1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
/*
Rosegarden
A MIDI and audio sequencer and musical notation editor.
This program is Copyright 2000-2008
Guillaume Laurent <glaurent@telegraph-road.org>,
Chris Cannam <cannam@all-day-breakfast.com>,
Richard Bown <richard.bown@ferventsoftware.com>
The moral rights of Guillaume Laurent, Chris Cannam, and Richard
Bown to claim authorship of this work have been asserted.
Other copyrights also apply to some parts of this work. Please
see the AUTHORS file and individual file headers for details.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
*/
#ifndef _RG_CONTROLRULER_H_
#define _RG_CONTROLRULER_H_
#include "base/Segment.h"
#include "gui/general/RosegardenCanvasView.h"
#include <tqcolor.h>
#include <tqpoint.h>
#include <tqstring.h>
#include <utility>
class TQWidget;
class TQWheelEvent;
class TQScrollBar;
class TQPopupMenu;
class TQMouseEvent;
class TQContextMenuEvent;
class TQCanvasRectangle;
class TQCanvas;
namespace Rosegarden
{
class ControlTool;
class ControlSelector;
class ControlItem;
class TextFloat;
class Segment;
class RulerScale;
class EventSelection;
class EditViewBase;
/**
* ControlRuler : base class for Control Rulers
*/
class ControlRuler : public RosegardenCanvasView, public SegmentObserver
{
TQ_OBJECT
friend class ControlItem;
public:
ControlRuler(Segment*,
RulerScale*,
EditViewBase* parentView,
TQCanvas*,
TQWidget* parent=0, const char* name=0, WFlags f=0);
virtual ~ControlRuler();
virtual TQString getName() = 0;
int getMaxItemValue() { return m_maxItemValue; }
void setMaxItemValue(int val) { m_maxItemValue = val; }
void clear();
void setControlTool(ControlTool*);
int applyTool(double x, int val);
TQCanvasRectangle* getSelectionRectangle() { return m_selectionRect; }
RulerScale* getRulerScale() { return m_rulerScale; }
// SegmentObserver interface
virtual void segmentDeleted(const Segment *);
static const int DefaultRulerHeight;
static const int MinItemHeight;
static const int MaxItemHeight;
static const int ItemHeightRange;
void flipForwards();
void flipBackwards();
void setMainHorizontalScrollBar(TQScrollBar* s ) { m_mainHorizontalScrollBar = s; }
signals:
void stateChange(const TQString&, bool);
public slots:
/// override RosegardenCanvasView - we don't want to change the main hscrollbar
virtual void slotUpdate();
virtual void slotUpdateElementsHPos();
protected:
virtual void contentsMousePressEvent(TQMouseEvent*);
virtual void contentsMouseReleaseEvent(TQMouseEvent*);
virtual void contentsMouseMoveEvent(TQMouseEvent*);
virtual void contentsWheelEvent(TQWheelEvent*);
virtual void contentsContextMenuEvent(TQContextMenuEvent*);
virtual TQScrollBar* getMainHorizontalScrollBar();
virtual void computeStaffOffset() {};
virtual void layoutItem(ControlItem*);
// Stacking of the SegmentItems on the canvas
//
std::pair<int, int> getZMinMax();
virtual void init() = 0;
virtual void drawBackground() = 0;
int valueToHeight(long val);
long heightToValue(int height);
TQColor valueToColour(int max, int val);
void clearSelectedItems();
void updateSelection();
void setMenuName(TQString menuName) { m_menuName = menuName; }
void createMenu();
//--------------- Data members ---------------------------------
EditViewBase* m_parentEditView;
TQScrollBar* m_mainHorizontalScrollBar;
RulerScale* m_rulerScale;
EventSelection* m_eventSelection;
Segment* m_segment;
ControlItem* m_currentItem;
TQCanvasItemList m_selectedItems;
ControlTool *m_tool;
int m_maxItemValue;
double m_staffOffset;
double m_currentX;
TQPoint m_lastEventPos;
bool m_itemMoved;
bool m_selecting;
ControlSelector* m_selector;
TQCanvasRectangle* m_selectionRect;
TQString m_menuName;
TQPopupMenu* m_menu;
TextFloat *m_numberFloat;
bool m_hposUpdatePending;
};
}
#endif
|