integrated patch by Attila Herman which adds support for colorized graph and quantized values

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1578 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-09-07 14:34:43 +00:00
parent 299dd9197d
commit ac2003ca70
3 changed files with 25 additions and 5 deletions

View File

@@ -1,5 +1,13 @@
2008-09-07 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* include/graph.h:
* src/gui/widgets/graph.cpp:
integrated patch by Attila Herman which adds support for colorized
graph and quantized values
* src/core/config_mgr.cpp:
made default VST path to be inside LMMS working directory
* src/gui/track_container_view.cpp:
changed size constraint for scrollArea-widget layout - fixes messed up
Song Editor after loading various projects

View File

@@ -53,6 +53,8 @@ public:
void setForeground( const QPixmap & _pixmap );
void setGraphColor( const QColor );
inline graphModel * model( void )
{
return castModel<graphModel>();
@@ -89,6 +91,7 @@ private:
QPixmap m_foreground;
QColor m_graphColor;
graphModel * m_graphModel;
graphStyle m_graphStyle;
@@ -107,7 +110,8 @@ public:
float _max,
int _size,
:: model * _parent,
bool _default_constructed = FALSE );
bool _default_constructed = FALSE,
float _step = 0.0 );
virtual ~graphModel();
@@ -161,6 +165,7 @@ private:
QVector<float> m_samples;
float m_minValue;
float m_maxValue;
float m_step;
friend class graph;

View File

@@ -46,6 +46,7 @@ graph::graph( QWidget * _parent, graphStyle _style ) :
m_graphStyle( _style )
{
m_mouseDown = false;
m_graphColor = QColor( 0xFF, 0xAA, 0x00 );
resize( 132, 104 );
setAcceptDrops( TRUE );
@@ -72,7 +73,10 @@ void graph::setForeground( const QPixmap &_pixmap )
m_foreground = _pixmap;
}
void graph::setGraphColor( QColor _graphcol )
{
m_graphColor = _graphcol;
}
/*
void graph::loadSampleFromFile( const QString & _filename )
@@ -217,7 +221,7 @@ void graph::paintEvent( QPaintEvent * )
{
QPainter p( this );
p.setPen( QPen(QColor( 0xFF, 0xAA, 0x00 ), 1) );
p.setPen( QPen( m_graphColor, 1 ) );
QVector<float> * samps = &(model()->m_samples);
int length = model()->length();
@@ -344,11 +348,12 @@ void graph::updateGraph( void )
graphModel::graphModel( float _min, float _max, int _length,
::model * _parent, bool _default_constructed ) :
::model * _parent, bool _default_constructed, float _step ) :
model( _parent, tr( "Graph" ), _default_constructed ),
m_samples( _length ),
m_minValue( _min ),
m_maxValue( _max )
m_maxValue( _max ),
m_step( _step )
{
}
@@ -395,6 +400,8 @@ void graphModel::setLength( int _length )
void graphModel::setSampleAt( int _x, float _val )
{
//snap to the grid
_val -= ( m_step != 0.0 ) ? fmod( _val, m_step ) * m_step : 0;
// boundary check
if ( _x >= 0 && _x < length() &&
_val >= minValue() && _val < maxValue() )