Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix marked semitones in the piano roll
  • Loading branch information
Umcaruje committed Mar 12, 2018
commit 14a748c87c6a0942733f2f5eaec1a8c860e74b8f
2 changes: 1 addition & 1 deletion data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ PianoRoll {
qproperty-noteBorders: false; /* boolean property, set false to have borderless notes */
qproperty-selectedNoteColor: #006b65;
qproperty-barColor: #078f3a;
qproperty-markedSemitoneColor: #06170E;
qproperty-markedSemitoneColor: rgba(255, 255, 255, 20);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this for classic theme too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always forget about that, will fix

/* Grid colors */
qproperty-lineColor: #292929;
qproperty-beatLineColor: #2d6b45;
Expand Down
32 changes: 15 additions & 17 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2633,23 +2633,6 @@ void PianoRoll::paintEvent(QPaintEvent * pe )

int key = m_startKey;

// display note marks before drawing other lines
for( int i = 0; i < m_markedSemiTones.size(); i++ )
{
const int key_num = m_markedSemiTones.at( i );
const int y = keyAreaBottom() + 5
- KEY_LINE_HEIGHT * ( key_num - m_startKey + 1 );

if( y > keyAreaBottom() )
{
break;
}

p.fillRect( WHITE_KEY_WIDTH + 1, y - KEY_LINE_HEIGHT / 2, width() - 10, KEY_LINE_HEIGHT,
markedSemitoneColor() );
}


// draw all white keys...
for( int y = key_line_y + 1 + y_offset; y > PR_TOP_MARGIN;
key_line_y -= KEY_LINE_HEIGHT, ++keys_processed )
Expand Down Expand Up @@ -2936,6 +2919,21 @@ void PianoRoll::paintEvent(QPaintEvent * pe )
}
}

// draw marked semitones after the grid
for( int i = 0; i < m_markedSemiTones.size(); i++ )
{
const int key_num = m_markedSemiTones.at( i );
const int y = keyAreaBottom() + 5
- KEY_LINE_HEIGHT * ( key_num - m_startKey + 1 );

if( y > keyAreaBottom() )
{
break;
}

p.fillRect( WHITE_KEY_WIDTH + 1, y - KEY_LINE_HEIGHT / 2, width() - 10, KEY_LINE_HEIGHT + 1,
markedSemitoneColor() );
}

// following code draws all notes in visible area
// and the note editing stuff (volume, panning, etc)
Expand Down