Chris@0: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@0: Chris@0: /* Chris@0: Sonic Visualiser Chris@0: An audio file viewer and annotation editor. Chris@0: Centre for Digital Music, Queen Mary, University of London. Chris@200: This file copyright 2006-2007 Chris Cannam and QMUL. Chris@0: Chris@0: This program is free software; you can redistribute it and/or Chris@0: modify it under the terms of the GNU General Public License as Chris@0: published by the Free Software Foundation; either version 2 of the Chris@0: License, or (at your option) any later version. See the file Chris@0: COPYING included with this distribution for more information. Chris@0: */ Chris@0: Chris@0: #ifndef _MAIN_WINDOW_H_ Chris@0: #define _MAIN_WINDOW_H_ Chris@0: Chris@0: #include Chris@0: #include Chris@85: #include Chris@0: #include Chris@0: Chris@204: #include "framework/MainWindowBase.h" Chris@0: #include "base/Command.h" Chris@1: #include "view/ViewManager.h" Chris@0: #include "base/PropertyContainer.h" Chris@34: #include "base/RecentFiles.h" Chris@0: #include "layer/LayerFactory.h" Chris@249: #include "transform/Transform.h" Chris@204: #include "framework/SVFileReader.h" Chris@250: #include "widgets/FileFinder.h" Chris@198: #include "data/fileio/FileSource.h" Chris@219: #include "widgets/LayerTreeDialog.h" Chris@0: #include Chris@0: Chris@0: class Document; Chris@0: class PaneStack; Chris@0: class Pane; Chris@0: class View; Chris@0: class Fader; Chris@65: class Overview; Chris@0: class Layer; Chris@0: class WaveformLayer; Chris@0: class WaveFileModel; Chris@0: class AudioCallbackPlaySource; Chris@0: class AudioCallbackPlayTarget; Chris@0: class CommandHistory; Chris@0: class QMenu; Chris@0: class AudioDial; Chris@0: class QLabel; Chris@16: class QCheckBox; Chris@0: class PreferencesDialog; Chris@177: class QTreeView; Chris@26: class QPushButton; Chris@69: class OSCQueue; Chris@69: class OSCMessage; Chris@162: class KeyReference; Chris@189: class Labeller; Chris@0: Chris@0: Chris@200: class MainWindow : public MainWindowBase Chris@0: { Chris@0: Q_OBJECT Chris@0: Chris@0: public: Chris@70: MainWindow(bool withAudioOutput = true, Chris@70: bool withOSCSupport = true); Chris@0: virtual ~MainWindow(); Chris@0: Chris@0: signals: Chris@207: virtual void canChangeSolo(bool); Chris@206: virtual void canAlign(bool); Chris@0: Chris@118: public slots: Chris@200: virtual void preferenceChanged(PropertyContainer::PropertyName); Chris@200: virtual bool commitData(bool mayAskUser); Chris@118: Chris@0: protected slots: Chris@200: virtual void openSession(); Chris@200: virtual void importAudio(); Chris@200: virtual void importMoreAudio(); Chris@200: virtual void openSomething(); Chris@200: virtual void openLocation(); Chris@200: virtual void openRecentFile(); Chris@200: virtual void exportAudio(); Chris@200: virtual void importLayer(); Chris@200: virtual void exportLayer(); Chris@200: virtual void exportImage(); Chris@200: virtual void saveSession(); Chris@200: virtual void saveSessionAs(); Chris@200: virtual void newSession(); Chris@200: virtual void closeSession(); Chris@200: virtual void preferences(); Chris@0: Chris@200: virtual void sampleRateMismatch(size_t, size_t, bool); Chris@200: virtual void audioOverloadPluginDisabled(); Chris@266: virtual void audioTimeStretchMultiChannelDisabled(); Chris@0: Chris@200: virtual void toolNavigateSelected(); Chris@200: virtual void toolSelectSelected(); Chris@200: virtual void toolEditSelected(); Chris@200: virtual void toolDrawSelected(); Chris@217: virtual void toolEraseSelected(); Chris@200: virtual void toolMeasureSelected(); Chris@7: Chris@200: virtual void documentModified(); Chris@200: virtual void documentRestored(); Chris@0: Chris@200: virtual void updateMenuStates(); Chris@200: virtual void updateDescriptionLabel(); Chris@0: Chris@200: virtual void setInstantsNumbering(); Chris@200: virtual void setInstantsCounterCycle(); Chris@200: virtual void resetInstantsCounters(); Chris@0: Chris@233: virtual void modelGenerationFailed(QString, QString); Chris@233: virtual void modelGenerationWarning(QString, QString); Chris@233: virtual void modelRegenerationFailed(QString, QString, QString); Chris@233: virtual void modelRegenerationWarning(QString, QString, QString); Chris@233: virtual void alignmentFailed(QString, QString); Chris@0: Chris@200: virtual void rightButtonMenuRequested(Pane *, QPoint point); Chris@0: Chris@239: virtual void propertyStacksResized(int); Chris@239: Chris@200: virtual void addPane(); Chris@200: virtual void addLayer(); Chris@274: virtual void addLayer(QString transformId); Chris@200: virtual void renameCurrentLayer(); Chris@0: Chris@272: virtual void findTransform(); Chris@272: Chris@200: virtual void paneAdded(Pane *); Chris@200: virtual void paneHidden(Pane *); Chris@200: virtual void paneAboutToBeDeleted(Pane *); Chris@200: virtual void paneDropAccepted(Pane *, QStringList); Chris@200: virtual void paneDropAccepted(Pane *, QString); Chris@0: Chris@200: virtual void setupRecentFilesMenu(); Chris@211: virtual void setupRecentTransformsMenu(); Chris@0: Chris@200: virtual void playSpeedChanged(int); Chris@207: virtual void playSoloToggled(); Chris@206: virtual void alignToggled(); Chris@0: Chris@227: virtual void currentPaneChanged(Pane *); Chris@227: Chris@200: virtual void speedUpPlayback(); Chris@200: virtual void slowDownPlayback(); Chris@200: virtual void restoreNormalPlayback(); Chris@0: Chris@200: virtual void outputLevelsChanged(float, float); Chris@0: Chris@200: virtual void layerRemoved(Layer *); Chris@200: virtual void layerInAView(Layer *, bool); Chris@0: Chris@200: virtual void mainModelChanged(WaveFileModel *); Chris@200: virtual void modelAdded(Model *); Chris@0: Chris@200: virtual void showLayerTree(); Chris@0: Chris@200: virtual void mouseEnteredWidget(); Chris@200: virtual void mouseLeftWidget(); Chris@73: Chris@200: virtual void handleOSCMessage(const OSCMessage &); Chris@193: Chris@200: virtual void website(); Chris@200: virtual void help(); Chris@200: virtual void about(); Chris@200: virtual void keyReference(); Chris@0: Chris@0: protected: Chris@65: Overview *m_overview; Chris@0: Fader *m_fader; Chris@0: AudioDial *m_playSpeed; Chris@0: WaveformLayer *m_panLayer; Chris@34: Chris@0: bool m_mainMenusCreated; Chris@0: QMenu *m_paneMenu; Chris@0: QMenu *m_layerMenu; Chris@34: QMenu *m_transformsMenu; Chris@155: QMenu *m_playbackMenu; Chris@0: QMenu *m_existingLayersMenu; Chris@95: QMenu *m_sliceMenu; Chris@0: QMenu *m_recentFilesMenu; Chris@211: QMenu *m_recentTransformsMenu; Chris@0: QMenu *m_rightButtonMenu; Chris@0: QMenu *m_rightButtonLayerMenu; Chris@211: QMenu *m_rightButtonTransformsMenu; Chris@155: QMenu *m_rightButtonPlaybackMenu; Chris@155: Chris@164: QAction *m_deleteSelectedAction; Chris@207: QAction *m_soloAction; Chris@265: QAction *m_rwdStartAction; Chris@265: QAction *m_rwdAction; Chris@155: QAction *m_ffwdAction; Chris@265: QAction *m_ffwdEndAction; Chris@265: QAction *m_playAction; Chris@265: QAction *m_playSelectionAction; Chris@265: QAction *m_playLoopAction; Chris@0: Chris@207: bool m_soloModified; Chris@207: bool m_prevSolo; Chris@207: Chris@239: QFrame *m_playControlsSpacer; Chris@239: int m_playControlsWidth; Chris@239: Chris@0: QPointer m_preferencesDialog; Chris@219: QPointer m_layerTreeDialog; Chris@0: Chris@162: KeyReference *m_keyReference; Chris@162: Chris@232: struct LayerConfiguration { Chris@232: LayerConfiguration(LayerFactory::LayerType _layer Chris@0: = LayerFactory::TimeRuler, Chris@232: Model *_source = 0, Chris@232: int _channel = -1) : Chris@66: layer(_layer), sourceModel(_source), channel(_channel) { } Chris@0: LayerFactory::LayerType layer; Chris@66: Model *sourceModel; Chris@0: int channel; Chris@0: }; Chris@0: Chris@232: typedef std::map PaneActionMap; Chris@0: PaneActionMap m_paneActions; Chris@0: Chris@232: typedef std::map LayerActionMap; Chris@232: LayerActionMap m_layerActions; Chris@232: Chris@211: typedef std::map TransformActionMap; Chris@211: TransformActionMap m_transformActions; Chris@34: Chris@211: typedef std::map TransformActionReverseMap; Chris@211: TransformActionReverseMap m_transformActionsReverse; Chris@0: Chris@0: typedef std::map ExistingLayerActionMap; Chris@0: ExistingLayerActionMap m_existingLayerActions; Chris@95: ExistingLayerActionMap m_sliceActions; Chris@0: Chris@0: typedef std::map ToolActionMap; Chris@0: ToolActionMap m_toolActions; Chris@0: Chris@189: typedef std::map NumberingActionMap; Chris@189: NumberingActionMap m_numberingActions; Chris@189: Chris@200: virtual void setupMenus(); Chris@200: virtual void setupFileMenu(); Chris@200: virtual void setupEditMenu(); Chris@200: virtual void setupViewMenu(); Chris@200: virtual void setupPaneAndLayerMenus(); Chris@211: virtual void setupTransformsMenu(); Chris@200: virtual void setupHelpMenu(); Chris@200: virtual void setupExistingLayersMenus(); Chris@200: virtual void setupToolbars(); Chris@66: Chris@232: virtual void addPane(const LayerConfiguration &configuration, QString text); Chris@0: Chris@0: virtual void closeEvent(QCloseEvent *e); Chris@200: virtual bool checkSaveModified(); Chris@265: Chris@265: virtual void updateVisibleRangeDisplay(Pane *p) const; Chris@200: Chris@265: virtual void connectLayerEditDialog(ModelDataTableDialog *); Chris@0: }; Chris@0: Chris@0: Chris@0: #endif