Skip to content

Commit

Permalink
Merge pull request #26291 from RomanPudashkin/input_by_duration_mode
Browse files Browse the repository at this point in the history
Input by duration mode
  • Loading branch information
RomanPudashkin authored Feb 4, 2025
2 parents 267ffdb + f3dde11 commit b3217a1
Show file tree
Hide file tree
Showing 76 changed files with 2,472 additions and 722 deletions.
7 changes: 6 additions & 1 deletion src/app/configs/data/shortcuts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,15 @@
<seq>I</seq>
</SC>
<SC>
<key>note-input</key>
<key>note-input-by-note-name</key>
<seq>N</seq>
<autorepeat>0</autorepeat>
</SC>
<SC>
<key>note-input-by-duration</key>
<seq>M</seq>
<autorepeat>0</autorepeat>
</SC>
<SC>
<key>note-input-repitch</key>
<seq>Ctrl+Shift+I</seq>
Expand Down
7 changes: 6 additions & 1 deletion src/app/configs/data/shortcuts_azerty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,15 @@
<seq>I</seq>
</SC>
<SC>
<key>note-input</key>
<key>note-input-by-note-name</key>
<seq>N</seq>
<autorepeat>0</autorepeat>
</SC>
<SC>
<key>note-input-by-duration</key>
<seq>M</seq>
<autorepeat>0</autorepeat>
</SC>
<SC>
<key>note-input-repitch</key>
<seq>Ctrl+Shift+I</seq>
Expand Down
7 changes: 6 additions & 1 deletion src/app/configs/data/shortcuts_mac.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,15 @@
<seq>I</seq>
</SC>
<SC>
<key>note-input</key>
<key>note-input-by-note-name</key>
<seq>N</seq>
<autorepeat>0</autorepeat>
</SC>
<SC>
<key>note-input-by-duration</key>
<seq>M</seq>
<autorepeat>0</autorepeat>
</SC>
<SC>
<key>note-input-repitch</key>
<seq>Ctrl+Shift+I</seq>
Expand Down
8 changes: 6 additions & 2 deletions src/appshell/appshell.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<file>qml/platform/mac/Main.qml</file>
<file>qml/platform/win/Main.qml</file>
<file>resources/win_opengl_buglist.json</file>
<file>resources/tours.json</file>
<file>qml/Preferences/internal/BaseSection.qml</file>
<file>qml/Preferences/internal/LanguagesSection.qml</file>
<file>qml/Preferences/internal/AutoSaveSection.qml</file>
Expand All @@ -83,8 +84,11 @@
<file>qml/Preferences/internal/AdvancedTopSection.qml</file>
<file>qml/Preferences/internal/ZoomSection.qml</file>
<file>qml/Preferences/internal/ScrollPagesSection.qml</file>
<file>qml/Preferences/internal/NoteInputSection.qml</file>
<file>qml/Preferences/internal/NoteInputPlaySection.qml</file>
<file>qml/Preferences/internal/NoteInput/NoteInputSection.qml</file>
<file>qml/Preferences/internal/NoteInput/MidiInputSection.qml</file>
<file>qml/Preferences/internal/NoteInput/NotePreviewSection.qml</file>
<file>qml/Preferences/internal/NoteInput/VoiceAssignmentSection.qml</file>
<file>qml/Preferences/internal/NoteInput/NoteColorsSection.qml</file>
<file>qml/Preferences/internal/DefaultFilesSection.qml</file>
<file>qml/Preferences/internal/AutomaticUpdateSection.qml</file>
<file>qml/platform/win/AppTitleBar.qml</file>
Expand Down
97 changes: 62 additions & 35 deletions src/appshell/qml/Preferences/NoteInputPreferencesPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Muse.Ui 1.0
import Muse.UiComponents 1.0
import MuseScore.Preferences 1.0

import "internal"
import "internal/NoteInput"

PreferencesPage {
id: root
Expand All @@ -43,24 +43,48 @@ PreferencesPage {
spacing: root.sectionsSpacing

NoteInputSection {
noteInputMethods: noteInputModel.noteInputMethods()
defaultNoteInputMethod: noteInputModel.defaultNoteInputMethod
addAccidentalDotsArticulationsToNextNoteEntered: noteInputModel.addAccidentalDotsArticulationsToNextNoteEntered
useNoteInputCursorInInputByDuration: noteInputModel.useNoteInputCursorInInputByDuration

navigation.section: root.navigationSection
navigation.order: root.navigationOrderStart + 1

onDefaultNoteInputMethodChangeRequested: function(method) {
noteInputModel.defaultNoteInputMethod = method
}

onAddAccidentalDotsArticulationsToNextNoteEnteredChangeRequested: function(add) {
noteInputModel.addAccidentalDotsArticulationsToNextNoteEntered = add
}

onUseNoteInputCursorInInputByDurationChangeRequested: function(use) {
noteInputModel.useNoteInputCursorInInputByDuration = use
}
}

SeparatorLine {}

MidiInputSection {
midiInputEnabled: noteInputModel.midiInputEnabled
startNoteInputWhenPressingKey: noteInputModel.startNoteInputAtSelectionWhenPressingMidiKey
advanceToNextNote: noteInputModel.advanceToNextNoteOnKeyRelease
colorNotes: noteInputModel.colorNotesOutsideOfUsablePitchRange
warnGuitarBends: noteInputModel.warnGuitarBends
delayBetweenNotes: noteInputModel.delayBetweenNotesInRealTimeModeMilliseconds

navigation.section: root.navigationSection
navigation.order: root.navigationOrderStart + 1
navigation.order: root.navigationOrderStart + 2

onAdvanceToNextNoteChangeRequested: function(advance) {
noteInputModel.advanceToNextNoteOnKeyRelease = advance
onMidiInputEnabledChangeRequested: function(enabled) {
noteInputModel.midiInputEnabled = enabled
}

onColorNotesChangeRequested: function(color) {
noteInputModel.colorNotesOutsideOfUsablePitchRange = color
onStartNoteInputWhenPressingKeyChangeRequested: function(start) {
noteInputModel.startNoteInputAtSelectionWhenPressingMidiKey = start
}

onWarnGuitarBendsChangeRequested: function(warn) {
noteInputModel.warnGuitarBends = warn
onAdvanceToNextNoteChangeRequested: function(advance) {
noteInputModel.advanceToNextNoteOnKeyRelease = advance
}

onDelayBetweenNotesChangeRequested: function(delay) {
Expand All @@ -70,19 +94,24 @@ PreferencesPage {

SeparatorLine {}

NoteInputPlaySection {
NotePreviewSection {
playNotesWhenEditing: noteInputModel.playNotesWhenEditing
playChordWhenEditing: noteInputModel.playChordWhenEditing
playPreviewNotesInInputByDuration: noteInputModel.playPreviewNotesInInputByDuration
playChordSymbolWhenEditing: noteInputModel.playChordSymbolWhenEditing
notePlayDurationMilliseconds: noteInputModel.notePlayDurationMilliseconds

navigation.section: root.navigationSection
navigation.order: root.navigationOrderStart + 2
navigation.order: root.navigationOrderStart + 3

onPlayNotesWhenEditingChangeRequested: function(play) {
noteInputModel.playNotesWhenEditing = play
}

onPlayPreviewNotesInInputByDurationChangeRequested: function(play) {
noteInputModel.playPreviewNotesInInputByDuration = play
}

onPlayChordWhenEditingChangeRequested: function(play) {
noteInputModel.playChordWhenEditing = play
}
Expand All @@ -98,40 +127,38 @@ PreferencesPage {

SeparatorLine {}

BaseSection {
id: dynamicsAllVoicesSection

VoiceAssignmentSection {
width: parent.width

title: qsTrc("appshell/preferences", "Voice assignment")
navigation.section: root.navigationSection
navigation.order: root.navigationOrderStart + 4

dynamicsApplyToAllVoices: noteInputModel.dynamicsApplyToAllVoices

StyledTextLabel {
width: parent.width
text: qsTrc("appshell/preferences", "When entered, dynamics and hairpins should affect:")
horizontalAlignment: Text.AlignLeft
onDynamicsApplyToAllVoicesChangeRequested: function(value) {
noteInputModel.dynamicsApplyToAllVoices = value
}
}

RoundedRadioButton {
width: parent.width
SeparatorLine {}

text: qsTrc("appshell/preferences", "All voices on the instrument")
NoteColorsSection {
width: parent.width

checked: noteInputModel.dynamicsApplyToAllVoices
onToggled: {
noteInputModel.dynamicsApplyToAllVoices = checked
}
}
colorNotes: noteInputModel.colorNotesOutsideOfUsablePitchRange
warnGuitarBends: noteInputModel.warnGuitarBends

RoundedRadioButton {
width: parent.width
navigation.section: root.navigationSection
navigation.order: root.navigationOrderStart + 5

text: qsTrc("appshell/preferences", "Only the voice they are applied to")
onColorNotesChangeRequested: function(color) {
noteInputModel.colorNotesOutsideOfUsablePitchRange = color
}

checked: !noteInputModel.dynamicsApplyToAllVoices
onToggled: {
noteInputModel.dynamicsApplyToAllVoices = !checked
}
onWarnGuitarBendsChangeRequested: function(warn) {
noteInputModel.warnGuitarBends = warn
}

}
}
}
142 changes: 142 additions & 0 deletions src/appshell/qml/Preferences/internal/NoteInput/MidiInputSection.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-Studio-CLA-applies
*
* MuseScore Studio
* Music Composition & Notation
*
* Copyright (C) 2025 MuseScore Limited
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.15
import QtQuick.Layouts 1.15

import Muse.Ui 1.0
import Muse.UiComponents 1.0

import "../../internal"

BaseSection {
id: root

title: qsTrc("appshell/preferences", "MIDI devices")

property alias midiInputEnabled: enableMidiInputToggle.checked
property alias startNoteInputWhenPressingKey: startNoteInputWhenPressingKeyBox.checked
property bool advanceToNextNote: false
property int delayBetweenNotes: 0

signal midiInputEnabledChangeRequested(bool enabled)
signal startNoteInputWhenPressingKeyChangeRequested(bool start)
signal advanceToNextNoteChangeRequested(bool advance)
signal delayBetweenNotesChangeRequested(int delay)

Row {
width: parent.width
height: enableMidiInputToggle.height

spacing: 6

ToggleButton {
id: enableMidiInputToggle

navigation.name: "EnableMidiInputToggle"
navigation.panel: root.navigation
navigation.row: 0

onToggled: {
root.midiInputEnabledChangeRequested(!checked)
}
}

StyledTextLabel {
height: parent.height

horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter

text: qsTrc("appshell/preferences", "Enable MIDI input")
}
}

CheckBox {
id: startNoteInputWhenPressingKeyBox
width: parent.width

enabled: root.midiInputEnabled
text: qsTrc("appshell/preferences", "When pressing a key, begin note input at the selected measure, note, or rest")

navigation.name: "StartNoteInputWhenPressingKeyBox"
navigation.panel: root.navigation
navigation.row: 1

onClicked: {
root.startNoteInputWhenPressingKeyChangeRequested(!checked)
}
}

ExpandableBlank {
width: parent.width

enabled: root.midiInputEnabled
title: qsTrc("appshell/preferences", "Real-time input modes")
isExpanded: false

contentItemComponent: Column {
width: parent.width

spacing: root.spacing

CheckBox {
id: advanceToNextNoteBox
width: parent.width

enabled: root.midiInputEnabled
text: qsTrc("appshell/preferences", "Advance to next note on key release")

checked: root.advanceToNextNote

navigation.name: "AdvanceToNextNoteBox"
navigation.panel: root.navigation
navigation.row: 2

onClicked: {
root.advanceToNextNoteChangeRequested(!checked)
}
}

IncrementalPropertyControlWithTitle {
id: delayBetweenNotesControl

enabled: root.midiInputEnabled
title: qsTrc("appshell/preferences", "Delay between notes")

currentValue: root.delayBetweenNotes

columnWidth: root.columnWidth
spacing: root.columnSpacing

measureUnitsSymbol: qsTrc("global", "ms")

navigation.name: "DelayBetweenNotesControl"
navigation.panel: root.navigation
navigation.row: 3

onValueEdited: function(newValue) {
root.delayBetweenNotesChangeRequested(newValue)
}
}
}
}
}
Loading

0 comments on commit b3217a1

Please sign in to comment.