Skip to content

Commit

Permalink
Merge pull request #2574 from Umcaruje/gradients
Browse files Browse the repository at this point in the history
Refactor the drawing of TCO's; Get rid of hardcoded colors in TCOs; Even out the color scheme
  • Loading branch information
Umcaruje committed Mar 3, 2016
2 parents 988b788 + f136ba3 commit 020b4dd
Show file tree
Hide file tree
Showing 12 changed files with 461 additions and 337 deletions.
30 changes: 18 additions & 12 deletions data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,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 @@ -539,31 +539,37 @@ TrackContainerView QLabel

/* Patterns */

/* common pattern colors */
TrackContentObjectView {
qproperty-mutedColor: rgb( 128, 128, 128 );
qproperty-mutedBackgroundColor: 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;
}

/* instrument pattern */
PatternView {
color: rgb( 119, 199, 216 );
qproperty-fgColor: rgb( 187, 227, 236 );
qproperty-textColor: rgb( 255, 255, 255 );
background-color: rgb( 119, 199, 216 );
color: rgb( 187, 227, 236 );
}

/* sample track pattern */
SampleTCOView {
color: rgb( 74, 253, 133 );
qproperty-fgColor: rgb( 187, 227, 236 );
qproperty-textColor: rgb( 255, 60, 60 );
background-color: rgb( 74, 253, 133 );
color: rgb( 187, 227, 236 );
}

/* automation pattern */
AutomationPatternView {
color: #99afff;
qproperty-fgColor: rgb( 204, 215, 255 );
qproperty-textColor: rgb( 255, 255, 255 );
background-color: #99afff;
color: rgb( 204, 215, 255 );
}

/* 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-textColor: rgb( 255, 255, 255 );
background-color: rgb( 128, 182, 175 ); /* default colour for bb-tracks */
}

/* Plugins */
Expand Down
15 changes: 5 additions & 10 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 All @@ -59,20 +58,16 @@ protected slots:
protected:
virtual void constructContextMenu( QMenu * );
virtual void mouseDoubleClickEvent(QMouseEvent * me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re )
{
m_needsUpdate = true;
TrackContentObjectView::resizeEvent( _re );
}
virtual void paintEvent( QPaintEvent * pe );
virtual void dragEnterEvent( QDragEnterEvent * _dee );
virtual void dropEvent( QDropEvent * _de );


private:
AutomationPattern * m_pat;
QPixmap m_paintPixmap;
bool m_needsUpdate;

QStaticText m_staticTextName;

static QPixmap * s_pat_rec;

Expand Down
9 changes: 6 additions & 3 deletions 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 @@ -107,14 +108,16 @@ protected slots:


protected:
void paintEvent( QPaintEvent * );
void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * pe );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void constructContextMenu( QMenu * );


private:
BBTCO * m_bbTCO;

QPixmap m_paintPixmap;

QStaticText m_staticTextName;
} ;


Expand Down
14 changes: 4 additions & 10 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 All @@ -182,12 +180,7 @@ protected slots:
virtual void constructContextMenu( QMenu * );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re )
{
m_needsUpdate = true;
TrackContentObjectView::resizeEvent( _re );
}
virtual void paintEvent( QPaintEvent * pe );
virtual void wheelEvent( QWheelEvent * _we );


Expand All @@ -199,7 +192,8 @@ protected slots:

Pattern* m_pat;
QPixmap m_paintPixmap;
bool m_needsUpdate;

QStaticText m_staticTextName;
} ;


Expand Down
6 changes: 2 additions & 4 deletions include/SampleTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ public slots:
class SampleTCOView : public TrackContentObjectView
{
Q_OBJECT

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

public:
SampleTCOView( SampleTCO * _tco, TrackView * _tv );
Expand All @@ -102,6 +98,7 @@ public slots:
void updateSample();



protected:
virtual void contextMenuEvent( QContextMenuEvent * _cme );
virtual void mousePressEvent( QMouseEvent * _me );
Expand All @@ -113,6 +110,7 @@ public slots:

private:
SampleTCO * m_tco;
QPixmap m_paintPixmap;
} ;


Expand Down
37 changes: 32 additions & 5 deletions include/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,12 @@ class TrackContentObjectView : public selectableObject, public ModelView
Q_OBJECT

// theming qproperties
Q_PROPERTY( QColor fgColor READ fgColor WRITE setFgColor )
Q_PROPERTY( QColor mutedColor READ mutedColor WRITE setMutedColor )
Q_PROPERTY( QColor mutedBackgroundColor READ mutedBackgroundColor WRITE setMutedBackgroundColor )
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 @@ -204,16 +208,29 @@ class TrackContentObjectView : public selectableObject, public ModelView
{
return m_tco;
}
// qproperty access func
QColor fgColor() const;
// qproperty access func
QColor mutedColor() const;
QColor mutedBackgroundColor() const;
QColor selectedColor() const;
QColor textColor() const;
void setFgColor( const QColor & c );
QColor textShadowColor() 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 setGradient( const bool & b );

// access needsUpdate member variable
bool needsUpdate();
void setNeedsUpdate( bool b );

public slots:
virtual bool close();
void cut();
void remove();
virtual void update();

protected:
virtual void constructContextMenu( QMenu * )
Expand All @@ -227,6 +244,11 @@ public slots:
virtual void mousePressEvent( QMouseEvent * me );
virtual void mouseMoveEvent( QMouseEvent * me );
virtual void mouseReleaseEvent( QMouseEvent * me );
virtual void resizeEvent( QResizeEvent * re )
{
m_needsUpdate = true;
selectableObject::resizeEvent( re );
}

float pixelsPerTact();

Expand Down Expand Up @@ -267,9 +289,14 @@ protected slots:
MidiTime m_oldTime;// used for undo/redo while mouse-button is pressed

// qproperty fields
QColor m_fgColor;
QColor m_mutedColor;
QColor m_mutedBackgroundColor;
QColor m_selectedColor;
QColor m_textColor;
QColor m_textShadowColor;
bool m_gradient;

bool m_needsUpdate;
inline void setInitialMousePos( QPoint pos )
{
m_initialMousePos = pos;
Expand Down
4 changes: 1 addition & 3 deletions src/core/SampleBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,9 +903,7 @@ void SampleBuffer::visualize( QPainter & _p, const QRect & _dr,

const bool focus_on_range = _to_frame <= m_frames
&& 0 <= _from_frame && _from_frame < _to_frame;
// _p.setClipRect( _clip );
// _p.setPen( QColor( 0x22, 0xFF, 0x44 ) );
//_p.setPen( QColor( 64, 224, 160 ) );
//_p.setClipRect( _clip );
const int w = _dr.width();
const int h = _dr.height();

Expand Down
Loading

0 comments on commit 020b4dd

Please sign in to comment.