-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmainwindow.h
244 lines (199 loc) · 7.09 KB
/
mainwindow.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
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
// File: mainwindow.h
/*
Pep8-1 is a virtual machine for writing machine language and assembly
language programs.
Copyright (C) 2009 J. Stanley Warford, Pepperdine University
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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "byteconverterdec.h"
#include "byteconverterhex.h"
#include "byteconverterbin.h"
#include "byteconverterchar.h"
#include "byteconverterinstr.h"
// Left pane
#include "sourcecodepane.h"
#include "objectcodepane.h"
#include "assemblerlistingpane.h"
#include "listingtracepane.h"
#include "memorytracepane.h"
// Middle pane
#include "cpupane.h"
#include "inputpane.h"
#include "outputpane.h"
#include "terminalpane.h"
// Right pane
#include "memorydumppane.h"
// Dialog boxes
#include "redefinemnemonicsdialog.h"
#include "helpdialog.h"
#include "aboutpep.h"
namespace Ui
{
class MainWindowClass;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
protected:
void closeEvent(QCloseEvent *event);
private:
Ui::MainWindowClass *ui;
// Left pane
SourceCodePane *sourceCodePane;
ObjectCodePane *objectCodePane;
AssemblerListingPane *assemblerListingPane;
ListingTracePane *listingTracePane;
MemoryTracePane *memoryTracePane;
// Middle pane
CpuPane *cpuPane;
InputPane *inputPane;
OutputPane *outputPane;
TerminalPane *terminalPane;
// Right pane
MemoryDumpPane *memoryDumpPane;
// Dialog boxes
RedefineMnemonicsDialog *redefineMnemonicsDialog;
HelpDialog *helpDialog;
AboutPep *aboutPepDialog;
// Byte converter
ByteConverterDec *byteConverterDec;
ByteConverterHex *byteConverterHex;
ByteConverterBin *byteConverterBin;
ByteConverterChar *byteConverterChar;
ByteConverterInstr *byteConverterInstr;
// Save methods
bool saveSource();
bool saveObject();
bool saveListing();
void readSettings();
void writeSettings();
bool maybeSaveSource();
bool maybeSaveObject();
void loadFile(const QString &fileName);
bool saveFileSource(const QString &fileName);
bool saveFileObject(const QString &fileName);
bool saveFileListing(const QString &fileName);
void setCurrentFile(const QString &fileName, Enu::EPane pane);
QString strippedName(const QString &fullFileName);
QString curSourceFile;
QString curObjectFile;
QString curListingFile;
QString curPath;
// Recent Files methods
void updateRecentFileActions();
enum { MaxRecentFiles = 5};
QAction *recentFileActs[MaxRecentFiles];
QAction *separatorAct;
bool assemble();
bool load();
void setDebugState(bool b);
bool eventFilter(QObject *, QEvent *event);
private slots:
// File
void on_actionFile_New_triggered();
void on_actionFile_Open_triggered();
bool on_actionFile_Save_Source_triggered();
bool on_actionFile_Save_Source_As_triggered();
bool on_actionFile_Save_Object_As_triggered();
bool on_actionFile_Save_Listing_As_triggered();
void on_actionFile_Print_Source_triggered();
void on_actionFile_Print_Object_triggered();
void on_actionFile_Print_Listing_triggered();
// Edit
void on_actionEdit_Undo_triggered();
void on_actionEdit_Redo_triggered();
void on_actionEdit_Cut_triggered();
void on_actionEdit_Copy_triggered();
void on_actionEdit_Paste_triggered();
void on_actionEdit_Format_From_Listing_triggered();
void on_actionEdit_Font_triggered();
void on_actionEdit_Remove_Error_Messages_triggered();
// Build
void on_actionBuild_Assemble_triggered();
void on_actionBuild_Load_triggered();
void on_actionBuild_Execute_triggered();
void on_actionBuild_Run_Source_triggered();
void on_actionBuild_Start_Debugging_Source_triggered();
void on_actionBuild_Run_Object_triggered();
void on_actionBuild_Start_Debugging_Object_triggered();
void on_actionBuild_Start_Debugging_Loader_triggered();
void on_actionBuild_Stop_Debugging_triggered();
void on_actionBuild_Interrupt_Execution_triggered();
// View
void on_actionView_Code_Only_triggered();
void on_actionView_Code_CPU_triggered();
void on_actionView_Code_CPU_Memory_triggered();
void on_actionView_Code_Tab_triggered();
void on_actionView_Trace_Tab_triggered();
void on_actionView_Batch_I_O_Tab_triggered();
void on_actionView_Terminal_Tab_triggered();
// System
void on_actionSystem_Clear_Memory_triggered();
void on_actionSystem_Redefine_Mnemonics_triggered();
void on_actionSystem_Assemble_Install_New_OS_triggered();
void on_actionSystem_Reinstall_Default_OS_triggered();
// Help
void on_actionHelp_triggered();
void on_actionHelp_Check_for_updates_triggered();
void on_actionHelp_Machine_Language_triggered();
void on_actionHelp_Assembly_Language_triggered();
void on_actionHelp_Debugging_Programs_triggered();
void on_actionHelp_Writing_Trap_Handlers_triggered();
void on_actionHelp_Pep_8_Reference_triggered();
void on_actionHelp_Examples_triggered();
void on_actionHelp_Pep_8_Operating_System_triggered();
void on_actionAbout_Pep8_triggered();
void on_actionAbout_Qt_triggered();
void helpCopyToSourceButtonClicked();
// Byte converter
void slotByteConverterDecEdited(const QString &);
void slotByteConverterHexEdited(const QString &);
void slotByteConverterBinEdited(const QString &);
void slotByteConverterCharEdited(const QString &);
// Focus coloring Undo/Redo/Cut/Copy/Paste activate/deactivate
void mainWindowUtilities(QWidget *, QWidget *);
void setUndoability(bool b);
void setRedoability(bool b);
void doubleClickedCodeLabel(Enu::EPane pane);
// void resizeDocWidth(int, int);
// For updating the CPU and Memory trace from listing trace pane
void updateSimulationView();
void vonNeumannStepped();
void appendOutput(QString str);
// Terminal IO:
void waitingForInput();
void inputReceived();
void resumeButtonClicked();
void singleStepButtonClicked();
// Recent files
void openRecentFile();
/*
These belong in the other panes
// Trace
void on_pepMemSingleStepPushButton_clicked();
void on_pepMemResumePushButton_clicked();
void pepResumePushButtonClicked();
// Memory pane
void on_pepMemRefreshPushButton_clicked();
// CPU stats
void slotSaveTraceProgram(int);
void slotSaveTraceTraps(int);
void slotSaveTraceLoader(int);
*/
};
#endif // MAINWINDOW_H