diff --git a/data/themes/classic/style.css b/data/themes/classic/style.css index e377776da77..936edcc2f0d 100644 --- a/data/themes/classic/style.css +++ b/data/themes/classic/style.css @@ -115,8 +115,8 @@ PianoRoll { qproperty-gridColor: rgb( 128, 128, 128 ); qproperty-noteModeColor: rgb( 255, 255, 255 ); qproperty-noteColor: rgb( 119, 199, 216 ); - qproperty-noteBorderRadiusX: 5; - qproperty-noteBorderRadiusY: 2; + qproperty-noteOpacity: 128; + qproperty-noteBorders: true; /* boolean property, set false to have borderless notes */ qproperty-selectedNoteColor: rgb( 0, 125, 255 ); qproperty-barColor: #4afd85; qproperty-markedSemitoneColor: rgba( 40, 40, 40, 200 ); @@ -555,7 +555,7 @@ TrackContentObjectView { qproperty-selectedColor: rgb( 0, 125, 255 ); qproperty-textColor: rgb( 255, 255, 255 ); qproperty-textShadowColor: rgb( 0, 0, 0 ); - qproperty-gradient: true; + qproperty-gradient: true; /* boolean property, set true to have a gradient */ } /* instrument pattern */ diff --git a/data/themes/default/style.css b/data/themes/default/style.css index cceb0855767..7645a501f64 100755 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -15,7 +15,7 @@ AutomationEditor { background-color: #040506; color: #ffffff; qproperty-vertexColor: #7f0a1d; - qproperty-gridColor: #171a1d; + qproperty-gridColor: #2d3339; qproperty-crossColor: #FE143A; qproperty-graphColor: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:1, @@ -109,12 +109,12 @@ QMenu::indicator:selected { PianoRoll { background-color: #040506; - qproperty-gridColor: #171a1d; + qproperty-gridColor: #2d3339; qproperty-noteModeColor: #0bd556; qproperty-noteColor: #0bd556; - qproperty-noteBorderRadiusX: 0; - qproperty-noteBorderRadiusY: 0; - qproperty-selectedNoteColor: #044d1f; + qproperty-noteOpacity: 165; + qproperty-noteBorders: false; /* boolean property, set false to have borderless notes */ + qproperty-selectedNoteColor: #006b65; qproperty-barColor: #078f3a; qproperty-markedSemitoneColor: #06170E; /* Text on the white piano keys */ @@ -544,7 +544,7 @@ TrackContentObjectView { qproperty-selectedColor: #006B65; qproperty-textColor: #fff; qproperty-textShadowColor: rgb(0,0,0,200); - qproperty-gradient: false; + qproperty-gradient: false; /* boolean property, set true to have a gradient */ } /* instrument pattern */ diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 28f323defe1..fe00a593d80 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -57,13 +57,13 @@ class PianoRoll : public QWidget Q_PROPERTY( QColor noteModeColor READ noteModeColor WRITE setNoteModeColor ) Q_PROPERTY( QColor noteColor READ noteColor WRITE setNoteColor ) Q_PROPERTY( QColor barColor READ barColor WRITE setBarColor ) - Q_PROPERTY( float noteBorderRadiusX READ noteBorderRadiusX WRITE setNoteBorderRadiusX ) - Q_PROPERTY( float noteBorderRadiusY READ noteBorderRadiusY WRITE setNoteBorderRadiusY ) Q_PROPERTY( QColor selectedNoteColor READ selectedNoteColor WRITE setSelectedNoteColor ) Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor ) Q_PROPERTY( QColor textColorLight READ textColorLight WRITE setTextColorLight ) Q_PROPERTY( QColor textShadow READ textShadow WRITE setTextShadow ) Q_PROPERTY( QColor markedSemitoneColor READ markedSemitoneColor WRITE setMarkedSemitoneColor ) + Q_PROPERTY( int noteOpacity READ noteOpacity WRITE setNoteOpacity ) + Q_PROPERTY( bool noteBorders READ noteBorders WRITE setNoteBorders ) public: enum EditModes { @@ -116,10 +116,6 @@ class PianoRoll : public QWidget void setNoteColor( const QColor & c ); QColor barColor() const; void setBarColor( const QColor & c ); - float noteBorderRadiusX() const; - void setNoteBorderRadiusX( float b ); - float noteBorderRadiusY() const; - void setNoteBorderRadiusY( float b ); QColor selectedNoteColor() const; void setSelectedNoteColor( const QColor & c ); QColor textColor() const; @@ -130,6 +126,10 @@ class PianoRoll : public QWidget void setTextShadow( const QColor & c ); QColor markedSemitoneColor() const; void setMarkedSemitoneColor( const QColor & c ); + int noteOpacity() const; + void setNoteOpacity( const int i ); + bool noteBorders() const; + void setNoteBorders( const bool b ); protected: @@ -148,7 +148,7 @@ class PianoRoll : public QWidget int getKey( int y ) const; static void drawNoteRect( QPainter & p, int x, int y, int width, const Note * n, const QColor & noteCol, - float radiusX, float radiusY, const QColor & selCol ); + const QColor & selCol, const int noteOpc, const bool borderless ); void removeSelection(); void selectAll(); NoteVector getSelectedNotes(); @@ -372,13 +372,13 @@ protected slots: QColor m_noteModeColor; QColor m_noteColor; QColor m_barColor; - float m_noteBorderRadiusX; - float m_noteBorderRadiusY; QColor m_selectedNoteColor; QColor m_textColor; QColor m_textColorLight; QColor m_textShadow; QColor m_markedSemitoneColor; + int m_noteOpacity; + bool m_noteBorders; signals: void positionChanged( const MidiTime & ); diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 3fafca3ebcb..b3b4c398e4d 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -190,13 +190,13 @@ PianoRoll::PianoRoll() : m_noteModeColor( 0, 0, 0 ), m_noteColor( 0, 0, 0 ), m_barColor( 0, 0, 0 ), - m_noteBorderRadiusX( 0 ), - m_noteBorderRadiusY( 0 ), m_selectedNoteColor( 0, 0, 0 ), m_textColor( 0, 0, 0 ), m_textColorLight( 0, 0, 0 ), m_textShadow( 0, 0, 0 ), - m_markedSemitoneColor( 0, 0, 0 ) + m_markedSemitoneColor( 0, 0, 0 ), + m_noteOpacity( 255 ), + m_noteBorders( true ) { // gui names of edit modes m_nemStr.push_back( tr( "Note Velocity" ) ); @@ -746,18 +746,6 @@ QColor PianoRoll::barColor() const void PianoRoll::setBarColor( const QColor & c ) { m_barColor = c; } -float PianoRoll::noteBorderRadiusX() const -{ return m_noteBorderRadiusX; } - -void PianoRoll::setNoteBorderRadiusX( float b ) -{ m_noteBorderRadiusX = b; } - -float PianoRoll::noteBorderRadiusY() const -{ return m_noteBorderRadiusY; } - -void PianoRoll::setNoteBorderRadiusY( float b ) -{ m_noteBorderRadiusY = b; } - QColor PianoRoll::selectedNoteColor() const { return m_selectedNoteColor; } @@ -788,9 +776,25 @@ QColor PianoRoll::markedSemitoneColor() const void PianoRoll::setMarkedSemitoneColor( const QColor & c ) { m_markedSemitoneColor = c; } -void PianoRoll::drawNoteRect(QPainter & p, int x, int y, +int PianoRoll::noteOpacity() const +{ return m_noteOpacity; } + +void PianoRoll::setNoteOpacity( const int i ) +{ m_noteOpacity = i; } + +bool PianoRoll::noteBorders() const +{ return m_noteBorders; } + +void PianoRoll::setNoteBorders( const bool b ) +{ m_noteBorders = b; } + + + + + +void PianoRoll::drawNoteRect( QPainter & p, int x, int y, int width, const Note * n, const QColor & noteCol, - float radiusX, float radiusY, const QColor & selCol ) + const QColor & selCol, const int noteOpc, const bool borders ) { ++x; ++y; @@ -801,8 +805,8 @@ void PianoRoll::drawNoteRect(QPainter & p, int x, int y, width = 2; } - int volVal = qMin( 255, 25 + (int) ( ( (float)( n->getVolume() - MinVolume ) ) / - ( (float)( MaxVolume - MinVolume ) ) * 230.0f) ); + int volVal = qMin( 255, 100 + (int) ( ( (float)( n->getVolume() - MinVolume ) ) / + ( (float)( MaxVolume - MinVolume ) ) * 155.0f) ); float rightPercent = qMin( 1.0f, ( (float)( n->getPanning() - PanningLeft ) ) / ( (float)( PanningRight - PanningLeft ) ) * 2.0f ); @@ -812,37 +816,47 @@ void PianoRoll::drawNoteRect(QPainter & p, int x, int y, ( (float)( PanningRight - PanningLeft ) ) * 2.0f ); QColor col = QColor( noteCol ); + QPen pen; if( n->selected() ) { col = QColor( selCol ); } + const int borderWidth = borders ? 1 : 0; + + const int noteHeight = KEY_LINE_HEIGHT - 1 - borderWidth; + int noteWidth = width + 1 - borderWidth; + // adjust note to make it a bit faded if it has a lower volume // in stereo using gradients QColor lcol = QColor::fromHsv( col.hue(), col.saturation(), - volVal * leftPercent ); + volVal * leftPercent, noteOpc ); QColor rcol = QColor::fromHsv( col.hue(), col.saturation(), - volVal * rightPercent ); + volVal * rightPercent, noteOpc ); - QLinearGradient gradient( x, y, x+width, y+KEY_LINE_HEIGHT ); - gradient.setColorAt( 0, lcol ); - gradient.setColorAt( 1, rcol ); + QLinearGradient gradient( x, y, x, y + noteHeight ); + gradient.setColorAt( 0, rcol ); + gradient.setColorAt( 1, lcol ); p.setBrush( gradient ); - p.setPen( col ); - p.setRenderHint(QPainter::Antialiasing); - p.drawRoundedRect( QRectF ( x + 0.5, y - 0.5, width, KEY_LINE_HEIGHT ), radiusX, radiusY ); + if ( borders ) + { + p.setPen( col ); + } + else + { + p.setPen( Qt::NoPen ); + } + + p.drawRect( x, y, noteWidth, noteHeight ); - // that little tab thing on the end hinting at the user - // to resize the note - p.setPen( noteCol.lighter( 200 ) ); - p.setBrush( noteCol.lighter( 200 ) ); + // draw the note endmark, to hint the user to resize + p.setBrush( col ); if( width > 2 ) { - float leftIndent = 2.5; - float vertIndent = 3.5; - p.drawRect( QRectF (x + width - leftIndent, y + vertIndent, 1, KEY_LINE_HEIGHT - (2*vertIndent + 1) ) ); + const int endmarkWidth = 3 - borderWidth; + p.drawRect( x + noteWidth - endmarkWidth, y, endmarkWidth, noteHeight ); } } @@ -2972,7 +2986,8 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) // note drawNoteRect( p, x + WHITE_KEY_WIDTH, y_base - key * KEY_LINE_HEIGHT, - note_width, note, noteColor(), noteBorderRadiusX(), noteBorderRadiusY(), selectedNoteColor() ); + note_width, note, noteColor(), selectedNoteColor(), + noteOpacity(), noteBorders() ); } // draw note editing stuff @@ -3010,12 +3025,12 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) ( (float)( (PanningRight - PanningLeft ) ) ) * ( (float)( noteEditBottom() - noteEditTop() ) ); - p.drawLine( QLineF( noteEditLeft() + x + 0.5, noteEditTop() + 0.5 + + p.drawLine( QLine( noteEditLeft() + x, noteEditTop() + ( (float)( noteEditBottom() - noteEditTop() ) ) / 2.0f, - noteEditLeft() + x + 0.5, editHandleTop + 0.5 ) ); + noteEditLeft() + x , editHandleTop ) ); } - editHandles << QPointF ( x + noteEditLeft() + 0.5, - editHandleTop + 1.5 ); + editHandles << QPoint ( x + noteEditLeft(), + editHandleTop ); if( note->hasDetuningInfo() ) {