Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Percussion panel - refinements round 4 #25958

Merged
Merged
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 src/engraving/dom/undo.h
Original file line number Diff line number Diff line change
Expand Up @@ -1505,8 +1505,8 @@ class ChangeDrumset : public UndoCommand
void flip(EditData*) override;

public:
ChangeDrumset(Instrument* i, const Drumset* d, Part* p)
: instrument(i), drumset(*d), part(p) {}
ChangeDrumset(Instrument* i, const Drumset& d, Part* p)
: instrument(i), drumset(d), part(p) {}

UNDO_TYPE(CommandType::ChangeDrumset)
UNDO_NAME("ChangeDrumset")
Expand Down
4 changes: 2 additions & 2 deletions src/notation/internal/notationconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ class NotationConfiguration : public INotationConfiguration, public muse::async:
muse::async::Notification autoShowPercussionPanelChanged() const override;

bool showPercussionPanelPadSwapDialog() const override;
void setShowPercussionPanelPadSwapDialog(bool show);
void setShowPercussionPanelPadSwapDialog(bool show) override;
muse::async::Notification showPercussionPanelPadSwapDialogChanged() const override;

bool percussionPanelMoveMidiNotesAndShortcuts() const override;
void setPercussionPanelMoveMidiNotesAndShortcuts(bool move);
void setPercussionPanelMoveMidiNotesAndShortcuts(bool move) override;
muse::async::Notification percussionPanelMoveMidiNotesAndShortcutsChanged() const override;

muse::io::path_t styleFileImportPath() const override;
Expand Down
1 change: 1 addition & 0 deletions src/notation/internal/notationinteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ NotationInteraction::NotationInteraction(Notation* notation, INotationUndoStackP

m_undoStack->undoRedoNotification().onNotify(this, [this]() {
endEditElement();
notifyAboutNoteInputStateChanged();
});

m_undoStack->stackChanged().onNotify(this, [this]() {
Expand Down
2 changes: 1 addition & 1 deletion src/notation/internal/notationparts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ void NotationParts::replaceDrumset(const InstrumentKey& instrumentKey, const Dru

if (undoable) {
startEdit(TranslatableString("undoableAction", "Edit drumset"));
score()->undo(new mu::engraving::ChangeDrumset(instrument, &newDrumset, part));
score()->undo(new mu::engraving::ChangeDrumset(instrument, newDrumset, part));
apply();
} else {
instrument->setDrumset(&newDrumset);
Expand Down
5 changes: 2 additions & 3 deletions src/notation/qml/MuseScore/NotationScene/PercussionPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ Item {
orientation: Qt.Horizontal

navigation.panel: addRowButtonPanel
drawFocusBorderInsideRect: true

onClicked: {
padGrid.model.addEmptyRow()
Expand All @@ -428,9 +429,7 @@ Item {

visible: !percModel.enabled

anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: (padGrid.cellHeight / 2) - (panelDisabledLabel.height / 2)
anchors.centerIn: parent

font: ui.theme.bodyFont
text: qsTrc("notation/percussion", "Select an unpitched percussion staff to see available sounds")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ DropArea {

accessible.visualItem: footerFocusBorder
accessible.enabled: footerNavCtrl.enabled

onTriggered: {
// TODO: trigger context menu (not yet implemented)
}
}

Rectangle {
Expand Down Expand Up @@ -188,13 +184,22 @@ DropArea {
id: padContentComponent

PercussionPanelPadContent {
id: padContent

padModel: root.padModel
panelMode: root.panelMode
useNotationPreview: root.useNotationPreview

footerHeight: prv.footerHeight

padSwapActive: dragHandler.active

Connections {
target: footerNavCtrl
function onTriggered() {
padContent.openFooterContextMenu()
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ Column {

property bool padSwapActive: false

function openFooterContextMenu() {
if (!root.padModel) {
return
}
menuLoader.toggleOpened(root.padModel.footerContextMenuItems)
}

Item {
id: mainContentArea

Expand Down Expand Up @@ -154,6 +161,17 @@ Column {

color: Utils.colorWithAlpha(ui.theme.buttonColor, ui.theme.buttonOpacityNormal)

MouseArea {
id: footerMouseArea

anchors.fill: parent
enabled: root.panelMode !== PanelMode.EDIT_LAYOUT

onClicked: {
root.openFooterContextMenu()
}
}

StyledTextLabel {
id: shortcutLabel

Expand Down Expand Up @@ -190,5 +208,13 @@ Column {

text: Boolean(root.padModel) ? root.padModel.midiNote : ""
}

StyledMenuLoader {
id: menuLoader

onHandleMenuItem: function(itemId) {
root.padModel.handleMenuItem(itemId)
}
}
}
}
2 changes: 1 addition & 1 deletion src/notation/view/paintedengravingitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void PaintedEngravingItem::paintNotationPreview(muse::draw::Painter& painter, qr

params.drawStaff = true;

painter.fillRect(params.rect, configuration()->scoreInversionColor());
painter.fillRect(params.rect, configuration()->noteBackgroundColor());

EngravingItemPreviewPainter::paintPreview(m_item.get(), params);
}
Loading