TempleOSCDV4.12.ISO
This commit is contained in:
1 parent
93ca216483
commit
b84bbff6db
381 files changed
+18356
-18798
No files matched your search
@@ -132,7 +132,7 @@ Bool TakeTurn()
|
||||
}
|
||||
res=TRUE;
|
||||
}
|
||||
WinMgrSync;
|
||||
Refresh;
|
||||
Fs->song_task=NULL;
|
||||
return res;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ U0 TMsg(CDC *dc,U8 *msg)
|
||||
dc->color=YELLOW;
|
||||
GrPrint(dc,(GR_WIDTH-StrLen(msg)*FONT_WIDTH)/2,
|
||||
GR_HEIGHT-5*FONT_HEIGHT/2,"%s",msg);
|
||||
WinMgrSync;
|
||||
Refresh;
|
||||
if (ScanChar)
|
||||
throw;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -2,25 +2,25 @@ U0 ViewComics()
|
||||
{
|
||||
I64 i=0;
|
||||
U8 *st;
|
||||
CDirEntry *tempde=FilesFind("Comics/*.DD*"),*tempde1=tempde;
|
||||
CDirEntry *tmpde=FilesFind("Comics/*.DD*"),*tmpde1=tmpde;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrint(doc,"$$LTBLUE$$");
|
||||
while (tempde) {
|
||||
st=StrNew(tempde->name);
|
||||
while (tmpde) {
|
||||
st=StrNew(tmpde->name);
|
||||
FileExtRem(st);
|
||||
tempde->user_data=DocPrint(doc,"$$MU-UL,\"%-10ts\",LE=%d$$ ",st,tempde);
|
||||
tmpde->user_data=DocPrint(doc,"$$MU-UL,\"%-10ts\",LE=%d$$ ",st,tmpde);
|
||||
Free(st);
|
||||
tempde=tempde->next;
|
||||
tmpde=tmpde->next;
|
||||
if ((i++&3)==3)
|
||||
DocPrint(doc,"\n");
|
||||
}
|
||||
while (TRUE) {
|
||||
if ((tempde=PopUpMenu(doc))>0)
|
||||
Ed(tempde->full_name);
|
||||
if ((tmpde=PopUpMenu(doc))>0)
|
||||
Ed(tmpde->full_name);
|
||||
else
|
||||
break;
|
||||
}
|
||||
DocDel(doc);
|
||||
DirTreeDel(tempde1);
|
||||
DirTreeDel(tmpde1);
|
||||
}
|
||||
|
||||
+23
-23
@@ -7,47 +7,47 @@ U0 MPDrawHoreb(CDC *dc2)
|
||||
CDC *dc=DCAlias(dc2,task);
|
||||
I64 i,j,dx,dy,dz,w=task->pix_width,h=task->pix_height,r[16],cx=w>>1;
|
||||
F64 s,m,a,x1,y1,x2,y2;
|
||||
Obj *tempo;
|
||||
Obj *tmpo;
|
||||
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotY(r,-é);
|
||||
Mat4x4RotX(r,77*ã/180);
|
||||
for (i=Gs->num;i<O_NUM_OBJS+O_NUM_PEBBLES;i+=mp_cnt) {
|
||||
tempo=&objs[i];
|
||||
tempo->x1=tempo->x+vx; tempo->y1=tempo->y; tempo->z1=tempo->z+vz;
|
||||
Mat4x4MulXYZ(r,&tempo->x1,&tempo->y1,&tempo->z1);
|
||||
if (tempo->type==OT_SHEEP ||
|
||||
tempo->type==OT_GOAT1 || tempo->type==OT_GOAT2) {
|
||||
dx=100*tempo->dx; dy=100*tempo->dy; dz=100*tempo->dz;
|
||||
tmpo=&objs[i];
|
||||
tmpo->x1=tmpo->x+vx; tmpo->y1=tmpo->y; tmpo->z1=tmpo->z+vz;
|
||||
Mat4x4MulXYZ(r,&tmpo->x1,&tmpo->y1,&tmpo->z1);
|
||||
if (tmpo->type==OT_SHEEP ||
|
||||
tmpo->type==OT_GOAT1 || tmpo->type==OT_GOAT2) {
|
||||
dx=100*tmpo->dx; dy=100*tmpo->dy; dz=100*tmpo->dz;
|
||||
Mat4x4MulXYZ(r,&dx,&dy,&dz);
|
||||
if (dx<0)
|
||||
tempo->sym=TRUE;
|
||||
tmpo->sym=TRUE;
|
||||
else
|
||||
tempo->sym=FALSE;
|
||||
tmpo->sym=FALSE;
|
||||
}
|
||||
if (tempo->z1>=0) {
|
||||
s=100.0/(AbsI64(tempo->z1)+50);
|
||||
if (tempo->type) {
|
||||
if (tmpo->z1>=0) {
|
||||
s=100.0/(AbsI64(tmpo->z1)+50);
|
||||
if (tmpo->type) {
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4Scale(dc->r,s*2);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
if (tempo->sym) {
|
||||
if (tmpo->sym) {
|
||||
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
|
||||
DCSymmetrySet(dc,s*tempo->x1+cx,s*tempo->y1+h,
|
||||
s*tempo->x1+cx,s*tempo->y1+h+10);
|
||||
DCSymmetrySet(dc,s*tmpo->x1+cx,s*tmpo->y1+h,
|
||||
s*tmpo->x1+cx,s*tmpo->y1+h+10);
|
||||
}
|
||||
Sprite3B(dc,s*tempo->x1+cx,s*tempo->y1+h,tempo->z1,imgs[tempo->type]);
|
||||
Sprite3B(dc,s*tmpo->x1+cx,s*tmpo->y1+h,tmpo->z1,imgs[tmpo->type]);
|
||||
} else {
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
dc->color=pebble_colors[tempo->num&3];
|
||||
GrPlot3(dc,s*tempo->x1+cx,s*tempo->y1+h,tempo->z1);
|
||||
dc->color=pebble_colors[tmpo->num&3];
|
||||
GrPlot3(dc,s*tmpo->x1+cx,s*tmpo->y1+h,tmpo->z1);
|
||||
}
|
||||
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
|
||||
if (tempo==&objs[O_BURNING_BUSH]) {//draw burning bush
|
||||
dc->x=s*tempo->x1+cx;
|
||||
dc->y=s*tempo->y1+h;
|
||||
dc->z=tempo->z1;
|
||||
if (tmpo==&objs[O_BURNING_BUSH]) {//draw burning bush
|
||||
dc->x=s*tmpo->x1+cx;
|
||||
dc->y=s*tmpo->y1+h;
|
||||
dc->z=tmpo->z1;
|
||||
dc->pen_width=1;
|
||||
dc->color=winmgr.updates&15;
|
||||
for (j=0;j<45;j++) {
|
||||
@@ -57,7 +57,7 @@ U0 MPDrawHoreb(CDC *dc2)
|
||||
P2R(&x2,&y2,m,a);
|
||||
GrLine3(dc,20*x1,20*y1-25,0,20*x2,20*y2-25,0);
|
||||
}
|
||||
if (SqrI64(s*tempo->x1)+SqrI64(s*tempo->y1)<300*300)
|
||||
if (SqrI64(s*tmpo->x1)+SqrI64(s*tmpo->y1)<300*300)
|
||||
horeb_done=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
+23
-23
@@ -12,7 +12,7 @@ U0 DrawHoreb(CTask *task,CDC *dc)
|
||||
h=task->pix_height,r[16],
|
||||
cx=w>>1,cy=h>>1;
|
||||
F64 s,m,a,x1,y1,x2,y2;
|
||||
Obj *o_sort[O_NUM_OBJS+O_NUM_PEBBLES],*tempo;
|
||||
Obj *o_sort[O_NUM_OBJS+O_NUM_PEBBLES],*tmpo;
|
||||
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotY(r,-é);
|
||||
@@ -30,46 +30,46 @@ U0 DrawHoreb(CTask *task,CDC *dc)
|
||||
}
|
||||
|
||||
for (i=0;i<O_NUM_OBJS+O_NUM_PEBBLES;i++) {
|
||||
tempo=&objs[i];
|
||||
o_sort[i]=tempo;
|
||||
tempo->x1=tempo->x+vx; tempo->y1=tempo->y; tempo->z1=tempo->z+vz;
|
||||
Mat4x4MulXYZ(r,&tempo->x1,&tempo->y1,&tempo->z1);
|
||||
if (tempo->type==OT_SHEEP ||
|
||||
tempo->type==OT_GOAT1 || tempo->type==OT_GOAT2) {
|
||||
dx=100*tempo->dx; dy=100*tempo->dy; dz=100*tempo->dz;
|
||||
tmpo=&objs[i];
|
||||
o_sort[i]=tmpo;
|
||||
tmpo->x1=tmpo->x+vx; tmpo->y1=tmpo->y; tmpo->z1=tmpo->z+vz;
|
||||
Mat4x4MulXYZ(r,&tmpo->x1,&tmpo->y1,&tmpo->z1);
|
||||
if (tmpo->type==OT_SHEEP ||
|
||||
tmpo->type==OT_GOAT1 || tmpo->type==OT_GOAT2) {
|
||||
dx=100*tmpo->dx; dy=100*tmpo->dy; dz=100*tmpo->dz;
|
||||
Mat4x4MulXYZ(r,&dx,&dy,&dz);
|
||||
if (dx<0)
|
||||
tempo->sym=TRUE;
|
||||
tmpo->sym=TRUE;
|
||||
else
|
||||
tempo->sym=FALSE;
|
||||
tmpo->sym=FALSE;
|
||||
}
|
||||
}
|
||||
QSortI64(o_sort,O_NUM_OBJS+O_NUM_PEBBLES,&ObjCompare);
|
||||
|
||||
for (i=0;i<O_NUM_OBJS+O_NUM_PEBBLES;i++) {
|
||||
tempo=o_sort[i];
|
||||
if (tempo->z1<0) break;
|
||||
s=100.0/(AbsI64(tempo->z1)+50);
|
||||
if (tempo->type) {
|
||||
tmpo=o_sort[i];
|
||||
if (tmpo->z1<0) break;
|
||||
s=100.0/(AbsI64(tmpo->z1)+50);
|
||||
if (tmpo->type) {
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4Scale(dc->r,s*2);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
if (tempo->sym) {
|
||||
if (tmpo->sym) {
|
||||
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
|
||||
DCSymmetrySet(dc,s*tempo->x1+cx,s*tempo->y1+h,
|
||||
s*tempo->x1+cx,s*tempo->y1+h+10);
|
||||
DCSymmetrySet(dc,s*tmpo->x1+cx,s*tmpo->y1+h,
|
||||
s*tmpo->x1+cx,s*tmpo->y1+h+10);
|
||||
}
|
||||
Sprite3B(dc,s*tempo->x1+cx,s*tempo->y1+h,0,imgs[tempo->type]);
|
||||
Sprite3B(dc,s*tmpo->x1+cx,s*tmpo->y1+h,0,imgs[tmpo->type]);
|
||||
} else {
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
dc->color=pebble_colors[tempo->num&3];
|
||||
GrPlot3(dc,s*tempo->x1+cx,s*tempo->y1+h,tempo->z1);
|
||||
dc->color=pebble_colors[tmpo->num&3];
|
||||
GrPlot3(dc,s*tmpo->x1+cx,s*tmpo->y1+h,tmpo->z1);
|
||||
}
|
||||
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
|
||||
if (o_sort[i]==&objs[O_BURNING_BUSH]) {//draw burning bush
|
||||
dc->x=s*tempo->x1+cx;
|
||||
dc->y=s*tempo->y1+h;
|
||||
dc->x=s*tmpo->x1+cx;
|
||||
dc->y=s*tmpo->y1+h;
|
||||
dc->z=0;
|
||||
|
||||
dc->pen_width=1;
|
||||
@@ -82,7 +82,7 @@ U0 DrawHoreb(CTask *task,CDC *dc)
|
||||
GrLine3(dc,20*x1,20*y1-25,0,20*x2,20*y2-25,0);
|
||||
}
|
||||
|
||||
if (SqrI64(s*tempo->x1)+SqrI64(s*tempo->y1)<300*300)
|
||||
if (SqrI64(s*tmpo->x1)+SqrI64(s*tmpo->y1)<300*300)
|
||||
horeb_done=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
+19
-19
@@ -2,18 +2,18 @@ U0 AnimateTask(I64)
|
||||
{
|
||||
I64 i;
|
||||
F64 t;
|
||||
Obj *tempo;
|
||||
Obj *tmpo;
|
||||
while (TRUE) {
|
||||
t=tS;
|
||||
for (i=0;i<O_NUM_OBJS+O_NUM_PEBBLES;i++) {
|
||||
tempo=&objs[i];
|
||||
if (tempo->type==OT_SHEEP ||
|
||||
tempo->type==OT_GOAT1 || tempo->type==OT_GOAT2) {
|
||||
tempo->x+=tempo->dx;
|
||||
tempo->y+=tempo->dy;
|
||||
tempo->z+=tempo->dz;
|
||||
tempo->dx=5*Cos(0.5*t+tempo->é);
|
||||
tempo->dz=5*Sin(0.5*t+tempo->é);
|
||||
tmpo=&objs[i];
|
||||
if (tmpo->type==OT_SHEEP ||
|
||||
tmpo->type==OT_GOAT1 || tmpo->type==OT_GOAT2) {
|
||||
tmpo->x+=tmpo->dx;
|
||||
tmpo->y+=tmpo->dy;
|
||||
tmpo->z+=tmpo->dz;
|
||||
tmpo->dx=5*Cos(0.5*t+tmpo->é);
|
||||
tmpo->dz=5*Sin(0.5*t+tmpo->é);
|
||||
}
|
||||
}
|
||||
Sleep(20);
|
||||
@@ -22,7 +22,7 @@ U0 AnimateTask(I64)
|
||||
|
||||
U0 Init()
|
||||
{
|
||||
Obj *tempo;
|
||||
Obj *tmpo;
|
||||
I64 i,j,k,total=0;
|
||||
|
||||
for (i=0;i<OT_NUM_TYPES;i++)
|
||||
@@ -30,13 +30,13 @@ U0 Init()
|
||||
|
||||
MemSet(objs,0,sizeof(objs));
|
||||
for (i=0;i<O_NUM_OBJS+O_NUM_PEBBLES;i++) {
|
||||
tempo=&objs[i];
|
||||
tempo->num=i;
|
||||
tempo->x=RandU32&0x1FFF-0x1000;
|
||||
tempo->y=0;
|
||||
tempo->z=RandU32&0x1FFF-0x1000;
|
||||
tempo->é=2*ã*Rand;
|
||||
tempo->sym=RandU16&1;
|
||||
tmpo=&objs[i];
|
||||
tmpo->num=i;
|
||||
tmpo->x=RandU32&0x1FFF-0x1000;
|
||||
tmpo->y=0;
|
||||
tmpo->z=RandU32&0x1FFF-0x1000;
|
||||
tmpo->é=2*ã*Rand;
|
||||
tmpo->sym=RandU16&1;
|
||||
|
||||
if (i<O_NUM_OBJS) {
|
||||
k=0;
|
||||
@@ -48,9 +48,9 @@ U0 Init()
|
||||
else
|
||||
k++;
|
||||
}
|
||||
tempo->type=k;
|
||||
tmpo->type=k;
|
||||
} else
|
||||
tempo->type=OT_PEBBLE;
|
||||
tmpo->type=OT_PEBBLE;
|
||||
}
|
||||
objs[O_BURNING_BUSH].type=OT_BUSH1;
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+22
-22
@@ -1,24 +1,24 @@
|
||||
U0 BgtAcctsUpdate()
|
||||
{
|
||||
CBgtEntry *tempb;
|
||||
CBgtTemplate *tempt;
|
||||
tempb=b_head.next;
|
||||
while (tempb!=&b_head) {
|
||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||
tempb->credit_idx=StrFileAdd(tempb->credit,
|
||||
CBgtEntry *tmpb;
|
||||
CBgtTemplate *tmpt;
|
||||
tmpb=b_head.next;
|
||||
while (tmpb!=&b_head) {
|
||||
if (tmpb->type!=BE_TEMPLATE_COPY) {
|
||||
tmpb->credit_idx=StrFileAdd(tmpb->credit,
|
||||
&accts_table_strs,accts_table);
|
||||
tempb->debit_idx =StrFileAdd(tempb->debit,
|
||||
tmpb->debit_idx =StrFileAdd(tmpb->debit,
|
||||
&accts_table_strs,accts_table);
|
||||
}
|
||||
tempb=tempb->next;
|
||||
tmpb=tmpb->next;
|
||||
}
|
||||
tempt=t_head.next;
|
||||
while (tempt!=&t_head) {
|
||||
tempt->b.credit_idx=StrFileAdd(tempt->b.credit,
|
||||
tmpt=t_head.next;
|
||||
while (tmpt!=&t_head) {
|
||||
tmpt->b.credit_idx=StrFileAdd(tmpt->b.credit,
|
||||
&accts_table_strs,accts_table);
|
||||
tempt->b.debit_idx =StrFileAdd(tempt->b.debit,
|
||||
tmpt->b.debit_idx =StrFileAdd(tmpt->b.debit,
|
||||
&accts_table_strs,accts_table);
|
||||
tempt=tempt->next;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ U0 BgtAcctsRead()
|
||||
|
||||
I64 BgtAcctColor(U8 *st)
|
||||
{
|
||||
CHashGeneric *temph;
|
||||
if (temph=HashFind(st,accts_table,SFT_GENERIC))
|
||||
return temph->user_data1;
|
||||
CHashGeneric *tmph;
|
||||
if (tmph=HashFind(st,accts_table,SFT_GENERIC))
|
||||
return tmph->user_data1;
|
||||
else
|
||||
return BLACK;
|
||||
}
|
||||
@@ -57,19 +57,19 @@ U8 *BgtPopUpAcct(U8 *header=NULL,U8 *dft=NULL)
|
||||
U8 *res;
|
||||
CDoc *doc=DocNew;
|
||||
CDocEntry *doc_e,*doc_dft=NULL;
|
||||
CHashGeneric *temph;
|
||||
CHashGeneric *tmph;
|
||||
|
||||
if (header)
|
||||
DocPrint(doc,"%s",header);
|
||||
|
||||
for (i=0;i<=accts_table->mask;i++) {
|
||||
temph=accts_table->body[i];
|
||||
while (temph) {
|
||||
tmph=accts_table->body[i];
|
||||
while (tmph) {
|
||||
doc_e=DocPrint(doc,"$$FG,%d$$$$MU-UL,\"%s\",LE=0x%X$$\n",
|
||||
temph->user_data1,temph->str,temph->str);
|
||||
if (dft && !StrCmp(dft,temph->str))
|
||||
tmph->user_data1,tmph->str,tmph->str);
|
||||
if (dft && !StrCmp(dft,tmph->str))
|
||||
doc_dft=doc_e;
|
||||
temph=temph->next;
|
||||
tmph=tmph->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+24
-24
@@ -1,24 +1,24 @@
|
||||
U0 BgtEntryDel2(CBgtEntry *tempb)
|
||||
U0 BgtEntryDel2(CBgtEntry *tmpb)
|
||||
{
|
||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||
Free(tempb->credit);
|
||||
Free(tempb->debit);
|
||||
Free(tempb->desc);
|
||||
if (tmpb->type!=BE_TEMPLATE_COPY) {
|
||||
Free(tmpb->credit);
|
||||
Free(tmpb->debit);
|
||||
Free(tmpb->desc);
|
||||
}
|
||||
}
|
||||
|
||||
U0 BgtEntryDel(CBgtEntry *tempb)
|
||||
U0 BgtEntryDel(CBgtEntry *tmpb)
|
||||
{
|
||||
BgtEntryDel2(tempb);
|
||||
Free(tempb);
|
||||
BgtEntryDel2(tmpb);
|
||||
Free(tmpb);
|
||||
}
|
||||
|
||||
U0 BgtIns(CBgtEntry *tempb)
|
||||
U0 BgtIns(CBgtEntry *tmpb)
|
||||
{
|
||||
CBgtEntry *tempb1=b_head.next;
|
||||
while (tempb1!=&b_head && tempb1->date<tempb->date)
|
||||
tempb1=tempb1->next;
|
||||
QueIns(tempb,tempb1->last);
|
||||
CBgtEntry *tmpb1=b_head.next;
|
||||
while (tmpb1!=&b_head && tmpb1->date<tmpb->date)
|
||||
tmpb1=tmpb1->next;
|
||||
QueIns(tmpb,tmpb1->last);
|
||||
}
|
||||
|
||||
class CBgtEntryForm
|
||||
@@ -33,7 +33,7 @@ class CBgtEntryForm
|
||||
CBgtEntry *BgtEntryPmt(CBgtEntry *dft=NULL)
|
||||
{
|
||||
CBgtEntryForm b;
|
||||
CBgtEntry *tempb;
|
||||
CBgtEntry *tmpb;
|
||||
U8 *st;
|
||||
MemSet(&b,0,sizeof(CBgtEntryForm));
|
||||
StrCpy(&b.date,"*");
|
||||
@@ -55,16 +55,16 @@ CBgtEntry *BgtEntryPmt(CBgtEntry *dft=NULL)
|
||||
if (st!=DOCM_CANCEL)
|
||||
StrCpy(b.debit,st);
|
||||
} else {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
tempb->date =Str2Date(b.date);
|
||||
tempb->amount=b.amount;
|
||||
tempb->credit=StrNew(b.credit);
|
||||
tempb->debit =StrNew(b.debit);
|
||||
tempb->desc =StrNew(b.desc);
|
||||
tempb->type =BE_NORMAL;
|
||||
StrFileAdd(tempb->credit,&accts_table_strs,accts_table);
|
||||
StrFileAdd(tempb->debit,&accts_table_strs,accts_table);
|
||||
return tempb;
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
tmpb->date =Str2Date(b.date);
|
||||
tmpb->amount=b.amount;
|
||||
tmpb->credit=StrNew(b.credit);
|
||||
tmpb->debit =StrNew(b.debit);
|
||||
tmpb->desc =StrNew(b.desc);
|
||||
tmpb->type =BE_NORMAL;
|
||||
StrFileAdd(tmpb->credit,&accts_table_strs,accts_table);
|
||||
StrFileAdd(tmpb->debit,&accts_table_strs,accts_table);
|
||||
return tmpb;
|
||||
}
|
||||
} else
|
||||
return NULL;
|
||||
|
||||
+59
-59
@@ -1,7 +1,7 @@
|
||||
U0 BgtDataRead()
|
||||
{
|
||||
CBgtEntry *tempb;
|
||||
CBgtTemplate *tempt;
|
||||
CBgtEntry *tmpb;
|
||||
CBgtTemplate *tmpt;
|
||||
I64 i,cnt,size;
|
||||
U8 *b,*ptr;
|
||||
I64 max_num;
|
||||
@@ -17,26 +17,26 @@ U0 BgtDataRead()
|
||||
if (ptr=b=FileRead(BGT_DATA_FILE,&size)) {
|
||||
cnt=*ptr(I64 *)++;
|
||||
for (i=0;i<cnt;i++) {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(&tempb->start,ptr,BE_SIZE);
|
||||
tempb->credit=StrNew(s[tempb->credit_idx]);
|
||||
tempb->debit =StrNew(s[tempb->debit_idx]);
|
||||
tempb->desc =StrNew(s[tempb->desc_idx]);
|
||||
QueIns(tempb,b_head.last);
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(&tmpb->start,ptr,BE_SIZE);
|
||||
tmpb->credit=StrNew(s[tmpb->credit_idx]);
|
||||
tmpb->debit =StrNew(s[tmpb->debit_idx]);
|
||||
tmpb->desc =StrNew(s[tmpb->desc_idx]);
|
||||
QueIns(tmpb,b_head.last);
|
||||
ptr+=BE_SIZE;
|
||||
}
|
||||
|
||||
cnt=*ptr(I64 *)++;
|
||||
for (i=0;i<cnt;i++) {
|
||||
tempt=CAlloc(sizeof(CBgtTemplate));
|
||||
MemCpy(&tempt->start,ptr,BT_SIZE);
|
||||
tmpt=CAlloc(sizeof(CBgtTemplate));
|
||||
MemCpy(&tmpt->start,ptr,BT_SIZE);
|
||||
ptr+=BT_SIZE;
|
||||
MemCpy(&tempt->b.start,ptr,BE_SIZE);
|
||||
MemCpy(&tmpt->b.start,ptr,BE_SIZE);
|
||||
ptr+=BE_SIZE;
|
||||
tempt->b.credit=StrNew(s[tempt->b.credit_idx]);
|
||||
tempt->b.debit =StrNew(s[tempt->b.debit_idx]);
|
||||
tempt->b.desc =StrNew(s[tempt->b.desc_idx]);
|
||||
QueIns(tempt,t_head.last);
|
||||
tmpt->b.credit=StrNew(s[tmpt->b.credit_idx]);
|
||||
tmpt->b.debit =StrNew(s[tmpt->b.debit_idx]);
|
||||
tmpt->b.desc =StrNew(s[tmpt->b.desc_idx]);
|
||||
QueIns(tmpt,t_head.last);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,39 +50,39 @@ U0 BgtDataWrite()
|
||||
{
|
||||
I64 i,num=0,size,cnt1,cnt2;
|
||||
CHashTable *table=HashTableNew(1024);
|
||||
CBgtEntry *tempb;
|
||||
CBgtTemplate *tempt;
|
||||
CHashGeneric *temph;
|
||||
CBgtEntry *tmpb;
|
||||
CBgtTemplate *tmpt;
|
||||
CHashGeneric *tmph;
|
||||
U8 *buf,*ptr;
|
||||
|
||||
for (i=0;i<=accts_table->mask;i++) {
|
||||
temph=accts_table->body[i];
|
||||
while (temph) {
|
||||
StrFileAdd(temph->str,&num,table); //Cosmetics -- make accts appear first.
|
||||
temph=temph->next;
|
||||
tmph=accts_table->body[i];
|
||||
while (tmph) {
|
||||
StrFileAdd(tmph->str,&num,table); //Cosmetics -- make accts appear first.
|
||||
tmph=tmph->next;
|
||||
}
|
||||
}
|
||||
|
||||
tempb=b_head.next;
|
||||
tmpb=b_head.next;
|
||||
cnt1=0;
|
||||
while (tempb!=&b_head) {
|
||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||
tempb->credit_idx =StrFileAdd(tempb->credit,&num,table);
|
||||
tempb->debit_idx =StrFileAdd(tempb->debit,&num,table);
|
||||
tempb->desc_idx =StrFileAdd(tempb->desc,&num,table);
|
||||
while (tmpb!=&b_head) {
|
||||
if (tmpb->type!=BE_TEMPLATE_COPY) {
|
||||
tmpb->credit_idx =StrFileAdd(tmpb->credit,&num,table);
|
||||
tmpb->debit_idx =StrFileAdd(tmpb->debit,&num,table);
|
||||
tmpb->desc_idx =StrFileAdd(tmpb->desc,&num,table);
|
||||
cnt1++;
|
||||
}
|
||||
tempb=tempb->next;
|
||||
tmpb=tmpb->next;
|
||||
}
|
||||
|
||||
tempt=t_head.next;
|
||||
tmpt=t_head.next;
|
||||
cnt2=0;
|
||||
while (tempt!=&t_head) {
|
||||
tempt->b.credit_idx =StrFileAdd(tempt->b.credit,&num,table);
|
||||
tempt->b.debit_idx =StrFileAdd(tempt->b.debit,&num,table);
|
||||
tempt->b.desc_idx =StrFileAdd(tempt->b.desc,&num,table);
|
||||
while (tmpt!=&t_head) {
|
||||
tmpt->b.credit_idx =StrFileAdd(tmpt->b.credit,&num,table);
|
||||
tmpt->b.debit_idx =StrFileAdd(tmpt->b.debit,&num,table);
|
||||
tmpt->b.desc_idx =StrFileAdd(tmpt->b.desc,&num,table);
|
||||
cnt2++;
|
||||
tempt=tempt->next;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
StrFileWrite(BGT_STRINGS_FILE,table);
|
||||
StrFileDel(table);
|
||||
@@ -92,24 +92,24 @@ U0 BgtDataWrite()
|
||||
|
||||
MemCpy(ptr,&cnt1,sizeof(I64));
|
||||
ptr+=sizeof(I64);
|
||||
tempb=b_head.next;
|
||||
while (tempb!=&b_head) {
|
||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||
MemCpy(ptr,&tempb->start,BE_SIZE);
|
||||
tmpb=b_head.next;
|
||||
while (tmpb!=&b_head) {
|
||||
if (tmpb->type!=BE_TEMPLATE_COPY) {
|
||||
MemCpy(ptr,&tmpb->start,BE_SIZE);
|
||||
ptr+=BE_SIZE;
|
||||
}
|
||||
tempb=tempb->next;
|
||||
tmpb=tmpb->next;
|
||||
}
|
||||
|
||||
MemCpy(ptr,&cnt2,sizeof(I64));
|
||||
ptr+=sizeof(I64);
|
||||
tempt=t_head.next;
|
||||
while (tempt!=&t_head) {
|
||||
MemCpy(ptr,&tempt->start,BT_SIZE);
|
||||
tmpt=t_head.next;
|
||||
while (tmpt!=&t_head) {
|
||||
MemCpy(ptr,&tmpt->start,BT_SIZE);
|
||||
ptr+=BT_SIZE;
|
||||
MemCpy(ptr,&tempt->b.start,BE_SIZE);
|
||||
MemCpy(ptr,&tmpt->b.start,BE_SIZE);
|
||||
ptr+=BE_SIZE;
|
||||
tempt=tempt->next;
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
|
||||
FileWrite(BGT_DATA_FILE,buf,size);
|
||||
@@ -118,21 +118,21 @@ U0 BgtDataWrite()
|
||||
|
||||
U0 BgtDel()
|
||||
{
|
||||
CBgtEntry *tempb,*tempb1;
|
||||
CBgtTemplate *tempt,*tempt1;
|
||||
tempb=b_head.next;
|
||||
while (tempb!=&b_head) {
|
||||
tempb1=tempb->next;
|
||||
BgtEntryDel2(tempb);
|
||||
Free(tempb);
|
||||
tempb=tempb1;
|
||||
CBgtEntry *tmpb,*tmpb1;
|
||||
CBgtTemplate *tmpt,*tmpt1;
|
||||
tmpb=b_head.next;
|
||||
while (tmpb!=&b_head) {
|
||||
tmpb1=tmpb->next;
|
||||
BgtEntryDel2(tmpb);
|
||||
Free(tmpb);
|
||||
tmpb=tmpb1;
|
||||
}
|
||||
tempt=t_head.next;
|
||||
while (tempt!=&t_head) {
|
||||
tempt1=tempt->next;
|
||||
BgtEntryDel2(&tempt->b);
|
||||
Free(tempt);
|
||||
tempt=tempt1;
|
||||
tmpt=t_head.next;
|
||||
while (tmpt!=&t_head) {
|
||||
tmpt1=tmpt->next;
|
||||
BgtEntryDel2(&tmpt->b);
|
||||
Free(tmpt);
|
||||
tmpt=tmpt1;
|
||||
}
|
||||
StrFileDel(accts_table);
|
||||
accts_table=NULL;
|
||||
|
||||
+49
-49
@@ -3,30 +3,30 @@ extern U0 BgtRegen();
|
||||
Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
|
||||
{//ch=ASCII; sc=scan_code
|
||||
no_warn sc;
|
||||
CBgtEntry *tempb,*tempb1;
|
||||
CBgtTemplate *tempt,*tempt1;
|
||||
CBgtEntry *tmpb,*tmpb1;
|
||||
CBgtTemplate *tmpt,*tmpt1;
|
||||
CDocEntry *doc_ce;
|
||||
U8 *st;
|
||||
switch (ch) {
|
||||
case '\n':
|
||||
if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
|
||||
doc_ce->type_u8==DOCT_MENU_VAL) {
|
||||
tempb=doc_ce->user_data;
|
||||
if (tempt=tempb->template) {
|
||||
if (tempt1=BgtTemplatePmt(tempt)) {
|
||||
QueRem(tempt);
|
||||
BgtTemplatePurge(tempt);
|
||||
BgtEntryDel2(&tempt->b);
|
||||
Free(tempt);
|
||||
QueIns(tempt1,t_head.last);
|
||||
BgtTemplateExpand(tempt1);
|
||||
tmpb=doc_ce->user_data;
|
||||
if (tmpt=tmpb->template) {
|
||||
if (tmpt1=BgtTemplatePmt(tmpt)) {
|
||||
QueRem(tmpt);
|
||||
BgtTemplatePurge(tmpt);
|
||||
BgtEntryDel2(&tmpt->b);
|
||||
Free(tmpt);
|
||||
QueIns(tmpt1,t_head.last);
|
||||
BgtTemplateExpand(tmpt1);
|
||||
BgtRegen;
|
||||
}
|
||||
} else {
|
||||
if (tempb1=BgtEntryPmt(tempb)) {
|
||||
QueRem(tempb);
|
||||
BgtEntryDel(tempb);
|
||||
BgtIns(tempb1);
|
||||
if (tmpb1=BgtEntryPmt(tmpb)) {
|
||||
QueRem(tmpb);
|
||||
BgtEntryDel(tmpb);
|
||||
BgtIns(tmpb1);
|
||||
BgtRegen;
|
||||
}
|
||||
}
|
||||
@@ -35,15 +35,15 @@ Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
|
||||
case CH_CTRLY:
|
||||
if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
|
||||
doc_ce->type_u8==DOCT_MENU_VAL) {
|
||||
tempb=doc_ce->user_data;
|
||||
if (tempt=tempb->template) {
|
||||
QueRem(tempt);
|
||||
BgtTemplatePurge(tempt);
|
||||
BgtEntryDel2(&tempt->b);
|
||||
Free(tempt);
|
||||
tmpb=doc_ce->user_data;
|
||||
if (tmpt=tmpb->template) {
|
||||
QueRem(tmpt);
|
||||
BgtTemplatePurge(tmpt);
|
||||
BgtEntryDel2(&tmpt->b);
|
||||
Free(tmpt);
|
||||
} else {
|
||||
QueRem(tempb);
|
||||
BgtEntryDel(tempb);
|
||||
QueRem(tmpb);
|
||||
BgtEntryDel(tmpb);
|
||||
}
|
||||
BgtRegen;
|
||||
}
|
||||
@@ -64,26 +64,26 @@ Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
|
||||
}
|
||||
return TRUE;
|
||||
case 'n':
|
||||
if (tempb1=BgtEntryPmt) {
|
||||
BgtIns(tempb1);
|
||||
if (tmpb1=BgtEntryPmt) {
|
||||
BgtIns(tmpb1);
|
||||
BgtRegen;
|
||||
}
|
||||
return TRUE;
|
||||
case 't':
|
||||
if (tempt1=BgtTemplatePmt) {
|
||||
QueIns(tempt1,t_head.last);
|
||||
BgtTemplateExpand(tempt1);
|
||||
if (tmpt1=BgtTemplatePmt) {
|
||||
QueIns(tmpt1,t_head.last);
|
||||
BgtTemplateExpand(tmpt1);
|
||||
BgtRegen;
|
||||
}
|
||||
return TRUE;
|
||||
case 'c':
|
||||
if ((doc_ce=doc->cur_entry) && doc_ce!=doc &&
|
||||
doc_ce->type_u8==DOCT_MENU_VAL)
|
||||
tempb=doc_ce->user_data;
|
||||
tmpb=doc_ce->user_data;
|
||||
else
|
||||
tempb=NULL;
|
||||
if (tempb1=BgtEntryPmt(tempb)) {
|
||||
BgtIns(tempb1);
|
||||
tmpb=NULL;
|
||||
if (tmpb1=BgtEntryPmt(tmpb)) {
|
||||
BgtIns(tmpb1);
|
||||
BgtRegen;
|
||||
}
|
||||
return TRUE;
|
||||
@@ -97,24 +97,24 @@ U0 BgtRegen()
|
||||
F64 balance=0;
|
||||
CDoc *doc,*pdoc,*ddoc;
|
||||
CDocEntry *doc_ce;
|
||||
CBgtEntry *tempb=b_head.next,*tempb_ce;
|
||||
CBgtEntry *tmpb=b_head.next,*tmpb_ce;
|
||||
doc=DocNew;
|
||||
doc->flags|=DOCF_FORM;
|
||||
while (tempb!=&b_head) {
|
||||
if (!StrCmp(view_acct,tempb->credit))
|
||||
balance-=tempb->amount;
|
||||
if (!StrCmp(view_acct,tempb->debit))
|
||||
balance+=tempb->amount;
|
||||
c=BgtAcctColor(tempb->credit);
|
||||
while (tmpb!=&b_head) {
|
||||
if (!StrCmp(view_acct,tmpb->credit))
|
||||
balance-=tmpb->amount;
|
||||
if (!StrCmp(view_acct,tmpb->debit))
|
||||
balance+=tmpb->amount;
|
||||
c=BgtAcctColor(tmpb->credit);
|
||||
if (c!=color) {
|
||||
color=c;
|
||||
DocPrint(doc,"$$FG,%d$$",color);
|
||||
}
|
||||
tempb->doc_e=DocPrint(doc,
|
||||
tmpb->doc_e=DocPrint(doc,
|
||||
"$$MU-UL,\"%D %8ts %8ts:%8.2f %8.2f:%$$Q\",U=0x%X$$\n",
|
||||
tempb->date,tempb->credit,tempb->debit,balance,
|
||||
tempb->amount,tempb->desc,tempb);
|
||||
tempb=tempb->next;
|
||||
tmpb->date,tmpb->credit,tmpb->debit,balance,
|
||||
tmpb->amount,tmpb->desc,tmpb);
|
||||
tmpb=tmpb->next;
|
||||
}
|
||||
DocRecalc(doc);
|
||||
|
||||
@@ -130,19 +130,19 @@ U0 BgtRegen()
|
||||
doc_ce=pdoc->cur_entry;
|
||||
timeout_jiffy=cnts.jiffies+JIFFY_FREQ; //Max one second.
|
||||
while (doc_ce!=pdoc && cnts.jiffies<timeout_jiffy) {
|
||||
while (doc_ce->type_u8!=DOCT_MENU_VAL || !(tempb_ce=doc_ce->user_data)) {
|
||||
while (doc_ce->type_u8!=DOCT_MENU_VAL || !(tmpb_ce=doc_ce->user_data)) {
|
||||
doc_ce=doc_ce->next;
|
||||
if (doc_ce==pdoc) goto br_cont;
|
||||
}
|
||||
tempb=b_head.next;
|
||||
while (tempb!=&b_head) {
|
||||
if (tempb==tempb_ce) {
|
||||
doc->cur_entry=tempb->doc_e;
|
||||
tmpb=b_head.next;
|
||||
while (tmpb!=&b_head) {
|
||||
if (tmpb==tmpb_ce) {
|
||||
doc->cur_entry=tmpb->doc_e;
|
||||
doc->cur_col=0;
|
||||
DocCenter(doc);
|
||||
goto br_cont;
|
||||
}
|
||||
tempb=tempb->next;
|
||||
tmpb=tmpb->next;
|
||||
}
|
||||
doc_ce=doc_ce->next;
|
||||
}
|
||||
|
||||
+27
-27
@@ -57,18 +57,18 @@ public U0 StrFileArrDel(U8 **a,I64 max_num)
|
||||
public I64 StrFileAdd(U8 *st,I64 *_num,
|
||||
CHashTable *table,I64 color=COLOR_INVALID)
|
||||
{
|
||||
CHashGeneric *temph;
|
||||
CHashGeneric *tmph;
|
||||
if (!st) return 0;
|
||||
if (!(temph=HashFind(st,table,SFT_GENERIC))) {
|
||||
temph=CAlloc(sizeof(CHashGeneric));
|
||||
temph->type=SFT_GENERIC;
|
||||
temph->str=StrNew(st);
|
||||
temph->user_data0=(*_num)++;
|
||||
HashAdd(temph,table);
|
||||
if (!(tmph=HashFind(st,table,SFT_GENERIC))) {
|
||||
tmph=CAlloc(sizeof(CHashGeneric));
|
||||
tmph->type=SFT_GENERIC;
|
||||
tmph->str=StrNew(st);
|
||||
tmph->user_data0=(*_num)++;
|
||||
HashAdd(tmph,table);
|
||||
}
|
||||
if (color!=COLOR_INVALID)
|
||||
temph->user_data1=color;
|
||||
return temph->user_data0;
|
||||
tmph->user_data1=color;
|
||||
return tmph->user_data0;
|
||||
}
|
||||
|
||||
I64 StrEntriesCompare(CHashGeneric *h1,CHashGeneric *h2)
|
||||
@@ -80,7 +80,7 @@ public U0 StrFileWrite(U8 *name,CHashTable *table,Bool no_nums=FALSE)
|
||||
{
|
||||
I64 i,j,cnt,color=BLACK;
|
||||
CDoc *doc=DocNew(name);
|
||||
CHashGeneric *temph,**a;
|
||||
CHashGeneric *tmph,**a;
|
||||
if (table) {
|
||||
cnt=0; //Count Strings
|
||||
for (i=0;i<=table->mask;i++)
|
||||
@@ -88,23 +88,23 @@ public U0 StrFileWrite(U8 *name,CHashTable *table,Bool no_nums=FALSE)
|
||||
a=MAlloc(cnt*sizeof(CHashGeneric *));
|
||||
j=0; //Load Strings
|
||||
for (i=0;i<=table->mask;i++) {
|
||||
temph=table->body[i];
|
||||
while (temph) {
|
||||
a[j++]=temph;
|
||||
temph=temph->next;
|
||||
tmph=table->body[i];
|
||||
while (tmph) {
|
||||
a[j++]=tmph;
|
||||
tmph=tmph->next;
|
||||
}
|
||||
}
|
||||
QSortI64(a,cnt,&StrEntriesCompare);
|
||||
for (i=0;i<cnt;i++) {
|
||||
temph=a[i];
|
||||
if (temph->user_data1&15!=color) {
|
||||
DocPrint(doc,"$$FG,%d$$",temph->user_data1&15);
|
||||
color=temph->user_data1&15;
|
||||
tmph=a[i];
|
||||
if (tmph->user_data1&15!=color) {
|
||||
DocPrint(doc,"$$FG,%d$$",tmph->user_data1&15);
|
||||
color=tmph->user_data1&15;
|
||||
}
|
||||
if (no_nums)
|
||||
DocPrint(doc,"%s\n",temph->str);
|
||||
DocPrint(doc,"%s\n",tmph->str);
|
||||
else
|
||||
DocPrint(doc,"%d,%s\n",temph->user_data0,temph->str);
|
||||
DocPrint(doc,"%d,%s\n",tmph->user_data0,tmph->str);
|
||||
}
|
||||
Free(a);
|
||||
}
|
||||
@@ -116,15 +116,15 @@ public U0 StrFileWrite(U8 *name,CHashTable *table,Bool no_nums=FALSE)
|
||||
public U0 StrFileDel(CHashTable *table)
|
||||
{
|
||||
I64 i;
|
||||
CHashGeneric *temph,*temph1;
|
||||
CHashGeneric *tmph,*tmph1;
|
||||
if (!table) return;
|
||||
for (i=0;i<=table->mask;i++) {
|
||||
temph=table->body[i];
|
||||
while (temph) {
|
||||
temph1=temph->next;
|
||||
Free(temph->str);
|
||||
Free(temph);
|
||||
temph=temph1;
|
||||
tmph=table->body[i];
|
||||
while (tmph) {
|
||||
tmph1=tmph->next;
|
||||
Free(tmph->str);
|
||||
Free(tmph);
|
||||
tmph=tmph1;
|
||||
}
|
||||
}
|
||||
Free(table->body);
|
||||
|
||||
+54
-54
@@ -1,37 +1,37 @@
|
||||
U0 BgtTemplatePurge(CBgtTemplate *tempt)
|
||||
U0 BgtTemplatePurge(CBgtTemplate *tmpt)
|
||||
{
|
||||
CBgtEntry *tempb,*tempb1;
|
||||
tempb=b_head.next;
|
||||
while (tempb!=&b_head) {
|
||||
tempb1=tempb->next;
|
||||
if (tempb->template==tempt) {
|
||||
QueRem(tempb);
|
||||
BgtEntryDel2(tempb);
|
||||
Free(tempb);
|
||||
CBgtEntry *tmpb,*tmpb1;
|
||||
tmpb=b_head.next;
|
||||
while (tmpb!=&b_head) {
|
||||
tmpb1=tmpb->next;
|
||||
if (tmpb->template==tmpt) {
|
||||
QueRem(tmpb);
|
||||
BgtEntryDel2(tmpb);
|
||||
Free(tmpb);
|
||||
}
|
||||
tempb=tempb1;
|
||||
tmpb=tmpb1;
|
||||
}
|
||||
}
|
||||
|
||||
U0 BgtTemplateExpand(CBgtTemplate *tempt)
|
||||
U0 BgtTemplateExpand(CBgtTemplate *tmpt)
|
||||
{
|
||||
CDate d,start,end;
|
||||
CDateStruct ds;
|
||||
CBgtEntry *tempb;
|
||||
CBgtEntry *tmpb;
|
||||
|
||||
start=MyStr2Date(tempt->start_date);
|
||||
end =MyStr2Date(tempt->end_date);
|
||||
tempt->b.template=tempt;
|
||||
switch (tempt->type) {
|
||||
start=MyStr2Date(tmpt->start_date);
|
||||
end =MyStr2Date(tmpt->end_date);
|
||||
tmpt->b.template=tmpt;
|
||||
switch (tmpt->type) {
|
||||
case BT_INTERVAL:
|
||||
d=start;
|
||||
while (d<=end) {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
|
||||
tempb->date=d;
|
||||
tempb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tempb);
|
||||
d+=tempt->period*0x100000000;
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tmpb,&tmpt->b,sizeof(CBgtEntry));
|
||||
tmpb->date=d;
|
||||
tmpb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tmpb);
|
||||
d+=tmpt->period*0x100000000;
|
||||
}
|
||||
break;
|
||||
case BT_MONTHLY:
|
||||
@@ -39,11 +39,11 @@ U0 BgtTemplateExpand(CBgtTemplate *tempt)
|
||||
while (TRUE) {
|
||||
d=Struct2Date(&ds);
|
||||
if (d<=end) {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
|
||||
tempb->date=d;
|
||||
tempb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tempb);
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tmpb,&tmpt->b,sizeof(CBgtEntry));
|
||||
tmpb->date=d;
|
||||
tmpb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tmpb);
|
||||
} else
|
||||
break;
|
||||
if (++ds.mon>11) {
|
||||
@@ -57,11 +57,11 @@ U0 BgtTemplateExpand(CBgtTemplate *tempt)
|
||||
while (TRUE) {
|
||||
d=Struct2Date(&ds);
|
||||
if (d<=end) {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
|
||||
tempb->date=d;
|
||||
tempb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tempb);
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tmpb,&tmpt->b,sizeof(CBgtEntry));
|
||||
tmpb->date=d;
|
||||
tmpb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tmpb);
|
||||
} else
|
||||
break;
|
||||
ds.mon+=2;
|
||||
@@ -76,11 +76,11 @@ U0 BgtTemplateExpand(CBgtTemplate *tempt)
|
||||
while (TRUE) {
|
||||
d=Struct2Date(&ds);
|
||||
if (d<=end) {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
|
||||
tempb->date=d;
|
||||
tempb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tempb);
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tmpb,&tmpt->b,sizeof(CBgtEntry));
|
||||
tmpb->date=d;
|
||||
tmpb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tmpb);
|
||||
} else
|
||||
break;
|
||||
ds.mon+=6;
|
||||
@@ -95,11 +95,11 @@ U0 BgtTemplateExpand(CBgtTemplate *tempt)
|
||||
while (TRUE) {
|
||||
d=Struct2Date(&ds);
|
||||
if (d<=end) {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
|
||||
tempb->date=d;
|
||||
tempb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tempb);
|
||||
tmpb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(tmpb,&tmpt->b,sizeof(CBgtEntry));
|
||||
tmpb->date=d;
|
||||
tmpb->type=BE_TEMPLATE_COPY;
|
||||
BgtIns(tmpb);
|
||||
} else
|
||||
break;
|
||||
ds.year++;
|
||||
@@ -110,17 +110,17 @@ U0 BgtTemplateExpand(CBgtTemplate *tempt)
|
||||
|
||||
U0 CBgtTemplatesExpand()
|
||||
{
|
||||
CBgtTemplate *tempt=t_head.next;
|
||||
while (tempt!=&t_head) {
|
||||
BgtTemplateExpand(tempt);
|
||||
tempt=tempt->next;
|
||||
CBgtTemplate *tmpt=t_head.next;
|
||||
while (tmpt!=&t_head) {
|
||||
BgtTemplateExpand(tmpt);
|
||||
tmpt=tmpt->next;
|
||||
}
|
||||
}
|
||||
|
||||
CBgtTemplate *BgtTemplatePmt(CBgtTemplate *dft_t=NULL)
|
||||
{
|
||||
CBgtTemplate t,*tempt;
|
||||
CBgtEntry *tempb,*dft_b;
|
||||
CBgtTemplate t,*tmpt;
|
||||
CBgtEntry *tmpb,*dft_b;
|
||||
MemSet(&t,0,sizeof(CBgtTemplate));
|
||||
if (dft_t) {
|
||||
MemCpy(&t.start,&dft_t->start,BT_SIZE);
|
||||
@@ -134,12 +134,12 @@ CBgtTemplate *BgtTemplatePmt(CBgtTemplate *dft_t=NULL)
|
||||
while (TRUE)
|
||||
if (PopUpForm(&t) && ((t.type==BT_INTERVAL && t.period>0) ||
|
||||
t.type>BT_INTERVAL)) {
|
||||
if (tempb=BgtEntryPmt(dft_b)) {
|
||||
tempt=CAlloc(sizeof(CBgtTemplate));
|
||||
MemCpy(&tempt->start,&t.start,BT_SIZE);
|
||||
MemCpy(&tempt->b,tempb,sizeof(CBgtEntry));
|
||||
Free(tempb);
|
||||
return tempt;
|
||||
if (tmpb=BgtEntryPmt(dft_b)) {
|
||||
tmpt=CAlloc(sizeof(CBgtTemplate));
|
||||
MemCpy(&tmpt->start,&t.start,BT_SIZE);
|
||||
MemCpy(&tmpt->b,tmpb,sizeof(CBgtEntry));
|
||||
Free(tmpb);
|
||||
return tmpt;
|
||||
}
|
||||
} else
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define BGT_STRINGS_FILE "~/Budget/Strs.DD.Z"
|
||||
#define BGT_ACCTS_FILE "~/Budget/Accts.DD.Z"
|
||||
#define BGT_DATA_FILE "~/Budget/Bgt.DAT.Z"
|
||||
#define BGT_DATA_FILE "~/Budget/Bgt.DATA.Z"
|
||||
|
||||
#define BE_NORMAL 0
|
||||
#define BE_GAS 1
|
||||
|
||||
@@ -267,7 +267,7 @@ just to be different.
|
||||
|
||||
U0 DrawObj(CDC *dc,Obj *o,F64 tt)
|
||||
{
|
||||
U8 *temps;
|
||||
U8 *tmps;
|
||||
F64 r1=Max(9-0.1*o->z,1),r2=Max(r1/4,1);
|
||||
|
||||
if (o==human)
|
||||
@@ -280,11 +280,11 @@ U0 DrawObj(CDC *dc,Obj *o,F64 tt)
|
||||
if (o==ball)
|
||||
Sprite3(dc,o->x,(o->y-o->z)/2,GR_Z_ALL-o->y,$IB,"<1>",BI=1$);
|
||||
else {
|
||||
temps=SpriteInterpolate((tt-o->last_t0)/(o->next_t0-o->last_t0),
|
||||
tmps=SpriteInterpolate((tt-o->last_t0)/(o->next_t0-o->last_t0),
|
||||
imgs[o->last_img].img[o->team],
|
||||
imgs[o->next_img].img[o->team]);
|
||||
SpriteY3B(dc,o->x,(o->y-o->z)/2,GR_Z_ALL-o->y,temps,o->é);
|
||||
Free(temps);
|
||||
SpriteY3B(dc,o->x,(o->y-o->z)/2,GR_Z_ALL-o->y,tmps,o->é);
|
||||
Free(tmps);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,7 +616,7 @@ U0 AnimateTask(CTask *parent_task)
|
||||
}
|
||||
}
|
||||
}
|
||||
WinMgrSync;
|
||||
Refresh;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -580,7 +580,7 @@ U0 DigitalLogic()
|
||||
Fs->draw_it=&DrawIt;
|
||||
GetChar;
|
||||
DocClear;
|
||||
WinMgrSync(2,TRUE);
|
||||
Refresh(2,TRUE);
|
||||
DocBottom;
|
||||
}
|
||||
} catch
|
||||
|
||||
+24
-24
@@ -18,20 +18,20 @@ CTask *SingleSong(U8 *msg,U8 *name)
|
||||
Bool JBPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
|
||||
{//ch=ASCII; sc=scan_code
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_e;
|
||||
CDirEntry *tempde;
|
||||
CDirEntry *tmpde;
|
||||
CDoc *s;
|
||||
if (!(sc&(SCF_ALT|SCF_CTRL|SCF_SHIFT))
|
||||
&& doc_ce->type_u8==DOCT_MENU_VAL && doc_ce->left_exp>=0) {
|
||||
tempde=doc_ce->left_exp;
|
||||
tmpde=doc_ce->left_exp;
|
||||
if (sc.u8[0]==SC_DELETE ) {
|
||||
Beep;
|
||||
Silent;
|
||||
Del(tempde->full_name);
|
||||
Del(tmpde->full_name);
|
||||
Silent(OFF);
|
||||
} else if ('0'<=ch<='9') {
|
||||
if (StrLen(doc_ce->tag)>1)
|
||||
doc_ce->tag[0]=ch;
|
||||
s=DocRead(tempde->full_name);
|
||||
s=DocRead(tmpde->full_name);
|
||||
doc_e=s->head.next;
|
||||
while (doc_e!=s && doc_e->type_u8!=DOCT_TEXT)
|
||||
doc_e=doc_e->next;
|
||||
@@ -42,7 +42,7 @@ Bool JBPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
|
||||
DocDel(s);
|
||||
return TRUE;
|
||||
} else if (ch==CH_SPACE||ch==CH_ESC)
|
||||
tempde->user_data++; //JB_RUN_LEVEL++
|
||||
tmpde->user_data++; //JB_RUN_LEVEL++
|
||||
//<SPACE> is followed by <ESC> --> JB_RUN_LEVEL_TWO
|
||||
//Actual <ESC> just exits --> JB_RUN_LEVEL_ONE
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public U0 JukeBox(U8 *dirname="~/Psalmody",U8 **_filename=NULL)
|
||||
{//_filename is for using this as a song-chooser program.
|
||||
I64 i=0,rating;
|
||||
U8 *st,*st2;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
CDirEntry *tmpde,*tmpde1;
|
||||
CDoc *doc=DocNew,*s;
|
||||
CDocEntry *doc_e;
|
||||
CTask *task=NULL;
|
||||
@@ -61,7 +61,7 @@ public U0 JukeBox(U8 *dirname="~/Psalmody",U8 **_filename=NULL)
|
||||
*_filename=NULL;
|
||||
dirname=StrNew(dirname);
|
||||
st=MStrPrint("%s/*.HC.Z",dirname);
|
||||
tempde=tempde1=FilesFind(st);
|
||||
tmpde=tmpde1=FilesFind(st);
|
||||
Free(st);
|
||||
Free(dirname);
|
||||
doc->user_put_key=&JBPutKey;
|
||||
@@ -70,13 +70,13 @@ public U0 JukeBox(U8 *dirname="~/Psalmody",U8 **_filename=NULL)
|
||||
"$$BLACK$$Incomplete $$CYAN$$Special$$FG$$\n\n"
|
||||
"$$GREEN$$<DELETE>$$FG$$ to delete a song.\n"
|
||||
"Press a number to rate a song.\n");
|
||||
while (tempde) {
|
||||
while (tmpde) {
|
||||
if (!(i++%5))
|
||||
DocPrint(doc,"\n");
|
||||
if (FileOcc("Play(",tempde->full_name,"")) {
|
||||
st=StrNew(tempde->name);
|
||||
if (FileOcc("Play(",tmpde->full_name,"")) {
|
||||
st=StrNew(tmpde->name);
|
||||
FileExtRem(st);
|
||||
s=DocRead(tempde->full_name);
|
||||
s=DocRead(tmpde->full_name);
|
||||
doc_e=s->head.next;
|
||||
while (doc_e!=s && doc_e->type_u8!=DOCT_TEXT)
|
||||
doc_e=doc_e->next;
|
||||
@@ -94,7 +94,7 @@ public U0 JukeBox(U8 *dirname="~/Psalmody",U8 **_filename=NULL)
|
||||
DocPrint(doc,"$$CYAN$$");
|
||||
else if (StrMatch("no nothing",doc_e->tag)) {
|
||||
DocPrint(doc,"$$RED$$");
|
||||
if (FileOcc("\\0",tempde->full_name,"")) {
|
||||
if (FileOcc("\\0",tmpde->full_name,"")) {
|
||||
s->cur_entry=doc_e->next;
|
||||
s->cur_col=0;
|
||||
DocEntryDel(s,doc_e);
|
||||
@@ -102,37 +102,37 @@ public U0 JukeBox(U8 *dirname="~/Psalmody",U8 **_filename=NULL)
|
||||
DocWrite(s);
|
||||
}
|
||||
}
|
||||
DocPrint(doc,"$$MU-UL,\"%c%-8ts\",LE=%d$$ ",rating,st,tempde);
|
||||
tempde->user_data=JB_RUN_LEVEL_NULL;
|
||||
DocPrint(doc,"$$MU-UL,\"%c%-8ts\",LE=%d$$ ",rating,st,tmpde);
|
||||
tmpde->user_data=JB_RUN_LEVEL_NULL;
|
||||
}
|
||||
DocDel(s);
|
||||
Free(st);
|
||||
}
|
||||
tempde=tempde->next;
|
||||
tmpde=tmpde->next;
|
||||
}
|
||||
DocPrint(doc,"\n$$CYAN$$$$MU-UL,\"DONE\",LE=%d$$\n",DOCM_CANCEL);
|
||||
while (TRUE) {
|
||||
if (_filename)
|
||||
tempde=PopUpMenu(doc,DOF_INTERCEPT_TASK_END);
|
||||
tmpde=PopUpMenu(doc,DOF_INTERCEPT_TASK_END);
|
||||
else
|
||||
tempde=PopUpMenu(doc);
|
||||
tmpde=PopUpMenu(doc);
|
||||
if (task)
|
||||
Kill(task);
|
||||
if (tempde<=0) break;
|
||||
st2=StrNew(tempde->name);
|
||||
if (tmpde<=0) break;
|
||||
st2=StrNew(tmpde->name);
|
||||
if (_filename) {
|
||||
Free(*_filename);
|
||||
*_filename=StrNew(tempde->full_name);
|
||||
*_filename=StrNew(tmpde->full_name);
|
||||
}
|
||||
if (tempde->user_data==JB_RUN_LEVEL_ONE) break; //<ESC>
|
||||
tempde->user_data=JB_RUN_LEVEL_NULL; //Rst from <SPACE>
|
||||
if (tmpde->user_data==JB_RUN_LEVEL_ONE) break; //<ESC>
|
||||
tmpde->user_data=JB_RUN_LEVEL_NULL; //Rst from <SPACE>
|
||||
FileExtRem(st2);
|
||||
st=MStrPrint("ExeFile(\"%s\");",tempde->full_name);
|
||||
st=MStrPrint("ExeFile(\"%s\");",tmpde->full_name);
|
||||
MusicSettingsRst;
|
||||
task=SingleSong(st,st2);
|
||||
Free(st2);
|
||||
Free(st);
|
||||
}
|
||||
DocDel(doc);
|
||||
DirTreeDel(tempde1);
|
||||
DirTreeDel(tmpde1);
|
||||
}
|
||||
+11
-11
@@ -2,13 +2,13 @@ U0 SongPuppet(CTask *task,I64 passes)
|
||||
{
|
||||
CDbgInfo *dbg_info;
|
||||
I64 i,start,end,rip,last_rip;
|
||||
CHashFun *tempf=NULL;
|
||||
CHashFun *tmpf=NULL;
|
||||
for (i=0;i<250 && TaskValidate(task);i++) {
|
||||
if (tempf=HashFind("Song",task->hash_table,HTT_FUN))
|
||||
if (tmpf=HashFind("Song",task->hash_table,HTT_FUN))
|
||||
break;
|
||||
Sleep(1);
|
||||
}
|
||||
if (tempf && (dbg_info=tempf->dbg_info)) {
|
||||
if (tmpf && (dbg_info=tmpf->dbg_info)) {
|
||||
start=dbg_info->body[0];
|
||||
end =dbg_info->body[dbg_info->max_line+1-dbg_info->min_line];
|
||||
last_rip=0;
|
||||
@@ -74,16 +74,16 @@ public U0 JukeSongsPuppet(U8 *dirname="~/Psalmody",I64 passes=2,
|
||||
I64 start_song=0,I64 end_song=MAX_I64)
|
||||
{//Help make music video by puppeting JukeBox task.
|
||||
I64 i;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
CDirEntry *tmpde,*tmpde1;
|
||||
CTask *juke_task=User("JukeBox(0x%X);\n",dirname);
|
||||
Cd(dirname);
|
||||
tempde1=FilesFind("*",FUF_RECURSE|FUF_JUST_TXT|FUF_JUST_FILES);
|
||||
for (tempde=tempde1,i=0;tempde && i<start_song;i++)
|
||||
tempde=tempde->next;
|
||||
for (i=start_song;tempde && i<end_song;i++) {
|
||||
JukeSongPuppet(juke_task,passes,i,tempde->name);
|
||||
tempde=tempde->next;
|
||||
tmpde1=FilesFind("*",FUF_RECURSE|FUF_JUST_TXT|FUF_JUST_FILES);
|
||||
for (tmpde=tmpde1,i=0;tmpde && i<start_song;i++)
|
||||
tmpde=tmpde->next;
|
||||
for (i=start_song;tmpde && i<end_song;i++) {
|
||||
JukeSongPuppet(juke_task,passes,i,tmpde->name);
|
||||
tmpde=tmpde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
DirTreeDel(tmpde1);
|
||||
Kill(juke_task);
|
||||
}
|
||||
@@ -19,7 +19,7 @@ This uses four types of output
|
||||
|
||||
4) The Fs->next_ctrl for the tempo/stacatto sliders.
|
||||
|
||||
See $LK,"GrUpdateTaskWin",A="MN:GrUpdateTaskWin"$(), $LK,"GrUpdateTasks",A="MN:GrUpdateTasks"$() and $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
|
||||
See $LK,"GrUpdateTaskWin",A="MN:GrUpdateTaskWin"$(), $LK,"GrUpdateTasks",A="MN:GrUpdateTasks"$() and $LK,"GrUpdateScrn",A="MN:GrUpdateScrn"$().
|
||||
$WW,1$$WW,0$*/
|
||||
|
||||
#define NOTE_REST MIN_I64
|
||||
@@ -62,20 +62,13 @@ class PsmCtrl
|
||||
PsmNote head;
|
||||
PsmNote clipboard;
|
||||
CMenuEntry *incomplete_entry,*record_entry;
|
||||
I64 screen_x,
|
||||
I64 scrn_x,
|
||||
tool;
|
||||
PsmNote *cur_note;
|
||||
CDC *dc2;
|
||||
Bool playing;
|
||||
} oc;
|
||||
} psm;
|
||||
|
||||
U8 *psm_note_lst="A\0A#\0B\0C\0C#\0D\0D#\0E\0F\0F#\0G\0G#\0";
|
||||
U8 psm_note_map[12]={6,6,5,4,4,3,3,2,1,1,0,0};
|
||||
U8 psm_note_inverse_map[7]={10,8,7,5,3,2,0};
|
||||
|
||||
#define PSMPM_NORMAL 0
|
||||
#define PSMPM_REVERB1 1
|
||||
#define PSMPM_NUM_PLAY_MODES 2
|
||||
I64 psm_play_mode=0;
|
||||
F64 psm_play_f=0;
|
||||
|
||||
@@ -63,7 +63,7 @@ Bool psm_triplet_durations[PSM_NUM_DURATIONS]={TRUE,FALSE,TRUE,
|
||||
|
||||
Bool PsmBlink()
|
||||
{
|
||||
if (Blink || oc.playing)
|
||||
if (Blink || psm.playing)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@@ -88,27 +88,27 @@ Bool PsmIsDotted(I64 duration)
|
||||
|
||||
U0 PsmMarkSel(I64 x1,I64 x2,Bool sel)
|
||||
{
|
||||
PsmNote *tempo=oc.head.next;
|
||||
while (tempo!=&oc.head) {
|
||||
PsmNote *tmpn=psm.head.next;
|
||||
while (tmpn!=&psm.head) {
|
||||
if (sel) {
|
||||
if (x1<=tempo->x<=x2)
|
||||
tempo->flags|=PSMF_SEL;
|
||||
if (x1<=tmpn->x<=x2)
|
||||
tmpn->flags|=PSMF_SEL;
|
||||
} else
|
||||
tempo->flags&=~PSMF_SEL;
|
||||
tempo=tempo->next;
|
||||
tmpn->flags&=~PSMF_SEL;
|
||||
tmpn=tmpn->next;
|
||||
}
|
||||
}
|
||||
|
||||
U0 PsmSetWidth(PsmNote *tempo)
|
||||
U0 PsmSetWidth(PsmNote *tmpn)
|
||||
{
|
||||
if (tempo->type==PSMT_METER)
|
||||
tempo->width=12;
|
||||
if (tmpn->type==PSMT_METER)
|
||||
tmpn->width=12;
|
||||
else {
|
||||
tempo->width=PSM_NOTE_SPACING;
|
||||
if (PsmIsDotted(tempo->duration))
|
||||
tempo->width+=PSM_NOTE_SPACING/2;
|
||||
if (Bt(&tempo->flags,PSMf_SHARP) || Bt(&tempo->flags,PSMf_FLAT))
|
||||
tempo->width+=PSM_NOTE_SPACING;
|
||||
tmpn->width=PSM_NOTE_SPACING;
|
||||
if (PsmIsDotted(tmpn->duration))
|
||||
tmpn->width+=PSM_NOTE_SPACING/2;
|
||||
if (Bt(&tmpn->flags,PSMf_SHARP) || Bt(&tmpn->flags,PSMf_FLAT))
|
||||
tmpn->width+=PSM_NOTE_SPACING;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,18 +116,16 @@ U0 PsmSetOctave(I64 octave)
|
||||
{
|
||||
I64 i;
|
||||
U8 buf[STR_LEN];
|
||||
CMenuEntry *tempse;
|
||||
CMenuEntry *tmpse;
|
||||
for (i=0;i<=6;i++) {
|
||||
StrPrint(buf,"Snd/Octave%d",i);
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,buf)) {
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,buf)) {
|
||||
if (i==octave)
|
||||
tempse->checked=TRUE;
|
||||
tmpse->checked=TRUE;
|
||||
else
|
||||
tempse->checked=FALSE;
|
||||
tmpse->checked=FALSE;
|
||||
}
|
||||
}
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"Snd/Reverb"))
|
||||
tempse->checked=psm_play_mode==1;
|
||||
}
|
||||
|
||||
U0 DrawNote(CDC *dc,I64 x,I64 y,I64 duration)
|
||||
@@ -150,21 +148,21 @@ U0 DrawTimeSignature(CDC *dc,I64 x,I64 y,I64 top,I64 bottom)
|
||||
U0 PsmRecalcNoteXY()
|
||||
{
|
||||
F64 measure_len=4,measure_left=measure_len;
|
||||
PsmNote *tempo=oc.head.next;
|
||||
I64 x=8-oc.screen_x,note,octave;
|
||||
PsmNote *tmpn=psm.head.next;
|
||||
I64 x=8-psm.scrn_x,note,octave;
|
||||
while (TRUE) {
|
||||
tempo->x=x;
|
||||
tempo->y=50;
|
||||
if (tempo==&oc.head)
|
||||
tmpn->x=x;
|
||||
tmpn->y=50;
|
||||
if (tmpn==&psm.head)
|
||||
break;
|
||||
else {
|
||||
if (tempo->type!=PSMT_METER) {
|
||||
octave=tempo->octave;
|
||||
if (tmpn->type!=PSMT_METER) {
|
||||
octave=tmpn->octave;
|
||||
if (octave!=OCTAVE_REST) {
|
||||
note=tempo->note;
|
||||
if (Bt(&tempo->flags,PSMf_SHARP))
|
||||
note=tmpn->note;
|
||||
if (Bt(&tmpn->flags,PSMf_SHARP))
|
||||
note--;
|
||||
if (Bt(&tempo->flags,PSMf_FLAT))
|
||||
if (Bt(&tmpn->flags,PSMf_FLAT))
|
||||
note++;
|
||||
if (note<0) {
|
||||
note=11;
|
||||
@@ -174,27 +172,27 @@ U0 PsmRecalcNoteXY()
|
||||
octave++;
|
||||
}
|
||||
note=music.note_map[*LstSub(note,psm_note_lst)-'A'];
|
||||
tempo->y=(15+(psm_note_map[note]-7*(octave-2)))*4;
|
||||
tmpn->y=(15+(psm_note_map[note]-7*(octave-2)))*4;
|
||||
}
|
||||
}
|
||||
x+=tempo->width;
|
||||
if (tempo->type==PSMT_METER) {
|
||||
measure_len=tempo->meter_top*4.0/tempo->meter_bottom;
|
||||
x+=tmpn->width;
|
||||
if (tmpn->type==PSMT_METER) {
|
||||
measure_len=tmpn->meter_top*4.0/tmpn->meter_bottom;
|
||||
measure_left=0;
|
||||
} else
|
||||
measure_left-=psm_durations[tempo->duration];
|
||||
measure_left-=psm_durations[tmpn->duration];
|
||||
if (measure_left<0.001) {
|
||||
x+=PSM_NOTE_SPACING;
|
||||
measure_left=measure_len;
|
||||
}
|
||||
}
|
||||
tempo=tempo->next;
|
||||
tmpn=tmpn->next;
|
||||
}
|
||||
}
|
||||
|
||||
U0 DrawIt(CTask *task,CDC *dc)
|
||||
{
|
||||
PsmNote *tempo;
|
||||
PsmNote *tmpn;
|
||||
I64 i,x,y,
|
||||
w=task->pix_width;
|
||||
F64 measure_len=4,measure_left=measure_len;
|
||||
@@ -206,63 +204,63 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
GrLine(dc,0,i*8,w,i*8);
|
||||
|
||||
PsmRecalcNoteXY;
|
||||
if (oc.cur_note->x<64) {
|
||||
oc.screen_x-=128;
|
||||
if (psm.cur_note->x<64) {
|
||||
psm.scrn_x-=128;
|
||||
PsmRecalcNoteXY;
|
||||
}
|
||||
if (oc.cur_note->x>=GR_WIDTH-64) {
|
||||
oc.screen_x+=128;
|
||||
if (psm.cur_note->x>=GR_WIDTH-64) {
|
||||
psm.scrn_x+=128;
|
||||
PsmRecalcNoteXY;
|
||||
}
|
||||
|
||||
tempo=oc.head.next;
|
||||
while (tempo!=&oc.head) {
|
||||
x=tempo->x;
|
||||
y=tempo->y;
|
||||
tmpn=psm.head.next;
|
||||
while (tmpn!=&psm.head) {
|
||||
x=tmpn->x;
|
||||
y=tmpn->y;
|
||||
if (measure_left<0.001) {
|
||||
dc->color=BLACK;
|
||||
GrLine(dc,x-PSM_NOTE_SPACING,8,x-PSM_NOTE_SPACING,11*8);
|
||||
measure_left=measure_len;
|
||||
}
|
||||
if (tempo->type==PSMT_METER) {
|
||||
if (tempo==oc.cur_note && PsmBlink)
|
||||
if (tmpn->type==PSMT_METER) {
|
||||
if (tmpn==psm.cur_note && PsmBlink)
|
||||
dc->color=BROWN;
|
||||
else
|
||||
dc->color=BLACK;
|
||||
DrawTimeSignature(dc,x,5*8,tempo->meter_top,tempo->meter_bottom);
|
||||
measure_len=tempo->meter_top*4.0/tempo->meter_bottom;
|
||||
DrawTimeSignature(dc,x,5*8,tmpn->meter_top,tmpn->meter_bottom);
|
||||
measure_len=tmpn->meter_top*4.0/tmpn->meter_bottom;
|
||||
measure_left=0;
|
||||
} else {
|
||||
if (tempo==oc.cur_note && PsmBlink) {
|
||||
if (tmpn==psm.cur_note && PsmBlink) {
|
||||
dc->color=BROWN;
|
||||
GrPrint(dc,x+8,y,"%s",tempo->word);
|
||||
} else if (tempo->flags&PSMF_SEL)
|
||||
GrPrint(dc,x+8,y,"%s",tmpn->word);
|
||||
} else if (tmpn->flags&PSMF_SEL)
|
||||
dc->color=RED;
|
||||
else {
|
||||
if (tempo->note!=NOTE_REST)
|
||||
if (tmpn->note!=NOTE_REST)
|
||||
dc->color=BLACK;
|
||||
else
|
||||
dc->color=LTGRAY;
|
||||
if (PsmHasWords(tempo->word))
|
||||
if (PsmHasWords(tmpn->word))
|
||||
dc->color=GREEN;
|
||||
}
|
||||
DrawNote(dc,x,y,tempo->duration);
|
||||
if (PsmIsDotted(tempo->duration))
|
||||
DrawNote(dc,x,y,tmpn->duration);
|
||||
if (PsmIsDotted(tmpn->duration))
|
||||
x+=PSM_NOTE_SPACING/2;
|
||||
if (Bt(&tempo->flags,PSMf_SHARP))
|
||||
if (Bt(&tmpn->flags,PSMf_SHARP))
|
||||
Sprite3(dc,x,y,0,$IB,"<13>",BI=13$);
|
||||
else if (Bt(&tempo->flags,PSMf_FLAT))
|
||||
else if (Bt(&tmpn->flags,PSMf_FLAT))
|
||||
Sprite3(dc,x,y,0,$IB,"<14>",BI=14$);
|
||||
measure_left-=psm_durations[tempo->duration];
|
||||
measure_left-=psm_durations[tmpn->duration];
|
||||
}
|
||||
tempo=tempo->next;
|
||||
tmpn=tmpn->next;
|
||||
}
|
||||
|
||||
if (oc.cur_note==&oc.head && PsmBlink)
|
||||
if (psm.cur_note==&psm.head && PsmBlink)
|
||||
dc->color=BROWN;
|
||||
else
|
||||
dc->color=BLACK;
|
||||
Sprite3(dc,oc.head.x,50,0,$IB,"<12>",BI=12$);
|
||||
Sprite3(dc,psm.head.x,50,0,$IB,"<12>",BI=12$);
|
||||
}
|
||||
|
||||
#define PSM_NOTE_BOX_X 220
|
||||
@@ -298,12 +296,12 @@ U0 DrawPickNoteBox()
|
||||
for (i=0;i<PSM_NUM_DURATIONS;i++) {
|
||||
PsmSetPickNoteBoxX(i,&x);
|
||||
if (PsmIsDotted(i))
|
||||
oc.dc2->color=RED;
|
||||
psm.dc2->color=RED;
|
||||
else if (psm_triplet_durations[i])
|
||||
oc.dc2->color=LTRED;
|
||||
psm.dc2->color=LTRED;
|
||||
else
|
||||
oc.dc2->color=BLACK;
|
||||
DrawNote(oc.dc2,x,PSM_NOTE_BOX_Y,i);
|
||||
psm.dc2->color=BLACK;
|
||||
DrawNote(psm.dc2,x,PSM_NOTE_BOX_Y,i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,19 +310,19 @@ U0 DrawPickNoteBox()
|
||||
|
||||
U0 DrawPickTools()
|
||||
{
|
||||
if (oc.tool==PSMTT_BOX_TOOL)
|
||||
oc.dc2->color=ROPF_DITHER+WHITE<<16+RED;
|
||||
if (psm.tool==PSMTT_BOX_TOOL)
|
||||
psm.dc2->color=ROPF_DITHER+WHITE<<16+RED;
|
||||
else
|
||||
oc.dc2->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
GrBorder(oc.dc2,PSM_TOOLS_X,PSM_TOOLS_Y,
|
||||
psm.dc2->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
GrBorder(psm.dc2,PSM_TOOLS_X,PSM_TOOLS_Y,
|
||||
PSM_TOOLS_X+10,PSM_TOOLS_Y+10);
|
||||
|
||||
if (oc.tool==PSMTT_PTR_TOOL)
|
||||
oc.dc2->color=RED;
|
||||
if (psm.tool==PSMTT_PTR_TOOL)
|
||||
psm.dc2->color=RED;
|
||||
else
|
||||
oc.dc2->color=BLACK;
|
||||
(*gr.fp_draw_input_ptr)(oc.dc2,PSM_TOOLS_X+15,PSM_TOOLS_Y);
|
||||
oc.dc2->color=BLACK;
|
||||
psm.dc2->color=BLACK;
|
||||
(*gr.fp_draw_input_ptr)(psm.dc2,PSM_TOOLS_X+15,PSM_TOOLS_Y);
|
||||
psm.dc2->color=BLACK;
|
||||
}
|
||||
|
||||
Bool PsmGetPickToolBox(I64 xx,I64 yy)
|
||||
@@ -333,9 +331,9 @@ Bool PsmGetPickToolBox(I64 xx,I64 yy)
|
||||
PSM_TOOLS_Y<=yy<PSM_TOOLS_Y+15) {
|
||||
PsmMarkSel(0,0,FALSE);
|
||||
if (xx<PSM_TOOLS_X+13)
|
||||
oc.tool=PSMTT_BOX_TOOL;
|
||||
psm.tool=PSMTT_BOX_TOOL;
|
||||
else
|
||||
oc.tool=PSMTT_PTR_TOOL;
|
||||
psm.tool=PSMTT_PTR_TOOL;
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
@@ -364,9 +362,9 @@ Bool PsmGetPickMeterBox(I64 xx,I64 yy,I64 *top,I64 *bottom)
|
||||
U0 DrawPickMeterBox()
|
||||
{
|
||||
I64 i;
|
||||
oc.dc2->color=BLACK;
|
||||
psm.dc2->color=BLACK;
|
||||
for (i=0;i<PSM_NUM_METERS;i++)
|
||||
DrawTimeSignature(oc.dc2,PSM_METER_X+i*PSM_METER_W,PSM_METER_Y,
|
||||
DrawTimeSignature(psm.dc2,PSM_METER_X+i*PSM_METER_W,PSM_METER_Y,
|
||||
meter_tops[i],meter_bottoms[i]);
|
||||
}
|
||||
|
||||
@@ -398,25 +396,25 @@ U0 PsmMenu(I64 psm_octave)
|
||||
"$$LTGREEN$$<BACKSPACE>$$FG$$\tDeletes Last Note\n"
|
||||
"$$LTGREEN$$Left Mouse$$FG$$\tDrag note or shift word\n"
|
||||
"$$LTGREEN$$Right Mouse$$FG$$\tChange duration or set word\n";
|
||||
Sprite($IB,"<6>",BI=6$,"$$SP+LA,\"\","
|
||||
Sprite($IB,"<6>",BI=6$,"$$SP+LIS,\"\","
|
||||
"LM=\"Msg(MSG_KEY_DOWN,0,SCF_CTRL|SC_CURSOR_LEFT);\",BI=%d$$");
|
||||
" ";
|
||||
if (oc.playing)
|
||||
if (psm.playing)
|
||||
Sprite($IB,"<9>",BI=9$,"$$SP,\"\",LM=\"x\",BI=%d$$");
|
||||
else
|
||||
Sprite($IB,"<8>",BI=8$,"$$SP,\"\",LM=\"x\",BI=%d$$");
|
||||
" ";
|
||||
if (oc.record_entry->checked) {
|
||||
oc.record_entry->checked=TRUE;
|
||||
if (psm.record_entry->checked) {
|
||||
psm.record_entry->checked=TRUE;
|
||||
Sprite($IB,"<10>",BI=10$,"$$SP,\"\",LM=\"z\",BI=%d$$");
|
||||
} else
|
||||
Sprite($IB,"<11>",BI=11$,"$$SP,\"\",LM=\"z\",BI=%d$$");
|
||||
" ";
|
||||
Sprite($IB,"<7>",BI=7$,"$$SP+LA,\"\","
|
||||
Sprite($IB,"<7>",BI=7$,"$$SP+LIS,\"\","
|
||||
"LM=\"Msg(MSG_KEY_DOWN,0,SCF_CTRL|SC_CURSOR_RIGHT);\",BI=%d$$");
|
||||
"$$CM+LX,0,6$$";
|
||||
PsmSetOctave(psm_octave);
|
||||
WinMgrSync(2);
|
||||
Refresh(2);
|
||||
}
|
||||
| ||||