Fix graph widget

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1098 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Paul Giblock
2008-06-08 11:35:36 +00:00
parent d6262bb556
commit 0ab023c4bf
2 changed files with 14 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
2008-06-08 Paul Giblock <drfaygo/at/gmail/dot/com>
* src/gui/widgets/graph.cpp:
Fix graph widget
2008-06-08 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/ladspa_effect/tap/tap_deesser.c:

View File

@@ -130,6 +130,8 @@ void graph::mouseMoveEvent ( QMouseEvent * _me )
x = m_lastCursorX;
}
printf("%d %d %d %d\n", height(), skip, x, y);
y = max( 2, min( y, height()-3 ) );
changeSampleAt( x, y );
@@ -181,6 +183,7 @@ void graph::changeSampleAt(int _x, int _y)
float xscale = static_cast<float>( model()->length() ) /
( width()-4 );
// consider border of background image
_x -= 2;
_y -= 2;
@@ -189,7 +192,12 @@ void graph::changeSampleAt(int _x, int _y)
float range = minVal - maxVal;
float val = ( _y*range/( height()-4 ) ) + maxVal;
model()->setSampleAt( (int)( _x*xscale ), (int) val );
printf("%d, (%d*%f/( %d-4 ) ) + %f \n", _x, _y, range, height(), maxVal );
float tmp = _y*range
printf("%d, %d\n", _x, tmp );
model()->setSampleAt( (int)( _x*xscale ), val );
}