File: actions.c

package info (click to toggle)
xtrojka 123-16
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 492 kB
  • ctags: 443
  • sloc: ansic: 3,087; makefile: 133; sh: 19
file content (74 lines) | stat: -rw-r--r-- 1,439 bytes parent folder | download | duplicates (4)
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
/*
 *	xtrojka (c) 1994,1995,1996 Maarten Los
 *
 *	#include "COPYRIGHT"
 *
 *	created:	27.xi.1995
 *	modified:
 *
 *	This is action handler
 */

#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>

#include "actions.h"

#include "xtrojka.h"
#include "debug.h"

extern void quit_appl_action();
extern void gameover_action();
extern void new_game();
extern void toggle_wizard();
extern void toggle_slick();

extern Widget form;

extern XtAppContext app_context;


/*
 * 	actions
 */
XtActionsRec std_actions[] =
{
	{ "aQuitgame", (XtActionProc)quit_appl_action },
	{ "aAbort", (XtActionProc)gameover_action },
	{ "aNew", (XtActionProc)new_game },
	{ "aTogglewizard", (XtActionProc)toggle_wizard },
	{ "aToggleslick", (XtActionProc)toggle_slick }
};


/*
 * 	translations to activate the actions
 *	support both Alt- and Ctrl- key combinations
 */
static String std_trans =
	"Alt<Key>X:	aQuitgame()\n\
	 Alt<Key>Q:	aQuitgame()\n\
	 Alt<Key>A:	aAbort()\n\
	 Alt<Key>N:	aNew()\n\
	 Alt<Key>W:	aTogglewizard()\n\
	 Alt<Key>S:	aToggleslick()\n\
	 Ctrl<Key>X:	aQuitgame()\n\
	 Ctrl<Key>Q:	aQuitgame()\n\
	 Ctrl<Key>A:	aAbort()\n\
	 Ctrl<Key>N:	aNew()\n\
	 Ctrl<Key>W:	aTogglewizard()\n\
	 Ctrl<Key>S:	aToggleslick()";

/* 
 *	functions
 */
void init_actions(void)
{
	DEBUG("actions.c","init_actions")

	XtAppAddActions(app_context, std_actions, XtNumber(std_actions));

	XtOverrideTranslations(form, 
			XtParseTranslationTable(std_trans));
}