16 #ifndef SV_MAIN_WINDOW_BASE_H 17 #define SV_MAIN_WINDOW_BASE_H 22 #include <QMainWindow> 26 #include "base/Command.h" 27 #include "view/ViewManager.h" 28 #include "view/PaneStack.h" 29 #include "base/PropertyContainer.h" 30 #include "base/RecentFiles.h" 31 #include "base/FrameTimer.h" 32 #include "layer/LayerFactory.h" 33 #include "transform/Transform.h" 35 #include "data/fileio/FileFinder.h" 36 #include "data/fileio/FileSource.h" 37 #include "data/osc/OSCQueue.h" 38 #include "data/osc/OSCMessageCallback.h" 39 #include "data/model/Model.h" 52 class AudioCallbackPlaySource;
53 class TimeStretchWrapper;
54 class AudioCallbackRecordTarget;
59 class LevelPanToolButton;
62 class PreferencesDialog;
70 class ModelDataTableDialog;
74 class LayerGeometryProvider;
77 class SystemPlaybackTarget;
92 public OSCMessageCallback
113 AUDIO_PLAYBACK_AND_RECORD
129 PaneStack::Options paneStackOptions);
149 RecordCreateAdditionalModel
166 virtual bool saveSessionFile(QString path);
167 virtual bool saveSessionTemplate(QString path);
169 virtual bool exportLayerToSVL(Layer *layer,
170 QString toPath, QString &error);
172 virtual bool exportLayerToMIDI(Layer *layer,
173 MultiSelection *selectionsToWrite,
174 QString toPath, QString &error);
176 virtual bool exportLayerToRDF(Layer *layer,
177 QString toPath, QString &error);
179 virtual bool exportLayerToCSV(Layer *layer, LayerGeometryProvider *provider,
180 MultiSelection *selectionsToWrite,
182 DataExportOptions options,
183 QString toPath, QString &error);
187 virtual bool exportLayerTo(Layer *layer, LayerGeometryProvider *provider,
188 MultiSelection *selectionsToWrite,
189 QString toPath, QString &error);
191 void cueOSCScript(QString filename);
194 sv_frame_t getFrame()
const override;
197 m_defaultFfwdRwdStep = step;
201 m_audioRecordMode = mode;
206 void canAddPane(
bool);
207 void canDeleteCurrentPane(
bool);
208 void canAddLayer(
bool);
209 void canImportMoreAudio(
bool);
210 void canReplaceMainAudio(
bool);
211 void canImportLayer(
bool);
212 void canChangeSessionTemplate(
bool);
213 void canExportAudio(
bool);
214 void canExportLayer(
bool);
215 void canExportImage(
bool);
216 void canRenameLayer(
bool);
217 void canEditLayer(
bool);
218 void canEditLayerTabular(
bool);
219 void canMeasureLayer(
bool);
220 void canSelect(
bool);
221 void canClearSelection(
bool);
222 void canEditSelection(
bool);
223 void canDeleteSelection(
bool);
225 void canInsertInstant(
bool);
226 void canInsertInstantsAtBoundaries(
bool);
227 void canInsertItemAtSelection(
bool);
228 void canRenumberInstants(
bool);
229 void canSubdivideInstants(
bool);
230 void canWinnowInstants(
bool);
231 void canDeleteCurrentLayer(
bool);
233 void canScroll(
bool);
235 void canRecord(
bool);
237 void canRewind(
bool);
238 void canPlaySelection(
bool);
239 void canSpeedUpPlayback(
bool);
240 void canSlowDownPlayback(
bool);
241 void canChangePlaybackSpeed(
bool);
242 void canSelectPreviousPane(
bool);
243 void canSelectNextPane(
bool);
244 void canSelectPreviousLayer(
bool);
245 void canSelectNextLayer(
bool);
247 void canSaveAs(
bool);
249 void hideSplash(QWidget *);
250 void sessionLoaded();
251 void audioFileLoaded();
252 void replacedDocument();
253 void activity(QString);
256 virtual void preferenceChanged(PropertyContainer::PropertyName);
257 virtual void resizeConstrained(QSize);
258 virtual void recreateAudioIO();
261 virtual void zoomIn();
262 virtual void zoomOut();
263 virtual void zoomToFit();
264 virtual void zoomDefault();
265 virtual void scrollLeft();
266 virtual void scrollRight();
267 virtual void jumpLeft();
268 virtual void jumpRight();
269 virtual void peekLeft();
270 virtual void peekRight();
272 virtual void showNoOverlays();
273 virtual void showMinimalOverlays();
274 virtual void showAllOverlays();
276 virtual void toggleTimeRulers();
277 virtual void toggleZoomWheels();
278 virtual void togglePropertyBoxes();
279 virtual void toggleStatusBar();
280 virtual void toggleCentreLine();
284 virtual void ffwdEnd();
285 virtual void rewind();
286 virtual void rewindStart();
287 virtual void record();
290 virtual void ffwdSimilar();
291 virtual void rewindSimilar();
293 virtual void deleteCurrentPane();
294 virtual void deleteCurrentLayer();
295 virtual void editCurrentLayer();
297 virtual void previousPane();
298 virtual void nextPane();
299 virtual void previousLayer();
300 virtual void nextLayer();
302 virtual void playLoopToggled();
303 virtual void playSelectionToggled();
304 virtual void playSoloToggled();
306 virtual void audioChannelCountIncreased(
int count);
308 virtual void sampleRateMismatch(sv_samplerate_t, sv_samplerate_t,
bool) = 0;
309 virtual void audioOverloadPluginDisabled() = 0;
311 virtual void playbackFrameChanged(sv_frame_t);
312 virtual void globalCentreFrameChanged(sv_frame_t);
313 virtual void viewCentreFrameChanged(View *, sv_frame_t);
314 virtual void viewZoomLevelChanged(View *, ZoomLevel,
bool);
315 virtual void monitoringLevelsChanged(
float,
float) = 0;
316 virtual void recordDurationChanged(sv_frame_t, sv_samplerate_t);
318 virtual void currentPaneChanged(Pane *);
319 virtual void currentLayerChanged(Pane *, Layer *);
321 virtual void selectAll();
322 virtual void selectToStart();
323 virtual void selectToEnd();
324 virtual void selectVisible();
325 virtual void clearSelection();
329 virtual void paste();
330 virtual void pasteAtPlaybackPosition();
331 virtual void pasteRelative(sv_frame_t offset);
332 virtual void deleteSelected();
334 virtual void insertInstant();
335 virtual void insertInstantAt(sv_frame_t);
336 virtual void insertInstantsAtBoundaries();
337 virtual void insertItemAtSelection();
338 virtual void insertItemAt(sv_frame_t, sv_frame_t);
339 virtual void renumberInstants();
340 virtual void subdivideInstantsBy(
int);
341 virtual void winnowInstantsBy(
int);
343 virtual void documentModified();
344 virtual void documentRestored();
346 virtual void layerAdded(Layer *);
347 virtual void layerRemoved(Layer *);
348 virtual void layerAboutToBeDeleted(Layer *);
349 virtual void layerInAView(Layer *,
bool);
351 virtual void mainModelChanged(ModelId);
352 virtual void modelAdded(ModelId);
354 virtual void updateMenuStates();
355 virtual void updateDescriptionLabel() = 0;
356 virtual void updateWindowTitle();
358 virtual void modelGenerationFailed(QString, QString) = 0;
359 virtual void modelGenerationWarning(QString, QString) = 0;
360 virtual void modelRegenerationFailed(QString, QString, QString) = 0;
361 virtual void modelRegenerationWarning(QString, QString, QString) = 0;
363 virtual void alignmentComplete(ModelId);
364 virtual void alignmentFailed(ModelId, QString) = 0;
366 virtual void paneRightButtonMenuRequested(Pane *, QPoint point) = 0;
367 virtual void panePropertiesRightButtonMenuRequested(Pane *, QPoint point) = 0;
368 virtual void layerPropertiesRightButtonMenuRequested(Pane *, Layer *, QPoint point) = 0;
370 virtual void paneAdded(Pane *) = 0;
371 virtual void paneHidden(Pane *) = 0;
372 virtual void paneAboutToBeDeleted(Pane *) = 0;
373 virtual void paneDropAccepted(Pane *, QStringList) = 0;
374 virtual void paneDropAccepted(Pane *, QString) = 0;
375 virtual void paneDeleteButtonClicked(Pane *);
377 virtual void oscReady();
378 virtual void pollOSC();
379 virtual void oscScriptFinished();
381 virtual void contextHelpChanged(
const QString &);
382 virtual void inProgressSelectionChanged();
387 virtual void closeSession() = 0;
389 virtual void emitHideSplash();
393 virtual void menuActionMapperInvoked(QObject *);
424 QThread(mwb), m_mwb(mwb), m_withPort(withNetworkPort) { }
428 OSCQueue *queue =
new OSCQueue(m_withPort);
429 m_mwb->m_oscQueue = queue;
442 void startOSCQueue(
bool withNetworkPort);
443 void startOSCScript();
466 QLabel *getStatusLabel()
const;
468 ModelId getMainModelId()
const;
469 std::shared_ptr<WaveFileModel> getMainModel()
const;
470 void createDocument();
475 QString templateName,
476 bool registerSource);
478 sv_frame_t getModelsStartFrame()
const;
479 sv_frame_t getModelsEndFrame()
const;
481 Pane *addPaneToStack();
482 Layer *getSnapLayer()
const;
491 void removeLayerEditDialog(Layer *);
497 Pane *
addPane()
override {
return m_mw->addPaneToStack(); }
499 m_mw->resizeConstrained(QSize(width, height));
502 m_mw->m_viewManager->addSelectionQuietly(Selection(start, end));
514 void execute()
override;
515 void unexecute()
override;
516 QString getName()
const override;
533 void execute()
override;
534 void unexecute()
override;
535 QString getName()
const override;
544 virtual bool checkSaveModified() = 0;
546 virtual QString getOpenFileName(FileFinder::FileType type);
547 virtual QString getSaveFileName(FileFinder::FileType type);
548 virtual void registerLastOpenedFilePath(FileFinder::FileType type, QString path);
550 virtual QString getDefaultSessionTemplate()
const;
551 virtual void setDefaultSessionTemplate(QString);
553 virtual void findTimeRulerLayer();
555 virtual void createAudioIO();
556 virtual void deleteAudioIO();
558 virtual void openHelpUrl(QString url);
559 virtual void openLocalFolder(QString path);
561 virtual void setupMenus() = 0;
562 virtual void updateVisibleRangeDisplay(Pane *p)
const = 0;
563 virtual void updatePositionStatusDisplays()
const = 0;
567 virtual void finaliseMenus();
568 virtual void finaliseMenu(QMenu *);
580 virtual void connectLayerEditDialog(ModelDataTableDialog *dialog);
582 virtual void toXml(QTextStream &stream,
bool asTemplate);
AudioCallbackRecordTarget * m_recordTarget
virtual bool shouldCreateNewSessionForRDFAudio(bool *)
void setIconsVisibleInMenus(bool visible)
OSCQueueStarter * m_oscQueueStarter
MIDIMode
Determine whether to open a MIDI input device.
RecentFiles m_recentFiles
RealTime m_defaultFfwdRwdStep
OSCQueueStarter(MainWindowBase *mwb, bool withNetworkPort)
The base class for the SV main window.
virtual void newerVersionAvailable(QString)
breakfastquay::SystemPlaybackTarget * m_playTarget
Pane * addPane() override
QList< QShortcut * > m_appShortcuts
bool m_initialDarkBackground
std::map< Layer *, QPointer< ModelDataTableDialog > > LayerDataDialogMap
void setWindowSize(int width, int height) override
breakfastquay::SystemAudioIO * m_audioIO
RecentFiles m_recentTransforms
Open for playback, never for recording.
void setDefaultFfwdRwdStep(RealTime step)
Open for playback when model loaded, switch to I/O if record called.
void addSelection(sv_frame_t start, sv_frame_t end) override
AudioMode
Determine what kind of audio device to open when the first model is loaded or record() is called...
QSignalMapper * m_menuShortcutMapper
QString m_myStatusMessage
PaneCallback(MainWindowBase *mw)
A Sonic Visualiser document consists of a set of data models, and also the visualisation layers used ...
void setAudioRecordMode(AudioRecordMode mode)
ViewDataDialogMap m_viewDataDialogMap
Open no audio device, ever.
std::map< View *, DataDialogSet > ViewDataDialogMap
AudioRecordMode m_audioRecordMode
std::set< QPointer< ModelDataTableDialog > > DataDialogSet
bool m_iconsVisibleInMenus
LayerDataDialogMap m_layerDataDialogMap
QString m_originalLocation
AudioCallbackPlaySource * m_playSource
ViewManager * m_viewManager