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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
//=========================================================
// MusE
// Linux Music Editor
// $Id: strip.cpp,v 1.6.2.5 2009/11/14 03:37:48 terminator356 Exp $
//
// (C) Copyright 2000-2004 Werner Schweer (ws@seh.de)
//=========================================================
#include <QToolButton>
#include <QLabel>
#include <QLayout>
#include <QPalette>
#include <QColor>
//Added by qt3to4:
#include <QVBoxLayout>
//#include <Q3Frame>
#include <QFrame>
#include "globals.h"
#include "gconfig.h"
#include "app.h"
#include "audio.h"
#include "song.h"
#include "track.h"
#include "strip.h"
#include "meter.h"
#include "utils.h"
//---------------------------------------------------------
// setRecordFlag
//---------------------------------------------------------
void Strip::setRecordFlag(bool flag)
{
if (record) {
record->blockSignals(true);
record->setOn(flag);
record->blockSignals(false);
}
}
//---------------------------------------------------------
// resetPeaks
//---------------------------------------------------------
void Strip::resetPeaks()
{
track->resetPeaks();
}
//---------------------------------------------------------
// recordToggled
//---------------------------------------------------------
void Strip::recordToggled(bool val)
{
if (track->type() == Track::AUDIO_OUTPUT) {
if (val && track->recordFlag() == false) {
muse->bounceToFile((AudioOutput*)track);
}
audio->msgSetRecord((AudioOutput*)track, val);
if (!((AudioOutput*)track)->recFile())
record->setOn(false);
return;
}
song->setRecordFlag(track, val);
}
//---------------------------------------------------------
// heartBeat
//---------------------------------------------------------
void Strip::heartBeat()
{
}
//---------------------------------------------------------
// setLabelFont
//---------------------------------------------------------
// Added by Tim. p3.3.9
void Strip::setLabelFont()
{
// Use the new font #6 I created just for these labels (so far).
// Set the label's font.
label->setFont(config.fonts[6]);
// Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size.
autoAdjustFontSize(label, label->text(), false, true, config.fonts[6].pointSize(), 5);
}
//---------------------------------------------------------
// setLabelText
//---------------------------------------------------------
void Strip::setLabelText()
{
QColor c;
switch(track->type()) {
case Track::AUDIO_OUTPUT:
c = Qt::green;
break;
case Track::AUDIO_GROUP:
c = Qt::yellow;
break;
case Track::AUDIO_AUX:
c = QColor(120, 255, 255); // Light blue
break;
case Track::WAVE:
c = Qt::magenta;
break;
case Track::AUDIO_INPUT:
c = Qt::red;
break;
case Track::AUDIO_SOFTSYNTH:
c = QColor(255, 130, 0); // Med orange
break;
case Track::MIDI:
case Track::DRUM:
{
c = QColor(0, 160, 255); // Med blue
}
break;
default:
return;
}
label->setText(track->name());
QPalette palette;
palette.setColor(label->backgroundRole(), c);
//palette.setColor(QPalette::Window, c);
label->setPalette(palette);
}
//---------------------------------------------------------
// muteToggled
//---------------------------------------------------------
void Strip::muteToggled(bool val)
{
track->setMute(val);
song->update(SC_MUTE);
}
//---------------------------------------------------------
// soloToggled
//---------------------------------------------------------
void Strip::soloToggled(bool val)
{
audio->msgSetSolo(track, val);
song->update(SC_SOLO);
}
//---------------------------------------------------------
// Strip
// create mixer strip
//---------------------------------------------------------
Strip::Strip(QWidget* parent, Track* t)
: QFrame(parent)
{
setAttribute(Qt::WA_DeleteOnClose);
iR = 0;
oR = 0;
setBackgroundRole(QPalette::Mid);
setFrameStyle(Panel | Raised);
setLineWidth(2);
useSoloIconSet2 = false;
track = t;
meter[0] = 0;
meter[1] = 0;
setFixedWidth(STRIP_WIDTH);
//layout = new QVBoxLayout(this);
layout = new QVBoxLayout();
layout->setMargin(3);
setLayout(layout);
//---------------------------------------------
// label
//---------------------------------------------
label = new QLabel(this);
// Moved by Tim. p3.3.9
//setLabelText();
//label->setFont(config.fonts[1]);
//printf("Strip::Strip w:%d frw:%d layoutmarg:%d lx:%d ly:%d lw:%d lh:%d\n", STRIP_WIDTH, frameWidth(), layout->margin(), label->x(), label->y(), label->width(), label->height());
// Tested: The label's width is 100. It does not become STRIP_WIDTH - 2*layout->margin
// until the mixer is shown in MusE::showMixer.
// Therefore 'fake' set the size of the label now.
// Added by Tim. p3.3.9
//label->setGeometry(label->x(), label->y(), STRIP_WIDTH - 2*frameWidth() - 2*layout->margin(), label->height());
label->setGeometry(label->x(), label->y(), STRIP_WIDTH - 2*layout->margin(), label->height());
// Unfortunately for the mixer labels, QLabel doesn't support the BreakAnywhere flag.
// Changed by Tim. p3.3.9
//label->setAlignment(AlignCenter);
//label->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
// MusE-2 Tested: TextWrapAnywhere actually works, but in fact it takes precedence
// over word wrap, so I found it is not really desirable. Maybe with a user setting...
//label->setAlignment(Qt::AlignCenter | Qt::TextWordWrap | Qt::TextWrapAnywhere);
label->setAlignment(Qt::AlignCenter | Qt::TextWordWrap);
label->setWordWrap(true);
label->setAutoFillBackground(true);
label->setLineWidth(2);
label->setFrameStyle(Sunken | StyledPanel);
//label->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum));
label->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
// Added by Tim. p3.3.9
setLabelText();
setLabelFont();
layout->addWidget(label);
}
//---------------------------------------------------------
// Strip
//---------------------------------------------------------
Strip::~Strip()
{
}
//---------------------------------------------------------
// setAutomationType
//---------------------------------------------------------
void Strip::setAutomationType(int t,int)
{
track->setAutomationType(AutomationType(t));
song->update(SC_AUTOMATION);
}
|