-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPUXMMENU.c
207 lines (185 loc) · 7.1 KB
/
PUXMMENU.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/*PUXMMENU.C*/
#include "PKIN.h"
#include "PKINDLOG.h"
/****myenableitem()**********************************************************/
void myenableitem(Widget themenu, Widget theitem, int thestate)
{
#ifdef UNIX_MOTIF /*060324 re compile with NOGUI, requires Lquiet=1*/
if(Lquiet==0) /*was Lcommanded before 990402*/
{
XtVaSetValues(theitem,XmNsensitive,thestate,NULL);
}
#endif /* UNIX_MOTIF 060324 re compile with NOGUI, requires Lquiet=1*/
}
/*___myenableitem()_________________________________________________________*/
/****AdjustMenus()***********************************************************/
void AdjustMenus()
{
myenableitem(fileMenu, openItem, !Lgetfile);
myenableitem(fileMenu, aboutItem, 1);/* info always enabled */
myenableitem(fileMenu, passItem, Lpassposs);
myenableitem(fileMenu, launchItem, Lmadekin);
myenableitem(fileMenu, quitItem, 1);
myenableitem(optiMenu, optionsaboutItem, 1);
myenableitem(optiMenu, mutrotItem, 1);
}
/*___AdjustMenus()__________________________________________________________*/
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/****mycheckitem()********************************************************/
void mycheckitem(Widget themenu, Widget theitem, int thestate)
{ /*common name: MAC & PC & UNIX*/
#ifdef UNIX_MOTIF /*060324 re compile with NOGUI, requires Lquiet=1*/
if(Lquiet==0) /*was Lcommanded before 990402*/
{
XmToggleButtonSetState(theitem, thestate, 0);
/* 0: don't generate a callback*/
}
#endif /* UNIX_MOTIF 060324 re compile with NOGUI, requires Lquiet=1*/
}
/*___mycheckitem()_______________________________________________________*/
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/****mymodifymenuitem()******************************************************/
void mymodifymenuitem(Widget themenu, Widget theitem, char thestring[256])
{
#ifdef UNIX_MOTIF /*060324 re compile with NOGUI, requires Lquiet=1*/
XmString xmstring;
if(Lquiet==0) /*was Lcommanded before 990402*/
{
xmstring = XmStringCreateSimple(thestring);
XtVaSetValues(theitem,XmNlabelString,xmstring,NULL);
XmStringFree(xmstring);
}
#endif /* UNIX_MOTIF 060324 re compile with NOGUI, requires Lquiet=1*/
}
/*___mymodifymenuitem()_____________________________________________________*/
/****checkmarkmenu()*********************************************************/
void checkmarkmenu(int ion,MenuHandle menu, Widget item, int iredraw)
{
#ifdef UNIX_MOTIF /*060324 re compile with NOGUI, requires Lquiet=1*/
if(Lquiet==0) /*was Lcommanded before 990402*/
{
XmToggleButtonSetState(item, ion, 0);
}
#endif /* UNIX_MOTIF 060324 re compile with NOGUI, requires Lquiet=1*/
}
/*___checkmarkmenu()________________________________________________________*/
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/****resetmenuchecks()************************************/
void resetmenuchecks()
{
#ifdef UNIX_MOTIF /*060324 re compile with NOGUI, requires Lquiet=1*/
/*XmToggleButtonSetState( testItem, Ltest, 0);*/
if(Lquiet==0) /*was Lcommanded before 990402*/
{
AdjustMenus();
}
#endif /* UNIX_MOTIF 060324 re compile with NOGUI, requires Lquiet=1*/
}
/*___resetmenuchecks()___________________________________*/
/****launchcurrentkinemage()**************************************************/
void launchcurrentkinemage()
{
#ifdef TESTACTIVE
sprintf(alertstr,"Now launch current kin");
DoReportDialog();
#endif
sprintf(word,"mage %s &",OutfileStr);
system(word);
exit(0);
}
/*___launchcurrentkinemage()_________________________________________________*/
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/****open_CB******************************************************************/
XtCallbackProc open_CB(Widget w,XtPointer client_data,XtPointer call_data)
{
Lnewfile = 1; /*flag so Main loop will initiate open file stuff*/
return(NULL);
}
/*___open_CB_________________________________________________________________*/
/****quit_CB******************************************************************/
XtCallbackProc quit_CB(Widget w,XtPointer client_data,XtPointer call_data)
{
#ifdef UNIX_MOTIF /*060324 re compile with NOGUI, requires Lquiet=1*/
if(Lquiet==0)
{
if(((XmAnyCallbackStruct *)(call_data))->reason == XmCR_ACTIVATE)
{
if(fpinput!=NULL)
{
fclose(fpinput);
}
if(fpoutput!=NULL)
{
fclose(fpoutput);
}
exit(0);
}
}
#endif /* UNIX_MOTIF 060324 re compile with NOGUI, requires Lquiet=1*/
return(NULL);
}
/*___quit_CB_________________________________________________________________*/
/****dummy_CB()***************************************************************/
XtCallbackProc dummy_CB(Widget w,XtPointer client_data,XtPointer call_data)
{
return(NULL);
}
/*___dummy_CB()______________________________________________________________*/
/****about_CB()***************************************************************/
XtCallbackProc about_CB(Widget w,XtPointer client_data,XtPointer call_data)
{
menuabout(); /*PKINMENU*/
return(NULL);
}
/*___about_CB()______________________________________________________________*/
/****newpass_CB()************************************************************/
XtCallbackProc newpass_CB(Widget w,XtPointer client_data,XtPointer call_data)
{
Lgetfile = 1; /*must reset to 1 if continue with new pass on same file*/
Lnewpass = 1;
Lrangestart = 1;
npass++;
rewind(fpinput);
Linclusive = 1;
return(NULL);
}
/*___newpass_CB()___________________________________________________________*/
/****launchcurrent_CB()*******************************************************/
XtCallbackProc launchcurrent_CB(Widget w,XtPointer client_d,XtPointer call_d)
{
if(fpinput!=NULL)
{
fclose(fpinput);
}
if(fpoutput!=NULL)
{
fclose(fpoutput);
}
launchcurrentkinemage();
exit(0);
return(NULL);
}
/*___launchcurrent_CB()________________________________________________________*/
/****optionsabout_CB()*********************************************************/
XtCallbackProc optionsabout_CB(Widget w,XtPointer client_da,XtPointer call_da)
{
aboutoptions(); /*PKINMENU*/
return(NULL);
}
/*___optionsabout_CB()________________________________________________________*/
/****mutrot_CB()***************************************************************/
XtCallbackProc mutrot_CB(Widget w,XtPointer client_data,XtPointer call_data)
{
menuaboutmutations(0); /*PKINMENU.c*/
return(NULL);
}
/*___mutrot_CB()______________________________________________________________*/
/****makehelphtml_CB()********************************************************/
XtCallbackProc makehelphtml_CB(Widget w,XtPointer client_data,XtPointer call_data)
{
writehelptohtmlfile(0); /*PKININIT.c*/
return(NULL);
}
/*___makehelphtml_CB()_______________________________________________________*/
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/*PUXMMENU.c*/