56 lines
1.3 KiB
Plaintext
56 lines
1.3 KiB
Plaintext
//This is a drawing program
|
|
|
|
void DrawIt(TssStruct *tss)
|
|
{
|
|
ClearWinText(tss);
|
|
}
|
|
|
|
void Doodle()
|
|
{
|
|
I8 cmd,x1,y1,x2,y2,p1,p2,color=BLACK;
|
|
void *old_update=Fs->update_win;
|
|
BoolU4 old_ip_double=Bts(&Fs->crt_flags,CRTf_NO_DOUBLE_CLICK);
|
|
BoolU4 old_inhibit=ip_inhibit_win_operations;
|
|
GrBitMap *base=GrAlias(Gs->grbase,Fs);
|
|
base->color=ROP_XOR+(color ^ WHITE);
|
|
ip_inhibit_win_operations=TRUE;
|
|
WinMax;
|
|
Fs->update_win=&DrawIt;
|
|
GrClear;
|
|
PutS("$$CL$$");
|
|
do {
|
|
cmd=GetMsg(&p1,&p2,
|
|
(1<<MSG_KEY_DOWN)+(1<<MSG_IP_L_DOWN)+
|
|
(1<<MSG_IP_R_UP));
|
|
switch (cmd) {
|
|
case MSG_IP_R_UP:
|
|
ip_inhibit_win_operations=FALSE;
|
|
color=PopUpColor;
|
|
base->color=ROP_XOR+(color ^ WHITE);
|
|
ip_inhibit_win_operations=TRUE;
|
|
break;
|
|
case MSG_IP_L_DOWN:
|
|
x1=p1; y1=p2;
|
|
x2=p1; y2=p2;
|
|
while (cmd!=MSG_IP_L_UP) {
|
|
GrLine3(base,x1,y1,0,x2,y2,0);
|
|
cmd=GetMsg(&p1,&p2,
|
|
(1<<MSG_IP_L_UP)+(1<<MSG_IP_MOVE));
|
|
GrLine3(base,x1,y1,0,x2,y2,0);
|
|
x2=p1; y2=p2;
|
|
}
|
|
GrLine3(base,x1,y1,0,x2,y2,0);
|
|
break;
|
|
case MSG_KEY_DOWN:
|
|
break;
|
|
}
|
|
} while (cmd!=MSG_KEY_DOWN);
|
|
Fs->update_win=old_update;
|
|
GrClear;
|
|
AssignBit(&Fs->crt_flags,CRTf_NO_DOUBLE_CLICK,old_ip_double);
|
|
ip_inhibit_win_operations=old_inhibit;
|
|
GrDel(base);
|
|
}
|
|
|
|
Doodle; //Execute when #included
|
|
|