Fixed graph for real

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1104 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Paul Giblock
2008-06-08 12:27:23 +00:00
parent f39c9641ab
commit efc8c7bbfa

View File

@@ -116,7 +116,7 @@ void graph::mouseMoveEvent ( QMouseEvent * _me )
// avoid mouse leaps
int diff = x - m_lastCursorX;
if( diff >= 1 )
{
x = min( width() - 2, m_lastCursorX + 1);
@@ -130,18 +130,19 @@ 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 );
// update mouse
m_lastCursorX = x;
if( diff != 0 )
{
m_lastCursorX = x;
QPoint pt = mapToGlobal( QPoint( x, y ) );
QPoint pt = mapToGlobal( QPoint( x, y ) );
QCursor::setPos( pt.x(), pt.y() );
QCursor::setPos( pt.x(), pt.y() );
}
skip = true;
}
@@ -192,8 +193,6 @@ void graph::changeSampleAt(int _x, int _y)
float range = minVal - maxVal;
float val = ( _y*range/( height()-4 ) ) + maxVal;
printf("%d, (%d*%f/( %d-4 ) ) + %f \n", _x, _y, range, height(), maxVal );
model()->setSampleAt( (int)( _x*xscale ), val );
}