Chris@0
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 Sonic Visualiser
|
Chris@0
|
5 An audio file viewer and annotation editor.
|
Chris@0
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@200
|
7 This file copyright 2006-2007 Chris Cannam and QMUL.
|
Chris@0
|
8
|
Chris@0
|
9 This program is free software; you can redistribute it and/or
|
Chris@0
|
10 modify it under the terms of the GNU General Public License as
|
Chris@0
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@0
|
12 License, or (at your option) any later version. See the file
|
Chris@0
|
13 COPYING included with this distribution for more information.
|
Chris@0
|
14 */
|
Chris@0
|
15
|
Chris@0
|
16 #ifndef _MAIN_WINDOW_H_
|
Chris@0
|
17 #define _MAIN_WINDOW_H_
|
Chris@0
|
18
|
Chris@0
|
19 #include <QFrame>
|
Chris@0
|
20 #include <QString>
|
Chris@85
|
21 #include <QUrl>
|
Chris@0
|
22 #include <QPointer>
|
Chris@0
|
23
|
Chris@203
|
24 #include "document/MainWindowBase.h"
|
Chris@0
|
25 #include "base/Command.h"
|
Chris@1
|
26 #include "view/ViewManager.h"
|
Chris@0
|
27 #include "base/PropertyContainer.h"
|
Chris@34
|
28 #include "base/RecentFiles.h"
|
Chris@0
|
29 #include "layer/LayerFactory.h"
|
Chris@203
|
30 #include "plugin/transform/Transform.h"
|
Chris@1
|
31 #include "document/SVFileReader.h"
|
Chris@88
|
32 #include "data/fileio/FileFinder.h"
|
Chris@198
|
33 #include "data/fileio/FileSource.h"
|
Chris@0
|
34 #include <map>
|
Chris@0
|
35
|
Chris@0
|
36 class Document;
|
Chris@0
|
37 class PaneStack;
|
Chris@0
|
38 class Pane;
|
Chris@0
|
39 class View;
|
Chris@0
|
40 class Fader;
|
Chris@65
|
41 class Overview;
|
Chris@0
|
42 class Layer;
|
Chris@0
|
43 class WaveformLayer;
|
Chris@0
|
44 class WaveFileModel;
|
Chris@0
|
45 class AudioCallbackPlaySource;
|
Chris@0
|
46 class AudioCallbackPlayTarget;
|
Chris@0
|
47 class CommandHistory;
|
Chris@0
|
48 class QMenu;
|
Chris@0
|
49 class AudioDial;
|
Chris@0
|
50 class QLabel;
|
Chris@16
|
51 class QCheckBox;
|
Chris@0
|
52 class PreferencesDialog;
|
Chris@177
|
53 class QTreeView;
|
Chris@26
|
54 class QPushButton;
|
Chris@69
|
55 class OSCQueue;
|
Chris@69
|
56 class OSCMessage;
|
Chris@162
|
57 class KeyReference;
|
Chris@189
|
58 class Labeller;
|
Chris@0
|
59
|
Chris@0
|
60
|
Chris@200
|
61 class MainWindow : public MainWindowBase
|
Chris@0
|
62 {
|
Chris@0
|
63 Q_OBJECT
|
Chris@0
|
64
|
Chris@0
|
65 public:
|
Chris@70
|
66 MainWindow(bool withAudioOutput = true,
|
Chris@70
|
67 bool withOSCSupport = true);
|
Chris@0
|
68 virtual ~MainWindow();
|
Chris@0
|
69
|
Chris@0
|
70 signals:
|
Chris@0
|
71
|
Chris@118
|
72 public slots:
|
Chris@200
|
73 virtual void preferenceChanged(PropertyContainer::PropertyName);
|
Chris@200
|
74 virtual bool commitData(bool mayAskUser);
|
Chris@118
|
75
|
Chris@0
|
76 protected slots:
|
Chris@200
|
77 virtual void openSession();
|
Chris@200
|
78 virtual void importAudio();
|
Chris@200
|
79 virtual void importMoreAudio();
|
Chris@200
|
80 virtual void openSomething();
|
Chris@200
|
81 virtual void openLocation();
|
Chris@200
|
82 virtual void openRecentFile();
|
Chris@200
|
83 virtual void exportAudio();
|
Chris@200
|
84 virtual void importLayer();
|
Chris@200
|
85 virtual void exportLayer();
|
Chris@200
|
86 virtual void exportImage();
|
Chris@200
|
87 virtual void saveSession();
|
Chris@200
|
88 virtual void saveSessionAs();
|
Chris@200
|
89 virtual void newSession();
|
Chris@200
|
90 virtual void closeSession();
|
Chris@200
|
91 virtual void preferences();
|
Chris@0
|
92
|
Chris@200
|
93 virtual void sampleRateMismatch(size_t, size_t, bool);
|
Chris@200
|
94 virtual void audioOverloadPluginDisabled();
|
Chris@0
|
95
|
Chris@200
|
96 virtual void toolNavigateSelected();
|
Chris@200
|
97 virtual void toolSelectSelected();
|
Chris@200
|
98 virtual void toolEditSelected();
|
Chris@200
|
99 virtual void toolDrawSelected();
|
Chris@200
|
100 virtual void toolMeasureSelected();
|
Chris@7
|
101
|
Chris@200
|
102 virtual void documentModified();
|
Chris@200
|
103 virtual void documentRestored();
|
Chris@0
|
104
|
Chris@200
|
105 virtual void updateMenuStates();
|
Chris@200
|
106 virtual void updateDescriptionLabel();
|
Chris@0
|
107
|
Chris@200
|
108 virtual void setInstantsNumbering();
|
Chris@200
|
109 virtual void setInstantsCounterCycle();
|
Chris@200
|
110 virtual void resetInstantsCounters();
|
Chris@0
|
111
|
Chris@200
|
112 virtual void modelGenerationFailed(QString);
|
Chris@200
|
113 virtual void modelRegenerationFailed(QString, QString);
|
Chris@0
|
114
|
Chris@200
|
115 virtual void rightButtonMenuRequested(Pane *, QPoint point);
|
Chris@0
|
116
|
Chris@200
|
117 virtual void addPane();
|
Chris@200
|
118 virtual void addLayer();
|
Chris@200
|
119 virtual void renameCurrentLayer();
|
Chris@0
|
120
|
Chris@200
|
121 virtual void paneAdded(Pane *);
|
Chris@200
|
122 virtual void paneHidden(Pane *);
|
Chris@200
|
123 virtual void paneAboutToBeDeleted(Pane *);
|
Chris@200
|
124 virtual void paneDropAccepted(Pane *, QStringList);
|
Chris@200
|
125 virtual void paneDropAccepted(Pane *, QString);
|
Chris@0
|
126
|
Chris@200
|
127 virtual void setupRecentFilesMenu();
|
Chris@200
|
128 virtual void setupRecentTransformsMenu();
|
Chris@0
|
129
|
Chris@200
|
130 virtual void playSpeedChanged(int);
|
Chris@200
|
131 virtual void playSharpenToggled();
|
Chris@200
|
132 virtual void playMonoToggled();
|
Chris@0
|
133
|
Chris@200
|
134 virtual void speedUpPlayback();
|
Chris@200
|
135 virtual void slowDownPlayback();
|
Chris@200
|
136 virtual void restoreNormalPlayback();
|
Chris@0
|
137
|
Chris@200
|
138 virtual void outputLevelsChanged(float, float);
|
Chris@0
|
139
|
Chris@200
|
140 virtual void layerRemoved(Layer *);
|
Chris@200
|
141 virtual void layerInAView(Layer *, bool);
|
Chris@0
|
142
|
Chris@200
|
143 virtual void mainModelChanged(WaveFileModel *);
|
Chris@200
|
144 virtual void modelAdded(Model *);
|
Chris@0
|
145
|
Chris@200
|
146 virtual void showLayerTree();
|
Chris@0
|
147
|
Chris@200
|
148 virtual void mouseEnteredWidget();
|
Chris@200
|
149 virtual void mouseLeftWidget();
|
Chris@73
|
150
|
Chris@200
|
151 virtual void handleOSCMessage(const OSCMessage &);
|
Chris@193
|
152
|
Chris@200
|
153 virtual void website();
|
Chris@200
|
154 virtual void help();
|
Chris@200
|
155 virtual void about();
|
Chris@200
|
156 virtual void keyReference();
|
Chris@0
|
157
|
Chris@0
|
158 protected:
|
Chris@65
|
159 Overview *m_overview;
|
Chris@0
|
160 Fader *m_fader;
|
Chris@0
|
161 AudioDial *m_playSpeed;
|
Chris@26
|
162 QPushButton *m_playSharpen;
|
Chris@26
|
163 QPushButton *m_playMono;
|
Chris@0
|
164 WaveformLayer *m_panLayer;
|
Chris@34
|
165
|
Chris@0
|
166 bool m_mainMenusCreated;
|
Chris@0
|
167 QMenu *m_paneMenu;
|
Chris@0
|
168 QMenu *m_layerMenu;
|
Chris@34
|
169 QMenu *m_transformsMenu;
|
Chris@155
|
170 QMenu *m_playbackMenu;
|
Chris@0
|
171 QMenu *m_existingLayersMenu;
|
Chris@95
|
172 QMenu *m_sliceMenu;
|
Chris@0
|
173 QMenu *m_recentFilesMenu;
|
Chris@34
|
174 QMenu *m_recentTransformsMenu;
|
Chris@0
|
175 QMenu *m_rightButtonMenu;
|
Chris@0
|
176 QMenu *m_rightButtonLayerMenu;
|
Chris@34
|
177 QMenu *m_rightButtonTransformsMenu;
|
Chris@155
|
178 QMenu *m_rightButtonPlaybackMenu;
|
Chris@155
|
179
|
Chris@164
|
180 QAction *m_deleteSelectedAction;
|
Chris@155
|
181 QAction *m_ffwdAction;
|
Chris@155
|
182 QAction *m_rwdAction;
|
Chris@0
|
183
|
Chris@0
|
184 QPointer<PreferencesDialog> m_preferencesDialog;
|
Chris@177
|
185 QPointer<QTreeView> m_layerTreeView;
|
Chris@0
|
186
|
Chris@162
|
187 KeyReference *m_keyReference;
|
Chris@162
|
188
|
Chris@0
|
189 struct PaneConfiguration {
|
Chris@0
|
190 PaneConfiguration(LayerFactory::LayerType _layer
|
Chris@0
|
191 = LayerFactory::TimeRuler,
|
Chris@66
|
192 Model *_source = 0,
|
Chris@0
|
193 int _channel = -1) :
|
Chris@66
|
194 layer(_layer), sourceModel(_source), channel(_channel) { }
|
Chris@0
|
195 LayerFactory::LayerType layer;
|
Chris@66
|
196 Model *sourceModel;
|
Chris@0
|
197 int channel;
|
Chris@0
|
198 };
|
Chris@0
|
199
|
Chris@0
|
200 typedef std::map<QAction *, PaneConfiguration> PaneActionMap;
|
Chris@0
|
201 PaneActionMap m_paneActions;
|
Chris@0
|
202
|
Chris@107
|
203 typedef std::map<QAction *, TransformId> TransformActionMap;
|
Chris@34
|
204 TransformActionMap m_transformActions;
|
Chris@34
|
205
|
Chris@107
|
206 typedef std::map<TransformId, QAction *> TransformActionReverseMap;
|
Chris@34
|
207 TransformActionReverseMap m_transformActionsReverse;
|
Chris@0
|
208
|
Chris@0
|
209 typedef std::map<QAction *, LayerFactory::LayerType> LayerActionMap;
|
Chris@0
|
210 LayerActionMap m_layerActions;
|
Chris@0
|
211
|
Chris@0
|
212 typedef std::map<QAction *, Layer *> ExistingLayerActionMap;
|
Chris@0
|
213 ExistingLayerActionMap m_existingLayerActions;
|
Chris@95
|
214 ExistingLayerActionMap m_sliceActions;
|
Chris@0
|
215
|
Chris@0
|
216 typedef std::map<ViewManager::ToolMode, QAction *> ToolActionMap;
|
Chris@0
|
217 ToolActionMap m_toolActions;
|
Chris@0
|
218
|
Chris@189
|
219 typedef std::map<QAction *, int> NumberingActionMap;
|
Chris@189
|
220 NumberingActionMap m_numberingActions;
|
Chris@189
|
221
|
Chris@200
|
222 virtual void setupMenus();
|
Chris@200
|
223 virtual void setupFileMenu();
|
Chris@200
|
224 virtual void setupEditMenu();
|
Chris@200
|
225 virtual void setupViewMenu();
|
Chris@200
|
226 virtual void setupPaneAndLayerMenus();
|
Chris@200
|
227 virtual void setupTransformsMenu();
|
Chris@200
|
228 virtual void setupHelpMenu();
|
Chris@200
|
229 virtual void setupExistingLayersMenus();
|
Chris@200
|
230 virtual void setupToolbars();
|
Chris@66
|
231
|
Chris@200
|
232 virtual void addPane(const PaneConfiguration &configuration, QString text);
|
Chris@0
|
233
|
Chris@0
|
234 virtual void closeEvent(QCloseEvent *e);
|
Chris@200
|
235 virtual bool checkSaveModified();
|
Chris@200
|
236
|
Chris@200
|
237 virtual void updateVisibleRangeDisplay(Pane *p) const;
|
Chris@0
|
238 };
|
Chris@0
|
239
|
Chris@0
|
240
|
Chris@0
|
241 #endif
|