1
// RCS-ID: $Id: scoreView.h,v 1.3 2006/02/23 19:17:49 cecilios Exp $
2
//--------------------------------------------------------------------------------------
3
// LenMus Phonascus: The teacher of music
4
// Copyright (c) 2002-2006 Cecilio Salmeron
6
// This program is free software; you can redistribute it and/or modify it under the
7
// terms of the GNU General Public License as published by the Free Software Foundation;
8
// either version 2 of the License, or (at your option) any later version.
10
// This program is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
14
// You should have received a copy of the GNU General Public License along with this
15
// program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
16
// Fifth Floor, Boston, MA 02110-1301, USA.
18
// For any comment, suggestion or feature request, please contact the manager of
19
// the project at cecilios@users.sourceforge.net
21
//-------------------------------------------------------------------------------------
23
@brief Header file for class lmScoreView
30
#ifndef __SCOREVIEWH__ //to avoid nested includes
31
#define __SCOREVIEWH__
33
#if wxUSE_GENERIC_DRAGIMAGE
34
#include "wx/generic/dragimgg.h"
35
#define wxDragImage wxGenericDragImage
37
#include "wx/dragimag.h"
41
#include "wx/docview.h"
42
#include "ScoreCanvas.h"
43
#include "EditFrame.h"
45
#include "../widgets/Ruler.h"
46
#include "FontManager.h"
47
#include "../sound/SoundEvents.h"
51
class lmScoreView: public wxView
57
bool OnCreate(wxDocument* doc, long WXUNUSED(flags));
58
void OnDraw(wxDC *dc);
59
void RepaintScoreRectangle(wxDC* pDC, wxRect& repaintRect);
60
void OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) = (wxObject *) NULL);
61
bool OnClose(bool deleteWindow = TRUE);
63
void OnCut(wxCommandEvent& event);
67
void SetScale(double rScale);
68
double GetScale() { return m_rScale; }
69
void SetRulersVisible(bool fVisible);
73
//methods for dealing with user interaction
74
void OnMouseEvent(wxMouseEvent& event, wxDC* pDC);
75
void OnScroll(wxScrollEvent& event);
77
//scrolling and painting
78
void AdjustScrollbars();
79
void ResizeControls();
80
void GetViewStart (int *x, int *y) const;
81
void GetScrollPixelsPerUnit (int *x_unit, int *y_unit) const;
84
void GetPageInfo(int* pMinPage, int* pMaxPage, int* pSelPageFrom, int* pSelPageTo);
85
void DrawPage(wxDC* pDC, int nPage);
87
// sound related methods
91
void OnVisualHighlight(lmScoreHighlightEvent& event);
97
// Auxiliary for rendering the view
98
void InvalidateBitmap();
100
// Auxiliary for scrolling
101
int CalcScrollInc(wxScrollEvent& event);
102
void DoScroll(wxInt32 orientation, wxInt32 nScrollSteps);
106
lmEditFrame* m_pFrame; // the frame for the view
107
lmScoreCanvas* m_pCanvas; // the window for rendering the view
109
// controls on the window
110
lmRuler* m_pHRuler; //rulers
112
wxScrollBar* m_pHScroll; // scrollbars
113
wxScrollBar* m_pVScroll;
115
// scrolling management
116
wxInt32 m_xScrollPosition, m_yScrollPosition; // current display origin (scroll units)
117
wxInt32 m_pixelsPerStepX, m_pixelsPerStepY; // pixels per scroll unit
118
wxInt32 m_xMaxScrollSteps, m_yMaxScrollSteps; // num of scroll units to scroll the full view
119
wxInt32 m_xScrollStepsPerPage, m_yScrollStepsPerPage; // scroll units to scroll a page
120
wxInt32 m_thumbX, m_thumbY; // scrollbars thumbs size
122
double m_rScale; // presentation scale
123
lmPaper m_Paper; // the lmPaper object to use
126
bool m_fRulers; // draw rulers
128
// positioning of page images (in pixels) onto the view space. This is
129
// a virtual infinite paper on which all pages are rendered one after the other.
130
lmPixels m_xPageSizeD, m_yPageSizeD; // pages size in pixels
131
lmPixels m_xBorder; // margin on both sides, left and rigth, of the page
132
lmPixels m_yBorder; // top margin before the first page
133
lmPixels m_yInterpageGap; // gap between pages
134
wxInt32 m_numPages; // the current number of pages contained in the view space
136
// scaling factors between display pixels and logical units
137
double m_xDisplayPixelsPerLU;
138
double m_yDisplayPixelsPerLU;
140
// dragging control variables
142
wxPoint m_dragStartPosL;
143
wxPoint m_dragHotSpot; // pixels
144
wxDragImage* m_pDragImage;
145
lmScoreObj* m_pSoDrag; // lmScoreObj being dragged
148
lmFontManager m_fontManager;
150
DECLARE_DYNAMIC_CLASS(lmScoreView)
151
DECLARE_EVENT_TABLE()
156
#endif // __SCOREVIEWH__