From b37ce31bc37e9cba53a6fc8b672ce6b78ba6486a Mon Sep 17 00:00:00 2001 From: Wong Cho Ching Date: Fri, 31 Jan 2014 23:11:13 +0800 Subject: [PATCH] render circles on automation points; Inceased INITIAL_WIDTH --- include/AutomationEditor.h | 3 ++- src/gui/AutomationEditor.cpp | 32 ++++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/include/AutomationEditor.h b/include/AutomationEditor.h index 123370dc62..3219cdcc89 100644 --- a/include/AutomationEditor.h +++ b/include/AutomationEditor.h @@ -153,7 +153,7 @@ private: } ; // some constants... - static const int INITIAL_WIDTH = 740; + static const int INITIAL_WIDTH = 860; static const int INITIAL_HEIGHT = 480; static const int SCROLLBAR_SIZE = 16; @@ -249,6 +249,7 @@ private: bool m_scrollBack; void drawCross( QPainter & _p ); + void drawAutomationPoint( QPainter & p, timeMap::iterator it ); bool inBBEditor(); diff --git a/src/gui/AutomationEditor.cpp b/src/gui/AutomationEditor.cpp index 7129d199ac..ffc2306375 100644 --- a/src/gui/AutomationEditor.cpp +++ b/src/gui/AutomationEditor.cpp @@ -72,6 +72,10 @@ QPixmap * AutomationEditor::s_toolSelect = NULL; QPixmap * AutomationEditor::s_toolMove = NULL; +const QColor DRAGGABLE_PIN_COLOR = QColor( 0xFF, 0x00, 0x00 ); +const QColor DRAGGABLE_PIN_BORDER_COLOR = QColor( 0xFF, 0xFF, 0xFF ); + + AutomationEditor::AutomationEditor() : QWidget(), m_zoomingXModel(), @@ -1348,6 +1352,22 @@ inline void AutomationEditor::drawCross( QPainter & _p ) +inline void AutomationEditor::drawAutomationPoint( QPainter & p, timeMap::iterator it ) +{ + int x = xCoordOfTick( it.key() ); + int y = yCoordOfLevel( it.value() ); + int outerRadius = qMin( 8, m_ppt/quantization() ); + int innerRadius = qMax( 0, outerRadius-2 ); + p.setBrush( QBrush( DRAGGABLE_PIN_BORDER_COLOR ) ); + p.drawEllipse( x-outerRadius/2, y-outerRadius/2, outerRadius, outerRadius ); + p.setBrush( QBrush( DRAGGABLE_PIN_COLOR ) ); + p.drawEllipse( x-innerRadius/2, y-innerRadius/2, innerRadius, innerRadius ); + p.setBrush( QBrush() ); +} + + + + void AutomationEditor::paintEvent( QPaintEvent * _pe ) { QMutexLocker m( &m_patternMutex ); @@ -1574,16 +1594,14 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe ) } delete [] values; - // Draw cross - int y = yCoordOfLevel( it.value() ); - p.drawLine( x - 1, y, x + 1, y ); - p.drawLine( x, y - 1, x, y + 1 ); - // _p.setPen( QColor( 0xFF, 0x9F, 0x00 ) ); - // _p.setPen( QColor( 0xFF, 0xFF, 0x40 ) ); + // Draw circle + drawAutomationPoint(p, it); ++it; } + Q_ASSERT( it == time_map.end()-1 ); + for( int i = it.key(), x = xCoordOfTick( i ); x <= width(); i++, x = xCoordOfTick( i ) ) { @@ -1592,6 +1610,8 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe ) // boolean correctly drawLevelTick( p, i, it.value(), false ); } + // Draw circle(the last one) + drawAutomationPoint(p, it); } else {