-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmainwindow.h
316 lines (268 loc) · 9.25 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
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QFileSystemModel>
#include <QFileDialog>
#include <QMessageBox>
#include <QTime>
#include <QProcess>
#include <QTextStream>
#include <QElapsedTimer>
#include <QSettings>
#include <QTimer>
#include <QFileSystemWatcher>
#include <QInputDialog>
#include <QDesktopServices>
#include <QSpinBox>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QMimeData>
#include "tab.h"
#include "highlighter.h"
#include "common.h"
#include "settingswindow.h"
#include "about.h"
#include "tfiledirective.h"
#include "tdiskdirective.h"
#include "ideiconprovider.h"
#include "bookmarkwidget.h"
#include "choosetopic.h"
#include "qhexedit2/qhexedit.h"
#include "hexsearchdialog.h"
#include "cartconv.h"
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
class QAbstractItemModel;
class QCompleter;
class CodeEditor;
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
public slots:
void changeCurrentSavedState(bool changed);
void changeCode();
void selectionChangeCode();
void showContextMenu();
void SetCursorPos();
void showFind();
void showAllChars();
void find(const QString &pattern, Qt::CaseSensitivity cs, bool all, bool replace,
const QString &replaceText = nullptr);
void RunInEmulator();
void Compress();
void OpenWithDirMaster();
void PlayWithSIDPlayer();
void CreateD64Image();
void RemoveFileOrFolder();
void Rename();
void OpenWithHexEditor();
void SetAssemblyFile();
void ConvertToCrt();
void OpenCode();
void OpenHome();
void OpenHelp();
void removeBookmark();
void removeAllBookmark();
void editBookmark();
void bookmarkClicked(const QModelIndex &index);
void bookmarksChangedSlot(quint64 lineNumber, QString text, bool isAdded);
void updateLineNumberSlot(quint64 currentLine, int delta);
void memoryViewerCurrentAddressChanged(int);
void memoryViewerCurrentCoordinateChanged(int x, int y);
void ReceiveLineForCompleter(QString line);
private slots:
void on_tvWorkspaceFiles_doubleClicked(const QModelIndex &index);
void on_tvWorkspaceFiles_clicked(const QModelIndex &index);
void on_actionOpen_triggered();
void on_actionNew_triggered();
void on_actionClose_triggered();
void on_tabWidget_tabCloseRequested(int index);
void on_actionSave_triggered();
void on_actionSelect_Workspace_triggered();
void on_actionSave_as_triggered();
void on_actionClose_All_triggered();
void on_actionSaveAll_triggered();
void on_actionExit_triggered();
void on_actionBuild_this_triggered();
void on_bFindClose_clicked();
void on_tabWidget_currentChanged(int index);
void on_tFind_textChanged(const QString &arg1);
void on_bFindNext_clicked();
void on_bFindAll_clicked();
void on_bReplace_clicked();
void on_bReplaceAll_clicked();
void on_actionSettings_triggered();
void on_actionAbout_triggered();
void on_actionBuild_and_Run_triggered();
void on_actionBuild_as_binary_triggered();
void on_tvWorkspaceFiles_customContextMenuRequested(const QPoint &pos);
void on_actionDebugger_triggered();
void on_actionCloseAllButThis_triggered();
void fileChanged(const QString &path);
void hexfileChanged(const QString &path);
void on_brHome_anchorClicked(const QUrl &arg1);
void on_bDescription_clicked();
void on_bIllegal_clicked();
void on_bStandard_clicked();
void on_actionGenerate_File_Directive_triggered();
void on_actionGenerate_Disk_Directive_triggered();
void on_listOpenDocuments_itemSelectionChanged();
void on_actionKick_Assembler_Web_Manual_triggered();
void on_actionInsert_BASIC_SYS_Line_triggered();
void on_actionPuts_A_Breakpoint_triggered();
void on_b65C02opcodes_clicked();
void on_bAssemblerDirectives_clicked();
void on_bPreprocessorDirectives_clicked();
void on_bValueTypes_clicked();
void on_actionWelcome_triggered();
void on_actionCode_triggered();
void on_actionClear_Output_triggered();
void on_tFind_returnPressed();
void on_tIssues_cellDoubleClicked(int row, int column);
void on_bStandardMacros_clicked();
void on_sbMemoryViewer_valueChanged(int addressPerLine);
void on_horizontalSlider_valueChanged(int value);
void on_actionReport_An_Issue_triggered();
// hex editor slots
void dataChanged();
void setOverwriteMode(bool mode);
void bytesperlineValueChanged(int value);
void hexFileFindReplace();
void hexFileRedo();
void hexFileUndo();
void hexFileSaveas();
void hexFileSave();
void hexFileOpen();
void hexNewFile();
void hexFileSaveselection();
void on_actionSet_Assembly_File_For_Current_Tab_triggered();
void on_actionCartridge_Conversion_Utility_triggered();
void on_actionIDE_65XX_Home_Page_triggered();
private:
Ui::MainWindow *ui;
QFileSystemModel *m_ptrModelForTree;
QAction *findAction;
QAction *showAllCharsAction;
QToolBar *leftToolBar;
QString filePath; // selected file on workspace
QModelIndex selectedIndex;
QString workspacePath;
// settings
QSettings settings;
void writeSettings();
void readSettings();
void readSettingsOptionsOnly();
SettingsWindow *settingsWin;
CartConv *cc;
QFileSystemWatcher *watcher;
QFileSystemWatcher *hexwatcher;
IdeIconProvider *icProvider;
bool firstOpening;
QIcon tabicon;
void closeFile(int index);
void saveFile(int index = -1);
QString saveAsFile(int index = -1, QString caption = "Save file");
void setCurrentTabName(const QString &filePath, int index);
void openFileFromPath(QString filenamePath);
void openWorkspace(QString wDir);
void closeAll();
void setTopToolbar(int index=-1);
void printOutput(const QString & message, const QColor &color);
void printOutputWithTime(const QString & message, const QColor &color);
bool build(bool afterbuildthenrun = false , bool binary = false);
// paths
QString pJRE;
QString pKickAssJar;
QString pEmulator;
QString pEmulatorParameters;
QString pCompressionUtility;
QString pCompressionParameters;
QString pSIDPlayer;
QString pSIDPlayerParameters;
QString pCartconv;
QString pDirMaster;
QString pC1541;
QString pDebugger;
QString pAssemblyFile;
QString asmNotSelected = "[ Assembly file not selected ]";
bool pOpenLastUsedFiles;
int pMaxRecentWorkspace;
int pTabSize;
int pTabPolicy;
QString pCodeFontName;
int pCodeFontSize;
bool pWordWrap;
bool pShowAllChars;
bool pAutoCompletion;
int pZoom;
bool bWelcome;
QStringList opendocuments;
void RefreshOpenDocuments();
BookmarkWidget *bookmarks;
QSettings bookmarkcfgfile;
QHexEdit *hexEdit;
QLabel *hexFilename;
// QSpinBox *bytesPerLine;
// QCheckBox *hexInsert;
QAction *hRedo;
QAction *hUndo;
QAction *hSave;
QAction *hSaveas;
QAction *hSaveselection;
void hexActionEnable();
void saveHexFile(QString &hfilename, bool saveSelection=false);
void loadHexFile();
QString curHexFilename;
HexSearchDialog *hexSearchDialog;
QProcess p;
void ExecuteAppWithFile(QString pApplication, QString additionalArgs="");
QMenu *fileContextMenu;
QAction *menuDirmaster;
QAction *menuExomizer;
QAction *menuEmulator;
QAction *menuC1541;
QAction *menuDelete;
QAction *menuRename;
QAction *menuSidPlayer;
QAction *menuHexEditor;
QAction *menuAssemblyFile;
QAction *menuCartConv;
QAbstractItemModel *modelFromFile(const QString& fileName);
QCompleter *completer = nullptr;
QAction *menuHome;
QAction *menuCode;
QLabel *spacerTop, *spacerBottom, *spacerMiddle; //vertical spacer for left toolbar
QLabel *statusCurPosInfo;
//QByteArray dockState;
void HideDocks();
void RestoreDocks();
void UpdateRecentWorkspaces();
void RemoveFromRecentWorkspace(QString wspc);
void AddRecentWorkspace(QString wspc);
void setActionsEnable(bool value);
void setActionsEnableForDoc(bool value);
void insertCode(QString code, QTextCursor::MoveOperation operation = QTextCursor::Start);
// issues
void clearIssues();
void grabIssues(QString currentLine, QTextStream &tStr);
void addIssue(QString issue, QString filename, QString line);
void grabMemoryView(QString currentLine, QTextStream &tStr);
int lastMemoryViewX = -1;
int lastMemoryViewY = -1;
bool sbMemoryViewerValueNotChanged = true;
void prepareBeforeOpen(QString filename);
void saveUserCompleter();
protected:
void closeEvent(QCloseEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
bool eventFilter(QObject *obj, QEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) override;
void dropEvent(QDropEvent *event) override;
};
#endif // MAINWINDOW_H