Reverted back to non-Widgetized autoModelViews

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@885 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Paul Giblock
2008-04-04 08:47:06 +00:00
parent 1fbff410f8
commit dd051fbc63
7 changed files with 39 additions and 59 deletions

View File

@@ -16,7 +16,7 @@
- use controller in value() if set
* src/tracks/pattern.cpp:
Change brightness of note volume-lines according to volume
Fixed length of notes according to PaulWay
* src/core/mixer.cpp:
trigger controller's frame counter

View File

@@ -104,52 +104,38 @@ public:
return( static_cast<T>( _v ) );
}
inline virtual T value( void ) const
{
return value( 0 );
}
inline virtual T value( void ) const
{
return value( 0 );
}
inline virtual T value( int _frameOffset ) const
{
T val;
if( m_controller != NULL )
{
val = minValue() +
( maxValue() - minValue() ) *
castValue( m_controller->currentValue( _frameOffset ) );
// New framebuffer, emit signal for all the signal based users
if( _frameOffset == 0 && val != m_value )
{
// Sort of a hack, but this really is our intention
//
// Any model that wants sample-exactness must operate without relying
// on the dataChanged signal. This is primarily for updating the GUI
//autoModel * that = const_cast<autoModel *>( this );
//emit that->dataChanged();
}
}
else
{
val = m_value;
}
if( m_controller != NULL )
{
return minValue() +
( maxValue() - minValue() ) *
castValue( m_controller->currentValue( _frameOffset ) );
}
return val;
return m_value;
}
inline controller * getController( void ) const
{
return m_controller;
}
inline void setController( controller * _c )
{
m_controller = _c;
inline controller * getController( void ) const
{
return m_controller;
}
inline void setController( controller * _c )
{
m_controller = _c;
QObject::connect( m_controller, SIGNAL( valueChanged() ),
this, SIGNAL( dataChanged() ) );
}
}
inline virtual T initValue( void ) const
{
@@ -244,7 +230,7 @@ protected:
private:
controller * m_controller;
controller * m_controller;
T m_value;
T m_initValue;
T m_minValue;
@@ -299,12 +285,12 @@ public slots:
template<typename T, typename EDIT_STEP_TYPE, class WIDGET_BASE>
template<typename T, typename EDIT_STEP_TYPE = T>
class automatableModelView : public modelView
{
public:
typedef automatableModel<T, EDIT_STEP_TYPE> autoModel;
typedef automatableModelView<WIDGET_BASE, T, EDIT_STEP_TYPE> autoModelView;
typedef automatableModelView<T, EDIT_STEP_TYPE> autoModelView;
automatableModelView( ::model * _model ) :
modelView( _model )
@@ -341,15 +327,14 @@ public:
#define generateModelPrimitive(type,type2) \
typedef automatableModel<type,type2> type##Model; \
typedef automatableModelView<type,type2,WIDGET_BASE> type##ModelView<WIDGET_BASE>; \
typedef automatableModelView<type,type2> type##ModelView; \
// some model-primitives
generateModelPrimitive(float,float);
generateModelPrimitive(int,int);
template<class WIDGET_TYPE>
class boolModel : public automatableModel<bool, signed char, WIDGET_TYPE>
class boolModel : public automatableModel<bool, signed char>
{
public:
boolModel( const bool _val = FALSE,
@@ -362,7 +347,7 @@ public:
} ;
typedef automatableModelView<bool, signed char, WIDGET_TYPE> boolModelView<WIDGET_TYPE>;
typedef automatableModelView<bool, signed char> boolModelView;
#endif

View File

@@ -45,7 +45,7 @@ automatableModel<T, EDIT_STEP_TYPE>::automatableModel(
::model * _parent,
bool _default_constructed ) :
model( _parent, _default_constructed ),
m_controller( NULL ),
m_controller( NULL ),
m_value( _val ),
m_initValue( _val ),
m_minValue( _min ),

View File

@@ -77,12 +77,12 @@ protected:
static unsigned int s_frames;
/*
QString publicName();
slots:
void trigger();
*/
signals:
// The value changed while the mixer isn't running (i.e: MIDI CC)
void valueChanged( void );

View File

@@ -5,7 +5,7 @@
* Josef Wilgen
*
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
@@ -47,7 +47,7 @@ enum knobTypes
class knob : public QWidget, public floatModelView<QWidget>
class knob : public QWidget, public floatModelView
{
Q_OBJECT
public:
@@ -73,8 +73,6 @@ public slots:
signals:
// void valueChanged( float value );
// void valueChanged( void );
void sliderPressed( void );
void sliderReleased( void );
void sliderMoved( float value );

View File

@@ -70,14 +70,11 @@ void modelView::doConnections( void )
{
if( m_model != NULL )
{
// Why queued connections? this causes a terrible stair effect when
// the GUI can't keep up. If anything should suffer, it should be
// GUI response.
QWidget * w = dynamic_cast<QWidget *>( this );
QObject::connect( m_model, SIGNAL( dataChanged() ),
w, SLOT( update() ) /*, Qt::QueuedConnection */ );
w, SLOT( update() ), Qt::QueuedConnection );
QObject::connect( m_model, SIGNAL( propertiesChanged() ),
w, SLOT( update() ) /*, Qt::QueuedConnection */ );
w, SLOT( update() ), Qt::QueuedConnection );
}
}

View File

@@ -577,12 +577,12 @@ void knob::connectToMidiDevice( void )
void knob::connectToController( void )
{
// TODO[pg]: Display a dialog with list of controllers currently in the song
// in addition to any system MIDI controllers
// TODO[pg]: Display a dialog with list of controllers currently in the song
// in addition to any system MIDI controllers
controller * c = new controller();
controller * c = new controller();
model()->setController( c );
model()->setController( c );
}