From 0ab023c4bf58d1c4b9d1e63eb2b133d678059027 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Sun, 8 Jun 2008 11:35:36 +0000 Subject: [PATCH] Fix graph widget git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1098 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 5 +++++ src/gui/widgets/graph.cpp | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f68ce9538..46e376a37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-06-08 Paul Giblock + + * src/gui/widgets/graph.cpp: + Fix graph widget + 2008-06-08 Tobias Doerffel * plugins/ladspa_effect/tap/tap_deesser.c: diff --git a/src/gui/widgets/graph.cpp b/src/gui/widgets/graph.cpp index 72b48be1c..470792ec2 100644 --- a/src/gui/widgets/graph.cpp +++ b/src/gui/widgets/graph.cpp @@ -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( 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 ); }