annotate edmain.h @ 376:40e33ad0d153

Work towards a working editor .. some day.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 17 Oct 2012 02:27:55 +0300
parents
children feaeec4c6c55
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 #ifndef EDMAIN_H
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 #define EDMAIN_H
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 // Program name etc
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 #define PROGRAM_NAME "DMPE Editor"
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 #define PROGRAM_VERSION "0.1"
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 // Defaults
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 #define DOC_DEF_FILENAME "Untitled"
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 #define DOC_UNDO_MAX 30
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 #include "eddemoobj.h"
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 #include <QDebug>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 #include <QFile>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 #include <QApplication>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 #include <QMainWindow>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 #include <QTableView>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 #include <QAction>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 #include <QActionGroup>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 #include <QSlider>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 #include <QMessageBox>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 #include <QCheckBox>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 class DemoEditor : public QMainWindow
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 {
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 Q_OBJECT
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 public:
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 DemoEditor();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 ~DemoEditor();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 void settingsRestore();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 void settingsSave();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 private slots:
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 void actionFileNew();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 void actionFileOpen();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 void actionFileSave();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 void actionFileSaveAs();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 void actionAboutBox();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 //void actionCut();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 //void actionCopy();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 //void actionPaste();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 //void actionDelete();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 void performUndo();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 void performRedo();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 private:
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 bool changed, initSDL;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 DemoObject *demo;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 DMEngineData engine;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 QTableView *list;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 QAction *menuActUndo, *menuActRedo, *menuActOpen, *menuActSave, *menuActSaveAs;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 // QAction *menuActCut, *menuActCopy, *menuActPaste, *menuActDelete;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 QAction * createToolButton(QActionGroup *group, QString name, QIcon icon, QString statustip, QVariant data);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 QAction * createMenuAction(QString name, const QKeySequence &shortcut, QString tooltip);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 QAction * createMenuGroupAction(QMenu *, QActionGroup *, QString name, const QKeySequence &shortcut, QString tooltip, QVariant data);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 void setActionGroupChecked(QActionGroup *group, QVariant data);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 void showFileErrorDialog(QString operation, int code, QFile::FileError err);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 QMessageBox::StandardButton showDocumentModifiedDialog();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 void statusMsg(QString message);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 void closeEvent(QCloseEvent *event);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 void createMainGUI();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 void updateMenuStates();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 int reopenResources();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 int loadResources();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 bool initializeVideo();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 void rehashFile();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 void createNewFile();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 void readFromFile(QString filename);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 void saveToFile(QString filename);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 QList<DemoObject *> undoHistory;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 int undoHistoryPos, undoHistoryMax;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 void historyReset();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 void historyPush(QString description);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93 void historyTop();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 void historyPop();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 };
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 #endif // EDMAIN_H