Skip to content

Commit

Permalink
Define all pattern colours in CSS and make them stylable
Browse files Browse the repository at this point in the history
also coding style improvements (remove leading underscores from header guards)
  • Loading branch information
diizy committed Feb 25, 2014
1 parent 2100bf8 commit e7b097d
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 29 deletions.
17 changes: 17 additions & 0 deletions data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,23 @@ TrackContainerView QLabel
background: none;
}

/* Patterns */

/* instrument pattern */
patternView {
color: rgb( 119, 199, 216 );
}

/* sample track pattern */
SampleTCOView {
color: rgb( 74, 253, 133 );
}

/* automation pattern */
AutomationPatternView {
color: #99afff;
}

/* Plugins */

TripleOscillatorView knob {
Expand Down
6 changes: 3 additions & 3 deletions include/AutomationPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Copyright (c) 2008-2013 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
Expand All @@ -24,8 +24,8 @@
*
*/

#ifndef _AUTOMATION_PATTERN_H
#define _AUTOMATION_PATTERN_H
#ifndef AUTOMATION_PATTERN_H
#define AUTOMATION_PATTERN_H

#include <QtCore/QPointer>

Expand Down
4 changes: 2 additions & 2 deletions include/AutomationPatternView.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
*
*/

#ifndef _AUTOMATION_PATTERN_VIEW_H
#define _AUTOMATION_PATTERN_VIEW_H
#ifndef AUTOMATION_PATTERN_VIEW_H
#define AUTOMATION_PATTERN_VIEW_H

#include "track.h"

Expand Down
4 changes: 2 additions & 2 deletions include/AutomationTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
*
*/

#ifndef _AUTOMATION_TRACK_H
#define _AUTOMATION_TRACK_H
#ifndef AUTOMATION_TRACK_H
#define AUTOMATION_TRACK_H

#include "track.h"

Expand Down
4 changes: 2 additions & 2 deletions include/SampleTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
*
*/

#ifndef _SAMPLE_TRACK_H
#define _SAMPLE_TRACK_H
#ifndef SAMPLE_TRACK_H
#define SAMPLE_TRACK_H

#include <QtGui/QDialog>

Expand Down
6 changes: 3 additions & 3 deletions include/bb_track.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* (which is a singleton-class) as track
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
Expand All @@ -24,8 +24,8 @@
*/


#ifndef _BB_TRACK_H
#define _BB_TRACK_H
#ifndef BB_TRACK_H
#define BB_TRACK_H

#include <QtCore/QObject>
#include <QtCore/QMap>
Expand Down
4 changes: 2 additions & 2 deletions include/pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
*
*/

#ifndef _PATTERN_H
#define _PATTERN_H
#ifndef PATTERN_H
#define PATTERN_H

#include <QtCore/QVector>
#include <QtGui/QWidget>
Expand Down
4 changes: 2 additions & 2 deletions include/track.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
*
*/

#ifndef _TRACK_H
#define _TRACK_H
#ifndef TRACK_H
#define TRACK_H

#include <QtCore/QVector>
#include <QtCore/QList>
Expand Down
2 changes: 1 addition & 1 deletion src/core/TrackContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* like Song-Editor, BB-Editor...
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
Expand Down
6 changes: 3 additions & 3 deletions src/core/track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ void trackContentWidget::updateBackground()
pmp.setPen( QPen( QColor( 0, 0, 0, 160 ), 1 ) );
// horizontal line
pmp.drawLine( 0, 0, w*2, 0 );

// vertical lines
for( float x = 0; x < w * 2; x += ppt )
{
Expand Down Expand Up @@ -1850,7 +1850,7 @@ trackContentObject * track::getTCO( int _tco_num )
printf( "called track::getTCO( %d ), "
"but TCO %d doesn't exist\n", _tco_num, _tco_num );
return createTCO( _tco_num * MidiTime::ticksPerTact() );

}


Expand Down Expand Up @@ -2220,7 +2220,7 @@ void trackView::modelChanged()
connect( m_track, SIGNAL( destroyedTrack() ), this, SLOT( close() ) );
m_trackOperationsWidget.m_muteBtn->setModel( &m_track->m_mutedModel );
m_trackOperationsWidget.m_soloBtn->setModel( &m_track->m_soloModel );
ModelView::modelChanged();
ModelView::modelChanged();
setFixedHeight( m_track->getHeight() );
}

Expand Down
11 changes: 7 additions & 4 deletions src/gui/AutomationPatternView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ AutomationPatternView::AutomationPatternView( AutomationPattern * _pattern,

toolTip::add( this, tr( "double-click to open this pattern in "
"automation editor" ) );
setStyle( QApplication::style() );
}


Expand Down Expand Up @@ -203,6 +204,9 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
return;
}

QPainter _p( this );
const QColor styleColor = _p.pen().brush().color();

m_needsUpdate = false;

if( m_paintPixmap.isNull() == true || m_paintPixmap.size() != size() )
Expand All @@ -216,7 +220,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
QColor c;
if( !( m_pat->getTrack()->isMuted() || m_pat->isMuted() ) )
c = isSelected() ? QColor( 0, 0, 224 )
: QColor( 0x99, 0xAF, 0xFF );
: styleColor; //QColor( 0x99, 0xAF, 0xFF );
else
c = QColor( 80,80,80 );

Expand Down Expand Up @@ -274,7 +278,7 @@ 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 );
break;
Expand Down Expand Up @@ -317,8 +321,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * )

p.end();

p.begin( this );
p.drawPixmap( 0, 0, m_paintPixmap );
_p.drawPixmap( 0, 0, m_paintPixmap );

}

Expand Down
3 changes: 2 additions & 1 deletion src/tracks/SampleTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,12 @@ void SampleTCOView::mouseDoubleClickEvent( QMouseEvent * )
void SampleTCOView::paintEvent( QPaintEvent * _pe )
{
QPainter p( this );
const QColor styleColor = p.pen().brush().color();

QColor c;
if( !( m_tco->getTrack()->isMuted() || m_tco->isMuted() ) )
c = isSelected() ? QColor( 0, 0, 224 )
: QColor( 74, 253, 133 );
: styleColor; //QColor( 74, 253, 133 );
else c = QColor( 80, 80, 80 );

QLinearGradient grad( 0, 0, 0, height() );
Expand Down
11 changes: 7 additions & 4 deletions src/tracks/pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,9 @@ void patternView::paintEvent( QPaintEvent * )
return;
}

QPainter _p( this );
const QColor styleColor = _p.pen().brush().color();

m_pat->changeLength( m_pat->length() );

m_needsUpdate = false;
Expand All @@ -837,7 +840,7 @@ void patternView::paintEvent( QPaintEvent * )
if(( m_pat->m_patternType != pattern::BeatPattern ) &&
!( m_pat->getTrack()->isMuted() || m_pat->isMuted() ))
c = isSelected() ? QColor( 0, 0, 224 )
: QColor( 119, 199, 216 );
: styleColor;//QColor( 119, 199, 216 );
else
c = QColor( 80, 80, 80 );

Expand All @@ -851,7 +854,7 @@ void patternView::paintEvent( QPaintEvent * )
lingrad.setColorAt( 0, c.darker( 300 ) );
lingrad.setColorAt( 1, c );
}

p.setBrush( lingrad );
p.setPen( c.darker( 300 ) );
p.drawRect( QRect( 0, 0, width() - 1, height() - 1 ) );
Expand Down Expand Up @@ -1025,8 +1028,8 @@ void patternView::paintEvent( QPaintEvent * )

p.end();

p.begin( this );
p.drawPixmap( 0, 0, m_paintPixmap );
// p.begin( this );
_p.drawPixmap( 0, 0, m_paintPixmap );

}

Expand Down

0 comments on commit e7b097d

Please sign in to comment.