From 421c071ab06fb1dc902b47ed55c9d88fe77132d9 Mon Sep 17 00:00:00 2001 From: Amadeus Folego Date: Wed, 7 Jan 2015 15:55:58 -0200 Subject: [PATCH] Fix muted track not highlighted on selection Fix #1239 --- src/gui/AutomationPatternView.cpp | 11 ++++++++--- src/tracks/BBTrack.cpp | 6 +++--- src/tracks/Pattern.cpp | 8 ++++++-- src/tracks/SampleTrack.cpp | 11 ++++++++--- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/gui/AutomationPatternView.cpp b/src/gui/AutomationPatternView.cpp index 1c404e6ef..7885905f7 100644 --- a/src/gui/AutomationPatternView.cpp +++ b/src/gui/AutomationPatternView.cpp @@ -259,11 +259,16 @@ void AutomationPatternView::paintEvent( QPaintEvent * ) QLinearGradient lingrad( 0, 0, 0, height() ); QColor c; + if( !( m_pat->getTrack()->isMuted() || m_pat->isMuted() ) ) - c = isSelected() ? QColor( 0, 0, 224 ) - : styleColor; + c = styleColor; else - c = QColor( 80,80,80 ); + c = QColor( 80, 80, 80 ); + + if( isSelected() == true ) + { + c = QColor( qMax( c.red() - 128, 0 ), qMax( c.green() - 128, 0 ), 255 ); + } lingrad.setColorAt( 1, c.darker( 300 ) ); lingrad.setColorAt( 0, c ); diff --git a/src/tracks/BBTrack.cpp b/src/tracks/BBTrack.cpp index 5a76d56a0..011e5e826 100644 --- a/src/tracks/BBTrack.cpp +++ b/src/tracks/BBTrack.cpp @@ -215,7 +215,7 @@ void BBTCOView::paintEvent( QPaintEvent * ) { QPainter p( this ); - QColor col = m_bbTCO->m_useStyleColor + QColor col = m_bbTCO->m_useStyleColor ? p.pen().brush().color() : m_bbTCO->colorObj(); @@ -223,10 +223,10 @@ void BBTCOView::paintEvent( QPaintEvent * ) { col = QColor( 160, 160, 160 ); } + if( isSelected() == true ) { - col = QColor( qMax( col.red() - 128, 0 ), - qMax( col.green() - 128, 0 ), 255 ); + col = QColor( qMax( col.red() - 128, 0 ), qMax( col.green() - 128, 0 ), 255 ); } QLinearGradient lingrad( 0, 0, 0, height() ); diff --git a/src/tracks/Pattern.cpp b/src/tracks/Pattern.cpp index 727fbd948..dc61aa6d7 100644 --- a/src/tracks/Pattern.cpp +++ b/src/tracks/Pattern.cpp @@ -907,11 +907,15 @@ void PatternView::paintEvent( QPaintEvent * ) if(( m_pat->m_patternType != Pattern::BeatPattern ) && !( m_pat->getTrack()->isMuted() || m_pat->isMuted() )) - c = isSelected() ? QColor( 0, 0, 224 ) - : styleColor; + c = styleColor; else c = QColor( 80, 80, 80 ); + if( isSelected() == true ) + { + c = QColor( qMax( c.red() - 128, 0 ), qMax( c.green() - 128, 0 ), 255 ); + } + if( m_pat->m_patternType != Pattern::BeatPattern ) { lingrad.setColorAt( 1, c.darker( 300 ) ); diff --git a/src/tracks/SampleTrack.cpp b/src/tracks/SampleTrack.cpp index 891790af2..7e3be4f4c 100644 --- a/src/tracks/SampleTrack.cpp +++ b/src/tracks/SampleTrack.cpp @@ -340,9 +340,14 @@ void SampleTCOView::paintEvent( QPaintEvent * _pe ) QColor c; if( !( m_tco->getTrack()->isMuted() || m_tco->isMuted() ) ) - c = isSelected() ? QColor( 0, 0, 224 ) - : styleColor; - else c = QColor( 80, 80, 80 ); + c = styleColor; + else + c = QColor( 80, 80, 80 ); + + if( isSelected() == true ) + { + c = QColor( qMax( c.red() - 128, 0 ), qMax( c.green() - 128, 0 ), 255 ); + } QLinearGradient grad( 0, 0, 0, height() );