28 |
#include <QDragEnterEvent> |
#include <QDragEnterEvent> |
29 |
#include <QUrl> |
#include <QUrl> |
30 |
|
|
|
#include <math.h> |
|
|
|
|
31 |
// Channel status/usage usage limit control. |
// Channel status/usage usage limit control. |
32 |
#define QSAMPLER_ERROR_LIMIT 3 |
#define QSAMPLER_ERROR_LIMIT 3 |
33 |
|
|
34 |
|
// Needed for lroundf() |
35 |
|
#include <math.h> |
36 |
|
|
37 |
|
#ifndef CONFIG_ROUND |
38 |
|
static inline long lroundf ( float x ) |
39 |
|
{ |
40 |
|
if (x >= 0.0f) |
41 |
|
return long(x + 0.5f); |
42 |
|
else |
43 |
|
return long(x - 0.5f); |
44 |
|
} |
45 |
|
#endif |
46 |
|
|
47 |
|
|
48 |
namespace QSampler { |
namespace QSampler { |
49 |
|
|
50 |
ChannelStrip::ChannelStrip(QWidget* parent, Qt::WFlags f) : QWidget(parent, f) { |
// Channel strip activation/selection. |
51 |
ui.setupUi(this); |
ChannelStrip *ChannelStrip::g_pSelectedStrip = NULL; |
52 |
|
|
53 |
|
|
54 |
|
ChannelStrip::ChannelStrip ( QWidget* pParent, Qt::WindowFlags wflags ) |
55 |
|
: QWidget(pParent, wflags) |
56 |
|
{ |
57 |
|
m_ui.setupUi(this); |
58 |
|
|
59 |
// Initialize locals. |
// Initialize locals. |
60 |
m_pChannel = NULL; |
m_pChannel = NULL; |
61 |
m_iDirtyChange = 0; |
m_iDirtyChange = 0; |
62 |
m_iErrorCount = 0; |
m_iErrorCount = 0; |
63 |
|
|
64 |
// Try to restore normal window positioning. |
// Try to restore normal window positioning. |
65 |
adjustSize(); |
adjustSize(); |
66 |
|
|
67 |
QObject::connect(ui.ChannelSetupPushButton, |
QObject::connect(m_ui.ChannelSetupPushButton, |
68 |
SIGNAL(clicked()), |
SIGNAL(clicked()), |
69 |
SLOT(channelSetup())); |
SLOT(channelSetup())); |
70 |
QObject::connect(ui.ChannelMutePushButton, |
QObject::connect(m_ui.ChannelMutePushButton, |
71 |
SIGNAL(toggled(bool)), |
SIGNAL(toggled(bool)), |
72 |
SLOT(channelMute(bool))); |
SLOT(channelMute(bool))); |
73 |
QObject::connect(ui.ChannelSoloPushButton, |
QObject::connect(m_ui.ChannelSoloPushButton, |
74 |
SIGNAL(toggled(bool)), |
SIGNAL(toggled(bool)), |
75 |
SLOT(channelSolo(bool))); |
SLOT(channelSolo(bool))); |
76 |
QObject::connect(ui.VolumeSlider, |
QObject::connect(m_ui.VolumeSlider, |
77 |
SIGNAL(valueChanged(int)), |
SIGNAL(valueChanged(int)), |
78 |
SLOT(volumeChanged(int))); |
SLOT(volumeChanged(int))); |
79 |
QObject::connect(ui.VolumeSpinBox, |
QObject::connect(m_ui.VolumeSpinBox, |
80 |
SIGNAL(valueChanged(int)), |
SIGNAL(valueChanged(int)), |
81 |
SLOT(volumeChanged(int))); |
SLOT(volumeChanged(int))); |
82 |
QObject::connect(ui.ChannelEditPushButton, |
QObject::connect(m_ui.ChannelEditPushButton, |
83 |
SIGNAL(clicked()), |
SIGNAL(clicked()), |
84 |
SLOT(channelEdit())); |
SLOT(channelEdit())); |
85 |
|
|
86 |
|
setSelected(false); |
87 |
} |
} |
88 |
|
|
89 |
ChannelStrip::~ChannelStrip() { |
|
90 |
// Destroy existing channel descriptor. |
ChannelStrip::~ChannelStrip (void) |
91 |
if (m_pChannel) |
{ |
92 |
delete m_pChannel; |
setSelected(false); |
93 |
m_pChannel = NULL; |
|
94 |
|
// Destroy existing channel descriptor. |
95 |
|
if (m_pChannel) |
96 |
|
delete m_pChannel; |
97 |
|
m_pChannel = NULL; |
98 |
} |
} |
99 |
|
|
100 |
|
|
156 |
// Channel strip setup formal initializer. |
// Channel strip setup formal initializer. |
157 |
void ChannelStrip::setup ( qsamplerChannel *pChannel ) |
void ChannelStrip::setup ( qsamplerChannel *pChannel ) |
158 |
{ |
{ |
159 |
// Destroy any previous channel descriptor; |
// Destroy any previous channel descriptor; |
160 |
// (remember that once setup we own it!) |
// (remember that once setup we own it!) |
161 |
if (m_pChannel) |
if (m_pChannel) |
162 |
delete m_pChannel; |
delete m_pChannel; |
163 |
|
|
164 |
// Set the new one... |
// Set the new one... |
165 |
m_pChannel = pChannel; |
m_pChannel = pChannel; |
166 |
|
|
167 |
// Stabilize this around. |
// Stabilize this around. |
168 |
updateChannelInfo(); |
updateChannelInfo(); |
169 |
|
|
170 |
// We'll accept drops from now on... |
// We'll accept drops from now on... |
171 |
if (m_pChannel) |
if (m_pChannel) |
172 |
setAcceptDrops(true); |
setAcceptDrops(true); |
173 |
} |
} |
174 |
|
|
175 |
|
|
176 |
// Channel secriptor accessor. |
// Channel secriptor accessor. |
177 |
qsamplerChannel *ChannelStrip::channel (void) |
qsamplerChannel *ChannelStrip::channel (void) const |
178 |
{ |
{ |
179 |
return m_pChannel; |
return m_pChannel; |
180 |
} |
} |
181 |
|
|
182 |
|
|
183 |
// Messages view font accessors. |
// Messages view font accessors. |
184 |
QFont ChannelStrip::displayFont (void) |
QFont ChannelStrip::displayFont (void) const |
185 |
{ |
{ |
186 |
return ui.EngineNameTextLabel->font(); |
return m_ui.EngineNameTextLabel->font(); |
187 |
} |
} |
188 |
|
|
189 |
void ChannelStrip::setDisplayFont ( const QFont & font ) |
void ChannelStrip::setDisplayFont ( const QFont & font ) |
190 |
{ |
{ |
191 |
ui.EngineNameTextLabel->setFont(font); |
m_ui.EngineNameTextLabel->setFont(font); |
192 |
ui.MidiPortChannelTextLabel->setFont(font); |
m_ui.MidiPortChannelTextLabel->setFont(font); |
193 |
ui.InstrumentNameTextLabel->setFont(font); |
m_ui.InstrumentNameTextLabel->setFont(font); |
194 |
ui.InstrumentStatusTextLabel->setFont(font); |
m_ui.InstrumentStatusTextLabel->setFont(font); |
195 |
} |
} |
196 |
|
|
197 |
|
|
200 |
{ |
{ |
201 |
QPalette pal; |
QPalette pal; |
202 |
pal.setColor(QPalette::Foreground, Qt::yellow); |
pal.setColor(QPalette::Foreground, Qt::yellow); |
203 |
ui.EngineNameTextLabel->setPalette(pal); |
m_ui.EngineNameTextLabel->setPalette(pal); |
204 |
ui.MidiPortChannelTextLabel->setPalette(pal); |
m_ui.MidiPortChannelTextLabel->setPalette(pal); |
205 |
pal.setColor(QPalette::Foreground, Qt::green); |
pal.setColor(QPalette::Foreground, Qt::green); |
206 |
if (bDisplayEffect) { |
if (bDisplayEffect) { |
207 |
QPixmap pm(":/icons/displaybg1.png"); |
QPixmap pm(":/icons/displaybg1.png"); |
209 |
} else { |
} else { |
210 |
pal.setColor(QPalette::Background, Qt::black); |
pal.setColor(QPalette::Background, Qt::black); |
211 |
} |
} |
212 |
ui.ChannelInfoFrame->setPalette(pal); |
m_ui.ChannelInfoFrame->setPalette(pal); |
213 |
ui.StreamVoiceCountTextLabel->setPalette(pal); |
m_ui.StreamVoiceCountTextLabel->setPalette(pal); |
214 |
} |
} |
215 |
|
|
216 |
|
|
217 |
// Maximum volume slider accessors. |
// Maximum volume slider accessors. |
218 |
void ChannelStrip::setMaxVolume ( int iMaxVolume ) |
void ChannelStrip::setMaxVolume ( int iMaxVolume ) |
219 |
{ |
{ |
220 |
m_iDirtyChange++; |
m_iDirtyChange++; |
221 |
ui.VolumeSlider->setRange(0, iMaxVolume); |
m_ui.VolumeSlider->setRange(0, iMaxVolume); |
222 |
ui.VolumeSpinBox->setRange(0, iMaxVolume); |
m_ui.VolumeSpinBox->setRange(0, iMaxVolume); |
223 |
m_iDirtyChange--; |
m_iDirtyChange--; |
224 |
} |
} |
225 |
|
|
226 |
|
|
310 |
|
|
311 |
// Instrument name... |
// Instrument name... |
312 |
if (m_pChannel->instrumentName().isEmpty()) { |
if (m_pChannel->instrumentName().isEmpty()) { |
313 |
if (m_pChannel->instrumentStatus() >= 0) |
if (m_pChannel->instrumentStatus() >= 0) { |
314 |
ui.InstrumentNameTextLabel->setText(' ' + qsamplerChannel::loadingInstrument()); |
m_ui.InstrumentNameTextLabel->setText( |
315 |
else |
' ' + qsamplerChannel::loadingInstrument()); |
316 |
ui.InstrumentNameTextLabel->setText(' ' + qsamplerChannel::noInstrumentName()); |
} else { |
317 |
} else |
m_ui.InstrumentNameTextLabel->setText( |
318 |
ui.InstrumentNameTextLabel->setText(' ' + m_pChannel->instrumentName()); |
' ' + qsamplerChannel::noInstrumentName()); |
319 |
|
} |
320 |
|
} else { |
321 |
|
m_ui.InstrumentNameTextLabel->setText( |
322 |
|
' ' + m_pChannel->instrumentName()); |
323 |
|
} |
324 |
|
|
325 |
return true; |
return true; |
326 |
} |
} |
329 |
// Do the dirty volume change. |
// Do the dirty volume change. |
330 |
bool ChannelStrip::updateChannelVolume (void) |
bool ChannelStrip::updateChannelVolume (void) |
331 |
{ |
{ |
332 |
if (m_pChannel == NULL) |
if (m_pChannel == NULL) |
333 |
return false; |
return false; |
|
|
|
|
// Convert... |
|
|
#ifdef CONFIG_ROUND |
|
|
int iVolume = (int) ::round(100.0 * m_pChannel->volume()); |
|
|
#else |
|
|
double fIPart = 0.0; |
|
|
double fFPart = ::modf(100.0 * m_pChannel->volume(), &fIPart); |
|
|
int iVolume = (int) fIPart; |
|
|
if (fFPart >= +0.5) |
|
|
iVolume++; |
|
|
else |
|
|
if (fFPart <= -0.5) |
|
|
iVolume--; |
|
|
#endif |
|
334 |
|
|
335 |
// And clip... |
// Convert... |
336 |
if (iVolume < 0) |
int iVolume = ::lroundf(100.0f * m_pChannel->volume()); |
337 |
iVolume = 0; |
// And clip... |
338 |
|
if (iVolume < 0) |
339 |
// Flag it here, to avoid infinite recursion. |
iVolume = 0; |
340 |
m_iDirtyChange++; |
|
341 |
ui.VolumeSlider->setValue(iVolume); |
// Flag it here, to avoid infinite recursion. |
342 |
ui.VolumeSpinBox->setValue(iVolume); |
m_iDirtyChange++; |
343 |
m_iDirtyChange--; |
m_ui.VolumeSlider->setValue(iVolume); |
344 |
|
m_ui.VolumeSpinBox->setValue(iVolume); |
345 |
|
m_iDirtyChange--; |
346 |
|
|
347 |
return true; |
return true; |
348 |
} |
} |
349 |
|
|
350 |
|
|
351 |
// Update whole channel info state. |
// Update whole channel info state. |
352 |
bool ChannelStrip::updateChannelInfo (void) |
bool ChannelStrip::updateChannelInfo (void) |
353 |
{ |
{ |
354 |
if (m_pChannel == NULL) |
if (m_pChannel == NULL) |
355 |
return false; |
return false; |
356 |
|
|
357 |
// Check for error limit/recycle... |
// Check for error limit/recycle... |
358 |
if (m_iErrorCount > QSAMPLER_ERROR_LIMIT) |
if (m_iErrorCount > QSAMPLER_ERROR_LIMIT) |
359 |
return true; |
return true; |
360 |
|
|
361 |
// Update strip caption. |
// Update strip caption. |
362 |
QString sText = m_pChannel->channelName(); |
QString sText = m_pChannel->channelName(); |
363 |
setWindowTitle(sText); |
setWindowTitle(sText); |
364 |
ui.ChannelSetupPushButton->setText(sText); |
m_ui.ChannelSetupPushButton->setText('&' + sText); |
365 |
|
|
366 |
// Check if we're up and connected. |
// Check if we're up and connected. |
367 |
MainForm* pMainForm = MainForm::getInstance(); |
MainForm* pMainForm = MainForm::getInstance(); |
368 |
if (pMainForm->client() == NULL) |
if (pMainForm->client() == NULL) |
369 |
return false; |
return false; |
370 |
|
|
371 |
// Read actual channel information. |
// Read actual channel information. |
372 |
m_pChannel->updateChannelInfo(); |
m_pChannel->updateChannelInfo(); |
373 |
|
|
374 |
// Engine name... |
// Engine name... |
375 |
if (m_pChannel->engineName().isEmpty()) |
if (m_pChannel->engineName().isEmpty()) { |
376 |
ui.EngineNameTextLabel->setText(' ' + qsamplerChannel::noEngineName()); |
m_ui.EngineNameTextLabel->setText( |
377 |
else |
' ' + qsamplerChannel::noEngineName()); |
378 |
ui.EngineNameTextLabel->setText(' ' + m_pChannel->engineName()); |
} else { |
379 |
|
m_ui.EngineNameTextLabel->setText( |
380 |
|
' ' + m_pChannel->engineName()); |
381 |
|
} |
382 |
|
|
383 |
// Instrument name... |
// Instrument name... |
384 |
updateInstrumentName(false); |
updateInstrumentName(false); |
385 |
|
|
386 |
// MIDI Port/Channel... |
// MIDI Port/Channel... |
387 |
QString sMidiPortChannel = QString::number(m_pChannel->midiPort()) + " / "; |
QString sMidiPortChannel = QString::number(m_pChannel->midiPort()) + " / "; |
388 |
if (m_pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) |
if (m_pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) |
389 |
sMidiPortChannel += tr("All"); |
sMidiPortChannel += tr("All"); |
390 |
else |
else |
391 |
sMidiPortChannel += QString::number(m_pChannel->midiChannel() + 1); |
sMidiPortChannel += QString::number(m_pChannel->midiChannel() + 1); |
392 |
ui.MidiPortChannelTextLabel->setText(sMidiPortChannel); |
m_ui.MidiPortChannelTextLabel->setText(sMidiPortChannel); |
393 |
|
|
394 |
// Common palette... |
// Common palette... |
395 |
QPalette pal; |
QPalette pal; |
396 |
const QColor& rgbFore = pal.color(QPalette::Foreground); |
const QColor& rgbFore = pal.color(QPalette::Foreground); |
397 |
|
|
398 |
// Instrument status... |
// Instrument status... |
399 |
int iInstrumentStatus = m_pChannel->instrumentStatus(); |
int iInstrumentStatus = m_pChannel->instrumentStatus(); |
400 |
if (iInstrumentStatus < 0) { |
if (iInstrumentStatus < 0) { |
401 |
pal.setColor(QPalette::Foreground, Qt::red); |
pal.setColor(QPalette::Foreground, Qt::red); |
402 |
ui.InstrumentStatusTextLabel->setPalette(pal); |
m_ui.InstrumentStatusTextLabel->setPalette(pal); |
403 |
ui.InstrumentStatusTextLabel->setText(tr("ERR%1").arg(iInstrumentStatus)); |
m_ui.InstrumentStatusTextLabel->setText( |
404 |
m_iErrorCount++; |
tr("ERR%1").arg(iInstrumentStatus)); |
405 |
return false; |
m_iErrorCount++; |
406 |
} |
return false; |
407 |
// All seems normal... |
} |
408 |
|
// All seems normal... |
409 |
pal.setColor(QPalette::Foreground, |
pal.setColor(QPalette::Foreground, |
410 |
iInstrumentStatus < 100 ? Qt::yellow : Qt::green); |
iInstrumentStatus < 100 ? Qt::yellow : Qt::green); |
411 |
ui.InstrumentStatusTextLabel->setPalette(pal); |
m_ui.InstrumentStatusTextLabel->setPalette(pal); |
412 |
ui.InstrumentStatusTextLabel->setText(QString::number(iInstrumentStatus) + '%'); |
m_ui.InstrumentStatusTextLabel->setText( |
413 |
m_iErrorCount = 0; |
QString::number(iInstrumentStatus) + '%'); |
414 |
|
m_iErrorCount = 0; |
415 |
|
|
416 |
#ifdef CONFIG_MUTE_SOLO |
#ifdef CONFIG_MUTE_SOLO |
417 |
// Mute/Solo button state coloring... |
// Mute/Solo button state coloring... |
418 |
bool bMute = m_pChannel->channelMute(); |
bool bMute = m_pChannel->channelMute(); |
419 |
const QColor& rgbButton = pal.color(QPalette::Button); |
const QColor& rgbButton = pal.color(QPalette::Button); |
420 |
pal.setColor(QPalette::Foreground, rgbFore); |
pal.setColor(QPalette::Foreground, rgbFore); |
421 |
pal.setColor(QPalette::Button, bMute ? Qt::yellow : rgbButton); |
pal.setColor(QPalette::Button, bMute ? Qt::yellow : rgbButton); |
422 |
ui.ChannelMutePushButton->setPalette(pal); |
m_ui.ChannelMutePushButton->setPalette(pal); |
423 |
ui.ChannelMutePushButton->setDown(bMute); |
m_ui.ChannelMutePushButton->setDown(bMute); |
424 |
bool bSolo = m_pChannel->channelSolo(); |
bool bSolo = m_pChannel->channelSolo(); |
425 |
pal.setColor(QPalette::Button, bSolo ? Qt::cyan : rgbButton); |
pal.setColor(QPalette::Button, bSolo ? Qt::cyan : rgbButton); |
426 |
ui.ChannelSoloPushButton->setPalette(pal); |
m_ui.ChannelSoloPushButton->setPalette(pal); |
427 |
ui.ChannelSoloPushButton->setDown(bSolo); |
m_ui.ChannelSoloPushButton->setDown(bSolo); |
428 |
#else |
#else |
429 |
ui.ChannelMutePushButton->setEnabled(false); |
m_ui.ChannelMutePushButton->setEnabled(false); |
430 |
ui.ChannelSoloPushButton->setEnabled(false); |
m_ui.ChannelSoloPushButton->setEnabled(false); |
431 |
#endif |
#endif |
432 |
|
|
433 |
// And update the both GUI volume elements; |
// And update the both GUI volume elements; |
434 |
// return success if, and only if, intrument is fully loaded... |
// return success if, and only if, intrument is fully loaded... |
435 |
return updateChannelVolume() && (iInstrumentStatus == 100); |
return updateChannelVolume() && (iInstrumentStatus == 100); |
436 |
} |
} |
437 |
|
|
438 |
|
|
439 |
// Update whole channel usage state. |
// Update whole channel usage state. |
440 |
bool ChannelStrip::updateChannelUsage (void) |
bool ChannelStrip::updateChannelUsage (void) |
441 |
{ |
{ |
442 |
if (m_pChannel == NULL) |
if (m_pChannel == NULL) |
443 |
return false; |
return false; |
444 |
|
|
445 |
MainForm *pMainForm = MainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
446 |
if (pMainForm->client() == NULL) |
if (pMainForm->client() == NULL) |
448 |
|
|
449 |
// This only makes sense on fully loaded channels... |
// This only makes sense on fully loaded channels... |
450 |
if (m_pChannel->instrumentStatus() < 100) |
if (m_pChannel->instrumentStatus() < 100) |
451 |
return false; |
return false; |
452 |
|
|
453 |
// Get current channel voice count. |
// Get current channel voice count. |
454 |
int iVoiceCount = ::lscp_get_channel_voice_count(pMainForm->client(), m_pChannel->channelID()); |
int iVoiceCount = ::lscp_get_channel_voice_count( |
455 |
// Get current stream count. |
pMainForm->client(), m_pChannel->channelID()); |
456 |
int iStreamCount = ::lscp_get_channel_stream_count(pMainForm->client(), m_pChannel->channelID()); |
// Get current stream count. |
457 |
// Get current channel buffer fill usage. |
int iStreamCount = ::lscp_get_channel_stream_count( |
458 |
// As benno has suggested this is the percentage usage |
pMainForm->client(), m_pChannel->channelID()); |
459 |
// of the least filled buffer stream... |
// Get current channel buffer fill usage. |
460 |
int iStreamUsage = ::lscp_get_channel_stream_usage(pMainForm->client(), m_pChannel->channelID());; |
// As benno has suggested this is the percentage usage |
461 |
|
// of the least filled buffer stream... |
462 |
// Update the GUI elements... |
int iStreamUsage = ::lscp_get_channel_stream_usage( |
463 |
ui.StreamUsageProgressBar->setValue(iStreamUsage); |
pMainForm->client(), m_pChannel->channelID());; |
464 |
ui.StreamVoiceCountTextLabel->setText(QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount)); |
|
465 |
|
// Update the GUI elements... |
466 |
|
m_ui.StreamUsageProgressBar->setValue(iStreamUsage); |
467 |
|
m_ui.StreamVoiceCountTextLabel->setText( |
468 |
|
QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount)); |
469 |
|
|
470 |
// We're clean. |
// We're clean. |
471 |
return true; |
return true; |
472 |
} |
} |
473 |
|
|
474 |
|
|
475 |
// Volume change slot. |
// Volume change slot. |
476 |
void ChannelStrip::volumeChanged ( int iVolume ) |
void ChannelStrip::volumeChanged ( int iVolume ) |
477 |
{ |
{ |
478 |
if (m_pChannel == NULL) |
if (m_pChannel == NULL) |
479 |
return; |
return; |
480 |
|
|
481 |
|
// Avoid recursion. |
482 |
|
if (m_iDirtyChange > 0) |
483 |
|
return; |
484 |
|
|
485 |
// Avoid recursion. |
// Convert and clip. |
486 |
if (m_iDirtyChange > 0) |
float fVolume = (float) iVolume / 100.0f; |
487 |
return; |
if (fVolume < 0.001f) |
488 |
|
fVolume = 0.0f; |
489 |
// Convert and clip. |
|
490 |
float fVolume = (float) iVolume / 100.0; |
// Update the GUI elements. |
491 |
if (fVolume < 0.001) |
if (m_pChannel->setVolume(fVolume)) { |
492 |
fVolume = 0.0; |
updateChannelVolume(); |
493 |
|
emit channelChanged(this); |
494 |
// Update the GUI elements. |
} |
|
if (m_pChannel->setVolume(fVolume)) { |
|
|
updateChannelVolume(); |
|
|
emit channelChanged(this); |
|
|
} |
|
495 |
} |
} |
496 |
|
|
497 |
|
|
498 |
// Context menu event handler. |
// Context menu event handler. |
499 |
void ChannelStrip::contextMenuEvent( QContextMenuEvent *pEvent ) |
void ChannelStrip::contextMenuEvent( QContextMenuEvent *pEvent ) |
500 |
{ |
{ |
501 |
if (m_pChannel == NULL) |
if (m_pChannel == NULL) |
502 |
return; |
return; |
503 |
|
|
504 |
// We'll just show up the main form's edit menu (thru qsamplerChannel). |
// We'll just show up the main form's edit menu (thru qsamplerChannel). |
505 |
m_pChannel->contextMenuEvent(pEvent); |
m_pChannel->contextMenuEvent(pEvent); |
506 |
} |
} |
507 |
|
|
508 |
|
|
512 |
m_iErrorCount = 0; |
m_iErrorCount = 0; |
513 |
} |
} |
514 |
|
|
515 |
|
|
516 |
|
// Channel strip activation/selection. |
517 |
|
void ChannelStrip::setSelected ( bool bSelected ) |
518 |
|
{ |
519 |
|
if (bSelected) { |
520 |
|
if (g_pSelectedStrip == this) |
521 |
|
return; |
522 |
|
if (g_pSelectedStrip) |
523 |
|
g_pSelectedStrip->setSelected(false); |
524 |
|
g_pSelectedStrip = this; |
525 |
|
} else { |
526 |
|
if (g_pSelectedStrip == this) |
527 |
|
g_pSelectedStrip = NULL; |
528 |
|
} |
529 |
|
|
530 |
|
QPalette pal; |
531 |
|
if (bSelected) { |
532 |
|
const QColor& color = pal.midlight().color(); |
533 |
|
pal.setColor(QPalette::Background, color.dark(150)); |
534 |
|
pal.setColor(QPalette::Foreground, color.light(150)); |
535 |
|
} |
536 |
|
QWidget::setPalette(pal); |
537 |
|
} |
538 |
|
|
539 |
|
|
540 |
|
bool ChannelStrip::isSelected (void) const |
541 |
|
{ |
542 |
|
return (this == g_pSelectedStrip); |
543 |
|
} |
544 |
|
|
545 |
|
|
546 |
} // namespace QSampler |
} // namespace QSampler |
547 |
|
|
548 |
|
|