From b8f5f2117712f7fbc2ac4e74bb2e5d0135af47e2 Mon Sep 17 00:00:00 2001 From: Umcaruje Date: Tue, 2 Aug 2016 14:45:45 +0200 Subject: [PATCH] Make the background of BB patterns themeable (#2942) * Make the background of BB patterns themeable * Lighten up the color, make the BB background borderless --- data/themes/classic/style.css | 1 + data/themes/default/style.css | 3 ++- include/Track.h | 4 ++++ src/core/Track.cpp | 7 +++++++ src/tracks/Pattern.cpp | 8 ++++---- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/data/themes/classic/style.css b/data/themes/classic/style.css index 1c3df417a..5d3cc6468 100644 --- a/data/themes/classic/style.css +++ b/data/themes/classic/style.css @@ -573,6 +573,7 @@ TrackContentObjectView { qproperty-mutedColor: rgb( 128, 128, 128 ); qproperty-mutedBackgroundColor: rgb( 80, 80, 80 ); qproperty-selectedColor: rgb( 0, 125, 255 ); + qproperty-BBPatternBackground: rgb( 80, 80, 80 ); qproperty-textColor: rgb( 255, 255, 255 ); qproperty-textShadowColor: rgb( 0, 0, 0 ); qproperty-gradient: true; /* boolean property, set true to have a gradient */ diff --git a/data/themes/default/style.css b/data/themes/default/style.css index b7751352d..f269d7a76 100755 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -582,8 +582,9 @@ TrackContainerView QLabel /* common pattern colors */ TrackContentObjectView { qproperty-mutedColor: rgb(255,255,255,100); - qproperty-mutedBackgroundColor: #0A0B0D; + qproperty-mutedBackgroundColor: #373d48; qproperty-selectedColor: #006B65; + qproperty-BBPatternBackground: #373d48; qproperty-textColor: #fff; qproperty-textShadowColor: rgb(0,0,0,200); qproperty-gradient: false; /* boolean property, set true to have a gradient */ diff --git a/include/Track.h b/include/Track.h index b90989228..57f16a7a5 100644 --- a/include/Track.h +++ b/include/Track.h @@ -195,6 +195,7 @@ class TrackContentObjectView : public selectableObject, public ModelView Q_PROPERTY( QColor selectedColor READ selectedColor WRITE setSelectedColor ) Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor ) Q_PROPERTY( QColor textShadowColor READ textShadowColor WRITE setTextShadowColor ) + Q_PROPERTY( QColor BBPatternBackground READ BBPatternBackground WRITE setBBPatternBackground ) Q_PROPERTY( bool gradient READ gradient WRITE setGradient ) public: @@ -213,12 +214,14 @@ public: QColor selectedColor() const; QColor textColor() const; QColor textShadowColor() const; + QColor BBPatternBackground() const; bool gradient() const; void setMutedColor( const QColor & c ); void setMutedBackgroundColor( const QColor & c ); void setSelectedColor( const QColor & c ); void setTextColor( const QColor & c ); void setTextShadowColor( const QColor & c ); + void setBBPatternBackground( const QColor & c ); void setGradient( const bool & b ); // access needsUpdate member variable @@ -293,6 +296,7 @@ private: QColor m_selectedColor; QColor m_textColor; QColor m_textShadowColor; + QColor m_BBPatternBackground; bool m_gradient; bool m_needsUpdate; diff --git a/src/core/Track.cpp b/src/core/Track.cpp index 294ff7721..6f22d1483 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -257,6 +257,7 @@ TrackContentObjectView::TrackContentObjectView( TrackContentObject * tco, m_selectedColor( 0, 0, 0 ), m_textColor( 0, 0, 0 ), m_textShadowColor( 0, 0, 0 ), + m_BBPatternBackground( 0, 0, 0 ), m_gradient( true ), m_needsUpdate( true ) { @@ -353,6 +354,9 @@ QColor TrackContentObjectView::textColor() const QColor TrackContentObjectView::textShadowColor() const { return m_textShadowColor; } +QColor TrackContentObjectView::BBPatternBackground() const +{ return m_BBPatternBackground; } + bool TrackContentObjectView::gradient() const { return m_gradient; } @@ -372,6 +376,9 @@ void TrackContentObjectView::setTextColor( const QColor & c ) void TrackContentObjectView::setTextShadowColor( const QColor & c ) { m_textShadowColor = QColor( c ); } +void TrackContentObjectView::setBBPatternBackground( const QColor & c ) +{ m_BBPatternBackground = QColor( c ); } + void TrackContentObjectView::setGradient( const bool & b ) { m_gradient = b; } diff --git a/src/tracks/Pattern.cpp b/src/tracks/Pattern.cpp index d71161210..0d8ddf355 100644 --- a/src/tracks/Pattern.cpp +++ b/src/tracks/Pattern.cpp @@ -1007,9 +1007,10 @@ void PatternView::paintEvent( QPaintEvent * ) bool current = gui->pianoRoll()->currentPattern() == m_pat; bool beatPattern = m_pat->m_patternType == Pattern::BeatPattern; - // state: selected, muted, normal + // state: selected, normal, beat pattern, muted c = isSelected() ? selectedColor() : ( ( !muted && !beatPattern ) - ? painter.background().color() : mutedBackgroundColor() ); + ? painter.background().color() : ( beatPattern + ? BBPatternBackground() : mutedBackgroundColor() ) ); // invert the gradient for the background in the B&B editor lingrad.setColorAt( beatPattern ? 0 : 1, c.darker( 300 ) ); @@ -1236,12 +1237,11 @@ void PatternView::paintEvent( QPaintEvent * ) p.setPen( c.lighter( current ? 160 : 130 ) ); p.drawRect( 1, 1, rect().right() - TCO_BORDER_WIDTH, rect().bottom() - TCO_BORDER_WIDTH ); - } // outer border p.setPen( ( current && !beatPattern ) ? c.lighter( 130 ) : c.darker( 300 ) ); p.drawRect( 0, 0, rect().right(), rect().bottom() ); - + } // draw the 'muted' pixmap only if the pattern was manualy muted if( m_pat->isMuted() ) {