Skip to content

Commit

Permalink
NotePropertiesRuler: support Delete key
Browse files Browse the repository at this point in the history
Delete key does now remove selected notes and notes under cursor in `NotePropertiesRuler`
  • Loading branch information
theGreatWhiteShark committed Oct 18, 2024
1 parent 9932e42 commit 56073c4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ XXXX-XX-XX the hydrogen team <hydrogen-devel@lists.sourceforge.net>
is required on your system for MP3 support. (#2023)
- `X-NSM-Exec` entry added to `org.hydrogenmusic.Hydrogen.desktop` by
@grammoboy2 (#2042).
- Delete key does now remove selected notes and notes under cursor in
NotePropertiesRuler.
* Changed
- Grid lines in the Song Editor are now rendered dotted to emphasize that
this is the space the patterns in rather than objects in their own right.
Expand Down
15 changes: 15 additions & 0 deletions src/gui/src/PatternEditor/NotePropertiesRuler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,21 @@ void NotePropertiesRuler::keyPressEvent( QKeyEvent *ev )
// |<--
m_pPatternEditorPanel->setCursorPosition(0);

} else if ( ev->key() == Qt::Key_Delete ) {
// Key: Delete / Backspace: delete selected notes, or note under keyboard cursor
bUnhideCursor = false;
if ( m_selection.begin() != m_selection.end() ) {
// Delete selected notes if any
m_pPatternEditorPanel->getDrumPatternEditor()->
deleteSelection();
} else {
// Delete note under the keyboard cursor.
m_pPatternEditorPanel->getDrumPatternEditor()->
addOrRemoveNote( m_pPatternEditorPanel->getCursorPosition(), -1,
pHydrogen->getSelectedInstrumentNumber(),
/*bDoAdd=*/false, /*bDoDelete=*/true );
}

} else {

// Value adjustments
Expand Down

0 comments on commit 56073c4

Please sign in to comment.