home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 52
/
Amiga_Dream_52.iso
/
Linux
/
Enlightenment
/
enl_DR-0.10.tar.gz
/
enl_DR-0.10.tar
/
enl
/
infobox.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-06-24
|
12KB
|
479 lines
#include "enlightenment.h"
void InitInfoBox()
{
}
void ShowLine(int *x,int *y,int i,int j,char *s,Window *wlst,Pixmap *plst,Pixmap *mlst)
{
int k;
GC gcp;
GC gcm;
XGCValues gcv;
k=0;
while (wlst[k]) k++;
wlst[k]=XCreateSimpleWindow(disp,root,*x,*y,ifb.width,ifb.height,0,0,0);
*y=*y+ifb.height;
plst[k]=XCreatePixmap(disp,wlst[k],ifb.width,ifb.height,depth);
mlst[k]=XCreatePixmap(disp,wlst[k],ifb.width,ifb.height,1);
gcp=XCreateGC(disp,plst[k],0,&gcv);
gcm=XCreateGC(disp,mlst[k],0,&gcv);
XSetForeground(disp,gcm,0);
XFillRectangle(disp,mlst[k],gcm,0,0,ifb.width,ifb.height);
DrawText(plst[k],s,ifb.mouse_width+ifb.key_width,0,
ifb.width-(ifb.mouse_width+ifb.key_width),ifb.height);
DrawTextMask(mlst[k],s,ifb.mouse_width+ifb.key_width,0,
ifb.width-(ifb.mouse_width+ifb.key_width),ifb.height);
XSetForeground(disp,gcp,1);
XSetForeground(disp,gcm,1);
if (i==1)
{
XCopyArea(disp,ifb.k2_pmap,plst[k],gcp,0,0,ifb.key_width,ifb.height,0,0);
XCopyArea(disp,ifb.k2_mask,mlst[k],gcm,0,0,ifb.key_width,ifb.height,0,0);
}
if (i==2)
{
XCopyArea(disp,ifb.k3_pmap,plst[k],gcp,0,0,ifb.key_width,ifb.height,0,0);
XCopyArea(disp,ifb.k3_mask,mlst[k],gcm,0,0,ifb.key_width,ifb.height,0,0);
}
if (i==3)
{
XCopyArea(disp,ifb.k4_pmap,plst[k],gcp,0,0,ifb.key_width,ifb.height,0,0);
XCopyArea(disp,ifb.k4_mask,mlst[k],gcm,0,0,ifb.key_width,ifb.height,0,0);
}
if (j==0)
{
XCopyArea(disp,ifb.m1_pmap,plst[k],gcp,0,0,ifb.mouse_width,ifb.height,ifb.key_width,0);
XCopyArea(disp,ifb.m1_mask,mlst[k],gcm,0,0,ifb.mouse_width,ifb.height,ifb.key_width,0);
}
if (j==1)
{
XCopyArea(disp,ifb.m2_pmap,plst[k],gcp,0,0,ifb.mouse_width,ifb.height,ifb.key_width,0);
XCopyArea(disp,ifb.m2_mask,mlst[k],gcm,0,0,ifb.mouse_width,ifb.height,ifb.key_width,0);
}
if (j==2)
{
XCopyArea(disp,ifb.m3_pmap,plst[k],gcp,0,0,ifb.mouse_width,ifb.height,ifb.key_width,0);
XCopyArea(disp,ifb.m3_mask,mlst[k],gcm,0,0,ifb.mouse_width,ifb.height,ifb.key_width,0);
}
XShapeCombineMask(disp,wlst[k],ShapeBounding,0,0,mlst[k],ShapeSet);
XSetWindowBackgroundPixmap(disp,wlst[k],plst[k]);
XMapWindow(disp,wlst[k]);
XFreeGC(disp,gcp);
XFreeGC(disp,gcm);
}
void GenListBtn(BWin *bwin)
{
int i,j;
int x,y,d;
Window w1,w2;
char s[1024];
Window wlst[64];
Pixmap plst[64];
Pixmap mlst[64];
XEvent xev;
for (i=0;i<64;i++)
{
wlst[i]=0;
plst[i]=0;
mlst[i]=0;
}
XQueryPointer(disp,root,&w1,&w2,&x,&y,&d,&d,&d);
if ((DisplayWidth(disp,screen)-x)<ifb.width)
x=DisplayWidth(disp,screen)-ifb.width;
for (i=0;i<4;i++)
{
for (j=0;j<3;j++)
{
if (bwin->action[j][i].id==12)
{
sprintf(s,"Menu : %s",bwin->action[j][i].params);
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (bwin->action[j][i].id==13)
{
sprintf(s,"Execute : %s",bwin->action[j][i].params);
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (bwin->action[j][i].id==14)
{
sprintf(s,"Exit");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (bwin->action[j][i].id==16)
{
sprintf(s,"Restart");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (bwin->action[j][i].id==17)
{
sprintf(s,"Restart Theme : %s",bwin->action[j][i].params);
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (bwin->action[j][i].id==18)
{
sprintf(s,"Root Background : %s",bwin->action[j][i].params);
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
}
}
XSync(disp,False);
XNextEvent(disp,&xev);
XPutBackEvent(disp,&xev);
i=0;
while(wlst[i])
{
XDestroyWindow(disp,wlst[i]);
XFreePixmap(disp,plst[i]);
XFreePixmap(disp,mlst[i]);
i++;
}
}
void GenListEWin(int b)
{
int i,j;
int x,y,d;
Window w1,w2;
char s[1024];
Window wlst[64];
Pixmap plst[64];
Pixmap mlst[64];
XEvent xev;
for (i=0;i<64;i++)
{
wlst[i]=0;
plst[i]=0;
mlst[i]=0;
}
XQueryPointer(disp,root,&w1,&w2,&x,&y,&d,&d,&d);
if ((DisplayWidth(disp,screen)-x)<ifb.width)
x=DisplayWidth(disp,screen)-ifb.width;
for (i=0;i<4;i++)
{
for (j=0;j<3;j++)
{
if (cfg.subwin_action[b][j][i].id==1)
{
sprintf(s,"Move Window");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==2)
{
sprintf(s,"Resize Window");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==3)
{
sprintf(s,"Iconify Window");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==4)
{
sprintf(s,"Kill Window");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==5)
{
sprintf(s,"Raise Window to Top");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==6)
{
sprintf(s,"Lower Window to Bottom");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==7)
{
sprintf(s,"Rasie/Lower Window");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==8)
{
sprintf(s,"Toggle Window Max Height");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==9)
{
sprintf(s,"Toggle Window Max Width");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==10)
{
sprintf(s,"Toggle Window Max Size");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==11)
{
sprintf(s,"Configure Enlightenment");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
if (cfg.subwin_action[b][j][i].id==12)
{
sprintf(s,"Menu : %s",cfg.subwin_action[b][j][i].params);
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==13)
{
sprintf(s,"Execute : %s",cfg.subwin_action[b][j][i].params);
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==14)
{
sprintf(s,"Exit");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==12)
{
sprintf(s,"Exit");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==14)
{
sprintf(s,"Exit");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==14)
{
sprintf(s,"Exit");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==14)
{
sprintf(s,"Exit");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==15)
{
sprintf(s,"Forcibly Kill Window");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==16)
{
sprintf(s,"Restart");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==17)
{
sprintf(s,"Restart Theme : %s",cfg.subwin_action[b][j][i].params);
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (cfg.subwin_action[b][j][i].id==18)
{
sprintf(s,"Root Background : %s",cfg.subwin_action[b][j][i].params);
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
}
}
XSync(disp,False);
XNextEvent(disp,&xev);
XPutBackEvent(disp,&xev);
i=0;
while(wlst[i])
{
XDestroyWindow(disp,wlst[i]);
XFreePixmap(disp,plst[i]);
XFreePixmap(disp,mlst[i]);
i++;
}
}
void GenListIcon()
{
int i,j;
int x,y,d;
Window w1,w2;
char s[1024];
Window wlst[64];
Pixmap plst[64];
Pixmap mlst[64];
XEvent xev;
for (i=0;i<64;i++)
{
wlst[i]=0;
plst[i]=0;
mlst[i]=0;
}
XQueryPointer(disp,root,&w1,&w2,&x,&y,&d,&d,&d);
if ((DisplayWidth(disp,screen)-x)<ifb.width)
x=DisplayWidth(disp,screen)-ifb.width;
for (i=0;i<4;i++)
{
for (j=0;j<3;j++)
{
if (icfg.action[j][i].id==1)
{
sprintf(s,"Move Window");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==2)
{
sprintf(s,"Resize Window");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==3)
{
sprintf(s,"Iconify Window");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==4)
{
sprintf(s,"Kill Window");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==5)
{
sprintf(s,"Raise Window to Top");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==6)
{
sprintf(s,"Lower Window to Bottom");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==7)
{
sprintf(s,"Rasie/Lower Window");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==8)
{
sprintf(s,"Toggle Window Max Height");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==9)
{
sprintf(s,"Toggle Window Max Width");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==10)
{
sprintf(s,"Toggle Window Max Size");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==11)
{
sprintf(s,"Configure Enlightenment");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
if (icfg.action[j][i].id==12)
{
sprintf(s,"Menu : %s",icfg.action[j][i].params);
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==13)
{
sprintf(s,"Execute : %s",icfg.action[j][i].params);
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==14)
{
sprintf(s,"Exit");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==12)
{
sprintf(s,"Exit");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==14)
{
sprintf(s,"Exit");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==14)
{
sprintf(s,"Exit");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==14)
{
sprintf(s,"Exit");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==15)
{
sprintf(s,"Forcibly Kill Window");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==16)
{
sprintf(s,"Restart");
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==17)
{
sprintf(s,"Restart Theme : %s",icfg.action[j][i].params);
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
else if (icfg.action[j][i].id==18)
{
sprintf(s,"Root Background : %s",icfg.action[j][i].params);
ShowLine(&x,&y,i,j,s,wlst,plst,mlst);
}
}
}
XSync(disp,False);
XNextEvent(disp,&xev);
XPutBackEvent(disp,&xev);
i=0;
while(wlst[i])
{
XDestroyWindow(disp,wlst[i]);
XFreePixmap(disp,plst[i]);
XFreePixmap(disp,mlst[i]);
i++;
}
}
void InfoBox()
{
int x,y,d;
Window w1,w2;
if (ifb.nodo) return;
XQueryPointer(disp,root,&w1,&w2,&x,&y,&d,&d,&d);
if (w2) ShowInfo(w2);
}
void ShowInfo(Window win)
{
EWin *ewin;
BWin *bwin;
Icon *icon;
int wb;
int x,y,d;
Window w1,w2;
ewin=ListGetWinID(global_l,win);
if (ewin)
{
XQueryPointer(disp,win,&w1,&w2,&x,&y,&d,&d,&d);
win=w2;
}
ewin=ListGetSubWinID(global_l,win);
if (ewin)
{
wb=GetEWinButtonID(ewin,win);
GenListEWin(wb);
}
else if (bwin=GetButtonWinID(win))
{
GenListBtn(bwin);
}
else if (win==icfg.bg_win)
{
XQueryPointer(disp,win,&w1,&w2,&x,&y,&d,&d,&d);
win=w2;
icon=GetIconWinID(win);
GenListIcon();
}
}