Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
miiizen committed Nov 10, 2023
1 parent c1cff17 commit 2934183
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/engraving/dom/arpeggio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ bool Arpeggio::edit(EditData& ed)
}
}

renderer()->layoutOnEdit(this);
triggerLayout();

return true;
}
Expand Down
9 changes: 7 additions & 2 deletions src/engraving/dom/chord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1819,10 +1819,15 @@ void Chord::undoChangeSpanArpeggio(Arpeggio* a)
{
const std::list<EngravingObject*> links = linkList();
for (EngravingObject* linkedObject : links) {
if (linkedObject == this) {
score()->undo(new ChangeSpanArpeggio(this, a));
continue;
}
Chord* chord = toChord(linkedObject);
Score* score = chord->score();
if (score) {
score->undo(new ChangeSpanArpeggio(chord, a));
EngravingItem* linkedArp = a->findLinkedInScore(score);
if (score && linkedArp) {
score->undo(new ChangeSpanArpeggio(chord, toArpeggio(linkedArp)));
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/engraving/rendering/dev/arpeggiolayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ double ArpeggioLayout::insetDistance(Arpeggio* item, LayoutContext& ctx, double
// insetDistance
//---------------------------------------------------------

double ArpeggioLayout::insetDistance(Arpeggio* item, LayoutContext& ctx, double mag_, Chord* chord, std::vector<Accidental*> accidentals)
double ArpeggioLayout::insetDistance(Arpeggio* item, LayoutContext& ctx, double mag_, Chord* chord,
const std::vector<Accidental*>& accidentals)
{
if (!item || !chord) {
return 0.0;
Expand Down
3 changes: 2 additions & 1 deletion src/engraving/rendering/dev/arpeggiolayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class ArpeggioLayout
static void layoutArpeggio2(Arpeggio* item, LayoutContext& ctx);

static double insetDistance(Arpeggio* item, LayoutContext& ctx, double mag_, Chord* _chord);
static double insetDistance(Arpeggio* item, LayoutContext& ctx, double mag_, Chord* _chord, const std::vector<Accidental*> accidentals);
static double insetDistance(Arpeggio* item, LayoutContext& ctx, double mag_, Chord* _chord,
const std::vector<Accidental*>& accidentals);
static double insetTop(Arpeggio* item, Chord* c);
static double insetBottom(Arpeggio* item, Chord* c);
static double insetWidth(Arpeggio* item);
Expand Down
10 changes: 9 additions & 1 deletion src/engraving/rendering/dev/chordlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void ChordLayout::layoutPitched(Chord* item, LayoutContext& ctx)
double lhead = 0.0; // amount of notehead to left of chord origin
Note* upnote = item->upNote();
Note* downnote = item->downNote();
Note* leftNote = nullptr;

delete item->tabDur(); // no TAB? no duration symbol! (may happen when converting a TAB into PITCHED)
item->setTabDur(nullptr);
Expand All @@ -135,6 +136,9 @@ void ChordLayout::layoutPitched(Chord* item, LayoutContext& ctx)
rrr = std::max(rrr, x2);
// track amount of space due to notehead only
lhead = std::max(lhead, -x1);
if (!leftNote || note->x() < leftNote->x()) {
leftNote = note;
}

Accidental* accidental = note->accidental();
if (accidental && accidental->visible()) {
Expand Down Expand Up @@ -198,7 +202,11 @@ void ChordLayout::layoutPitched(Chord* item, LayoutContext& ctx)

double gapSize = arpeggioNoteDistance;

if (downnote->line() > firstLedgerBelow || upnote->line() < firstLedgerAbove) {
if (leftNote && leftNote->x() == 0) {
if (downnote->line() > firstLedgerBelow || upnote->line() < firstLedgerAbove) {
gapSize = arpeggioLedgerDistance + ctx.conf().styleS(Sid::ledgerLineLength).val() * item->spatium();
}
} else if (leftNote->line() > firstLedgerBelow || leftNote->line() < firstLedgerAbove) {
gapSize = arpeggioLedgerDistance + ctx.conf().styleS(Sid::ledgerLineLength).val() * item->spatium();
}

Expand Down
9 changes: 0 additions & 9 deletions src/engraving/rendering/dev/scorerenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ void ScoreRenderer::layoutText1(TextBase* item, bool base)
}
}

// ===============================================================
// Layout Elements on Edit
// ===============================================================
void ScoreRenderer::layoutOnEdit(Arpeggio* item)
{
LayoutContext ctx(item->score());
// ArpeggioLayout::layoutOnEdit(item, ctx);
}

void ScoreRenderer::layoutTextLineBaseSegment(TextLineBaseSegment* item)
{
LayoutContext ctx(item->score());
Expand Down
4 changes: 0 additions & 4 deletions src/engraving/rendering/dev/scorerenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ class ScoreRenderer : public IScoreRenderer
void paintScore(draw::Painter* painter, Score* score, const IScoreRenderer::PaintOptions& opt) const override;
void paintItem(draw::Painter& painter, const EngravingItem* item) const override;

// Temporary compatibility interface

void layoutOnEdit(Arpeggio* item) override;

//! TODO Investigation is required, probably these functions or their calls should not be.
// Other
void layoutTextLineBaseSegment(TextLineBaseSegment* item) override;
Expand Down
3 changes: 0 additions & 3 deletions src/engraving/rendering/iscorerenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ class IScoreRenderer : MODULE_EXPORT_INTERFACE
doLayoutItem(static_cast<EngravingItem*>(item));
}

// Layout Elements on Edit
virtual void layoutOnEdit(Arpeggio* item) = 0;

//! TODO Investigation is required, probably these functions or their calls should not be.
// Other
virtual void layoutTextLineBaseSegment(TextLineBaseSegment* item) = 0;
Expand Down
9 changes: 0 additions & 9 deletions src/engraving/rendering/stable/scorerenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,6 @@ void ScoreRenderer::layoutText1(TextBase* item, bool base)
}
}

// ===============================================================
// Layout Elements on Edit
// ===============================================================
void ScoreRenderer::layoutOnEdit(Arpeggio* item)
{
LayoutContext ctx(item->score());
ArpeggioLayout::layoutOnEdit(item, ctx);
}

void ScoreRenderer::layoutTextLineBaseSegment(TextLineBaseSegment* item)
{
LayoutContext ctx(item->score());
Expand Down
2 changes: 0 additions & 2 deletions src/engraving/rendering/stable/scorerenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ class ScoreRenderer : public IScoreRenderer

// Temporary compatibility interface

void layoutOnEdit(Arpeggio* item) override;

//! TODO Investigation is required, probably these functions or their calls should not be.
// Other
void layoutTextLineBaseSegment(TextLineBaseSegment* item) override;
Expand Down

0 comments on commit 2934183

Please sign in to comment.