| version 1.1, 2005/11/25 22:41:24 |
version 1.2, 2005/11/27 20:14:50 |
|
|
| // Copyright (c) 2005 Michal Sudolsky |
/* |
| // modified by Juraj Kolesár <koli@koli.sk> |
Name: lc_user.c |
| #include "cuchar.h" |
Author: Michal Sudolsky |
| |
Date: 22.09.2005 15:13 |
| |
*/ |
| |
// modified by Juraj Kolesar <koli@koli.sk> |
| |
|
| |
#include "cc.h" |
| |
|
| |
bool file_open_dialog(WIN *parent,char *caption,char *filename,char *mask) |
| |
{ |
| |
if((caption==NULL)||(filename==NULL)||(mask==NULL))return false; |
| |
const cback=C_CYAN; |
| |
bool i; |
| |
long x,y; |
| |
static long vx=DEF_FOB_VX,vy=DEF_FOB_VY; |
| |
x=(screenx-vx)/2; |
| |
y=(screeny-vy)/2; |
| |
screen_to_client(parent,&x,&y); |
| |
WIN *di,*diskcombo,*filelist,*nameedit,*maskcombo; |
| |
TUFOB *tufob; |
| |
PDIALOG pdialog; |
| |
pdialog.type=TP_DIALOG; |
| |
pdialog.style=ST_DI_SIZEABLE; |
| |
pdialog.caption=caption; |
| |
pdialog.cback=cback; |
| |
pdialog.cbactive=C_DEFAULT; |
| |
pdialog.cbinactive=C_DEFAULT; |
| |
pdialog.cbuttext[0]=C_DEFAULT; |
| |
pdialog.cbuttext[1]=C_DEFAULT; |
| |
pdialog.cbuttext[2]=C_DEFAULT; |
| |
pdialog.modal=true; |
| |
pdialog.menu=NULL; |
| |
pdialog.resize=NULL; |
| |
pdialog.sizeok=fobsizeokproc; |
| |
pdialog.close=fobcloseproc; |
| |
di=create_win(parent,x,y,vx,vy,(PUNION*)&pdialog,0,fobdialogacelproc); |
| |
di->user=malloc(sizeof(TUFOB)); |
| |
tufob=((TUFOB*)(di->user)); |
| |
tufob->i=-1; |
| |
PCOMBO pcombo; |
| |
PBUTTON pbutton; |
| |
PLIST plist; |
| |
PEDIT pedit; |
| |
GList *disklines,*masklines; |
| |
disklines=NULL; |
| |
disklines=g_list_append(disklines,"/"); |
| |
disklines=g_list_append(disklines,"/root"); |
| |
disklines=g_list_append(disklines,"/home"); |
| |
pbutton.type=TP_BUTTON; |
| |
pbutton.style=BT_NORMAL; |
| |
pbutton.checked=false; |
| |
pbutton.cback[0]=cback; |
| |
pbutton.cback[1]=cback; |
| |
pbutton.cback[2]=cback; |
| |
pbutton.ctext[0]=C_BLACK; |
| |
pbutton.ctext[1]=C_BLACK; |
| |
pbutton.ctext[2]=C_BLACK; |
| |
pbutton.cutext[0]=C_BLUE; |
| |
pbutton.cutext[1]=C_BLUE; |
| |
pbutton.cutext[2]=C_BLUE; |
| |
pbutton.cfocus[0]=C_DEFAULT; |
| |
pbutton.cfocus[1]=C_DEFAULT; |
| |
pbutton.cfocus[2]=C_DEFAULT; |
| |
pbutton.hasfocus=false; |
| |
pbutton.push=fobdiskbuttonproc; |
| |
pbutton.text="Look &in:"; |
| |
create_win(di,3,2,strlen(pbutton.text),1,(PUNION*)&pbutton,ST_VISIBLE,NULL); |
| |
pcombo.type=TP_COMBO; |
| |
pcombo.activeline=0; |
| |
pcombo.cback=C_DEFAULT; |
| |
pcombo.cbutback[0]=C_BLUE; |
| |
pcombo.cbutback[1]=C_DEFAULT; |
| |
pcombo.cbutfront[0]=C_DEFAULT; |
| |
pcombo.cbutfront[1]=C_DEFAULT; |
| |
pcombo.change=fobdiskcombochangeproc; |
| |
pcombo.maxvisitems=8; |
| |
pcombo.lstvy=0; |
| |
pcombo.lstcback=C_DEFAULT; |
| |
pcombo.lstcborder=C_DEFAULT; |
| |
pcombo.lstctext=C_DEFAULT; |
| |
pcombo.lstcselected=C_DEFAULT; |
| |
pcombo.lstcseltext=C_DEFAULT; |
| |
pcombo.lstcactive=C_DEFAULT; |
| |
pcombo.lstcactivetext=C_DEFAULT; |
| |
pcombo.lstscrcback=C_DEFAULT; |
| |
pcombo.lstscrcmark=C_DEFAULT; |
| |
pcombo.lstscrcbar=C_DEFAULT; |
| |
pcombo.lstscrcarrowup=C_DEFAULT; |
| |
pcombo.lstscrcarrowdown=C_DEFAULT; |
| |
pcombo.lstlines=disklines; |
| |
pcombo.edistyle=ED_READONLY; |
| |
pcombo.edicbmask=C_WHITE; |
| |
pcombo.edicfmask=C_BLACK; |
| |
diskcombo=create_win(di,12,2,vx-3-12,1,(PUNION*)&pcombo, |
| |
ST_VISIBLE|ST_A_HFIXED|ST_CO_WITH_EDIT,NULL); |
| |
tufob->diskcombo=diskcombo; |
| |
set_text(diskcombo,filename); |
| |
plist.type=TP_LIST; |
| |
plist.activeline=0; |
| |
plist.lines=NULL; |
| |
plist.combotyp=CT_NORMAL; |
| |
plist.cback=C_DEFAULT; |
| |
plist.cborder=C_DEFAULT; |
| |
plist.ctext=C_DEFAULT; |
| |
plist.cselected=C_DEFAULT; |
| |
plist.cseltext=C_DEFAULT; |
| |
plist.cactive=C_DEFAULT; |
| |
plist.cactivetext=C_DEFAULT; |
| |
plist.change=NULL; |
| |
plist.dblclk=fobfilelistdblclkproc; |
| |
plist.scrcmark=C_DEFAULT; |
| |
plist.scrcbar=C_DEFAULT; |
| |
plist.scrcarrowup=C_DEFAULT; |
| |
plist.scrcarrowdown=C_DEFAULT; |
| |
plist.scrcback=C_DEFAULT; |
| |
filelist=create_win(di,3,4,vx-5-10-3,vy-6-4,(PUNION*)&plist, |
| |
ST_VISIBLE|ST_A_FIXED,fobfilelistacelproc); |
| |
tufob->filelist=filelist; |
| |
pbutton.push=fobnamebuttonproc; |
| |
pbutton.text="File &name:"; |
| |
create_win(di,3,vy-5,strlen(pbutton.text),1,(PUNION*)&pbutton,ST_VISIBLE|ST_AD_FIXED,NULL); |
| |
pedit.type=TP_EDIT; |
| |
pedit.cback=C_DEFAULT; |
| |
pedit.cbmask=C_WHITE; |
| |
pedit.cfmask=C_BLACK; |
| |
pedit.style=ED_NORMAL; |
| |
pedit.ctext=C_DEFAULT; |
| |
pedit.change=NULL; |
| |
nameedit=create_win(di,18,vy-5,vx-21,1,(PUNION*)&pedit,ST_VISIBLE|ST_AD_FIXED|ST_A_HFIXED,NULL); |
| |
tufob->nameedit=nameedit; |
| |
pbutton.push=fobmaskbuttonproc; |
| |
pbutton.text="Files of &type:"; |
| |
create_win(di,3,vy-3,strlen(pbutton.text),1,(PUNION*)&pbutton,ST_VISIBLE|ST_AD_FIXED,NULL); |
| |
masklines=NULL; |
| |
|
| |
|
| |
|
| |
//masklines=g_list_append(masklines,"/"); |
| |
|
| |
|
| |
|
| |
pcombo.change=fobdiskcombochangeproc; |
| |
pcombo.lstlines=masklines; |
| |
maskcombo=create_win(di,18,vy-3,vx-21,1,(PUNION*)&pcombo,ST_VISIBLE|ST_AD_FIXED|ST_A_HFIXED,NULL); |
| |
tufob->maskcombo=maskcombo; |
| |
pbutton.cback[0]=C_DEFAULT; |
| |
pbutton.cback[1]=C_DEFAULT; |
| |
pbutton.cback[2]=C_DEFAULT; |
| |
pbutton.ctext[0]=C_DEFAULT; |
| |
pbutton.ctext[1]=C_DEFAULT; |
| |
pbutton.ctext[2]=C_DEFAULT; |
| |
pbutton.cutext[0]=C_DEFAULT; |
| |
pbutton.cutext[1]=C_DEFAULT; |
| |
pbutton.cutext[2]=C_DEFAULT; |
| |
pbutton.hasfocus=true; |
| |
pbutton.push=fobopenbuttonproc; |
| |
pbutton.text="&Open"; |
| |
create_win(di,vx-13,4,10,1,(PUNION*)&pbutton,ST_VISIBLE|ST_AR_FIXED,NULL); |
| |
pbutton.push=fobcancelbuttonproc; |
| |
pbutton.text="&Cancel"; |
| |
create_win(di,vx-13,6,10,1,(PUNION*)&pbutton,ST_VISIBLE|ST_AR_FIXED,NULL); |
| |
set_focus(filelist); |
| |
show_win(di,true); |
| |
while((tufob->i==-1)&&apprun)message_pump(); |
| |
i=tufob->i; |
| |
vx=di->vx; |
| |
vy=di->vy; |
| |
delete_win(di); |
| |
free(tufob); |
| |
if(disklines!=NULL)g_list_free(disklines); |
| |
if(masklines!=NULL)g_list_free(masklines); |
| |
return i; |
| |
} |
| |
|
| |
long color_dialog(WIN *parent,char *caption,long color) |
| |
{ |
| |
if(caption==NULL)return -1; |
| |
long x,y,i; |
| |
const vx=34,vy=10,cback=C_CYAN; |
| |
WIN *di,*p,*combo,*p1,*p2; |
| |
x=(screenx-vx)/2; |
| |
y=(screeny-vy)/2; |
| |
screen_to_client(parent,&x,&y); |
| |
TUCB *tucb; |
| |
PDIALOG pdialog; |
| |
PBUTTON pbutton; |
| |
PPAINT ppaint; |
| |
PCOMBO pcombo; |
| |
GList *lines; |
| |
pdialog.type=TP_DIALOG; |
| |
pdialog.style=0; |
| |
pdialog.caption=caption; |
| |
pdialog.cback=cback; |
| |
pdialog.cbactive=C_DEFAULT; |
| |
pdialog.cbinactive=C_DEFAULT; |
| |
pdialog.cbuttext[0]=C_DEFAULT; |
| |
pdialog.cbuttext[1]=C_DEFAULT; |
| |
pdialog.cbuttext[2]=C_DEFAULT; |
| |
pdialog.modal=true; |
| |
pdialog.menu=NULL; |
| |
pdialog.resize=NULL; |
| |
pdialog.sizeok=NULL; |
| |
pdialog.close=cbcloseproc; |
| |
di=create_win(parent,x,y,vx,vy,(PUNION*)&pdialog,0,cbdialogacelproc); |
| |
di->user=malloc(sizeof(TUCB)); |
| |
tucb=((TUCB*)(di->user)); |
| |
tucb->i=0; |
| |
ppaint.type=TP_PAINT; |
| |
ppaint.style=PA_PATTERN; |
| |
for(y=0;y<4;y++) |
| |
for(x=0;x<4;x++) |
| |
{ |
| |
i=y*4+x; |
| |
ppaint.cback=i; |
| |
ppaint.color=i; |
| |
p=create_win(di,2*x+5,y+3,2,1,(PUNION*)&ppaint,ST_VISIBLE,cbpaintacelproc); |
| |
p->user=(void*)i; |
| |
} |
| |
lines=NULL; |
| |
lines=g_list_append(lines,getcolorname(C_BLACK)); |
| |
lines=g_list_append(lines,getcolorname(C_RED)); |
| |
lines=g_list_append(lines,getcolorname(C_GREEN)); |
| |
lines=g_list_append(lines,getcolorname(C_YELLOW)); |
| |
lines=g_list_append(lines,getcolorname(C_BLUE)); |
| |
lines=g_list_append(lines,getcolorname(C_MAGENTA)); |
| |
lines=g_list_append(lines,getcolorname(C_CYAN)); |
| |
lines=g_list_append(lines,getcolorname(C_WHITE)); |
| |
lines=g_list_append(lines,getcolorname(C_LBLACK)); |
| |
lines=g_list_append(lines,getcolorname(C_LRED)); |
| |
lines=g_list_append(lines,getcolorname(C_LGREEN)); |
| |
lines=g_list_append(lines,getcolorname(C_LYELLOW)); |
| |
lines=g_list_append(lines,getcolorname(C_LBLUE)); |
| |
lines=g_list_append(lines,getcolorname(C_LMAGENTA)); |
| |
lines=g_list_append(lines,getcolorname(C_LCYAN)); |
| |
lines=g_list_append(lines,getcolorname(C_LWHITE)); |
| |
pcombo.type=TP_COMBO; |
| |
pcombo.activeline=color; |
| |
pcombo.cback=C_DEFAULT; |
| |
pcombo.cbutback[0]=C_BLUE; |
| |
pcombo.cbutback[1]=C_DEFAULT; |
| |
pcombo.cbutfront[0]=C_DEFAULT; |
| |
pcombo.cbutfront[1]=C_DEFAULT; |
| |
pcombo.change=cbcombochangeproc; |
| |
pcombo.maxvisitems=8; |
| |
pcombo.lstvy=10; |
| |
pcombo.lstcback=C_DEFAULT; |
| |
pcombo.lstcborder=C_DEFAULT; |
| |
pcombo.lstctext=C_DEFAULT; |
| |
pcombo.lstcselected=C_DEFAULT; |
| |
pcombo.lstcseltext=C_DEFAULT; |
| |
pcombo.lstcactive=C_DEFAULT; |
| |
pcombo.lstcactivetext=C_DEFAULT; |
| |
pcombo.lstscrcback=C_DEFAULT; |
| |
pcombo.lstscrcmark=C_DEFAULT; |
| |
pcombo.lstscrcbar=C_DEFAULT; |
| |
pcombo.lstscrcarrowup=C_DEFAULT; |
| |
pcombo.lstscrcarrowdown=C_DEFAULT; |
| |
pcombo.lstlines=lines; |
| |
combo=create_win(di,17,2,MAXLEN_COLOR_STRING-1,1,(PUNION*)&pcombo,ST_VISIBLE,NULL); |
| |
tucb->combo=combo; |
| |
ppaint.cback=C_BLUE; |
| |
ppaint.color=C_WHITE; |
| |
p1=create_win(di,(color%4)*2+5,2,2,1,(PUNION*)&ppaint,ST_VISIBLE,NULL); |
| |
create_win(p1,0,5,2,1,(PUNION*)&ppaint,ST_VISIBLE,NULL); |
| |
tucb->p1=p1; |
| |
p2=create_win(di,3,(color/4)+3,2,1,(PUNION*)&ppaint,ST_VISIBLE,NULL); |
| |
create_win(p2,10,0,2,1,(PUNION*)&ppaint,ST_VISIBLE,NULL); |
| |
tucb->p2=p2; |
| |
pbutton.type=TP_BUTTON; |
| |
pbutton.style=BT_NORMAL; |
| |
pbutton.checked=false; |
| |
pbutton.cback[0]=C_DEFAULT; |
| |
pbutton.cback[1]=C_DEFAULT; |
| |
pbutton.cback[2]=C_DEFAULT; |
| |
pbutton.ctext[0]=C_DEFAULT; |
| |
pbutton.ctext[1]=C_DEFAULT; |
| |
pbutton.ctext[2]=C_DEFAULT; |
| |
pbutton.cutext[0]=C_DEFAULT; |
| |
pbutton.cutext[1]=C_DEFAULT; |
| |
pbutton.cutext[2]=C_DEFAULT; |
| |
pbutton.cfocus[0]=C_DEFAULT; |
| |
pbutton.cfocus[1]=C_DEFAULT; |
| |
pbutton.cfocus[2]=C_DEFAULT; |
| |
pbutton.hasfocus=true; |
| |
pbutton.push=cbpushproc; |
| |
pbutton.text=" &Ok "; |
| |
p=create_win(di,19,5,1,1,(PUNION*)&pbutton,ST_VISIBLE|ST_AUTOXSIZE,NULL); |
| |
p->user=(void*)1; |
| |
pbutton.text="&Cancel"; |
| |
p=create_win(di,19,7,1,1,(PUNION*)&pbutton,ST_VISIBLE|ST_AUTOXSIZE,NULL); |
| |
p->user=(void*)-1; |
| |
show_win(di,true); |
| |
while((tucb->i==0)&&apprun)message_pump(); |
| |
if(tucb->i==-1)i=-1; |
| |
else if(tucb->i==1)i=combo->extra->combo.activeline; |
| |
delete_win(di); |
| |
free(tucb); |
| |
return i; |
| |
} |
| |
|
| |
long message_box(WIN *parent,char *caption,char *text,long style) |
| |
{ |
| |
if((caption==NULL)||(text==NULL))return -1; |
| |
long x,y,bx,lastwh,i,j,l,line,vx,vy,len=strlen(text),nlen; |
| |
const bxok=2+4+2,bxyes=3+4+2,bxno=2+4+2,bxcancel=6+4+2; |
| |
char *st; |
| |
WIN *but; |
| |
bool nonext; |
| |
PDIALOG pdialog; |
| |
PTEXT ptext; |
| |
PBUTTON pbutton; |
| |
WIN *di; |
| |
nlen=len; |
| |
vx=6; |
| |
vy=4; |
| |
bx=0; |
| |
if(style!=MB_DEFAULT)vy+=1; |
| |
if(style&MB_OK)bx+=bxok; |
| |
if(style&MB_YES)bx+=bxyes; |
| |
if(style&MB_NO)bx+=bxno; |
| |
if(style&MB_CANCEL)bx+=bxcancel; |
| |
if(bx>0)bx-=2; |
| |
vx+=bx; |
| |
st=malloc(nlen+1); |
| |
if(st==NULL)return -1; |
| |
line=1; |
| |
lastwh=-1; |
| |
for(i=0,l=0,j=0;i<len;i++,l++,j++) |
| |
{ |
| |
nonext=false; |
| |
if(text[i]==' ')lastwh=l; |
| |
if((text[i]=='\n')||(j>=MAX_MB_VX-6)) |
| |
{ |
| |
if(j>=MAX_MB_VX-6) |
| |
{ |
| |
if((lastwh!=-1)&&(i-lastwh<=MAX_MB_VX-6)) |
| |
{ |
| |
st[lastwh]='\0'; |
| |
j=l-lastwh-1; |
| |
if(j==-1)nonext=true; |
| |
lastwh=-1; |
| |
} |
| |
else |
| |
{ |
| |
st[l]='\0'; |
| |
l++; |
| |
nlen++; |
| |
st=realloc(st,nlen+1); |
| |
if(st==NULL)return -1; |
| |
j=0; |
| |
} |
| |
} |
| |
else |
| |
{ |
| |
st[l]='\0'; |
| |
j=0; |
| |
} |
| |
vx=MAX_MB_VX; |
| |
line++; |
| |
} |
| |
if((text[i]!='\n')&&(!nonext))st[l]=text[i]; |
| |
} |
| |
if(j+6>vx)vx=j+6; |
| |
st[nlen]='\0'; |
| |
vy+=line+1; |
| |
if(vx<MIN_MB_VX)vx=MIN_MB_VX; |
| |
if(vy<MIN_MB_VY)vy=MIN_MB_VY; |
| |
x=(screenx-vx)/2; |
| |
y=(screeny-vy)/2; |
| |
screen_to_client(parent,&x,&y); |
| |
pdialog.type=TP_DIALOG; |
| |
pdialog.style=0; |
| |
pdialog.caption=caption; |
| |
pdialog.cback=C_RED; |
| |
pdialog.cbactive=C_DEFAULT; |
| |
pdialog.cbinactive=C_DEFAULT; |
| |
pdialog.cbuttext[0]=C_DEFAULT; |
| |
pdialog.cbuttext[1]=C_DEFAULT; |
| |
pdialog.cbuttext[2]=C_DEFAULT; |
| |
pdialog.modal=true; |
| |
pdialog.menu=NULL; |
| |
pdialog.resize=NULL; |
| |
pdialog.sizeok=NULL; |
| |
pdialog.close=mbcloseproc; |
| |
di=create_win(parent,x,y,vx,vy,(PUNION*)&pdialog,0,mbdialogacelproc); |
| |
ptext.type=TP_TEXT; |
| |
ptext.cback=pdialog.cback; |
| |
ptext.ctext=C_LWHITE; |
| |
for(i=0,j=0;j<nlen;j++) |
| |
{ |
| |
if((j==0)||(st[j-1]=='\0')) |
| |
{ |
| |
ptext.text=&st[j]; |
| |
create_win(di,3,2+i,1,1,(PUNION*)&ptext,ST_VISIBLE|ST_AUTOXSIZE,NULL); |
| |
i++; |
| |
} |
| |
} |
| |
pbutton.type=TP_BUTTON; |
| |
pbutton.style=BT_NORMAL; |
| |
pbutton.checked=false; |
| |
pbutton.cback[0]=C_DEFAULT; |
| |
pbutton.cback[1]=C_DEFAULT; |
| |
pbutton.cback[2]=C_DEFAULT; |
| |
pbutton.ctext[0]=C_DEFAULT; |
| |
pbutton.ctext[1]=C_DEFAULT; |
| |
pbutton.ctext[2]=C_DEFAULT; |
| |
pbutton.cutext[0]=C_DEFAULT; |
| |
pbutton.cutext[1]=C_DEFAULT; |
| |
pbutton.cutext[2]=C_DEFAULT; |
| |
pbutton.cfocus[0]=C_DEFAULT; |
| |
pbutton.cfocus[1]=C_DEFAULT; |
| |
pbutton.cfocus[2]=C_DEFAULT; |
| |
pbutton.hasfocus=true; |
| |
pbutton.push=mbpushproc; |
| |
j=(vx-bx)/2; |
| |
if(style&MB_OK) |
| |
{ |
| |
pbutton.text="&Ok"; |
| |
but=create_win(di,j,vy-3,10,1,(PUNION*)&pbutton,ST_VISIBLE|ST_AUTOXSIZE,NULL); |
| |
but->user=(void*)MB_OK; |
| |
j+=bxok; |
| |
} |
| |
if(style&MB_YES) |
| |
{ |
| |
pbutton.text="&Yes"; |
| |
but=create_win(di,j,vy-3,10,1,(PUNION*)&pbutton,ST_VISIBLE|ST_AUTOXSIZE,NULL); |
| |
but->user=(void*)MB_YES; |
| |
j+=bxyes; |
| |
} |
| |
if(style&MB_NO) |
| |
{ |
| |
pbutton.text="&No"; |
| |
but=create_win(di,j,vy-3,10,1,(PUNION*)&pbutton,ST_VISIBLE|ST_AUTOXSIZE,NULL); |
| |
but->user=(void*)MB_NO; |
| |
j+=bxno; |
| |
} |
| |
if(style&MB_CANCEL) |
| |
{ |
| |
pbutton.text="&Cancel"; |
| |
but=create_win(di,j,vy-3,10,1,(PUNION*)&pbutton,ST_VISIBLE|ST_AUTOXSIZE,NULL); |
| |
but->user=(void*)MB_CANCEL; |
| |
j+=bxcancel; |
| |
} |
| |
show_win(di,true); |
| |
while((!(bool)di->user)&&apprun)message_pump(); |
| |
i=(long)di->user; |
| |
delete_win(di); |
| |
free(st); |
| |
return i; |
| |
} |
| |
|
| |
void edit_copy(WIN *edit) |
| |
{ |
| |
if(edit==NULL)return; |
| |
if(edit->extra->type!=TP_EDIT)return; |
| |
EDIT *ed=&edit->extra->edit; |
| |
if(ed->maskpos==-1)return; |
| |
long len=strlen(ed->text); |
| |
if(ed->maskpos<0)ed->maskpos=0; |
| |
if(ed->maskpos>len-1)ed->maskpos=len-1; |
| |
if(ed->curpos<0)ed->curpos=0; |
| |
if(ed->curpos>len-1)ed->curpos=len-1; |
| |
long i=ed->curpos,j=ed->maskpos,l; |
| |
if(j<i) |
| |
{ |
| |
l=i-j; |
| |
i=j; |
| |
} |
| |
else l=j-i; |
| |
l++; |
| |
clipboard=realloc(clipboard,l+1); |
| |
for(j=0;j<l;j++)clipboard[j]=ed->text[j+i]; |
| |
clipboard[j]='\0'; |
| |
} |
| |
|
| |
void edit_paste(WIN *edit) |
| |
{ |
| |
if(clipboard==NULL)return; |
| |
if(edit==NULL)return; |
| |
if(edit->extra->type!=TP_EDIT)return; |
| |
EDIT *ed=&edit->extra->edit; |
| |
if(ed->style==ED_READONLY)return; |
| |
long i,j,l,len=strlen(ed->text),clen=strlen(clipboard); |
| |
if(ed->curpos<0)ed->curpos=0; |
| |
if(ed->maskpos!=-1) |
| |
{ |
| |
if(ed->maskpos<0)ed->maskpos=0; |
| |
if(ed->maskpos>len-1)ed->maskpos=len-1; |
| |
if(ed->curpos>len-1)ed->curpos=len-1; |
| |
i=ed->curpos; |
| |
j=ed->maskpos; |
| |
if(j<i) |
| |
{ |
| |
l=i-j; |
| |
i=j; |
| |
} |
| |
else l=j-i; |
| |
l++; |
| |
} |
| |
else |
| |
{ |
| |
if(ed->curpos>len)ed->curpos=len; |
| |
i=ed->curpos; |
| |
l=0; |
| |
} |
| |
if(clen>l) |
| |
{ |
| |
ed->text=realloc(ed->text,len+clen-l+1); |
| |
for(j=len+clen-l-1;j>=i+clen;j--)ed->text[j]=ed->text[j+l-clen]; |
| |
} |
| |
else if(clen<l) |
| |
{ |
| |
for(j=i+clen;j<len-l+clen;j++)ed->text[j]=ed->text[j+l-clen]; |
| |
ed->text=realloc(ed->text,len+clen-l+1); |
| |
} |
| |
ed->text[len+clen-l]='\0'; |
| |
for(j=0;j<clen;j++)ed->text[j+i]=clipboard[j]; |
| |
ed->maskpos=-1; |
| |
ed->curpos=i+clen; |
| |
redraw(); |
| |
} |
| |
|
| |
void edit_delete(WIN *edit) |
| |
{ |
| |
if(edit==NULL)return; |
| |
if(edit->extra->type!=TP_EDIT)return; |
| |
EDIT *ed=&edit->extra->edit; |
| |
if(ed->style==ED_READONLY)return; |
| |
if(ed->maskpos==-1)return; |
| |
long i,j,l,len=strlen(ed->text); |
| |
if(ed->curpos<0)ed->curpos=0; |
| |
if(ed->maskpos<0)ed->maskpos=0; |
| |
if(ed->maskpos>len-1)ed->maskpos=len-1; |
| |
if(ed->curpos>len-1)ed->curpos=len-1; |
| |
i=ed->curpos; |
| |
j=ed->maskpos; |
| |
if(j<i) |
| |
{ |
| |
l=i-j; |
| |
i=j; |
| |
} |
| |
else l=j-i; |
| |
l++; |
| |
for(j=i;j<len-l;j++)ed->text[j]=ed->text[j+l]; |
| |
ed->text=realloc(ed->text,len-l+1); |
| |
ed->text[len-l]='\0'; |
| |
ed->maskpos=-1; |
| |
ed->curpos=i; |
| |
redraw(); |
| |
} |
| |
|
| |
void edit_cut(WIN *edit) |
| |
{ |
| |
edit_copy(edit); |
| |
edit_delete(edit); |
| |
} |
| |
|
| |
void edit_select(WIN *edit,long sta,long end) |
| |
{ |
| |
if(edit==NULL)return; |
| |
if(edit->extra->type!=TP_EDIT)return; |
| |
EDIT *ed=&edit->extra->edit; |
| |
long len=strlen(ed->text); |
| |
if(sta<-1)sta=-1; |
| |
if(sta>len-1)sta=len-1; |
| |
if(end<0)end=0; |
| |
if(sta!=-1) |
| |
{ |
| |
if(end>len-1)end=len-1; |
| |
} |
| |
else |
| |
if(end>len)end=len; |
| |
ed->maskpos=sta; |
| |
ed->curpos=end; |
| |
redraw(); |
| |
} |
| |
|
| |
void edit_get_selection(WIN *edit,long *sta,long *end) |
| |
{ |
| |
if(edit==NULL)return; |
| |
if(edit->extra->type!=TP_EDIT)return; |
| |
EDIT *ed=&edit->extra->edit; |
| |
*sta=ed->maskpos; |
| |
*end=ed->curpos; |
| |
} |
| |
|
| |
void set_clipboard(char *text) |
| |
{ |
| |
if(text==NULL) |
| |
{ |
| |
free(clipboard); |
| |
clipboard=NULL; |
| |
} |
| |
clipboard=realloc(clipboard,strlen(text)+1); |
| |
strcpy(clipboard,text); |
| |
} |
| |
|
| |
char *get_clipboard() |
| |
{ |
| |
return clipboard; |
| |
} |
| |
|
| void track_popup_menu(WIN *menu,long x,long y) |
void track_popup_menu(WIN *menu,long x,long y) |
| { |
{ |
| Line 104 void del_menu_item(WIN *menu,long pos) |
|
| Line 703 void del_menu_item(WIN *menu,long pos) |
|
| if(isvisible(menu))redraw(); |
if(isvisible(menu))redraw(); |
| } |
} |
| |
|
| void exit_api() |
void set_api_run(bool run) |
| { |
{ |
| apprun=false; |
apprun=run; |
| |
} |
| |
|
| |
bool is_api_run() |
| |
{ |
| |
return apprun; |
| } |
} |
| |
|
| void set_capture(WIN *win) |
void set_capture(WIN *win) |
| Line 120 WIN *get_capture() |
|
| Line 724 WIN *get_capture() |
|
| return capturewin; |
return capturewin; |
| } |
} |
| |
|
| bool set_focus(WIN *win)
|
bool set_focus(WIN *win) |
| {
|
{ |
| if(win==NULL){focuswin=NULL;redraw();return false;}
|
if(win==NULL){focuswin=NULL;redraw();return false;} |
| while(win!=NULL)
|
while(win!=NULL) |
| {
|
{ |
| if(isactive(win)&&((win->extra->type==TP_EDIT)||((win->extra->type==TP_BUTTON)&&(win->extra->button.hasfocus))||
|
if(isactive(win)&&((win->extra->type==TP_EDIT)||((win->extra->type==TP_BUTTON)&&(win->extra->button.hasfocus))|| |
| (win->extra->type==TP_LIST)||(win->extra->type==TP_COMBO)||(win->extra->type==TP_MENU)|| |
(win->extra->type==TP_LIST)||(win->extra->type==TP_COMBO)||(win->extra->type==TP_MENU)|| |
| (win->extra->type==TP_DIALOG)))
|
(win->extra->type==TP_DIALOG))) |
| {
|
{ |
| WIN *temp=focuswin;
|
WIN *temp=focuswin; |
| focuswin=win;
|
focuswin=win; |
| if(win->parent!=NULL)win->parent->lastfocus=win; |
if(win->parent!=NULL)win->parent->lastfocus=win; |
| bringwintotop(win);
|
bringwintotop(win); |
| return true;
|
return true; |
| }
|
} |
| win=win->parent;
|
win=win->parent; |
| }
|
} |
| return false;
|
return false; |
| }
|
} |
| |
|
| WIN *get_focus() |
WIN *get_focus() |
| { |
{ |
| return focuswin; |
return focuswin; |
| } |
} |
| |
|
| void show_win(WIN *win,bool visible)
|
void show_win(WIN *win,bool visible) |
| {
|
{ |
| bool doredraw=false;
|
bool doredraw=false; |
| WIN *p;
|
WIN *p; |
| if(win==NULL){hlvisible=visible;redraw();return;}
|
if(win==NULL){hlvisible=visible;redraw();return;} |
| if((win->active)||(isactive(win->parent)))
|
if((win->active)||(isactive(win->parent))) |
| {
|
{ |
| if(win->active!=visible)doredraw=true;
|
if(win->active!=visible)doredraw=true; |
| win->active=visible;
|
win->active=visible; |
| if(visible)
|
if(visible) |
| {
|
{ |
| p=findchild(win);
|
p=findchild(win); |
| if(p!=NULL)if(set_focus(p))doredraw=false;
|
if(p!=NULL)if(set_focus(p))doredraw=false; |
| }
|
} |
| if((win->extra->type==TP_DIALOG)&&win->extra->dialog.modal)
|
if((win->extra->type==TP_DIALOG)&&win->extra->dialog.modal) |
| {
|
{ |
| if(win->parent!=NULL)win->parent->hasmodal=visible;
|
if(win->parent!=NULL)win->parent->hasmodal=visible; |
| else hasmodal=visible;
|
else hasmodal=visible; |
| }
|
} |
| if(!isactive(focuswin)){focuswin=NULL;set_focus(findchild(win->parent));}
|
if(!isactive(focuswin)){focuswin=NULL;set_focus(findchild(win->parent));} |
| if(!isactive(capturewin))capturewin=NULL;
|
if(!isactive(capturewin))capturewin=NULL; |
| }
|
} |
| win->active=visible;
|
win->active=visible; |
| if(doredraw)redraw();
|
if(doredraw)redraw(); |
| }
|
} |
| |
|
| long get_tick()
|
long get_tick() |
| {
|
{ |
| struct timeb times;
|
struct timeb times; |
| long time;
|
long time; |
| ftime(×);
|
ftime(×); |
| time=times.time;
|
time=times.time; |
| time=time*1000+times.millitm;
|
time=time*1000+times.millitm; |
| return time;
|
return time; |
| }
|
} |
| |
|
| void client_to_screen(WIN *p,long *x,long *y)
|
void client_to_screen(WIN *p,long *x,long *y) |
| {
|
{ |
| WIN *n=p;
|
WIN *n=p; |
| while(n!=NULL)
|
while(n!=NULL) |
| {
|
{ |
| if(x!=NULL)*x+=n->x;
|
if(x!=NULL)*x+=n->x; |
| if(y!=NULL)*y+=n->y;
|
if(y!=NULL)*y+=n->y; |
| n=n->parent;
|
n=n->parent; |
| }
|
} |
| }
|
} |
|
|
|
| void screen_to_client(WIN *p,long *x,long *y)
|
void screen_to_client(WIN *p,long *x,long *y) |
| {
|
{ |
| WIN *n=p;
|
WIN *n=p; |
| while(n!=NULL)
|
while(n!=NULL) |
| {
|
{ |
| if(x!=NULL)*x-=n->x;
|
if(x!=NULL)*x-=n->x; |
| if(y!=NULL)*y-=n->y;
|
if(y!=NULL)*y-=n->y; |
| n=n->parent;
|
n=n->parent; |
| }
|
} |
| }
|
} |
| |
|
| |
bool get_menu_pos(WIN *win,long id,WIN **submenu,long *pos) |
| |
{ |
| |
if(win==NULL)return false; |
| |
if(win->extra->type==TP_MENU) |
| |
{ |
| |
MENU *menu=&win->extra->menu; |
| |
GList *lines=menu->lines; |
| |
long npos=0; |
| |
while(lines!=NULL) |
| |
{ |
| |
if(((CMENU*)lines->data)->id==id) |
| |
{ |
| |
if(submenu!=NULL)*submenu=win; |
| |
if(pos!=NULL)*pos=npos; |
| |
return true; |
| |
} |
| |
WIN *nsubmenu=((CMENU*)lines->data)->submenu; |
| |
if(nsubmenu!=NULL) |
| |
{ |
| |
if(get_menu_pos(nsubmenu,id,submenu,pos))return true; |
| |
} |
| |
npos++; |
| |
lines=g_list_next(lines); |
| |
} |
| |
} |
| |
return false; |
| |
} |
| |
|
| |
void set_user(WIN *win,void *user) |
| |
{ |
| |
if(win==NULL)return; |
| |
win->user=user; |
| |
} |
| |
|
| |
void *get_user(WIN *win) |
| |
{ |
| |
if(win==NULL)return NULL; |
| |
return win->user; |
| |
} |
| |
|
| void set_text(WIN *win,char *text)
|
void set_checked(WIN *win,long pos,bool status) |
| {
|
{ |
| if(win==NULL)return; |
if(win==NULL)return; |
| if(win->extra->type==TP_EDIT)
|
if(win->extra->type==TP_BUTTON) |
| {
|
{ |
| |
win->extra->button.checked=status; |
| |
} |
| |
else if(win->extra->type==TP_MENU) |
| |
{ |
| |
MENU *menu=&win->extra->menu; |
| |
GList *lines=menu->lines; |
| |
if(lines!=NULL) |
| |
{ |
| |
lines=g_list_nth(lines,pos); |
| |
if(lines!=NULL) |
| |
{ |
| |
((CMENU*)lines->data)->checked=status; |
| |
} |
| |
} |
| |
} |
| |
} |
| |
|
| |
bool get_checked(WIN *win,long pos) |
| |
{ |
| |
if(win==NULL)return false; |
| |
if(win->extra->type==TP_BUTTON) |
| |
{ |
| |
return win->extra->button.checked; |
| |
} |
| |
else if(win->extra->type==TP_MENU) |
| |
{ |
| |
MENU *menu=&win->extra->menu; |
| |
GList *lines=menu->lines; |
| |
if(lines!=NULL) |
| |
{ |
| |
lines=g_list_nth(lines,pos); |
| |
if(lines!=NULL) |
| |
{ |
| |
return((CMENU*)lines->data)->checked; |
| |
} |
| |
} |
| |
} |
| |
return false; |
| |
} |
| |
|
| |
void set_text(WIN *win,char *text) |
| |
{ |
| |
if(win==NULL)return; |
| |
if(win->extra->type==TP_EDIT) |
| |
{ |
| char *er; |
char *er; |
| er=(char*)realloc(win->extra->edit.text,strlen((const char*)text)+1);
|
er=(char*)realloc(win->extra->edit.text,strlen((const char*)text)+1); |
| if(er==NULL)return; |
if(er==NULL)return; |
| win->extra->edit.text=er; |
win->extra->edit.text=er; |
| strcpy((char*)win->extra->edit.text,(const char*)text);
|
win->extra->edit.maskpos=-1; |
| |
strcpy((char*)win->extra->edit.text,(const char*)text); |
| redraw(); |
redraw(); |
| } |
} |
| else if(win->extra->type==TP_TEXT) |
else if(win->extra->type==TP_TEXT) |
| Line 220 void set_text(WIN *win,char *text) |
|
| Line 910 void set_text(WIN *win,char *text) |
|
| win->extra->text.text=text; |
win->extra->text.text=text; |
| redraw(); |
redraw(); |
| } |
} |
| |
else if((win->extra->type==TP_COMBO)&&(win->extra->combo.edit!=NULL)) |
| |
{ |
| |
set_text(win->extra->combo.edit,text); |
| |
} |
| else if(win->extra->type==TP_DIALOG) |
else if(win->extra->type==TP_DIALOG) |
| { |
{ |
| win->extra->dialog.caption=text; |
win->extra->dialog.caption=text; |
| redraw(); |
redraw(); |
| } |
} |
| }
|
} |
| |
|
| char *get_text(WIN *win) |
char *get_text(WIN *win) |
| { |
{ |
| if(win==NULL)return; |
if(win==NULL)return; |
| if(win->extra->type==TP_EDIT)
|
if(win->extra->type==TP_EDIT) |
| {
|
{ |
| return win->extra->edit.text;
|
return win->extra->edit.text; |
| } |
} |
| else if(win->extra->type==TP_TEXT) |
else if(win->extra->type==TP_TEXT) |
| { |
{ |
| Line 267 void set_pos(WIN *win,long pos) |
|
| Line 961 void set_pos(WIN *win,long pos) |
|
| else if(win->extra->type==TP_LIST) |
else if(win->extra->type==TP_LIST) |
| { |
{ |
| SCROLL *vscroll=&win->extra->list.vscroll->extra->scroll; |
SCROLL *vscroll=&win->extra->list.vscroll->extra->scroll; |
| if(pos<vscroll->pos)vscroll->pos=pos;
|
if(pos<vscroll->pos)vscroll->pos=pos; |
| if(pos-win->vy+3>vscroll->pos)vscroll->pos=pos-win->vy+3;
|
if(pos-win->vy+3>vscroll->pos)vscroll->pos=pos-win->vy+3; |
| win->extra->list.activeline=pos; |
win->extra->list.activeline=pos; |
| redraw(); |
redraw(); |
| if(win->extra->list.change!=NULL)win->extra->list.change(win); |
if(win->extra->list.change!=NULL)win->extra->list.change(win); |
| Line 315 void set_list(WIN *win,GList *list) |
|
| Line 1009 void set_list(WIN *win,GList *list) |
|
| if(win==NULL)return; |
if(win==NULL)return; |
| if(win->extra->type==TP_LIST) |
if(win->extra->type==TP_LIST) |
| { |
{ |
| win->extra->list.lines=list; |
LIST *llist=&win->extra->list; |
| |
llist->lines=list; |
| |
if((llist->combotyp==CT_TABLE)&&(llist->lines!=NULL)) |
| |
{ |
| |
long i; |
| |
if(llist->lencells!=NULL)g_slist_free(llist->lencells); |
| |
for(i=0;i<g_slist_length((GSList*)llist->lines->data);i++) |
| |
llist->lencells=g_slist_append(llist->lencells,NULL); |
| |
} |
| redraw(); |
redraw(); |
| } |
} |
| else if(win->extra->type==TP_COMBO) |
else if(win->extra->type==TP_COMBO) |
| Line 447 long create_thread(void *(*proc)()) |
|
| Line 1149 long create_thread(void *(*proc)()) |
|
| return res; |
return res; |
| } |
} |
| |
|
| TIMER *set_timer(WIN *win,long msec,char prior,void (*timer)())
|
TIMER *set_timer(WIN *win,long msec,char prior,void (*timer)(TIMER*)) |
| {
|
{ |
| TIMER *time;
|
TIMER *time; |
| time=malloc(sizeof(TIMER));
|
time=malloc(sizeof(TIMER)); |
| time->next=hltimer;
|
time->next=hltimer; |
| time->win=win;
|
time->win=win; |
| time->period=msec;
|
time->period=msec; |
| time->prior=prior;
|
time->prior=prior; |
| time->tminus=get_tick();
|
time->tminus=get_tick(); |
| time->timer=timer;
|
time->timer=timer; |
| hltimer=time;
|
hltimer=time; |
| return time;
|
return time; |
| }
|
} |
| |
|
| void del_timer_for_win(WIN *win)
|
void del_timer_for_win(WIN *win) |
| {
|
{ |
| TIMER *tprev,*timer;
|
TIMER *tprev,*timer; |
| if((win==NULL)||(hltimer==NULL))return;
|
if((win==NULL)||(hltimer==NULL))return; |
| tprev=NULL;
|
tprev=NULL; |
| timer=hltimer;
|
timer=hltimer; |
| while(timer!=NULL)
|
while(timer!=NULL) |
| {
|
{ |
| if(timer->win==win)
|
if(timer->win==win) |
| {
|
{ |
| if(tprev!=NULL)tprev->next=timer->next;
|
if(tprev!=NULL)tprev->next=timer->next; |
| else hltimer=timer->next;
|
else hltimer=timer->next; |
| free(timer);
|
free(timer); |
| }
|
} |
| else tprev=timer;
|
else tprev=timer; |
| if(tprev!=NULL)timer=tprev->next;
|
if(tprev!=NULL)timer=tprev->next; |
| else timer=hltimer;
|
else timer=hltimer; |
| }
|
} |
| }
|
} |
|
|
|
| void del_timer(TIMER *timer)
|
void del_timer(TIMER *timer) |
| {
|
{ |
| TIMER *p;
|
TIMER *p; |
| if((timer==NULL)||(hltimer==NULL))return;
|
if((timer==NULL)||(hltimer==NULL))return; |
| if(timer==hltimer)
|
if(timer==hltimer) |
| {
|
{ |
| hltimer=timer->next;
|
hltimer=timer->next; |
| free(timer);
|
free(timer); |
| }
|
} |
| else
|
else |
| {
|
{ |
| for(p=hltimer;(p!=NULL)&&(p->next!=timer);p=p->next);
|
for(p=hltimer;(p!=NULL)&&(p->next!=timer);p=p->next); |
| if(p!=NULL)
|
if(p!=NULL) |
| {
|
{ |
| p->next=timer->next;
|
p->next=timer->next; |
| free(timer);
|
free(timer); |
| }
|
} |
| }
|
} |
| }
|
} |
| |
|
| long get_timer_clock(TIMER *timer)
|
long get_timer_clock(TIMER *timer) |
| {
|
{ |
| if(timer==NULL)return -1;
|
if(timer==NULL)return -1; |
| return get_tick()-timer->tminus;
|
return get_tick()-timer->tminus; |
| }
|
} |
|
|
|
| void set_timer_params(TIMER *timer,PTIMER *params) |
void set_timer_params(TIMER *timer,PTIMER *params) |
| { |
{ |
| if((timer==NULL)||(params==NULL))return; |
if((timer==NULL)||(params==NULL))return; |
| Line 525 void get_timer_params(TIMER *timer,PTIME |
|
| Line 1227 void get_timer_params(TIMER *timer,PTIME |
|
| params->timer=timer->timer; |
params->timer=timer->timer; |
| } |
} |
| |
|
| bool is_timer_run(TIMER *timer)
|
bool is_timer_run(TIMER *timer) |
| {
|
{ |
| if(timer==NULL)return -1;
|
if(timer==NULL)return -1; |
| return get_timer_clock(timer)<=timer->period*timer->prior/100;
|
return get_timer_clock(timer)<=timer->period*timer->prior/100; |
| }
|
} |
| |
|
| void get_client_size(WIN *win,long *x,long *y,long *vx,long *vy)
|
void get_client_size(WIN *win,long *x,long *y,long *vx,long *vy) |
| {
|
{ |
| if(win!=NULL)
|
if(win!=NULL) |
| {
|
{ |
| long dy=0; |
long dy=0; |
| if(win->extra->type==TP_DIALOG) |
if(win->extra->type==TP_DIALOG) |
| { |
{ |
| dy++; |
dy++; |
| if(win->extra->dialog.menu!=NULL)dy++; |
if(win->extra->dialog.menu!=NULL)dy++; |
| } |
} |
| if(vx!=NULL)*vx=win->vx-(win->extra->type!=TP_DIALOG?0:2);
|
if(vx!=NULL)*vx=win->vx-(win->extra->type!=TP_DIALOG?0:2); |
| if(vy!=NULL)*vy=win->vy-dy-1;
|
if(vy!=NULL)*vy=win->vy-dy-1; |
| if(vx!=NULL)*x=win->extra->type!=TP_DIALOG?0:1;
|
if(x!=NULL)*x=win->extra->type!=TP_DIALOG?0:1; |
| if(vy!=NULL)*y=dy;
|
if(y!=NULL)*y=dy; |
| }
|
} |
| else
|
else |
| {
|
{ |
| if(vx!=NULL)*vx=screenx;
|
if(vx!=NULL)*vx=screenx; |
| if(vy!=NULL)*vy=screeny-(hlmenu==NULL?0:1)-(hldowntext==NULL?0:1);
|
if(vy!=NULL)*vy=screeny-(hlmenu==NULL?0:1)-(hldowntext==NULL?0:1); |
| if(vx!=NULL)*x=0;
|
if(x!=NULL)*x=0; |
| if(vy!=NULL)*y=hlmenu==NULL?0:1;
|
if(y!=NULL)*y=hlmenu==NULL?0:1; |
| }
|
} |
| }
|
} |
|
|
|
| bool send_message(WIN *win,long x,long y,unsigned short key)
|
|
| {
|
|
| if(((key&KKMASK)>=CCOFFSET)&&((key&KKMASK)<KKOFFSET))return dosendkeymessage(win,key);
|
|
| else if(((key&KKMASK)>=KKOFFSET)&&((key&KKMASK)<MMOFFSET))return dosendsyskeymessage(win,key);
|
|
| else if(((key&KKMASK)>=MMOFFSET)&&((key&KKMASK)<XXOFFSET))return dosendmousemessage(win,x,y,key);
|
|
| }
|
|
| |
|
| void delete_win(WIN *win)
|
bool send_message(WIN *win,long x,long y,unsigned short key) |
| |
{ |
| |
if(!isactive(win))return false; |
| |
if(((key&KKMASK)>=CCOFFSET)&&((key&KKMASK)<KKOFFSET))return dosendkeymessage(win,key); |
| |
else if(((key&KKMASK)>=KKOFFSET)&&((key&KKMASK)<MMOFFSET))return dosendsyskeymessage(win,key); |
| |
else if(((key&KKMASK)>=MMOFFSET)&&((key&KKMASK)<XXOFFSET))return dosendmousemessage(win,x,y,key); |
| |
} |
| |
|
| |
void delete_win(WIN *win) |
| { |
{ |
| show_win(win,false); |
show_win(win,false); |
| dodeletewin(win); |
dodeletewin(win); |
| }
|
} |
| |
|
| char get_win_type(WIN *win) |
char get_win_type(WIN *win) |
| { |
{ |
| return win->extra->type; |
return win->extra->type; |
| } |
} |
| |
|
| bool move_win(WIN *win,long x,long y,long vx,long vy,long state)
|
bool move_win(WIN *win,long x,long y,long vx,long vy,long state) |
| {
|
{ |
| if(win==NULL)return false;
|
if(win==NULL)return false; |
| if(x==NOCHANGE)x=win->x;
|
if(x==NOCHANGE)x=win->x; |
| if(y==NOCHANGE)y=win->y;
|
if(y==NOCHANGE)y=win->y; |
| if(vx==NOCHANGE)vx=win->vx;
|
if(vx==NOCHANGE)vx=win->vx; |
| if(vy==NOCHANGE)vy=win->vy;
|
if(vy==NOCHANGE)vy=win->vy; |
| if(win->extra->type==TP_DIALOG)
|
if((win->extra->type==TP_DIALOG)&& |
| {
|
(win->extra->dialog.sizeok!=NULL))win->extra->dialog.sizeok(win,&x,&y,&vx,&vy); |
| if(state==NOCHANGE)state=win->extra->dialog.state;
|
if(win->extra->type==TP_DIALOG) |
| if((state<0)||(state>SV_IN_MAXSTATE))return false;
|
{ |
| if(state==SV_MAXIMIZED)
|
if(state==NOCHANGE)state=win->extra->dialog.state; |
| {
|
if((state<0)||(state>SV_IN_MAXSTATE))return false; |
| if(win->extra->dialog.state!=SV_MAXIMIZED)
|
if(state==SV_MAXIMIZED) |
| {
|
{ |
| get_client_size(win->parent,&x,&y,&vx,&vy);
|
if(win->extra->dialog.state!=SV_MAXIMIZED) |
| }
|
{ |
| else
|
get_client_size(win->parent,&x,&y,&vx,&vy); |
| {
|
} |
| x=win->x;
|
else |
| y=win->y;
|
{ |
| vx=win->vx;
|
x=win->x; |
| vy=win->vy;
|
y=win->y; |
| }
|
vx=win->vx; |
| }
|
vy=win->vy; |
| else if(state==SV_MINIMIZED)
|
} |
| {
|
} |
| if(win->extra->dialog.state==SV_MAXIMIZED)
|
else if(state==SV_MINIMIZED) |
| {
|
{ |
| vx=win->extra->dialog.tmpvx;
|
if(win->extra->dialog.state==SV_MAXIMIZED) |
| x=win->extra->dialog.tmpx;
|
{ |
| y=win->extra->dialog.tmpy;
|
vx=win->extra->dialog.tmpvx; |
| }
|
x=win->extra->dialog.tmpx; |
| vy=1;
|
y=win->extra->dialog.tmpy; |
| }
|
} |
| else if(state==SV_NORMAL)
|
vy=1; |
| {
|
} |
| if(win->extra->dialog.state==SV_MAXIMIZED)
|
else if(state==SV_NORMAL) |
| {
|
{ |
| vx=win->extra->dialog.tmpvx;
|
if(win->extra->dialog.state==SV_MAXIMIZED) |
| vy=win->extra->dialog.tmpvy;
|
{ |
| x=win->extra->dialog.tmpx;
|
vx=win->extra->dialog.tmpvx; |
| y=win->extra->dialog.tmpy;
|
vy=win->extra->dialog.tmpvy; |
| }
|
x=win->extra->dialog.tmpx; |
| else if(win->extra->dialog.state==SV_MINIMIZED)
|
y=win->extra->dialog.tmpy; |
| {
|
} |
| vy=win->extra->dialog.tmpvy;
|
else if(win->extra->dialog.state==SV_MINIMIZED) |
| }
|
{ |
| }
|
vy=win->extra->dialog.tmpvy; |
| if(vx<10)vx=10;
|
} |
| }
|
} |
| if(vx<1)vx=1;
|
if(vx<10)vx=10; |
| if(vy<1)vy=1;
|
} |
| if((win->vx==vx)&&(win->vy==vy)&&(win->x==x)&&(win->y==y)&&
|
if(vx<1)vx=1; |
| (win->extra->type==TP_DIALOG?win->extra->dialog.state==state:true))return false;
|
if(vy<1)vy=1; |
| if((win->extra->type==TP_DIALOG)&&
|
if((win->vx==vx)&&(win->vy==vy)&&(win->x==x)&&(win->y==y)&& |
| (win->extra->dialog.sizeok!=NULL)&&
|
(win->extra->type==TP_DIALOG?win->extra->dialog.state==state:true))return false; |
| (!win->extra->dialog.sizeok(vx,vy)))return false;
|
if(win->extra->type==TP_DIALOG) |
| if(win->extra->type==TP_DIALOG)
|
{ |
| {
|
if(win->extra->dialog.state==SV_NORMAL) |
| if(win->extra->dialog.state==SV_NORMAL)
|
{ |
| {
|
if(state==SV_MAXIMIZED) |
| if(state==SV_MAXIMIZED)
|
{ |
| {
|
win->extra->dialog.tmpvx=win->vx; |
| win->extra->dialog.tmpvx=win->vx;
|
win->extra->dialog.tmpvy=win->vy; |
| win->extra->dialog.tmpvy=win->vy;
|
win->extra->dialog.tmpx=win->x; |
| win->extra->dialog.tmpx=win->x;
|
win->extra->dialog.tmpy=win->y; |
| win->extra->dialog.tmpy=win->y;
|
} |
| }
|
else if(state==SV_MINIMIZED) |
| else if(state==SV_MINIMIZED)
|
{ |
| {
|
win->extra->dialog.tmpvy=win->vy; |
| win->extra->dialog.tmpvy=win->vy;
|
} |
| }
|
} |
| }
|
if(win->extra->dialog.state==SV_MINIMIZED) |
| if(win->extra->dialog.state==SV_MINIMIZED)
|
{ |
| {
|
if(state==SV_MAXIMIZED) |
| if(state==SV_MAXIMIZED)
|
{ |
| {
|
win->extra->dialog.tmpvx=win->vx; |
| win->extra->dialog.tmpvx=win->vx;
|
win->extra->dialog.tmpx=win->x; |
| win->extra->dialog.tmpx=win->x;
|
win->extra->dialog.tmpy=win->y; |
| win->extra->dialog.tmpy=win->y;
|
} |
| }
|
} |
| }
|
} |
| }
|
win->x=x; |
| win->x=x;
|
win->y=y; |
| win->y=y;
|
win->vx=vx; |
| win->vx=vx;
|
win->vy=vy; |
| win->vy=vy;
|
long px,py,pvx,pvy; |
| if(win->extra->type==TP_DIALOG)
|
get_client_size(win->parent,&px,&py,&pvx,&pvy); |
| {
|
win->flx=x; |
| win->extra->dialog.state=state;
|
win->fly=y; |
| if(state==SV_NORMAL)
|
win->frx=pvx+px-x-vx; |
| {
|
win->fry=pvy+py-y-vy; |
| if((win->extra->dialog.style&ST_DI_HASMAXIMIZE)==ST_DI_HASMAXIMIZE)
|
if(win->extra->type==TP_DIALOG) |
| win->extra->dialog.bmaximize->extra->button.text="O";
|
{ |
| if((win->extra->dialog.style&ST_DI_HASMINIMIZE)==ST_DI_HASMINIMIZE)
|
win->extra->dialog.state=state; |
| win->extra->dialog.bminimize->extra->button.text=".";
|
if(state==SV_NORMAL) |
| }
|
{ |
| else if(state==SV_MAXIMIZED)
|
if((win->extra->dialog.style&ST_DI_HASMAXIMIZE)==ST_DI_HASMAXIMIZE) |
| {
|
win->extra->dialog.bmaximize->extra->button.text="O"; |
| if((win->extra->dialog.style&ST_DI_HASMAXIMIZE)==ST_DI_HASMAXIMIZE)
|
if((win->extra->dialog.style&ST_DI_HASMINIMIZE)==ST_DI_HASMINIMIZE) |
| win->extra->dialog.bmaximize->extra->button.text="o";
|
win->extra->dialog.bminimize->extra->button.text="."; |
| if((win->extra->dialog.style&ST_DI_HASMINIMIZE)==ST_DI_HASMINIMIZE)
|
} |
| win->extra->dialog.bminimize->extra->button.text=".";
|
else if(state==SV_MAXIMIZED) |
| }
|
{ |
| else if(state==SV_MINIMIZED)
|
if((win->extra->dialog.style&ST_DI_HASMAXIMIZE)==ST_DI_HASMAXIMIZE) |
| {
|
win->extra->dialog.bmaximize->extra->button.text="o"; |
| if((win->extra->dialog.style&ST_DI_HASMAXIMIZE)==ST_DI_HASMAXIMIZE)
|
if((win->extra->dialog.style&ST_DI_HASMINIMIZE)==ST_DI_HASMINIMIZE) |
| win->extra->dialog.bmaximize->extra->button.text="O";
|
win->extra->dialog.bminimize->extra->button.text="."; |
| if((win->extra->dialog.style&ST_DI_HASMINIMIZE)==ST_DI_HASMINIMIZE)
|
} |
| win->extra->dialog.bminimize->extra->button.text="o";
|
else if(state==SV_MINIMIZED) |
| }
|
{ |
| if(win->extra->dialog.resize!=NULL)win->extra->dialog.resize(win->vx,win->vy);
|
if((win->extra->dialog.style&ST_DI_HASMAXIMIZE)==ST_DI_HASMAXIMIZE) |
| }
|
win->extra->dialog.bmaximize->extra->button.text="O"; |
| |
if((win->extra->dialog.style&ST_DI_HASMINIMIZE)==ST_DI_HASMINIMIZE) |
| |
win->extra->dialog.bminimize->extra->button.text="o"; |
| |
} |
| |
if(win->extra->dialog.resize!=NULL)win->extra->dialog.resize(win->vx,win->vy); |
| |
} |
| if(isvisible(win))redraw(); |
if(isvisible(win))redraw(); |
| return true;
|
return true; |
| }
|
} |
| |
|
| WIN *create_win(WIN *parent,long x,long y,long vx,long vy, |
WIN *create_win(WIN *parent,long x,long y,long vx,long vy, |
| PUNION *extra,long style,bool (*acel)(WIN *win,long x,long y,unsigned short key)) |
PUNION *extra,long style,bool (*acel)(WIN *win,long x,long y,unsigned short key)) |
| {
|
{ |
| WIN *ne,*p;
|
WIN *ne,*p; |
| long size; |
long size,px,py,pvx,pvy; |
| ne=(WIN*)malloc(sizeof(WIN));
|
ne=(WIN*)malloc(sizeof(WIN)); |
| ne->parent=parent;
|
ne->parent=parent; |
| ne->x=x;
|
ne->x=x; |
| ne->y=y;
|
ne->y=y; |
| ne->vx=vx;
|
ne->vx=vx; |
| ne->vy=vy;
|
ne->vy=vy; |
| ne->svx=-1;
|
ne->svx=-1; |
| ne->svy=-1; |
ne->svy=-1; |
| ne->style=style;
|
get_client_size(parent,&px,&py,&pvx,&pvy); |
| ne->hasmodal=false;
|
ne->flx=x; |
| ne->acel=(void*)acel;
|
ne->fly=y; |
| |
ne->frx=pvx+px-x-vx; |
| |
ne->fry=pvy+py-y-vy; |
| |
ne->style=style; |
| |
ne->hasmodal=false; |
| |
ne->acel=(void*)acel; |
| ne->active=false; |
ne->active=false; |
| ne->lastfocus=NULL;
|
ne->lastfocus=NULL; |
| ne->windata=malloc(0);
|
ne->windata=malloc(0); |
| |
ne->stat=0; |
| |
ne->user=NULL; |
| switch(extra->type) |
switch(extra->type) |
| { |
{ |
| case TP_TEXT:size=sizeof(TEXT);break; |
case TP_TEXT:size=sizeof(TEXT);break; |
| Line 719 WIN *create_win(WIN *parent,long x,long |
|
| Line 1434 WIN *create_win(WIN *parent,long x,long |
|
| case TP_LIST:size=sizeof(LIST);break; |
case TP_LIST:size=sizeof(LIST);break; |
| case TP_STATUS:size=sizeof(STATUS);break; |
case TP_STATUS:size=sizeof(STATUS);break; |
| case TP_SCROLL:size=sizeof(SCROLL);break; |
case TP_SCROLL:size=sizeof(SCROLL);break; |
| case TP_TABLE:size=sizeof(TABLE);break; |
|
| case TP_PAINT:size=sizeof(PAINT);break; |
case TP_PAINT:size=sizeof(PAINT);break; |
| case TP_MENU:size=sizeof(MENU);break; |
case TP_MENU:size=sizeof(MENU);break; |
| case TP_DIALOG:size=sizeof(DIALOG);break; |
case TP_DIALOG:size=sizeof(DIALOG);break; |
| case TP_FADE:size=sizeof(FADE);break; |
case TP_FADE:size=sizeof(FADE);break; |
| } |
} |
| ne->extra=(UNION*)malloc(size); |
ne->extra=(UNION*)malloc(size); |
| ne->next=NULL;
|
ne->next=NULL; |
| ne->child=NULL;
|
ne->child=NULL; |
| ne->childend=NULL;
|
ne->childend=NULL; |
| if(hlwin==NULL)
|
if(hlwin==NULL) |
| {
|
{ |
| hlwin=ne;
|
hlwin=ne; |
| hlendwin=ne;
|
hlendwin=ne; |
| }
|
} |
| else
|
else |
| {
|
{ |
| if(parent==NULL)
|
if(parent==NULL) |
| {
|
{ |
| hlendwin->next=ne;
|
hlendwin->next=ne; |
| hlendwin=ne;
|
hlendwin=ne; |
| }
|
} |
| else
|
else |
| {
|
{ |
| if(parent->child==NULL)
|
if(parent->child==NULL) |
| {
|
{ |
| parent->child=ne;
|
parent->child=ne; |
| parent->childend=ne;
|
parent->childend=ne; |
| }
|
} |
| else
|
else |
| {
|
{ |
| parent->childend->next=ne;
|
parent->childend->next=ne; |
| parent->childend=ne;
|
parent->childend=ne; |
| }
|
} |
| }
|
} |
| }
|
} |
| if(extra->type==TP_TEXT)
|
if(extra->type==TP_TEXT) |
| {
|
{ |
| if(ne->vy>1)ne->vy=1; |
if(ne->vy>1)ne->vy=1; |
| }
|
} |
| else if(extra->type==TP_EDIT)
|
else if(extra->type==TP_EDIT) |
| {
|
{ |
| ne->extra->edit.curpos=0;
|
ne->extra->edit.curpos=0; |
| ne->extra->edit.scroll=0;
|
ne->extra->edit.maskpos=-1; |
| |
ne->extra->edit.scroll=0; |
| ne->extra->edit.text=(unsigned char*)malloc(1); |
ne->extra->edit.text=(unsigned char*)malloc(1); |
| ne->extra->edit.text[0]='\0';
|
ne->extra->edit.text[0]='\0'; |
| }
|
} |
| else if(extra->type==TP_SCROLL)
|
else if(extra->type==TP_SCROLL) |
| {
|
{ |
| SCROLL *scroll;
|
SCROLL *scroll; |
| scroll=&ne->extra->scroll;
|
scroll=&ne->extra->scroll; |
| scroll->smooth=false;
|
scroll->smooth=false; |
| scroll->smoothpos=0;
|
scroll->smoothpos=0; |
| scroll->sup=SC_UP;
|
scroll->sup=SC_UP; |
| scroll->sdown=SC_UP;
|
scroll->sdown=SC_UP; |
| scroll->spageup=SC_UP;
|
scroll->spageup=SC_UP; |
| scroll->spagedown=SC_UP;
|
scroll->spagedown=SC_UP; |
| if(extra->scroll.vert)
|
if(extra->scroll.vert) |
| {
|
{ |
| if(ne->vx>1)ne->vx=1;
|
if(ne->vx>1)ne->vx=1; |
| }
|
} |
| else
|
else |
| {
|
{ |
| if(ne->vy>1)ne->vy=1;
|
if(ne->vy>1)ne->vy=1; |
| }
|
} |
| }
|
} |
| else if(extra->type==TP_BUTTON)
|
else if(extra->type==TP_BUTTON) |
| {
|
{ |
| BUTTON *button;
|
BUTTON *button; |
| button=&ne->extra->button;
|
button=&ne->extra->button; |
| button->status=TS_UP;
|
button->status=TS_UP; |
| }
|
} |
| else if(extra->type==TP_LIST) |
else if(extra->type==TP_LIST) |
| { |
{ |
| PSCROLL scroll; |
PSCROLL scroll; |
| Line 801 WIN *create_win(WIN *parent,long x,long |
|
| Line 1516 WIN *create_win(WIN *parent,long x,long |
|
| scroll.change=NULL; |
scroll.change=NULL; |
| list->exvscroll=EX_NONE; |
list->exvscroll=EX_NONE; |
| list->exhscroll=EX_NONE; |
list->exhscroll=EX_NONE; |
| |
list->lencells=NULL; |
| scroll.vert=true; |
scroll.vert=true; |
| list->vscroll=create_win(ne,ne->vx-1,1,1,ne->vy-2,(PUNION*)&scroll,0,NULL); |
list->vscroll=create_win(ne,ne->vx-1,1,1,ne->vy-2,(PUNION*)&scroll,0,NULL); |
| scroll.vert=false; |
scroll.vert=false; |
| list->hscroll=create_win(ne,1,ne->vy-1,ne->vx-2,1,(PUNION*)&scroll,0,NULL); |
list->hscroll=create_win(ne,1,ne->vy-1,ne->vx-2,1,(PUNION*)&scroll,0,NULL); |
| if(list->combotyp) |
if(extra->list.combotyp==CT_COMBO) |
| { |
{ |
| PUNION fade; |
PUNION fade; |
| fade.type=TP_FADE; |
fade.type=TP_FADE; |
| Line 827 WIN *create_win(WIN *parent,long x,long |
|
| Line 1543 WIN *create_win(WIN *parent,long x,long |
|
| x=-1;y=ne->vy; |
x=-1;y=ne->vy; |
| list.type=TP_LIST; |
list.type=TP_LIST; |
| list.activeline=0; |
list.activeline=0; |
| list.combotyp=true; |
list.combotyp=CT_COMBO; |
| list.change=NULL; |
list.change=NULL; |
| list.dblclk=combodblclkproc; |
list.dblclk=combodblclkproc; |
| combo->pushed=SC_UP; |
combo->pushed=SC_UP; |
| combo->scroll=0; |
combo->scroll=0; |
| combo->list=create_win(ne,x,y,ne->vx+2,ne->extra->combo.lstvy,(PUNION*)&list,0,NULL); |
combo->list=create_win(ne,x,y,ne->vx+2,ne->extra->combo.lstvy,(PUNION*)&list,0,NULL); |
| |
if((style&ST_CO_WITH_EDIT)==ST_CO_WITH_EDIT) |
| |
{ |
| |
PEDIT edit; |
| |
edit.type=TP_EDIT; |
| |
combo->edit=create_win(ne,0,0,ne->vx-1,1,(PUNION*)&edit,ST_VISIBLE,claeditacel); |
| |
} |
| |
else |
| |
combo->edit=NULL; |
| } |
} |
| else if(extra->type==TP_STATUS) |
else if(extra->type==TP_STATUS) |
| { |
{ |
| Line 864 WIN *create_win(WIN *parent,long x,long |
|
| Line 1588 WIN *create_win(WIN *parent,long x,long |
|
| dialog->state=SV_NORMAL; |
dialog->state=SV_NORMAL; |
| PBUTTON button; |
PBUTTON button; |
| button.type=TP_BUTTON; |
button.type=TP_BUTTON; |
| |
button.style=BT_NORMAL; |
| |
button.checked=false; |
| button.hasfocus=false; |
button.hasfocus=false; |
| long n=3; |
long n=3; |
| button.text="X"; |
button.text="X"; |
| Line 908 void set_win_params(WIN *win,PUNION *par |
|
| Line 1634 void set_win_params(WIN *win,PUNION *par |
|
| case TP_COMBO:setcomboparams(win,params);break; |
case TP_COMBO:setcomboparams(win,params);break; |
| case TP_LIST:setlistparams(win,params);break; |
case TP_LIST:setlistparams(win,params);break; |
| case TP_STATUS:setstatusparams(win,params);break; |
case TP_STATUS:setstatusparams(win,params);break; |
| case TP_TABLE:settableparams(win,params);break; |
|
| case TP_PAINT:setpaintparams(win,params);break; |
case TP_PAINT:setpaintparams(win,params);break; |
| case TP_MENU:setmenuparams(win,params);break; |
case TP_MENU:setmenuparams(win,params);break; |
| case TP_DIALOG:setdialogparams(win,params);break; |
case TP_DIALOG:setdialogparams(win,params);break; |
| Line 929 void get_win_params(WIN *win,PUNION *par |
|
| Line 1654 void get_win_params(WIN *win,PUNION *par |
|
| case TP_COMBO:getcomboparams(win,params);break; |
case TP_COMBO:getcomboparams(win,params);break; |
| case TP_LIST:getlistparams(win,params);break; |
case TP_LIST:getlistparams(win,params);break; |
| case TP_STATUS:getstatusparams(win,params);break; |
case TP_STATUS:getstatusparams(win,params);break; |
| case TP_TABLE:gettableparams(win,params);break; |
|
| case TP_PAINT:getpaintparams(win,params);break; |
case TP_PAINT:getpaintparams(win,params);break; |
| case TP_MENU:getmenuparams(win,params);break; |
case TP_MENU:getmenuparams(win,params);break; |
| case TP_DIALOG:getdialogparams(win,params);break; |
case TP_DIALOG:getdialogparams(win,params);break; |
| } |
} |
| } |
} |
| |
|
| |
#include <term.h> |
| |
#undef buttons |
| |
|
| |
void message_pump() |
| |
{ |
| |
long key,temp; |
| |
unsigned char res; |
| |
unsigned short mod; |
| |
TIMER *p,*pnext; |
| |
long time; |
| |
static MEVENT event; |
| |
Gpm_Event ev; |
| |
mousex=NOCHANGE; |
| |
mousey=NOCHANGE; |
| |
res=6; |
| |
mod=0; |
| |
key=getch(); |
| |
if(ioctl(0,TIOCLINUX,&res)>=0) |
| |
{ |
| |
if((res&SHIFT_PRESSED)==SHIFT_PRESSED)mod|=MD_SHIFT; |
| |
if((res&CTRL_PRESSED)==CTRL_PRESSED)mod|=MD_CTRL; |
| |
if(((res&ALTL_PRESSED)==ALTL_PRESSED)||((res&ALTR_PRESSED)==ALTR_PRESSED)) |
| |
{ |
| |
mod|=MD_ALT; |
| |
if(key==27)key=getch(); |
| |
} |
| |
} |
| |
if(key==27) |
| |
{ |
| |
if((temp=getch())!=27) |
| |
ungetch(temp); |
| |
else |
| |
{ |
| |
key=temp; |
| |
mod|=MD_ALT; |
| |
} |
| |
} |
| |
if((mouseactive==MOUSE_GPM)&&(gpmgetevent(&ev))) |
| |
{ |
| |
event.x=ev.x; |
| |
event.y=ev.y; |
| |
event.bstate=0; |
| |
if((ev.buttons&GPM_B_LEFT)==GPM_B_LEFT) |
| |
{ |
| |
if((ev.type&GPM_DOWN)==GPM_DOWN)event.bstate|=BUTTON1_PRESSED; |
| |
else if((ev.type&GPM_UP)==GPM_UP)event.bstate|=BUTTON1_RELEASED; |
| |
} |
| |
if((ev.buttons&GPM_B_RIGHT)==GPM_B_RIGHT) |
| |
{ |
| |
if((ev.type&GPM_DOWN)==GPM_DOWN)event.bstate|=BUTTON3_PRESSED; |
| |
else if((ev.type&GPM_UP)==GPM_UP)event.bstate|=BUTTON3_RELEASED; |
| |
} |
| |
if((ev.modifiers&SHIFT_PRESSED)==SHIFT_PRESSED)event.bstate|=BUTTON_SHIFT; |
| |
if((ev.modifiers&CTRL_PRESSED)==CTRL_PRESSED)event.bstate|=BUTTON_CTRL; |
| |
if(((ev.modifiers&ALTL_PRESSED)==ALTL_PRESSED)||((ev.modifiers&ALTR_PRESSED)==ALTR_PRESSED)) |
| |
event.bstate|=BUTTON_ALT; |
| |
domouseevent(&event); |
| |
} |
| |
dokey(key,mod); |
| |
if((screenx!=columns)||(screeny!=lines)) |
| |
{ |
| |
screenx=columns; |
| |
screeny=lines; |
| |
mainwin.vx=screenx; |
| |
mainwin.vy=screeny; |
| |
mainwin.windata=realloc(mainwin.windata,screenx*screeny*sizeof(attr_t)); |
| |
if(resizescreen!=NULL)resizescreen(NULL); |
| |
redraw(); |
| |
} |
| |
if(key!=-1)redrawmouse=0; |
| |
if(redrawmouse<2) |
| |
{ |
| |
Gpm_DrawPointer(gpmev.x,gpmev.y,gpm_consolefd); |
| |
redrawmouse++; |
| |
} |
| |
refresh(); |
| |
for(p=hltimer;p!=NULL;p=pnext) |
| |
{ |
| |
time=get_tick(); |
| |
pnext=p->next; |
| |
if(time-p->tminus>=p->period) |
| |
{ |
| |
p->tminus=time; |
| |
p->timer(p); |
| |
} |
| |
} |
| |
} |