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
|
/*
Rosegarden
A MIDI and audio sequencer and musical notation editor.
This program is Copyright 2000-2008
Guillaume Laurent <[email protected]>,
Chris Cannam <[email protected]>,
Richard Bown <[email protected]>
This file is Copyright 2007-2008
Yves Guillemot <[email protected]>
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_HEADERSGROUP_H_
#define _RG_HEADERSGROUP_H_
#include "base/Track.h"
#include <vector>
#include <tqsize.h>
#include <tqwidget.h>
#include <tqvbox.h>
class TQLabel;
class TQResizeEvent;
namespace Rosegarden
{
class NotationView;
class Composition;
class TrackHeader;
class HeadersGroup : public TQVBox
{
TQ_OBJECT
public:
/**
* Create an empty headers group
*/
HeadersGroup(TQWidget *parent, NotationView * nv, Composition * comp);
void removeAllHeaders();
void addHeader(int trackId, int height, int ypos, double xcur);
/**
* Resize a filler at bottom of group to set the headersGroup height
* to the value specified in parameter.
* (Used to give to the headers group exactly the same height as the
* canvas. Necessary to get synchronous vertical scroll.)
*/
void completeToHeight(int height);
NotationView * getNotationView()
{ return m_notationView;
}
Composition * getComposition()
{ return m_composition;
}
/**
* Return the total height of all the headers (without the filler).
*/
int getUsedHeight()
{ return m_usedHeight;
}
/**
* Highlight as "current" the header of the specified track.
*/
void setCurrent(TrackId trackId);
/**
* Highlight as "current" the header of the specified track.
*/
int getWidth()
{
return m_lastWidth;
}
typedef enum { ShowNever, ShowWhenNeeded, ShowAlways } ShowHeadersModeType;
// Used to ensure to have one default value and only one.
static const ShowHeadersModeType DefaultShowMode = ShowAlways;
// Useful in configuration dialog.
static bool isValidShowMode(int mode)
{
return ((mode >= ShowNever) && (mode <= ShowAlways));
}
public slots :
/**
* Called when notation canvas moves.
* Setting force to true forces the headers to be redrawn even
* if x has not changed since the last call.
*/
void slotUpdateAllHeaders(int x, int y, bool force = false);
signals :
void headersResized(int newWidth);
private:
void resizeEvent(TQResizeEvent * ev);
NotationView * m_notationView;
Composition * m_composition;
typedef std::vector<TrackHeader *> TrackHeaderVector;
TrackHeaderVector m_headers;
int m_usedHeight;
TQLabel * m_filler;
int m_lastX;
int m_lastWidth;
};
}
#endif
|