2
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
6
A MIDI and audio sequencer and musical notation editor.
8
This program is Copyright 2000-2008
9
Guillaume Laurent <glaurent@telegraph-road.org>,
10
Chris Cannam <cannam@all-day-breakfast.com>,
11
Richard Bown <richard.bown@ferventsoftware.com>
13
This file is Copyright 2007-2008
14
Yves Guillemot <yc.guillemot@wanadoo.fr>
16
The moral rights of Guillaume Laurent, Chris Cannam, and Richard
17
Bown to claim authorship of this work have been asserted.
19
Other copyrights also apply to some parts of this work. Please
20
see the AUTHORS file and individual file headers for details.
22
This program is free software; you can redistribute it and/or
23
modify it under the terms of the GNU General Public License as
24
published by the Free Software Foundation; either version 2 of the
25
License, or (at your option) any later version. See the file
26
COPYING included with this distribution for more information.
30
#ifndef _RG_TRACKHEADER_H_
31
#define _RG_TRACKHEADER_H_
33
#include "base/NotationTypes.h"
34
#include "base/Track.h"
48
class NotePixmapFactory;
53
class TrackHeader : public QLabel
58
* Create a new track header for track of id trackId.
59
* *parent is the parent widget, height the height of staff and
60
* ypos is the staff y position on canvas.
62
TrackHeader(QWidget *parent, TrackId trackId, int height, int ypos);
65
* Draw a blue line around header when current is true
66
* (intended to highlight the "current" track).
68
void setCurrent(bool current);
71
* Examine staff at x position and gather data needed to draw
73
* Return the minimum width required to display the track header.
74
* maxWidth is the maximum width allowed to show text. Return width
75
* may be greater than maxWidth if needed to show clef and key signature.
76
* (Header have always to show complete clef and key signature).
78
int lookAtStaff(double x, int maxWidth);
81
* (Re)draw the header on the notation view using the data gathered
82
* by lookAtStaff() last call and the specified width.
84
void updateHeader(int width);
87
* Return the Id of the associated track.
94
* Return how many text lines may be written in the header (above
95
* the clef and under the clef).
96
* This data is coming from the last call of lookAtStaff().
98
int getNumberOfTextLines() { return m_numberOfTextLines; }
101
* Return the Clef to draw in the header
103
Clef & getClef() { return m_clef; }
106
* Get which key signature should be drawn in the header
107
* from the last call of lookAtStaff().
109
Rosegarden::Key & getKey() { return m_key; }
112
* Return true if a Clef (and a key signature) have to be drawn in the header
116
return (m_status & SEGMENT_HERE) || (m_status & BEFORE_FIRST_SEGMENT);
120
* Return the text to write in the header top
122
QString getUpperText() { return m_upperText; }
125
* Return the transposition text
126
* (to be written at the end of the upper text)
128
QString getTransposeText() { return m_transposeText; }
131
* Return the text to write in the header bottom
133
QString getLowerText() { return m_label; }
136
* Return true if two segments or more are superimposed and are
137
* not using the same clef
139
bool isClefInconsistent() { return m_status & INCONSISTENT_CLEFS; }
142
* Return true if two segments or more are superimposed and are
143
* not using the same key signature
145
bool isKeyInconsistent() { return m_status & INCONSISTENT_KEYS; }
148
* Return true if two segments or more are superimposed and are
149
* not using the same label
151
bool isLabelInconsistent() { return m_status & INCONSISTENT_LABELS; }
154
* Return true if two segments or more are superimposed and are
155
* not using the same transposition
157
bool isTransposeInconsistent()
159
return m_status & INCONSISTENT_TRANSPOSITIONS;
165
* Convert the transpose value to the instrument tune and
166
* return it in a printable string.
168
void transposeValueToName(int transpose, QString &transposeName);
172
static const int SEGMENT_HERE;
173
static const int SUPERIMPOSED_SEGMENTS;
174
static const int INCONSISTENT_CLEFS;
175
static const int INCONSISTENT_KEYS;
176
static const int INCONSISTENT_LABELS;
177
static const int INCONSISTENT_TRANSPOSITIONS;
178
static const int BEFORE_FIRST_SEGMENT;
183
NotationView * m_notationView;
186
Rosegarden::Key m_lastKey;
189
QString m_lastUpperText;
192
int m_lastStatusPart;
196
Rosegarden::Key m_key;
203
QString m_transposeText;
204
int m_numberOfTextLines;
206
// Used to sort the segments listed in the header toolTipText
208
bool operator()(const Segment *s1, const Segment *s2) const;
210
typedef std::multiset<Segment *, SegmentCmp> SortedSegments;
212
// First segment on the track.
213
Segment * m_firstSeg;
214
timeT m_firstSegStartTime;