comparison view/ViewManager.h @ 1324:13d9b422f7fe zoom

Merge from default branch
author Chris Cannam
date Mon, 17 Sep 2018 13:51:31 +0100
parents fc9d9f1103fa
children 646e713a4632
comparison
equal deleted inserted replaced
1183:57d192e26331 1324:13d9b422f7fe
11 published by the Free Software Foundation; either version 2 of the 11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file 12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information. 13 COPYING included with this distribution for more information.
14 */ 14 */
15 15
16 #ifndef _VIEW_MANAGER_H_ 16 #ifndef SV_VIEW_MANAGER_H
17 #define _VIEW_MANAGER_H_ 17 #define SV_VIEW_MANAGER_H
18 18
19 #include <QObject> 19 #include <QObject>
20 #include <QTimer> 20 #include <QTimer>
21 #include <QPalette> 21 #include <QPalette>
22 22
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 #include "base/BaseTypes.h"
30 30
31 class AudioPlaySource; 31 class AudioPlaySource;
32 class AudioRecordTarget;
32 class Model; 33 class Model;
33 34
34 enum PlaybackFollowMode { 35 enum PlaybackFollowMode {
35 36
36 /** 37 /**
78 public: 79 public:
79 ViewManager(); 80 ViewManager();
80 virtual ~ViewManager(); 81 virtual ~ViewManager();
81 82
82 void setAudioPlaySource(AudioPlaySource *source); 83 void setAudioPlaySource(AudioPlaySource *source);
84 void setAudioRecordTarget(AudioRecordTarget *target);
83 85
84 bool isPlaying() const; 86 bool isPlaying() const;
87 bool isRecording() const;
85 88
86 sv_frame_t getGlobalCentreFrame() const; // the set method is a slot 89 sv_frame_t getGlobalCentreFrame() const; // the set method is a slot
87 int getGlobalZoom() const; 90 int getGlobalZoom() const;
88 91
89 sv_frame_t getPlaybackFrame() const; // the set method is a slot 92 sv_frame_t getPlaybackFrame() const; // the set method is a slot
125 Selection getContainingSelection(sv_frame_t frame, bool defaultToFollowing) const; 128 Selection getContainingSelection(sv_frame_t frame, bool defaultToFollowing) const;
126 129
127 Clipboard &getClipboard() { return m_clipboard; } 130 Clipboard &getClipboard() { return m_clipboard; }
128 131
129 enum ToolMode { 132 enum ToolMode {
130 NavigateMode, 133 NavigateMode,
131 SelectMode, 134 SelectMode,
132 EditMode, 135 EditMode,
133 DrawMode, 136 DrawMode,
134 EraseMode, 137 EraseMode,
135 MeasureMode, 138 MeasureMode,
136 NoteEditMode //GF: Tonioni: this tool mode will be context sensitive. 139 NoteEditMode //GF: Tonioni: this tool mode will be context sensitive.
137 }; 140 };
138 ToolMode getToolMode() const { return m_toolMode; } 141 ToolMode getToolMode() const { return m_toolMode; }
139 void setToolMode(ToolMode mode); 142 void setToolMode(ToolMode mode);
140 143
141 /// Override the tool mode for a specific view 144 /// Override the tool mode for a specific view
188 /** 191 /**
189 * Take a "design pixel" size and scale it for the actual 192 * Take a "design pixel" size and scale it for the actual
190 * display. This is relevant to hi-dpi systems that do not do 193 * display. This is relevant to hi-dpi systems that do not do
191 * pixel doubling (i.e. Windows and Linux rather than OS/X). 194 * pixel doubling (i.e. Windows and Linux rather than OS/X).
192 */ 195 */
193 int scalePixelSize(int pixels); 196 static int scalePixelSize(int pixels);
194 197
195 enum OverlayMode { 198 enum OverlayMode {
196 NoOverlays, 199 NoOverlays,
197 GlobalOverlays, 200 GlobalOverlays,
198 StandardOverlays, 201 StandardOverlays,
214 return m_overlayMode != NoOverlays; 217 return m_overlayMode != NoOverlays;
215 } 218 }
216 bool shouldShowVerticalColourScale() const { 219 bool shouldShowVerticalColourScale() const {
217 return m_overlayMode == AllOverlays; 220 return m_overlayMode == AllOverlays;
218 } 221 }
222 bool shouldShowHorizontalValueScale() const { // for layers where x != time
223 return m_overlayMode != NoOverlays;
224 }
219 bool shouldShowSelectionExtents() const { 225 bool shouldShowSelectionExtents() const {
220 return m_overlayMode != NoOverlays && m_overlayMode != GlobalOverlays; 226 return m_overlayMode != NoOverlays && m_overlayMode != GlobalOverlays;
221 } 227 }
222 bool shouldShowLayerNames() const { 228 bool shouldShowLayerNames() const {
223 return m_overlayMode == AllOverlays; 229 return m_overlayMode == AllOverlays;
252 void viewZoomLevelChanged(View *v, int zoom, bool locked); 258 void viewZoomLevelChanged(View *v, int zoom, bool locked);
253 259
254 /** Emitted when the playback frame changes. */ 260 /** Emitted when the playback frame changes. */
255 void playbackFrameChanged(sv_frame_t frame); 261 void playbackFrameChanged(sv_frame_t frame);
256 262
257 /** Emitted when the output levels change. Values in range 0.0 -> 1.0. */ 263 /** Emitted when the output or record levels change. Values in range 0.0 -> 1.0. */
258 void outputLevelsChanged(float left, float right); 264 void monitoringLevelsChanged(float left, float right);
259 265
260 /** Emitted whenever the selection has changed. */ 266 /** Emitted whenever the selection has changed. */
261 void selectionChanged(); 267 void selectionChanged();
262 268
263 /** Emitted when the selection has been changed through an 269 /** Emitted when the selection has been changed through an
303 void viewCentreFrameChanged(sv_frame_t, bool, PlaybackFollowMode); 309 void viewCentreFrameChanged(sv_frame_t, bool, PlaybackFollowMode);
304 void viewZoomLevelChanged(int, bool); 310 void viewZoomLevelChanged(int, bool);
305 void setGlobalCentreFrame(sv_frame_t); 311 void setGlobalCentreFrame(sv_frame_t);
306 void setPlaybackFrame(sv_frame_t); 312 void setPlaybackFrame(sv_frame_t);
307 void playStatusChanged(bool playing); 313 void playStatusChanged(bool playing);
314 void recordStatusChanged(bool recording);
308 315
309 protected slots: 316 protected slots:
310 void checkPlayStatus(); 317 void checkPlayStatus();
311 void seek(sv_frame_t); 318 void seek(sv_frame_t);
312 //!!! void considerZoomChange(void *, int, bool); 319 //!!! void considerZoomChange(void *, int, bool);
313 320
314 protected: 321 protected:
315 AudioPlaySource *m_playSource; 322 AudioPlaySource *m_playSource;
323 AudioRecordTarget *m_recordTarget;
324
316 sv_frame_t m_globalCentreFrame; 325 sv_frame_t m_globalCentreFrame;
317 int m_globalZoom; 326 int m_globalZoom;
318 mutable sv_frame_t m_playbackFrame; 327 mutable sv_frame_t m_playbackFrame;
319 Model *m_playbackModel; //!!! 328 Model *m_playbackModel; //!!!
320 sv_samplerate_t m_mainModelSampleRate; 329 sv_samplerate_t m_mainModelSampleRate;
340 void signalSelectionChange(); 349 void signalSelectionChange();
341 350
342 class SetSelectionCommand : public Command 351 class SetSelectionCommand : public Command
343 { 352 {
344 public: 353 public:
345 SetSelectionCommand(ViewManager *vm, const MultiSelection &ms); 354 SetSelectionCommand(ViewManager *vm, const MultiSelection &ms);
346 virtual ~SetSelectionCommand(); 355 virtual ~SetSelectionCommand();
347 virtual void execute(); 356 virtual void execute();
348 virtual void unexecute(); 357 virtual void unexecute();
349 virtual QString getName() const; 358 virtual QString getName() const;
350 359
351 protected: 360 protected:
352 ViewManager *m_vm; 361 ViewManager *m_vm;
353 MultiSelection m_oldSelection; 362 MultiSelection m_oldSelection;
354 MultiSelection m_newSelection; 363 MultiSelection m_newSelection;
355 }; 364 };
356 365
357 OverlayMode m_overlayMode; 366 OverlayMode m_overlayMode;
358 bool m_zoomWheelsEnabled; 367 bool m_zoomWheelsEnabled;
359 bool m_showCentreLine; 368 bool m_showCentreLine;