home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
d
/
dir_nm20.zip
/
Dir_NM_2.0
/
NM-Menu.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-16
|
20KB
|
712 lines
/* === NM-Menu.c ===
*
* int In_Use(Action,Choice)
* void Renew_Notice()
* void draw_command_box(text_string,x_start,y_start,width,height)
* void Show_Menu()
* void Show_Preface(Y)
* void Show_Face(Y)
* void RefreshMenu()
* void HighlightMenu(mx,my)
* int In_Table(mouse_x,mouse_y)
* int Get_Row_Id(mouse_x,mouse_y)
* int Get_Column_Id(mouse_x,mouse_y)
* void Hi_light_Table(mx,my)
* void Get_New_XY(mouse_x,mouse_y,X,Y)
* void Hi_light_host(mouse_x,mouse_y)
* int In_Map(mouse_x,mouse_y)
* int In_Text(mouse_x,mouse_y)
* int In_Set(mouse_x,mouse_y,W,H)
* int In_Value(mouse_x,mouse_y)
* void Hi_light_Map(mouse_x,mouse_y)
* void Hi_light_Text(mouse_x,mouse_y)
* void Hi_light_Set(mouse_x,mouse_y)
* void Hi_light_Value(mouse_x,mouse_y)
* void High_Light_Char(X,Y)
* void Move_Table(mouse_x,mouse_y,dx,dy)
* int NewMenuSelection()
* int Menu_box(x,y,nboxes,xstart_array,ystart,width,height)
*
*/
#include "NM.h"
#define NBOXES 24
#define OUTLINEWIDTH 2
char *title_array[NBOXES]={"Input","List","Output/Bk","Re_Name","Move_To",
"Delete","Value","Check_Tmp","Switch","Combine",
" "," ","Load","Tempo_Set"," ","Timbre",
"Words","Dance","Sounds","Voice","Piano","Print_Out",
" ","Quit"};
int xstart_array[NBOXES]={10,10,10,120,120,120,230,230,230,340,340,340,692,692,
692,802,802,802,912,912,912,1022,1022,1022},
ystart_array[NBOXES]={2,32,62,2,32,62,2,32,62,2,32,62,
2,32,62,2,32,62,2,32,62,2,32,62},
width=100,height=30,Map_SX=451;
int (*fcn_array[24])()={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int lit=-1,IN=-1,now=0,total=0,unite=0,Action=0,Motion=0,Copy=0,
Delete=0,Move=0,Switch=0,Replace=0,Mix=0;
extern GC saveGC;
int In_Use(Action,Choice)
int Action,Choice;
{
if (Action==Choice) return 1;else return 0;
}
void Renew_Notice()
{
int i,X,Y,W,H;
char *On_Clr,*Off_Clr;
if (Replace==-1) { Replace=0;tail=content[now];Save_Name(); }
On_Clr=(char *)malloc(20);*On_Clr='\0';
sprintf(On_Clr+strlen(On_Clr),"%s","magenta");
Off_Clr=(char *)malloc(20);*Off_Clr='\0';
sprintf(Off_Clr+strlen(Off_Clr),"%s","SteelBlue");
for (i=0;i<23;i++)
{
X=xstart_array[i]+8*(width/10)+2;Y=ystart_array[i]+height/4+2;
W=width/10-3;H=height/2-3;
switch (i)
{
case 0:Notice(X,Y,W,H,In_Use(Motion,Input_On),On_Clr,Off_Clr);break;
case 1:Notice(X,Y,W,H,In_Use(Motion,List_On),On_Clr,Off_Clr);break;
case 2:Notice(X,Y,W,H,In_Use(Motion,Output_On),On_Clr,Off_Clr);break;
case 3:Notice(X,Y,W,H,In_Use(Action,Re_Name_On),On_Clr,Off_Clr);break;
case 4:Notice(X,Y,W,H,In_Use(Action,Move_On),On_Clr,Off_Clr);break;
case 5:Notice(X,Y,W,H,In_Use(Action,Delete_On),On_Clr,Off_Clr);break;
case 6:Notice(X,Y,W,H,In_Use(Action,Value_On),On_Clr,Off_Clr);break;
case 7:Notice(X,Y,W,H,In_Use(Action,Check_Tmp_On),On_Clr,Off_Clr);
break;
case 8:Notice(X,Y,W,H,In_Use(Action,Switch_On),On_Clr,Off_Clr);break;
case 9:Notice(X,Y,W,H,In_Use(Action,Combine_On),On_Clr,Off_Clr);break;
case 12:Notice(X,Y,W,H,In_Use(Motion,Load_On),On_Clr,Off_Clr);break;
case 13:Notice(X,Y,W,H,In_Use(Motion,Tempo_Set_On),On_Clr,Off_Clr);
break;
case 15:Notice(X,Y,W,H,In_Use(Motion,Timbre_On),On_Clr,Off_Clr);break;
case 16:Notice(X,Y,W,H,In_Use(Motion,Words_On),On_Clr,Off_Clr);break;
case 17:Notice(X,Y,W,H,In_Use(Motion,Dance_On),On_Clr,Off_Clr);break;
case 18:Notice(X,Y,W,H,In_Use(Motion,Sounds_On),On_Clr,Off_Clr);break;
case 19:Notice(X,Y,W,H,In_Use(Motion,Voice_On),On_Clr,Off_Clr);break;
case 20:Notice(X,Y,W,H,In_Use(Motion,Piano_On),On_Clr,Off_Clr);break;
case 21:Notice(X,Y,W,H,In_Use(Motion,Print_On),On_Clr,Off_Clr);break;
break;
}
}
}
/* Routines for displaying and highlighting command boxes */
void draw_command_box(text_string,x_start,y_start,width,height)
char *text_string;
int x_start,y_start,width,height;
{
XSetLineAttributes(display,gc,2,0,0,0);
DrawRectangle(x_start,y_start,width,height);
SetColor("SkyBlue");XSetLineAttributes(display,gc,1,0,0,0);
DrawRectangle(x_start+8*(width/10),y_start+height/4,width/10,height/2);
SetColor("PaleGreen");OutTextXY(x_start+7,y_start+20,text_string);
}
void Show_Menu()
{
int n;
Rub(0,0,1139,93,"MediumBlue");Use_Font("7x14");Map_Dx=0;Map_Dy=0;
for (n=0;n<NBOXES;n++)
{
Rub(xstart_array[n],ystart_array[n],width,height,"MidNightBlue");
switch (n)
{
case 0:
case 1:
case 2:SetColor("LightSkyBlue");break;
case 3:
case 4:
case 5:SetColor("yellow");break;
case 6:
case 7:
case 8:SetColor("turquoise");break;
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:SetColor("HotPink");break;
case 15:
case 16:
case 17:SetColor("turquoise");break;
case 18:
case 19:
case 20:SetColor("yellow");break;
case 21:
case 22:
case 23:SetColor("LightSkyBlue");break;
}
draw_command_box(title_array[n],xstart_array[n],ystart_array[n],
width,height);
}
Column_Id=-10;Row_Id=-10;Map_Column_Id=-10;Map_Row_Id=-10;Draw_Map(Map_SX,2);
}
void Show_Preface(Y)
int Y;
{
int i,j;
Dx_bar=137;Dy_bar=45;X_bar=170;Y_bar=Y+380;W_bar=106;H_bar=26;total=0;
Rub(0,480,1132,384,"MediumBlue");XSetLineAttributes(display,gc,2,0,0,0);
SetColor("yellow");Line(0,480,1132,480);Use_Font("7x14");SetColor("white");
DrawRectangle(X_bar-27,Y_bar-20,32*H_bar+16,12*H_bar-16);SetColor("SkyBlue");
for (i=0;i<6;i++)
for (j=0;j<6;j++)
DrawRectangle(i*Dx_bar+X_bar,j*Dy_bar+Y_bar,W_bar+4,H_bar+4);
for (i=0;i<6;i++)
for (j=0;j<6;j++)
Rub(i*Dx_bar+X_bar+2,j*Dy_bar+Y_bar+2,W_bar,H_bar,"MidNightBlue");
SetColor("gold");
for (i=0;i<6;i++)
for (j=0;j<6;j++)
{
OutTextXY(i*Dx_bar+X_bar+8,j*Dy_bar+Y_bar+21,Get_Filename(i*6+j,0));
total+=content[i*6+j];
}
SetColor("green");DrawRectangle(8,812,1117,37);Rub(9,813,1115,35,"black");
SetColor("yellow");Use_Font("12x24");OutTextXY(506,842,"Total = ");
SetColor("SpringGreen");Out_I_XY(606,842,total);
}
void Show_Face(Y)
int Y;
{
SetColor("cyan");XSetLineAttributes(display,gc,2,0,0,0);
DrawRectangle(1,1,1130,860);Line(1,94,1130,94);
Rub(3,95,1126,385,"MidNightBlue");XSetFunction(display,gc,GXcopy);
XSetLineAttributes(display,gc,3,0,0,0);Use_Font("12x24");SetColor("white");
DrawRectangle(326,Y,480,290);Rub(339,Y+13,454,264,"RoyalBlue");
Rub(349,Y+23,434,244,"black");SetColor("magenta");
DrawRectangle(359,Y+33,414,224);Rub(369,Y+43,394,204,"RoyalBlue");
SetColor("yellow");OutTextXY(548,Y+143,"2.0");SetColor("white");
OutTextXY(463,Y+100,"imble usician");SetColor("gold");
Use_Font("-bitstream-charter-bold-r-normal--33-240-100-100-p-206-iso8859-1");
OutTextXY(439,Y+100,"N M");SetColor("SpringGreen");
Use_Font("12x24");OutTextXY(510,Y+187,"Ni Min");SetColor("pink");
Use_Font("7x14");OutTextXY(470,Y+223,"Developed at I.U. IN. U.S.A.");
Show_Preface(Y);
}
void RefreshMenu()
{
static XGCValues newValues;
static unsigned long valuemask;
/* NEW TRICK for switching states-> copy the current GC values into a static
* dummy, change the attributes,then copy the preexisting GC values back before
* exiting. The manual implies there is no better way...
*/
XClearWindow(display,win);valuemask=GCFunction|GCLineWidth;
XCopyGC(display,gc,valuemask,saveGC);
newValues.function=GXxor;newValues.line_width=OUTLINEWIDTH;
XChangeGC(display,gc,valuemask,&newValues);XSetFunction(display,gc,GXcopy);
IN=-1;lit=-1;In_Menu=1;Del=-1;freq=392.0;Show_Menu();Show_Face(139);
Action=0;Motion=0;Host=0;Host_X=-1;Host_Y=-1;Tour_On=0;Print_pt=0;
}
/* Process the motion events to see if menu box needs highlighting. */
void HighlightMenu(mx,my)
int mx,my;
{
int cmd;
cmd=Menu_box(mx,my,NBOXES,xstart_array,ystart_array,width,height);
if (cmd>=0) /* Toggle on */
{
if (lit!=cmd)
{
if (lit==-1)
{
highlight(xstart_array[cmd]+3,ystart_array[cmd]+3,width-5,
height-5);
lit=cmd;
}
else
{
highlight(xstart_array[lit]+3,ystart_array[lit]+3,width-5,
height-5);
highlight(xstart_array[cmd]+3,ystart_array[cmd]+3,width-5,
height-5);
lit=cmd;
}
}
}
else if (lit>=0) /* Toggle off */
{
highlight(xstart_array[lit]+3,ystart_array[lit]+3,width-5,height-5);
lit=-1;
}
}
int In_Table(mouse_x,mouse_y)
int mouse_x,mouse_y;
{
int Lim_Y;
if (Host==1) Lim_Y=380;else Lim_Y=Table_Height;
if (5<mouse_x && mouse_x<Table_Width && 97<mouse_y && mouse_y<100+Lim_Y)
return 1;
else return 0;
}
int Get_Row_Id(mouse_x,mouse_y)
int mouse_x,mouse_y;
{
if (In_Table(mouse_x,mouse_y)==1)
{
if (97<mouse_y && mouse_y<120) return -2; /* In_Name */
else if (77+Table_Height<mouse_y) return -3; /* Out_Name */
else return (mouse_y-121)/20+Row_Pointer; /* Atom */
}
else return -1;
}
int Get_Column_Id(mouse_x,mouse_y)
int mouse_x,mouse_y;
{
int i,X;
if (In_Table(mouse_x,mouse_y)==1)
{
if (5<mouse_x && mouse_x<7*Column_Range[0].Delta+5) return 0;
for (i=Column_Pointer;i<Max_Column;i++)
{
X=Head_Len+Column_Range[i].Position+3
-Column_Range[Column_Pointer].Position;
if (X<=mouse_x && mouse_x<=X+7*Column_Range[i].Delta) return i;
}
}
else return -1;
}
Hi_light_Table(mx,my)
int mx,my;
{
int New_Row_Id,New_Column_Id,X,New_X,Y,New_Y,Width,
New_Width,Height;
if (Row_On==1)
{
New_Row_Id=Get_Row_Id(mx,my);Height=15;
if (New_Row_Id!=-1 && Row_Id!=New_Row_Id)
{
if (Row_Id!=-10)
{
if (Row_Id==-2) highlight(6,99,Table_Width-6,19);
else if (Row_Id==-3)
highlight(6,Row_Range[Table_Row_Num-Row_Pointer].Position
+3,Table_Width-6,19);
else highlight(6,Row_Range[Row_Id-Row_Pointer].Position+3,
Table_Width-6,Height);
}
Row_Id=New_Row_Id;
if (Row_Id==-2) highlight(6,99,Table_Width-6,19);
else if (Row_Id==-3)
highlight(6,Row_Range[Table_Row_Num-Row_Pointer].Position+3,
Table_Width-6,19);
else highlight(6,Row_Range[Row_Id-Row_Pointer].Position+3,
Table_Width-6,Height);
}
else if (New_Row_Id==-1 && Row_Id!=-10)
{
if (Row_Id==-2) highlight(6,99,Table_Width-6,19);
else if (Row_Id==-3)
highlight(6,Row_Range[Table_Row_Num-Row_Pointer].Position
+3,Table_Width-6,19);
else highlight(6,Row_Range[Row_Id-Row_Pointer].Position+3,
Table_Width-6,Height);
Row_Id=-10;
}
}
else if (Column_On==1)
{
New_Column_Id=Get_Column_Id(mx,my);
if (New_Column_Id!=-1 && Column_Id!=New_Column_Id)
{
X=Column_Range[Column_Id].Position+Head_Len+6
-Column_Range[Column_Pointer].Position;
Width=7*Column_Range[Column_Id].Delta;
New_X=Column_Range[New_Column_Id].Position+Head_Len+6
-Column_Range[Column_Pointer].Position;
New_Width=7*Column_Range[New_Column_Id].Delta;
if (Column_Id!=-10) highlight(X,99,Width-5,Table_Height);
Column_Id=New_Column_Id;X=New_X;Width=New_Width;
highlight(X,99,Width-5,Table_Height);
}
else if (New_Column_Id==-1 && Column_Id!=-10)
{
X=Column_Range[Column_Id].Position+Head_Len+6
-Column_Range[Column_Pointer].Position;
Width=7*Column_Range[Column_Id].Delta;
highlight(X,99,Width-5,Table_Height);Column_Id=-10;
}
}
else if (Atom_On==1)
{
New_Column_Id=Get_Column_Id(mx,my);
New_Row_Id=Get_Row_Id(mx,my);
if (New_Column_Id!=-1 && New_Row_Id!=-1 &&
(Column_Id!=New_Column_Id || Row_Id!=New_Row_Id))
{
X=Column_Range[Column_Id].Position+6;
if (Row_Id==-2) { Y=99;Height=19; }
else if (Row_Id==-3)
{
Y=Row_Range[Table_Row_Num-Row_Pointer].Position+3;
Height=19;
}
else
{
Y=Row_Range[Row_Id-Row_Pointer].Position+3;
Height=15;
}
Width=7*Column_Range[Column_Id].Delta;
if (Column_Id!=-10 && Row_Id!=-10)
highlight(X,Y,Width-5,Height);
New_X=Column_Range[New_Column_Id].Position+6;
if (New_Row_Id==-2) { New_Y=99;Height=19; }
else if (New_Row_Id==-3)
{
New_Y=Row_Range[Table_Row_Num-Row_Pointer].Position
+3;
Height=19;
}
else
{
New_Y=Row_Range[New_Row_Id-Row_Pointer].Position+3;
Height=15;
}
New_Width=7*Column_Range[New_Column_Id].Delta;
Column_Id=New_Column_Id;Row_Id=New_Row_Id;
X=New_X;Y=New_Y;Width=New_Width;
highlight(X,Y,Width-5,Height);
}
else if (New_Column_Id==-1 && Column_Id!=-10 &&
New_Row_Id==-1 && Row_Id!=-10)
{
X=Column_Range[Column_Id].Position+6;
if (Row_Id==-2) { Y=99;Height=19; }
else if (Row_Id==-3)
{
Y=Row_Range[Table_Row_Num-
Row_Pointer].Position+3;
Height=19;
}
else
{
Y=Row_Range[Row_Id-Row_Pointer].Position+3;
Height=15;
}
Width=7*Column_Range[Column_Id].Delta;
highlight(X,Y,Width-5,Height);Column_Id=-10;Row_Id=-10;
}
}
}
void Get_New_XY(mouse_x,mouse_y,X,Y)
int mouse_x,mouse_y,*X,*Y;
{
int x,y;
for (x=0;x<6;x++)
for (y=0;y<6;y++)
if (X_bar+x*Dx_bar<mouse_x && mouse_x<X_bar+x*Dx_bar+W_bar+2 &&
Y_bar+y*Dy_bar<mouse_y && mouse_y<Y_bar+y*Dy_bar+H_bar+2)
{ *X=x;*Y=y;return; }
}
void Hi_light_host(mouse_x,mouse_y)
int mouse_x,mouse_y;
{
int New_host_x,New_host_y;
New_host_x=-1;New_host_y=-1;
Get_New_XY(mouse_x,mouse_y,&New_host_x,&New_host_y);
if (New_host_x>=0) /* Toggle on */
{
if (Host_X != New_host_x && Host_Y != New_host_y)
{
if (Host_X==-1)
{
Host_X=New_host_x;Host_Y=New_host_y;
highlight(X_bar+Host_X*Dx_bar+3,Y_bar+Host_Y*Dy_bar+3,
W_bar-1,H_bar-1);
}
else
{
highlight(X_bar+Host_X*Dx_bar+3,Y_bar+Host_Y*Dy_bar+3,
W_bar-1,H_bar-1);
Host_X=New_host_x;Host_Y=New_host_y;
highlight(X_bar+Host_X*Dx_bar+3,Y_bar+Host_Y*Dy_bar+3,
W_bar-1,H_bar-1);
}
}
}
else if (Host_X>=0) /* Toggle off */
{
highlight(X_bar+Host_X*Dx_bar+3,Y_bar+Host_Y*Dy_bar+3,
W_bar-1,H_bar-1);
Host_X=-1;Host_Y=-1;
}
}
int In_Map(mouse_x,mouse_y)
int mouse_x,mouse_y;
{
if (Map_SX-1<mouse_x && mouse_x<Map_SX+228 && 2<mouse_y && mouse_y<92)
return 1;
else return 0;
}
int In_Text(mouse_x,mouse_y)
int mouse_x,mouse_y;
{
if (Map_SX-1<mouse_x && mouse_x<Map_SX+228 && Text_SY-1<mouse_y &&
mouse_y<Text_SY+73)
return 1;
else return 0;
}
int In_Set(mouse_x,mouse_y,W,H)
int mouse_x,mouse_y,W,H;
{
if (Set_X+2*W-1<mouse_x && mouse_x<Set_X+Set_W && Set_Y+H-1<mouse_y &&
mouse_y<Set_Y+Set_H)
return 1;
else if (Set_X-1<mouse_x && mouse_x<Set_X+2*W+1 && Set_Y-1<mouse_y &&
mouse_y<Set_Y+H)
return 0;
else return -1;
}
int In_Value(mouse_x,mouse_y)
int mouse_x,mouse_y;
{
if (Value_X-1<mouse_x && mouse_x<Value_X+Value_W && Value_Y-1<mouse_y &&
mouse_y<Value_Y+Value_H)
return 1;
else return -1;
}
void Hi_light_Map(mouse_x,mouse_y)
int mouse_x,mouse_y;
{
int New_Col_Id,New_Row_Id,X,Y,W,H;
W=16;H=15;
if (In_Map(mouse_x,mouse_y)==1)
{
New_Col_Id=(mouse_x-Map_SX-1)/19;New_Row_Id=(mouse_y-5)/18;
if (Map_Column_Id!=New_Col_Id || Map_Row_Id!=New_Row_Id)
{
if (Map_Column_Id!=-10 && Map_Row_Id!=-10)
{
X=Map_SX+Map_Column_Id*19+2;Y=4+Map_Row_Id*18;highlight(X,Y,W,H);
}
Map_Column_Id=New_Col_Id;Map_Row_Id=New_Row_Id;
X=Map_SX+Map_Column_Id*19+2;Y=4+Map_Row_Id*18;highlight(X,Y,W,H);
}
}
else if (Map_Column_Id!=-10 || Map_Row_Id!=-10)
{
X=Map_SX+Map_Column_Id*19+2;Y=4+Map_Row_Id*18;highlight(X,Y,W,H);
Map_Column_Id=-10;Map_Row_Id=-10;
}
}
void Hi_light_Text(mouse_x,mouse_y)
int mouse_x,mouse_y;
{
int New_Col_Id,New_Row_Id,X,Y,W,H;
W=16;H=15;
if (In_Text(mouse_x,mouse_y)==1)
{
New_Col_Id=(mouse_x-Map_SX-1)/19;New_Row_Id=(mouse_y-Text_SY-1)/18;
if (Text_Column_Id!=New_Col_Id || Text_Row_Id!=New_Row_Id)
{
if (Text_Column_Id!=-10 && Text_Row_Id!=-10)
{
X=Map_SX+Text_Column_Id*19+2;Y=2+Text_SY+Text_Row_Id*18;
highlight(X,Y,W,H);
}
Text_Column_Id=New_Col_Id;Text_Row_Id=New_Row_Id;
X=Map_SX+Text_Column_Id*19+2;Y=2+Text_SY+Text_Row_Id*18;
highlight(X,Y,W,H);
}
}
else if (Text_Column_Id!=-10 || Text_Row_Id!=-10)
{
X=Map_SX+Text_Column_Id*19+2;Y=2+Text_SY+Text_Row_Id*18;
highlight(X,Y,W,H);Text_Column_Id=-10;Text_Row_Id=-10;
}
}
void Hi_light_Set(mouse_x,mouse_y)
int mouse_x,mouse_y;
{
int New_Col_Id,New_Row_Id,X,Y,W,H;
W=60;H=40;
if (In_Set(mouse_x,mouse_y,W,H)==1)
{
New_Col_Id=(mouse_x-Set_X-2*W-1)/W;New_Row_Id=(mouse_y-Set_Y-H-1)/H;
if (Set_Column!=New_Col_Id || Set_Row!=New_Row_Id)
{
if (Set_Column!=-10 && Set_Row!=-10)
{
X=Set_X+2*W+Set_Column*W+2;Y=2+Set_Y+H+Set_Row*H;
highlight(X+1,Y+1,W-5,H-6);
}
Set_Column=New_Col_Id;Set_Row=New_Row_Id;
X=Set_X+2*W+Set_Column*W+2;Y=2+Set_Y+H+Set_Row*H;
highlight(X+1,Y+1,W-5,H-6);
}
}
else if (Set_Column!=-10 || Set_Row!=-10)
{
X=Set_X+2*W+Set_Column*W+2;Y=2+Set_Y+H+Set_Row*H;
highlight(X+1,Y+1,W-5,H-6);Set_Column=-10;Set_Row=-10;
}
}
void Hi_light_Value(mouse_x,mouse_y)
int mouse_x,mouse_y;
{
int New_Col_Id,New_Row_Id,X,Y,W,H;
W=136;H=60;
if (In_Value(mouse_x,mouse_y)==1)
{
New_Col_Id=(mouse_x-Value_X-1)/W;New_Row_Id=(mouse_y-Value_Y-1)/H;
if (Value_Column!=New_Col_Id || Value_Row!=New_Row_Id)
{
if (Value_Column!=-10 && Value_Row!=-10)
{
X=Value_X+Value_Column*W+2;Y=2+Value_Y+Value_Row*H;
highlight(X+Value_H_X,Y+Value_H_Y,Value_H_W,Value_H_H);
}
Value_Column=New_Col_Id;Value_Row=New_Row_Id;
X=Value_X+Value_Column*W+2;Y=2+Value_Y+Value_Row*H;
highlight(X+Value_H_X,Y+Value_H_Y,Value_H_W,Value_H_H);
}
}
else if (Value_Column!=-10 || Value_Row!=-10)
{
X=Value_X+Value_Column*W+2;Y=2+Value_Y+Value_Row*H;
highlight(X+Value_H_X,Y+Value_H_Y,Value_H_W,Value_H_H);
Value_Column=-10;Value_Row=-10;
}
}
void High_Light_Char(X,Y)
int X,Y;
{
highlight(X*7+47,Y*Dist+149,7,11);
}
void Move_Table(mouse_x,mouse_y,dx,dy)
int mouse_x,mouse_y,dx,dy;
{
if (dx>0)
{
if (Column_Pointer>1)
{ if (Column_Pointer-dx>0) Column_Pointer-=dx;else Column_Pointer=1; }
}
else
{
if (Column_Pointer-dx<Table_Column_Num) Column_Pointer-=dx;
else Column_Pointer=Table_Column_Num-2;
}
if (dy>0)
{
if (Row_Pointer>0)
{ if (Row_Pointer-dy>0) Row_Pointer-=dy;else Row_Pointer=0; }
}
else
{
if (Row_Pointer-dy<Table_Row_Num) Row_Pointer-=dy;
else Row_Pointer=Table_Row_Num-2;
}
Update_Table(mouse_x,mouse_y);
}
int NewMenuSelection()
{
if (lit>=0)
{
if (IN>=0)
{
if (IN!=lit) /* both lit but different */
{
if (fcn_array[lit]) { (*fcn_array[lit])(lit);IN=-1; } else IN=lit;
}
}
else
{
if (fcn_array[lit]) (*fcn_array[lit])(lit); /* Just call function */
else IN=lit;
}
return(1);
}
else return(0);
}
/* Return MINUS ONE if not in a command box, box number = otherwise. */
int Menu_box(x,y,nboxes,xstart_array,ystart_array,width,height)
int x,y,nboxes,*xstart_array,*ystart_array,width,height;
{
int n,xstart,ystart;
for (n=0;n<nboxes;n++)
{
xstart=xstart_array[n];ystart=ystart_array[n];
if ((xstart<=x)&&(x<xstart+width)&&(ystart<=y)&&(y<ystart+height))
return(n);
}
n=-1;return(n); /* Return -1 if no hit */
}
/* Miscellaneous useful calls
*
XSetLineAttributes(display,gc,3,0,0,0);
* Args of XSetLineAttributes
* = (dis,gc,line_width,line_style,cap_style,join_style)
* See /usr/include/X11/X.h for LineSolid,CapNotLast,JoinMiter, etc.
*/