Skip to content

Add shortcut to adjust dynamics. Fixes #34082#34189

Open
stevage wants to merge 5 commits into
musescore:mainfrom
stevage:34082-alter-dynamics-shortcut
Open

Add shortcut to adjust dynamics. Fixes #34082#34189
stevage wants to merge 5 commits into
musescore:mainfrom
stevage:34082-alter-dynamics-shortcut

Conversation

@stevage

@stevage stevage commented Jul 14, 2026

Copy link
Copy Markdown

Resolves: #34082

Adds feature: shortcut key Alt+, and Alt+. decreases or increases every dynamic within the selection by one step, between ppppp and fffff. Pinned hairpins are adjusted if needed.

  • I signed the CLA as stevage:
  • The title of the PR describes the problem it addresses.
  • Each commit's message describes its purpose and effects, and references the issue it resolves. If changes are extensive, there is a sequence of easily reviewable commits.
  • The code in the PR follows the coding rules.
  • I understand all aspects of the code I'm contributing and I'm able to explain it if requested.
  • The code compiles and runs on my machine, preferably after each commit individually. I have manually tested and verified that my changes fulfil their intended purpose.
  • No prior attempts to resolve this problem exist, or if they do, I listed them in my PR description and described how I avoided repeating past mistakes.
  • There are no unnecessary changes.

(well, I split out the body of autoFlipHairpinsType() in order to avoid excess calls to startEdit(), perhaps that was unecessary.

  • [] I created a unit test or vtest to verify the changes I made (if applicable).

I have not - would appreciate guidance here.

Screen.Recording.2026-07-14.at.3.22.22.pm.mov

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5aa5ccc9-8220-4279-9afe-cc298080e006

📥 Commits

Reviewing files that changed from the base of the PR and between b261a2e and d1b2f6e.

📒 Files selected for processing (8)
  • src/app/configs/data/shortcuts.xml
  • src/app/configs/data/shortcuts_mac.xml
  • src/notation/inotationinteraction.h
  • src/notation/internal/notationinteraction.cpp
  • src/notation/internal/notationinteraction.h
  • src/notation/tests/mocks/notationinteractionmock.h
  • src/notationscene/internal/notationactioncontroller.cpp
  • src/notationscene/internal/notationuiactions.cpp
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/app/configs/data/shortcuts.xml
  • src/app/configs/data/shortcuts_mac.xml
  • src/notation/tests/mocks/notationinteractionmock.h
  • src/notation/internal/notationinteraction.h
  • src/notationscene/internal/notationuiactions.cpp
  • src/notationscene/internal/notationactioncontroller.cpp
  • src/notation/internal/notationinteraction.cpp

📝 Walkthrough

Walkthrough

Added interface and implementation support for increasing or decreasing selected dynamics within valid bounds, synchronizing dynamic text, applying undoable changes, and auto-flipping adjacent hairpins. Registered notation actions and UI metadata, updated the interaction mock, and added Alt+. and Alt+, shortcuts for standard and Mac configurations.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding shortcuts to adjust dynamics.
Description check ✅ Passed The description follows the template well, includes the issue reference, summary, and checklist items with only a minor incomplete optional test item.
Linked Issues check ✅ Passed The PR implements the requested increase/decrease dynamic shortcuts and selection-wide step changes, matching issue #34082.
Out of Scope Changes check ✅ Passed The changes stay focused on dynamic adjustment shortcuts, related interaction logic, and UI wiring with no clear unrelated additions.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Linked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped musescore/muse_framework.git.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/notationscene/internal/notationactioncontroller.cpp (1)

344-346: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Disable actions when there is no selection.

Consider adding the &Controller::hasSelection condition to these action registrations. While the interaction itself safely ignores an empty selection, supplying the condition ensures the actions are properly grayed out in UI menus and palettes when nothing is selected, matching the UX conventions of similar selection-dependent actions.

♻️ Proposed refactor
-    registerAction("increase-dynamic", [this]() { currentNotationInteraction()->increaseDecreaseDynamicsForSelection(1); });
-    registerAction("decrease-dynamic", [this]() { currentNotationInteraction()->increaseDecreaseDynamicsForSelection(-1); });
+    registerAction("increase-dynamic", [this]() { currentNotationInteraction()->increaseDecreaseDynamicsForSelection(1); }, &Controller::hasSelection);
+    registerAction("decrease-dynamic", [this]() { currentNotationInteraction()->increaseDecreaseDynamicsForSelection(-1); }, &Controller::hasSelection);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/notationscene/internal/notationactioncontroller.cpp` around lines 344 -
346, Update the “increase-dynamic” and “decrease-dynamic” registrations to
include the Controller::hasSelection enabled condition, so both actions are
grayed out when no selection exists while retaining their existing callbacks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/notation/internal/notationinteraction.cpp`:
- Around line 5767-5791: Update increaseDecreaseDynamicsForSelection so both
increment and decrement operations remain within the standard dynamic range:
allow increasing only while the current type is below FFFF and decreasing only
while it is above PPPPP, excluding OTHER, FP, and later non-standard enum
values. Preserve the existing property updates and hairpin handling for valid
transitions.

---

Nitpick comments:
In `@src/notationscene/internal/notationactioncontroller.cpp`:
- Around line 344-346: Update the “increase-dynamic” and “decrease-dynamic”
registrations to include the Controller::hasSelection enabled condition, so both
actions are grayed out when no selection exists while retaining their existing
callbacks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2450e810-7e54-4242-ae71-54bc5ba2993a

📥 Commits

Reviewing files that changed from the base of the PR and between 239bfbc and f3c9cf5.

📒 Files selected for processing (8)
  • src/app/configs/data/shortcuts.xml
  • src/app/configs/data/shortcuts_mac.xml
  • src/notation/inotationinteraction.h
  • src/notation/internal/notationinteraction.cpp
  • src/notation/internal/notationinteraction.h
  • src/notation/tests/mocks/notationinteractionmock.h
  • src/notationscene/internal/notationactioncontroller.cpp
  • src/notationscene/internal/notationuiactions.cpp

Comment thread src/notation/internal/notationinteraction.cpp Outdated
@stevage stevage force-pushed the 34082-alter-dynamics-shortcut branch from b261a2e to d1b2f6e Compare July 15, 2026 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shortcut to increase/decrease all dynamics in selection by one step

2 participants