| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
асть SASM. |
| 23 |
|
| 24 |
ерераспространять ее и/или |
| 25 |
ественной лицензии GNU в том виде, |
| 26 |
бодного программного обеспечения; |
| 27 |
у выбору) любой более поздней |
| 28 |
ии. |
| 29 |
|
| 30 |
что она будет полезной, |
| 31 |
явной гарантии ТОВАРНОГО ВИДА |
| 32 |
ЕЙ. Подробнее см. в Стандартной |
| 33 |
ицензии GNU. |
| 34 |
|
| 35 |
ртной общественной лицензии GNU |
| 36 |
Если это не так, см. |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
#ifndef MAINWINDOW_H |
| 42 |
#define MAINWINDOW_H |
| 43 |
|
| 44 |
#include <QMainWindow> |
| 45 |
#include <QStackedWidget> |
| 46 |
#include <QTextBrowser> |
| 47 |
#include <QTimer> |
| 48 |
#include <QElapsedTimer> |
| 49 |
#include <QMenuBar> |
| 50 |
#include <QMessageBox> |
| 51 |
#include <QFileDialog> |
| 52 |
#include <QTime> |
| 53 |
#include <QPointer> |
| 54 |
#include <QColorDialog> |
| 55 |
#include <QSignalMapper> |
| 56 |
#include <QMap> |
| 57 |
#include <QSplitter> |
| 58 |
#include <QToolBar> |
| 59 |
#include <QMutex> |
| 60 |
#include <QDragEnterEvent> |
| 61 |
#include <QMimeData> |
| 62 |
#include "tab.h" |
| 63 |
#include "highlighter.h" |
| 64 |
#include "debugger.h" |
| 65 |
#include "finddialog.h" |
| 66 |
#include "ruqtextedit.h" |
| 67 |
#include "getstartedwidget.h" |
| 68 |
#include "ui_settings.h" |
| 69 |
#include "debugtablewidget.h" |
| 70 |
#include "debuganycommandwidget.h" |
| 71 |
#include "assembler.h" |
| 72 |
#include "nasm.h" |
| 73 |
#include "gas.h" |
| 74 |
#include "common.h" |
| 75 |
#include "fasm.h" |
| 76 |
#include "signallocker.h" |
| 77 |
#include "masm.h" |
| 78 |
|
| 79 |
#define SASM_VERSION "3.15.0" |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
class MainWindow : public QMainWindow |
| 91 |
{ |
| 92 |
Q_OBJECT |
| 93 |
|
| 94 |
public: |
| 95 |
MainWindow(const QStringList & args, QWidget *parent = 0); |
| 96 |
~MainWindow(); |
| 97 |
|
| 98 |
void initUi(); |
| 99 |
void createMenus(); |
| 100 |
void createActions(); |
| 101 |
void createButtons(); |
| 102 |
void createToolBars(); |
| 103 |
void writeSettings(); |
| 104 |
void setupEditor(int i); |
| 105 |
bool okToContinue(int index = -1); |
| 106 |
void setTabPath(const QString &filePath, int index = -1); |
| 107 |
bool removeDirRecuresively(const QString &dirName); |
| 108 |
|
| 109 |
private: |
| 110 |
|
| 111 |
GetStartedWidget *getStartedWidget; |
| 112 |
QStackedWidget *mainWidget; |
| 113 |
QSplitter *splitter; |
| 114 |
QVBoxLayout *workLayout; |
| 115 |
QWidget *workWidget; |
| 116 |
RuQTextEdit *compilerOut; |
| 117 |
QTabWidget *tabs; |
| 118 |
|
| 119 |
|
| 120 |
QMenu *fileMenu; |
| 121 |
QMenu *editMenu; |
| 122 |
QMenu *debugMenu; |
| 123 |
QMenu *buildMenu; |
| 124 |
QMenu *settingsMenu; |
| 125 |
QMenu *helpMenu; |
| 126 |
QAction *newAction; |
| 127 |
QAction *openAction; |
| 128 |
QAction *closeAction; |
| 129 |
QAction *saveAction; |
| 130 |
QAction *saveAsAction; |
| 131 |
QAction *saveExeAction; |
| 132 |
QAction *exitAction; |
| 133 |
QAction *findAction; |
| 134 |
QAction *commentAction; |
| 135 |
QAction *uncommentAction; |
| 136 |
QAction *undoAction; |
| 137 |
QAction *redoAction; |
| 138 |
QAction *cutAction; |
| 139 |
QAction *copyAction; |
| 140 |
QAction *pasteAction; |
| 141 |
QAction *deleteAction; |
| 142 |
QAction *selectAllAction; |
| 143 |
QAction *putTabAction; |
| 144 |
QAction *deleteTabAction; |
| 145 |
QAction *buildAction; |
| 146 |
QAction *runAction; |
| 147 |
QAction *runExeAction; |
| 148 |
QAction *stopAction; |
| 149 |
QAction *debugAction; |
| 150 |
QAction *debugNextAction; |
| 151 |
QAction *debugNextNiAction; |
| 152 |
QAction *debugToggleBreakpointAction; |
| 153 |
QAction *debugShowRegistersAction; |
| 154 |
QAction *debugShowMemoryAction; |
| 155 |
QAction *settingsAction; |
| 156 |
QAction *helpAction; |
| 157 |
QAction *aboutAction; |
| 158 |
|
| 159 |
|
| 160 |
QToolBar *fileToolBar; |
| 161 |
QToolBar *editToolBar; |
| 162 |
QToolBar *buildToolBar; |
| 163 |
QToolBar *debugToolBar; |
| 164 |
|
| 165 |
|
| 166 |
QProcess *runProcess; |
| 167 |
CodeEditor *prevCodeEditor; |
| 168 |
QTimer *timer; |
| 169 |
QElapsedTimer programExecutionTime; |
| 170 |
Debugger *debugger; |
| 171 |
bool programIsBuilded; |
| 172 |
QPointer<DebugTableWidget> registersWindow; |
| 173 |
QDockWidget *registersDock; |
| 174 |
QPointer<DebugTableWidget> memoryWindow; |
| 175 |
QDockWidget *memoryDock; |
| 176 |
QList<RuQPlainTextEdit::Watch> watches; |
| 177 |
DebugAnyCommandWidget *debugAnyCommandWidget; |
| 178 |
bool programStopped; |
| 179 |
int outputIndex; |
| 180 |
Assembler *assembler; |
| 181 |
bool debuggerWasStarted; |
| 182 |
QString debugKey; |
| 183 |
|
| 184 |
|
| 185 |
Highlighter *highlighter; |
| 186 |
Highlighter *settingsHighlighter; |
| 187 |
|
| 188 |
|
| 189 |
QPointer<FindDialog> findDialog; |
| 190 |
Qt::CaseSensitivity prevCs; |
| 191 |
|
| 192 |
|
| 193 |
QPointer<QWidget> settingsWindow; |
| 194 |
Ui::SettingsWindow settingsUi; |
| 195 |
QString startText; |
| 196 |
CodeEditor *settingsStartTextEditor; |
| 197 |
|
| 198 |
QString saveOpenDirectory; |
| 199 |
QPointer<QTextBrowser> help; |
| 200 |
QSignalMapper *colorSignalMapper; |
| 201 |
QSignalMapper *fontsSignalMapper; |
| 202 |
QList<QPushButton *> colorButtons; |
| 203 |
|
| 204 |
QList<QColor> defaultColors; |
| 205 |
QMap<QString, QColor> colorsMap; |
| 206 |
QList<QCheckBox *> fontCheckBoxes; |
| 207 |
QSettings settings; |
| 208 |
QString backupAssembler; |
| 209 |
QString backupMode; |
| 210 |
QString backupAssemblerOptions; |
| 211 |
QString backupLinkerOptions; |
| 212 |
QString backupObjectFileName; |
| 213 |
bool backupDisableLinking; |
| 214 |
bool backupCurrentDir; |
| 215 |
QString backupAssemblerPath; |
| 216 |
QString backupStartText; |
| 217 |
QString backupLinkerPath; |
| 218 |
|
| 219 |
|
| 220 |
bool closeFromCloseAll; |
| 221 |
void closeEvent(QCloseEvent *e); |
| 222 |
|
| 223 |
public slots: |
| 224 |
|
| 225 |
void newFile(); |
| 226 |
void openFile(); |
| 227 |
void closeFile(); |
| 228 |
bool saveFile(int index = -1, bool openSaveAs = true); |
| 229 |
bool saveAsFile(int index = -1); |
| 230 |
void saveExe(); |
| 231 |
bool closeApp(); |
| 232 |
void refreshEditMenu(); |
| 233 |
void changeCurrentSavedState(bool changed); |
| 234 |
void openFile(QString path); |
| 235 |
|
| 236 |
|
| 237 |
void buildProgram(bool debugMode = false); |
| 238 |
void runProgram(); |
| 239 |
void runExeProgram(); |
| 240 |
void stopProgram(); |
| 241 |
void testStopOfProgram(); |
| 242 |
void setProgramBuildedFlagToFalse(); |
| 243 |
void changeCurrentTab(int index); |
| 244 |
void printLog(const QString & message, const QColor &color); |
| 245 |
void printLogWithTime(const QString & message, const QColor &color); |
| 246 |
void startCountProgramTime(); |
| 247 |
|
| 248 |
|
| 249 |
void debug(); |
| 250 |
void enableDebugActions(); |
| 251 |
void disableDebugActions(bool start = false); |
| 252 |
void debugNext(); |
| 253 |
void debugNextNi(); |
| 254 |
void debugExit(); |
| 255 |
void debugToggleBreakpoint(); |
| 256 |
void debugShowRegisters(); |
| 257 |
void debugShowMemory(); |
| 258 |
void debugRunCommand(QString command, bool print); |
| 259 |
void saveWatches(DebugTableWidget *table); |
| 260 |
void setShowRegistersToUnchecked(); |
| 261 |
void setShowMemoryToUnchecked(); |
| 262 |
void setShowMemoryToChecked(const RuQPlainTextEdit::Watch &variable); |
| 263 |
void showAnyCommandWidget(); |
| 264 |
void closeAnyCommandWidget(); |
| 265 |
void printOutput(QString msg, int index = -1); |
| 266 |
void getOutput(); |
| 267 |
void changeDebugActionToStart(); |
| 268 |
|
| 269 |
|
| 270 |
void find(); |
| 271 |
void findNext(const QString &pattern, Qt::CaseSensitivity cs, bool all, bool replace, |
| 272 |
const QString &replaceText = 0); |
| 273 |
void findNextAfterTextChange(); |
| 274 |
|
| 275 |
|
| 276 |
void restorePrevSession(bool notNotify = false); |
| 277 |
void openSettings(); |
| 278 |
void initColorButtons(bool dark, bool ignoreSettings); |
| 279 |
void changeColorButtonsLight(); |
| 280 |
void changeColorButtonsDark(); |
| 281 |
void changeMode(bool x86); |
| 282 |
void changeAssembler(); |
| 283 |
void changeStartText(); |
| 284 |
void saveSettings(); |
| 285 |
void exitSettings(); |
| 286 |
void changeActionsState(int widgetIndex); |
| 287 |
void resetAllSettings(); |
| 288 |
void pickColor(QWidget *colorButton, bool init = false, bool ignoreSettings = false); |
| 289 |
void changeHighlightingFont(QWidget *box, bool init = false); |
| 290 |
void changeHighlightingLineMode(int mode); |
| 291 |
void recreateHighlighter(); |
| 292 |
void recreateAssembler(bool start = false); |
| 293 |
void initAssemblerSettings(bool firstOpening); |
| 294 |
void backupSettings(); |
| 295 |
void restoreSettingsAndExit(); |
| 296 |
void printMasmInfo(); |
| 297 |
void enableOrDisableLinkingEdit(int disableLinkingCheckboxState); |
| 298 |
|
| 299 |
|
| 300 |
bool deleteTab(int index, bool saveFileName = false); |
| 301 |
void closeAllChildWindows(); |
| 302 |
|
| 303 |
|
| 304 |
void openHelp(); |
| 305 |
void openAbout(); |
| 306 |
|
| 307 |
|
| 308 |
void onMessageReceived(const QString &message); |
| 309 |
|
| 310 |
protected: |
| 311 |
void dragEnterEvent(QDragEnterEvent *event); |
| 312 |
|
| 313 |
void dropEvent(QDropEvent *event); |
| 314 |
}; |
| 315 |
|
| 316 |
#endif |