Skip to content

Commit

Permalink
[palette] added layout for Tremolo
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkorsukov committed Jul 10, 2023
1 parent e313c77 commit 56cf709
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/engraving/layout/pal/tlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2470,10 +2470,10 @@ void TLayout::layout(TimeSig*, LayoutContext&)
UNREACHABLE;
}

void TLayout::layout(Tremolo* item, LayoutContext& ctx)
void TLayout::layout(Tremolo*, LayoutContext&)
{
v0::LayoutContext ctxv0(ctx.score());
v0::TremoloLayout::layout(item, ctxv0);
//! NOTE Moved to PaletteLayout
UNREACHABLE;
}

void TLayout::layout(TremoloBar*, LayoutContext&)
Expand Down
10 changes: 10 additions & 0 deletions src/palette/internal/palettelayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@

#include "engraving/libmscore/utils.h"

#include "engraving/layout/v0/tremololayout.h"
#include "engraving/layout/pal/tlayout.h"

#include "log.h"
Expand Down Expand Up @@ -183,6 +184,8 @@ void PaletteLayout::layoutItem(EngravingItem* item)
break;
case ElementType::TIMESIG: layout(toTimeSig(item), ctx);
break;
case ElementType::TREMOLO: layout(toTremolo(item), ctx);
break;
case ElementType::TREMOLOBAR: layout(toTremoloBar(item), ctx);
break;
case ElementType::TRILL: layout(toTrill(item), ctx);
Expand Down Expand Up @@ -1343,6 +1346,13 @@ void PaletteLayout::layout(TimeSig* item, const Context& ctx)
item->setDrawArgs(drawArgs);
}

void PaletteLayout::layout(Tremolo* item, const Context& ctx)
{
//! TODO
engraving::layout::v0::LayoutContext ctxv0(ctx.donUseScore());
engraving::layout::v0::TremoloLayout::layout(item, ctxv0);
}

void PaletteLayout::layout(TremoloBar* item, const Context&)
{
double spatium = item->spatium();
Expand Down
5 changes: 5 additions & 0 deletions src/palette/internal/palettelayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class TextLine;
class TextLineSegment;
class TextLineBaseSegment;
class TimeSig;
class Tremolo;
class TremoloBar;
class Trill;
class TrillSegment;
Expand Down Expand Up @@ -134,6 +135,9 @@ class PaletteLayout
std::shared_ptr<engraving::IEngravingFont> engravingFont() const;
engraving::compat::DummyElement* dummyParent() const;

//! NOTE Temporarily, do not use
engraving::Score* donUseScore() const { return m_score; }

private:
engraving::Score* m_score = nullptr;
};
Expand Down Expand Up @@ -199,6 +203,7 @@ class PaletteLayout
static void layout(engraving::TempoText* item, const Context& ctx);
static void layout(engraving::TextLine* item, const Context& ctx);
static void layout(engraving::TimeSig* item, const Context& ctx);
static void layout(engraving::Tremolo* item, const Context& ctx);
static void layout(engraving::TremoloBar* item, const Context& ctx);
static void layout(engraving::Trill* item, const Context& ctx);

Expand Down

0 comments on commit 56cf709

Please sign in to comment.