Skip to content

Commit

Permalink
- Improved status-bar piano keyboard note-on/range key display.
Browse files Browse the repository at this point in the history
  • Loading branch information
rncbc committed Mar 3, 2019
1 parent 7f67d29 commit 12813dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/padthv1widget_keybd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ int padthv1widget_keybd::noteHigh (void) const


// Piano key rectangle finder.
QRect padthv1widget_keybd::noteRect ( int iNote ) const
QRect padthv1widget_keybd::noteRect ( int iNote, bool bOn ) const
{
const int w = QWidget::width();
const int h = QWidget::height();
Expand All @@ -183,9 +183,11 @@ QRect padthv1widget_keybd::noteRect ( int iNote ) const
x2 += int(wk - float(w2 >> 1));
h2 = (h << 1) / 3;
++w2;
} else {
} else if (bOn) {
x2 += (w2 >> 1);
--w2; // <<= 1;
--w2;
} else {
w2 <<= 1;
}

return QRect(x2, 0, w2, h2);
Expand All @@ -205,7 +207,7 @@ void padthv1widget_keybd::noteOn ( int iNote )

// Now for the sounding new one...
note.on = true;
note.rect = noteRect(iNote);
note.rect = noteRect(iNote, true);

QWidget::update(note.rect);
}
Expand Down
2 changes: 1 addition & 1 deletion src/padthv1widget_keybd.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected slots:
int safeNoteHigh(int iNoteHigh) const;

// Piano key rectangle finder.
QRect noteRect(int iNote) const;
QRect noteRect(int iNote, bool bOn = false) const;

// Piano keyboard note-on/off handlers.
void dragNoteOn(const QPoint& pos);
Expand Down

0 comments on commit 12813dc

Please sign in to comment.