Fixed bug in LED-checkbox
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@16 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
17
AUTHORS
17
AUTHORS
@@ -1,15 +1,12 @@
|
||||
Tobias Doerffel
|
||||
<tobydox@users.sourceforge.net>
|
||||
Maintainer, main-development, artwork etc.
|
||||
<tobydox@users.sourceforge.net>
|
||||
Maintainer, main-development, artwork etc.
|
||||
|
||||
Dany McRae
|
||||
<khjklujn@yahoo.com>
|
||||
development
|
||||
Danny McRae
|
||||
<khjklujn@yahoo.com>
|
||||
development
|
||||
|
||||
Sebastian Tilsch
|
||||
<djcompilation@gmx.de>
|
||||
recording of many samples
|
||||
|
||||
|
||||
...may be there're more here in the future...
|
||||
<djcompilation@gmx.de>
|
||||
recording of many samples
|
||||
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
2005-10-12 Dany McRae <khjklujn@yahoo.com>
|
||||
|
||||
* Makefile.am:
|
||||
* include/led_checkbox.h:
|
||||
* src/core/envelope_and_lfo_widget.cpp:
|
||||
* src/widgets/led_checkbox.cpp:
|
||||
inherit ledCheckBox from QWidget instead of QCheckBox since it sometimes
|
||||
caused graphic-errors when running on KDE with Baghira-style...
|
||||
|
||||
2005-10-05 Dany McRae <khjklujn@yahoo.com>
|
||||
|
||||
* resources/note_double_whole.png:
|
||||
|
||||
@@ -59,6 +59,7 @@ lmms_MOC = \
|
||||
./group_box.moc \
|
||||
./knob.moc \
|
||||
./lcd_spinbox.moc \
|
||||
./led_checkbox.moc \
|
||||
./lmms_main_win.moc \
|
||||
./mixer.moc \
|
||||
./name_label.moc \
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.50)
|
||||
AC_INIT(lmms, 0.1.1-cvs20051005, tobydox@users.sourceforge.net)
|
||||
AM_INIT_AUTOMAKE(lmms, 0.1.1-cvs20051005)
|
||||
AC_INIT(lmms, 0.1.1-cvs20051012, tobydox@users.sourceforge.net)
|
||||
AM_INIT_AUTOMAKE(lmms, 0.1.1-cvs20051012)
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QWidget>
|
||||
|
||||
#else
|
||||
|
||||
#include <qcheckbox.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,8 +41,9 @@
|
||||
class QPixmap;
|
||||
|
||||
|
||||
class ledCheckBox : public QCheckBox
|
||||
class ledCheckBox : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum ledColors
|
||||
{
|
||||
@@ -53,37 +54,36 @@ public:
|
||||
ledColors _color = YELLOW );
|
||||
virtual ~ledCheckBox();
|
||||
|
||||
#ifdef QT4
|
||||
inline virtual bool isChecked( void ) const
|
||||
|
||||
inline bool isChecked( void ) const
|
||||
{
|
||||
return( checkState() == Qt::Checked );
|
||||
}
|
||||
#else
|
||||
inline virtual bool isOn( void ) const
|
||||
{
|
||||
return( state() == On );
|
||||
}
|
||||
#endif
|
||||
#ifdef QT4
|
||||
inline virtual void setChecked( bool _on )
|
||||
#else
|
||||
inline virtual void setOn( bool _on )
|
||||
#endif
|
||||
{
|
||||
if( _on != isChecked() )
|
||||
{
|
||||
toggle();
|
||||
}
|
||||
return( m_checked );
|
||||
}
|
||||
|
||||
inline const QString & text( void )
|
||||
{
|
||||
return( m_text );
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
void toggle( void );
|
||||
void setChecked( bool _on );
|
||||
|
||||
protected:
|
||||
virtual void paintEvent( QPaintEvent * _pe );
|
||||
virtual void mousePressEvent( QMouseEvent * _me );
|
||||
|
||||
|
||||
private:
|
||||
QPixmap * m_ledOnPixmap;
|
||||
QPixmap * m_ledOffPixmap;
|
||||
|
||||
bool m_checked;
|
||||
QString m_text;
|
||||
|
||||
signals:
|
||||
void toggled( bool );
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -208,12 +208,12 @@ public:
|
||||
}
|
||||
|
||||
|
||||
inline void pause( void )
|
||||
void pause( void )
|
||||
{
|
||||
m_safetySyncMutex.lock();
|
||||
}
|
||||
|
||||
inline void play( void )
|
||||
void play( void )
|
||||
{
|
||||
m_safetySyncMutex.unlock();
|
||||
}
|
||||
|
||||
@@ -43,9 +43,6 @@
|
||||
#include <qdom.h>
|
||||
#include <qlabel.h>
|
||||
|
||||
#define isChecked isOn
|
||||
#define setChecked setOn
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -341,10 +338,11 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount,
|
||||
"sin_wave_active" ) );
|
||||
m_sinLfoBtn->setInactiveGraphic( embed::getIconPixmap(
|
||||
"sin_wave_inactive" ) );
|
||||
m_sinLfoBtn->setChecked( TRUE );
|
||||
#ifdef QT4
|
||||
m_sinLfoBtn->setChecked( TRUE );
|
||||
m_sinLfoBtn->setWhatsThis(
|
||||
#else
|
||||
m_sinLfoBtn->setOn( TRUE );
|
||||
QWhatsThis::add( m_sinLfoBtn,
|
||||
#endif
|
||||
tr( "Click here if you want a sine-wave for current "
|
||||
@@ -618,19 +616,35 @@ void envelopeAndLFOWidget::loadSettings( const QDomElement & _this )
|
||||
switch( m_lfoShape )
|
||||
{
|
||||
case SIN:
|
||||
#ifdef QT4
|
||||
m_sinLfoBtn->setChecked( TRUE );
|
||||
#else
|
||||
m_sinLfoBtn->setOn( TRUE );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case TRIANGLE:
|
||||
#ifdef QT4
|
||||
m_triangleLfoBtn->setChecked( TRUE );
|
||||
#else
|
||||
m_triangleLfoBtn->setOn( TRUE );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case SAW:
|
||||
#ifdef QT4
|
||||
m_sawLfoBtn->setChecked( TRUE );
|
||||
#else
|
||||
m_sawLfoBtn->setOn( TRUE );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case SQUARE:
|
||||
#ifdef QT4
|
||||
m_sqrLfoBtn->setChecked( TRUE );
|
||||
#else
|
||||
m_sqrLfoBtn->setOn( TRUE );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -298,6 +298,7 @@ float knob::getValue( const QPoint & _p )
|
||||
}
|
||||
return( new_value );
|
||||
}
|
||||
|
||||
return( ( _p.y() - m_origMousePos.y() ) * m_step );
|
||||
}
|
||||
|
||||
@@ -444,13 +445,29 @@ void knob::mousePressEvent( QMouseEvent * _me )
|
||||
|
||||
|
||||
|
||||
//! Emits a valueChanged() signal if necessary
|
||||
void knob::buttonReleased( void )
|
||||
//! Mouse Move Event handler
|
||||
void knob::mouseMoveEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( ( !m_tracking ) || ( value() != m_prevValue ) )
|
||||
if( m_scrollMode == ScrMouse )
|
||||
{
|
||||
emit valueChanged( value() );
|
||||
setPosition( _me->pos() );
|
||||
if( value() != m_prevValue )
|
||||
{
|
||||
emit sliderMoved( value() );
|
||||
if( !configManager::inst()->value( "knobs",
|
||||
"classicalusability").toInt() )
|
||||
{
|
||||
QCursor::setPos( mapToGlobal(
|
||||
m_origMousePos ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
songEditor::inst()->setModified();
|
||||
|
||||
s_textFloat->setText( m_hintTextBeforeValue +
|
||||
QString::number( value() ) +
|
||||
m_hintTextAfterValue );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -493,56 +510,6 @@ void knob::mouseReleaseEvent( QMouseEvent * _me )
|
||||
|
||||
|
||||
|
||||
void knob::setPosition( const QPoint & _p )
|
||||
{
|
||||
if( configManager::inst()->value( "knobs", "classicalusability"
|
||||
).toInt() )
|
||||
{
|
||||
setNewValue( getValue( _p ) - m_mouseOffset, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
setNewValue( m_value - getValue( _p ), 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void knob::setTracking( bool _enable )
|
||||
{
|
||||
m_tracking = _enable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//! Mouse Move Event handler
|
||||
void knob::mouseMoveEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( m_scrollMode == ScrMouse )
|
||||
{
|
||||
setPosition( _me->pos() );
|
||||
if( value() != m_prevValue )
|
||||
{
|
||||
emit sliderMoved( value() );
|
||||
}
|
||||
if( !configManager::inst()->value( "knobs", "classicalusability"
|
||||
).toInt() )
|
||||
{
|
||||
QCursor::setPos( mapToGlobal( m_origMousePos ) );
|
||||
}
|
||||
}
|
||||
songEditor::inst()->setModified();
|
||||
|
||||
s_textFloat->setText( m_hintTextBeforeValue +
|
||||
QString::number( value() ) +
|
||||
m_hintTextAfterValue );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! Qt wheel event
|
||||
void knob::wheelEvent( QWheelEvent * _me )
|
||||
{
|
||||
@@ -572,6 +539,43 @@ void knob::wheelEvent( QWheelEvent * _me )
|
||||
|
||||
|
||||
|
||||
//! Emits a valueChanged() signal if necessary
|
||||
void knob::buttonReleased( void )
|
||||
{
|
||||
if( ( !m_tracking ) || ( value() != m_prevValue ) )
|
||||
{
|
||||
emit valueChanged( value() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void knob::setPosition( const QPoint & _p )
|
||||
{
|
||||
if( configManager::inst()->value( "knobs", "classicalusability"
|
||||
).toInt() )
|
||||
{
|
||||
setNewValue( getValue( _p ) - m_mouseOffset, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
setNewValue( m_value - getValue( _p ), 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void knob::setTracking( bool _enable )
|
||||
{
|
||||
m_tracking = _enable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void knob::setValue( float _val, bool _is_init_value )
|
||||
{
|
||||
if( _is_init_value )
|
||||
|
||||
@@ -53,7 +53,9 @@ static const QString names[ledCheckBox::TOTAL_COLORS] =
|
||||
|
||||
ledCheckBox::ledCheckBox( const QString & _text, QWidget * _parent,
|
||||
ledColors _color ) :
|
||||
QCheckBox( _text, _parent )
|
||||
QWidget( _parent ),
|
||||
m_checked( FALSE ),
|
||||
m_text( _text )
|
||||
{
|
||||
if( _color >= TOTAL_COLORS || _color < YELLOW )
|
||||
{
|
||||
@@ -67,7 +69,7 @@ ledCheckBox::ledCheckBox( const QString & _text, QWidget * _parent,
|
||||
m_ledOffPixmap = new QPixmap( embed::getIconPixmap( "led_off" ) );
|
||||
|
||||
#ifndef QT4
|
||||
setBackgroundMode( Qt::NoBackground );
|
||||
setBackgroundMode( Qt::PaletteBackground );
|
||||
#endif
|
||||
|
||||
setFont( pointSize<7>( font() ) );
|
||||
@@ -88,6 +90,38 @@ ledCheckBox::~ledCheckBox()
|
||||
|
||||
|
||||
|
||||
void ledCheckBox::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( _me->button() == Qt::LeftButton )
|
||||
{
|
||||
toggle();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ledCheckBox::toggle( void )
|
||||
{
|
||||
m_checked = !m_checked;
|
||||
update();
|
||||
emit( toggled( m_checked ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ledCheckBox::setChecked( bool _on )
|
||||
{
|
||||
if( _on != isChecked() )
|
||||
{
|
||||
toggle();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ledCheckBox::paintEvent( QPaintEvent * )
|
||||
{
|
||||
#ifdef QT4
|
||||
@@ -118,3 +152,5 @@ void ledCheckBox::paintEvent( QPaintEvent * )
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "led_checkbox.moc"
|
||||
|
||||
Reference in New Issue
Block a user