Skip to content

[MusicXML] improve title box position#33373

Open
rettinghaus wants to merge 4 commits into
musescore:mainfrom
rettinghaus:xml/vbox
Open

[MusicXML] improve title box position#33373
rettinghaus wants to merge 4 commits into
musescore:mainfrom
rettinghaus:xml/vbox

Conversation

@rettinghaus
Copy link
Copy Markdown
Contributor

This rounds the default-x and default-y positions of the title vbox on export for greater stability on import and export.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3f34cb9f-f7a7-4bbb-96b3-c97526418f72

📥 Commits

Reviewing files that changed from the base of the PR and between 10b228d and aaa4bdf.

📒 Files selected for processing (1)
  • src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp

📝 Walkthrough

Walkthrough

This PR contains two focused bug fixes to the MusicXML import and export pipeline. The export change adjusts creditWords() to format credit element positioning attributes (default-x and default-y) with 2 decimal place precision, with corresponding test data updates. The import change modifies resizeTitleBox() to calculate title box padding using spatium-dependent values when applicable, instead of always using the VBox's spatium value. Both changes adjust numeric precision and layout calculations without altering public interfaces.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description briefly explains what was changed but lacks required details. The template requires commit messages, verification steps, coding standards confirmation, and a GitHub issue reference—none of which are provided. Add the GitHub issue reference (Resolves: #33373), describe each commit's purpose, confirm testing and code compilation, and confirm adherence to coding guidelines by checking the appropriate template checkboxes.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title '[MusicXML] improve title box position' directly relates to the main change: rounding title box positioning attributes for export stability.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp (1)

1004-1020: ⚠️ Potential issue | 🟠 Major

Use conditional spatium logic consistently on line 1020

Line 1004 conditionally selects the spatium source based on vbox->sizeIsSpatiumDependent(), but line 1020 unconditionally uses vbox->spatium() for the height-to-Spatium conversion. The padding calculation and height conversion must use the same spatium base.

Change line 1020 to:

const double sp = vbox->sizeIsSpatiumDependent() ? vbox->spatium() : vbox->style().defaultSpatium();
const auto height = Spatium::fromAbsolute(calculatedVBoxHeight, sp);

This pattern is consistent with similar conversions elsewhere in the codebase (e.g., box.cpp lines 106-108).

🤖 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/importexport/musicxml/internal/import/importmusicxmlpass1.cpp` around
lines 1004 - 1020, The height conversion uses vbox->spatium() unconditionally
but padding above used vbox->sizeIsSpatiumDependent() to pick between
vbox->spatium() and vbox->style().defaultSpatium(); update the
Spatium::fromAbsolute call to use the same conditional spatium selection as the
padding calculation (compute a local sp variable via
vbox->sizeIsSpatiumDependent() ? vbox->spatium() :
vbox->style().defaultSpatium() and pass that to Spatium::fromAbsolute with
calculatedVBoxHeight), referencing vbox, calculatedVBoxHeight and
Spatium::fromAbsolute to locate the change.
🤖 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/importexport/musicxml/internal/import/importmusicxmlpass1.cpp`:
- Line 1004: The variable padding is declared as int which truncates fractional
spatium values; change its type to double and assign it from
vbox->sizeIsSpatiumDependent() ? vbox->style().spatium() :
vbox->style().defaultSpatium() so the fractional precision from spatium() and
defaultSpatium() is preserved (update any downstream uses of padding to accept
double where necessary).

---

Outside diff comments:
In `@src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp`:
- Around line 1004-1020: The height conversion uses vbox->spatium()
unconditionally but padding above used vbox->sizeIsSpatiumDependent() to pick
between vbox->spatium() and vbox->style().defaultSpatium(); update the
Spatium::fromAbsolute call to use the same conditional spatium selection as the
padding calculation (compute a local sp variable via
vbox->sizeIsSpatiumDependent() ? vbox->spatium() :
vbox->style().defaultSpatium() and pass that to Spatium::fromAbsolute with
calculatedVBoxHeight), referencing vbox, calculatedVBoxHeight and
Spatium::fromAbsolute to locate the change.
🪄 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: 30a4d7c0-5820-4ad6-912f-f4a2adc5f617

📥 Commits

Reviewing files that changed from the base of the PR and between de0871b and 10b228d.

📒 Files selected for processing (3)
  • src/importexport/musicxml/internal/export/exportmusicxml.cpp
  • src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp
  • src/importexport/musicxml/tests/data/testSystemDistance_ref.xml

Comment thread src/importexport/musicxml/internal/import/importmusicxmlpass1.cpp Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@mathesoncalum mathesoncalum requested a review from miiizen May 13, 2026 08:07
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 13, 2026
Backport of musescore#33373

Co-Authored-By: Klaus Rettinghaus <rettinghaus@users.noreply.github.com>
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 13, 2026
Backport of musescore#33373

Co-Authored-By: Klaus Rettinghaus <rettinghaus@users.noreply.github.com>
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 13, 2026
Backport of musescore#33373

Co-Authored-By: Klaus Rettinghaus <rettinghaus@users.noreply.github.com>
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.

3 participants