/[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 1514 by capela, Fri Nov 23 10:51:37 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 58  ChannelStrip::ChannelStrip ( QWidget* pP Line 63  ChannelStrip::ChannelStrip ( QWidget* pP
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()),
# Line 503  void ChannelStrip::resetErrorCount (void Line 509  void ChannelStrip::resetErrorCount (void
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    

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

  ViewVC Help
Powered by ViewVC