Merge pull request #2574 from Umcaruje/gradients

Refactor the drawing of TCO's; Get rid of hardcoded colors in TCOs; Even out the color scheme
This commit is contained in:
Umcaruje
2016-03-03 09:22:12 +01:00
12 changed files with 466 additions and 342 deletions

View File

@@ -25,6 +25,8 @@
#ifndef AUTOMATION_PATTERN_VIEW_H
#define AUTOMATION_PATTERN_VIEW_H
#include <QStaticText>
#include "Track.h"
class AutomationPattern;
@@ -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 );
@@ -59,12 +58,7 @@ 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 );
@@ -72,7 +66,8 @@ protected:
private:
AutomationPattern * m_pat;
QPixmap m_paintPixmap;
bool m_needsUpdate;
QStaticText m_staticTextName;
static QPixmap * s_pat_rec;

View File

@@ -29,6 +29,7 @@
#include <QtCore/QObject>
#include <QtCore/QMap>
#include <QStaticText>
#include "Track.h"
@@ -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;
} ;

View File

@@ -31,6 +31,7 @@
#include <QDialog>
#include <QtCore/QThread>
#include <QPixmap>
#include <QStaticText>
#include "Note.h"
@@ -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();
@@ -182,12 +180,7 @@ protected:
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 );
@@ -199,7 +192,8 @@ private:
Pattern* m_pat;
QPixmap m_paintPixmap;
bool m_needsUpdate;
QStaticText m_staticTextName;
} ;

View File

@@ -88,10 +88,6 @@ signals:
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 );
@@ -102,6 +98,7 @@ public slots:
void updateSample();
protected:
virtual void contextMenuEvent( QContextMenuEvent * _cme );
virtual void mousePressEvent( QMouseEvent * _me );
@@ -113,6 +110,7 @@ protected:
private:
SampleTCO * m_tco;
QPixmap m_paintPixmap;
} ;

View File

@@ -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 );
@@ -204,16 +208,29 @@ public:
{
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 * )
@@ -227,6 +244,11 @@ protected:
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();
@@ -267,9 +289,14 @@ private:
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;