1
//---------------------------------------------------------------------------------------
2
// This file is part of the Lomse library.
3
// Copyright (c) 2010 Lomse project
5
// Lomse is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU General Public License as published by the Free Software Foundation,
7
// either version 3 of the License, or (at your option) any later version.
9
// Lomse is distributed in the hope that it will be useful, but WITHOUT ANY
10
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License along
14
// with Lomse; if not, see <http://www.gnu.org/licenses/>.
16
// For any comment, suggestion or feature request, please contact the manager of
17
// the project at cecilios@users.sourceforge.net
19
//---------------------------------------------------------------------------------------
21
#ifndef __LOMSE_GRAPHIC_VIEW_H__
22
#define __LOMSE_GRAPHIC_VIEW_H__
24
#include "lomse_injectors.h"
25
#include "lomse_view.h"
26
#include "lomse_drawer.h"
27
#include "platform/lomse_platform.h"
36
//forward declarations
45
//---------------------------------------------------------------------------------------
46
// A view to edit the score in full page
47
class GraphicView : public View
50
LibraryScope& m_libraryScope;
51
GraphicModel* m_pGraficModel;
52
ScreenDrawer* m_pDrawer;
53
std::vector<RenderingBuffer*> m_pPages;
54
PlatformSupport* m_pPlatform;
55
RenderOptions m_options;
59
//GraphicView(Document* pDoc); //, Controller* pController);
60
GraphicView(LibraryScope& libraryScope, Document* pDoc, PlatformSupport* pPlatform,
61
ScreenDrawer* pDrawer);
62
virtual ~GraphicView();
64
//--------------------------------------------------------------------
65
// Methods to serve platform dependent event handlers.
66
//virtual void on_init();
67
virtual void on_resize(Pixels vx, Pixels vy);
68
//virtual void on_idle();
69
virtual void on_mouse_move(int x, int y, unsigned flags);
70
virtual void on_mouse_button_down(int x, int y, unsigned flags);
71
virtual void on_mouse_button_up(int x, int y, unsigned flags);
72
//virtual void on_key(int x, int y, unsigned key, unsigned flags);
73
//virtual void on_ctrl_change();
75
//--------------------------------------------------------------------
76
// The View is requested to re-paint itself onto the window
77
virtual void on_paint();
78
//virtual void on_post_draw(void* raw_handler);
80
//window related commands
83
//inline DocCursor& get_cursor() { return m_cursor; }
84
//void on_document_reloaded();
89
//void caret_to_object(long nId);
91
//observed object notifications
92
void handle_event(Observable* ref);
95
GraphicModel* get_graphic_model();
98
inline void zoom_in() { m_scale *= 1.05; }
99
inline void zoom_out() { m_scale /= 1.05; }
100
inline void set_scale(double scale) { m_scale = scale; }
101
inline double get_scale() { return m_scale; }
104
inline void set_option_draw_box_doc_page_content(bool value) {
105
m_options.draw_box_doc_page_content_flag = value;
107
inline void set_option_draw_box_score_page(bool value) {
108
m_options.draw_box_score_page_flag = value;
110
inline void set_option_draw_box_system(bool value) {
111
m_options.draw_box_system_flag = value;
113
inline void set_option_draw_box_slice(bool value) {
114
m_options.draw_box_slice_flag = value;
116
inline void set_option_draw_box_slice_instr(bool value) {
117
m_options.draw_box_slice_instr_flag = value;
121
GraphicModel* create_graphic_model();
122
void draw_graphic_model();
124
virtual void generate_paths() = 0;
126
//renderization parameters
132
////agg renderization related
133
//agg::slider_ctrl<agg::rgba8> m_expand;
134
//agg::slider_ctrl<agg::rgba8> m_gamma;
135
//agg::slider_ctrl<agg::rgba8> m_scale;
136
//agg::slider_ctrl<agg::rgba8> m_rotate;
138
//current viewport origin (pixels)
142
//temporary for dragging (pixels)
149
//---------------------------------------------------------------------------------------
150
// A graphic view with one page, no margins (i.e. LenMus ScoreAuxCtrol)
151
class SimpleView : public GraphicView
156
SimpleView(LibraryScope& libraryScope, Document* pDoc, PlatformSupport* pPlatform,
157
ScreenDrawer* pDrawer);
158
virtual ~SimpleView() {}
161
void generate_paths();
166
//---------------------------------------------------------------------------------------
167
// A graphic view with pages in vertical (i.e. Adobe PDF Reader, MS Word)
168
class VerticalBookView : public GraphicView
173
VerticalBookView(LibraryScope& libraryScope, Document* pDoc,
174
PlatformSupport* pPlatform, ScreenDrawer* pDrawer);
175
virtual ~VerticalBookView() {}
178
void generate_paths();
183
//---------------------------------------------------------------------------------------
184
// A graphic view with pages in horizontall (i.e. Finale, Sibelius)
185
class HorizontalBookView : public GraphicView
190
HorizontalBookView(LibraryScope& libraryScope, Document* pDoc,
191
PlatformSupport* pPlatform, ScreenDrawer* pDrawer);
192
virtual ~HorizontalBookView() {}
195
void generate_paths();
203
#endif //__LOMSE_GRAPHIC_VIEW_H__