Logo Search packages:      
Sourcecode: canorus version File versions  Download package

CAScoreViewPort Class Reference

Inheritance diagram for CAScoreViewPort:

CAViewPort

List of all members.


Detailed Description

Widget for rendering the score.

This class represents the widget capable of rendering the score. It is usually used as a central widget in the main window, but might be used for example, in a list of possible harmonization or improvization solutions, score layout window and more as an independent widget or only as a drawable content on a button.

Score viewport consists of a virtual workspace full of drawable elements which represent the abstract music elements or contexts. Every drawable element has its absolute X, Y, Width and Height geometry properties. Score viewport also shows usually a small part of the whole workspace (depending on scroll bars values and a zoom level). When drawable elements are drawn, their CADrawable::draw() methods are called with the viewports X and Y coordinates, zoom level, pen color and other properties needed to correctly draw an element to the score viewport's canvas.

Note that this widget is only capable of correctly rendering the drawable elements. No Control part of the MVC model is implemented here. The viewport logic is implemented outside of this class (usually main window). Score viewport only provides various signals to communicate with outer world. However, this class provides various modes (eg. drawing the shadow notes when inserting music elements, coloring only one voice, hiding certain staffs, animating the scroll etc.) the controller might use.

This widget also provides horizontal and vertical scrollbars (see _hScrollBar and _vScrollBar).

Definition at line 52 of file scoreviewport.h.


Public Types

enum  CAScrollBarVisibility { ScrollBarAlwaysVisible, ScrollBarAlwaysHidden, ScrollBarShowIfNeeded }
enum  CAViewPortType { ScoreViewPort, SourceViewPort }

Signals

void CADoubleClickEvent (QMouseEvent *e, QPoint p)
void CAKeyPressEvent (QKeyEvent *e)
void CAMouseMoveEvent (QMouseEvent *e, QPoint p)
void CAMousePressEvent (QMouseEvent *e, QPoint p)
void CAMouseReleaseEvent (QMouseEvent *e, QPoint p)
void CATripleClickEvent (QMouseEvent *e, QPoint p)
void CAWheelEvent (QWheelEvent *e, QPoint p)
void clicked ()
void closed (CAViewPort *)
void selectionChanged ()

Public Member Functions

void addCElement (CADrawableContext *elt, bool select=false)
void addMElement (CADrawableMusElement *elt, bool select=false)
void addSelectionRegion (QRect r)
void addToSelection (const QList< CAMusElement * > elts)
CADrawableMusElement * addToSelection (CAMusElement *elt)
void addToSelection (const QList< CADrawableMusElement * > list, bool selectableOnly=true)
void addToSelection (CADrawableMusElement *elt, bool triggerSignal=true)
QColor backgroundColor ()
QPen border ()
int calculateTime (double x, double y)
 CAScoreViewPort (CASheet *sheet, QWidget *parent=0)
 CAScoreViewPort (QWidget *parent=0)
void checkScrollBars ()
void clearRepaintArea ()
void clearSelection ()
void clearSelectionRegionList ()
CAScoreViewPortclone (QWidget *parent)
CAScoreViewPortclone ()
CAContextcontextCollision (double x, double y)
int coordsToTime (double x)
CATextEditcreateTextEdit (CADrawableMusElement *elt)
CADrawableContext * currentContext ()
QColor disabledElementsColor ()
const int drawableHeight ()
const int drawableWidth ()
bool drawShadowNoteAccs ()
CADrawableContext * findCElement (CAContext *)
QList< CADrawableContext * > findContextsInRegion (QRect &reg)
CADrawableMusElement * findMElement (CAMusElement *)
QColor foregroundColor ()
QColor hiddenElementsColor ()
void importCElements (CAKDTree< CADrawableContext * > *elts)
void importElements (CAKDTree< CADrawableMusElement * > *drawableMList, CAKDTree< CADrawableContext * > *drawableCList)
void importMElements (CAKDTree< CADrawableMusElement * > *elts)
void invertSelection ()
CAScrollBarVisibility isScrollBarVisible ()
QPoint lastMousePressCoords ()
bool manualScroll ()
QList< CADrawableMusElement * > musElementsAt (double x, double y)
QList< CAMusElement * > musElementSelection ()
CADrawableContext * nearestDownContext (double x, double y)
CADrawableMusElement * nearestLeftElement (double x, double y, CAVoice *voice)
CADrawableMusElement * nearestLeftElement (double x, double y, CADrawableContext *context=0)
CADrawableMusElement * nearestRightElement (double x, double y, CAVoice *voice)
CADrawableMusElement * nearestRightElement (double x, double y, CADrawableContext *context=0)
CADrawableContext * nearestUpContext (double x, double y)
QString noteName ()
bool noteNameVisible ()
bool playing ()
void rebuild ()
bool removeFromSelection (CADrawableMusElement *elt)
CAMusElementremoveMElement (double x, double y)
void removeSelectionRegion (QRect r)
void removeTextEdit ()
CADrawable::CADirection resizeDirection ()
void selectAll ()
void selectAllCurBar ()
void selectAllCurContext ()
CADrawableContext * selectCElement (double x, double y)
CADrawableContext * selectContext (CAContext *context)
CADrawableMusElement * selectDownMusElement ()
QColor selectedContextColor ()
CAVoiceselectedVoice ()
QList< CADrawableMusElement * > & selection ()
QColor selectionAreaColor ()
QColor selectionColor ()
const QList< QRect > & selectionRegionList () const
CADrawableMusElement * selectMElement (CAMusElement *elt)
CADrawableMusElement * selectNextMusElement (bool append=false)
CADrawableMusElement * selectPrevMusElement (bool append=false)
CADrawableMusElement * selectUpMusElement ()
void setBackgroundColor (const QColor c)
void setBorder (const QPen pen)
void setCenterCoords (double x, double y, bool animate=false, bool force=false)
void setCurrentContext (CADrawableContext *c)
void setDisabledElementsColor (const QColor c)
void setDrawShadowNoteAccs (bool draw)
void setForegroundColor (const QColor c)
void setHiddenElementsColor (const QColor c)
void setLastMousePressCoordsAfter (const QList< CAMusElement * > list)
void setManualScroll (bool scroll)
void setNoteName (QString n)
void setNoteNameVisible (bool v)
void setPlaying (bool playing)
void setRepaintArea (QRect *area)
void setScrollBarVisible (CAScrollBarVisibility status)
void setSelectedContextColor (const QColor c)
void setSelectedVoice (CAVoice *selectedVoice)
void setSelectionAreaColor (const QColor c)
void setSelectionColor (const QColor c)
void setShadowNoteAccs (int accs)
void setShadowNoteLength (CAPlayableLength)
void setShadowNoteVisible (bool visible)
void setSheet (CASheet *sheet)
void setWorldCoords (double x, double y, double w, double h, bool animate=false, bool force=false)
void setWorldCoords (const QRect r, bool animate=false, bool force=false)
void setWorldHeight (int h, bool force=false)
void setWorldWidth (int w, bool force=false)
void setWorldX (int x, bool animate=false, bool force=false)
void setWorldY (int y, bool animate=false, bool force=false)
void setZoom (float z, QPoint p, bool animate=false, bool force=false)
void setZoom (float z, double x=0, double y=0, bool animate=false, bool force=false)
int shadowNoteAccs ()
bool shadowNoteVisible ()
CASheetsheet ()
CATextEdittextEdit ()
bool textEditVisible ()
double timeToCoords (int time)
double timeToCoordsSimpleVersion (int time)
void unsetBorder ()
void updateHelpers ()
CAViewPortType viewPortType ()
const QRect worldCoords ()
const int worldHeight ()
const int worldWidth ()
const int worldX ()
const int worldY ()
const float zoom ()
void zoomToFit (bool animate=false, bool force=false)
void zoomToHeight (bool animate=false, bool force=false)
void zoomToSelection (bool animate=false, bool force=false)
void zoomToWidth (bool animate=false, bool force=false)

Static Public Attributes

static const int DEFAULT_VIEWPORT_HEIGHT = 400
static const int DEFAULT_VIEWPORT_WIDTH = 600

Protected Slots

void closeEvent (QCloseEvent *)

Protected Member Functions

void setViewPortType (CAViewPortType t)

Protected Attributes

CAViewPortType _viewPortType

Private Slots

void enterEvent (QEvent *e)
void HScrollBarEvent (int val)
void keyPressEvent (QKeyEvent *e)
void leaveEvent (QEvent *e)
void mouseMoveEvent (QMouseEvent *e)
void mousePressEvent (QMouseEvent *e)
void mouseReleaseEvent (QMouseEvent *e)
void on_animationTimer_timeout ()
void on_clickTimer_timeout ()
void paintEvent (QPaintEvent *p)
void resizeEvent (QResizeEvent *e)
void VScrollBarEvent (int val)
void wheelEvent (QWheelEvent *e)

Private Member Functions

void clearCElements ()
void clearMElements ()
void drawSelectionRegion (QPainter *p, CADrawSettings s)
template<typename T>
int getMaxXExtended (CAKDTree< T > &v)
template<typename T>
int getMaxYExtended (CAKDTree< T > &v)
void initScoreViewPort (CASheet *s)
bool isSelected (CADrawableMusElement *elt)
void setLastMousePressCoords (QPoint p)
void setResizeDirection (CADrawable::CADirection r)
void setShadowNoteVisibleOnLeave (bool v)
void setTextEdit (CATextEdit *e)
void setTextEditGeometry (const QRect r)
void setTextEditVisible (bool v)
bool shadowNoteVisibleOnLeave ()
void startAnimationTimer ()
QRect textEditGeometry ()

Private Attributes

bool _allowManualScroll
int _animationStep
QTimer * _animationTimer
QColor _backgroundColor
QPen _borderPen
QWidget * _canvas
bool _checkScrollBarsDeadLock
QTimer * _clickTimer
CADrawableContext * _currentContext
QColor _disabledElementsColor
CAKDTree< CADrawableContext * > _drawableCList
CAKDTree< CADrawableMusElement * > _drawableMList
bool _drawBorder
bool _drawShadowNoteAccs
QColor _foregroundColor
QColor _hiddenElementsColor
bool _holdRepaint
QScrollBar * _hScrollBar
bool _hScrollBarDeadLock
QPoint _lastMousePressCoords
QGridLayout * _layout
QString _noteName
bool _noteNameVisible
int _numberOfClicks
double _oldWorldH
double _oldWorldW
double _oldWorldX
double _oldWorldY
bool _playing
QRect * _repaintArea
CADrawable::CADirection _resizeDirection
CAScrollBarVisibility _scrollBarVisible
QColor _selectedContextColor
CAVoice_selectedVoice
QList< CADrawableMusElement * > _selection
QColor _selectionAreaColor
QColor _selectionColor
QList< QRect > _selectionRegionList
QList< CADrawableNote * > _shadowDrawableNote
QList< CANote * > _shadowNote
int _shadowNoteAccs
bool _shadowNoteVisible
bool _shadowNoteVisibleOnLeave
CASheet_sheet
double _targetWorldH
double _targetWorldW
double _targetWorldX
double _targetWorldY
float _targetZoom
CATextEdit_textEdit
QRect _textEditGeometry
bool _textEditVisible
QScrollBar * _vScrollBar
bool _vScrollBarDeadLock
double _worldH
double _worldW
double _worldX
double _worldY
double _xCursor
double _yCursor
float _zoom

Static Private Attributes

static const int ANIMATION_STEPS = 7
static const int BOTTOM_EXTRA_SPACE = 30
static const int RIGHT_EXTRA_SPACE = 100

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

Generated by  Doxygen 1.6.0   Back to index