Mercurial > hg > dmlib
annotate edmain.h @ 391:28a74940f2b6
More work on the editor.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 19 Oct 2012 04:30:24 +0300 |
parents | e5220ff48bc8 |
children | 5137db55f00b |
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" |
381 | 10 #define DOC_UNDO_MAX 15 |
11 | |
12 enum | |
13 { | |
14 CTRL_REWIND, | |
15 CTRL_PLAY_START, | |
16 CTRL_PLAY_CURRENT, | |
17 CTRL_PAUSE | |
18 }; | |
19 | |
20 #define CTRL_ICON_SIZE 32 | |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
21 |
379
05e85401480a
Rename eddemoobj to edtlobj, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
378
diff
changeset
|
22 #include "edtlobj.h" |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
381
diff
changeset
|
23 #include "edview.h" |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
381
diff
changeset
|
24 #include "edwaveform.h" |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
25 #include <QDebug> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
26 #include <QFile> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
27 #include <QApplication> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
28 #include <QMainWindow> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
29 #include <QTableView> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
30 #include <QAction> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
31 #include <QActionGroup> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
32 #include <QSlider> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
33 #include <QMessageBox> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 #include <QCheckBox> |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
381
diff
changeset
|
35 #include <QScrollBar> |
376
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 class DemoEditor : public QMainWindow |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
38 { |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
39 Q_OBJECT |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
40 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
41 public: |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
42 DemoEditor(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
43 ~DemoEditor(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
44 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
45 void settingsRestore(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
46 void settingsSave(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
47 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
48 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
49 private slots: |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
50 void actionFileNew(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
51 void actionFileOpen(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
52 void actionFileSave(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
53 void actionFileSaveAs(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
54 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
55 void actionAboutBox(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
56 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
57 //void actionCut(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
58 //void actionCopy(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
59 //void actionPaste(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
60 //void actionDelete(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
61 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
62 void performUndo(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
63 void performRedo(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
64 |
381 | 65 void actionControlChanged(QAction *); |
391 | 66 void actionTimelineScrollChanged(int); |
67 void actionOffsetChanged(float); | |
68 void actionTimeChanged(float); | |
381 | 69 |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
70 private: |
381 | 71 QTableView *effectTable; |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
72 QAction *menuActUndo, *menuActRedo, *menuActOpen, *menuActSave, *menuActSaveAs; |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
73 // QAction *menuActCut, *menuActCopy, *menuActPaste, *menuActDelete; |
381 | 74 QActionGroup *actGroupControls; |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
381
diff
changeset
|
75 QScrollBar *timelineScrollBar; |
391 | 76 WaveTrackView *timelineAudioTrack; |
77 GLDemoView *demoView; | |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
381
diff
changeset
|
78 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
381
diff
changeset
|
79 |
376
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 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
|
82 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
|
83 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
|
84 void setActionGroupChecked(QActionGroup *group, QVariant data); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
85 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
86 |
378 | 87 void showFileErrorDialog(QString operation, int code); |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
88 QMessageBox::StandardButton showDocumentModifiedDialog(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
89 void statusMsg(QString message); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
90 void closeEvent(QCloseEvent *event); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
91 void createMainGUI(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
92 void updateMenuStates(); |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
381
diff
changeset
|
93 void updateTimelineView(); |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
94 |
378 | 95 int initEffectsAndResources(); |
96 void shutdownEffectsAndResources(); | |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
97 int reopenResources(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
98 int loadResources(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
99 bool initializeVideo(); |
391 | 100 |
101 int getAudioTrackDuration(); | |
102 int getTimelineDuration(); | |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
103 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
104 void createNewFile(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
105 void readFromFile(QString filename); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
106 void saveToFile(QString filename); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
107 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
108 |
381 | 109 bool changed, initSDL; |
391 | 110 float currViewScale; |
111 int currViewOffset; | |
112 int currFrameTime; | |
113 | |
381 | 114 TimelineObject *tl; |
115 DMEngineData engine; | |
116 | |
378 | 117 QList<TimelineObject *> undoHistory; |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
118 int undoHistoryPos, undoHistoryMax; |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
119 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
120 void historyReset(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
121 void historyPush(QString description); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
122 void historyTop(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
123 void historyPop(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
124 }; |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
125 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
126 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
127 #endif // EDMAIN_H |