From 941c3cdc788adf53110ed66f5c11869a078c1a91 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Sun, 29 Jun 2008 06:24:23 +0000 Subject: [PATCH] Improve automation track appearance. Fix tempoSyncKnob calculation git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1198 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 6 +++++- src/core/automation_pattern.cpp | 26 +++++++++++++++++++++----- src/gui/widgets/tempo_sync_knob.cpp | 2 +- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18eca1446..e12d0bfb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,12 +4,16 @@ Initialize gain at 1.0 * src/core/automation_pattern.cpp: - Correctly draw automation TCO for negative minValues. + - Correctly draw automation TCO for negative minValues. + - Add some shading * src/gui/controller_connection_dialog.cpp: - Connect cancel button - Make mapping function read-only for alpha release + * src/gui/widgets/tempo_sync_knob.cpp: + Make tempoSyncKnob really sync to tempo again + 2008-06-28 Tobias Doerffel * plugins/Makefile.am: diff --git a/src/core/automation_pattern.cpp b/src/core/automation_pattern.cpp index 8f8d8364e..eec07ac0c 100644 --- a/src/core/automation_pattern.cpp +++ b/src/core/automation_pattern.cpp @@ -621,15 +621,31 @@ void automationPatternView::paintEvent( QPaintEvent * ) height() - 2 * TCO_BORDER_WIDTH ); } - const float y_scale = m_pat->firstObject()->maxValue() - - m_pat->firstObject()->minValue(); + const float min = m_pat->firstObject()->minValue(); + const float max = m_pat->firstObject()->maxValue(); + + const float y_scale = max - min; const float h = ( height()-2*TCO_BORDER_WIDTH ) / y_scale; - p.translate( 0.0f, m_pat->firstObject()->maxValue() * - height() / y_scale ); + p.translate( 0.0f, max * height() / y_scale ); p.scale( 1.0f, -h ); + //QLinearGradient lin2grad( 0, min, 0, max ); + QLinearGradient lin2grad( 0, min, 0, max ); + const QColor cl = QColor( 255, 224, 0 ); + const QColor cd = QColor( 229, 158, 0 ); + //lingrad.setColorAt( min, c ); + lin2grad.setColorAt( 1, cl ); + +/* if( min < 0 ) { + lin2grad.setColorAt( -min/y_scale, Qt::black ); + lin2grad.setColorAt( 0, k ); + } + else {*/ + lin2grad.setColorAt( 0, cd ); +// } + for( automationPattern::timeMap::const_iterator it = m_pat->getTimeMap().begin(); it != m_pat->getTimeMap().end(); ++it ) @@ -646,7 +662,7 @@ void automationPatternView::paintEvent( QPaintEvent * ) x2 = width() - TCO_BORDER_WIDTH + 1; } p.fillRect( QRectF( x1, 0.0f, x2-x1, it.value() ), - QColor( 255, 224, 0 ) ); + lin2grad /*QColor( 255, 224, 0 )*/ ); } p.resetMatrix(); diff --git a/src/gui/widgets/tempo_sync_knob.cpp b/src/gui/widgets/tempo_sync_knob.cpp index 81a5e8636..7dedbd7fe 100644 --- a/src/gui/widgets/tempo_sync_knob.cpp +++ b/src/gui/widgets/tempo_sync_knob.cpp @@ -118,7 +118,7 @@ void tempoSyncKnobModel::calculateTempoSyncTime( bpm_t _bpm ) } bool journalling = testAndSetJournalling( FALSE ); float oneUnit = 60000.0 / ( _bpm * conversionFactor * m_scale ); - setValue( oneUnit*( maxValue() - minValue() ) + minValue() ); + setValue( oneUnit * maxValue() ); setJournalling( journalling ); }