| version 1.5, 2005/12/02 17:15:00 |
version 1.6, 2005/12/08 21:13:04 |
|
|
| |
|
| #include "cc.h" |
#include "cc.h" |
| |
|
| WIN *hlwin=NULL, |
Cc_Win *_cc_hlwin=NULL, |
| *hlendwin=NULL, |
*_cc_hlendwin=NULL, |
| *focuswin=NULL, |
*_cc_focuswin=NULL, |
| *capturewin=NULL, |
*_cc_capturewin=NULL, |
| *hlmenu=NULL, |
*_cc_hlmenu=NULL, |
| *hldowntext=NULL, |
*_cc_hldowntext=NULL, |
| mainwin; |
_cc_mainwin; |
| bool (*acelproc)()=NULL; |
bool (*_cc_acelproc)()=NULL; |
| void (*resizescreen)()=NULL; |
void (*_cc_resizescreen)()=NULL; |
| TIMER *hltimer=NULL; |
Cc_Timer *_cc_hltimer=NULL; |
| bool hasmodal=false; |
bool _cc_hasmodal=false; |
| bool apprun=true; |
bool _cc_apprun=true; |
| bool hlvisible=false; |
bool _cc_hlvisible=false; |
| GList *dialoglist=NULL; |
GList *_cc_dialoglist=NULL; |
| char *clipboard=NULL; |
char *_cc_clipboard=NULL; |
| WIN *clipboardmenu=NULL; |
Cc_Win *_cc_clipboardmenu=NULL; |
| GSList *topwinlist=NULL; |
GSList *_cc_topwinlist=NULL; |
| CMAP *cmap=NULL; |
long _cc_oldattr; |
| char *bitmap[BITMAPY]={ // nejake to logo do pozadia |
CMAP *_cc_cmap=NULL; |
| "oo...........................................................................oo", |
char *_cc_bitmap[BITMAPY]={ // nejake to logo do pozadia |
| "o.............................................................................o", |
|
| "..........................o..o.................................................", |
|
| "...........................oo..................................................", |
|
| "..oooooooooo..oo....oo....oooo.................................................", |
|
| "......oo......oo....oo...oo..oo................................................", |
|
| "......oo......oo....oo..oo.....................................................", |
|
| "......oo......oo....oo..oo.....................................................", |
|
| "......oo.......oo..oo....oo..oo................................................", |
|
| "......oo........oooo......oooo.................................................", |
|
| "...............................................................................", |
"...............................................................................", |
| "...oooo.....oo..oo.....ooo.....oo...oo.........................................", |
".........................................oo.oo.................................", |
| "...oo.oo....oo..oo....oo.oo....oo..oo..........................................", |
"..........................................oo...................................", |
| "...oo..oo...oo..oo...oo...oo...oo.oo...........................................", |
".....ooooooooooo...oooo.....oooo.......oooooooo................................", |
| "...oo...oo..oo..oo..ooooooooo..oooo............................................", |
".....ooooooooooo....oo.......oo......oo.......oo...............................", |
| "...oo....oo.oo..oo..oo.....oo..oo.oo...........................................", |
".........ooo........oo.......oo.....oo........o.o..............................", |
| "...oo.....oooo..oo..oo.....oo..oo..oo..........................................", |
".........ooo........oo.......oo....oo..........................................", |
| "...oo......ooo..oo..oo.....oo..oo...oo.........................................", |
".........ooo........oo.......oo....oo..........................................", |
| |
".........ooo........oo.......oo....oo..........................................", |
| |
".........ooo........oo.......oo....oo..........................................", |
| |
".........ooo........oooo...oooo.....oo........o.o..............................", |
| |
".........ooo.........ooooooooo.......oo......ooo...............................", |
| |
"........ooooo..........ooooo...........ooooooo.................................", |
| "...............................................................................", |
"...............................................................................", |
| "...............................................................................", |
"...............................................................................", |
| |
"......................oooo......oooo...oooo.........oooo.........oooo...ooo....", |
| |
".......................ooo.......oo.....oo.........oo..oo.........oo....oo.....", |
| |
".......................oo.oo.....oo.....oo.........oo..oo.........oo...oo......", |
| |
".......................oo..oo....oo.....oo........oo....oo........oo.oo........", |
| |
".......................oo...oo...oo.....oo........oo....oo........ooo..........", |
| |
".......................oo....oo..oo.....oo.......oooo..oooo.......oo.oo........", |
| |
".......................oo.....oo.oo.....oo......oo........oo......oo...oo......", |
| |
".......................oo.......ooo.....oo.....oo..........oo.....oo....oo.....", |
| |
"......................oooo......oooo...oooo..oooo..........oooo..oooo...ooo....", |
| "...............................................................................", |
"...............................................................................", |
| "...............................................................................", |
|
| "...............................................................................", |
|
| "o.............................................................................o", |
|
| "oo...........................................................................oo", |
|
| }; |
}; |
| |
|
| void fobdiskbuttonproc(WIN *win) |
void _cc_fobdiskbuttonproc(Cc_Win *win) |
| { |
{ |
| |
|
| |
|
| } |
} |
| |
|
| void fobnamebuttonproc(WIN *win) |
void _cc_fobnamebuttonproc(Cc_Win *win) |
| { |
{ |
| |
|
| |
|
| } |
} |
| |
|
| void fobmaskbuttonproc(WIN *win) |
void _cc_fobmaskbuttonproc(Cc_Win *win) |
| { |
{ |
| |
|
| |
|
| } |
} |
| |
|
| void fobopenbuttonproc(WIN *win) |
void _cc_fobopenbuttonproc(Cc_Win *win) |
| { |
{ |
| |
|
| |
|
| } |
} |
| |
|
| void fobcancelbuttonproc(WIN *win) |
void _cc_fobcancelbuttonproc(Cc_Win *win) |
| { |
{ |
| |
|
| |
|
| } |
} |
| |
|
| void fobsizeokproc(WIN *win,long *x,long *y,long *vx,long *vy) |
void _cc_fobsizeokproc(Cc_Win *win,long *x,long *y,long *vx,long *vy) |
| { |
{ |
| if(*vx<MIN_FOB_VX)*vx=MIN_FOB_VX; |
if(*vx<MIN_FOB_VX)*vx=MIN_FOB_VX; |
| if(*vy<MIN_FOB_VY)*vy=MIN_FOB_VY; |
if(*vy<MIN_FOB_VY)*vy=MIN_FOB_VY; |
| } |
} |
| |
|
| bool fobdialogacelproc(WIN *win,long x,long y,unsigned short key) |
bool _cc_fobdialogacelproc(Cc_Win *win,long x,long y,unsigned short key) |
| { |
{ |
| if(key==CC_K_ESC)((TUFOB*)(win->user))->i=0; |
if(key==CC_KEY_ESC)((TUFOB*)(win->user))->i=0; |
| return send_message(win,x,y,key); |
return cc_send_message(win,x,y,key); |
| } |
} |
| |
|
| void fobcloseproc(WIN *sender) |
void _cc_fobcloseproc(Cc_Win *sender) |
| { |
{ |
| ((TUFOB*)(sender->user))->i=0; |
((TUFOB*)(sender->user))->i=0; |
| } |
} |
| |
|
| void fobdiskcombochangeproc(WIN *win) |
void _cc_fobdiskcombochangeproc(Cc_Win *win) |
| { |
{ |
| |
|
| |
|
| |
|
| } |
} |
| |
|
| void fobfilelistdblclkproc(WIN *win) |
void _cc_fobfilelistdblclkproc(Cc_Win *win) |
| { |
{ |
| |
|
| |
|
| |
|
| } |
} |
| |
|
| bool fobfilelistacelproc(WIN *win,long x,long y,unsigned short key) |
bool _cc_fobfilelistacelproc(Cc_Win *win,long x,long y,unsigned short key) |
| { |
{ |
| |
|
| return send_message(win,x,y,key); |
return cc_send_message(win,x,y,key); |
| } |
} |
| |
|
| void cbcombochangeproc(WIN *win) |
void _cc_cbcombochangeproc(Cc_Win *win) |
| { |
{ |
| long color=win->extra->combo.activeline; |
long color=win->extra->combo.activeline; |
| TUCB *tucb=(TUCB*)(win->parent->user); |
TUCB *tucb=(TUCB*)(win->parent->user); |
| WIN *p1=tucb->p1,*p2=tucb->p2; |
Cc_Win *p1=tucb->p1,*p2=tucb->p2; |
| move_win(p1,(color%4)*2+5,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE); |
cc_move_win(p1,(color%4)*2+5,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE); |
| move_win(p2,CC_NOCHANGE,(color/4)+3,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE); |
cc_move_win(p2,CC_NOCHANGE,(color/4)+3,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE); |
| } |
} |
| |
|
| bool cbpaintacelproc(WIN *win,long x,long y,unsigned short key) |
bool _cc_cbpaintacelproc(Cc_Win *win,long x,long y,unsigned short key) |
| { |
{ |
| if(key==CC_M_LBUTTONDOWN) |
if(key==CC_MOUSE_L_DOWN) |
| { |
{ |
| long color=(long)win->user; |
long color=(long)win->user; |
| TUCB *tucb=(TUCB*)(win->parent->user); |
TUCB *tucb=(TUCB*)(win->parent->user); |
| WIN *combo=tucb->combo,*p1=tucb->p1,*p2=tucb->p2; |
Cc_Win *combo=tucb->combo,*p1=tucb->p1,*p2=tucb->p2; |
| set_pos(combo,color); |
cc_set_pos(combo,color); |
| move_win(p1,(color%4)*2+5,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE); |
cc_move_win(p1,(color%4)*2+5,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE, |
| move_win(p2,CC_NOCHANGE,(color/4)+3,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE); |
CC_NOCHANGE); |
| |
cc_move_win(p2,CC_NOCHANGE,(color/4)+3,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE); |
| } |
} |
| return send_message(win,x,y,key); |
return cc_send_message(win,x,y,key); |
| } |
} |
| |
|
| bool cbdialogacelproc(WIN *win,long x,long y,unsigned short key) |
bool _cc_cbdialogacelproc(Cc_Win *win,long x,long y,unsigned short key) |
| { |
{ |
| if(key==CC_K_ESC)((TUCB*)(win->user))->i=-1; |
if(key==CC_KEY_ESC)((TUCB*)(win->user))->i=-1; |
| return send_message(win,x,y,key); |
return cc_send_message(win,x,y,key); |
| } |
} |
| |
|
| void cbcloseproc(WIN *sender) |
void _cc_cbcloseproc(Cc_Win *sender) |
| { |
{ |
| ((TUCB*)(sender->user))->i=-1; |
((TUCB*)(sender->user))->i=-1; |
| } |
} |
| |
|
| void cbpushproc(WIN *sender) |
void _cc_cbpushproc(Cc_Win *sender) |
| { |
{ |
| ((TUCB*)(sender->parent->user))->i=(long)sender->user; |
((TUCB*)(sender->parent->user))->i=(long)sender->user; |
| } |
} |
| |
|
| bool mbdialogacelproc(WIN *win,long x,long y,unsigned short key) |
bool _cc_mbdialogacelproc(Cc_Win *win,long x,long y,unsigned short key) |
| { |
{ |
| if(key==CC_K_ESC)win->user=(void*)CC_MB_CANCEL; |
if(key==CC_KEY_ESC) |
| return send_message(win,x,y,key); |
{ |
| |
TUMB *tumb=(TUMB*)win->user; |
| |
tumb->action(win,CC_MB_CANCEL); |
| |
free(tumb->st); |
| |
free(tumb); |
| |
cc_delete_win(win); |
| |
return true; |
| |
} |
| |
return cc_send_message(win,x,y,key); |
| } |
} |
| |
|
| void mbcloseproc(WIN *sender) |
void _cc_mbcloseproc(Cc_Win *sender) |
| { |
{ |
| sender->user=(void*)CC_MB_CANCEL; |
TUMB *tumb=(TUMB*)sender->user; |
| |
tumb->action(sender,CC_MB_CANCEL); |
| |
free(tumb->st); |
| |
free(tumb); |
| |
cc_delete_win(sender); |
| } |
} |
| |
|
| void mbpushproc(WIN *sender) |
void _cc_mbpushproc(Cc_Win *sender) |
| { |
{ |
| sender->parent->user=sender->user; |
TUMB *tumb=(TUMB*)sender->parent->user; |
| |
tumb->action(sender->parent,(long)sender->user); |
| |
free(tumb->st); |
| |
free(tumb); |
| |
cc_delete_win(sender->parent); |
| } |
} |
| |
|
| bool claeditacel(WIN *sender,long x,long y,unsigned short key) |
bool _cc_claeditacel(Cc_Win *sender,long x,long y,unsigned short key) |
| { |
{ |
| if((key&CC_MASK_KEY)==CC_K_TAB)return false; |
if((key&CC_MASK_KEY)==CC_KEY_TAB)return false; |
| bool ret=send_message(sender,x,y,key); |
bool ret=cc_send_message(sender,x,y,key); |
| if(key==CC_M_LBUTTONDOWN)set_focus(sender->parent); |
if(key==CC_MOUSE_L_DOWN)cc_set_focus(sender->parent); |
| return ret; |
return ret; |
| } |
} |
| |
|
| void scrollincombochangeproc(WIN *sender) |
void _cc_scrollincombochangeproc(Cc_Win *sender) |
| { |
{ |
| redrawclientwin(sender->parent); |
_cc_redrawclientwin(sender->parent); |
| } |
} |
| |
|
| long fadecolor(long chr) |
long _cc_fadecolor(long chr) |
| { |
{ |
| char cb,cf; |
char cb,cf; |
| short pair; |
short pair; |
| cb=C_BLACK; |
cb=CC_C_BLACK; |
| cf=C_WHITE; |
cf=CC_C_WHITE; |
| pair=cb&0x7; |
pair=cb&0x7; |
| pair<<=3; |
pair<<=3; |
| pair+=cf; |
pair+=cf; |
| Line 202 long fadecolor(long chr) |
|
| Line 220 long fadecolor(long chr) |
|
| return chr&~A_BOLD&~A_REVERSE&~A_COLOR|COLOR_PAIR(pair); |
return chr&~A_BOLD&~A_REVERSE&~A_COLOR|COLOR_PAIR(pair); |
| } |
} |
| |
|
| void setuplistparams(WIN *win) |
void _cc_setuplistparams(Cc_Win *win) |
| { |
{ |
| LIST *list=&win->extra->list; |
LIST *list=&win->extra->list; |
| if(list->lines==NULL) |
if(list->lines==NULL) |
| Line 272 void setuplistparams(WIN *win) |
|
| Line 290 void setuplistparams(WIN *win) |
|
| } |
} |
| } |
} |
| |
|
| char *getcolorname(long color) |
char *_cc_getcolorname(long color) |
| { |
{ |
| switch(color) |
switch(color) |
| { |
{ |
| case C_BLACK:return "black";break; |
case CC_C_BLACK:return "black";break; |
| case C_RED:return "red";break; |
case CC_C_RED:return "red";break; |
| case C_GREEN:return "green";break; |
case CC_C_GREEN:return "green";break; |
| case C_YELLOW:return "yellow";break; |
case CC_C_YELLOW:return "yellow";break; |
| case C_BLUE:return "blue";break; |
case CC_C_BLUE:return "blue";break; |
| case C_MAGENTA:return "magenta";break; |
case CC_C_MAGENTA:return "magenta";break; |
| case C_CYAN:return "cyan";break; |
case CC_C_CYAN:return "cyan";break; |
| case C_WHITE:return "light gray";break; |
case CC_C_WHITE:return "light gray";break; |
| case C_LBLACK:return "dark gray";break; |
case CC_C_LBLACK:return "dark gray";break; |
| case C_LRED:return "light red";break; |
case CC_C_LRED:return "light red";break; |
| case C_LGREEN:return "light green";break; |
case CC_C_LGREEN:return "light green";break; |
| case C_LYELLOW:return "light yellow";break; |
case CC_C_LYELLOW:return "light yellow";break; |
| case C_LBLUE:return "light blue";break; |
case CC_C_LBLUE:return "light blue";break; |
| case C_LMAGENTA:return "light magenta";break; |
case CC_C_LMAGENTA:return "light magenta";break; |
| case C_LCYAN:return "light cyan";break; |
case CC_C_LCYAN:return "light cyan";break; |
| case C_LWHITE:return "white";break; |
case CC_C_LWHITE:return "white";break; |
| default:return NULL; |
default:return NULL; |
| } |
} |
| } |
} |
| |
|
| long strlenmenu(char *text) |
long _cc_strlenmenu(char *text) |
| { |
{ |
| if(strcmp(text,"-")==0)return 0; |
if(strcmp(text,"-")==0)return 0; |
| long i,l=0,len=strlen(text); |
long i,l=0,len=strlen(text); |
| Line 311 long strlenmenu(char *text) |
|
| Line 329 long strlenmenu(char *text) |
|
| return len-l; |
return len-l; |
| } |
} |
| |
|
| bool searchwinexist(WIN *p,WIN *win) |
bool _cc_searchwinexist(Cc_Win *p,Cc_Win *win) |
| { |
{ |
| while(p!=NULL) |
while(p!=NULL) |
| { |
{ |
| if(p==win)return true; |
if(p==win)return true; |
| if(searchwinexist(p->child,win))return true; |
if(_cc_searchwinexist(p->child,win))return true; |
| p=p->next; |
p=p->next; |
| } |
} |
| return false; |
return false; |
| } |
} |
| |
|
| bool winexist(WIN *win) |
bool _cc_winexist(Cc_Win *win) |
| { |
{ |
| if(win==NULL)return true; |
if(win==NULL)return true; |
| else return searchwinexist(hlwin,win); |
else return _cc_searchwinexist(_cc_hlwin,win); |
| } |
} |
| |
|
| void setparent(WIN *win,WIN *parent) |
void _cc_setparent(Cc_Win *win,Cc_Win *parent) |
| { |
{ |
| WIN *p; |
Cc_Win *p; |
| if(win->parent==NULL) |
if(win->parent==NULL) |
| { |
{ |
| if(hlwin==win) |
if(_cc_hlwin==win) |
| { |
{ |
| hlwin=win->next; |
_cc_hlwin=win->next; |
| if(hlendwin==win)hlendwin=NULL; |
if(_cc_hlendwin==win)_cc_hlendwin=NULL; |
| } |
} |
| else if(hlwin!=NULL) |
else if(_cc_hlwin!=NULL) |
| { |
{ |
| p=hlwin; |
p=_cc_hlwin; |
| while(p->next!=win){p=p->next;if(p==NULL)return;} |
while(p->next!=win){p=p->next;if(p==NULL)return;} |
| p->next=win->next; |
p->next=win->next; |
| if(win==hlendwin)hlendwin=p; |
if(win==_cc_hlendwin)_cc_hlendwin=p; |
| } |
} |
| } |
} |
| else |
else |
| Line 364 void setparent(WIN *win,WIN *parent) |
|
| Line 382 void setparent(WIN *win,WIN *parent) |
|
| } |
} |
| win->parent=parent; |
win->parent=parent; |
| win->next=NULL; |
win->next=NULL; |
| if(hlwin==NULL) |
if(_cc_hlwin==NULL) |
| { |
{ |
| hlwin=win; |
_cc_hlwin=win; |
| hlendwin=win; |
_cc_hlendwin=win; |
| } |
} |
| else |
else |
| { |
{ |
| if(parent==NULL) |
if(parent==NULL) |
| { |
{ |
| hlendwin->next=win; |
_cc_hlendwin->next=win; |
| hlendwin=win; |
_cc_hlendwin=win; |
| } |
} |
| else |
else |
| { |
{ |
| Line 392 void setparent(WIN *win,WIN *parent) |
|
| Line 410 void setparent(WIN *win,WIN *parent) |
|
| } |
} |
| } |
} |
| |
|
| char *getshortcuttext(unsigned short shortcut) |
char *_cc_getshortcuttext(unsigned short shortcut) |
| { |
{ |
| static char s[MAXLEN_SHORTCUT_STRING]; |
static char s[MAXLEN_SHORTCUT_STRING]; |
| char *c; |
char *c; |
| unsigned short mod=shortcut&CC_MASK_MOD,key=shortcut&CC_MASK_KEY; |
unsigned short mod=shortcut&CC_MASK_MOD,key=shortcut&CC_MASK_KEY; |
| s[0]='\0'; |
s[0]='\0'; |
| if(key>=CC_OFFSET_C) |
if(key>=CC_OFFSET_CHAR) |
| { |
{ |
| if((mod&CC_D_CTRL)==CC_D_CTRL)sprintf(s,"%s%s",s,"CTRL+"); |
if((mod&CC_MOD_CTRL)==CC_MOD_CTRL)sprintf(s,"%s%s",s,"CTRL+"); |
| if((mod&CC_D_ALT)==CC_D_ALT)sprintf(s,"%s%s",s,"ALT+"); |
if((mod&CC_MOD_ALT)==CC_MOD_ALT)sprintf(s,"%s%s",s,"ALT+"); |
| if((mod&CC_D_SHIFT)==CC_D_SHIFT)sprintf(s,"%s%s",s,"SHIFT+"); |
if((mod&CC_MOD_SHIFT)==CC_MOD_SHIFT)sprintf(s,"%s%s",s,"SHIFT+"); |
| if(key<CC_OFFSET_K)sprintf(s,"%s%c",s,key); |
if(key<CC_OFFSET_KEY)sprintf(s,"%s%c",s,key); |
| else |
else |
| { |
{ |
| switch(key) |
switch(key) |
| { |
{ |
| case CC_K_LEFT:c="LEFT";break; |
case CC_KEY_LEFT:c="LEFT";break; |
| case CC_K_RIGHT:c="RIGHT";break; |
case CC_KEY_RIGHT:c="RIGHT";break; |
| case CC_K_UP:c="UP";break; |
case CC_KEY_UP:c="UP";break; |
| case CC_K_DOWN:c="DOWN";break; |
case CC_KEY_DOWN:c="DOWN";break; |
| case CC_K_HOME:c="HOME";break; |
case CC_KEY_HOME:c="HOME";break; |
| case CC_K_END:c="END";break; |
case CC_KEY_END:c="END";break; |
| case CC_K_PGUP:c="PGUP";break; |
case CC_KEY_PGUP:c="PGUP";break; |
| case CC_K_PGDOWN:c="PGDOWN";break; |
case CC_KEY_PGDOWN:c="PGDOWN";break; |
| case CC_K_CENTER:c="CENTER";break; |
case CC_KEY_CENTER:c="CENTER";break; |
| case CC_K_ESC:c="ESC";break; |
case CC_KEY_ESC:c="ESC";break; |
| case CC_K_ENTER:c="ENTER";break; |
case CC_KEY_ENTER:c="ENTER";break; |
| case CC_K_DEL:c="DEL";break; |
case CC_KEY_DEL:c="DEL";break; |
| case CC_K_INS:c="INS";break; |
case CC_KEY_INS:c="INS";break; |
| case CC_K_TAB:c="TAB";break; |
case CC_KEY_TAB:c="TAB";break; |
| case CC_K_BACK:c="BACK";break; |
case CC_KEY_BACK:c="BACK";break; |
| case CC_K_PAUSE:c="PAUSE";break; |
case CC_KEY_PAUSE:c="PAUSE";break; |
| case CC_K_POPUP:c="POPUP";break; |
case CC_KEY_POPUP:c="POPUP";break; |
| case CC_K_F1:c="F1";break; |
case CC_KEY_F1:c="F1";break; |
| case CC_K_F2:c="F2";break; |
case CC_KEY_F2:c="F2";break; |
| case CC_K_F3:c="F3";break; |
case CC_KEY_F3:c="F3";break; |
| case CC_K_F4:c="F4";break; |
case CC_KEY_F4:c="F4";break; |
| case CC_K_F5:c="F5";break; |
case CC_KEY_F5:c="F5";break; |
| case CC_K_F6:c="F6";break; |
case CC_KEY_F6:c="F6";break; |
| case CC_K_F7:c="F7";break; |
case CC_KEY_F7:c="F7";break; |
| case CC_K_F8:c="F8";break; |
case CC_KEY_F8:c="F8";break; |
| case CC_K_F9:c="F9";break; |
case CC_KEY_F9:c="F9";break; |
| case CC_K_F10:c="F10";break; |
case CC_KEY_F10:c="F10";break; |
| case CC_K_F11:c="F11";break; |
case CC_KEY_F11:c="F11";break; |
| case CC_K_F12:c="F12";break; |
case CC_KEY_F12:c="F12";break; |
| default:c="?"; |
default:c="?"; |
| } |
} |
| sprintf(s,"%s%s",s,c); |
sprintf(s,"%s%s",s,c); |
| Line 445 char *getshortcuttext(unsigned short sho |
|
| Line 463 char *getshortcuttext(unsigned short sho |
|
| return s; |
return s; |
| } |
} |
| |
|
| long getmenucellid(MENU *menu) |
long _cc_getmenucellid(MENU *menu) |
| { |
{ |
| GList *lines=menu->lines; |
GList *lines=menu->lines; |
| long actline; |
long actline; |
| Line 453 long getmenucellid(MENU *menu) |
|
| Line 471 long getmenucellid(MENU *menu) |
|
| { |
{ |
| lines=g_list_next(lines); |
lines=g_list_next(lines); |
| } |
} |
| if(actline==0)return ((CMENU*)lines->data)->id;else return -1; |
if(actline==0)return ((Cc_Menu_I*)lines->data)->id;else return -1; |
| } |
} |
| |
|
| bool isactive(WIN *win) |
bool _cc_isactive(Cc_Win *win) |
| { |
{ |
| if(!isvisible(win))return false; |
if(!_cc_isvisible(win))return false; |
| if(win==NULL)return !hasmodal; |
if(win==NULL)return !_cc_hasmodal; |
| if(win->extra->type==TP_FADE)return false; |
if(win->extra->type==TP_FADE)return false; |
| WIN *p=win; |
Cc_Win *p=win; |
| while(p!=NULL) |
while(p!=NULL) |
| { |
{ |
| if(!p->active)return false; |
if(!p->active)return false; |
| Line 471 bool isactive(WIN *win) |
|
| Line 489 bool isactive(WIN *win) |
|
| if(p->hasmodal)return false; |
if(p->hasmodal)return false; |
| while(p->parent!=NULL) |
while(p->parent!=NULL) |
| { |
{ |
| if((!((p->extra->type==CC_TP_DIALOG)&&p->extra->dialog.modal))&&p->parent->hasmodal)return false; |
if((!((p->extra->type==CC_TP_DIALOG)&&p->extra->dialog.modal))&& |
| |
p->parent->hasmodal)return false; |
| p=p->parent; |
p=p->parent; |
| } |
} |
| if((!((p->extra->type==CC_TP_DIALOG)&&p->extra->dialog.modal))&&hasmodal)return false; |
if((!((p->extra->type==CC_TP_DIALOG)&&p->extra->dialog.modal))&&_cc_hasmodal) |
| |
return false; |
| return true; |
return true; |
| } |
} |
| |
|
| bool dosearchfocused(WIN *win) |
bool _cc_dosearchfocused(Cc_Win *win) |
| { |
{ |
| while(win!=NULL) |
while(win!=NULL) |
| { |
{ |
| if(win==focuswin)return true; |
if(win==_cc_focuswin)return true; |
| if(dosearchfocused(win->child))return true; |
if(_cc_dosearchfocused(win->child))return true; |
| win=win->next; |
win=win->next; |
| if((win!=NULL)&&(win->extra->type==CC_TP_DIALOG))break; |
if((win!=NULL)&&(win->extra->type==CC_TP_DIALOG))break; |
| } |
} |
| return false; |
return false; |
| } |
} |
| |
|
| bool isfocused(WIN *win) |
bool _cc_isfocused(Cc_Win *win) |
| { |
{ |
| if(win==focuswin)return true; |
if(win==_cc_focuswin)return true; |
| return dosearchfocused(win->child); |
return _cc_dosearchfocused(win->child); |
| } |
} |
| |
|
| bool isvisible(WIN *win) |
bool _cc_isvisible(Cc_Win *win) |
| { |
{ |
| if(!hlvisible)return false; |
if(!_cc_hlvisible)return false; |
| WIN *prev; |
Cc_Win *prev; |
| if(win==NULL)return true; |
if(win==NULL)return true; |
| if(!win->active)return false; |
if(!win->active)return false; |
| prev=win; |
prev=win; |
| Line 516 bool isvisible(WIN *win) |
|
| Line 536 bool isvisible(WIN *win) |
|
| return true; |
return true; |
| } |
} |
| |
|
| bool isdlgactive(WIN *win) |
bool _cc_isdlgactive(Cc_Win *win) |
| { |
{ |
| if(win==NULL)return false; |
if(win==NULL)return false; |
| WIN *p=focuswin; |
Cc_Win *p=_cc_focuswin; |
| while(p!=NULL) |
while(p!=NULL) |
| { |
{ |
| if(p==win)return true; |
if(p==win)return true; |
| Line 528 bool isdlgactive(WIN *win) |
|
| Line 548 bool isdlgactive(WIN *win) |
|
| return false; |
return false; |
| } |
} |
| |
|
| void dobringonewintotop(WIN *win) |
void _cc_dobringonewintotop(Cc_Win *win) |
| { |
{ |
| WIN *p; |
Cc_Win *p; |
| if(win->parent!=NULL) |
if(win->parent!=NULL) |
| { |
{ |
| if(win!=win->parent->childend) |
if(win!=win->parent->childend) |
| Line 551 void dobringonewintotop(WIN *win) |
|
| Line 571 void dobringonewintotop(WIN *win) |
|
| } |
} |
| else |
else |
| { |
{ |
| if(win!=hlendwin) |
if(win!=_cc_hlendwin) |
| { |
{ |
| if(win!=hlwin) |
if(win!=_cc_hlwin) |
| { |
{ |
| for(p=hlwin;p->next!=NULL;p=p->next)if(p->next==win)break; |
for(p=_cc_hlwin;p->next!=NULL;p=p->next)if(p->next==win)break; |
| p->next=win->next; |
p->next=win->next; |
| } |
} |
| else |
else |
| { |
{ |
| hlwin=win->next; |
_cc_hlwin=win->next; |
| } |
} |
| win->next=NULL; |
win->next=NULL; |
| hlendwin->next=win; |
_cc_hlendwin->next=win; |
| hlendwin=win; |
_cc_hlendwin=win; |
| } |
} |
| } |
} |
| } |
} |
| |
|
| void dobringwintotop(WIN *win) |
void _cc_dobringwintotop(Cc_Win *win) |
| { |
{ |
| if(win==NULL)return; |
if(win==NULL)return; |
| if((win->extra->type==CC_TP_DIALOG)||(win->extra->type==CC_TP_MENU))dobringonewintotop(win); |
if((win->extra->type==CC_TP_DIALOG)||(win->extra->type==CC_TP_MENU)) |
| dobringwintotop(win->parent); |
_cc_dobringonewintotop(win); |
| |
_cc_dobringwintotop(win->parent); |
| } |
} |
| |
|
| void bringwintotop(WIN *win) |
void _cc_bringwintotop(Cc_Win *win) |
| { |
{ |
| dobringwintotop(win); |
_cc_dobringwintotop(win); |
| redraw(); |
_cc_redraw(); |
| } |
} |
| |
|
| WIN *findchild(WIN *win) |
Cc_Win *_cc_findchild(Cc_Win *win) |
| { |
{ |
| WIN *p; |
Cc_Win *p; |
| if((win!=NULL)&&(win->lastfocus!=NULL))return win->lastfocus; |
if((win!=NULL)&&(win->lastfocus!=NULL))return win->lastfocus; |
| if(win!=NULL)p=win->child; |
if(win!=NULL)p=win->child; |
| else p=hlwin; |
else p=_cc_hlwin; |
| for(;p!=NULL;p=p->next) |
for(;p!=NULL;p=p->next) |
| { |
{ |
| if(((p->extra->type==CC_TP_EDIT)||((p->extra->type==CC_TP_BUTTON)&&(p->extra->button.hasfocus)) |
if(((p->extra->type==CC_TP_EDIT)||((p->extra->type==CC_TP_BUTTON)&& |
| ||(p->extra->type==CC_TP_COMBO)||(p->extra->type==CC_TP_LIST))&&isactive(p))return p; |
(p->extra->button.hasfocus))||(p->extra->type==CC_TP_COMBO)|| |
| if((p->extra->type==CC_TP_DIALOG)&&(isactive(p)||p->hasmodal))return findchild(p); |
(p->extra->type==CC_TP_LIST))&&_cc_isactive(p))return p; |
| |
if((p->extra->type==CC_TP_DIALOG)&&(_cc_isactive(p)||p->hasmodal)) |
| |
return _cc_findchild(p); |
| } |
} |
| return win; |
return win; |
| } |
} |
| |
|
| WIN *findchildnom(WIN *win) |
Cc_Win *_cc_findchildnom(Cc_Win *win) |
| { |
{ |
| WIN *p; |
Cc_Win *p; |
| if((win!=NULL)&&(win->lastfocus!=NULL)&&(win->lastfocus->extra->type!=CC_TP_DIALOG))return win->lastfocus; |
if((win!=NULL)&&(win->lastfocus!=NULL)&& |
| |
(win->lastfocus->extra->type!=CC_TP_DIALOG))return win->lastfocus; |
| if(win!=NULL)p=win->child; |
if(win!=NULL)p=win->child; |
| else p=hlwin; |
else p=_cc_hlwin; |
| for(;p!=NULL;p=p->next) |
for(;p!=NULL;p=p->next) |
| { |
{ |
| if(((p->extra->type==CC_TP_EDIT)||((p->extra->type==CC_TP_BUTTON)&&(p->extra->button.hasfocus)) |
if(((p->extra->type==CC_TP_EDIT)||((p->extra->type==CC_TP_BUTTON)&& |
| ||(p->extra->type==CC_TP_COMBO)||(p->extra->type==CC_TP_LIST))&&isactive(p))return p; |
(p->extra->button.hasfocus))||(p->extra->type==CC_TP_COMBO)|| |
| if((p->extra->type==CC_TP_DIALOG)&&(isactive(p)||p->hasmodal))return findchildnom(p); |
(p->extra->type==CC_TP_LIST))&&_cc_isactive(p))return p; |
| |
if((p->extra->type==CC_TP_DIALOG)&&(_cc_isactive(p)||p->hasmodal)) |
| |
return _cc_findchildnom(p); |
| } |
} |
| return win; |
return win; |
| } |
} |
| |
|
| void combodblclkproc(WIN *sender) |
void _cc_combodblclkproc(Cc_Win *sender) |
| { |
{ |
| if(sender->extra->type==CC_TP_LIST) |
if(sender->extra->type==CC_TP_LIST) |
| if(sender->parent!=NULL) |
if(sender->parent!=NULL) |
| Line 620 void combodblclkproc(WIN *sender) |
|
| Line 646 void combodblclkproc(WIN *sender) |
|
| { |
{ |
| COMBO *combo=&sender->parent->extra->combo; |
COMBO *combo=&sender->parent->extra->combo; |
| long i=sender->extra->list.activeline; |
long i=sender->extra->list.activeline; |
| setcomboactiveitem(combo,combo->activeline,i); |
_cc_setcomboactiveitem(combo,combo->activeline,i); |
| combo->activeline=i; |
combo->activeline=i; |
| combo->scroll=0; |
combo->scroll=0; |
| if(combo->change!=NULL)combo->change(sender->parent); |
if(combo->change!=NULL)combo->change(sender->parent); |
| |
_cc_redrawclientwin(sender->parent); |
| } |
} |
| } |
} |
| |
|
| void buttontimer(TIMER *sender) |
void _cc_buttontimer(Cc_Timer *sender) |
| { |
{ |
| redrawclientwin(sender->win); |
_cc_redrawclientwin(sender->win); |
| del_timer(sender); |
cc_del_timer(sender); |
| } |
} |
| |
|
| void bclosepush(WIN *sender) |
void _cc_bclosepush(Cc_Win *sender) |
| { |
{ |
| DIALOG *dialog=&sender->parent->extra->dialog; |
DIALOG *dialog=&sender->parent->extra->dialog; |
| if(dialog->close!=NULL)dialog->close(sender->parent); |
if(dialog->close!=NULL)dialog->close(sender->parent); |
| } |
} |
| |
|
| void bmaximizepush(WIN *sender) |
void _cc_bmaximizepush(Cc_Win *sender) |
| { |
{ |
| if(sender->parent->extra->dialog.state==CC_SV_MAXIMIZED) |
if(sender->parent->extra->dialog.state==CC_SV_MAXIMIZED) |
| move_win(sender->parent,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_SV_NORMAL); |
cc_move_win(sender->parent,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE, |
| |
CC_SV_NORMAL); |
| else |
else |
| move_win(sender->parent,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_SV_MAXIMIZED); |
cc_move_win(sender->parent,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE, |
| |
CC_SV_MAXIMIZED); |
| } |
} |
| |
|
| void bminimizepush(WIN *sender) |
void _cc_bminimizepush(Cc_Win *sender) |
| { |
{ |
| if(sender->parent->extra->dialog.state==CC_SV_MINIMIZED) |
if(sender->parent->extra->dialog.state==CC_SV_MINIMIZED) |
| move_win(sender->parent,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_SV_NORMAL); |
cc_move_win(sender->parent,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE, |
| |
CC_SV_NORMAL); |
| else |
else |
| move_win(sender->parent,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_SV_MINIMIZED); |
cc_move_win(sender->parent,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE, |
| |
CC_SV_MINIMIZED); |
| } |
} |
| |
|
| void dodeletewin(WIN *win) |
void _cc_dodeletewin(Cc_Win *win) |
| { |
{ |
| WIN *p,*pnext; |
Cc_Win *p,*pnext; |
| if(win==NULL)return; |
if(win==NULL)return; |
| if(win->parent==NULL) |
if(win->parent==NULL) |
| { |
{ |
| if(hlwin==win) |
if(_cc_hlwin==win) |
| { |
{ |
| hlwin=win->next; |
_cc_hlwin=win->next; |
| if(hlendwin==win)hlendwin=NULL; |
if(_cc_hlendwin==win)_cc_hlendwin=NULL; |
| } |
} |
| else if(hlwin!=NULL) |
else if(_cc_hlwin!=NULL) |
| { |
{ |
| p=hlwin; |
p=_cc_hlwin; |
| while(p->next!=win){p=p->next;if(p==NULL)return;} |
while(p->next!=win){p=p->next;if(p==NULL)return;} |
| p->next=win->next; |
p->next=win->next; |
| if(win==hlendwin)hlendwin=p; |
if(win==_cc_hlendwin)_cc_hlendwin=p; |
| } |
} |
| } |
} |
| else |
else |
| Line 694 void dodeletewin(WIN *win) |
|
| Line 725 void dodeletewin(WIN *win) |
|
| while(p!=NULL) |
while(p!=NULL) |
| { |
{ |
| pnext=p->next; |
pnext=p->next; |
| dodeletewin(p); |
_cc_dodeletewin(p); |
| p=pnext; |
p=pnext; |
| } |
} |
| if(win->extra->type==CC_TP_EDIT)free(win->extra->edit.text); |
if(win->extra->type==CC_TP_EDIT)free(win->extra->edit.text); |
| if(focuswin==win)focuswin=NULL; |
if(_cc_focuswin==win)_cc_focuswin=NULL; |
| if(capturewin==win)capturewin=NULL; |
if(_cc_capturewin==win)_cc_capturewin=NULL; |
| usekeys=true; |
_cc_usekeys=true; |
| del_timer_for_win(win); |
cc_del_timer_for_win(win); |
| while(g_list_find(dialoglist,win)!=NULL)dialoglist=g_list_remove(dialoglist,win); |
while(g_list_find(_cc_dialoglist,win)!=NULL) |
| |
_cc_dialoglist=g_list_remove(_cc_dialoglist,win); |
| if(win->extra->type==CC_TP_MENU) |
if(win->extra->type==CC_TP_MENU) |
| { |
{ |
| WIN *parent=win->parent; |
Cc_Win *parent=win->parent; |
| if(parent!=NULL) |
if(parent!=NULL) |
| { |
{ |
| if(parent->extra->type==CC_TP_DIALOG) |
if(parent->extra->type==CC_TP_DIALOG) |
| Line 719 void dodeletewin(WIN *win) |
|
| Line 751 void dodeletewin(WIN *win) |
|
| GList *lines=menu->lines; |
GList *lines=menu->lines; |
| while(lines!=NULL) |
while(lines!=NULL) |
| { |
{ |
| if(((CMENU*)lines->data)->submenu==win) |
if(((Cc_Menu_I*)lines->data)->submenu==win) |
| ((CMENU*)lines->data)->submenu=NULL; |
((Cc_Menu_I*)lines->data)->submenu=NULL; |
| lines=g_list_next(lines); |
lines=g_list_next(lines); |
| } |
} |
| } |
} |
| } |
} |
| if(hlmenu==win)hlmenu=NULL; |
if(_cc_hlmenu==win)_cc_hlmenu=NULL; |
| MENU *menu=&win->extra->menu; |
MENU *menu=&win->extra->menu; |
| GList *lines=menu->lines; |
GList *lines=menu->lines; |
| while(lines!=NULL) |
while(lines!=NULL) |
| Line 737 void dodeletewin(WIN *win) |
|
| Line 769 void dodeletewin(WIN *win) |
|
| } |
} |
| else if(win->extra->type==CC_TP_TEXT) |
else if(win->extra->type==CC_TP_TEXT) |
| { |
{ |
| if(hldowntext==win)hldowntext=NULL; |
if(_cc_hldowntext==win)_cc_hldowntext=NULL; |
| } |
} |
| if(win==lastfocused)lastfocused=NULL; |
if(win==_cc_lastfocused)_cc_lastfocused=NULL; |
| free(win->extra); |
free(win->extra); |
| free(win->windata); |
free(win->windata); |
| free(win); |
free(win); |
| } |
} |
| |
|
| WIN *findnextwin(WIN *win) |
Cc_Win *_cc_findnextwin(Cc_Win *win) |
| { |
{ |
| if(win==NULL)return NULL; |
if(win==NULL)return NULL; |
| WIN *p=win->next; |
Cc_Win *p=win->next; |
| while(true) |
while(true) |
| { |
{ |
| if(p==NULL)p=(win->parent==NULL)?hlwin:win->parent->child; |
if(p==NULL)p=(win->parent==NULL)?_cc_hlwin:win->parent->child; |
| if(((p==win)||( |
if(((p==win)||( |
| ((p->extra->type==CC_TP_EDIT)||((p->extra->type==CC_TP_BUTTON)&&(p->extra->button.hasfocus))|| |
((p->extra->type==CC_TP_EDIT)||((p->extra->type==CC_TP_BUTTON)&& |
| (p->extra->type==CC_TP_COMBO)||(p->extra->type==CC_TP_LIST)) |
(p->extra->button.hasfocus))||(p->extra->type==CC_TP_COMBO)|| |
| ))&&isactive(p))return p; |
(p->extra->type==CC_TP_LIST))))&&_cc_isactive(p))return p; |
| p=p->next; |
p=p->next; |
| } |
} |
| } |
} |
| |
|
| WIN *findprevwin(WIN *win) |
Cc_Win *_cc_findprevwin(Cc_Win *win) |
| { |
{ |
| if(win==NULL)return NULL; |
if(win==NULL)return NULL; |
| WIN *val=win,*prev=win; |
Cc_Win *val=win,*prev=win; |
| while(1) |
while(1) |
| { |
{ |
| val=findnextwin(val); |
val=_cc_findnextwin(val); |
| if(val!=NULL){if(val==win)return prev;}else return NULL; |
if(val!=NULL){if(val==win)return prev;}else return NULL; |
| prev=val; |
prev=val; |
| } |
} |
| } |
} |
| |
|
| WIN *cyclenextwin(WIN *win) |
Cc_Win *_cc_cyclenextwin(Cc_Win *win) |
| { |
{ |
| if(win==NULL)return NULL; |
if(win==NULL)return NULL; |
| WIN *parent=win->parent; |
Cc_Win *parent=win->parent; |
| win=win->next; |
win=win->next; |
| if(win==NULL) |
if(win==NULL) |
| { |
{ |
| if(parent!=NULL)win=parent->child; |
if(parent!=NULL)win=parent->child; |
| else win=hlwin; |
else win=_cc_hlwin; |
| } |
} |
| return win; |
return win; |
| } |
} |
| |
|
| WIN *searchnextdialog(WIN *win) |
Cc_Win *_cc_searchnextdialog(Cc_Win *win) |
| { |
{ |
| WIN *start=win; |
Cc_Win *start=win; |
| if(win==NULL)return NULL; |
if(win==NULL)return NULL; |
| do |
do |
| { |
{ |
| WIN *n=searchnextdialog(win->child); |
Cc_Win *n=_cc_searchnextdialog(win->child); |
| if(n!=NULL)return n; |
if(n!=NULL)return n; |
| if((win->extra->type==CC_TP_DIALOG)&&isactive(win))return win; |
if((win->extra->type==CC_TP_DIALOG)&&_cc_isactive(win))return win; |
| win=cyclenextwin(win); |
win=_cc_cyclenextwin(win); |
| } |
} |
| while(win!=start); |
while(win!=start); |
| return NULL; |
return NULL; |
| } |
} |
| |
|
| WIN *findnextdialog(WIN *win) |
Cc_Win *_cc_findnextdialog(Cc_Win *win) |
| { |
{ |
| WIN *p=searchnextdialog((win!=NULL)?cyclenextwin(win):hlwin); |
Cc_Win *p=_cc_searchnextdialog((win!=NULL)?_cc_cyclenextwin(win):_cc_hlwin); |
| if((win!=NULL)&&(p!=win)) |
if((win!=NULL)&&(p!=win)) |
| { |
{ |
| dialoglist=g_list_prepend(dialoglist,win); |
_cc_dialoglist=g_list_prepend(_cc_dialoglist,win); |
| if(g_list_length(dialoglist)>MAX_PREVIOUS_DIALOGS) |
if(g_list_length(_cc_dialoglist)>MAX_PREVIOUS_DIALOGS) |
| { |
{ |
| GList *l=g_list_last(dialoglist); |
GList *l=g_list_last(_cc_dialoglist); |
| dialoglist=g_list_remove_link(dialoglist,l); |
_cc_dialoglist=g_list_remove_link(_cc_dialoglist,l); |
| g_list_free(l); |
g_list_free(l); |
| } |
} |
| } |
} |
| return p; |
return p; |
| } |
} |
| |
|
| WIN *findprevdialog(WIN *win) |
Cc_Win *_cc_findprevdialog(Cc_Win *win) |
| { |
{ |
| WIN *p; |
Cc_Win *p; |
| if(dialoglist==NULL)return win; |
if(_cc_dialoglist==NULL)return win; |
| p=dialoglist->data; |
p=_cc_dialoglist->data; |
| dialoglist=g_list_remove(dialoglist,p); |
_cc_dialoglist=g_list_remove(_cc_dialoglist,p); |
| return (p!=NULL)?p:win; |
return (p!=NULL)?p:win; |
| } |
} |
| |
|
| bool runacel(WIN *win,long x,long y,unsigned short key) |
bool _cc_runacel(Cc_Win *win,long x,long y,unsigned short key) |
| { |
{ |
| WIN *p=win,*parent; |
Cc_Win *p=win,*parent; |
| if(p==NULL)p=hlmenu; |
if(p==NULL)p=_cc_hlmenu; |
| while(p!=NULL) |
while(p!=NULL) |
| { |
{ |
| if(p->extra->type==CC_TP_DIALOG) |
if(p->extra->type==CC_TP_DIALOG) |
| Line 839 bool runacel(WIN *win,long x,long y,unsi |
|
| Line 871 bool runacel(WIN *win,long x,long y,unsi |
|
| { |
{ |
| parent=p->parent; |
parent=p->parent; |
| if(parent!=NULL)parent=p->parent; |
if(parent!=NULL)parent=p->parent; |
| if(parent==NULL)parent=(WIN*)-1; |
if(parent==NULL)parent=(Cc_Win*)-1; |
| } |
} |
| else parent=p->parent; |
else parent=p->parent; |
| if(p->acel!=NULL){if(p->acel(p,x,y,key))return true;} |
if(p->acel!=NULL){if(p->acel(p,x,y,key))return true;} |
| else if(send_message(p,x,y,key))return true; |
else if(cc_send_message(p,x,y,key))return true; |
| p=parent; |
p=parent; |
| if(!winexist(p))break; |
if(!_cc_winexist(p))break; |
| if(p==NULL)p=hlmenu; |
if(p==NULL)p=_cc_hlmenu; |
| else if(p==(WIN*)-1)break; |
else if(p==(Cc_Win*)-1)break; |
| } |
} |
| if(acelproc!=NULL){if(acelproc(NULL,x,y,key))return true;} |
if(_cc_acelproc!=NULL){if(_cc_acelproc(NULL,x,y,key))return true;} |
| else if(send_message(NULL,x,y,key))return true; |
else if(cc_send_message(NULL,x,y,key))return true; |
| return false; |
return false; |
| } |
} |
| |
|
| WIN *findwin(long x,long y) |
Cc_Win *_cc_findwin(long x,long y) |
| { |
{ |
| if((x<0)||(y<0)||(x>=screenx)||(y>=screeny))return NULL; |
if((x<0)||(y<0)||(x>=_cc_screenx)||(y>=_cc_screeny))return NULL; |
| return cmap[x+y*screenx].win; |
return _cc_cmap[x+y*_cc_screenx].win; |
| } |
} |
| |
|
| WIN *findwinonlypaint(long x,long y) |
Cc_Win *_cc_findwinonlypaint(long x,long y) |
| { |
{ |
| if((x<0)||(y<0)||(x>=screenx)||(y>=screeny))return NULL; |
if((x<0)||(y<0)||(x>=_cc_screenx)||(y>=_cc_screeny))return NULL; |
| return cmap[x+y*screenx].paint; |
return _cc_cmap[x+y*_cc_screenx].paint; |
| } |
} |
| |
|
| void dosetredrawed(WIN *win,bool redrawed) |
void _cc_dosetredrawed(Cc_Win *win,bool redrawed) |
| { |
{ |
| if(hlmenu!=NULL) |
if(_cc_hlmenu!=NULL) |
| { |
{ |
| if(hlmenu->parent!=NULL)setparent(hlmenu,NULL); |
if(_cc_hlmenu->parent!=NULL)_cc_setparent(_cc_hlmenu,NULL); |
| hlmenu->x=0; |
_cc_hlmenu->x=0; |
| hlmenu->y=0; |
_cc_hlmenu->y=0; |
| hlmenu->vx=screenx; |
_cc_hlmenu->vx=_cc_screenx; |
| hlmenu->vy=1; |
_cc_hlmenu->vy=1; |
| } |
} |
| if(hldowntext!=NULL) |
if(_cc_hldowntext!=NULL) |
| { |
{ |
| if(hldowntext->parent!=NULL)setparent(hldowntext,NULL); |
if(_cc_hldowntext->parent!=NULL)_cc_setparent(_cc_hldowntext,NULL); |
| hldowntext->style|=CC_ST_TOP_WIN; |
_cc_hldowntext->style|=CC_ST_TOP_WIN; |
| hldowntext->x=0; |
_cc_hldowntext->x=0; |
| hldowntext->y=screeny-1; |
_cc_hldowntext->y=_cc_screeny-1; |
| hldowntext->vx=screenx; |
_cc_hldowntext->vx=_cc_screenx; |
| hldowntext->vy=1; |
_cc_hldowntext->vy=1; |
| } |
} |
| for(;win!=NULL;win=win->next) |
for(;win!=NULL;win=win->next) |
| { |
{ |
| checkwin(win); |
_cc_checkwin(win); |
| win->redrawed=redrawed; |
win->redrawed=redrawed; |
| dosetredrawed(win->child,redrawed); |
_cc_dosetredrawed(win->child,redrawed); |
| } |
} |
| } |
} |
| |
|
| int doredraw(WIN *win,char drawmode) |
int _cc_doredraw(Cc_Win *win,char drawmode) |
| { |
{ |
| for(;win!=NULL;win=win->next) |
for(;win!=NULL;win=win->next) |
| { |
{ |
| Line 901 int doredraw(WIN *win,char drawmode) |
|
| Line 933 int doredraw(WIN *win,char drawmode) |
|
| { |
{ |
| if(!(win->style&CC_ST_TOP_WIN)) |
if(!(win->style&CC_ST_TOP_WIN)) |
| { |
{ |
| if(drawwin(win,true)==ERR)return ERR; |
if(_cc_drawwin(win,true)==ERR)return ERR; |
| win->redrawed=true; |
win->redrawed=true; |
| checkbars(win,true); |
_cc_checkbars(win,true); |
| if(doredraw(win->child,DM_BOTTOM)==ERR)return ERR; |
if(_cc_doredraw(win->child,DM_BOTTOM)==ERR)return ERR; |
| } |
} |
| else |
else |
| { |
{ |
| topwinlist=g_slist_append(topwinlist,win); |
_cc_topwinlist=g_slist_append(_cc_topwinlist,win); |
| if(doredraw(win->child,DM_MARK_TOP)==ERR)return ERR; |
if(_cc_doredraw(win->child,DM_MARK_TOP)==ERR)return ERR; |
| } |
} |
| } |
} |
| else if(drawmode==DM_MARK_TOP) |
else if(drawmode==DM_MARK_TOP) |
| { |
{ |
| if(win->style&CC_ST_TOP_WIN)topwinlist=g_slist_append(topwinlist,win); |
if(win->style&CC_ST_TOP_WIN) |
| if(doredraw(win->child,DM_MARK_TOP)==ERR)return ERR; |
_cc_topwinlist=g_slist_append(_cc_topwinlist,win); |
| |
if(_cc_doredraw(win->child,DM_MARK_TOP)==ERR)return ERR; |
| } |
} |
| else if(drawmode==DM_TOP_BOTTOM) |
else if(drawmode==DM_TOP_BOTTOM) |
| { |
{ |
| if(!(win->style&CC_ST_TOP_WIN)) |
if(!(win->style&CC_ST_TOP_WIN)) |
| { |
{ |
| if(drawwin(win,true)==ERR)return ERR; |
if(_cc_drawwin(win,true)==ERR)return ERR; |
| win->redrawed=true; |
win->redrawed=true; |
| checkbars(win,true); |
_cc_checkbars(win,true); |
| } |
} |
| if(doredraw(win->child,DM_TOP_BOTTOM)==ERR)return ERR; |
if(_cc_doredraw(win->child,DM_TOP_BOTTOM)==ERR)return ERR; |
| } |
} |
| } |
} |
| return OK; |
return OK; |
| } |
} |
| |
|
| void doneredraw() |
void _cc_doneredraw() |
| { |
{ |
| long x,y; |
long x,y; |
| if((focuswin!=NULL)&&(focuswin->extra->type==CC_TP_EDIT)&& |
if((_cc_focuswin!=NULL)&&(_cc_focuswin->extra->type==CC_TP_EDIT)&& |
| (focuswin->extra->edit.maskpos==-1)) |
(_cc_focuswin->extra->edit.maskpos==-1)) |
| { |
{ |
| EDIT *edit=&focuswin->extra->edit; |
EDIT *edit=&_cc_focuswin->extra->edit; |
| x=0;y=0; |
x=0;y=0; |
| client_to_screen(focuswin,&x,&y); |
cc_client_to_screen(_cc_focuswin,&x,&y); |
| x+=edit->curpos-edit->scroll; |
x+=edit->curpos-edit->scroll; |
| if(((x>=0)&&(y>=0)&&(x<screenx)&&(y<screeny))&&(isvisible(focuswin))&&(findwin(x,y)==focuswin)) |
if(((x>=0)&&(y>=0)&&(x<_cc_screenx)&&(y<_cc_screeny))&& |
| |
(_cc_isvisible(_cc_focuswin))&&(_cc_findwin(x,y)==_cc_focuswin)) |
| { |
{ |
| move(y,x); |
move(y,x); |
| curs_set(1); |
curs_set(1); |
| Line 957 void doneredraw() |
|
| Line 991 void doneredraw() |
|
| curs_set(0); |
curs_set(0); |
| move(0,0); |
move(0,0); |
| } |
} |
| if(mouseactive==MOUSE_GPM)redrawmouse=0; |
if(_cc_mouseactive==MOUSE_GPM)_cc_redrawmouse=0; |
| } |
} |
| |
|
| void redrawclientwin(WIN *win) |
void _cc_redrawclientwin(Cc_Win *win) |
| { |
{ |
| if(!winexist(win))return; |
if(!_cc_winexist(win))return; |
| if(win==NULL)return; |
if(win==NULL)return; |
| if((win->style&CC_ST_AUTOXSIZE)||(win->style&CC_ST_AUTOYSIZE)){redraw();return;} |
if((win->style&CC_ST_AUTOXSIZE)||(win->style&CC_ST_AUTOYSIZE)) |
| if(!isvisible(win))return; |
{ |
| drawwin(win,false); |
_cc_redraw(); |
| |
return; |
| |
} |
| |
if(!_cc_isvisible(win))return; |
| |
_cc_drawwin(win,false); |
| long x=0,y=0,j,i,z; |
long x=0,y=0,j,i,z; |
| attr_t *data=win->windata; |
attr_t *data=win->windata; |
| CMAP *map=cmap; |
CMAP *map=_cc_cmap; |
| client_to_screen(win,&x,&y); |
cc_client_to_screen(win,&x,&y); |
| wredrawln(stdscr,y,win->vy); |
wredrawln(stdscr,y,win->vy); |
| for(j=y;j<y+win->vy;j++) |
for(j=y;j<y+win->vy;j++) |
| { |
{ |
| map=cmap+j*screenx+x; |
map=_cc_cmap+j*_cc_screenx+x; |
| for(i=x;i<x+win->vx;i++) |
for(i=x;i<x+win->vx;i++) |
| { |
{ |
| if(map->win==win) |
if(map->win==win) |
| { |
{ |
| z=*data; |
z=*data; |
| if(map->fade)z=fadecolor(z); |
if(map->fade)z=_cc_fadecolor(z); |
| mvaddch(j,i,z); |
mvaddch(j,i,z); |
| } |
} |
| map++; |
map++; |
| data++; |
data++; |
| } |
} |
| } |
} |
| doneredraw(); |
_cc_doneredraw(); |
| } |
} |
| |
|
| int redraw() |
int _cc_redraw() |
| { |
{ |
| WIN *win; |
Cc_Win *win; |
| long x,y,px,py,a1,a2; |
long x,y,px,py,a1,a2; |
| short c1,c2; |
short c1,c2; |
| GSList *sl; |
GSList *sl; |
| if(hlvisible) |
if(_cc_hlvisible) |
| { |
{ |
| c1=C_BLUE;c1<<=3;c1+=C_WHITE; |
c1=CC_C_BLUE;c1<<=3;c1+=CC_C_WHITE; |
| init_pair(c1,C_WHITE,C_BLUE); |
init_pair(c1,CC_C_WHITE,CC_C_BLUE); |
| c2=!uglycharset?C_BLUE:C_WHITE;c2<<=3;c2+=C_WHITE; |
c2=!_cc_uglycharset?CC_C_BLUE:CC_C_WHITE;c2<<=3;c2+=CC_C_WHITE; |
| init_pair(c2,C_WHITE,!uglycharset?C_BLUE:C_WHITE); |
init_pair(c2,CC_C_WHITE,!_cc_uglycharset?CC_C_BLUE:CC_C_WHITE); |
| a1=(!uglycharset?A_ALTCHARSET:0)+COLOR_PAIR(c1)+mapsymbol[CHESS]; |
a1=(!_cc_uglycharset?A_ALTCHARSET:0)+COLOR_PAIR(c1)+_cc_mapsymbol[CHESS]; |
| a2=A_BOLD+(!uglycharset?A_ALTCHARSET:0)+COLOR_PAIR(c2)+mapsymbol[CHESS]; |
a2=A_BOLD+(!_cc_uglycharset?A_ALTCHARSET:0)+COLOR_PAIR(c2)+ |
| px=(screenx-BITMAPX)/2; |
_cc_mapsymbol[CHESS]; |
| py=(screeny-BITMAPY)/2; |
px=(_cc_screenx-BITMAPX)/2; |
| fillback(&mainwin,a1); |
py=(_cc_screeny-BITMAPY)/2; |
| |
_cc_fillback(&_cc_mainwin,a1); |
| for(y=py;y<py+BITMAPY;y++) |
for(y=py;y<py+BITMAPY;y++) |
| for(x=px;x<px+BITMAPX;x++) |
for(x=px;x<px+BITMAPX;x++) |
| if(bitmap[y-py][x-px]=='o') |
if(_cc_bitmap[y-py][x-px]=='o') |
| maddch(&mainwin,y,x,a2); |
_cc_maddch(&_cc_mainwin,y,x,a2); |
| memset(cmap,0,screenx*screeny*sizeof(CMAP)); |
memset(_cc_cmap,0,_cc_screenx*_cc_screeny*sizeof(CMAP)); |
| dosetredrawed(hlwin,false); |
_cc_dosetredrawed(_cc_hlwin,false); |
| if(doredraw(hlwin,DM_BOTTOM)==ERR)return ERR; |
if(_cc_doredraw(_cc_hlwin,DM_BOTTOM)==ERR)return ERR; |
| sl=topwinlist; |
sl=_cc_topwinlist; |
| while(sl!=NULL) |
while(sl!=NULL) |
| { |
{ |
| win=(WIN*)sl->data; |
win=(Cc_Win*)sl->data; |
| if(drawwin(win,true)==ERR)return ERR; |
if(_cc_drawwin(win,true)==ERR)return ERR; |
| win->redrawed=true; |
win->redrawed=true; |
| checkbars(win,true); |
_cc_checkbars(win,true); |
| if(doredraw(win->child,DM_TOP_BOTTOM)==ERR)return ERR; |
if(_cc_doredraw(win->child,DM_TOP_BOTTOM)==ERR)return ERR; |
| sl=g_slist_next(sl); |
sl=g_slist_next(sl); |
| } |
} |
| if(topwinlist!=NULL) |
if(_cc_topwinlist!=NULL) |
| { |
{ |
| g_slist_free(topwinlist); |
g_slist_free(_cc_topwinlist); |
| topwinlist=NULL; |
_cc_topwinlist=NULL; |
| } |
} |
| } |
} |
| else |
else |
| { |
{ |
| c1=C_BLACK;c1<<=3;c1+=C_WHITE; |
c1=CC_C_BLACK;c1<<=3;c1+=CC_C_WHITE; |
| init_pair(c1,C_WHITE,C_BLACK); |
init_pair(c1,CC_C_WHITE,CC_C_BLACK); |
| a1=COLOR_PAIR(c1)+' '; |
a1=COLOR_PAIR(c1)+' '; |
| fillback(&mainwin,a1); |
_cc_fillback(&_cc_mainwin,a1); |
| } |
} |
| mrefresh(&mainwin); |
_cc_mrefresh(&_cc_mainwin); |
| doneredraw(); |
_cc_doneredraw(); |
| refresh(); |
refresh(); |
| return OK; |
return OK; |
| } |
} |
| |
|
| void checkwin(WIN *win) |
void _cc_checkwin(Cc_Win *win) |
| { |
{ |
| if(win==NULL)return; |
if(win==NULL)return; |
| long x,y,wx,wy,px,py; |
long x,y,wx,wy,px,py; |
| bool result; |
bool result; |
| get_client_size(win->parent,&px,&py,&wx,&wy); |
cc_get_client_size(win->parent,&px,&py,&wx,&wy); |
| switch(win->style&CC_ST_AL_FIXED) |
switch(win->style&CC_ST_AL_FIXED) |
| { |
{ |
| case CC_ST_AL_LEFT:win->x=px;break; |
case CC_ST_AL_LEFT:win->x=px;break; |
| case CC_ST_AL_CENTER: |
case CC_ST_AL_CENTER: |
| win->x=(win->style&CC_ST_AR_FIXED)!=CC_ST_AR_CENTER?(wx+px)/2:(wx+px-win->vx)/2; |
win->x=(win->style&CC_ST_AR_FIXED)!=CC_ST_AR_CENTER?(wx+px)/2: |
| |
(wx+px-win->vx)/2; |
| break; |
break; |
| case CC_ST_AL_FIXED:win->x=win->flx;break; |
case CC_ST_AL_FIXED:win->x=win->flx;break; |
| } |
} |
| Line 1066 void checkwin(WIN *win) |
|
| Line 1106 void checkwin(WIN *win) |
|
| case CC_ST_AR_CENTER: |
case CC_ST_AR_CENTER: |
| if(win->style&CC_ST_AL_FIXED) |
if(win->style&CC_ST_AL_FIXED) |
| { |
{ |
| if((win->style&CC_ST_AL_FIXED)!=CC_ST_AL_CENTER)win->vx=(wx+px)/2-win->x; |
if((win->style&CC_ST_AL_FIXED)!=CC_ST_AL_CENTER) |
| |
win->vx=(wx+px)/2-win->x; |
| } |
} |
| else win->x=(wx+px)/2-win->vx; |
else win->x=(wx+px)/2-win->vx; |
| break; |
break; |
| Line 1079 void checkwin(WIN *win) |
|
| Line 1120 void checkwin(WIN *win) |
|
| { |
{ |
| case CC_ST_AU_UP:win->y=py;break; |
case CC_ST_AU_UP:win->y=py;break; |
| case CC_ST_AU_CENTER: |
case CC_ST_AU_CENTER: |
| win->y=(win->style&CC_ST_AD_FIXED)!=CC_ST_AD_CENTER?(wy+py)/2:(wy+py-win->vy)/2; |
win->y=(win->style&CC_ST_AD_FIXED)!=CC_ST_AD_CENTER?(wy+py)/2: |
| |
(wy+py-win->vy)/2; |
| break; |
break; |
| case CC_ST_AU_FIXED:win->y=win->fly;break; |
case CC_ST_AU_FIXED:win->y=win->fly;break; |
| } |
} |
| Line 1092 void checkwin(WIN *win) |
|
| Line 1134 void checkwin(WIN *win) |
|
| case CC_ST_AD_CENTER: |
case CC_ST_AD_CENTER: |
| if(win->style&CC_ST_AU_FIXED) |
if(win->style&CC_ST_AU_FIXED) |
| { |
{ |
| if((win->style&CC_ST_AU_FIXED)!=CC_ST_AU_CENTER)win->vy=(wy+py)/2-win->y; |
if((win->style&CC_ST_AU_FIXED)!=CC_ST_AU_CENTER) |
| |
win->vy=(wy+py)/2-win->y; |
| } |
} |
| else win->y=(wy+py)/2-win->vy; |
else win->y=(wy+py)/2-win->vy; |
| break; |
break; |
| Line 1102 void checkwin(WIN *win) |
|
| Line 1145 void checkwin(WIN *win) |
|
| break; |
break; |
| } |
} |
| if(win->style&CC_ST_A_TEMP) |
if(win->style&CC_ST_A_TEMP) |
| win->style&=~(CC_ST_AL_FIXED|CC_ST_AU_FIXED|CC_ST_AR_FIXED|CC_ST_AD_FIXED|CC_ST_A_TEMP); |
win->style&=~(CC_ST_AL_FIXED|CC_ST_AU_FIXED|CC_ST_AR_FIXED|CC_ST_AD_FIXED| |
| |
CC_ST_A_TEMP); |
| x=win->x; |
x=win->x; |
| y=win->y; |
y=win->y; |
| client_to_screen(win->parent,&x,&y); |
cc_client_to_screen(win->parent,&x,&y); |
| if(win->extra->type==CC_TP_DIALOG) |
if(win->extra->type==CC_TP_DIALOG) |
| { |
{ |
| if(win->vx<10)win->vx=10; |
if(win->vx<10)win->vx=10; |
| if(x>screenx-1)x=screenx-1; |
if(x>_cc_screenx-1)x=_cc_screenx-1; |
| if(y>screeny-1-(hldowntext!=NULL?1:0))y=screeny-1-(hldowntext!=NULL?1:0); |
if(y>_cc_screeny-1-(_cc_hldowntext!=NULL?1:0)) |
| |
y=_cc_screeny-1-(_cc_hldowntext!=NULL?1:0); |
| if(x+win->vx<=0)x=1-win->vx; |
if(x+win->vx<=0)x=1-win->vx; |
| if(y+win->vy<=0)y=1-win->vy; |
if(y+win->vy<=0)y=1-win->vy; |
| } |
} |
| else if((win->extra->type==CC_TP_LIST)&&(win->extra->list.combotyp==CC_LI_COMBO)) |
else if((win->extra->type==CC_TP_LIST)&& |
| |
(win->extra->list.combotyp==CC_LI_COMBO)) |
| { |
{ |
| if((win->parent!=NULL)&&(win->parent->extra->type==CC_TP_COMBO)) |
if((win->parent!=NULL)&&(win->parent->extra->type==CC_TP_COMBO)) |
| { |
{ |
| px=0;py=0;client_to_screen(win->parent,&px,&py); |
px=0;py=0;cc_client_to_screen(win->parent,&px,&py); |
| x=px-1; |
x=px-1; |
| win->vx=win->parent->vx+2; |
win->vx=win->parent->vx+2; |
| win->vy=win->parent->extra->combo.lstvy; |
win->vy=win->parent->extra->combo.lstvy; |
| y=py+win->parent->vy; |
y=py+win->parent->vy; |
| if(y+win->vy>screeny)y=py-win->vy; |
if(y+win->vy>_cc_screeny)y=py-win->vy; |
| } |
} |
| if(x+win->vx>screenx)x=screenx-win->vx; |
if(x+win->vx>_cc_screenx)x=_cc_screenx-win->vx; |
| if(x<0)x=0; |
if(x<0)x=0; |
| if(x+win->vx>screenx)win->vx=screenx-x; |
if(x+win->vx>_cc_screenx)win->vx=_cc_screenx-x; |
| if(y+win->vy>screeny)y=screeny-win->vy; |
if(y+win->vy>_cc_screeny)y=_cc_screeny-win->vy; |
| if(y<0)y=0; |
if(y<0)y=0; |
| if(y+win->vy>screeny)win->vy=screeny-y; |
if(y+win->vy>_cc_screeny)win->vy=_cc_screeny-y; |
| } |
} |
| else if((win->extra->type==CC_TP_MENU)&&(win->extra->menu.vert)) |
else if((win->extra->type==CC_TP_MENU)&&(win->extra->menu.vert)) |
| { |
{ |
| if(x+win->vx>screenx)x=screenx-win->vx; |
if(x+win->vx>_cc_screenx)x=_cc_screenx-win->vx; |
| if(x<0)x=0; |
if(x<0)x=0; |
| if(y+win->vy>screeny)y=screeny-win->vy; |
if(y+win->vy>_cc_screeny)y=_cc_screeny-win->vy; |
| if(y<0)y=0; |
if(y<0)y=0; |
| } |
} |
| else if((win->extra->type==CC_TP_TEXT)|| |
else if((win->extra->type==CC_TP_TEXT)|| |
| Line 1163 void checkwin(WIN *win) |
|
| Line 1209 void checkwin(WIN *win) |
|
| { |
{ |
| if(win->extra->button.text!=NULL) |
if(win->extra->button.text!=NULL) |
| if((win->style&CC_ST_AUTOXSIZE)==CC_ST_AUTOXSIZE) |
if((win->style&CC_ST_AUTOXSIZE)==CC_ST_AUTOXSIZE) |
| win->vx=strlenmenu(win->extra->button.text)+4; |
win->vx=_cc_strlenmenu(win->extra->button.text)+4; |
| } |
} |
| else if(win->extra->type==CC_TP_COMBO) |
else if(win->extra->type==CC_TP_COMBO) |
| { |
{ |
| Line 1181 void checkwin(WIN *win) |
|
| Line 1227 void checkwin(WIN *win) |
|
| if((win->style&CC_ST_AUTOXSIZE)==CC_ST_AUTOXSIZE)win->vx=list->maxitemlen+2; |
if((win->style&CC_ST_AUTOXSIZE)==CC_ST_AUTOXSIZE)win->vx=list->maxitemlen+2; |
| if((win->style&CC_ST_AUTOYSIZE)==CC_ST_AUTOYSIZE)win->vy=list->numlines+2; |
if((win->style&CC_ST_AUTOYSIZE)==CC_ST_AUTOYSIZE)win->vy=list->numlines+2; |
| } |
} |
| screen_to_client(win->parent,&x,&y); |
cc_screen_to_client(win->parent,&x,&y); |
| win->x=x; |
win->x=x; |
| win->y=y; |
win->y=y; |
| if(win->vx<1)win->vx=1; |
if(win->vx<1)win->vx=1; |
| if(win->vy<1)win->vy=1; |
if(win->vy<1)win->vy=1; |
| wx=0; |
wx=0; |
| wy=0; |
wy=0; |
| client_to_screen(win,&wx,&wy); |
cc_client_to_screen(win,&wx,&wy); |
| x=wx; |
x=wx; |
| y=wy; |
y=wy; |
| if((x>=screenx)||(y>=screeny))return; |
if((x>=_cc_screenx)||(y>=_cc_screeny))return; |
| wx=screenx-wx; |
wx=_cc_screenx-wx; |
| wy=screeny-wy; |
wy=_cc_screeny-wy; |
| if(wx<0)wx=0; |
if(wx<0)wx=0; |
| if(wy<0)wy=0; |
if(wy<0)wy=0; |
| if(win->vx<wx)wx=win->vx; |
if(win->vx<wx)wx=win->vx; |
| Line 1207 void checkwin(WIN *win) |
|
| Line 1253 void checkwin(WIN *win) |
|
| } |
} |
| switch(win->extra->type) |
switch(win->extra->type) |
| { |
{ |
| case CC_TP_COMBO:checkwincombo(win);break; |
case CC_TP_COMBO:_cc_checkwincombo(win);break; |
| case CC_TP_LIST:checkwinlist(win);break; |
case CC_TP_LIST:_cc_checkwinlist(win);break; |
| case CC_TP_MENU:checkwinmenu(win);break; |
case CC_TP_MENU:_cc_checkwinmenu(win);break; |
| case CC_TP_DIALOG:checkwindialog(win); |
case CC_TP_DIALOG:_cc_checkwindialog(win); |
| } |
} |
| } |
} |
| |
|
| int drawwin(WIN *win,bool dorefresh) |
int _cc_drawwin(Cc_Win *win,bool dorefresh) |
| { |
{ |
| if(win==NULL)return; |
if(win==NULL)return; |
| if(!isvisible(win))return; |
if(!_cc_isvisible(win))return; |
| long x,y,wx; |
long x,y,wx; |
| x=0; |
x=0; |
| y=0; |
y=0; |
| client_to_screen(win,&x,&y); |
cc_client_to_screen(win,&x,&y); |
| if((x>=screenx)||(y>=screeny))return; |
if((x>=_cc_screenx)||(y>=_cc_screeny))return; |
| if((x+win->vx<=0)||(y+win->vy<=0))return; |
if((x+win->vx<=0)||(y+win->vy<=0))return; |
| wx=win->vx; |
wx=win->vx; |
| switch(win->extra->type) |
switch(win->extra->type) |
| { |
{ |
| case CC_TP_TEXT:drawwintext(win);break; |
case CC_TP_TEXT:_cc_drawwintext(win);break; |
| case CC_TP_EDIT:drawwinedit(win);break; |
case CC_TP_EDIT:_cc_drawwinedit(win);break; |
| case CC_TP_BUTTON:drawwinbutton(win,wx);break; |
case CC_TP_BUTTON:_cc_drawwinbutton(win,wx);break; |
| case CC_TP_SCROLL:drawwinscroll(win);break; |
case CC_TP_SCROLL:_cc_drawwinscroll(win);break; |
| case CC_TP_LIST:drawwinlist(win,wx);break; |
case CC_TP_LIST:_cc_drawwinlist(win,wx);break; |
| case CC_TP_COMBO:drawwincombo(win);break; |
case CC_TP_COMBO:_cc_drawwincombo(win);break; |
| case CC_TP_STATUS:drawwinstatus(win);break; |
case CC_TP_STATUS:_cc_drawwinstatus(win);break; |
| case CC_TP_PAINT:drawwinpaint(win);break; |
case CC_TP_PAINT:_cc_drawwinpaint(win);break; |
| case CC_TP_MENU:drawwinmenu(win,wx);break; |
case CC_TP_MENU:_cc_drawwinmenu(win,wx);break; |
| case CC_TP_DIALOG:drawwindialog(win,wx);break; |
case CC_TP_DIALOG:_cc_drawwindialog(win,wx);break; |
| case TP_FADE:drawwinfade(win,x,y);break; |
case TP_FADE:_cc_drawwinfade(win,x,y);break; |
| } |
} |
| if(dorefresh)mrefresh(win); |
if(dorefresh)_cc_mrefresh(win); |
| } |
} |
| |
|
| void clipboardmenuproc(WIN *win,long id) |
void _cc_clipboardmenuproc(Cc_Win *win,long id) |
| { |
{ |
| switch(id) |
switch(id) |
| { |
{ |
| case 0:edit_cut(win->parent);break; |
case 0:cc_edit_cut(win->parent);break; |
| case 1:edit_copy(win->parent);break; |
case 1:cc_edit_copy(win->parent);break; |
| case 2:edit_paste(win->parent);break; |
case 2:cc_edit_paste(win->parent);break; |
| case 3:edit_delete(win->parent);break; |
case 3:cc_edit_delete(win->parent);break; |
| case 4:edit_select(win->parent,0,CC_MAXLONG);break; |
case 4:cc_edit_select(win->parent,0,CC_MAXLONG);break; |
| } |
|
| } |
|
| |
|
| #include <term.h> |
|
| #undef buttons |
|
| |
|
| int main(int argc,char *argv[]) |
|
| { |
|
| long i; |
|
| if((i=main_api(argc,argv))!=0)return i; |
|
| long oldattr; |
|
| Gpm_Event ev; |
|
| initscr(); |
|
| start_color(); |
|
| oldattr=attrset(0); |
|
| ESCDELAY=0; |
|
| uglycharset=false; |
|
| for(i=1;i<argc;i++)if(strcmp(argv[i],"-a")==0){uglycharset=true;break;} |
|
| if(uglycharset)mapsymbol=ugmsymbol; |
|
| hascolors=has_colors(); |
|
| keypad(stdscr,true); |
|
| cbreak(); |
|
| noecho(); |
|
| nodelay(stdscr,true); |
|
| curs_set(0); |
|
| mousex=-1; |
|
| mousey=-1; |
|
| Gpm_Connect conn; |
|
| conn.eventMask=GPM_MOVE|GPM_DRAG|GPM_DOWN|GPM_UP; |
|
| conn.defaultMask=0; |
|
| conn.minMod=0; |
|
| conn.maxMod=-1; |
|
| gpm_zerobased=true; |
|
| if((Gpm_Open(&conn,0)!=-1)&&(Gpm_GetEvent(&ev)!=-1)) |
|
| { |
|
| gpmev.x=mousex=ev.x; |
|
| gpmev.y=mousey=ev.y; |
|
| mouseactive=MOUSE_GPM; |
|
| Gpm_Repeat(0); |
|
| GPM_XTERM_ON; |
|
| pthread_create(&gpmthreadp,NULL,gpmthread,NULL); |
|
| } |
|
| else |
|
| { |
|
| mouseactive=MOUSE_XTERM; |
|
| mousemask(ALL_MOUSE_EVENTS|REPORT_MOUSE_POSITION,NULL); |
|
| mouseinterval(0); |
|
| } |
|
| screenx=columns; |
|
| screeny=lines; |
|
| mainwin.x=0; |
|
| mainwin.y=0; |
|
| mainwin.vx=screenx; |
|
| mainwin.vy=screeny; |
|
| mainwin.parent=NULL; |
|
| mainwin.windata=malloc(screenx*screeny*sizeof(attr_t)); |
|
| cmap=malloc(screenx*screeny*sizeof(CMAP)); |
|
| { |
|
| PMENU menu; |
|
| menu.type=CC_TP_MENU; |
|
| menu.cback=C_DEFAULT; |
|
| menu.cborder=C_DEFAULT; |
|
| menu.ctext=C_DEFAULT; |
|
| menu.cutext=C_DEFAULT; |
|
| menu.cactive=C_DEFAULT; |
|
| menu.cactivetext=C_DEFAULT; |
|
| menu.cactiveutext=C_DEFAULT; |
|
| menu.change=NULL; |
|
| menu.select=clipboardmenuproc; |
|
| menu.vert=true; |
|
| clipboardmenu=create_menu(NULL,&menu,NULL); |
|
| add_menu_item(clipboardmenu,&(CMENU){0,false,"Cu&t",CC_D_CTRL|'X',NULL}); |
|
| add_menu_item(clipboardmenu,&(CMENU){1,false,"&Copy",CC_D_CTRL|'C',NULL}); |
|
| add_menu_item(clipboardmenu,&(CMENU){2,false,"&Paste",CC_D_CTRL|'V',NULL}); |
|
| add_menu_item(clipboardmenu,&(CMENU){3,false,"&Delete",0,NULL}); |
|
| add_menu_item(clipboardmenu,&(CMENU){4,false,"Select &All",0,NULL}); |
|
| } |
|
| redraw(); |
|
| init_api(); |
|
| do message_pump();while(apprun); |
|
| done_api(); |
|
| bkgd(oldattr); |
|
| clear(); |
|
| refresh(); |
|
| if(mouseactive==MOUSE_GPM) |
|
| { |
|
| GPM_XTERM_OFF; |
|
| Gpm_Close(); |
|
| } |
} |
| noecho(); |
|
| cbreak(); |
|
| free(mainwin.windata); |
|
| free(cmap); |
|
| endwin(); |
|
| mousemask(0,NULL); |
|
| curs_set(1); |
|
| return end_api(); |
|
| } |
} |