Mercurial > hg > dmlib
annotate edmain.h @ 400:f44a89a25c97
Fix waveform display from going over buffer limit.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 19 Oct 2012 15:56:59 +0300 |
parents | 9993873ff655 |
children | 2fdf440ea66a |
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" |
393
5137db55f00b
More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents:
391
diff
changeset
|
25 #include "edtimeline.h" |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
26 #include <QDebug> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
27 #include <QFile> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
28 #include <QApplication> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
29 #include <QMainWindow> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
30 #include <QTableView> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
31 #include <QAction> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
32 #include <QActionGroup> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
33 #include <QSlider> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 #include <QMessageBox> |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
35 #include <QCheckBox> |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
381
diff
changeset
|
36 #include <QScrollBar> |
376
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 class DemoEditor : public QMainWindow |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
39 { |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
40 Q_OBJECT |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
41 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
42 public: |
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 ~DemoEditor(); |
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 settingsRestore(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
47 void settingsSave(); |
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 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
50 private slots: |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
51 void actionFileNew(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
52 void actionFileOpen(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
53 void actionFileSave(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
54 void actionFileSaveAs(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
55 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
56 void actionAboutBox(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
57 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
58 //void actionCut(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
59 //void actionCopy(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
60 //void actionPaste(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
61 //void actionDelete(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
62 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
63 void performUndo(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
64 void performRedo(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
65 |
381 | 66 void actionControlChanged(QAction *); |
391 | 67 void actionTimelineScrollChanged(int); |
68 void actionOffsetChanged(float); | |
69 void actionTimeChanged(float); | |
397 | 70 void actionTimelineChanged(); |
381 | 71 |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
72 private: |
381 | 73 QTableView *effectTable; |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
74 QAction *menuActUndo, *menuActRedo, *menuActOpen, *menuActSave, *menuActSaveAs; |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
75 // QAction *menuActCut, *menuActCopy, *menuActPaste, *menuActDelete; |
381 | 76 QActionGroup *actGroupControls; |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
381
diff
changeset
|
77 QScrollBar *timelineScrollBar; |
393
5137db55f00b
More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents:
391
diff
changeset
|
78 QWaveTrackView *timelineAudioTrack; |
5137db55f00b
More work towards the editor ..
Matti Hamalainen <ccr@tnsp.org>
parents:
391
diff
changeset
|
79 QTimelineView *timelineView; |
391 | 80 GLDemoView *demoView; |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
381
diff
changeset
|
81 |
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
381
diff
changeset
|
82 |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
83 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
84 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
|
85 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
|
86 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
|
87 void setActionGroupChecked(QActionGroup *group, QVariant data); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
88 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
89 |
378 | 90 void showFileErrorDialog(QString operation, int code); |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
91 QMessageBox::StandardButton showDocumentModifiedDialog(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
92 void statusMsg(QString message); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
93 void closeEvent(QCloseEvent *event); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
94 void createMainGUI(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
95 void updateMenuStates(); |
384
e5220ff48bc8
Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents:
381
diff
changeset
|
96 void updateTimelineView(); |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
97 |
378 | 98 int initEffectsAndResources(); |
99 void shutdownEffectsAndResources(); | |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
100 int reopenResources(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
101 int loadResources(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
102 bool initializeVideo(); |
391 | 103 int getTimelineDuration(); |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
104 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
105 void createNewFile(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
106 void readFromFile(QString filename); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
107 void saveToFile(QString filename); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
108 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
109 |
381 | 110 bool changed, initSDL; |
391 | 111 float currViewScale; |
112 int currViewOffset; | |
113 int currFrameTime; | |
114 | |
397 | 115 TimelineObject *currTimeline; |
381 | 116 DMEngineData engine; |
117 | |
378 | 118 QList<TimelineObject *> undoHistory; |
376
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
119 int undoHistoryPos, undoHistoryMax; |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
120 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
121 void historyReset(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
122 void historyPush(QString description); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
123 void historyTop(); |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
124 void historyPop(); |
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 |
40e33ad0d153
Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
128 #endif // EDMAIN_H |