diff --git a/ChangeLog b/ChangeLog index 610e16a80..ce00ba014 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,13 @@ * plugins/stereo_matrix/stereomatrix_controls.cpp: Allow knobs to invert phase as well + * include/pixmap_button.h: + * src/gui/widgets/pixmap_button.cpp: + Make button pixmap "activate" on click + + * src/gui/widgets/automatable_button.cpp: + Noted bug in automatable button + 2008-05-14 Tobias Doerffel * include/project_renderer.h: diff --git a/include/pixmap_button.h b/include/pixmap_button.h index 955c38cc3..0f6c45689 100644 --- a/include/pixmap_button.h +++ b/include/pixmap_button.h @@ -50,12 +50,14 @@ signals: protected: virtual void paintEvent( QPaintEvent * _pe ); virtual void mousePressEvent( QMouseEvent * _me ); + virtual void mouseReleaseEvent( QMouseEvent * _me ); virtual void mouseDoubleClickEvent( QMouseEvent * _me ); private: QPixmap m_activePixmap; QPixmap m_inactivePixmap; + bool m_pressed; } ; diff --git a/src/gui/widgets/automatable_button.cpp b/src/gui/widgets/automatable_button.cpp index 3651bcced..4962f5d43 100644 --- a/src/gui/widgets/automatable_button.cpp +++ b/src/gui/widgets/automatable_button.cpp @@ -146,6 +146,8 @@ void automatableButton::mousePressEvent( QMouseEvent * _me ) void automatableButton::mouseReleaseEvent( QMouseEvent * _me ) { + // TODO: Fix this. for example: LeftDown, RightDown, Both Released causes two events + // or - pressing down then releasing outside of the bbox causes click event. emit clicked(); } diff --git a/src/gui/widgets/pixmap_button.cpp b/src/gui/widgets/pixmap_button.cpp index 99604d74e..a34faef6e 100644 --- a/src/gui/widgets/pixmap_button.cpp +++ b/src/gui/widgets/pixmap_button.cpp @@ -38,7 +38,8 @@ pixmapButton::pixmapButton( QWidget * _parent, const QString & _name ) : automatableButton( _parent, _name ), m_activePixmap(), - m_inactivePixmap() + m_inactivePixmap(), + m_pressed( FALSE ) { setActiveGraphic( embed::getIconPixmap( "led_yellow" ) ); setInactiveGraphic( embed::getIconPixmap( "led_off" ), FALSE ); @@ -58,7 +59,7 @@ void pixmapButton::paintEvent( QPaintEvent * ) { QPainter p( this ); - if( model()->value() ) + if( model()->value() || m_pressed ) { if( !m_activePixmap.isNull() ) { @@ -85,12 +86,27 @@ void pixmapButton::mousePressEvent( QMouseEvent * _me ) } else { + // Show pressing graphics if this isn't checkable + if( !isCheckable() ) + { + m_pressed = TRUE; + update(); + } + automatableButton::mousePressEvent( _me ); } } +void pixmapButton::mouseReleaseEvent( QMouseEvent * _me ) +{ + automatableButton::mouseReleaseEvent( _me ); - + if( !isCheckable() ) + { + m_pressed = FALSE; + update(); + } +} void pixmapButton::mouseDoubleClickEvent( QMouseEvent * _me ) {