[MusicXML] improve title box position#33373
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR contains two focused bug fixes to the MusicXML import and export pipeline. The export change adjusts Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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. Comment |
There was a problem hiding this comment.
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 | 🟠 MajorUse conditional spatium logic consistently on line 1020
Line 1004 conditionally selects the spatium source based on
vbox->sizeIsSpatiumDependent(), but line 1020 unconditionally usesvbox->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.cpplines 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
📒 Files selected for processing (3)
src/importexport/musicxml/internal/export/exportmusicxml.cppsrc/importexport/musicxml/internal/import/importmusicxmlpass1.cppsrc/importexport/musicxml/tests/data/testSystemDistance_ref.xml
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Backport of musescore#33373 Co-Authored-By: Klaus Rettinghaus <rettinghaus@users.noreply.github.com>
Backport of musescore#33373 Co-Authored-By: Klaus Rettinghaus <rettinghaus@users.noreply.github.com>
Backport of musescore#33373 Co-Authored-By: Klaus Rettinghaus <rettinghaus@users.noreply.github.com>
This rounds the
default-xanddefault-ypositions of the title vbox on export for greater stability on import and export.