| version 1.5, 2005/12/02 17:15:00 |
version 1.6, 2005/12/08 21:13:04 |
|
|
| // modified by Juraj Kolesar <koli@koli.sk> |
// modified by Juraj Kolesar <koli@koli.sk> |
| |
|
| #include "cc.h" |
#include "cc.h" |
| #define stat spcfocus->stat |
|
| |
|
| bool usekeys=true; |
pthread_t _cc__cc_getchthreadp; |
| |
bool _cc_usekeys=true; |
| |
|
| bool findmenukey(WIN *win,unsigned short key) |
bool _cc_findmenukey(Cc_Win *win,unsigned short key) |
| { |
{ |
| MENU *menu=&win->extra->menu; |
MENU *menu=&win->extra->menu; |
| GList *lines=menu->lines; |
GList *lines=menu->lines; |
| bool gets=false; |
bool gets=false; |
| while(lines!=NULL) |
while(lines!=NULL) |
| { |
{ |
| unsigned short sc=((CMENU*)lines->data)->shortcut; |
unsigned short sc=((Cc_Menu_I*)lines->data)->shortcut; |
| if(((sc&CC_MASK_KEY)>='a')&&((sc&CC_MASK_KEY)<='z'))sc+='A'-'a'; |
if(((sc&CC_MASK_KEY)>='a')&&((sc&CC_MASK_KEY)<='z'))sc+='A'-'a'; |
| if((sc==key)&&(menu->select!=NULL)) |
if((sc==key)&&(menu->select!=NULL)) |
| { |
{ |
| menu->select(win,((CMENU*)lines->data)->id); |
menu->select(win,((Cc_Menu_I*)lines->data)->id); |
| gets=true; |
gets=true; |
| } |
} |
| WIN *submenu=((CMENU*)lines->data)->submenu; |
Cc_Win *submenu=((Cc_Menu_I*)lines->data)->submenu; |
| if(submenu!=NULL)if(findmenukey(submenu,key))gets=true; |
if(submenu!=NULL)if(_cc_findmenukey(submenu,key))gets=true; |
| lines=g_list_next(lines); |
lines=g_list_next(lines); |
| } |
} |
| return gets; |
return gets; |
| } |
} |
| |
|
| bool sendkeymessage(unsigned short key) |
bool _cc_sendkeymessage(unsigned short key) |
| { |
{ |
| if(!usekeys)return true; |
if(!_cc_usekeys)return true; |
| return runacel(focuswin,0,0,key); |
return _cc_runacel(_cc_focuswin,0,0,key); |
| } |
} |
| |
|
| bool dosendkeymessage(WIN *spcfocus,unsigned short key) |
bool _cc_dosendkeymessage(Cc_Win *spcfocus,unsigned short key) |
| { |
{ |
| if(spcfocus==NULL)return false; |
if(spcfocus==NULL)return false; |
| EDIT *edit; |
EDIT *edit; |
| Line 48 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| Line 48 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| long len,i,line; |
long len,i,line; |
| char *er,*c,s; |
char *er,*c,s; |
| unsigned short kk=key&CC_MASK_KEY; |
unsigned short kk=key&CC_MASK_KEY; |
| WIN *p; |
Cc_Win *p; |
| switch(spcfocus->extra->type) |
switch(spcfocus->extra->type) |
| { |
{ |
| case CC_TP_EDIT: |
case CC_TP_EDIT: |
| if((key==(CC_D_CTRL|'c'))||(key==(CC_D_CTRL|'C'))){edit_copy(spcfocus);gets=true;break;} |
if((key==(CC_MOD_CTRL|'c'))||(key==(CC_MOD_CTRL|'C'))) |
| if((key==(CC_D_CTRL|'v'))||(key==(CC_D_CTRL|'V'))){edit_paste(spcfocus);gets=true;break;} |
{cc_edit_copy(spcfocus);gets=true;break;} |
| if((key==(CC_D_CTRL|'x'))||(key==(CC_D_CTRL|'X'))){edit_cut(spcfocus);gets=true;break;} |
if((key==(CC_MOD_CTRL|'v'))||(key==(CC_MOD_CTRL|'V'))) |
| if((key&(CC_MASK_MOD-CC_D_SHIFT)))break; |
{cc_edit_paste(spcfocus);gets=true;break;} |
| |
if((key==(CC_MOD_CTRL|'x'))||(key==(CC_MOD_CTRL|'X'))) |
| |
{cc_edit_cut(spcfocus);gets=true;break;} |
| |
if((key&(CC_MASK_MOD-CC_MOD_SHIFT)))break; |
| edit=&spcfocus->extra->edit; |
edit=&spcfocus->extra->edit; |
| if(edit->style==CC_ED_READONLY)break; |
if(edit->style==CC_ED_READONLY)break; |
| len=strlen(edit->text); |
len=strlen(edit->text); |
| Line 77 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| Line 80 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| if(er==NULL)return false; |
if(er==NULL)return false; |
| edit->text=er; |
edit->text=er; |
| if(line>0)for(i=len;i>edit->curpos;i--)edit->text[i]=edit->text[i-1]; |
if(line>0)for(i=len;i>edit->curpos;i--)edit->text[i]=edit->text[i-1]; |
| else if(line<0)for(i=edit->curpos+1;i<len+line;i++)edit->text[i]=edit->text[i-line]; |
else if(line<0)for(i=edit->curpos+1;i<len+line;i++) |
| |
edit->text[i]=edit->text[i-line]; |
| edit->text[edit->curpos]=key; |
edit->text[edit->curpos]=key; |
| len+=line; |
len+=line; |
| edit->text[len]='\0'; |
edit->text[len]='\0'; |
| edit->curpos++; |
edit->curpos++; |
| edit->maskpos=-1; |
edit->maskpos=-1; |
| if(edit->curpos-edit->scroll>spcfocus->vx-1)edit->scroll+=(spcfocus->vx/2>10)?10:spcfocus->vx/2; |
if(edit->curpos-edit->scroll>spcfocus->vx-1) |
| |
edit->scroll+=(spcfocus->vx/2>10)?10:spcfocus->vx/2; |
| if(edit->change!=NULL)edit->change(spcfocus); |
if(edit->change!=NULL)edit->change(spcfocus); |
| chang=true; |
chang=true; |
| gets=true; |
gets=true; |
| break; |
break; |
| case CC_TP_BUTTON: |
case CC_TP_BUTTON: |
| button=&spcfocus->extra->button; |
button=&spcfocus->extra->button; |
| if((key&~CC_D_SHIFT)==' ') |
if((key&~CC_MOD_SHIFT)==' ') |
| { |
{ |
| if(button->status==TS_HIGH)button->status=TS_EXPUSH;else button->status=TS_PUSH; |
if(button->status==TS_HIGH)button->status=TS_EXPUSH; |
| |
else button->status=TS_PUSH; |
| chang=true; |
chang=true; |
| if(button->push!=NULL)button->push(spcfocus); |
if(button->push!=NULL)button->push(spcfocus); |
| gets=true; |
gets=true; |
| Line 101 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| Line 107 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| case CC_TP_MENU: |
case CC_TP_MENU: |
| if((kk>='a')&&(kk<='z')){key+='A'-'a';kk=key&CC_MASK_KEY;} |
if((kk>='a')&&(kk<='z')){key+='A'-'a';kk=key&CC_MASK_KEY;} |
| menu=&spcfocus->extra->menu; |
menu=&spcfocus->extra->menu; |
| if(spcfocus==focuswin) |
if(spcfocus==_cc_focuswin) |
| { |
{ |
| gets=true; |
gets=true; |
| lines=menu->lines; |
lines=menu->lines; |
| line=0; |
line=0; |
| while(lines!=NULL) |
while(lines!=NULL) |
| { |
{ |
| c=((CMENU*)lines->data)->text; |
c=((Cc_Menu_I*)lines->data)->text; |
| len=strlen(c); |
len=strlen(c); |
| for(i=0;i<len;i++) |
for(i=0;i<len;i++) |
| { |
{ |
| Line 119 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| Line 125 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| if(s==kk) |
if(s==kk) |
| { |
{ |
| menu->activeline=line; |
menu->activeline=line; |
| dosendsyskeymessage(spcfocus,CC_K_ENTER); |
_cc_dosendsyskeymessage(spcfocus,CC_KEY_ENTER); |
| } |
} |
| i++; |
i++; |
| } |
} |
| Line 130 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| Line 136 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| } |
} |
| if((!menu->vert)|| |
if((!menu->vert)|| |
| (spcfocus->parent==NULL)|| |
(spcfocus->parent==NULL)|| |
| (spcfocus->parent->extra->type!=CC_TP_MENU))gets|=findmenukey(spcfocus,key); |
(spcfocus->parent->extra->type!=CC_TP_MENU)) |
| |
gets|=_cc_findmenukey(spcfocus,key); |
| break; |
break; |
| case CC_TP_DIALOG: |
case CC_TP_DIALOG: |
| if((kk>='a')&&(kk<='z'))kk+='A'-'a'; |
if((kk>='a')&&(kk<='z'))kk+='A'-'a'; |
| Line 148 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| Line 155 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| if((s>='a')&&(s<='z'))s+='A'-'a'; |
if((s>='a')&&(s<='z'))s+='A'-'a'; |
| if(s==kk) |
if(s==kk) |
| { |
{ |
| dosendsyskeymessage(p,CC_K_ENTER); |
_cc_dosendsyskeymessage(p,CC_KEY_ENTER); |
| gets=true; |
gets=true; |
| } |
} |
| i++; |
i++; |
| Line 157 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| Line 164 bool dosendkeymessage(WIN *spcfocus,unsi |
|
| } |
} |
| break; |
break; |
| } |
} |
| if(chang)redrawclientwin(spcfocus); |
if(chang)_cc_redrawclientwin(spcfocus); |
| return gets; |
return gets; |
| } |
} |
| |
|
| bool dosendsyskeymessage(WIN *spcfocus,unsigned short key) |
bool _cc_dosendsyskeymessage(Cc_Win *spcfocus,unsigned short key) |
| { |
{ |
| EDIT *edit; |
EDIT *edit; |
| BUTTON *button; |
BUTTON *button; |
| Line 183 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 190 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| len=strlen(edit->text); |
len=strlen(edit->text); |
| switch(key) |
switch(key) |
| { |
{ |
| case CC_K_UP: |
case CC_KEY_UP: |
| set_focus(findprevwin(spcfocus)); |
cc_set_focus(_cc_findprevwin(spcfocus)); |
| stat=0; |
spcfocus->stat=0; |
| break; |
break; |
| case CC_K_DOWN: |
case CC_KEY_DOWN: |
| set_focus(findnextwin(spcfocus)); |
cc_set_focus(_cc_findnextwin(spcfocus)); |
| stat=0; |
spcfocus->stat=0; |
| break; |
break; |
| case CC_K_POPUP: |
case CC_KEY_POPUP: |
| x=0; |
x=0; |
| y=1; |
y=1; |
| client_to_screen(spcfocus,&x,&y); |
cc_client_to_screen(spcfocus,&x,&y); |
| set_parent(clipboardmenu,spcfocus); |
cc_set_parent(_cc_clipboardmenu,spcfocus); |
| track_popup_menu(clipboardmenu,x,y); |
cc_track_popup_menu(_cc_clipboardmenu,x,y); |
| break; |
break; |
| case CC_K_INS|CC_D_CTRL:edit_copy(spcfocus);gets=true;break; |
case CC_KEY_INS|CC_MOD_CTRL:cc_edit_copy(spcfocus);gets=true;break; |
| case CC_K_INS|CC_D_SHIFT:edit_paste(spcfocus);gets=true;break; |
case CC_KEY_INS|CC_MOD_SHIFT:cc_edit_paste(spcfocus);gets=true;break; |
| case CC_K_DEL|CC_D_SHIFT:edit_cut(spcfocus);gets=true;break; |
case CC_KEY_DEL|CC_MOD_SHIFT:cc_edit_cut(spcfocus);gets=true;break; |
| case CC_K_LEFT: |
case CC_KEY_LEFT: |
| if(edit->curpos>0){edit->curpos--;chang=true;} |
if(edit->curpos>0){edit->curpos--;chang=true;} |
| if(edit->maskpos!=-1){edit->maskpos=-1;chang=true;} |
if(edit->maskpos!=-1){edit->maskpos=-1;chang=true;} |
| gets=true;break; |
gets=true;break; |
| case CC_K_LEFT|CC_D_SHIFT: |
case CC_KEY_LEFT|CC_MOD_SHIFT: |
| if(len!=0)if(edit->maskpos==-1){edit->maskpos=edit->curpos;chang=true;} |
if(len!=0)if(edit->maskpos==-1) |
| |
{edit->maskpos=edit->curpos;chang=true;} |
| if(edit->curpos>0){edit->curpos--;chang=true;} |
if(edit->curpos>0){edit->curpos--;chang=true;} |
| gets=true;break; |
gets=true;break; |
| case CC_K_RIGHT: |
case CC_KEY_RIGHT: |
| if(edit->curpos<len){edit->curpos++;chang=true;} |
if(edit->curpos<len){edit->curpos++;chang=true;} |
| if(edit->maskpos!=-1){edit->maskpos=-1;chang=true;} |
if(edit->maskpos!=-1){edit->maskpos=-1;chang=true;} |
| gets=true;break; |
gets=true;break; |
| case CC_K_RIGHT|CC_D_SHIFT: |
case CC_KEY_RIGHT|CC_MOD_SHIFT: |
| if(len!=0)if(edit->maskpos==-1){edit->maskpos=edit->curpos;chang=true;} |
if(len!=0)if(edit->maskpos==-1) |
| |
{edit->maskpos=edit->curpos;chang=true;} |
| if(edit->curpos<len-1){edit->curpos++;chang=true;} |
if(edit->curpos<len-1){edit->curpos++;chang=true;} |
| gets=true;break; |
gets=true;break; |
| case CC_K_HOME:edit->curpos=0;edit->maskpos=-1;chang=true;gets=true;break; |
case CC_KEY_HOME:edit->curpos=0;edit->maskpos=-1;chang=true;gets=true; |
| case CC_K_HOME|CC_D_SHIFT: |
break; |
| if(len!=0)edit->maskpos=edit->curpos;edit->curpos=0;chang=true;gets=true;break; |
case CC_KEY_HOME|CC_MOD_SHIFT: |
| case CC_K_END:edit->curpos=len;edit->maskpos=-1;chang=true;gets=true;break; |
if(len!=0)edit->maskpos=edit->curpos;edit->curpos=0;chang=true; |
| case CC_K_END|CC_D_SHIFT: |
gets=true;break; |
| if(len!=0)edit->maskpos=edit->curpos;edit->curpos=len-1;chang=true;gets=true;break; |
case CC_KEY_END:edit->curpos=len;edit->maskpos=-1;chang=true;gets=true; |
| case CC_K_DEL:; |
break; |
| |
case CC_KEY_END|CC_MOD_SHIFT: |
| |
if(len!=0)edit->maskpos=edit->curpos;edit->curpos=len-1;chang=true; |
| |
gets=true;break; |
| |
case CC_KEY_DEL:; |
| if(edit->style==CC_ED_READONLY)break; |
if(edit->style==CC_ED_READONLY)break; |
| if(edit->curpos<len) |
if(edit->curpos<len) |
| { |
{ |
| Line 240 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 253 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| actline=edit->maskpos-edit->curpos+1; |
actline=edit->maskpos-edit->curpos+1; |
| } |
} |
| else actline=1; |
else actline=1; |
| for(i=edit->curpos;i<len-actline;i++)edit->text[i]=edit->text[i+actline]; |
for(i=edit->curpos;i<len-actline;i++) |
| |
edit->text[i]=edit->text[i+actline]; |
| len-=actline; |
len-=actline; |
| er=(unsigned char*)realloc(edit->text,len+1); |
er=(unsigned char*)realloc(edit->text,len+1); |
| edit->maskpos=-1; |
edit->maskpos=-1; |
| Line 252 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 266 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| } |
} |
| gets=true; |
gets=true; |
| break; |
break; |
| case CC_K_BACK: |
case CC_KEY_BACK: |
| if(edit->style==CC_ED_READONLY)break; |
if(edit->style==CC_ED_READONLY)break; |
| if((edit->curpos>0)||((edit->maskpos!=-1)&&(edit->curpos>=0))) |
if((edit->curpos>0)||((edit->maskpos!=-1)&&(edit->curpos>=0))) |
| { |
{ |
| Line 276 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 290 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| edit->text=(unsigned char*)realloc(edit->text,len+1); |
edit->text=(unsigned char*)realloc(edit->text,len+1); |
| edit->maskpos=-1; |
edit->maskpos=-1; |
| edit->text[len]='\0'; |
edit->text[len]='\0'; |
| if(edit->curpos-edit->scroll<0)edit->scroll-=(spcfocus->vx/2>10)?10:spcfocus->vx/2; |
if(edit->curpos-edit->scroll<0) |
| |
edit->scroll-=(spcfocus->vx/2>10)?10:spcfocus->vx/2; |
| chang=true; |
chang=true; |
| change=edit->change; |
change=edit->change; |
| } |
} |
| Line 297 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 312 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| break; |
break; |
| case CC_TP_BUTTON: |
case CC_TP_BUTTON: |
| button=&spcfocus->extra->button; |
button=&spcfocus->extra->button; |
| if(key==CC_K_ENTER) |
if(key==CC_KEY_ENTER) |
| { |
{ |
| if(button->status==TS_HIGH)button->status=TS_EXPUSH;else button->status=TS_PUSH; |
if(button->status==TS_HIGH)button->status=TS_EXPUSH; |
| |
else button->status=TS_PUSH; |
| chang=true; |
chang=true; |
| if(button->push!=NULL)button->push(spcfocus); |
if(button->push!=NULL)button->push(spcfocus); |
| gets=true; |
gets=true; |
| } |
} |
| else if((key==CC_K_LEFT)||(key==CC_K_UP)) |
else if((key==CC_KEY_LEFT)||(key==CC_KEY_UP)) |
| { |
{ |
| set_focus(findprevwin(spcfocus)); |
cc_set_focus(_cc_findprevwin(spcfocus)); |
| gets=true; |
gets=true; |
| stat=0; |
spcfocus->stat=0; |
| } |
} |
| else if((key==CC_K_RIGHT)||(key==CC_K_DOWN)) |
else if((key==CC_KEY_RIGHT)||(key==CC_KEY_DOWN)) |
| { |
{ |
| set_focus(findnextwin(spcfocus)); |
cc_set_focus(_cc_findnextwin(spcfocus)); |
| gets=true; |
gets=true; |
| stat=0; |
spcfocus->stat=0; |
| } |
} |
| break; |
break; |
| case CC_TP_LIST: |
case CC_TP_LIST: |
| Line 325 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 341 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| numlines=list->numlines; |
numlines=list->numlines; |
| switch(key) |
switch(key) |
| { |
{ |
| case CC_K_LEFT:if(hscroll->pos>hscroll->minpos){hscroll->pos--;chang=true;}gets=true;break; |
case CC_KEY_LEFT:if(hscroll->pos>hscroll->minpos) |
| case CC_K_RIGHT:if(hscroll->pos<hscroll->maxpos){hscroll->pos++;chang=true;}gets=true;break; |
{hscroll->pos--;chang=true; |
| case CC_K_UP:list->activeline--;gets=true;break; |
_cc_redrawclientwin(list->hscroll);}gets=true;break; |
| case CC_K_DOWN:list->activeline++;gets=true;break; |
case CC_KEY_RIGHT:if(hscroll->pos<hscroll->maxpos) |
| case CC_K_PGUP:list->activeline-=vscroll->pagecnt;gets=true;break; |
{hscroll->pos++;chang=true; |
| case CC_K_PGDOWN:list->activeline+=vscroll->pagecnt;gets=true;break; |
_cc_redrawclientwin(list->hscroll);}gets=true;break; |
| case CC_K_HOME:list->activeline=0;gets=true;break; |
case CC_KEY_UP:list->activeline--;gets=true;break; |
| case CC_K_END:list->activeline=numlines-1;gets=true;break; |
case CC_KEY_DOWN:list->activeline++;gets=true;break; |
| case CC_K_ENTER: |
case CC_KEY_PGUP:list->activeline-=vscroll->pagecnt;gets=true;break; |
| |
case CC_KEY_PGDOWN:list->activeline+=vscroll->pagecnt;gets=true;break; |
| |
case CC_KEY_HOME:list->activeline=0;gets=true;break; |
| |
case CC_KEY_END:list->activeline=numlines-1;gets=true;break; |
| |
case CC_KEY_ENTER: |
| if(list->combotyp==CC_LI_COMBO) |
if(list->combotyp==CC_LI_COMBO) |
| { |
{ |
| capturewin=NULL; |
_cc_capturewin=NULL; |
| sendmousemessage(mousex,mousey,CC_M_LBUTTONUP); |
_cc_sendmousemessage(_cc_mousex,_cc_mousey,CC_MOUSE_L_UP); |
| set_focus(spcfocus->parent); |
cc_set_focus(spcfocus->parent); |
| show_win(spcfocus,false); |
cc_show_win(spcfocus,false); |
| gets=true; |
gets=true; |
| } |
} |
| if(list->dblclk!=NULL) |
if(list->dblclk!=NULL) |
| { |
{ |
| if((list->combotyp==CC_LI_COMBO)&&(spcfocus->parent!=NULL)&& |
if((list->combotyp==CC_LI_COMBO)&&(spcfocus->parent!=NULL)&& |
| (spcfocus->parent->extra->type==CC_TP_COMBO)&&(list->activeitem!=NULL)) |
(spcfocus->parent->extra->type==CC_TP_COMBO)&& |
| |
(list->activeitem!=NULL)) |
| { |
{ |
| combo=&spcfocus->parent->extra->combo; |
combo=&spcfocus->parent->extra->combo; |
| char *data=list->activeitem->data; |
char *data=list->activeitem->data; |
| set_text(combo->edit,data); |
cc_set_text(combo->edit,data); |
| |
cc_edit_select(combo->edit,0,CC_MAXLONG); |
| } |
} |
| list->dblclk(spcfocus); |
list->dblclk(spcfocus); |
| chang=true; |
chang=true; |
| } |
} |
| break; |
break; |
| case CC_K_ESC: |
case CC_KEY_ESC: |
| if(list->combotyp==CC_LI_COMBO) |
if(list->combotyp==CC_LI_COMBO) |
| { |
{ |
| capturewin=NULL; |
_cc_capturewin=NULL; |
| sendmousemessage(mousex,mousey,CC_M_LBUTTONUP); |
_cc_sendmousemessage(_cc_mousex,_cc_mousey,CC_MOUSE_L_UP); |
| set_focus(spcfocus->parent); |
cc_set_focus(spcfocus->parent); |
| show_win(spcfocus,false); |
cc_show_win(spcfocus,false); |
| gets=true; |
gets=true; |
| } |
} |
| break; |
break; |
| } |
} |
| if(list->activeline<0)list->activeline=0; |
if(list->activeline<0)list->activeline=0; |
| if(list->activeline>numlines-1)list->activeline=numlines-1; |
if(list->activeline>numlines-1)list->activeline=numlines-1; |
| if(list->activeline<vscroll->pos)vscroll->pos=list->activeline; |
if(list->activeline<vscroll->pos) |
| if(list->activeline-spcfocus->vy+3>vscroll->pos)vscroll->pos=list->activeline-spcfocus->vy+3; |
{ |
| |
vscroll->pos=list->activeline; |
| |
_cc_redrawclientwin(list->vscroll); |
| |
} |
| |
if(list->activeline-spcfocus->vy+3>vscroll->pos) |
| |
{ |
| |
vscroll->pos=list->activeline-spcfocus->vy+3; |
| |
_cc_redrawclientwin(list->vscroll); |
| |
} |
| if(actline!=list->activeline) |
if(actline!=list->activeline) |
| { |
{ |
| setlistactiveitem(list,actline,list->activeline); |
_cc_setlistactiveitem(list,actline,list->activeline); |
| if(list->change!=NULL)list->change(spcfocus); |
if(list->change!=NULL)list->change(spcfocus); |
| chang=true; |
chang=true; |
| } |
} |
| Line 385 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 415 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| numlines=list->numlines; |
numlines=list->numlines; |
| x=spcfocus->vx-1; |
x=spcfocus->vx-1; |
| y=0; |
y=0; |
| client_to_screen(spcfocus,&x,&y); |
cc_client_to_screen(spcfocus,&x,&y); |
| switch(key) |
switch(key) |
| { |
{ |
| case CC_K_LEFT:combo->scroll--;chang=true;gets=true;break; |
case CC_KEY_LEFT:combo->scroll--;chang=true;gets=true;break; |
| case CC_K_RIGHT:combo->scroll++;chang=true;gets=true;break; |
case CC_KEY_RIGHT:combo->scroll++;chang=true;gets=true;break; |
| case CC_K_UP:combo->activeline--;gets=true;break; |
case CC_KEY_UP: |
| case CC_K_DOWN:combo->activeline++;gets=true;break; |
if((combo->edit==NULL)|| |
| case CC_K_PGUP:combo->activeline-=vscroll->pagecnt;gets=true;break; |
(strcmp(combo->edit->extra->edit.text,combo->activeitem->data)==0)) |
| case CC_K_PGDOWN:combo->activeline+=vscroll->pagecnt;gets=true;break; |
combo->activeline--; |
| case CC_K_HOME:combo->activeline=0;gets=true;break; |
else {combo->activeline=0;actline=-1;} |
| case CC_K_END:combo->activeline=numlines-1;gets=true;break; |
gets=true; |
| case CC_K_ENTER: |
break; |
| if(capturewin!=spcfocus)capturewin=NULL; |
case CC_KEY_DOWN: |
| sendmousemessage(x,y,CC_M_LBUTTONDOWN); |
if((combo->edit==NULL)|| |
| sendmousemessage(x,y,CC_M_LBUTTONUP); |
(strcmp(combo->edit->extra->edit.text,combo->activeitem->data)==0)) |
| |
combo->activeline++; |
| |
else {combo->activeline=0;actline=-1;} |
| |
gets=true; |
| |
break; |
| |
case CC_KEY_PGUP: |
| |
if((combo->edit==NULL)|| |
| |
(strcmp(combo->edit->extra->edit.text,combo->activeitem->data)==0)) |
| |
combo->activeline-=vscroll->pagecnt; |
| |
else {combo->activeline=0;actline=-1;} |
| |
gets=true; |
| |
break; |
| |
case CC_KEY_PGDOWN: |
| |
if((combo->edit==NULL)|| |
| |
(strcmp(combo->edit->extra->edit.text,combo->activeitem->data)==0)) |
| |
combo->activeline+=vscroll->pagecnt; |
| |
else {combo->activeline=numlines-1;actline=-1;} |
| |
gets=true; |
| |
break; |
| |
case CC_KEY_HOME:combo->activeline=0;gets=true;break; |
| |
case CC_KEY_END:combo->activeline=numlines-1;gets=true;break; |
| |
case CC_KEY_ENTER: |
| |
if(_cc_capturewin!=spcfocus)_cc_capturewin=NULL; |
| |
_cc_sendmousemessage(x,y,CC_MOUSE_L_DOWN); |
| |
_cc_sendmousemessage(x,y,CC_MOUSE_L_UP); |
| gets=true; |
gets=true; |
| break; |
break; |
| } |
} |
| Line 408 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 462 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| if(actline!=combo->activeline) |
if(actline!=combo->activeline) |
| { |
{ |
| chang=true; |
chang=true; |
| setcomboactiveitem(combo,actline,combo->activeline); |
_cc_setcomboactiveitem(combo,actline,combo->activeline); |
| char *data=combo->activeitem->data; |
char *data=combo->activeitem->data; |
| set_text(combo->edit,data); |
cc_set_text(combo->edit,data); |
| |
cc_edit_select(combo->edit,0,CC_MAXLONG); |
| if(combo->change!=NULL)combo->change(spcfocus); |
if(combo->change!=NULL)combo->change(spcfocus); |
| } |
} |
| break; |
break; |
| Line 420 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 475 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| if(menu->lines!=NULL)numlines=g_list_length(menu->lines);else numlines=0; |
if(menu->lines!=NULL)numlines=g_list_length(menu->lines);else numlines=0; |
| switch(key) |
switch(key) |
| { |
{ |
| case CC_K_LEFT: |
case CC_KEY_LEFT: |
| if(!isfocused(spcfocus))return gets; |
if(!_cc_isfocused(spcfocus))return gets; |
| if(menu->lines==NULL)return gets; |
if(menu->lines==NULL)return gets; |
| if(!menu->vert) |
if(!menu->vert) |
| { |
{ |
| Line 439 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 494 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| if(lines==start){break;menu->activeline=-1;} |
if(lines==start){break;menu->activeline=-1;} |
| if(lines==NULL)lines=g_list_last(menu->lines); |
if(lines==NULL)lines=g_list_last(menu->lines); |
| } |
} |
| while(strcmp(((CMENU*)lines->data)->text,"-")==0); |
while(strcmp(((Cc_Menu_I*)lines->data)->text,"-")==0); |
| if(focuswin!=spcfocus) |
if(_cc_focuswin!=spcfocus) |
| { |
{ |
| dosendsyskeymessage(spcfocus,CC_K_ENTER); |
_cc_dosendsyskeymessage(spcfocus,CC_KEY_ENTER); |
| chang=false; |
chang=false; |
| } |
} |
| gets=true; |
gets=true; |
| Line 451 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 506 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| { |
{ |
| if(spcfocus->parent!=NULL) |
if(spcfocus->parent!=NULL) |
| { |
{ |
| WIN *parent=spcfocus->parent; |
Cc_Win *parent=spcfocus->parent; |
| if(parent->extra->type==CC_TP_MENU) |
if(parent->extra->type==CC_TP_MENU) |
| { |
{ |
| MENU *menus=&parent->extra->menu; |
MENU *menus=&parent->extra->menu; |
| if(menus->vert) |
if(menus->vert) |
| { |
{ |
| menu->activeline=-1; |
menu->activeline=-1; |
| WIN *capt=capturewin; |
Cc_Win *capt=_cc_capturewin; |
| show_win(spcfocus,false); |
cc_show_win(spcfocus,false); |
| set_focus(spcfocus->parent); |
cc_set_focus(spcfocus->parent); |
| if(capt==spcfocus)capturewin=spcfocus->parent; |
if(capt==spcfocus)_cc_capturewin=spcfocus->parent; |
| gets=true; |
gets=true; |
| } |
} |
| } |
} |
| } |
} |
| } |
} |
| break; |
break; |
| case CC_K_RIGHT: |
case CC_KEY_RIGHT: |
| if(!isfocused(spcfocus))return gets; |
if(!_cc_isfocused(spcfocus))return gets; |
| if(menu->lines==NULL)return gets; |
if(menu->lines==NULL)return gets; |
| if(!menu->vert) |
if(!menu->vert) |
| { |
{ |
| Line 484 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 539 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| if(lines==start){break;menu->activeline=-1;} |
if(lines==start){break;menu->activeline=-1;} |
| if(lines==NULL)lines=menu->lines; |
if(lines==NULL)lines=menu->lines; |
| } |
} |
| while(strcmp(((CMENU*)lines->data)->text,"-")==0); |
while(strcmp(((Cc_Menu_I*)lines->data)->text,"-")==0); |
| if(focuswin!=spcfocus) |
if(_cc_focuswin!=spcfocus) |
| { |
{ |
| dosendsyskeymessage(spcfocus,CC_K_ENTER); |
_cc_dosendsyskeymessage(spcfocus,CC_KEY_ENTER); |
| chang=false; |
chang=false; |
| } |
} |
| gets=true; |
gets=true; |
| } |
} |
| else |
else |
| { |
{ |
| if((menu->activeline!=-1)&&(focuswin==spcfocus)) |
if((menu->activeline!=-1)&&(_cc_focuswin==spcfocus)) |
| { |
{ |
| WIN *submenu=((CMENU*)g_list_nth(menu->lines,menu->activeline)->data)->submenu; |
Cc_Win *submenu=((Cc_Menu_I*) |
| |
g_list_nth(menu->lines, |
| |
menu->activeline)->data)->submenu; |
| if(submenu!=NULL) |
if(submenu!=NULL) |
| { |
{ |
| x=1; |
x=1; |
| y=menu->activeline+1; |
y=menu->activeline+1; |
| client_to_screen(spcfocus,&x,&y); |
cc_client_to_screen(spcfocus,&x,&y); |
| if(capturewin!=spcfocus)capturewin=NULL; |
if(_cc_capturewin!=spcfocus)_cc_capturewin=NULL; |
| sendmousemessage(x,y,CC_M_MOUSEMOVE); |
_cc_sendmousemessage(x,y,CC_MOUSE_MOVE); |
| if(submenu!=NULL) |
if(submenu!=NULL) |
| { |
{ |
| stat=2; |
spcfocus->stat=2; |
| if(submenu->extra->menu.activeline==-1)submenu->extra->menu.activeline=0; |
if(submenu->extra->menu.activeline==-1) |
| redrawclientwin(submenu); |
submenu->extra->menu.activeline=0; |
| |
_cc_redrawclientwin(submenu); |
| } |
} |
| gets=true; |
gets=true; |
| } |
} |
| } |
} |
| } |
} |
| break; |
break; |
| case CC_K_UP: |
case CC_KEY_UP: |
| if(!isfocused(spcfocus))return gets; |
if(!_cc_isfocused(spcfocus))return gets; |
| if(menu->lines==NULL)return gets; |
if(menu->lines==NULL)return gets; |
| start=lines=g_list_nth(menu->lines,menu->activeline); |
start=lines=g_list_nth(menu->lines,menu->activeline); |
| if(menu->activeline==-1)menu->activeline=numlines-1; |
if(menu->activeline==-1)menu->activeline=numlines-1; |
| Line 531 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 589 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| if(lines==start){break;menu->activeline=-1;} |
if(lines==start){break;menu->activeline=-1;} |
| if(lines==NULL)lines=g_list_last(menu->lines); |
if(lines==NULL)lines=g_list_last(menu->lines); |
| } |
} |
| while(strcmp(((CMENU*)lines->data)->text,"-")==0); |
while(strcmp(((Cc_Menu_I*)lines->data)->text,"-")==0); |
| gets=true; |
gets=true; |
| break; |
break; |
| case CC_K_DOWN: |
case CC_KEY_DOWN: |
| if(!isfocused(spcfocus))return gets; |
if(!_cc_isfocused(spcfocus))return gets; |
| if(menu->lines==NULL)return gets; |
if(menu->lines==NULL)return gets; |
| if(menu->vert) |
if(menu->vert) |
| { |
{ |
| Line 549 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 607 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| if(lines==start){break;menu->activeline=-1;} |
if(lines==start){break;menu->activeline=-1;} |
| if(lines==NULL)lines=menu->lines; |
if(lines==NULL)lines=menu->lines; |
| } |
} |
| while(strcmp(((CMENU*)lines->data)->text,"-")==0); |
while(strcmp(((Cc_Menu_I*)lines->data)->text,"-")==0); |
| gets=true; |
gets=true; |
| } |
} |
| else |
else |
| { |
{ |
| dosendsyskeymessage(spcfocus,CC_K_ENTER); |
_cc_dosendsyskeymessage(spcfocus,CC_KEY_ENTER); |
| chang=false; |
chang=false; |
| gets=true; |
gets=true; |
| } |
} |
| break; |
break; |
| case CC_K_ENTER: |
case CC_KEY_ENTER: |
| if(!isfocused(spcfocus))return gets; |
if(!_cc_isfocused(spcfocus))return gets; |
| if(menu->lines==NULL)return gets; |
if(menu->lines==NULL)return gets; |
| if(menu->vert) |
if(menu->vert) |
| { |
{ |
| Line 568 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 626 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| { |
{ |
| x=1; |
x=1; |
| y=menu->activeline+1; |
y=menu->activeline+1; |
| client_to_screen(spcfocus,&x,&y); |
cc_client_to_screen(spcfocus,&x,&y); |
| if(capturewin!=spcfocus)capturewin=NULL; |
if(_cc_capturewin!=spcfocus)_cc_capturewin=NULL; |
| WIN *submenu=((CMENU*)g_list_nth(menu->lines,menu->activeline)->data)->submenu; |
Cc_Win *submenu=((Cc_Menu_I*) |
| sendmousemessage(x,y,submenu!=NULL?CC_M_MOUSEMOVE:CC_M_LBUTTONDOWN); |
g_list_nth(menu->lines, |
| if(submenu==NULL)sendmousemessage(x,y,CC_M_LBUTTONUP); |
menu->activeline)->data)->submenu; |
| |
_cc_sendmousemessage(x,y,submenu!=NULL?CC_MOUSE_MOVE:CC_MOUSE_L_DOWN); |
| |
if(submenu==NULL)_cc_sendmousemessage(x,y,CC_MOUSE_L_UP); |
| if(submenu!=NULL) |
if(submenu!=NULL) |
| { |
{ |
| if(submenu->extra->menu.activeline==-1)submenu->extra->menu.activeline=0; |
if(submenu->extra->menu.activeline==-1) |
| stat=2; |
submenu->extra->menu.activeline=0; |
| redrawclientwin(submenu); |
spcfocus->stat=2; |
| |
_cc_redrawclientwin(submenu); |
| } |
} |
| else |
else |
| sendmousemessage(gpmev.x,gpmev.y,CC_M_MOUSEMOVE); |
_cc_sendmousemessage(_cc_gpmev.x,_cc_gpmev.y,CC_MOUSE_MOVE); |
| gets=true; |
gets=true; |
| } |
} |
| } |
} |
| Line 592 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 653 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| y=0; |
y=0; |
| long old=0; |
long old=0; |
| GList *lines=menu->lines; |
GList *lines=menu->lines; |
| WIN *submenu=((CMENU*)g_list_nth(menu->lines,menu->activeline)->data)->submenu; |
Cc_Win *submenu=((Cc_Menu_I*) |
| |
g_list_nth(menu->lines, |
| |
menu->activeline)->data)->submenu; |
| while((old<menu->activeline)&&(lines!=NULL)) |
while((old<menu->activeline)&&(lines!=NULL)) |
| { |
{ |
| if(lines->data!=NULL)if(((CMENU*)lines->data)->text!=NULL)x+=strlen(((CMENU*)lines->data)->text)+2; |
if(lines->data!=NULL) |
| |
if(((Cc_Menu_I*)lines->data)->text!=NULL) |
| |
x+=strlen(((Cc_Menu_I*)lines->data)->text)+2; |
| lines=g_list_next(lines); |
lines=g_list_next(lines); |
| old++; |
old++; |
| } |
} |
| client_to_screen(spcfocus,&x,&y); |
cc_client_to_screen(spcfocus,&x,&y); |
| menu->activeline=-1; |
menu->activeline=-1; |
| if(capturewin!=spcfocus)capturewin=NULL; |
if(_cc_capturewin!=spcfocus)_cc_capturewin=NULL; |
| sendmousemessage(x,y,CC_M_MOUSEMOVE); |
_cc_sendmousemessage(x,y,CC_MOUSE_MOVE); |
| sendmousemessage(x,y+1,CC_M_MOUSEMOVE); |
_cc_sendmousemessage(x,y+1,CC_MOUSE_MOVE); |
| if(submenu!=NULL) |
if(submenu!=NULL) |
| { |
{ |
| if(submenu->extra->menu.activeline==-1)submenu->extra->menu.activeline=0; |
if(submenu->extra->menu.activeline==-1) |
| redrawclientwin(submenu); |
submenu->extra->menu.activeline=0; |
| |
_cc_redrawclientwin(submenu); |
| } |
} |
| else sendmousemessage(gpmev.x,gpmev.y,CC_M_MOUSEMOVE); |
else _cc_sendmousemessage(_cc_gpmev.x,_cc_gpmev.y,CC_MOUSE_MOVE); |
| stat=2; |
spcfocus->stat=2; |
| } |
} |
| gets=true; |
gets=true; |
| } |
} |
| break; |
break; |
| case CC_K_ESC: |
case CC_KEY_ESC: |
| if(!isfocused(spcfocus))return gets; |
if(!_cc_isfocused(spcfocus))return gets; |
| menu->activeline=-1; |
menu->activeline=-1; |
| if(menu->vert) |
if(menu->vert) |
| { |
{ |
| if((spcfocus->parent!=NULL)&&(spcfocus->parent->extra->type==CC_TP_MENU)) |
if((spcfocus->parent!=NULL)&& |
| |
(spcfocus->parent->extra->type==CC_TP_MENU)) |
| { |
{ |
| WIN *capt=capturewin; |
Cc_Win *capt=_cc_capturewin; |
| show_win(spcfocus,false); |
cc_show_win(spcfocus,false); |
| set_focus(spcfocus->parent); |
cc_set_focus(spcfocus->parent); |
| if(capt==spcfocus)capturewin=spcfocus->parent; |
if(capt==spcfocus)_cc_capturewin=spcfocus->parent; |
| } |
} |
| else |
else |
| { |
{ |
| show_win(spcfocus,false); |
cc_show_win(spcfocus,false); |
| set_focus(spcfocus->parent); |
cc_set_focus(spcfocus->parent); |
| stat=0; |
spcfocus->stat=0; |
| } |
} |
| } |
} |
| else |
else |
| { |
{ |
| stat=0; |
spcfocus->stat=0; |
| set_focus(lastfocused); |
cc_set_focus(_cc_lastfocused); |
| sendmousemessage(gpmev.x,gpmev.y,CC_M_LBUTTONUP); |
_cc_sendmousemessage(_cc_gpmev.x,_cc_gpmev.y,CC_MOUSE_L_UP); |
| } |
} |
| gets=true; |
gets=true; |
| break; |
break; |
| case CC_K_LEFT|CC_D_ALT: |
case CC_KEY_LEFT|CC_MOD_ALT: |
| case CC_K_F9: |
case CC_KEY_F9: |
| if((!menu->vert)&&(!isfocused(spcfocus))) |
if((!menu->vert)&&(!_cc_isfocused(spcfocus))) |
| { |
{ |
| menu->activeline=0; |
menu->activeline=0; |
| set_focus(spcfocus); |
cc_set_focus(spcfocus); |
| } |
} |
| break; |
break; |
| default: |
default: |
| if(!menu->vert)gets=findmenukey(spcfocus,key); |
if(!menu->vert)gets=_cc_findmenukey(spcfocus,key); |
| } |
} |
| if(menu->activeline<-1)menu->activeline=-1; |
if(menu->activeline<-1)menu->activeline=-1; |
| if(menu->activeline>numlines-1)menu->activeline=numlines-1; |
if(menu->activeline>numlines-1)menu->activeline=numlines-1; |
| Line 665 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 732 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| dialog=&spcfocus->extra->dialog; |
dialog=&spcfocus->extra->dialog; |
| switch(key) |
switch(key) |
| { |
{ |
| case CC_K_LEFT|CC_D_CTRL: |
case CC_KEY_LEFT|CC_MOD_CTRL: |
| move_win(spcfocus,spcfocus->x-1,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
cc_move_win(spcfocus,spcfocus->x-1,CC_NOCHANGE,CC_NOCHANGE, |
| case CC_K_RIGHT|CC_D_CTRL: |
CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
| move_win(spcfocus,spcfocus->x+1,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
case CC_KEY_RIGHT|CC_MOD_CTRL: |
| case CC_K_UP|CC_D_CTRL: |
cc_move_win(spcfocus,spcfocus->x+1,CC_NOCHANGE,CC_NOCHANGE, |
| move_win(spcfocus,CC_NOCHANGE,spcfocus->y-1,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
| case CC_K_DOWN|CC_D_CTRL: |
case CC_KEY_UP|CC_MOD_CTRL: |
| move_win(spcfocus,CC_NOCHANGE,spcfocus->y+1,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
cc_move_win(spcfocus,CC_NOCHANGE,spcfocus->y-1,CC_NOCHANGE, |
| case CC_K_HOME|CC_D_CTRL: |
CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
| move_win(spcfocus,spcfocus->x-1,spcfocus->y-1,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
case CC_KEY_DOWN|CC_MOD_CTRL: |
| case CC_K_PGUP|CC_D_CTRL: |
cc_move_win(spcfocus,CC_NOCHANGE,spcfocus->y+1,CC_NOCHANGE,CC_NOCHANGE, |
| move_win(spcfocus,spcfocus->x+1,spcfocus->y-1,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
CC_NOCHANGE);gets=true;break; |
| case CC_K_PGDOWN|CC_D_CTRL: |
case CC_KEY_HOME|CC_MOD_CTRL: |
| move_win(spcfocus,spcfocus->x+1,spcfocus->y+1,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
cc_move_win(spcfocus,spcfocus->x-1,spcfocus->y-1,CC_NOCHANGE, |
| case CC_K_END|CC_D_CTRL: |
CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
| move_win(spcfocus,spcfocus->x-1,spcfocus->y+1,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
case CC_KEY_PGUP|CC_MOD_CTRL: |
| case CC_K_LEFT|CC_D_CTRL|CC_D_SHIFT: |
cc_move_win(spcfocus,spcfocus->x+1,spcfocus->y-1,CC_NOCHANGE, |
| move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vx-1,CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
| case CC_K_RIGHT|CC_D_CTRL|CC_D_SHIFT: |
case CC_KEY_PGDOWN|CC_MOD_CTRL: |
| move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vx+1,CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
cc_move_win(spcfocus,spcfocus->x+1,spcfocus->y+1,CC_NOCHANGE, |
| case CC_K_UP|CC_D_CTRL|CC_D_SHIFT: |
CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
| move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vy-1,CC_NOCHANGE);gets=true;break; |
case CC_KEY_END|CC_MOD_CTRL: |
| case CC_K_DOWN|CC_D_CTRL|CC_D_SHIFT: |
cc_move_win(spcfocus,spcfocus->x-1,spcfocus->y+1,CC_NOCHANGE, |
| move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vy+1,CC_NOCHANGE);gets=true;break; |
CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
| case CC_K_HOME|CC_D_CTRL|CC_D_SHIFT: |
case CC_KEY_LEFT|CC_MOD_CTRL|CC_MOD_SHIFT: |
| move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vx-1,spcfocus->vy-1,CC_NOCHANGE);gets=true;break; |
cc_move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vx-1, |
| case CC_K_PGUP|CC_D_CTRL|CC_D_SHIFT: |
CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
| move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vx+1,spcfocus->vy-1,CC_NOCHANGE);gets=true;break; |
case CC_KEY_RIGHT|CC_MOD_CTRL|CC_MOD_SHIFT: |
| case CC_K_PGDOWN|CC_D_CTRL|CC_D_SHIFT: |
cc_move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vx+1, |
| move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vx+1,spcfocus->vy+1,CC_NOCHANGE);gets=true;break; |
CC_NOCHANGE,CC_NOCHANGE);gets=true;break; |
| case CC_K_END|CC_D_CTRL|CC_D_SHIFT: |
case CC_KEY_UP|CC_MOD_CTRL|CC_MOD_SHIFT: |
| move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vx-1,spcfocus->vy+1,CC_NOCHANGE);gets=true;break; |
cc_move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE, |
| case CC_K_INS|CC_D_CTRL|CC_D_SHIFT: |
spcfocus->vy-1,CC_NOCHANGE);gets=true;break; |
| |
case CC_KEY_DOWN|CC_MOD_CTRL|CC_MOD_SHIFT: |
| |
cc_move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,CC_NOCHANGE, |
| |
spcfocus->vy+1,CC_NOCHANGE);gets=true;break; |
| |
case CC_KEY_HOME|CC_MOD_CTRL|CC_MOD_SHIFT: |
| |
cc_move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vx-1, |
| |
spcfocus->vy-1,CC_NOCHANGE);gets=true;break; |
| |
case CC_KEY_PGUP|CC_MOD_CTRL|CC_MOD_SHIFT: |
| |
cc_move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vx+1, |
| |
spcfocus->vy-1,CC_NOCHANGE);gets=true;break; |
| |
case CC_KEY_PGDOWN|CC_MOD_CTRL|CC_MOD_SHIFT: |
| |
cc_move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vx+1, |
| |
spcfocus->vy+1,CC_NOCHANGE);gets=true;break; |
| |
case CC_KEY_END|CC_MOD_CTRL|CC_MOD_SHIFT: |
| |
cc_move_win(spcfocus,CC_NOCHANGE,CC_NOCHANGE,spcfocus->vx-1, |
| |
spcfocus->vy+1,CC_NOCHANGE);gets=true;break; |
| |
case CC_KEY_INS|CC_MOD_CTRL|CC_MOD_SHIFT: |
| if((dialog->style&CC_ST_DI_HASMAXIMIZE)==CC_ST_DI_HASMAXIMIZE) |
if((dialog->style&CC_ST_DI_HASMAXIMIZE)==CC_ST_DI_HASMAXIMIZE) |
| dialog->bmaximize->extra->button.push(dialog->bmaximize); |
dialog->bmaximize->extra->button.push(dialog->bmaximize); |
| gets=true; |
gets=true; |
| break; |
break; |
| case CC_K_DEL|CC_D_CTRL|CC_D_SHIFT: |
case CC_KEY_DEL|CC_MOD_CTRL|CC_MOD_SHIFT: |
| if((dialog->style&CC_ST_DI_HASMINIMIZE)==CC_ST_DI_HASMINIMIZE) |
if((dialog->style&CC_ST_DI_HASMINIMIZE)==CC_ST_DI_HASMINIMIZE) |
| dialog->bminimize->extra->button.push(dialog->bminimize); |
dialog->bminimize->extra->button.push(dialog->bminimize); |
| gets=true; |
gets=true; |
| break; |
break; |
| case CC_K_F4|CC_D_SHIFT:dialog->bclose->extra->button.push(dialog->bclose);gets=true;break; |
case CC_KEY_F4|CC_MOD_SHIFT: |
| case CC_K_TAB: |
dialog->bclose->extra->button.push(dialog->bclose);gets=true;break; |
| set_focus(findchild(spcfocus)); |
case CC_KEY_TAB: |
| |
cc_set_focus(_cc_findchild(spcfocus)); |
| gets=true; |
gets=true; |
| break; |
break; |
| } |
} |
| Line 720 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| Line 804 bool dosendsyskeymessage(WIN *spcfocus,u |
|
| if(spcfocus!=NULL) |
if(spcfocus!=NULL) |
| if(spcfocus->extra->type!=CC_TP_DIALOG) |
if(spcfocus->extra->type!=CC_TP_DIALOG) |
| { |
{ |
| if(key==CC_K_TAB) |
if(key==CC_KEY_TAB) |
| { |
{ |
| set_focus(findnextwin(spcfocus)); |
cc_set_focus(_cc_findnextwin(spcfocus)); |
| gets=true; |
gets=true; |
| stat=0; |
spcfocus->stat=0; |
| } |
} |
| else if(key==(CC_K_TAB|CC_D_CTRL)) |
else if(key==(CC_KEY_TAB|CC_MOD_CTRL)) |
| { |
{ |
| set_focus(findprevwin(spcfocus)); |
cc_set_focus(_cc_findprevwin(spcfocus)); |
| gets=true; |
gets=true; |
| stat=0; |
spcfocus->stat=0; |
| } |
} |
| else if(key==(CC_K_TAB|CC_D_SHIFT)) |
else if(key==(CC_KEY_TAB|CC_MOD_SHIFT)) |
| { |
{ |
| if(spcfocus->parent!=NULL)set_focus(spcfocus->parent); |
if(spcfocus->parent!=NULL)cc_set_focus(spcfocus->parent); |
| gets=true; |
gets=true; |
| stat=0; |
spcfocus->stat=0; |
| } |
} |
| else if(key==(CC_K_TAB|CC_D_SHIFT|CC_D_CTRL)) |
else if(key==(CC_KEY_TAB|CC_MOD_SHIFT|CC_MOD_CTRL)) |
| { |
{ |
| WIN *child=findchild(spcfocus); |
Cc_Win *child=_cc_findchild(spcfocus); |
| if(child!=NULL)set_focus(child); |
if(child!=NULL)cc_set_focus(child); |
| gets=true; |
gets=true; |
| stat=0; |
spcfocus->stat=0; |
| } |
} |
| } |
} |
| if(key==CC_K_F5) |
if(key==CC_KEY_F5) |
| { |
{ |
| set_focus(findchildnom(findprevdialog(spcfocus))); |
cc_set_focus(_cc_findchildnom(_cc_findprevdialog(spcfocus))); |
| gets=true; |
gets=true; |
| stat=0; |
spcfocus->stat=0; |
| } |
} |
| else if(key==CC_K_F6) |
else if(key==CC_KEY_F6) |
| { |
{ |
| set_focus(findchildnom(findnextdialog(spcfocus))); |
cc_set_focus(_cc_findchildnom(_cc_findnextdialog(spcfocus))); |
| gets=true; |
gets=true; |
| stat=0; |
spcfocus->stat=0; |
| } |
} |
| } |
} |
| if(chang)redrawclientwin(spcfocus); |
if(chang)_cc_redrawclientwin(spcfocus); |
| return gets; |
return gets; |
| } |
} |
| |
|
| |
#include <term.h> |
| |
#undef buttons |
| |
|
| |
void *_cc_getchthread(void *par) |
| |
{ |
| |
while(_cc_apprun) |
| |
{ |
| |
long key,temp; |
| |
unsigned char res; |
| |
unsigned short mod; |
| |
res=6; |
| |
mod=0; |
| |
key=getch(); |
| |
if(!_cc_apprun)return NULL; |
| |
while(_cc_waitevent); |
| |
_cc_waitkeyevent=true; |
| |
_cc_mousex=CC_NOCHANGE; |
| |
_cc_mousey=CC_NOCHANGE; |
| |
nodelay(stdscr,true); |
| |
if(ioctl(0,TIOCLINUX,&res)>=0) |
| |
{ |
| |
if((res&SHIFT_PRESSED)==SHIFT_PRESSED)mod|=CC_MOD_SHIFT; |
| |
if((res&CTRL_PRESSED)==CTRL_PRESSED)mod|=CC_MOD_CTRL; |
| |
if(((res&ALTL_PRESSED)==ALTL_PRESSED)|| |
| |
((res&ALTR_PRESSED)==ALTR_PRESSED)) |
| |
{ |
| |
mod|=CC_MOD_ALT; |
| |
if(key==27)key=getch(); |
| |
} |
| |
} |
| |
if(key==27) |
| |
{ |
| |
if((temp=getch())!=27) |
| |
ungetch(temp); |
| |
else |
| |
{ |
| |
key=temp; |
| |
mod|=CC_MOD_ALT; |
| |
} |
| |
} |
| |
_cc_dokey(key,mod); |
| |
nodelay(stdscr,false); |
| |
if((_cc_screenx!=columns)||(_cc_screeny!=lines)) |
| |
{ |
| |
_cc_screenx=columns; |
| |
_cc_screeny=lines; |
| |
_cc_mainwin.vx=_cc_screenx; |
| |
_cc_mainwin.vy=_cc_screeny; |
| |
_cc_mainwin.windata=realloc(_cc_mainwin.windata, |
| |
_cc_screenx*_cc_screeny*sizeof(attr_t)); |
| |
_cc_cmap=realloc(_cc_cmap,_cc_screenx*_cc_screeny*sizeof(CMAP)); |
| |
if(_cc_resizescreen!=NULL)_cc_resizescreen(NULL); |
| |
_cc_redraw(); |
| |
} |
| |
else _cc_doneredraw(); |
| |
refresh(); |
| |
_cc_waitkeyevent=false; |
| |
} |
| |
return NULL; |
| |
} |