summaryrefslogtreecommitdiff
path: root/app/bin/command.h
blob: 073e412aa933e0b0e56a7403091ab64a829286f6 (plain)
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
/** \file command.h
 * Application wide declarations and defines
 */

/*  XTrkCad - Model Railroad CAD
 *  Copyright (C) 2005 Dave Bullis
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef COMMAND_H
#define COMMAND_H

#include "common.h"

#define IC_STICKY               (1<<0)
#define IC_INITNOTSTICKY        (1<<1)
#define IC_CANCEL               (1<<2)
#define IC_MENU                 (1<<3)
#define IC_NORESTART            (1<<4)
#define IC_SELECTED             (1<<5)
#define IC_POPUP                (1<<6)
#define IC_LCLICK               (1<<7)
#define IC_RCLICK               (1<<8)
#define IC_CMDMENU              (1<<9)
#define IC_POPUP2               (1<<10)
#define IC_ABUT                 (1<<11)
#define IC_ACCLKEY              (1<<12)
#define IC_MODETRAIN_TOO        (1<<13)
#define IC_MODETRAIN_ONLY       (1<<14)
#define IC_WANT_MOVE            (1<<15)
#define IC_PLAYBACK_PUSH        (1<<16)
#define IC_WANT_MODKEYS         (1<<17)
#define IC_POPUP3				(1<<18)


/*
 * Command Action
 */
#define C_DOWN			wActionLDown
#define C_MOVE			wActionLDrag
#define C_UP			wActionLUp
#define C_RDOWN			wActionRDown
#define C_RMOVE			wActionRDrag
#define C_RUP			wActionRUp
#define C_TEXT			wActionText
#define C_WUP			wActionWheelUp
#define C_WDOWN			wActionWheelDown
#define C_LDOUBLE       wActionLDownDouble
#define C_MODKEY        wActionModKey
#define C_SCROLLUP	    wActionScrollUp
#define C_SCROLLDOWN    wActionScrollDown
#define C_SCROLLLEFT	wActionScrollLeft
#define C_SCROLLRIGHT   wActionScrollRight
#define C_MDOWN 		wActionMDown
#define C_MMOVE		 	wActionMDrag
#define C_MUP			wActionMUp
#define C_INIT			(wActionLast+1)
#define C_START			(wActionLast+2)
#define C_REDRAW		(wActionLast+3)
#define C_CANCEL		(wActionLast+4)
#define C_OK			(wActionLast+5)
#define C_CONFIRM		(wActionLast+6)
#define C_LCLICK		(wActionLast+7)
#define C_RCLICK		(wActionLast+8)
#define C_CMDMENU		(wActionLast+9)
#define C_FINISH		(wActionLast+10)
#define C_UPDATE        (wActionLast+11)

#define C_CONTINUE		(100)
#define C_TERMINATE		(101)
#define C_INFO			(102)
#define C_ERROR			(103)

/*
 * Command Levels - obsolete
 */
#define LEVEL0			(0)
#define LEVEL0_50		(1)
#define LEVEL1			(2)
#define LEVEL2			(3)

/*
 * Command groups
 */
#define BG_SELECT		(0)
#define BG_ZOOM			(1)
#define BG_UNDO			(2)
#define BG_EASE			(3)
#define BG_TRKCRT		(4)
#define BG_TRKMOD		(5)
#define BG_TRKGRP		(6)
#define BG_MISCCRT		(7)
#define BG_RULER		(8)
#define BG_LAYER		(9)
#define BG_HOTBAR		(10)
#define BG_SNAP			(11)
#define BG_TRAIN		(12)
#define BG_COUNT		(13)
#define BG_FILE			(14)
#define BG_CONTROL		(15)
#define BG_EXPORTIMPORT (16)
#define BG_PRINT		(17)
#define BG_BIGGAP		(1<<8)
extern int cmdGroup;


extern int buttonCnt;
extern int commandCnt;
extern int cmdGroup;
extern long toolbarSet;
extern wWinPix_t toolbarHeight;
extern long preSelect;
extern long rightClickMode;
extern void * commandContext;
extern coOrd cmdMenuPos;

const char * GetCurCommandName( void );
void EnableCommands( void );
wIndex_t GetCurrentCommand(void);
void Reset( void );
wBool_t DoCurCommand( wAction_t, coOrd );
int ConfirmReset( BOOL_T );
void DoCommandB( void * );
void LayoutToolBar( void * );
BOOL_T CommandEnabled( wIndex_t );
#define NUM_CMDMENUS (4)
wIndex_t AddCommand(procCommand_t cmdProc, const char * helpKey,
                    const char * nameStr, wIcon_p icon, int reqLevel, long options, long acclKey,
                    wIndex_t buttInx, long stickyMask, wMenuPush_p cmdMenus[NUM_CMDMENUS],
                    void * context);
void AddToolbarControl( wControl_p, long );
void PlaybackButtonMouse( wIndex_t );
void PlaybackCommand( const char *, wIndex_t );
BOOL_T IsCurCommandSticky(void);
void ResetIfNotSticky( void );
void CommandInit( void );
#endif