This repository has been archived by the owner on Jul 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
menu.h
540 lines (487 loc) · 15.3 KB
/
menu.h
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
/* $XTermId: menu.h,v 1.128 2012/09/21 10:39:10 tom Exp $ */
/*
* Copyright 1999-2010,2011 by Thomas E. Dickey
*
* All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name(s) of the above copyright
* holders shall not be used in advertising or otherwise to promote the
* sale, use or other dealings in this Software without prior written
* authorization.
*
*
* Copyright 1989 The Open Group
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation.
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of The Open Group shall
* not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization
* from The Open Group.
*
*/
#ifndef included_menu_h
#define included_menu_h
/* *INDENT-OFF* */
#include <xterm.h>
typedef struct _MenuEntry {
const char *name;
void (*function) PROTO_XT_CALLBACK_ARGS;
Widget widget;
} MenuEntry;
extern MenuEntry mainMenuEntries[], vtMenuEntries[];
extern MenuEntry fontMenuEntries[];
#if OPT_TEK4014
extern MenuEntry tekMenuEntries[];
#endif
extern void Handle8BitControl PROTO_XT_ACTIONS_ARGS;
extern void HandleAllow132 PROTO_XT_ACTIONS_ARGS;
extern void HandleAllowBoldFonts PROTO_XT_ACTIONS_ARGS;
extern void HandleAllowColorOps PROTO_XT_ACTIONS_ARGS;
extern void HandleAllowFontOps PROTO_XT_ACTIONS_ARGS;
extern void HandleAllowSends PROTO_XT_ACTIONS_ARGS;
extern void HandleAllowTcapOps PROTO_XT_ACTIONS_ARGS;
extern void HandleAllowTitleOps PROTO_XT_ACTIONS_ARGS;
extern void HandleAllowWindowOps PROTO_XT_ACTIONS_ARGS;
extern void HandleAltEsc PROTO_XT_ACTIONS_ARGS;
extern void HandleAltScreen PROTO_XT_ACTIONS_ARGS;
extern void HandleAppCursor PROTO_XT_ACTIONS_ARGS;
extern void HandleAppKeypad PROTO_XT_ACTIONS_ARGS;
extern void HandleAutoLineFeed PROTO_XT_ACTIONS_ARGS;
extern void HandleAutoWrap PROTO_XT_ACTIONS_ARGS;
extern void HandleBackarrow PROTO_XT_ACTIONS_ARGS;
extern void HandleBellIsUrgent PROTO_XT_ACTIONS_ARGS;
extern void HandleClearSavedLines PROTO_XT_ACTIONS_ARGS;
extern void HandleCreateMenu PROTO_XT_ACTIONS_ARGS;
extern void HandleCursesEmul PROTO_XT_ACTIONS_ARGS;
extern void HandleCursorBlink PROTO_XT_ACTIONS_ARGS;
extern void HandleDeleteIsDEL PROTO_XT_ACTIONS_ARGS;
extern void HandleFontBoxChars PROTO_XT_ACTIONS_ARGS;
extern void HandleFontDoublesize PROTO_XT_ACTIONS_ARGS;
extern void HandleFontLoading PROTO_XT_ACTIONS_ARGS;
extern void HandleFontPacked PROTO_XT_ACTIONS_ARGS;
extern void HandleFullscreen PROTO_XT_ACTIONS_ARGS;
extern void HandleHardReset PROTO_XT_ACTIONS_ARGS;
extern void HandleHpFunctionKeys PROTO_XT_ACTIONS_ARGS;
extern void HandleJumpscroll PROTO_XT_ACTIONS_ARGS;
extern void HandleKeepSelection PROTO_XT_ACTIONS_ARGS;
extern void HandleLogging PROTO_XT_ACTIONS_ARGS;
extern void HandleMarginBell PROTO_XT_ACTIONS_ARGS;
extern void HandleMetaEsc PROTO_XT_ACTIONS_ARGS;
extern void HandleNumLock PROTO_XT_ACTIONS_ARGS;
extern void HandleOldFunctionKeys PROTO_XT_ACTIONS_ARGS;
extern void HandlePopupMenu PROTO_XT_ACTIONS_ARGS;
extern void HandlePrintControlMode PROTO_XT_ACTIONS_ARGS;
extern void HandlePrintEverything PROTO_XT_ACTIONS_ARGS;
extern void HandlePrintScreen PROTO_XT_ACTIONS_ARGS;
extern void HandleQuit PROTO_XT_ACTIONS_ARGS;
extern void HandleRedraw PROTO_XT_ACTIONS_ARGS;
extern void HandleRenderFont PROTO_XT_ACTIONS_ARGS;
extern void HandleReverseVideo PROTO_XT_ACTIONS_ARGS;
extern void HandleReverseWrap PROTO_XT_ACTIONS_ARGS;
extern void HandleScoFunctionKeys PROTO_XT_ACTIONS_ARGS;
extern void HandleScrollKey PROTO_XT_ACTIONS_ARGS;
extern void HandleScrollTtyOutput PROTO_XT_ACTIONS_ARGS;
extern void HandleScrollbar PROTO_XT_ACTIONS_ARGS;
extern void HandleSecure PROTO_XT_ACTIONS_ARGS;
extern void HandleSendSignal PROTO_XT_ACTIONS_ARGS;
extern void HandleSetPopOnBell PROTO_XT_ACTIONS_ARGS;
extern void HandleSetSelect PROTO_XT_ACTIONS_ARGS;
extern void HandleSetTekText PROTO_XT_ACTIONS_ARGS;
extern void HandleSetTerminalType PROTO_XT_ACTIONS_ARGS;
extern void HandleSetVisualBell PROTO_XT_ACTIONS_ARGS;
extern void HandleSoftReset PROTO_XT_ACTIONS_ARGS;
extern void HandleSunFunctionKeys PROTO_XT_ACTIONS_ARGS;
extern void HandleSunKeyboard PROTO_XT_ACTIONS_ARGS;
extern void HandleTekCopy PROTO_XT_ACTIONS_ARGS;
extern void HandleTekPage PROTO_XT_ACTIONS_ARGS;
extern void HandleTekReset PROTO_XT_ACTIONS_ARGS;
extern void HandleTiteInhibit PROTO_XT_ACTIONS_ARGS;
extern void HandleToolbar PROTO_XT_ACTIONS_ARGS;
extern void HandleUTF8Fonts PROTO_XT_ACTIONS_ARGS;
extern void HandleUTF8Mode PROTO_XT_ACTIONS_ARGS;
extern void HandleUTF8Title PROTO_XT_ACTIONS_ARGS;
extern void HandleVisibility PROTO_XT_ACTIONS_ARGS;
extern void HandleWriteError PROTO_XT_ACTIONS_ARGS;
extern void HandleWriteNow PROTO_XT_ACTIONS_ARGS;
extern void SetupMenus (Widget /*shell*/, Widget */*forms*/, Widget */*menus*/, Dimension * /*menu_high*/);
#if OPT_TOOLBAR
extern void ShowToolbar(Bool);
#endif
/*
* The following definitions MUST match the order of entries given in
* the mainMenuEntries, vtMenuEntries, and tekMenuEntries arrays in menu.c.
*/
/*
* items in primary menu
*/
typedef enum {
#if OPT_TOOLBAR
mainMenu_toolbar,
#endif
#if OPT_MAXIMIZE
mainMenu_fullscreen,
#endif
mainMenu_securekbd,
mainMenu_allowsends,
mainMenu_redraw,
mainMenu_line1,
#ifdef ALLOWLOGGING
mainMenu_logging,
#endif
#if OPT_PRINT_ON_EXIT
mainMenu_write_now,
mainMenu_write_error,
#endif
mainMenu_print,
mainMenu_print_redir,
mainMenu_line2,
mainMenu_8bit_ctrl,
mainMenu_backarrow,
#if OPT_NUM_LOCK
mainMenu_num_lock,
mainMenu_alt_esc,
mainMenu_meta_esc,
#endif
mainMenu_delete_del,
mainMenu_old_fkeys,
#if OPT_TCAP_FKEYS
mainMenu_tcap_fkeys,
#endif
#if OPT_HP_FUNC_KEYS
mainMenu_hp_fkeys,
#endif
#if OPT_SCO_FUNC_KEYS
mainMenu_sco_fkeys,
#endif
#if OPT_SUN_FUNC_KEYS
mainMenu_sun_fkeys,
#endif
#if OPT_SUNPC_KBD
mainMenu_sun_kbd,
#endif
mainMenu_line3,
mainMenu_suspend,
mainMenu_continue,
mainMenu_interrupt,
mainMenu_hangup,
mainMenu_terminate,
mainMenu_kill,
mainMenu_line4,
mainMenu_quit,
mainMenu_LAST
} mainMenuIndices;
/*
* items in vt100 mode menu
*/
typedef enum {
vtMenu_scrollbar,
vtMenu_jumpscroll,
vtMenu_reversevideo,
vtMenu_autowrap,
vtMenu_reversewrap,
vtMenu_autolinefeed,
vtMenu_appcursor,
vtMenu_appkeypad,
vtMenu_scrollkey,
vtMenu_scrollttyoutput,
vtMenu_allow132,
vtMenu_keepSelection,
vtMenu_selectToClipboard,
vtMenu_visualbell,
vtMenu_bellIsUrgent,
vtMenu_poponbell,
#if OPT_BLINK_CURS
vtMenu_cursorblink,
#endif
vtMenu_titeInhibit,
#ifndef NO_ACTIVE_ICON
vtMenu_activeicon,
#endif /* NO_ACTIVE_ICON */
vtMenu_line1,
vtMenu_softreset,
vtMenu_hardreset,
vtMenu_clearsavedlines,
vtMenu_line2,
#if OPT_TEK4014
vtMenu_tekshow,
vtMenu_tekmode,
vtMenu_vthide,
#endif
vtMenu_altscreen,
vtMenu_LAST
} vtMenuIndices;
/*
* items in vt100 font menu
*/
typedef enum {
fontMenu_default,
fontMenu_font1,
fontMenu_font2,
fontMenu_font3,
fontMenu_font4,
fontMenu_font5,
fontMenu_font6,
#define fontMenu_lastBuiltin fontMenu_font6
fontMenu_fontescape,
fontMenu_fontsel,
/* number of non-line items down to here should match NMENUFONTS in ptyx.h */
#if OPT_DEC_CHRSET || OPT_BOX_CHARS || OPT_DEC_SOFTFONT
fontMenu_line1,
fontMenu_allowBoldFonts,
#if OPT_BOX_CHARS
fontMenu_font_boxchars,
fontMenu_font_packedfont,
#endif
#if OPT_DEC_CHRSET
fontMenu_font_doublesize,
#endif
#if OPT_DEC_SOFTFONT
fontMenu_font_loadable,
#endif
#endif
#if OPT_RENDERFONT || OPT_WIDE_CHARS
fontMenu_line2,
#if OPT_RENDERFONT
fontMenu_render_font,
#endif
#if OPT_WIDE_CHARS
fontMenu_utf8_mode,
fontMenu_utf8_fonts,
fontMenu_utf8_title,
#endif
#endif
#if OPT_ALLOW_XXX_OPS
fontMenu_line3,
fontMenu_allowColorOps,
fontMenu_allowFontOps,
fontMenu_allowTcapOps,
fontMenu_allowTitleOps,
fontMenu_allowWindowOps,
#endif
fontMenu_LAST
} fontMenuIndices;
/*
* items in tek4014 mode menu
*/
#if OPT_TEK4014
typedef enum {
tekMenu_tektextlarge,
tekMenu_tektext2,
tekMenu_tektext3,
tekMenu_tektextsmall,
tekMenu_line1,
tekMenu_tekpage,
tekMenu_tekreset,
tekMenu_tekcopy,
tekMenu_line2,
tekMenu_vtshow,
tekMenu_vtmode,
tekMenu_tekhide,
tekMenu_LAST
} tekMenuIndices;
#endif
/*
* functions for updating menus
*/
extern void SetItemSensitivity(Widget mi, Bool val);
typedef enum {
toggleErr = -2,
toggleAll = -1,
toggleOff = 0,
toggleOn = 1
} ToggleEnum;
extern int decodeToggle(XtermWidget /* xw */, String * /* params */, Cardinal /* nparams */);
/*
* there should be one of each of the following for each checkable item
*/
#if OPT_TOOLBAR
extern void update_toolbar(void);
#else
#define update_toolbar() /* nothing */
#endif
#if OPT_MAXIMIZE
extern void update_fullscreen(void);
#else
#define update_fullscreen() /* nothing */
#endif
extern void update_securekbd(void);
extern void update_allowsends(void);
#ifdef ALLOWLOGGING
extern void update_logging(void);
#else
#define update_logging() /*nothing*/
#endif
#if OPT_PRINT_ON_EXIT
extern void update_write_error(void);
#else
#define update_write_error() /*nothing*/
#endif
extern void update_print_redir(void);
extern void update_8bit_control(void);
extern void update_decbkm(void);
#if OPT_NUM_LOCK
extern void update_num_lock(void);
extern void update_alt_esc(void);
extern void update_meta_esc(void);
#else
#define update_num_lock() /*nothing*/
#define update_alt_esc() /*nothing*/
#define update_meta_esc() /*nothing*/
#endif
extern void update_old_fkeys(void);
extern void update_delete_del(void);
#if OPT_SUNPC_KBD
extern void update_sun_kbd(void);
#endif
#if OPT_HP_FUNC_KEYS
extern void update_hp_fkeys(void);
#else
#define update_hp_fkeys() /*nothing*/
#endif
#if OPT_SCO_FUNC_KEYS
extern void update_sco_fkeys(void);
#else
#define update_sco_fkeys() /*nothing*/
#endif
#if OPT_SUN_FUNC_KEYS
extern void update_sun_fkeys(void);
#else
#define update_sun_fkeys() /*nothing*/
#endif
#if OPT_TCAP_FKEYS
extern void update_tcap_fkeys(void);
#else
#define update_tcap_fkeys() /*nothing*/
#endif
extern void update_scrollbar(void);
extern void update_jumpscroll(void);
extern void update_reversevideo(void);
extern void update_autowrap(void);
extern void update_reversewrap(void);
extern void update_autolinefeed(void);
extern void update_appcursor(void);
extern void update_appkeypad(void);
extern void update_scrollkey(void);
extern void update_keepSelection(void);
extern void update_selectToClipboard(void);
extern void update_scrollttyoutput(void);
extern void update_allow132(void);
extern void update_cursesemul(void);
extern void update_visualbell(void);
extern void update_bellIsUrgent(void);
extern void update_poponbell(void);
#define update_marginbell() /* nothing */
#if OPT_ALLOW_XXX_OPS
extern void update_menu_allowColorOps(void);
extern void update_menu_allowFontOps(void);
extern void update_menu_allowTcapOps(void);
extern void update_menu_allowTitleOps(void);
extern void update_menu_allowWindowOps(void);
#endif
#if OPT_BLINK_CURS
extern void update_cursorblink(void);
#else
#define update_cursorblink() /* nothing */
#endif
extern void update_altscreen(void);
extern void update_titeInhibit(void);
#ifndef NO_ACTIVE_ICON
extern void update_activeicon(void);
#endif /* NO_ACTIVE_ICON */
#if OPT_DEC_CHRSET
extern void update_font_doublesize(void);
#else
#define update_font_doublesize() /* nothing */
#endif
#if OPT_BOX_CHARS
extern void update_font_boxchars(void);
extern void update_font_packed(void);
#else
#define update_font_boxchars() /* nothing */
#define update_font_packed() /* nothing */
#endif
#if OPT_DEC_SOFTFONT
extern void update_font_loadable(void);
#else
#define update_font_loadable() /* nothing */
#endif
#if OPT_RENDERFONT
extern void update_font_renderfont(void);
#else
#define update_font_renderfont() /* nothing */
#endif
#if OPT_WIDE_CHARS
extern void update_font_utf8_mode(void);
extern void update_font_utf8_fonts(void);
extern void update_font_utf8_title(void);
#else
#define update_font_utf8_mode() /* nothing */
#define update_font_utf8_fonts() /* nothing */
#define update_font_utf8_title() /* nothing */
#endif
#if OPT_TEK4014
extern void update_tekshow(void);
extern void update_vttekmode(void);
extern void update_vtshow(void);
extern void set_vthide_sensitivity(void);
extern void set_tekhide_sensitivity(void);
#else
#define update_tekshow() /*nothing*/
#define update_vttekmode() /*nothing*/
#define update_vtshow() /*nothing*/
#define set_vthide_sensitivity() /*nothing*/
#define set_tekhide_sensitivity() /*nothing*/
#endif
#if OPT_DEC_CHRSET || OPT_BOX_CHARS || OPT_DEC_SOFTFONT
extern void update_menu_allowBoldFonts(void);
#else
#define update_menu_allowBoldFonts() /*nothing*/
#endif
/*
* macros for mapping font size to tekMenu placement
*/
#define FS2MI(n) (n) /* font_size_to_menu_item */
#define MI2FS(n) (n) /* menu_item_to_font_size */
#if OPT_TEK4014
extern void set_tekfont_menu_item(int n,int val);
#else
#define set_tekfont_menu_item(n,val) /*nothing*/
#endif
extern void set_menu_font(int val);
/* *INDENT-ON* */
#endif /* included_menu_h */