From 3fa90cc59a5bc6b96273d11ce056902c2159cf73 Mon Sep 17 00:00:00 2001 From: Javier Serrano Polo Date: Sun, 2 Jul 2006 21:43:07 +0000 Subject: [PATCH] improved levels display git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@196 0778d3d1-df1d-0410-868b-ea421aaaa00d --- src/core/automation_editor.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/core/automation_editor.cpp b/src/core/automation_editor.cpp index a5a69e3c7..147da1c4a 100644 --- a/src/core/automation_editor.cpp +++ b/src/core/automation_editor.cpp @@ -520,21 +520,25 @@ void automationEditor::update( void ) AlignmentFlags text_flags = (AlignmentFlags)( AlignRight | AlignVCenter ); - for( int y = grid_bottom, level = m_bottom_level; + if ( m_pattern ) + { + for( int y = grid_bottom, level = m_bottom_level; y >= TOP_MARGIN && level <= m_top_level; y -= m_y_delta, ++level ) - { - if( level % 5 == 0 ) { - p.setPen( QColor( 240, 240, 240 ) ); - p.drawText( 1, y - font_height + 1, + if( level % 5 == 0 ) + { + const QString & label = m_pattern->object() + ->levelToLabel( level ); + p.setPen( QColor( 240, 240, 240 ) ); + p.drawText( 1, y - font_height + 1, VALUES_WIDTH - 10, 2 * font_height, - text_flags, QString::number( level ) ); - - p.setPen( QColor( 0, 0, 0 ) ); - p.drawText( 0, y - font_height, + text_flags, label ); + p.setPen( QColor( 0, 0, 0 ) ); + p.drawText( 0, y - font_height, VALUES_WIDTH - 10, 2 * font_height, - text_flags, QString::number( level ) ); + text_flags, label ); + } } }