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 |
{ |
{ |
63 |
|
|
64 |
// Try to restore normal window positioning. |
// Try to restore normal window positioning. |
65 |
adjustSize(); |
adjustSize(); |
66 |
|
setSelected(false); |
67 |
|
|
68 |
QObject::connect(m_ui.ChannelSetupPushButton, |
QObject::connect(m_ui.ChannelSetupPushButton, |
69 |
SIGNAL(clicked()), |
SIGNAL(clicked()), |
509 |
m_iErrorCount = 0; |
m_iErrorCount = 0; |
510 |
} |
} |
511 |
|
|
512 |
|
|
513 |
|
// Channel strip activation/selection. |
514 |
|
void ChannelStrip::setSelected ( bool bSelected ) |
515 |
|
{ |
516 |
|
if (bSelected) { |
517 |
|
if (g_pSelectedStrip == this) |
518 |
|
return; |
519 |
|
if (g_pSelectedStrip) |
520 |
|
g_pSelectedStrip->setSelected(false); |
521 |
|
g_pSelectedStrip = this; |
522 |
|
} else { |
523 |
|
if (g_pSelectedStrip == this) |
524 |
|
g_pSelectedStrip = NULL; |
525 |
|
} |
526 |
|
|
527 |
|
QPalette pal; |
528 |
|
if (bSelected) { |
529 |
|
const QColor& color = pal.midlight().color(); |
530 |
|
pal.setColor(QPalette::Background, color.dark(150)); |
531 |
|
pal.setColor(QPalette::Foreground, color.light(150)); |
532 |
|
} |
533 |
|
QWidget::setPalette(pal); |
534 |
|
} |
535 |
|
|
536 |
|
|
537 |
|
bool ChannelStrip::isSelected (void) const |
538 |
|
{ |
539 |
|
return (this == g_pSelectedStrip); |
540 |
|
} |
541 |
|
|
542 |
|
|
543 |
} // namespace QSampler |
} // namespace QSampler |
544 |
|
|
545 |
|
|