]> Dogcows Code - chaz/thecheat/blob - CheatDocument.h
update contact information and project URL
[chaz/thecheat] / CheatDocument.h
1
2 /*
3 * The Cheat - The legendary universal game trainer for Mac OS X.
4 * http://www.brokenzipper.com/trac/wiki/TheCheat
5 *
6 * Copyright (c) 2003-2011, Charles McGarvey et al.
7 *
8 * Distributable under the terms and conditions of the 2-clause BSD
9 * license; see the file COPYING for the legal text of the license.
10 */
11
12 #import <Cocoa/Cocoa.h>
13 #import "ChazLog.h"
14 #include "cheat_global.h"
15
16 #import "VariableTable.h"
17 #import "FadeView.h"
18 #import "MenuExtras.h"
19 #import "StatusTextField.h"
20
21 #import "CheatData.h"
22 #import "SearchData.h"
23
24 #import "LocalCheater.h"
25 #import "RemoteCheater.h"
26 #import "Variable.h"
27
28 #import "AppController.h"
29
30
31 typedef unsigned TCDocumentMode;
32 enum {
33 TCSearchMode = 0,
34 TCCheatMode = 1
35 };
36
37
38 typedef unsigned TCDocumentStatus;
39 enum {
40 TCIdleStatus = 0,
41 TCSearchingStatus = 1,
42 TCCheatingStatus = 2,
43 TCDumpingStatus = 3
44 };
45
46
47 @interface CheatDocument : NSDocument
48 {
49 // WINDOW INTERFACE
50 IBOutlet NSWindow *ibWindow;
51 IBOutlet NSPopUpButton *ibServerPopup;
52 IBOutlet NSPopUpButton *ibProcessPopup;
53 IBOutlet NSView *ibPlaceView;
54 IBOutlet StatusTextField *ibStatusText;
55 IBOutlet NSProgressIndicator *ibStatusBar;
56
57 // SEARCH MODE INTERFACE
58 IBOutlet NSView *ibSearchContentView;
59 IBOutlet NSPopUpButton *ibSearchTypePopup;
60 IBOutlet NSMatrix *ibSearchIntegerSignMatrix;
61 IBOutlet NSPopUpButton *ibSearchOperatorPopup;
62 IBOutlet NSMatrix *ibSearchValueUsedMatrix;
63 IBOutlet NSTextField *ibSearchValueField;
64 IBOutlet VariableTable *ibSearchVariableTable;
65 IBOutlet NSButton *ibSearchClearButton;
66 IBOutlet NSButton *ibSearchButton;
67 IBOutlet NSButton *ibSearchVariableButton;
68
69 // CHEAT MODE INTERFACE
70 IBOutlet NSView *ibCheatContentView;
71 IBOutlet NSTextField *ibCheatInfoText;
72 IBOutlet BetterTableView *ibCheatVariableTable;
73 IBOutlet NSButton *ibCheatRepeatButton;
74 IBOutlet NSTextField *ibCheatRepeatAuxText;
75 IBOutlet NSTextField *ibCheatRepeatField;
76 IBOutlet NSButton *ibCheatButton;
77
78 // PROPERTIES INTERFACE
79 IBOutlet NSWindow *ibPropertiesSheet;
80 IBOutlet NSTextField *ibWindowTitleField;
81 IBOutlet NSTextField *ibCheatInfoField;
82
83 // PASSWORD INTERFACE
84 IBOutlet NSWindow *ibPasswordSheet;
85 IBOutlet NSTextField *ibPasswordField;
86
87 // CUSTOM SERVER INTERFACE
88 IBOutlet NSWindow *ibCustomServerSheet;
89 IBOutlet NSTextField *ibServerField;
90 IBOutlet NSTextField *ibPortField;
91
92 // EDIT VARIABLES INTERFACE
93 IBOutlet NSWindow *ibEditVariablesSheet;
94 IBOutlet NSTextField *ibNewValueField;
95
96 NSResponder *_lastResponder;
97
98 // ### IMPORTANT STUFF ###
99 BOOL _connectsOnOpen; // set whether connects automatically on open
100 TCDocumentMode _mode; // 'search' or 'cheat' mode
101 FadeView *_fadeView; // facilitates the fade animation
102
103 TCDocumentStatus _status; // what the user is doing
104 BOOL _isCancelingTask; // is what the user doing being cancelled
105 BOOL _isTargetPaused; // is the currently selected process paused
106
107 id _serverObject; // the object represented by the current server
108 Process *_process; // the currently selected process
109
110 CheatData *_cheatData; // container for the document data
111 SearchData *_searchData; // container for the search data
112
113 Cheater *_cheater; // the local or remote object to handle the cheating
114
115 // rendezvous support
116 NSNetService *_resolvingService;
117 }
118
119 // #############################################################################
120 #pragma mark Service Finding
121 // #############################################################################
122
123 + (NSArray *)cheatServices;
124
125 // #############################################################################
126 #pragma mark Changing Mode
127 // #############################################################################
128
129 // used to set the mode before the nib is loaded.
130 // do not use after that.
131 - (void)setMode:(TCDocumentMode)mode;
132
133 // use this after the nib is loaded.
134 - (void)switchToCheatMode;
135 - (void)switchToSearchMode;
136
137 // #############################################################################
138 #pragma mark Accessors
139 // #############################################################################
140
141 - (NSString *)defaultStatusString;
142 - (BOOL)isLoadedFromFile;
143
144 - (void)addServer:(NSMenuItem *)item;
145 - (void)removeServerWithObject:(id)serverObject;
146
147 // #############################################################################
148 #pragma mark Interface
149 // #############################################################################
150
151 - (void)updateInterface;
152 - (void)setDocumentChanged;
153
154 - (void)setActualResults:(unsigned)count;
155
156 // #############################################################################
157 #pragma mark Utility
158 // #############################################################################
159
160 + (void)setGlobalTarget:(Process *)target;
161 + (Process *)globalTarget;
162
163 - (void)showError:(NSString *)error;
164
165 // this doesn't update the interface
166 // so explicitly call updateInterface after use.
167 - (BOOL)shouldConnectWithServer:(NSMenuItem *)item;
168 - (void)selectConnectedCheater;
169 - (void)connectWithServer:(NSMenuItem *)item;
170 - (void)disconnectFromCheater;
171
172 - (void)setConnectOnOpen:(BOOL)flag;
173 - (void)connectWithURL:(NSString *)url;
174
175 - (void)watchVariables;
176
177
178 @end
179
180
181 // #############################################################################
182
183 @interface CheatDocument ( DocInterfaceActions )
184
185 - (IBAction)ibSetLocalCheater:(id)sender;
186 - (IBAction)ibSetRemoteCheater:(id)sender;
187 - (IBAction)ibSetCustomCheater:(id)sender;
188 - (IBAction)ibSetNoCheater:(id)sender;
189
190 - (IBAction)ibSetProcess:(id)sender;
191
192 - (IBAction)ibSetVariableType:(id)sender;
193 - (IBAction)ibSetIntegerSign:(id)sender;
194 - (IBAction)ibSetOperator:(id)sender;
195 - (IBAction)ibSetValueUsed:(id)sender;
196
197 - (IBAction)ibClearSearch:(id)sender;
198 - (IBAction)ibSearch:(id)sender;
199 - (IBAction)ibAddSearchVariable:(id)sender;
200
201 - (IBAction)ibSetCheatRepeats:(id)sender;
202 - (IBAction)ibSetRepeatInterval:(id)sender;
203 - (IBAction)ibCheat:(id)sender;
204
205 - (IBAction)ibRunPropertiesSheet:(id)sender;
206 - (IBAction)ibEndPropertiesSheet:(id)sender;
207
208 - (IBAction)ibRunPasswordSheet:(id)sender;
209 - (IBAction)ibEndPasswordSheet:(id)sender;
210
211 - (IBAction)ibRunCustomServerSheet:(id)sender;
212 - (IBAction)ibEndCustomServerSheet:(id)sender;
213
214 - (IBAction)ibRunEditVariablesSheet:(id)sender;
215 - (IBAction)ibEndEditVariablesSheet:(id)sender;
216
217 - (IBAction)ibPauseTarget:(id)sender;
218 - (IBAction)ibResumeTarget:(id)sender;
219
220 - (IBAction)ibCancelSearch:(id)sender;
221 - (IBAction)ibStopCheat:(id)sender;
222
223 - (IBAction)ibDumpMemory:(id)sender;
224 - (IBAction)ibCancelDump:(id)sender;
225
226 - (IBAction)ibAddCheatVariable:(id)sender;
227 - (IBAction)ibSetVariableEnabled:(id)sender;
228
229 - (IBAction)ibToggleSearchCheat:(id)sender;
230
231 - (IBAction)ibUndo:(id)sender;
232 - (IBAction)ibRedo:(id)sender;
233
234 @end
235
236
237 // #############################################################################
238
239 @interface CheatDocument ( DocCheaterDelegate ) < CheaterDelegate >
240
241 @end
242
This page took 0.041647 seconds and 4 git commands to generate.