annotate base/ViewManager.h @ 5:31c4ed2d5da6

* Hook up SV file i/o. You can now save and load sessions. Some problems -- gain is not reloaded correctly for waveforms, reloaded panes are not properly reconnected to the panner, and no doubt plenty of others.
author Chris Cannam
date Tue, 17 Jan 2006 17:45:55 +0000
parents d86891498eef
children 214054a0d8b8
rev   line source
Chris@0 1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@0 4 A waveform viewer and audio annotation editor.
Chris@2 5 Chris Cannam, Queen Mary University of London, 2005-2006
Chris@0 6
Chris@0 7 This is experimental software. Not for distribution.
Chris@0 8 */
Chris@0 9
Chris@0 10 #ifndef _VIEW_MANAGER_H_
Chris@0 11 #define _VIEW_MANAGER_H_
Chris@0 12
Chris@0 13 #include <QObject>
Chris@0 14 #include <QTimer>
Chris@0 15
Chris@0 16 #include <map>
Chris@0 17
Chris@0 18 class AudioPlaySource;
Chris@0 19 class PlayParameters;
Chris@0 20 class Model;
Chris@0 21
Chris@0 22 /**
Chris@0 23 * The ViewManager manages properties that may need to be synchronised
Chris@0 24 * between separate Views. For example, it handles signals associated
Chris@0 25 * with changes to the global pan and zoom. It also handles playback
Chris@0 26 * properties and play synchronisation.
Chris@0 27 *
Chris@0 28 * Views should be implemented in such a way as to work
Chris@0 29 * correctly whether they are supplied with a ViewManager or not.
Chris@0 30 */
Chris@0 31
Chris@0 32 class ViewManager : public QObject
Chris@0 33 {
Chris@0 34 Q_OBJECT
Chris@0 35
Chris@0 36 public:
Chris@0 37 ViewManager();
Chris@0 38
Chris@0 39 void setAudioPlaySource(AudioPlaySource *source);
Chris@0 40
Chris@0 41 //!!! No way to remove a model!
Chris@0 42 PlayParameters *getPlayParameters(const Model *model);
Chris@0 43 void clearPlayParameters();
Chris@0 44
Chris@0 45 unsigned long getGlobalCentreFrame() const;
Chris@0 46 unsigned long getGlobalZoom() const;
Chris@0 47
Chris@0 48 signals:
Chris@0 49 /** Emitted when a widget pans. The originator identifies the widget. */
Chris@0 50 void centreFrameChanged(void *originator, unsigned long frame, bool locked);
Chris@0 51
Chris@0 52 /** Emitted when a widget zooms. The originator identifies the widget. */
Chris@0 53 void zoomLevelChanged(void *originator, unsigned long zoom, bool locked);
Chris@0 54
Chris@0 55 /** Emitted when the playback frame changes. */
Chris@0 56 void playbackFrameChanged(unsigned long frame);
Chris@0 57
Chris@0 58 /** Emitted when the output levels change. Values in range 0.0 -> 1.0. */
Chris@0 59 void outputLevelsChanged(float left, float right);
Chris@0 60
Chris@0 61 protected slots:
Chris@0 62 void checkPlayStatus();
Chris@0 63 void considerSeek(void *, unsigned long, bool);
Chris@0 64 void considerZoomChange(void *, unsigned long, bool);
Chris@0 65
Chris@0 66 protected:
Chris@0 67 AudioPlaySource *m_playSource;
Chris@0 68 unsigned long m_globalCentreFrame;
Chris@0 69 unsigned long m_globalZoom;
Chris@0 70
Chris@0 71 float m_lastLeft;
Chris@0 72 float m_lastRight;
Chris@0 73
Chris@0 74 std::map<const Model *, PlayParameters *> m_playParameters;
Chris@0 75 };
Chris@0 76
Chris@0 77 #endif
Chris@0 78