Merge pull request #218 from wongcc966422/issue1

render circles on automation points; Increased INITIAL_WIDTH
This commit is contained in:
Tobias Doerffel
2014-02-01 03:41:08 -08:00
2 changed files with 28 additions and 7 deletions

View File

@@ -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();

View File

@@ -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
{