diff --git a/data/themes/default/style.css b/data/themes/default/style.css index adc1547c19f..d87d2651e9f 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -115,7 +115,7 @@ PianoRoll { qproperty-noteColor: rgb( 119, 199, 216 ); qproperty-noteBorderRadiusX: 5; qproperty-noteBorderRadiusY: 2; - qproperty-selectedNoteColor: rgb( 0, 64, 192 ); + qproperty-selectedNoteColor: rgb( 0, 125, 255 ); qproperty-barColor: #4afd85; qproperty-markedSemitoneColor: rgba( 40, 40, 40, 200 ); /* Text on the white piano keys */ @@ -540,28 +540,47 @@ TrackContainerView QLabel /* instrument pattern */ PatternView { color: rgb( 119, 199, 216 ); + qproperty-mutedColor: rgb( 80, 80, 80 ); + qproperty-selectedColor: rgb( 0, 125, 255 ); qproperty-fgColor: rgb( 187, 227, 236 ); + qproperty-fgMutedColor: rgb( 128, 128, 128 ); qproperty-textColor: rgb( 255, 255, 255 ); + qproperty-textShadowColor: rgb( 0, 0, 0 ); + qproperty-gradient: true; } /* sample track pattern */ SampleTCOView { color: rgb( 74, 253, 133 ); + qproperty-mutedColor: rgb( 80, 80, 80 ); + qproperty-selectedColor: rgb( 0, 125, 255 ); qproperty-fgColor: rgb( 187, 227, 236 ); + qproperty-fgMutedColor: rgb( 128, 128, 128 ); qproperty-textColor: rgb( 255, 60, 60 ); + qproperty-textShadowColor: rgb( 0, 0, 0 ); + qproperty-gradient: true; } /* automation pattern */ AutomationPatternView { color: #99afff; - qproperty-fgColor: rgb( 204, 215, 255 ); + qproperty-mutedColor: rgb( 80, 80, 80 ); + qproperty-selectedColor: rgb( 0, 125, 255 ); + qproperty-fgColor: rgba( 204, 215, 255 ); + qproperty-fgMutedColor: rgb( 128, 128, 128 ); qproperty-textColor: rgb( 255, 255, 255 ); + qproperty-textShadowColor: rgb( 0, 0, 0 ); + qproperty-gradient: true; } /* bb-pattern */ BBTCOView { color: rgb( 128, 182, 175 ); /* default colour for bb-tracks, used when the colour hasn't been defined by the user */ + qproperty-mutedColor: rgb( 80, 80, 80 ); + qproperty-selectedColor: rgb( 0, 125, 255 ); qproperty-textColor: rgb( 255, 255, 255 ); + qproperty-textShadowColor: rgb( 0, 0, 0 ); + qproperty-gradient: true; } /* Plugins */ diff --git a/include/Track.h b/include/Track.h index 4afc670764e..1ce7ade821e 100644 --- a/include/Track.h +++ b/include/Track.h @@ -192,7 +192,12 @@ class TrackContentObjectView : public selectableObject, public ModelView // theming qproperties Q_PROPERTY( QColor fgColor READ fgColor WRITE setFgColor ) + Q_PROPERTY( QColor fgMutedColor READ fgMutedColor WRITE setFgMutedColor ) + Q_PROPERTY( QColor mutedColor READ mutedColor WRITE setMutedColor ) + 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( bool gradient READ gradient WRITE setGradient ) public: TrackContentObjectView( TrackContentObject * tco, TrackView * tv ); @@ -206,9 +211,19 @@ class TrackContentObjectView : public selectableObject, public ModelView } // qproperty access func QColor fgColor() const; + QColor fgMutedColor() const; + QColor mutedColor() const; + QColor selectedColor() const; QColor textColor() const; + QColor textShadowColor() const; + bool gradient() const; void setFgColor( const QColor & c ); + void setFgMutedColor( const QColor & c ); + void setMutedColor( const QColor & c ); + void setSelectedColor( const QColor & c ); void setTextColor( const QColor & c ); + void setTextShadowColor( const QColor & c ); + void setGradient( const bool & b ); public slots: virtual bool close(); @@ -268,7 +283,12 @@ protected slots: // qproperty fields QColor m_fgColor; + QColor m_fgMutedColor; + QColor m_mutedColor; + QColor m_selectedColor; QColor m_textColor; + QColor m_textShadowColor; + bool m_gradient; inline void setInitialMousePos( QPoint pos ) { diff --git a/src/core/Track.cpp b/src/core/Track.cpp index 05d3750a5ff..f41db31ad14 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -252,7 +252,12 @@ TrackContentObjectView::TrackContentObjectView( TrackContentObject * tco, m_initialMouseGlobalPos( QPoint( 0, 0 ) ), m_hint( NULL ), m_fgColor( 0, 0, 0 ), - m_textColor( 0, 0, 0 ) + m_fgMutedColor( 0, 0, 0 ), + m_mutedColor( 0, 0, 0 ), + m_selectedColor( 0, 0, 0 ), + m_textColor( 0, 0, 0 ), + m_textShadowColor( 0, 0, 0 ), + m_gradient( true ) { if( s_textFloat == NULL ) { @@ -264,10 +269,10 @@ TrackContentObjectView::TrackContentObjectView( TrackContentObject * tco, setAttribute( Qt::WA_DeleteOnClose, true ); setFocusPolicy( Qt::StrongFocus ); setCursor( QCursor( embed::getIconPixmap( "hand" ), 3, 3 ) ); - move( 0, 1 ); + move( 0, 0 ); show(); - setFixedHeight( tv->getTrackContentWidget()->height() - 2 ); + setFixedHeight( tv->getTrackContentWidget()->height() - 1); setAcceptDrops( true ); setMouseTracking( true ); @@ -322,18 +327,46 @@ bool TrackContentObjectView::fixedTCOs() QColor TrackContentObjectView::fgColor() const { return m_fgColor; } -//! \brief CSS theming qproperty access method +QColor TrackContentObjectView::fgMutedColor() const +{ return m_fgMutedColor; } + +QColor TrackContentObjectView::mutedColor() const +{ return m_mutedColor; } + +QColor TrackContentObjectView::selectedColor() const +{ return m_selectedColor; } + QColor TrackContentObjectView::textColor() const { return m_textColor; } +QColor TrackContentObjectView::textShadowColor() const +{ return m_textShadowColor; } + +bool TrackContentObjectView::gradient() const +{ return m_gradient; } + //! \brief CSS theming qproperty access method void TrackContentObjectView::setFgColor( const QColor & c ) { m_fgColor = QColor( c ); } -//! \brief CSS theming qproperty access method +void TrackContentObjectView::setFgMutedColor( const QColor & c ) +{ m_fgMutedColor = QColor( c ); } + +void TrackContentObjectView::setMutedColor( const QColor & c ) +{ m_mutedColor = QColor( c ); } + +void TrackContentObjectView::setSelectedColor( const QColor & c ) +{ m_selectedColor = QColor( c ); } + void TrackContentObjectView::setTextColor( const QColor & c ) { m_textColor = QColor( c ); } +void TrackContentObjectView::setTextShadowColor( const QColor & c ) +{ m_textShadowColor = QColor( c ); } + +void TrackContentObjectView::setGradient( const bool & b ) +{ m_gradient = b; } + /*! \brief Close a trackContentObjectView * @@ -1047,11 +1080,8 @@ void TrackContentWidget::updateBackground() pmp.fillRect( w, 0, w , h, lighterColor() ); // draw lines - pmp.setPen( QPen( gridColor(), 1 ) ); - // horizontal line - pmp.drawLine( 0, h-1, w*2, h-1 ); - // vertical lines + pmp.setPen( QPen( gridColor(), 1 ) ); for( float x = 0; x < w * 2; x += ppt ) { pmp.drawLine( QLineF( x, 0.0, x, h ) ); @@ -1062,6 +1092,10 @@ void TrackContentWidget::updateBackground() { pmp.drawLine( QLineF( x, 0.0, x, h ) ); } + + // horizontal line + pmp.setPen( QPen( gridColor(), 1 ) ); + pmp.drawLine( 0, h-1, w*2, h-1 ); pmp.end(); @@ -1122,7 +1156,7 @@ void TrackContentWidget::update() for( tcoViewVector::iterator it = m_tcoViews.begin(); it != m_tcoViews.end(); ++it ) { - ( *it )->setFixedHeight( height() - 2 ); + ( *it )->setFixedHeight( height() - 1 ); ( *it )->update(); } QWidget::update(); diff --git a/src/gui/AutomationPatternView.cpp b/src/gui/AutomationPatternView.cpp index e92b5eb71af..7d84b923bd8 100644 --- a/src/gui/AutomationPatternView.cpp +++ b/src/gui/AutomationPatternView.cpp @@ -54,7 +54,6 @@ AutomationPatternView::AutomationPatternView( AutomationPattern * _pattern, this, SLOT( update() ) ); setAttribute( Qt::WA_OpaquePaintEvent, true ); - setFixedHeight( parentWidget()->height() - 2 ); ToolTip::add( this, tr( "double-click to open this pattern in " "automation editor" ) ); @@ -270,17 +269,22 @@ void AutomationPatternView::paintEvent( QPaintEvent * ) if( !( m_pat->getTrack()->isMuted() || m_pat->isMuted() ) ) c = styleColor; else - c = QColor( 80, 80, 80 ); + c = mutedColor(); if( isSelected() == true ) { - c.setRgb( qMax( c.red() - 128, 0 ), qMax( c.green() - 128, 0 ), 255 ); + c = selectedColor(); } lingrad.setColorAt( 1, c.darker( 300 ) ); lingrad.setColorAt( 0, c ); - - p.setBrush( lingrad ); + + if ( gradient() ) { + p.setBrush( lingrad ); + } else { + p.setBrush( c ); + } + if( gui->automationEditor()->currentPattern() == m_pat ) p.setPen( c.lighter( 160 ) ); else @@ -317,10 +321,17 @@ void AutomationPatternView::paintEvent( QPaintEvent * ) p.scale( 1.0f, -h ); QLinearGradient lin2grad( 0, min, 0, max ); + QColor col; + + if( !( m_pat->getTrack()->isMuted() || m_pat->isMuted() ) ) { + col = fgColor(); + } else { + col = fgMutedColor(); + } - lin2grad.setColorAt( 1, fgColor().lighter( 150 ) ); - lin2grad.setColorAt( 0.5, fgColor() ); - lin2grad.setColorAt( 0, fgColor().darker( 150 ) ); + lin2grad.setColorAt( 1, col.lighter( 150 ) ); + lin2grad.setColorAt( 0.5, col ); + lin2grad.setColorAt( 0, col.darker( 150 ) ); for( AutomationPattern::timeMap::const_iterator it = m_pat->getTimeMap().begin(); @@ -332,9 +343,11 @@ void AutomationPatternView::paintEvent( QPaintEvent * ) MidiTime::ticksPerTact(); const float x2 = (float)( width() - TCO_BORDER_WIDTH ); if( x1 > ( width() - TCO_BORDER_WIDTH ) ) break; - - p.fillRect( QRectF( x1, 0.0f, x2-x1, it.value() ), - lin2grad ); + if ( gradient() ) { + p.fillRect( QRectF( x1, 0.0f, x2-x1, it.value() ), lin2grad ); + } else { + p.fillRect( QRectF( x1, 0.0f, x2-x1, it.value() ), col ); + } break; } @@ -348,8 +361,11 @@ void AutomationPatternView::paintEvent( QPaintEvent * ) MidiTime::ticksPerTact(); if( x1 > ( width() - TCO_BORDER_WIDTH ) ) break; - p.fillRect( QRectF( x1, 0.0f, x2-x1, value ), - lin2grad ); + if ( gradient() ) { + p.fillRect( QRectF( x1, 0.0f, x2-x1, value ), lin2grad ); + } else { + p.fillRect( QRectF( x1, 0.0f, x2-x1, value ), col ); + } } delete [] values; } @@ -373,13 +389,9 @@ void AutomationPatternView::paintEvent( QPaintEvent * ) // pattern name p.setFont( pointSize<8>( p.font() ) ); - QColor text_color = ( m_pat->isMuted() || m_pat->getTrack()->isMuted() ) - ? QColor( 30, 30, 30 ) - : textColor(); - - p.setPen( QColor( 0, 0, 0 ) ); + p.setPen( textShadowColor() ); p.drawText( 4, p.fontMetrics().height()+1, m_pat->name() ); - p.setPen( text_color ); + p.setPen( textColor() ); p.drawText( 3, p.fontMetrics().height(), m_pat->name() ); if( m_pat->isMuted() ) diff --git a/src/tracks/BBTrack.cpp b/src/tracks/BBTrack.cpp index 45210b05f4e..029c316aca1 100644 --- a/src/tracks/BBTrack.cpp +++ b/src/tracks/BBTrack.cpp @@ -220,7 +220,7 @@ void BBTCOView::paintEvent( QPaintEvent * ) QColor col; if( m_bbTCO->getTrack()->isMuted() || m_bbTCO->isMuted() ) { - col = QColor( 160, 160, 160 ); + col = mutedColor(); } else if ( m_bbTCO->m_useStyleColor ) { @@ -233,14 +233,17 @@ void BBTCOView::paintEvent( QPaintEvent * ) if( isSelected() == true ) { - col.setRgb( qMax( col.red() - 128, 0 ), qMax( col.green() - 128, 0 ), 255 ); + col = selectedColor(); } QLinearGradient lingrad( 0, 0, 0, height() ); lingrad.setColorAt( 0, col.light( 130 ) ); lingrad.setColorAt( 1, col.light( 70 ) ); - p.fillRect( rect(), lingrad ); - + if ( gradient() ){ + p.fillRect( rect(), lingrad ); + } else { + p.fillRect( rect(), col ); + } tact_t t = Engine::getBBTrackContainer()->lengthOfBB( m_bbTCO->bbTrackIndex() ); if( m_bbTCO->length() > MidiTime::ticksPerTact() && t > 0 ) { @@ -263,7 +266,7 @@ void BBTCOView::paintEvent( QPaintEvent * ) p.setFont( pointSize<8>( p.font() ) ); - p.setPen( QColor( 0, 0, 0 ) ); + p.setPen( textShadowColor() ); p.drawText( 4, p.fontMetrics().height()+1, m_bbTCO->name() ); p.setPen( textColor() ); p.drawText( 3, p.fontMetrics().height(), m_bbTCO->name() ); diff --git a/src/tracks/Pattern.cpp b/src/tracks/Pattern.cpp index c32d6a2cadb..329525e8c0d 100644 --- a/src/tracks/Pattern.cpp +++ b/src/tracks/Pattern.cpp @@ -703,8 +703,6 @@ PatternView::PatternView( Pattern* pattern, TrackView* parent ) : "step_btn_off_light" ) ); } - setFixedHeight( parentWidget()->height() - 2 ); - ToolTip::add( this, tr( "use mouse wheel to set velocity of a step" ) ); setStyle( QApplication::style() ); @@ -977,12 +975,12 @@ void PatternView::paintEvent( QPaintEvent * ) } else { - c = QColor( 80, 80, 80 ); + c = mutedColor(); } if( isSelected() == true ) { - c.setRgb( qMax( c.red() - 128, 0 ), qMax( c.green() - 128, 0 ), 255 ); + c = selectedColor(); } if( m_pat->m_patternType != Pattern::BeatPattern ) @@ -995,8 +993,12 @@ void PatternView::paintEvent( QPaintEvent * ) lingrad.setColorAt( 0, c.darker( 300 ) ); lingrad.setColorAt( 1, c ); } - - p.setBrush( lingrad ); + + if ( gradient() ) { + p.setBrush( lingrad ); + } else { + p.setBrush( c ); + } if( gui->pianoRoll()->currentPattern() == m_pat && m_pat->m_patternType != Pattern::BeatPattern ) p.setPen( c.lighter( 130 ) ); else @@ -1029,9 +1031,9 @@ void PatternView::paintEvent( QPaintEvent * ) TCO_BORDER_WIDTH, x_base + static_cast( ppt * t ) - 1, 5 ); p.drawLine( x_base + static_cast( ppt * t ) - 1, - height() - ( 4 + 2 * TCO_BORDER_WIDTH ), + height() - ( 4 + TCO_BORDER_WIDTH ), x_base + static_cast( ppt * t ) - 1, - height() - 2 * TCO_BORDER_WIDTH ); + height() - ( TCO_BORDER_WIDTH + 1 )); } // melody pattern paint event @@ -1080,7 +1082,7 @@ void PatternView::paintEvent( QPaintEvent * ) if( m_pat->getTrack()->isMuted() || m_pat->isMuted() ) { - p.setPen( QColor( 160, 160, 160 ) ); + p.setPen( fgMutedColor() ); } else { @@ -1196,15 +1198,11 @@ void PatternView::paintEvent( QPaintEvent * ) p.setFont( pointSize<8>( p.font() ) ); - QColor text_color = ( m_pat->isMuted() || m_pat->getTrack()->isMuted() ) - ? QColor( 30, 30, 30 ) - : textColor(); - if( m_pat->name() != m_pat->instrumentTrack()->name() ) { - p.setPen( QColor( 0, 0, 0 ) ); + p.setPen( textShadowColor() ); p.drawText( 4, p.fontMetrics().height()+1, m_pat->name() ); - p.setPen( text_color ); + p.setPen( textColor() ); p.drawText( 3, p.fontMetrics().height(), m_pat->name() ); } diff --git a/src/tracks/SampleTrack.cpp b/src/tracks/SampleTrack.cpp index 2f64fd7ef2d..c26df7cfb75 100644 --- a/src/tracks/SampleTrack.cpp +++ b/src/tracks/SampleTrack.cpp @@ -363,20 +363,23 @@ void SampleTCOView::paintEvent( QPaintEvent * _pe ) } else { - c = QColor( 80, 80, 80 ); + c = mutedColor(); } if( isSelected() == true ) { - c.setRgb( qMax( c.red() - 128, 0 ), qMax( c.green() - 128, 0 ), 255 ); + c = selectedColor(); } - QLinearGradient grad( 0, 0, 0, height() ); + QLinearGradient lingrad( 0, 0, 0, height() ); - grad.setColorAt( 1, c.darker( 300 ) ); - grad.setColorAt( 0, c ); - - p.setBrush( grad ); + lingrad.setColorAt( 1, c.darker( 300 ) ); + lingrad.setColorAt( 0, c ); + if ( gradient() ){ + p.setBrush( lingrad ); + } else { + p.setBrush( c ); + } p.setPen( c.lighter( 160 ) ); p.drawRect( 1, 1, width()-3, height()-3 ); @@ -414,7 +417,7 @@ void SampleTCOView::paintEvent( QPaintEvent * _pe ) { p.setFont( pointSize<7>( p.font() ) ); - p.setPen( QColor( 0, 0, 0 ) ); + p.setPen( textShadowColor() ); p.drawText( 10, p.fontMetrics().height()+1, "Rec" ); p.setPen( textColor() ); p.drawText( 9, p.fontMetrics().height(), "Rec" );