/[svn]/qsampler/trunk/src/qsamplerChannelStrip.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerChannelStrip.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1513 by capela, Fri Nov 23 09:32:06 2007 UTC revision 1515 by capela, Fri Nov 23 18:15:33 2007 UTC
# Line 34  Line 34 
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  {  {
# Line 46  static inline long lroundf ( float x ) Line 44  static inline long lroundf ( float x )
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  {  {
# Line 77  ChannelStrip::ChannelStrip ( QWidget* pP Line 82  ChannelStrip::ChannelStrip ( QWidget* pP
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;
# Line 503  void ChannelStrip::resetErrorCount (void Line 512  void ChannelStrip::resetErrorCount (void
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    

Legend:
Removed from v.1513  
changed lines
  Added in v.1515

  ViewVC Help
Powered by ViewVC