From e273781e6a0744d1ec7c6e02a697afa53215d33a Mon Sep 17 00:00:00 2001 From: bonaime Date: Wed, 29 Apr 2026 00:37:23 +0200 Subject: [PATCH 1/7] Fix #448 and also allow to change a muted note to a real note --- source/app/powertabeditor.cpp | 101 +++++++++++++++++++++++----------- 1 file changed, 69 insertions(+), 32 deletions(-) diff --git a/source/app/powertabeditor.cpp b/source/app/powertabeditor.cpp index 310f4ec8..ac62daaa 100644 --- a/source/app/powertabeditor.cpp +++ b/source/app/powertabeditor.cpp @@ -2076,9 +2076,12 @@ bool PowerTabEditor::eventFilter(QObject *object, QEvent *event) if (scorearea && event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast(event); - if (keyEvent->key() >= Qt::Key_0 && keyEvent->key() <= Qt::Key_9) + // x for a muted note + const bool isMutedKey = (keyEvent->key() == Qt::Key_X); + if (keyEvent->key() >= Qt::Key_0 && keyEvent->key() <= Qt::Key_9 || + isMutedKey) { - const int number = keyEvent->key() - Qt::Key_0; + const int number = isMutedKey ? 0 : (keyEvent->key() - Qt::Key_0); ScoreLocation &location = getLocation(); // Add a space if the user is attempting to add a note at the end of @@ -2093,42 +2096,76 @@ bool PowerTabEditor::eventFilter(QObject *object, QEvent *event) // unless it's the first position of the system. if (!location.getBarline() || location.getPositionIndex() == 0) { - // Update the existing note if possible. - if (location.getNote()) - { - myUndoManager->push(new EditTabNumber(location, number), - location.getSystemIndex()); - } - else + if (isMutedKey && !location.getNote()) { + // Directly insert a new muted note without requiring a + // number to be entered first. + Note mutedNote(location.getString(), 0); + mutedNote.setProperty(Note::Muted); myUndoManager->push( - new AddNote(location, - Note(location.getString(), number), - myActiveDurationType), - location.getSystemIndex()); + new AddNote(location, mutedNote, myActiveDurationType), + location.getSystemIndex()); + return true; } - if (mySettingsManager->getReadHandle()->get( - Settings::PlayNotesWhileEditing)) + if (!isMutedKey) { - const ScoreLocation &location = getLocation(); - // Generate the midi data and then transfer it to the midi - // thread. - MidiFile midi_data = MidiPlayer::generateSingleNote( - location, *mySettingsManager); - MidiPlaybackSettings initial_settings(100, - location.getScore()); - - QMetaObject::invokeMethod( - myMidiPlayer, - [=, this, midi_data = std::move(midi_data)]() mutable { - myMidiPlayer->playSingleNote(midi_data, location, - initial_settings); - }, - Qt::QueuedConnection); - } + // Update the existing note if possible. + if (location.getNote()) + { + const Note *note = location.getNote(); + if (note->hasProperty(Note::Muted)) + { + // Remove the muted property and set the fret number + // as a single undoable action. + myUndoManager->beginMacro(tr("Edit Tab Number")); + myUndoManager->push( + new RemoveNoteProperty(location, Note::Muted, + tr("Muted")), + location.getSystemIndex()); + myUndoManager->push( + new EditTabNumber(location, number), + location.getSystemIndex()); + myUndoManager->endMacro(); + } + else + { + myUndoManager->push( + new EditTabNumber(location, number), + location.getSystemIndex()); + } + } + else + { + myUndoManager->push( + new AddNote(location, + Note(location.getString(), number), + myActiveDurationType), + location.getSystemIndex()); + } - return true; + if (mySettingsManager->getReadHandle()->get( + Settings::PlayNotesWhileEditing)) + { + const ScoreLocation &location = getLocation(); + // Generate the midi data and then transfer it to the midi + // thread. + MidiFile midi_data = MidiPlayer::generateSingleNote( + location, *mySettingsManager); + MidiPlaybackSettings initial_settings(100, + location.getScore()); + + QMetaObject::invokeMethod( + myMidiPlayer, + [=, this, midi_data = std::move(midi_data)]() mutable { + myMidiPlayer->playSingleNote(midi_data, location, + initial_settings); + }, + Qt::QueuedConnection); + } + + return true; + } } } } From 950a1e4e5a355bba4896a29cf4145d45d921910e Mon Sep 17 00:00:00 2001 From: Sebastien Date: Wed, 29 Apr 2026 21:32:47 +0200 Subject: [PATCH 2/7] Update source/app/powertabeditor.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- source/app/powertabeditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/app/powertabeditor.cpp b/source/app/powertabeditor.cpp index ac62daaa..67b3ed1e 100644 --- a/source/app/powertabeditor.cpp +++ b/source/app/powertabeditor.cpp @@ -2078,7 +2078,7 @@ bool PowerTabEditor::eventFilter(QObject *object, QEvent *event) QKeyEvent *keyEvent = static_cast(event); // x for a muted note const bool isMutedKey = (keyEvent->key() == Qt::Key_X); - if (keyEvent->key() >= Qt::Key_0 && keyEvent->key() <= Qt::Key_9 || + if ((keyEvent->key() >= Qt::Key_0 && keyEvent->key() <= Qt::Key_9) || isMutedKey) { const int number = isMutedKey ? 0 : (keyEvent->key() - Qt::Key_0); From ba890c20fb56f429a502dbdbeb0fdb6f378ff894 Mon Sep 17 00:00:00 2001 From: Sebastien Date: Wed, 29 Apr 2026 23:13:23 +0200 Subject: [PATCH 3/7] Update source/app/powertabeditor.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- source/app/powertabeditor.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/app/powertabeditor.cpp b/source/app/powertabeditor.cpp index 67b3ed1e..171ba948 100644 --- a/source/app/powertabeditor.cpp +++ b/source/app/powertabeditor.cpp @@ -2116,11 +2116,19 @@ bool PowerTabEditor::eventFilter(QObject *object, QEvent *event) const Note *note = location.getNote(); if (note->hasProperty(Note::Muted)) { - // Remove the muted property and set the fret number - // as a single undoable action. + // Remove the muted property only from the caret note + // and set the fret number as a single undoable + // action. + ScoreLocation singleNoteLocation(location); + singleNoteLocation.setSelectionStart( + location.getPositionIndex()); + singleNoteLocation.setSelectionEnd( + location.getPositionIndex()); + myUndoManager->beginMacro(tr("Edit Tab Number")); myUndoManager->push( - new RemoveNoteProperty(location, Note::Muted, + new RemoveNoteProperty(singleNoteLocation, + Note::Muted, tr("Muted")), location.getSystemIndex()); myUndoManager->push( From d6feb334c8742c0a945e91d197a3c6d176e03aeb Mon Sep 17 00:00:00 2001 From: Sebastien Date: Wed, 29 Apr 2026 23:16:53 +0200 Subject: [PATCH 4/7] Update source/app/powertabeditor.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- source/app/powertabeditor.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/source/app/powertabeditor.cpp b/source/app/powertabeditor.cpp index 171ba948..fbd63ec2 100644 --- a/source/app/powertabeditor.cpp +++ b/source/app/powertabeditor.cpp @@ -2155,7 +2155,6 @@ bool PowerTabEditor::eventFilter(QObject *object, QEvent *event) if (mySettingsManager->getReadHandle()->get( Settings::PlayNotesWhileEditing)) { - const ScoreLocation &location = getLocation(); // Generate the midi data and then transfer it to the midi // thread. MidiFile midi_data = MidiPlayer::generateSingleNote( From 020bcabf4f32f5d56ec055cbaa000aefad481e15 Mon Sep 17 00:00:00 2001 From: bonaime Date: Wed, 29 Apr 2026 23:56:01 +0200 Subject: [PATCH 5/7] undo ba890c20fb56f429a502dbdbeb0fdb6f378ff894 --- CMakeLists.txt | 4 ++-- source/app/powertabeditor.cpp | 14 +++----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd25e3f5..5970099e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required( VERSION 3.12 ) -# Target OS X 10.15 and above. This must be set before the first project() call. -set( CMAKE_OSX_DEPLOYMENT_TARGET "10.15" +# Target OS X 14.0 and above. This must be set before the first project() call. +set( CMAKE_OSX_DEPLOYMENT_TARGET "14.0" CACHE STRING "Minimum OS X deployment version" ) diff --git a/source/app/powertabeditor.cpp b/source/app/powertabeditor.cpp index fbd63ec2..0d1b0dda 100644 --- a/source/app/powertabeditor.cpp +++ b/source/app/powertabeditor.cpp @@ -2116,19 +2116,11 @@ bool PowerTabEditor::eventFilter(QObject *object, QEvent *event) const Note *note = location.getNote(); if (note->hasProperty(Note::Muted)) { - // Remove the muted property only from the caret note - // and set the fret number as a single undoable - // action. - ScoreLocation singleNoteLocation(location); - singleNoteLocation.setSelectionStart( - location.getPositionIndex()); - singleNoteLocation.setSelectionEnd( - location.getPositionIndex()); - + // Remove the muted property and set the fret number + // as a single undoable action. myUndoManager->beginMacro(tr("Edit Tab Number")); myUndoManager->push( - new RemoveNoteProperty(singleNoteLocation, - Note::Muted, + new RemoveNoteProperty(location, Note::Muted, tr("Muted")), location.getSystemIndex()); myUndoManager->push( From 2ca448f60516ed9a60056b48ccb229af264d638c Mon Sep 17 00:00:00 2001 From: bonaime Date: Thu, 11 Jun 2026 09:33:12 +0200 Subject: [PATCH 6/7] Macos CMAKE CMAKE_OSX_DEPLOYMENT_TARGET --- CMakeLists.txt | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5970099e..d2202642 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,29 @@ cmake_minimum_required( VERSION 3.12 ) + + # Target OS X 14.0 and above. This must be set before the first project() call. -set( CMAKE_OSX_DEPLOYMENT_TARGET "14.0" - CACHE STRING "Minimum OS X deployment version" -) +if(APPLE) + # Detect macOS version + execute_process( + COMMAND sw_vers -productVersion + OUTPUT_VARIABLE MACOS_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REGEX MATCH "^[0-9]+" MACOS_MAJOR "${MACOS_VERSION}") + message(STATUS "macOS major version: ${MACOS_MAJOR}") + + if(MACOS_MAJOR VERSION_LESS 15.0) + set(CMAKE_OSX_DEPLOYMENT_TARGET 14.0) + else() + set(CMAKE_OSX_DEPLOYMENT_TARGET 15.0) + endif() +endif() + +message(CMAKE_OSX_DEPLOYMENT_TARGET="${CMAKE_OSX_DEPLOYMENT_TARGET}") + + + project( powertabeditor ) include( CTest ) From 5524976c17bbc42cd7200db9cb10986373f09a08 Mon Sep 17 00:00:00 2001 From: Cameron White Date: Sat, 27 Jun 2026 23:32:17 -0400 Subject: [PATCH 7/7] Match cmake formatting style --- CMakeLists.txt | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d2202642..a45f4741 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,29 +1,24 @@ cmake_minimum_required( VERSION 3.12 ) - - -# Target OS X 14.0 and above. This must be set before the first project() call. -if(APPLE) +# Target OS X 15.0 and above. This must be set before the first project() call. +if ( APPLE ) # Detect macOS version - execute_process( - COMMAND sw_vers -productVersion - OUTPUT_VARIABLE MACOS_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE + execute_process ( + COMMAND sw_vers -productVersion + OUTPUT_VARIABLE MACOS_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE ) - string(REGEX MATCH "^[0-9]+" MACOS_MAJOR "${MACOS_VERSION}") - message(STATUS "macOS major version: ${MACOS_MAJOR}") - - if(MACOS_MAJOR VERSION_LESS 15.0) - set(CMAKE_OSX_DEPLOYMENT_TARGET 14.0) - else() - set(CMAKE_OSX_DEPLOYMENT_TARGET 15.0) - endif() -endif() - -message(CMAKE_OSX_DEPLOYMENT_TARGET="${CMAKE_OSX_DEPLOYMENT_TARGET}") - + string( REGEX MATCH "^[0-9]+" MACOS_MAJOR "${MACOS_VERSION}" ) + message( STATUS "macOS major version: ${MACOS_MAJOR}" ) + if ( MACOS_MAJOR VERSION_LESS 15.0 ) + set( CMAKE_OSX_DEPLOYMENT_TARGET 14.0 ) + else () + set( CMAKE_OSX_DEPLOYMENT_TARGET 15.0 ) + endif () + message( STATUS CMAKE_OSX_DEPLOYMENT_TARGET="${CMAKE_OSX_DEPLOYMENT_TARGET}" ) +endif () project( powertabeditor ) include( CTest )