-
Notifications
You must be signed in to change notification settings - Fork 0
/
editor.h
212 lines (188 loc) · 4.98 KB
/
editor.h
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
#ifndef _EDITOR_H_
#define _EDITOR_H_
/*
** -- Qt Classes --
*/
class QPopupMenu;
class list_objects;
class rename_window;
template<class> class QPtrList;
template<class> class QValueList;
/*
** -- Qt Includes --
*/
#include <qtimer.h>
#include <qcanvas.h>
#include <qcursor.h>
/*
** -- Local Includes --
*/
#include <gate.h>
#include <loop.h>
#include <task.h>
#include <wire.h>
#include <break.h>
#include <return.h>
#include <constant.h>
#include <continue.h>
#include <function.h>
#include <variable.h>
#include <dragobject.h>
#include <file_class.h>
#include <subroutine.h>
#include <list_objects.h>
#include <qtnqc_limits.h>
#include <tools_window.h>
#include <rename_window.h>
class editor: public QCanvasView
{
Q_OBJECT
public:
static const int MOVE_UP = 1;
static const int MOVE_DOWN = 2;
static const int MOVE_LEFT = 3;
static const int MOVE_RIGHT = 4;
static const int MAX_WIDTH = 2048;
static const int MAX_HEIGHT = 2048;
editor(const bool, QCanvas *, const int, QWidget *,
QWidget *, const char * = 0,
WFlags = 0);
~editor();
bool isMainEditor(void);
bool collisionDetected(object *, const QPoint &);
void clear(void);
void cleanup(void);
void enlarge(void);
void setMain(const bool);
void drawGate(const int, const int, const int, const int = -1);
void drawLoop(const int, const int, const int, QPtrList<file_class> *,
const int = -1, const QString & = "",
const int = 0, const int = 0);
void drawTask(const int, const int, const int, QPtrList<file_class> *,
const int = -1, const QString & = "",
const int = 0, const int = 0);
void drawSubroutine(const int, const int, const int, QPtrList<file_class> *,
const int = -1, const QString & = "",
const int = 0, const int = 0);
void readFile(QFile &);
void scrollTo(const int, const int);
void drawBreak(const int, const int, const int = -1);
void drawGeneric(const file_class *, QPtrList<file_class> *);
void writeToFile(QTextStream &, QString &);
void drawReturn(const int, const int, const int = -1);
void drawConstant(const int, const int, const int, const int = -1,
const int = 0);
void drawContinue(const int, const int, const int = -1);
void drawFunction(const int, const int, const int,
const int = 0, const int = 0);
void drawVariable(const int, const int, const int, const bool, const int,
const QString &);
void updateLister(void);
void createChildren(QPtrList<file_class> *);
void deleteSelection(const int, const int);
void updateFuncSubmenu(void);
void updateTaskSubmenu(void);
void updateSubroutineSubmenu(void);
void updateVariableNamesList(const QString &);
QPtrList<gate> *getGates(void)
{
return gates;
};
QPtrList<break_obj> *getBreaks(void)
{
return breaks;
};
QPtrList<continue_obj> *getContinues(void)
{
return continues;
};
QPtrList<return_obj> *getReturns(void)
{
return returns;
};
QPtrList<loop> *getLoops(void)
{
return loops;
};
QPtrList<task> *getTasks(void)
{
return tasks;
};
QPtrList<subroutine> *getSubroutines(void)
{
return subroutines;
};
QPtrList<constant> *getConstants(void)
{
return constants;
};
QPtrList<function> *getFunctions(void)
{
return functions;
};
QPtrList<variable> *getVariables(void)
{
return variables;
};
private:
int parent_id;
int copied_item_type;
int selected_item_type;
bool is_main_editor;
object *copied_item;
object *selected_item;
QPoint last_pos;
QPoint moving_start;
QTimer *sel_timer;
QWidget *dialog_parent;
QPtrList<gate> *gates;
QPtrList<loop> *loops;
QPtrList<task> *tasks;
QPtrList<wire> *wires;
QPtrList<subroutine> *subroutines;
QPtrList<constant> *constants;
QPtrList<function> *functions;
QPtrList<variable> *variables;
QPtrList<break_obj> *breaks;
QPtrList<file_class> fc_list;
QPtrList<return_obj> *returns;
QPtrList<continue_obj> *continues;
dragobject *drag;
QLineEdit *condition;
QPopupMenu *editmenu;
QPopupMenu *func_submenu;
QPopupMenu *task_submenu;
QPopupMenu *subroutine_submenu;
QValueList<QString> used_variable_names;
list_objects *lister;
rename_window *rw;
QCanvasRectangle *selection;
bool askAboutDelete(void);
protected:
void dropEvent(QDropEvent *);
void dragMoveEvent(QDragMoveEvent *);
void keyPressEvent(QKeyEvent *);
void mouseMoveEvent(QMouseEvent *);
void dragEnterEvent(QDragEnterEvent *);
void mousePressEvent(QMouseEvent *);
void contentsMousePressEvent(QMouseEvent *);
signals:
void status(const QString &);
private slots:
void slotEdit(void);
void setGlobal(void);
void slotDelete(void);
void slotRename(void);
void slotAddTask(void);
void slotAddSubroutine(void);
void slotListAll(void);
void slotShowHelp(void);
void slotShowMain(void);
void slotShowFuncs(void);
void slotShowTools(void);
void slotCopyObject(void);
void slotAddFunction(void);
void slotPasteObject(void);
void slotSelTimerTimeout(void);
};
#endif