Skip to content

Commit

Permalink
Refactor the drawing of TCO's; Get rid of hardcoded colors in TCOs; M…
Browse files Browse the repository at this point in the history
…ake TCO gradient configurable; Even out the color scheme
  • Loading branch information
Umcaruje committed Feb 20, 2016
1 parent 8841b89 commit 57df63d
Show file tree
Hide file tree
Showing 10 changed files with 273 additions and 224 deletions.
29 changes: 27 additions & 2 deletions data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -540,28 +540,53 @@ 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-mutedColor: red;
qproperty-selectedColor: green;
qproperty-fgColor: red;
qproperty-fgMutedColor: green;
qproperty-textColor: red;
qproperty-textShadowColor: green;
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 */
Expand Down
5 changes: 2 additions & 3 deletions include/AutomationPatternView.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#ifndef AUTOMATION_PATTERN_VIEW_H
#define AUTOMATION_PATTERN_VIEW_H

#include <QStaticText>

#include "Track.h"

class AutomationPattern;
Expand All @@ -34,9 +36,6 @@ class AutomationPatternView : public TrackContentObjectView
{
Q_OBJECT

// theming qproperties
Q_PROPERTY( QColor fgColor READ fgColor WRITE setFgColor )
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )

public:
AutomationPatternView( AutomationPattern * _pat, TrackView * _parent );
Expand Down
4 changes: 3 additions & 1 deletion include/BBTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <QtCore/QObject>
#include <QtCore/QMap>
#include <QStaticText>

#include "Track.h"

Expand Down Expand Up @@ -114,7 +115,8 @@ protected slots:

private:
BBTCO * m_bbTCO;


QStaticText m_staticTextName;
} ;


Expand Down
4 changes: 1 addition & 3 deletions include/Pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <QDialog>
#include <QtCore/QThread>
#include <QPixmap>
#include <QStaticText>


#include "Note.h"
Expand Down Expand Up @@ -159,9 +160,6 @@ class PatternView : public TrackContentObjectView
{
Q_OBJECT

// theming qproperties
Q_PROPERTY( QColor fgColor READ fgColor WRITE setFgColor )
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
public:
PatternView( Pattern* pattern, TrackView* parent );
virtual ~PatternView();
Expand Down
20 changes: 20 additions & 0 deletions include/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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();
Expand Down Expand Up @@ -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 )
{
Expand Down
54 changes: 44 additions & 10 deletions src/core/Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand All @@ -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 );

Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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 ) );
Expand All @@ -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();

Expand Down Expand Up @@ -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();
Expand Down
Loading

0 comments on commit 57df63d

Please sign in to comment.