svgui  1.9
ViewManager Class Reference

The ViewManager manages properties that may need to be synchronised between separate Views. More...

#include <ViewManager.h>

List of all members.

Classes

class  SetSelectionCommand

Public Types

enum  ToolMode {
  NavigateMode, SelectMode, EditMode, DrawMode,
  EraseMode, MeasureMode, NoteEditMode
}
enum  OverlayMode { NoOverlays, GlobalOverlays, StandardOverlays, AllOverlays }

Public Slots

void viewCentreFrameChanged (int, bool, PlaybackFollowMode)
void viewZoomLevelChanged (int, bool)
void setGlobalCentreFrame (int)
void setPlaybackFrame (int)
void playStatusChanged (bool playing)

Signals

void globalCentreFrameChanged (int frame)
 Emitted when user causes the global centre frame to change.
void viewCentreFrameChanged (View *v, int frame)
 Emitted when user scrolls a view, but doesn't affect global centre.
void viewZoomLevelChanged (View *v, int zoom, bool locked)
 Emitted when a view zooms.
void playbackFrameChanged (int frame)
 Emitted when the playback frame changes.
void outputLevelsChanged (float left, float right)
 Emitted when the output levels change.
void selectionChanged ()
 Emitted whenever the selection has changed.
void selectionChangedByUser ()
 Emitted when the selection has been changed through an explicit selection-editing action.
void inProgressSelectionChanged ()
 Emitted when the in-progress (rubberbanding) selection has changed.
void toolModeChanged ()
 Emitted when the tool mode has been changed.
void playLoopModeChanged ()
 Emitted when the play loop mode has been changed.
void playLoopModeChanged (bool)
void playSelectionModeChanged ()
 Emitted when the play selection mode has been changed.
void playSelectionModeChanged (bool)
void playSoloModeChanged ()
 Emitted when the play solo mode has been changed.
void playSoloModeChanged (bool)
void alignModeChanged ()
 Emitted when the alignment mode has been changed.
void alignModeChanged (bool)
void overlayModeChanged ()
 Emitted when the overlay mode has been changed.
void showCentreLineChanged ()
 Emitted when the centre line visibility has been changed.
void zoomWheelsEnabledChanged ()
 Emitted when the zoom wheels have been toggled.
void activity (QString)
 Emitted when any loggable activity has occurred.

Public Member Functions

 ViewManager ()
virtual ~ViewManager ()
void setAudioPlaySource (AudioPlaySource *source)
bool isPlaying () const
int getGlobalCentreFrame () const
int getGlobalZoom () const
int getPlaybackFrame () const
Model * getPlaybackModel () const
void setPlaybackModel (Model *)
int alignPlaybackFrameToReference (int) const
int alignReferenceToPlaybackFrame (int) const
bool haveInProgressSelection () const
const Selection & getInProgressSelection (bool &exclusive) const
void setInProgressSelection (const Selection &selection, bool exclusive)
void clearInProgressSelection ()
const MultiSelection & getSelection () const
const
MultiSelection::SelectionList & 
getSelections () const
void setSelection (const Selection &selection)
void addSelection (const Selection &selection)
void removeSelection (const Selection &selection)
void clearSelections ()
int constrainFrameToSelection (int frame) const
void addSelectionQuietly (const Selection &selection)
 Adding a selection normally emits the selectionChangedByUser signal.
Selection getContainingSelection (int frame, bool defaultToFollowing) const
 Return the selection that contains a given frame.
Clipboard & getClipboard ()
ToolMode getToolMode () const
void setToolMode (ToolMode mode)
void setToolModeFor (const View *v, ToolMode mode)
 Override the tool mode for a specific view.
ToolMode getToolModeFor (const View *v) const
 Return override mode if it exists for this view or global mode otherwise.
void clearToolModeOverrides ()
 Clear all current view-specific overrides.
bool getPlayLoopMode () const
void setPlayLoopMode (bool on)
bool getPlaySelectionMode () const
void setPlaySelectionMode (bool on)
bool getPlaySoloMode () const
void setPlaySoloMode (bool on)
bool getAlignMode () const
void setAlignMode (bool on)
void setIlluminateLocalFeatures (bool i)
void setShowWorkTitle (bool show)
void setShowDuration (bool show)
int getPlaybackSampleRate () const
 The sample rate that is used for playback.
int getOutputSampleRate () const
 The sample rate of the audio output device.
int getMainModelSampleRate () const
 The sample rate of the current main model.
void setMainModelSampleRate (int sr)
void setOverlayMode (OverlayMode mode)
OverlayMode getOverlayMode () const
void setShowCentreLine (bool show)
bool shouldShowCentreLine () const
bool shouldShowDuration () const
bool shouldShowFrameCount () const
bool shouldShowVerticalScale () const
bool shouldShowVerticalColourScale () const
bool shouldShowSelectionExtents () const
bool shouldShowLayerNames () const
bool shouldShowScaleGuides () const
bool shouldShowWorkTitle () const
bool shouldIlluminateLocalFeatures () const
bool shouldShowFeatureLabels () const
void setZoomWheelsEnabled (bool enable)
bool getZoomWheelsEnabled () const
void setGlobalDarkBackground (bool dark)
bool getGlobalDarkBackground () const

Protected Slots

void checkPlayStatus ()
void seek (int)

Protected Member Functions

void setSelections (const MultiSelection &ms, bool quietly=false)
void signalSelectionChange ()

Protected Attributes

AudioPlaySource * m_playSource
 !! void considerZoomChange(void *, int, bool);
int m_globalCentreFrame
int m_globalZoom
int m_playbackFrame
Model * m_playbackModel
int m_mainModelSampleRate
 !!
float m_lastLeft
float m_lastRight
MultiSelection m_selections
Selection m_inProgressSelection
bool m_inProgressExclusive
Clipboard m_clipboard
ToolMode m_toolMode
std::map< const View *, ToolModem_toolModeOverrides
bool m_playLoopMode
bool m_playSelectionMode
bool m_playSoloMode
bool m_alignMode
OverlayMode m_overlayMode
bool m_zoomWheelsEnabled
bool m_showCentreLine
bool m_illuminateLocalFeatures
bool m_showWorkTitle
bool m_showDuration
QPalette m_lightPalette
QPalette m_darkPalette

Detailed Description

The ViewManager manages properties that may need to be synchronised between separate Views.

For example, it handles signals associated with changes to the global pan and zoom, and it handles selections.

Views should be implemented in such a way as to work correctly whether they are supplied with a ViewManager or not.

Definition at line 73 of file ViewManager.h.


Member Enumeration Documentation

Enumerator:
NavigateMode 
SelectMode 
EditMode 
DrawMode 
EraseMode 
MeasureMode 
NoteEditMode 

Definition at line 128 of file ViewManager.h.

Enumerator:
NoOverlays 
GlobalOverlays 
StandardOverlays 
AllOverlays 

Definition at line 187 of file ViewManager.h.


Constructor & Destructor Documentation

Definition at line 125 of file ViewManager.cpp.


Member Function Documentation

void ViewManager::setAudioPlaySource ( AudioPlaySource *  source)

Definition at line 500 of file ViewManager.cpp.

References checkPlayStatus(), and m_playSource.

Definition at line 130 of file ViewManager.cpp.

References m_globalCentreFrame.

Referenced by View::setViewManager().

Definition at line 149 of file ViewManager.cpp.

References m_globalZoom.

Referenced by View::setViewManager().

Definition at line 158 of file ViewManager.cpp.

References m_playbackFrame, and m_playSource.

Referenced by View::getAlignedPlaybackFrame(), and View::setViewManager().

Model * ViewManager::getPlaybackModel ( ) const

Definition at line 179 of file ViewManager.cpp.

References m_playbackModel.

Referenced by View::getAligningModel().

void ViewManager::setPlaybackModel ( Model *  model)

Definition at line 185 of file ViewManager.cpp.

References m_playbackModel.

Definition at line 191 of file ViewManager.cpp.

References m_playbackModel.

Definition at line 208 of file ViewManager.cpp.

References m_playbackModel.

Definition at line 225 of file ViewManager.cpp.

References m_inProgressSelection.

Referenced by View::drawSelections(), and Pane::mouseReleaseEvent().

const Selection & ViewManager::getInProgressSelection ( bool &  exclusive) const

Definition at line 231 of file ViewManager.cpp.

References m_inProgressExclusive, and m_inProgressSelection.

Referenced by View::drawSelections(), and Pane::mouseReleaseEvent().

void ViewManager::setInProgressSelection ( const Selection &  selection,
bool  exclusive 
)
const MultiSelection & ViewManager::getSelection ( ) const

Definition at line 254 of file ViewManager.cpp.

References m_selections.

void ViewManager::setSelection ( const Selection &  selection)

Definition at line 266 of file ViewManager.cpp.

References m_selections, and setSelections().

Referenced by Pane::mouseReleaseEvent().

void ViewManager::addSelection ( const Selection &  selection)

Definition at line 274 of file ViewManager.cpp.

References m_selections, and setSelections().

Referenced by Pane::editSelectionEnd(), and Pane::mouseReleaseEvent().

void ViewManager::removeSelection ( const Selection &  selection)

Definition at line 290 of file ViewManager.cpp.

References m_selections, and setSelections().

Referenced by Pane::editSelectionEnd(), and Pane::mousePressEvent().

Definition at line 298 of file ViewManager.cpp.

References m_selections, and setSelections().

Referenced by setInProgressSelection().

int ViewManager::constrainFrameToSelection ( int  frame) const

Definition at line 317 of file ViewManager.cpp.

References getSelections().

void ViewManager::addSelectionQuietly ( const Selection &  selection)

Adding a selection normally emits the selectionChangedByUser signal.

Call this to add a selection without emitting that signal. This is used in session file load, for example.

Definition at line 282 of file ViewManager.cpp.

References m_selections, and setSelections().

Selection ViewManager::getContainingSelection ( int  frame,
bool  defaultToFollowing 
) const

Return the selection that contains a given frame.

If defaultToFollowing is true, and if the frame is not in a selected area, return the next selection after the given frame. Return the empty selection if no appropriate selection is found.

Definition at line 376 of file ViewManager.cpp.

References m_selections.

Referenced by Pane::getSelectionAt().

Clipboard& ViewManager::getClipboard ( ) [inline]

Definition at line 126 of file ViewManager.h.

References m_clipboard.

ToolMode ViewManager::getToolMode ( ) const [inline]

Definition at line 137 of file ViewManager.h.

References m_toolMode.

Referenced by getToolModeFor().

void ViewManager::setToolModeFor ( const View v,
ToolMode  mode 
)

Override the tool mode for a specific view.

Definition at line 410 of file ViewManager.cpp.

References m_toolModeOverrides.

Clear all current view-specific overrides.

Definition at line 416 of file ViewManager.cpp.

References m_toolModeOverrides.

bool ViewManager::getPlayLoopMode ( ) const [inline]

Definition at line 147 of file ViewManager.h.

References m_playLoopMode.

void ViewManager::setPlayLoopMode ( bool  on)

Definition at line 422 of file ViewManager.cpp.

References activity(), m_playLoopMode, and playLoopModeChanged().

bool ViewManager::getPlaySelectionMode ( ) const [inline]

Definition at line 150 of file ViewManager.h.

References m_playSelectionMode.

Referenced by View::movePlayPointer().

Definition at line 437 of file ViewManager.cpp.

References activity(), m_playSelectionMode, and playSelectionModeChanged().

bool ViewManager::getPlaySoloMode ( ) const [inline]

Definition at line 153 of file ViewManager.h.

References m_playSoloMode.

void ViewManager::setPlaySoloMode ( bool  on)

Definition at line 452 of file ViewManager.cpp.

References activity(), m_playSoloMode, and playSoloModeChanged().

void ViewManager::setAlignMode ( bool  on)

Definition at line 467 of file ViewManager.cpp.

References activity(), alignModeChanged(), and m_alignMode.

void ViewManager::setIlluminateLocalFeatures ( bool  i) [inline]

Definition at line 159 of file ViewManager.h.

References m_illuminateLocalFeatures.

void ViewManager::setShowWorkTitle ( bool  show) [inline]

Definition at line 160 of file ViewManager.h.

References m_showWorkTitle.

void ViewManager::setShowDuration ( bool  show) [inline]

Definition at line 161 of file ViewManager.h.

References m_showDuration.

The sample rate that is used for playback.

This is usually the rate of the main model, but not always. Models whose rates differ from this will play back at the wrong speed -- there is no per-model resampler.

Definition at line 482 of file ViewManager.cpp.

References m_playSource.

Referenced by Pane::drawDurationAndRate().

The sample rate of the audio output device.

If the playback sample rate differs from this, everything will be resampled at the output stage.

Definition at line 491 of file ViewManager.cpp.

References m_playSource.

Referenced by Pane::drawDurationAndRate().

int ViewManager::getMainModelSampleRate ( ) const [inline]

The sample rate of the current main model.

This may in theory differ from the playback sample rate, in which case even the main model will play at the wrong speed.

Definition at line 183 of file ViewManager.h.

References m_mainModelSampleRate.

Referenced by Colour3DPlotLayer::getFeatureDescription(), Colour3DPlotLayer::paint(), Colour3DPlotLayer::paintDense(), and Colour3DPlotLayer::shouldPaintDenseIn().

void ViewManager::setMainModelSampleRate ( int  sr) [inline]

Definition at line 185 of file ViewManager.h.

References m_mainModelSampleRate.

Definition at line 646 of file ViewManager.cpp.

References activity(), m_overlayMode, and overlayModeChanged().

Definition at line 194 of file ViewManager.h.

References m_overlayMode.

Referenced by TimeRulerLayer::paint().

void ViewManager::setShowCentreLine ( bool  show)

Definition at line 677 of file ViewManager.cpp.

References activity(), m_showCentreLine, and showCentreLineChanged().

bool ViewManager::shouldShowCentreLine ( ) const [inline]

Definition at line 197 of file ViewManager.h.

References m_showCentreLine.

Referenced by Pane::paintEvent(), and View::paintEvent().

bool ViewManager::shouldShowDuration ( ) const [inline]

Definition at line 199 of file ViewManager.h.

References m_overlayMode, m_showDuration, and NoOverlays.

Referenced by Pane::paintEvent(), and shouldShowFrameCount().

bool ViewManager::shouldShowFrameCount ( ) const [inline]

Definition at line 202 of file ViewManager.h.

References m_showCentreLine, and shouldShowDuration().

Referenced by Pane::drawCentreLine().

bool ViewManager::shouldShowVerticalScale ( ) const [inline]

Definition at line 205 of file ViewManager.h.

References m_overlayMode, and NoOverlays.

Referenced by Pane::getImageSize(), Pane::paintEvent(), and Pane::toNewImage().

bool ViewManager::shouldShowSelectionExtents ( ) const [inline]

Definition at line 211 of file ViewManager.h.

References GlobalOverlays, m_overlayMode, and NoOverlays.

Referenced by View::drawSelections().

bool ViewManager::shouldShowLayerNames ( ) const [inline]

Definition at line 214 of file ViewManager.h.

References AllOverlays, and m_overlayMode.

Referenced by Pane::paintEvent().

bool ViewManager::shouldShowScaleGuides ( ) const [inline]

Definition at line 217 of file ViewManager.h.

References m_overlayMode, and NoOverlays.

Referenced by SliceLayer::paint(), and WaveformLayer::paint().

bool ViewManager::shouldShowWorkTitle ( ) const [inline]

Definition at line 220 of file ViewManager.h.

References m_showWorkTitle.

Referenced by Pane::paintEvent().

bool ViewManager::shouldShowFeatureLabels ( ) const [inline]

Definition at line 226 of file ViewManager.h.

References GlobalOverlays, m_overlayMode, and NoOverlays.

Referenced by View::shouldShowFeatureLabels().

void ViewManager::setZoomWheelsEnabled ( bool  enable)

Definition at line 661 of file ViewManager.cpp.

References activity(), m_zoomWheelsEnabled, and zoomWheelsEnabledChanged().

Definition at line 693 of file ViewManager.cpp.

References getGlobalDarkBackground(), m_darkPalette, and m_lightPalette.

void ViewManager::globalCentreFrameChanged ( int  frame) [signal]

Emitted when user causes the global centre frame to change.

Referenced by setGlobalCentreFrame(), and viewCentreFrameChanged().

void ViewManager::viewCentreFrameChanged ( View v,
int  frame 
) [signal]

Emitted when user scrolls a view, but doesn't affect global centre.

Referenced by viewCentreFrameChanged().

void ViewManager::viewZoomLevelChanged ( View v,
int  zoom,
bool  locked 
) [signal]

Emitted when a view zooms.

Referenced by viewZoomLevelChanged().

void ViewManager::playbackFrameChanged ( int  frame) [signal]

Emitted when the playback frame changes.

Referenced by checkPlayStatus(), seek(), and setPlaybackFrame().

void ViewManager::outputLevelsChanged ( float  left,
float  right 
) [signal]

Emitted when the output levels change.

Values in range 0.0 -> 1.0.

Referenced by checkPlayStatus().

void ViewManager::selectionChanged ( ) [signal]

Emitted whenever the selection has changed.

Referenced by signalSelectionChange().

Emitted when the selection has been changed through an explicit selection-editing action.

*Not* emitted when the selection has been changed through undo or redo.

Referenced by setSelections().

Emitted when the in-progress (rubberbanding) selection has changed.

Referenced by clearInProgressSelection(), and setInProgressSelection().

void ViewManager::toolModeChanged ( ) [signal]

Emitted when the tool mode has been changed.

Referenced by setToolMode().

Emitted when the play loop mode has been changed.

Referenced by setPlayLoopMode().

void ViewManager::playLoopModeChanged ( bool  ) [signal]

Emitted when the play selection mode has been changed.

Referenced by setPlaySelectionMode().

void ViewManager::playSelectionModeChanged ( bool  ) [signal]

Emitted when the play solo mode has been changed.

Referenced by setPlaySoloMode().

void ViewManager::playSoloModeChanged ( bool  ) [signal]
void ViewManager::alignModeChanged ( ) [signal]

Emitted when the alignment mode has been changed.

Referenced by setAlignMode().

void ViewManager::alignModeChanged ( bool  ) [signal]

Emitted when the overlay mode has been changed.

Referenced by setOverlayMode().

Emitted when the centre line visibility has been changed.

Referenced by setShowCentreLine().

Emitted when the zoom wheels have been toggled.

Referenced by setZoomWheelsEnabled().

void ViewManager::viewZoomLevelChanged ( int  z,
bool  locked 
) [slot]

!! emit zoomLevelChanged();

Definition at line 619 of file ViewManager.cpp.

References activity(), m_globalZoom, and viewZoomLevelChanged().

void ViewManager::setGlobalCentreFrame ( int  f) [slot]

Definition at line 139 of file ViewManager.cpp.

References globalCentreFrameChanged(), and m_globalCentreFrame.

void ViewManager::setPlaybackFrame ( int  f) [slot]
void ViewManager::playStatusChanged ( bool  playing) [slot]

Definition at line 509 of file ViewManager.cpp.

References checkPlayStatus().

void ViewManager::seek ( int  f) [protected, slot]

Definition at line 593 of file ViewManager.cpp.

References m_playbackFrame, m_playSource, and playbackFrameChanged().

Referenced by viewCentreFrameChanged().

void ViewManager::setSelections ( const MultiSelection &  ms,
bool  quietly = false 
) [protected]
void ViewManager::signalSelectionChange ( ) [protected]

Definition at line 338 of file ViewManager.cpp.

References selectionChanged().


Member Data Documentation

AudioPlaySource* ViewManager::m_playSource [protected]

!! void considerZoomChange(void *, int, bool);

Definition at line 307 of file ViewManager.h.

Referenced by checkPlayStatus(), getOutputSampleRate(), getPlaybackFrame(), getPlaybackSampleRate(), isPlaying(), seek(), setAudioPlaySource(), and setPlaybackFrame().

int ViewManager::m_globalZoom [protected]

Definition at line 309 of file ViewManager.h.

Referenced by getGlobalZoom(), and viewZoomLevelChanged().

int ViewManager::m_playbackFrame [mutable, protected]

Definition at line 310 of file ViewManager.h.

Referenced by checkPlayStatus(), getPlaybackFrame(), seek(), and setPlaybackFrame().

float ViewManager::m_lastLeft [protected]

Definition at line 314 of file ViewManager.h.

Referenced by checkPlayStatus().

float ViewManager::m_lastRight [protected]

Definition at line 315 of file ViewManager.h.

Referenced by checkPlayStatus().

Definition at line 319 of file ViewManager.h.

Referenced by getInProgressSelection(), and setInProgressSelection().

Clipboard ViewManager::m_clipboard [protected]

Definition at line 321 of file ViewManager.h.

Referenced by getClipboard().

Definition at line 323 of file ViewManager.h.

Referenced by getToolMode(), and setToolMode().

std::map<const View *, ToolMode> ViewManager::m_toolModeOverrides [protected]

Definition at line 324 of file ViewManager.h.

Referenced by clearToolModeOverrides(), getToolModeFor(), and setToolModeFor().

bool ViewManager::m_playLoopMode [protected]

Definition at line 326 of file ViewManager.h.

Referenced by getPlayLoopMode(), and setPlayLoopMode().

Definition at line 327 of file ViewManager.h.

Referenced by getPlaySelectionMode(), and setPlaySelectionMode().

bool ViewManager::m_playSoloMode [protected]

Definition at line 328 of file ViewManager.h.

Referenced by getPlaySoloMode(), and setPlaySoloMode().

bool ViewManager::m_alignMode [protected]

Definition at line 329 of file ViewManager.h.

Referenced by getAlignMode(), and setAlignMode().

Definition at line 350 of file ViewManager.h.

Referenced by getZoomWheelsEnabled(), setZoomWheelsEnabled(), and ViewManager().

bool ViewManager::m_showWorkTitle [protected]

Definition at line 353 of file ViewManager.h.

Referenced by setShowWorkTitle(), and shouldShowWorkTitle().

bool ViewManager::m_showDuration [protected]

Definition at line 354 of file ViewManager.h.

Referenced by setShowDuration(), and shouldShowDuration().

QPalette ViewManager::m_lightPalette [protected]

Definition at line 356 of file ViewManager.h.

Referenced by setGlobalDarkBackground(), and ViewManager().

QPalette ViewManager::m_darkPalette [protected]

Definition at line 357 of file ViewManager.h.

Referenced by setGlobalDarkBackground(), and ViewManager().


The documentation for this class was generated from the following files: