Make the background of BB patterns themeable (#2942)

* Make the background of BB patterns themeable

* Lighten up the color, make the BB background borderless
This commit is contained in:
Umcaruje
2016-08-02 14:45:45 +02:00
committed by GitHub
parent 04dd35e57f
commit b8f5f21177
5 changed files with 18 additions and 5 deletions

View File

@@ -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; }

View File

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