1 /*
2 * xtrojka (c) 1994,1995,1996 Maarten Los
3 *
4 * #include "COPYRIGHT"
5 *
6 * created: 27.xi.1995
7 * modified:
8 *
9 * This is action handler
10 */
11
12 #include <X11/Intrinsic.h>
13 #include <X11/StringDefs.h>
14
15 #include "actions.h"
16
17 #include "xtrojka.h"
18 #include "debug.h"
19
20 extern void quit_appl_action();
21 extern void gameover_action();
22 extern void new_game();
23 extern void toggle_wizard();
24 extern void toggle_slick();
25
26 extern Widget form;
27
28 extern XtAppContext app_context;
29
30
31 /*
32 * actions
33 */
34 XtActionsRec std_actions[] =
35 {
36 { "aQuitgame", (XtActionProc)quit_appl_action },
37 { "aAbort", (XtActionProc)gameover_action },
38 { "aNew", (XtActionProc)new_game },
39 { "aTogglewizard", (XtActionProc)toggle_wizard },
40 { "aToggleslick", (XtActionProc)toggle_slick }
41 };
42
43
44 /*
45 * translations to activate the actions
46 * support both Alt- and Ctrl- key combinations
47 */
48 static String std_trans =
49 "Alt<Key>X: aQuitgame()\n\
50 Alt<Key>Q: aQuitgame()\n\
51 Alt<Key>A: aAbort()\n\
52 Alt<Key>N: aNew()\n\
53 Alt<Key>W: aTogglewizard()\n\
54 Alt<Key>S: aToggleslick()\n\
55 Ctrl<Key>X: aQuitgame()\n\
56 Ctrl<Key>Q: aQuitgame()\n\
57 Ctrl<Key>A: aAbort()\n\
58 Ctrl<Key>N: aNew()\n\
59 Ctrl<Key>W: aTogglewizard()\n\
60 Ctrl<Key>S: aToggleslick()";
61
62 /*
63 * functions
64 */
init_actions(void)65 void init_actions(void)
66 {
67 DEBUG("actions.c","init_actions")
68
69 XtAppAddActions(app_context, std_actions, XtNumber(std_actions));
70
71 XtOverrideTranslations(form,
72 XtParseTranslationTable(std_trans));
73 }
74
75