comparison view/ViewManager.h @ 944:78c152e4db95

Merge from branch tonioni
author Chris Cannam
date Mon, 20 Apr 2015 09:12:17 +0100
parents a1226b3b7925
children e0ac21f07ab0
comparison
equal deleted inserted replaced
896:78e041e45ff0 944:78c152e4db95
24 24
25 #include "base/ViewManagerBase.h" 25 #include "base/ViewManagerBase.h"
26 #include "base/Selection.h" 26 #include "base/Selection.h"
27 #include "base/Command.h" 27 #include "base/Command.h"
28 #include "base/Clipboard.h" 28 #include "base/Clipboard.h"
29 #include "base/BaseTypes.h"
29 30
30 class AudioPlaySource; 31 class AudioPlaySource;
31 class Model; 32 class Model;
32 33
33 enum PlaybackFollowMode { 34 enum PlaybackFollowMode {
80 81
81 void setAudioPlaySource(AudioPlaySource *source); 82 void setAudioPlaySource(AudioPlaySource *source);
82 83
83 bool isPlaying() const; 84 bool isPlaying() const;
84 85
85 int getGlobalCentreFrame() const; // the set method is a slot 86 sv_frame_t getGlobalCentreFrame() const; // the set method is a slot
86 int getGlobalZoom() const; 87 int getGlobalZoom() const;
87 88
88 int getPlaybackFrame() const; // the set method is a slot 89 sv_frame_t getPlaybackFrame() const; // the set method is a slot
89 90
90 // Only meaningful in solo mode, and used for optional alignment feature 91 // Only meaningful in solo mode, and used for optional alignment feature
91 Model *getPlaybackModel() const; 92 Model *getPlaybackModel() const;
92 void setPlaybackModel(Model *); 93 void setPlaybackModel(Model *);
93 94
94 int alignPlaybackFrameToReference(int) const; 95 sv_frame_t alignPlaybackFrameToReference(sv_frame_t) const;
95 int alignReferenceToPlaybackFrame(int) const; 96 sv_frame_t alignReferenceToPlaybackFrame(sv_frame_t) const;
96 97
97 bool haveInProgressSelection() const; 98 bool haveInProgressSelection() const;
98 const Selection &getInProgressSelection(bool &exclusive) const; 99 const Selection &getInProgressSelection(bool &exclusive) const;
99 void setInProgressSelection(const Selection &selection, bool exclusive); 100 void setInProgressSelection(const Selection &selection, bool exclusive);
100 void clearInProgressSelection(); 101 void clearInProgressSelection();
104 const MultiSelection::SelectionList &getSelections() const; 105 const MultiSelection::SelectionList &getSelections() const;
105 void setSelection(const Selection &selection); 106 void setSelection(const Selection &selection);
106 void addSelection(const Selection &selection); 107 void addSelection(const Selection &selection);
107 void removeSelection(const Selection &selection); 108 void removeSelection(const Selection &selection);
108 void clearSelections(); 109 void clearSelections();
109 int constrainFrameToSelection(int frame) const; 110 sv_frame_t constrainFrameToSelection(sv_frame_t frame) const;
110 111
111 /** 112 /**
112 * Adding a selection normally emits the selectionChangedByUser 113 * Adding a selection normally emits the selectionChangedByUser
113 * signal. Call this to add a selection without emitting that signal. 114 * signal. Call this to add a selection without emitting that signal.
114 * This is used in session file load, for example. 115 * This is used in session file load, for example.
119 * Return the selection that contains a given frame. 120 * Return the selection that contains a given frame.
120 * If defaultToFollowing is true, and if the frame is not in a 121 * If defaultToFollowing is true, and if the frame is not in a
121 * selected area, return the next selection after the given frame. 122 * selected area, return the next selection after the given frame.
122 * Return the empty selection if no appropriate selection is found. 123 * Return the empty selection if no appropriate selection is found.
123 */ 124 */
124 Selection getContainingSelection(int frame, bool defaultToFollowing) const; 125 Selection getContainingSelection(sv_frame_t frame, bool defaultToFollowing) const;
125 126
126 Clipboard &getClipboard() { return m_clipboard; } 127 Clipboard &getClipboard() { return m_clipboard; }
127 128
128 enum ToolMode { 129 enum ToolMode {
129 NavigateMode, 130 NavigateMode,
164 * The sample rate that is used for playback. This is usually the 165 * The sample rate that is used for playback. This is usually the
165 * rate of the main model, but not always. Models whose rates 166 * rate of the main model, but not always. Models whose rates
166 * differ from this will play back at the wrong speed -- there is 167 * differ from this will play back at the wrong speed -- there is
167 * no per-model resampler. 168 * no per-model resampler.
168 */ 169 */
169 int getPlaybackSampleRate() const; 170 sv_samplerate_t getPlaybackSampleRate() const;
170 171
171 /** 172 /**
172 * The sample rate of the audio output device. If the playback 173 * The sample rate of the audio output device. If the playback
173 * sample rate differs from this, everything will be resampled at 174 * sample rate differs from this, everything will be resampled at
174 * the output stage. 175 * the output stage.
175 */ 176 */
176 int getOutputSampleRate() const; 177 sv_samplerate_t getOutputSampleRate() const;
177 178
178 /** 179 /**
179 * The sample rate of the current main model. This may in theory 180 * The sample rate of the current main model. This may in theory
180 * differ from the playback sample rate, in which case even the 181 * differ from the playback sample rate, in which case even the
181 * main model will play at the wrong speed. 182 * main model will play at the wrong speed.
182 */ 183 */
183 int getMainModelSampleRate() const { return m_mainModelSampleRate; } 184 sv_samplerate_t getMainModelSampleRate() const { return m_mainModelSampleRate; }
184 185
185 void setMainModelSampleRate(int sr) { m_mainModelSampleRate = sr; } 186 void setMainModelSampleRate(sv_samplerate_t sr) { m_mainModelSampleRate = sr; }
186 187
187 /** 188 /**
188 * Take a "design pixel" size and scale it for the actual 189 * Take a "design pixel" size and scale it for the actual
189 * display. This is relevant to hi-dpi systems that do not do 190 * display. This is relevant to hi-dpi systems that do not do
190 * pixel doubling (i.e. Windows and Linux rather than OS/X). 191 * pixel doubling (i.e. Windows and Linux rather than OS/X).
240 void setGlobalDarkBackground(bool dark); 241 void setGlobalDarkBackground(bool dark);
241 bool getGlobalDarkBackground() const; 242 bool getGlobalDarkBackground() const;
242 243
243 signals: 244 signals:
244 /** Emitted when user causes the global centre frame to change. */ 245 /** Emitted when user causes the global centre frame to change. */
245 void globalCentreFrameChanged(int frame); 246 void globalCentreFrameChanged(sv_frame_t frame);
246 247
247 /** Emitted when user scrolls a view, but doesn't affect global centre. */ 248 /** Emitted when user scrolls a view, but doesn't affect global centre. */
248 void viewCentreFrameChanged(View *v, int frame); 249 void viewCentreFrameChanged(View *v, sv_frame_t frame);
249 250
250 /** Emitted when a view zooms. */ 251 /** Emitted when a view zooms. */
251 void viewZoomLevelChanged(View *v, int zoom, bool locked); 252 void viewZoomLevelChanged(View *v, int zoom, bool locked);
252 253
253 /** Emitted when the playback frame changes. */ 254 /** Emitted when the playback frame changes. */
254 void playbackFrameChanged(int frame); 255 void playbackFrameChanged(sv_frame_t frame);
255 256
256 /** Emitted when the output levels change. Values in range 0.0 -> 1.0. */ 257 /** Emitted when the output levels change. Values in range 0.0 -> 1.0. */
257 void outputLevelsChanged(float left, float right); 258 void outputLevelsChanged(float left, float right);
258 259
259 /** Emitted whenever the selection has changed. */ 260 /** Emitted whenever the selection has changed. */
297 298
298 /** Emitted when any loggable activity has occurred. */ 299 /** Emitted when any loggable activity has occurred. */
299 void activity(QString); 300 void activity(QString);
300 301
301 public slots: 302 public slots:
302 void viewCentreFrameChanged(int, bool, PlaybackFollowMode); 303 void viewCentreFrameChanged(sv_frame_t, bool, PlaybackFollowMode);
303 void viewZoomLevelChanged(int, bool); 304 void viewZoomLevelChanged(int, bool);
304 void setGlobalCentreFrame(int); 305 void setGlobalCentreFrame(sv_frame_t);
305 void setPlaybackFrame(int); 306 void setPlaybackFrame(sv_frame_t);
306 void playStatusChanged(bool playing); 307 void playStatusChanged(bool playing);
307 308
308 protected slots: 309 protected slots:
309 void checkPlayStatus(); 310 void checkPlayStatus();
310 void seek(int); 311 void seek(sv_frame_t);
311 //!!! void considerZoomChange(void *, int, bool); 312 //!!! void considerZoomChange(void *, int, bool);
312 313
313 protected: 314 protected:
314 AudioPlaySource *m_playSource; 315 AudioPlaySource *m_playSource;
315 int m_globalCentreFrame; 316 sv_frame_t m_globalCentreFrame;
316 int m_globalZoom; 317 int m_globalZoom;
317 mutable int m_playbackFrame; 318 mutable sv_frame_t m_playbackFrame;
318 Model *m_playbackModel; //!!! 319 Model *m_playbackModel; //!!!
319 int m_mainModelSampleRate; 320 sv_samplerate_t m_mainModelSampleRate;
320 321
321 float m_lastLeft; 322 float m_lastLeft;
322 float m_lastRight; 323 float m_lastRight;
323 324
324 MultiSelection m_selections; 325 MultiSelection m_selections;