34 |
// Needed for lroundf() |
// Needed for lroundf() |
35 |
#include <math.h> |
#include <math.h> |
36 |
|
|
|
namespace QSampler { |
|
|
|
|
37 |
#ifndef CONFIG_ROUND |
#ifndef CONFIG_ROUND |
38 |
static inline long lroundf ( float x ) |
static inline long lroundf ( float x ) |
39 |
{ |
{ |
44 |
} |
} |
45 |
#endif |
#endif |
46 |
|
|
47 |
|
|
48 |
|
namespace QSampler { |
49 |
|
|
50 |
|
// Channel strip activation/selection. |
51 |
|
ChannelStrip *ChannelStrip::g_pSelectedStrip = NULL; |
52 |
|
|
53 |
|
|
54 |
ChannelStrip::ChannelStrip ( QWidget* pParent, Qt::WindowFlags wflags ) |
ChannelStrip::ChannelStrip ( QWidget* pParent, Qt::WindowFlags wflags ) |
55 |
: QWidget(pParent, wflags) |
: QWidget(pParent, wflags) |
56 |
{ |
{ |
82 |
QObject::connect(m_ui.ChannelEditPushButton, |
QObject::connect(m_ui.ChannelEditPushButton, |
83 |
SIGNAL(clicked()), |
SIGNAL(clicked()), |
84 |
SLOT(channelEdit())); |
SLOT(channelEdit())); |
85 |
|
|
86 |
|
setSelected(false); |
87 |
} |
} |
88 |
|
|
89 |
|
|
90 |
ChannelStrip::~ChannelStrip (void) |
ChannelStrip::~ChannelStrip (void) |
91 |
{ |
{ |
92 |
|
setSelected(false); |
93 |
|
|
94 |
// Destroy existing channel descriptor. |
// Destroy existing channel descriptor. |
95 |
if (m_pChannel) |
if (m_pChannel) |
96 |
delete m_pChannel; |
delete m_pChannel; |
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 |
|
|