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
|
#ifndef __OBJECTS_OBJVIEW_COMMANDS_HH__
#define __OBJECTS_OBJVIEW_COMMANDS_HH__
#include "objview_stacktrace.hh"
#include "dwr/toggle.hh"
#include "dwr/vbox.hh"
#include "dwr/hbox.hh"
#include "dwr/label.hh"
namespace rtfl {
namespace objects {
class ObjViewGraph;
class OVGAttribute;
/*
* TODO: OVGCommand was originally introduced to provide a undo/redo mechanism
* needed for handling "obj-ident". Now, after "obj-ident" is handled by
* ObjIdentController, OVGCommand can be simplified and reduced to navigable
* commands.
*/
class OVGCommand: public lout::object::Object
{
public:
virtual const char *getFileName () = 0;
virtual int getLineNo () = 0;
virtual int getProcessId () = 0;
virtual void exec (ObjViewGraph *graph) = 0;
virtual void show (ObjViewGraph *graph) = 0;
virtual void hide (ObjViewGraph *graph) = 0;
virtual void scrollTo (ObjViewGraph *graph) = 0;
virtual void select (ObjViewGraph *graph) = 0;
virtual void unselect (ObjViewGraph *graph) = 0;
virtual bool isVisible (ObjViewGraph *graph) = 0;
virtual bool calcVisibility (ObjViewGraph *graph) = 0;
virtual int getNavigableCommandsIndex (ObjViewGraph *graph) = 0;
virtual void setNavigableCommandsIndex (ObjViewGraph *graph,
int navigableCommandsIndex) = 0;
virtual void setVisibleIndex (ObjViewGraph *graph,
int visibleIndex) = 0;
virtual ObjViewFunction *getFunction () = 0;
virtual void setRelatedCommand (OVGCommand *relatedCommand) = 0;
virtual OVGCommand *getRelatedCommand () = 0;
};
class OVGCommonCommand: public OVGCommand
{
private:
bool executed, visible;
ObjViewFunction *function;
OVGCommand *relatedCommand;
protected:
class CommandLinkReceiver: public ::dw::core::Layout::LinkReceiver
{
private:
ObjViewGraph *graph;
OVGCommand *command;
public:
inline CommandLinkReceiver () { graph = NULL; }
inline void setData (ObjViewGraph *graph,
OVGCommand *command)
{ this->graph = graph; this->command = command; }
bool click (::dw::core::Widget *widget, int link, int img, int x, int y,
::dw::core::EventButton *event);
};
char *id;
ObjViewGraph *graph;
virtual void doExec () = 0;
virtual void doShow ();
virtual void doHide ();
virtual void doScrollTo ();
virtual void doSelect ();
virtual void doUnselect ();
public:
OVGCommonCommand (ObjViewGraph *graph, const char *id,
ObjViewFunction *function);
~OVGCommonCommand ();
const char *getFileName ();
int getLineNo ();
int getProcessId ();
void exec (ObjViewGraph *graph);
void show (ObjViewGraph *graph);
void hide (ObjViewGraph *graph);
void scrollTo (ObjViewGraph *graph);
void select (ObjViewGraph *graph);
void unselect (ObjViewGraph *graph);
bool isVisible (ObjViewGraph *graph);
bool calcVisibility (ObjViewGraph *graph);
int getNavigableCommandsIndex (ObjViewGraph *graph);
void setNavigableCommandsIndex (ObjViewGraph *graph,
int navigableCommandsIndex);
void setVisibleIndex (ObjViewGraph *graph, int visibleIndex);
ObjViewFunction *getFunction () { return function; }
void setRelatedCommand (OVGCommand *relatedCommand)
{ this->relatedCommand = relatedCommand; }
OVGCommand *getRelatedCommand () { return relatedCommand; }
};
class OVGNavigableCommand: public OVGCommonCommand
{
private:
char *fileName;
int lineNo;
protected:
int navigableCommandsIndex;
dw::HBox *hbox;
dw::Label *label1, *label2;
CommandLinkReceiver linkReceiver;
void doShow ();
void doHide ();
void doScrollTo ();
void doSelect ();
void doUnselect ();
void initWidgets ();
void removeWidgets ();
public:
OVGNavigableCommand (const char *fileName, int lineNo, ObjViewGraph *graph,
const char *id, ObjViewFunction *function);
~OVGNavigableCommand ();
const char *getFileName ();
int getLineNo ();
int getNavigableCommandsIndex (ObjViewGraph *graph);
void setNavigableCommandsIndex (ObjViewGraph *graph,
int navigableCommandsIndex);
void setVisibleIndex (ObjViewGraph *graph, int visibleIndex);
};
class OVGIncIndentCommand: public OVGNavigableCommand
{
private:
bool success;
protected:
void doExec ();
public:
OVGIncIndentCommand (const char *fileName, int lineNo, ObjViewGraph *graph,
const char *id, ObjViewFunction *function);
~OVGIncIndentCommand ();
bool calcVisibility (ObjViewGraph *graph);
};
class OVGDecIndentCommand: public OVGNavigableCommand
{
private:
bool success;
protected:
void doExec ();
public:
OVGDecIndentCommand (const char *fileName, int lineNo, ObjViewGraph *graph,
const char *id, OVGIncIndentCommand *startCommand,
ObjViewFunction *function);
~OVGDecIndentCommand ();
bool calcVisibility (ObjViewGraph *graph);
};
class OVGEnterCommand: public OVGNavigableCommand, public ObjViewFunction
{
private:
char *aspect, *funname, *args;
int prio;
bool success;
protected:
void doExec ();
public:
OVGEnterCommand (const char *fileName, int lineNo, ObjViewGraph *graph,
const char *id, const char *aspect, int prio,
const char *funname, const char *args,
ObjViewFunction *function);
~OVGEnterCommand ();
bool calcVisibility (ObjViewGraph *graph);
char *createMessage (const char *c1, const char *c2, const char *c3a,
const char *c3b);
void freeMessage (char *message);
char *createName ();
void freeName (char *name);
int getColor ();
ObjViewFunction *getParent ();
bool isSelectable ();
void select ();
};
class OVGLeaveCommand: public OVGNavigableCommand
{
private:
OVGEnterCommand *enterCommand;
char *vals;
bool success;
protected:
void doExec ();
public:
OVGLeaveCommand (const char *fileName, int lineNo, ObjViewGraph *graph,
const char *id, const char *vals,
OVGEnterCommand *enterCommand);
~OVGLeaveCommand ();
bool calcVisibility (ObjViewGraph *graph);
};
class OVGAddMessageCommand: public OVGNavigableCommand
{
private:
char *aspect, *message;
int prio;
protected:
void doExec ();
public:
OVGAddMessageCommand (const char *fileName, int lineNo, ObjViewGraph *graph,
const char *id, const char *aspect, int prio,
const char *message, ObjViewFunction *function);
~OVGAddMessageCommand ();
bool calcVisibility (ObjViewGraph *graph);
};
class OVGAddMarkCommand: public OVGNavigableCommand
{
private:
char *aspect, *mark;
int prio;
protected:
void doExec ();
public:
OVGAddMarkCommand (const char *fileName, int lineNo, ObjViewGraph *graph,
const char *id, const char *aspect, int prio,
const char *mark, ObjViewFunction *function);
~OVGAddMarkCommand ();
bool calcVisibility (ObjViewGraph *graph);
const char *getMark () { return mark; }
bool isSelectable ();
void select ();
};
class OVGCreateCommand: public OVGNavigableCommand
{
private:
char *className;
protected:
void doExec ();
public:
OVGCreateCommand (const char *fileName, int lineNo, ObjViewGraph *graph,
const char *id, const char *className,
ObjViewFunction *function);
~OVGCreateCommand ();
bool calcVisibility (ObjViewGraph *graph);
};
class OVGAddAssocCommand: public OVGNavigableCommand
{
private:
char *id2;
protected:
void doExec ();
public:
OVGAddAssocCommand (const char *fileName, int lineNo, ObjViewGraph *graph,
const char *id1, const char *id2,
ObjViewFunction *function);
~OVGAddAssocCommand ();
bool calcVisibility (ObjViewGraph *graph);
};
class OVGAddAttrCommand: public OVGNavigableCommand
{
private:
char *name, *value;
dw::Label *smallLabel;
OVGAttribute *attribute;
int childNo;
protected:
void doExec ();
void doShow ();
void doHide ();
public:
OVGAddAttrCommand (const char *fileName, int lineNo, ObjViewGraph *graph,
const char *id, const char *name, const char *value,
ObjViewFunction *function);
~OVGAddAttrCommand ();
bool calcVisibility (ObjViewGraph *graph);
};
class OVGDeleteCommand: public OVGNavigableCommand
{
protected:
void doExec ();
public:
OVGDeleteCommand (const char *fileName, int lineNo, ObjViewGraph *graph,
const char *id, ObjViewFunction *function);
~OVGDeleteCommand ();
bool calcVisibility (ObjViewGraph *graph);
};
} // namespace objects
} // namespace rtfl
#endif // __OBJECTS_OBJVIEW_COMMANDS_HH__
|