Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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"
)

Expand Down
100 changes: 68 additions & 32 deletions source/app/powertabeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2076,9 +2076,12 @@ bool PowerTabEditor::eventFilter(QObject *object, QEvent *event)
if (scorearea && event->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(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
Expand All @@ -2093,42 +2096,75 @@ 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))
{
// 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;
}
}
}
}
Expand Down
Loading