[engraving] moved palettelayout to engraving/rendering/single

This commit is contained in:
Igor Korsukov 2023-07-28 11:48:34 +03:00
parent c6393c96f9
commit 255134dad5
33 changed files with 627 additions and 474 deletions

View file

@ -25,6 +25,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/libmscore/libmscore.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/compat/midi/compatmidi.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/rendering/dev/rendering.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/rendering/stable/rendering.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/rendering/single/single.cmake)
set(MODULE_SRC
@ -174,13 +175,15 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/style/defaultstyle.h
${CMAKE_CURRENT_LIST_DIR}/rendering/README.h
${CMAKE_CURRENT_LIST_DIR}/rendering/ilayout.h
${CMAKE_CURRENT_LIST_DIR}/rendering/iscorerendering.h
${CMAKE_CURRENT_LIST_DIR}/rendering/isinglerendering.h
${CMAKE_CURRENT_LIST_DIR}/rendering/layoutoptions.h
${CMAKE_CURRENT_LIST_DIR}/rendering/paddingtable.cpp
${CMAKE_CURRENT_LIST_DIR}/rendering/paddingtable.h
${RENDERING_DEV_SRC}
${RENDERING_STABLE_SRC}
${RENDERING_SINGLE_SRC}
${CMAKE_CURRENT_LIST_DIR}/playback/renderingcontext.h
${CMAKE_CURRENT_LIST_DIR}/playback/playbackcontext.cpp

View file

@ -42,8 +42,9 @@
#include "engraving/libmscore/mscore.h"
#include "engraving/libmscore/masterscore.h"
#include "rendering/dev/layout.h"
#include "rendering/stable/layout.h"
#include "rendering/dev/scorerendering.h"
#include "rendering/stable/scorerendering.h"
#include "rendering/single/singlerendering.h"
#include "compat/scoreaccess.h"
@ -84,8 +85,10 @@ Versions:
*
* see layout/README.h
*/
ioc()->registerExport<rendering::IRendering>(moduleName(), new rendering::dev::Layout());
//ioc()->registerExport<rendering::ILayout>(moduleName(), new layout::stable::Layout());
ioc()->registerExport<rendering::IScoreRendering>(moduleName(), new rendering::dev::ScoreRendering());
//ioc()->registerExport<rendering::IScoreRendering>(moduleName(), new layout::stable::ScoreRendering());
ioc()->registerExport<rendering::ISingleRendering>(moduleName(), new rendering::single::SingleRendering());
}
void EngravingModule::resolveImports()

View file

@ -32,7 +32,7 @@
#include "modularity/ioc.h"
#include "iengravingconfiguration.h"
#include "rendering/ilayout.h"
#include "rendering/iscorerendering.h"
#include "types/fraction.h"
#include "types/symid.h"
@ -135,7 +135,7 @@ public:
class EngravingItem : public EngravingObject
{
INJECT_STATIC(IEngravingConfiguration, engravingConfiguration)
INJECT_STATIC(rendering::IRendering, rendering)
INJECT_STATIC(rendering::IScoreRendering, rendering)
mutable mu::RectF _bbox; ///< Bounding box relative to _pos + _offset
double _mag; ///< standard magnification (derived value)

View file

@ -41,7 +41,7 @@
#include "types/constants.h"
#include "rendering/ilayout.h"
#include "rendering/iscorerendering.h"
#include "rendering/layoutoptions.h"
#include "rendering/paddingtable.h"
@ -242,7 +242,7 @@ class Score : public EngravingObject
INJECT(IEngravingFontsProvider, engravingFonts)
// internal
INJECT(rendering::IRendering, rendering)
INJECT(rendering::IScoreRendering, rendering)
public:
Score(const Score&) = delete;

View file

@ -1,12 +1,12 @@
set(RENDERING_DEV_SRC
${CMAKE_CURRENT_LIST_DIR}/scorerendering.cpp
${CMAKE_CURRENT_LIST_DIR}/scorerendering.h
${CMAKE_CURRENT_LIST_DIR}/tdraw.cpp
${CMAKE_CURRENT_LIST_DIR}/tdraw.h
${CMAKE_CURRENT_LIST_DIR}/tlayout.cpp
${CMAKE_CURRENT_LIST_DIR}/tlayout.h
${CMAKE_CURRENT_LIST_DIR}/layout.cpp
${CMAKE_CURRENT_LIST_DIR}/layout.h
${CMAKE_CURRENT_LIST_DIR}/layoutcontext.cpp
${CMAKE_CURRENT_LIST_DIR}/layoutcontext.h
${CMAKE_CURRENT_LIST_DIR}/scorelayout.cpp

View file

@ -19,7 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "layout.h"
#include "scorerendering.h"
#include "libmscore/arpeggio.h"
#include "libmscore/beam.h"
@ -40,23 +40,23 @@
using namespace mu::engraving;
using namespace mu::engraving::rendering::dev;
void Layout::layoutRange(Score* score, const Fraction& st, const Fraction& et)
void ScoreRendering::layoutRange(Score* score, const Fraction& st, const Fraction& et)
{
ScoreLayout::layoutRange(score, st, et);
}
void Layout::doLayoutItem(EngravingItem* item)
void ScoreRendering::doLayoutItem(EngravingItem* item)
{
LayoutContext ctx(item->score());
TLayout::layoutItem(item, ctx);
}
void Layout::doDrawItem(const EngravingItem* item, draw::Painter* p)
void ScoreRendering::doDrawItem(const EngravingItem* item, draw::Painter* p)
{
TDraw::drawItem(item, p);
}
void Layout::layoutText1(TextBase* item, bool base)
void ScoreRendering::layoutText1(TextBase* item, bool base)
{
LayoutContext ctx(item->score());
if (base) {
@ -71,35 +71,35 @@ void Layout::layoutText1(TextBase* item, bool base)
// ===============================================================
// Layout Elements on Edit
// ===============================================================
void Layout::layoutOnEdit(Arpeggio* item)
void ScoreRendering::layoutOnEdit(Arpeggio* item)
{
LayoutContext ctx(item->score());
ArpeggioLayout::layoutOnEdit(item, ctx);
}
double Layout::computePadding(const EngravingItem* item1, const EngravingItem* item2)
double ScoreRendering::computePadding(const EngravingItem* item1, const EngravingItem* item2)
{
return HorizontalSpacing::computePadding(item1, item2);
}
KerningType Layout::computeKerning(const EngravingItem* item1, const EngravingItem* item2)
KerningType ScoreRendering::computeKerning(const EngravingItem* item1, const EngravingItem* item2)
{
return HorizontalSpacing::computeKerning(item1, item2);
}
void Layout::layoutTextLineBaseSegment(TextLineBaseSegment* item)
void ScoreRendering::layoutTextLineBaseSegment(TextLineBaseSegment* item)
{
LayoutContext ctx(item->score());
TLayout::layoutTextLineBaseSegment(item, ctx);
}
void Layout::layoutBeam1(Beam* item)
void ScoreRendering::layoutBeam1(Beam* item)
{
LayoutContext ctx(item->score());
TLayout::layout1(item, ctx);
}
void Layout::layoutStem(Chord* item)
void ScoreRendering::layoutStem(Chord* item)
{
LayoutContext ctx(item->score());
ChordLayout::layoutStem(item, ctx);

View file

@ -19,17 +19,17 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_ENGRAVING_LAYOUT_H
#define MU_ENGRAVING_LAYOUT_H
#ifndef MU_ENGRAVING_SCORERENDERING_DEV_H
#define MU_ENGRAVING_SCORERENDERING_DEV_H
#include "../ilayout.h"
#include "../iscorerendering.h"
namespace mu::engraving {
class Score;
}
namespace mu::engraving::rendering::dev {
class Layout : public IRendering
class ScoreRendering : public IScoreRendering
{
public:
@ -60,4 +60,4 @@ private:
};
}
#endif // MU_ENGRAVING_LAYOUT_H
#endif // MU_ENGRAVING_SCORERENDERING_DEV_H

View file

@ -19,8 +19,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_ENGRAVING_IRENDERING_H
#define MU_ENGRAVING_IRENDERING_H
#ifndef MU_ENGRAVING_ISCORERENDERING_H
#define MU_ENGRAVING_ISCORERENDERING_H
#include <variant>
@ -84,12 +84,12 @@ class TimeSig;
}
namespace mu::engraving::rendering {
class IRendering : MODULE_INTERNAL_INTERFACE
class IScoreRendering : MODULE_INTERNAL_INTERFACE
{
INTERFACE_ID(IEngravingRendering)
public:
virtual ~IRendering() = default;
virtual ~IScoreRendering() = default;
// Layout Score
virtual void layoutRange(Score* score, const Fraction& st, const Fraction& et) = 0;
@ -175,4 +175,4 @@ private:
};
}
#endif // MU_ENGRAVING_IRENDERING_H
#endif // MU_ENGRAVING_ISCORERENDERING_H

View file

@ -0,0 +1,58 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2023 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_ENGRAVING_ISINGLERENDERING_H
#define MU_ENGRAVING_ISINGLERENDERING_H
#include "modularity/imoduleinterface.h"
#include "draw/painter.h"
namespace mu::engraving {
class EngravingItem;
}
namespace mu::engraving::rendering {
class ISingleRendering : MODULE_EXPORT_INTERFACE
{
INTERFACE_ID(ISingleRendering)
public:
virtual ~ISingleRendering() = default;
void layoutItem(EngravingItem* item)
{
doLayoutItem(item);
}
void drawItem(const EngravingItem* item, draw::Painter* p)
{
doDrawItem(item, p);
}
protected:
virtual void doLayoutItem(EngravingItem* item) = 0;
virtual void doDrawItem(const EngravingItem* item, draw::Painter* p) = 0;
};
}
#endif // MU_ENGRAVING_ISINGLERENDERING_H

View file

@ -0,0 +1,10 @@
set(RENDERING_SINGLE_SRC
${CMAKE_CURRENT_LIST_DIR}/singlerendering.cpp
${CMAKE_CURRENT_LIST_DIR}/singlerendering.h
${CMAKE_CURRENT_LIST_DIR}/singlelayout.cpp
${CMAKE_CURRENT_LIST_DIR}/singlelayout.h
${CMAKE_CURRENT_LIST_DIR}/singledraw.cpp
${CMAKE_CURRENT_LIST_DIR}/singledraw.h
)

View file

@ -5,7 +5,7 @@
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
* Copyright (C) 2023 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@ -19,7 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "palettedraw.h"
#include "singledraw.h"
#include "draw/painter.h"
@ -29,11 +29,11 @@
#include "infrastructure/rtti.h"
using namespace mu::palette;
using namespace mu::engraving::rendering::single;
using namespace mu::engraving;
using namespace mu::engraving::rtti;
void PaletteDraw::drawItem(const EngravingItem* item, draw::Painter* painter)
void SingleDraw::drawItem(const EngravingItem* item, draw::Painter* painter)
{
switch (item->type()) {
case ElementType::ACCIDENTAL: draw(item_cast<const Accidental*>(item), painter);
@ -43,7 +43,7 @@ void PaletteDraw::drawItem(const EngravingItem* item, draw::Painter* painter)
}
}
void PaletteDraw::draw(const Accidental* item, draw::Painter* painter)
void SingleDraw::draw(const Accidental* item, draw::Painter* painter)
{
// don't show accidentals for tab or slash notation
if (item->onTabStaff() || (item->note() && item->note()->fixed())) {

View file

@ -19,15 +19,18 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_PALETTE_PALETTEDRAW_H
#define MU_PALETTE_PALETTEDRAW_H
#ifndef MU_ENGRAVING_SINGLEDRAW_H
#define MU_ENGRAVING_SINGLEDRAW_H
#include "libmscore/engravingitem.h"
namespace mu::draw {
class Painter;
}
namespace mu::engraving {
class MStyle;
class IEngravingFont;
class Score;
class EngravingItem;
class Accidental;
class ActionIcon;
@ -119,16 +122,16 @@ class Volta;
class VoltaSegment;
}
namespace mu::palette {
class PaletteDraw
namespace mu::engraving::rendering::single {
class SingleDraw
{
public:
static void drawItem(const engraving::EngravingItem* item, draw::Painter* p); // factory
static void drawItem(const EngravingItem* item, draw::Painter* p); // factory
private:
static void draw(const engraving::Accidental* item, draw::Painter* p);
static void draw(const Accidental* item, draw::Painter* p);
};
}
#endif // MU_PALETTE_PALETTEDRAW_H
#endif // MU_ENGRAVING_SINGLEDRAW_H

View file

@ -5,7 +5,7 @@
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
* Copyright (C) 2023 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@ -20,84 +20,84 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "palettelayout.h"
#include "singlelayout.h"
#include "draw/fontmetrics.h"
#include "engraving/types/typesconv.h"
#include "engraving/types/symnames.h"
#include "types/typesconv.h"
#include "types/symnames.h"
#include "engraving/compat/dummyelement.h"
#include "compat/dummyelement.h"
#include "engraving/libmscore/engravingitem.h"
#include "engraving/libmscore/score.h"
#include "libmscore/engravingitem.h"
#include "libmscore/score.h"
#include "engraving/libmscore/accidental.h"
#include "engraving/libmscore/actionicon.h"
#include "engraving/libmscore/ambitus.h"
#include "engraving/libmscore/articulation.h"
#include "engraving/libmscore/bagpembell.h"
#include "engraving/libmscore/barline.h"
#include "engraving/libmscore/bend.h"
#include "engraving/libmscore/bracket.h"
#include "engraving/libmscore/breath.h"
#include "engraving/libmscore/capo.h"
#include "engraving/libmscore/chordline.h"
#include "engraving/libmscore/clef.h"
#include "engraving/libmscore/dynamic.h"
#include "engraving/libmscore/expression.h"
#include "engraving/libmscore/fermata.h"
#include "engraving/libmscore/fingering.h"
#include "engraving/libmscore/fret.h"
#include "engraving/libmscore/glissando.h"
#include "engraving/libmscore/gradualtempochange.h"
#include "engraving/libmscore/hairpin.h"
#include "engraving/libmscore/harppedaldiagram.h"
#include "engraving/libmscore/instrchange.h"
#include "engraving/libmscore/jump.h"
#include "engraving/libmscore/keysig.h"
#include "engraving/libmscore/letring.h"
#include "engraving/libmscore/line.h"
#include "engraving/libmscore/marker.h"
#include "engraving/libmscore/measurenumber.h"
#include "engraving/libmscore/measurerepeat.h"
#include "engraving/libmscore/note.h"
#include "engraving/libmscore/ornament.h"
#include "engraving/libmscore/ottava.h"
#include "engraving/libmscore/palmmute.h"
#include "engraving/libmscore/pedal.h"
#include "engraving/libmscore/playtechannotation.h"
#include "engraving/libmscore/rehearsalmark.h"
#include "engraving/libmscore/slur.h"
#include "engraving/libmscore/stafftext.h"
#include "engraving/libmscore/stafftypechange.h"
#include "engraving/libmscore/symbol.h"
#include "engraving/libmscore/systemtext.h"
#include "engraving/libmscore/tempotext.h"
#include "engraving/libmscore/text.h"
#include "engraving/libmscore/textline.h"
#include "engraving/libmscore/textlinebase.h"
#include "engraving/libmscore/timesig.h"
#include "engraving/libmscore/tremolobar.h"
#include "engraving/libmscore/trill.h"
#include "engraving/libmscore/vibrato.h"
#include "engraving/libmscore/volta.h"
#include "libmscore/accidental.h"
#include "libmscore/actionicon.h"
#include "libmscore/ambitus.h"
#include "libmscore/articulation.h"
#include "libmscore/bagpembell.h"
#include "libmscore/barline.h"
#include "libmscore/bend.h"
#include "libmscore/bracket.h"
#include "libmscore/breath.h"
#include "libmscore/capo.h"
#include "libmscore/chordline.h"
#include "libmscore/clef.h"
#include "libmscore/dynamic.h"
#include "libmscore/expression.h"
#include "libmscore/fermata.h"
#include "libmscore/fingering.h"
#include "libmscore/fret.h"
#include "libmscore/glissando.h"
#include "libmscore/gradualtempochange.h"
#include "libmscore/hairpin.h"
#include "libmscore/harppedaldiagram.h"
#include "libmscore/instrchange.h"
#include "libmscore/jump.h"
#include "libmscore/keysig.h"
#include "libmscore/letring.h"
#include "libmscore/line.h"
#include "libmscore/marker.h"
#include "libmscore/measurenumber.h"
#include "libmscore/measurerepeat.h"
#include "libmscore/note.h"
#include "libmscore/ornament.h"
#include "libmscore/ottava.h"
#include "libmscore/palmmute.h"
#include "libmscore/pedal.h"
#include "libmscore/playtechannotation.h"
#include "libmscore/rehearsalmark.h"
#include "libmscore/slur.h"
#include "libmscore/stafftext.h"
#include "libmscore/stafftypechange.h"
#include "libmscore/symbol.h"
#include "libmscore/systemtext.h"
#include "libmscore/tempotext.h"
#include "libmscore/text.h"
#include "libmscore/textline.h"
#include "libmscore/textlinebase.h"
#include "libmscore/timesig.h"
#include "libmscore/tremolobar.h"
#include "libmscore/trill.h"
#include "libmscore/vibrato.h"
#include "libmscore/volta.h"
#include "engraving/libmscore/utils.h"
#include "libmscore/utils.h"
#include "engraving/rendering/dev/tlayout.h"
#include "engraving/rendering/dev/tremololayout.h"
#include "engraving/rendering/dev/arpeggiolayout.h"
#include "engraving/rendering/dev/chordlayout.h"
#include "rendering/dev/tlayout.h"
#include "rendering/dev/tremololayout.h"
#include "rendering/dev/arpeggiolayout.h"
#include "rendering/dev/chordlayout.h"
#include "log.h"
using namespace mu::draw;
using namespace mu::engraving;
using namespace mu::engraving::rendering::dev;
using namespace mu::palette;
using namespace mu::engraving::rendering::single;
void PaletteLayout::layoutItem(EngravingItem* item)
void SingleLayout::layoutItem(EngravingItem* item)
{
Context ctx(item->score());
@ -219,7 +219,7 @@ void PaletteLayout::layoutItem(EngravingItem* item)
}
}
void PaletteLayout::layoutLineSegment(LineSegment* item, const Context& ctx)
void SingleLayout::layoutLineSegment(LineSegment* item, const Context& ctx)
{
switch (item->type()) {
case ElementType::GRADUAL_TEMPO_CHANGE_SEGMENT: layout(toGradualTempoChangeSegment(item), ctx);
@ -248,22 +248,22 @@ void PaletteLayout::layoutLineSegment(LineSegment* item, const Context& ctx)
}
}
const MStyle& PaletteLayout::Context::style() const
const MStyle& SingleLayout::Context::style() const
{
return m_score->style();
}
std::shared_ptr<IEngravingFont> PaletteLayout::Context::engravingFont() const
std::shared_ptr<IEngravingFont> SingleLayout::Context::engravingFont() const
{
return m_score->engravingFont();
}
compat::DummyElement* PaletteLayout::Context::dummyParent() const
compat::DummyElement* SingleLayout::Context::dummyParent() const
{
return m_score->dummy();
}
void PaletteLayout::layout(Accidental* item, const Context&)
void SingleLayout::layout(Accidental* item, const Context&)
{
if (!item->layoutData().isValid()) {
Accidental::LayoutData data;
@ -275,13 +275,13 @@ void PaletteLayout::layout(Accidental* item, const Context&)
}
}
void PaletteLayout::layout(ActionIcon* item, const Context&)
void SingleLayout::layout(ActionIcon* item, const Context&)
{
FontMetrics fontMetrics(item->iconFont());
item->setbbox(fontMetrics.boundingRect(Char(item->icon())));
}
void PaletteLayout::layout(Ambitus* item, const Context& ctx)
void SingleLayout::layout(Ambitus* item, const Context& ctx)
{
double headWdt = item->headWidth();
double spatium = item->spatium();
@ -360,7 +360,7 @@ void PaletteLayout::layout(Ambitus* item, const Context& ctx)
);
}
void PaletteLayout::layout(Arpeggio* item, const Context& ctx)
void SingleLayout::layout(Arpeggio* item, const Context& ctx)
{
LayoutContext tctx(ctx.dontUseScore());
Arpeggio::LayoutData data;
@ -368,7 +368,7 @@ void PaletteLayout::layout(Arpeggio* item, const Context& ctx)
item->setLayoutData(data);
}
void PaletteLayout::layout(Articulation* item, const Context&)
void SingleLayout::layout(Articulation* item, const Context&)
{
RectF bbox;
@ -385,7 +385,7 @@ void PaletteLayout::layout(Articulation* item, const Context&)
}
static void layoutBagpipeEmbellishment(const BagpipeEmbellishment* item,
const PaletteLayout::Context& ctx,
const SingleLayout::Context& ctx,
BagpipeEmbellishment::LayoutData& data)
{
const double mags = item->magS() * 0.75; // grace head magnification
@ -453,14 +453,14 @@ static void layoutBagpipeEmbellishment(const BagpipeEmbellishment* item,
dataBeam.x2 = x - headp - data.stemLineW * .5;
}
void PaletteLayout::layout(BagpipeEmbellishment* item, const Context& ctx)
void SingleLayout::layout(BagpipeEmbellishment* item, const Context& ctx)
{
BagpipeEmbellishment::LayoutData data;
layoutBagpipeEmbellishment(item, ctx, data);
item->setLayoutData(data);
}
void PaletteLayout::layout(BarLine* item, const Context& ctx)
void SingleLayout::layout(BarLine* item, const Context& ctx)
{
item->setPos(PointF());
item->setMag(1.0);
@ -520,7 +520,7 @@ void PaletteLayout::layout(BarLine* item, const Context& ctx)
item->setbbox(bbox);
}
void PaletteLayout::layout(Bend* item, const Context&)
void SingleLayout::layout(Bend* item, const Context&)
{
double spatium = item->spatium();
double lw = item->lineWidth();
@ -609,7 +609,7 @@ void PaletteLayout::layout(Bend* item, const Context&)
item->setPos(0.0, 0.0);
}
void PaletteLayout::layout(Bracket* item, const Context& ctx)
void SingleLayout::layout(Bracket* item, const Context& ctx)
{
Shape shape;
@ -668,23 +668,23 @@ void PaletteLayout::layout(Bracket* item, const Context& ctx)
item->setShape(shape);
}
void PaletteLayout::layout(Breath* item, const Context&)
void SingleLayout::layout(Breath* item, const Context&)
{
item->setbbox(item->symBbox(item->symId()));
}
void PaletteLayout::layout(Capo* item, const Context& ctx)
void SingleLayout::layout(Capo* item, const Context& ctx)
{
layoutTextBase(item, ctx);
}
void PaletteLayout::layout(Chord* item, const Context& ctx)
void SingleLayout::layout(Chord* item, const Context& ctx)
{
LayoutContext tctx(ctx.dontUseScore());
ChordLayout::layout(item, tctx);
}
void PaletteLayout::layout(ChordLine* item, const Context& ctx)
void SingleLayout::layout(ChordLine* item, const Context& ctx)
{
item->setMag(1.0);
if (!item->modified()) {
@ -739,7 +739,7 @@ void PaletteLayout::layout(ChordLine* item, const Context& ctx)
}
}
void PaletteLayout::layout(Clef* item, const Context& ctx)
void SingleLayout::layout(Clef* item, const Context& ctx)
{
constexpr int lines = 5;
constexpr double lineDist = 1.0;
@ -777,12 +777,12 @@ void PaletteLayout::layout(Clef* item, const Context& ctx)
item->setbbox(bbox);
}
void PaletteLayout::layout(Expression* item, const Context& ctx)
void SingleLayout::layout(Expression* item, const Context& ctx)
{
layoutTextBase(item, ctx);
}
void PaletteLayout::layout(Fermata* item, const Context&)
void SingleLayout::layout(Fermata* item, const Context&)
{
item->setPos(PointF());
item->setOffset(PointF());
@ -790,12 +790,12 @@ void PaletteLayout::layout(Fermata* item, const Context&)
item->setbbox(b.translated(-0.5 * b.width(), 0.0));
}
void PaletteLayout::layout(Fingering* item, const Context& ctx)
void SingleLayout::layout(Fingering* item, const Context& ctx)
{
layoutTextBase(item, ctx);
}
void PaletteLayout::layout(FretDiagram* item, const Context& ctx)
void SingleLayout::layout(FretDiagram* item, const Context& ctx)
{
double spatium = item->spatium();
item->setStringLw(spatium * 0.08);
@ -831,19 +831,19 @@ void PaletteLayout::layout(FretDiagram* item, const Context& ctx)
item->bbox().setRect(x, y, w, h);
}
void PaletteLayout::layout(FSymbol* item, const Context&)
void SingleLayout::layout(FSymbol* item, const Context&)
{
item->setbbox(draw::FontMetrics::boundingRect(item->font(), item->toString()));
item->setOffset(0.0, 0.0);
item->setPos(0.0, 0.0);
}
void PaletteLayout::layout(Dynamic* item, const Context& ctx)
void SingleLayout::layout(Dynamic* item, const Context& ctx)
{
layoutTextBase(item, ctx);
}
void PaletteLayout::layout(Glissando* item, const Context& ctx)
void SingleLayout::layout(Glissando* item, const Context& ctx)
{
double spatium = item->spatium();
@ -856,7 +856,7 @@ void PaletteLayout::layout(Glissando* item, const Context& ctx)
layout(static_cast<GlissandoSegment*>(s), ctx);
}
void PaletteLayout::layout(GlissandoSegment* item, const Context&)
void SingleLayout::layout(GlissandoSegment* item, const Context&)
{
if (item->pos2().x() <= 0) {
item->setbbox(RectF());
@ -868,24 +868,24 @@ void PaletteLayout::layout(GlissandoSegment* item, const Context&)
item->setbbox(r.adjusted(-lw, -lw, lw, lw));
}
void PaletteLayout::layout(GradualTempoChange* item, const Context& ctx)
void SingleLayout::layout(GradualTempoChange* item, const Context& ctx)
{
layoutLine(item, ctx);
}
void PaletteLayout::layout(GradualTempoChangeSegment* item, const Context& ctx)
void SingleLayout::layout(GradualTempoChangeSegment* item, const Context& ctx)
{
layoutTextLineBaseSegment(item, ctx);
item->setOffset(PointF());
}
void PaletteLayout::layout(Hairpin* item, const Context& ctx)
void SingleLayout::layout(Hairpin* item, const Context& ctx)
{
item->setPos(0.0, 0.0);
layoutLine(item, ctx);
}
void PaletteLayout::layout(HairpinSegment* item, const Context& ctx)
void SingleLayout::layout(HairpinSegment* item, const Context& ctx)
{
const double spatium = item->spatium();
@ -1001,23 +1001,23 @@ void PaletteLayout::layout(HairpinSegment* item, const Context& ctx)
item->setOffset(PointF());
}
void PaletteLayout::layout(HarpPedalDiagram* item, const Context& ctx)
void SingleLayout::layout(HarpPedalDiagram* item, const Context& ctx)
{
item->updateDiagramText();
layoutTextBase(item, ctx);
}
void PaletteLayout::layout(InstrumentChange* item, const Context& ctx)
void SingleLayout::layout(InstrumentChange* item, const Context& ctx)
{
layoutTextBase(item, ctx);
}
void PaletteLayout::layout(Jump* item, const Context& ctx)
void SingleLayout::layout(Jump* item, const Context& ctx)
{
layoutTextBase(item, ctx);
}
void PaletteLayout::layout(KeySig* item, const Context& ctx)
void SingleLayout::layout(KeySig* item, const Context& ctx)
{
double spatium = item->spatium();
double step = spatium * 0.5;
@ -1140,32 +1140,32 @@ void PaletteLayout::layout(KeySig* item, const Context& ctx)
}
}
void PaletteLayout::layout(LayoutBreak* item, const Context&)
void SingleLayout::layout(LayoutBreak* item, const Context&)
{
UNUSED(item);
}
void PaletteLayout::layout(LetRing* item, const Context& ctx)
void SingleLayout::layout(LetRing* item, const Context& ctx)
{
layoutLine(item, ctx);
}
void PaletteLayout::layout(LetRingSegment* item, const Context& ctx)
void SingleLayout::layout(LetRingSegment* item, const Context& ctx)
{
layoutTextLineBaseSegment(item, ctx);
}
void PaletteLayout::layout(NoteHead* item, const Context& ctx)
void SingleLayout::layout(NoteHead* item, const Context& ctx)
{
layout(static_cast<Symbol*>(item), ctx);
}
void PaletteLayout::layout(Marker* item, const Context& ctx)
void SingleLayout::layout(Marker* item, const Context& ctx)
{
layoutTextBase(item, ctx);
}
void PaletteLayout::layout(MeasureNumber* item, const Context& ctx)
void SingleLayout::layout(MeasureNumber* item, const Context& ctx)
{
item->setPos(PointF());
item->setOffset(PointF());
@ -1173,7 +1173,7 @@ void PaletteLayout::layout(MeasureNumber* item, const Context& ctx)
layout1TextBase(item, ctx);
}
void PaletteLayout::layout(MeasureRepeat* item, const Context& ctx)
void SingleLayout::layout(MeasureRepeat* item, const Context& ctx)
{
switch (item->numMeasures()) {
case 1:
@ -1204,7 +1204,7 @@ void PaletteLayout::layout(MeasureRepeat* item, const Context& ctx)
item->setbbox(bbox);
}
void PaletteLayout::layout(Ornament* item, const Context& ctx)
void SingleLayout::layout(Ornament* item, const Context& ctx)
{
double spatium = item->spatium();
double vertMargin = 0.35 * spatium;
@ -1230,49 +1230,49 @@ void PaletteLayout::layout(Ornament* item, const Context& ctx)
}
}
void PaletteLayout::layout(Ottava* item, const Context& ctx)
void SingleLayout::layout(Ottava* item, const Context& ctx)
{
layoutLine(item, ctx);
}
void PaletteLayout::layout(OttavaSegment* item, const Context& ctx)
void SingleLayout::layout(OttavaSegment* item, const Context& ctx)
{
layoutTextLineBaseSegment(item, ctx);
item->setOffset(PointF());
}
void PaletteLayout::layout(PalmMute* item, const Context& ctx)
void SingleLayout::layout(PalmMute* item, const Context& ctx)
{
layoutLine(item, ctx);
}
void PaletteLayout::layout(PalmMuteSegment* item, const Context& ctx)
void SingleLayout::layout(PalmMuteSegment* item, const Context& ctx)
{
layoutTextLineBaseSegment(item, ctx);
}
void PaletteLayout::layout(Pedal* item, const Context& ctx)
void SingleLayout::layout(Pedal* item, const Context& ctx)
{
layoutLine(item, ctx);
}
void PaletteLayout::layout(PedalSegment* item, const Context& ctx)
void SingleLayout::layout(PedalSegment* item, const Context& ctx)
{
layoutTextLineBaseSegment(item, ctx);
item->setOffset(PointF());
}
void PaletteLayout::layout(PlayTechAnnotation* item, const Context& ctx)
void SingleLayout::layout(PlayTechAnnotation* item, const Context& ctx)
{
layoutTextBase(item, ctx);
}
void PaletteLayout::layout(RehearsalMark* item, const Context& ctx)
void SingleLayout::layout(RehearsalMark* item, const Context& ctx)
{
layoutTextBase(item, ctx);
}
void PaletteLayout::layout(Slur* item, const Context& ctx)
void SingleLayout::layout(Slur* item, const Context& ctx)
{
double spatium = item->spatium();
SlurSegment* s = nullptr;
@ -1297,52 +1297,52 @@ void PaletteLayout::layout(Slur* item, const Context& ctx)
item->setbbox(s->bbox());
}
void PaletteLayout::layout(Spacer* item, const Context&)
void SingleLayout::layout(Spacer* item, const Context&)
{
UNUSED(item);
}
void PaletteLayout::layout(StaffText* item, const Context& ctx)
void SingleLayout::layout(StaffText* item, const Context& ctx)
{
layoutTextBase(item, ctx);
}
void PaletteLayout::layout(StaffTypeChange* item, const Context& ctx)
void SingleLayout::layout(StaffTypeChange* item, const Context& ctx)
{
double spatium = ctx.style().spatium();
item->setbbox(RectF(-item->lw() * .5, -item->lw() * .5, spatium * 2.5 + item->lw(), spatium * 2.5 + item->lw()));
item->setPos(0.0, 0.0);
}
void PaletteLayout::layout(Symbol* item, const Context&)
void SingleLayout::layout(Symbol* item, const Context&)
{
item->setbbox(item->scoreFont() ? item->scoreFont()->bbox(item->sym(), item->magS()) : item->symBbox(item->sym()));
item->setOffset(0.0, 0.0);
item->setPos(0.0, 0.0);
}
void PaletteLayout::layout(SystemText* item, const Context& ctx)
void SingleLayout::layout(SystemText* item, const Context& ctx)
{
layoutTextBase(item, ctx);
}
void PaletteLayout::layout(TempoText* item, const Context& ctx)
void SingleLayout::layout(TempoText* item, const Context& ctx)
{
layoutTextBase(item, ctx);
}
void PaletteLayout::layout(TextLine* item, const Context& ctx)
void SingleLayout::layout(TextLine* item, const Context& ctx)
{
layoutLine(item, ctx);
}
void PaletteLayout::layout(TextLineSegment* item, const Context& ctx)
void SingleLayout::layout(TextLineSegment* item, const Context& ctx)
{
layoutTextLineBaseSegment(item, ctx);
item->setOffset(PointF());
}
void PaletteLayout::layout(TimeSig* item, const Context& ctx)
void SingleLayout::layout(TimeSig* item, const Context& ctx)
{
item->setPos(0.0, 0.0);
double spatium = item->spatium();
@ -1451,14 +1451,14 @@ void PaletteLayout::layout(TimeSig* item, const Context& ctx)
item->setDrawArgs(drawArgs);
}
void PaletteLayout::layout(Tremolo* item, const Context& ctx)
void SingleLayout::layout(Tremolo* item, const Context& ctx)
{
//! TODO
LayoutContext tctx(ctx.dontUseScore());
TremoloLayout::layout(item, tctx);
}
void PaletteLayout::layout(TremoloBar* item, const Context&)
void SingleLayout::layout(TremoloBar* item, const Context&)
{
double spatium = item->spatium();
@ -1477,12 +1477,12 @@ void PaletteLayout::layout(TremoloBar* item, const Context&)
item->setbbox(item->polygon().boundingRect().adjusted(-w, -w, w, w));
}
void PaletteLayout::layout(Trill* item, const Context& ctx)
void SingleLayout::layout(Trill* item, const Context& ctx)
{
layoutLine(static_cast<SLine*>(item), ctx);
}
void PaletteLayout::layout(TrillSegment* item, const Context& ctx)
void SingleLayout::layout(TrillSegment* item, const Context& ctx)
{
if (item->spanner()->placeBelow()) {
item->setPosY(0.0);
@ -1544,12 +1544,12 @@ void PaletteLayout::layout(TrillSegment* item, const Context& ctx)
item->setOffset(PointF());
}
void PaletteLayout::layout(Vibrato* item, const Context& ctx)
void SingleLayout::layout(Vibrato* item, const Context& ctx)
{
layoutLine(static_cast<SLine*>(item), ctx);
}
void PaletteLayout::layout(VibratoSegment* item, const Context&)
void SingleLayout::layout(VibratoSegment* item, const Context&)
{
if (item->spanner()->placeBelow()) {
item->setPosY(0.0);
@ -1573,24 +1573,24 @@ void PaletteLayout::layout(VibratoSegment* item, const Context&)
item->setOffset(PointF());
}
void PaletteLayout::layout(Volta* item, const Context& ctx)
void SingleLayout::layout(Volta* item, const Context& ctx)
{
layoutLine(item, ctx);
}
void PaletteLayout::layout(VoltaSegment* item, const Context& ctx)
void SingleLayout::layout(VoltaSegment* item, const Context& ctx)
{
layoutTextLineBaseSegment(item, ctx);
item->setOffset(PointF());
item->text()->setOffset(PointF(10.0, 54.0)); //! TODO
}
void PaletteLayout::layout(Text* item, const Context& ctx)
void SingleLayout::layout(Text* item, const Context& ctx)
{
layoutTextBase(static_cast<TextBase*>(item), ctx);
}
void PaletteLayout::layoutTextBase(TextBase* item, const Context& ctx)
void SingleLayout::layoutTextBase(TextBase* item, const Context& ctx)
{
item->setPos(PointF());
item->setOffset(PointF());
@ -1602,7 +1602,7 @@ void PaletteLayout::layoutTextBase(TextBase* item, const Context& ctx)
layout1TextBase(item, ctx);
}
void PaletteLayout::layout1TextBase(TextBase* item, const Context&)
void SingleLayout::layout1TextBase(TextBase* item, const Context&)
{
if (item->isBlockNotCreated()) {
item->createBlocks();
@ -1654,7 +1654,7 @@ void PaletteLayout::layout1TextBase(TextBase* item, const Context&)
}
}
void PaletteLayout::layoutLine(SLine* item, const Context& ctx)
void SingleLayout::layoutLine(SLine* item, const Context& ctx)
{
if (item->spannerSegments().empty()) {
item->setLen(ctx.style().spatium() * 7);
@ -1665,7 +1665,7 @@ void PaletteLayout::layoutLine(SLine* item, const Context& ctx)
item->setbbox(lineSegm->bbox());
}
void PaletteLayout::layoutTextLineBaseSegment(TextLineBaseSegment* item, const Context& ctx)
void SingleLayout::layoutTextLineBaseSegment(TextLineBaseSegment* item, const Context& ctx)
{
item->npointsRef() = 0;
TextLineBase* tl = item->textLineBase();

View file

@ -0,0 +1,246 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2023 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_ENGRAVING_SINGLELAYOUT_H
#define MU_ENGRAVING_SINGLELAYOUT_H
#include <memory>
namespace mu::engraving {
class MStyle;
class IEngravingFont;
class EngravingItem;
class Score;
class Accidental;
class ActionIcon;
class Ambitus;
class Arpeggio;
class Articulation;
class BagpipeEmbellishment;
class BarLine;
class Bend;
class Bracket;
class Breath;
class Capo;
class Chord;
class ChordLine;
class Clef;
class Dynamic;
class Expression;
class Fermata;
class Fingering;
class FretDiagram;
class FSymbol;
class Glissando;
class GlissandoSegment;
class GradualTempoChange;
class GradualTempoChangeSegment;
class Hairpin;
class HairpinSegment;
class HarpPedalDiagram;
class InstrumentChange;
class Jump;
class KeySig;
class LayoutBreak;
class LetRing;
class LetRingSegment;
class SLine;
class LineSegment;
class Marker;
class MeasureNumber;
class MeasureRepeat;
class NoteHead;
class Ornament;
class Ottava;
class OttavaSegment;
class PalmMute;
class PalmMuteSegment;
class Pedal;
class PedalSegment;
class PlayTechAnnotation;
class RehearsalMark;
class Slur;
class Spacer;
class StaffText;
class StaffTypeChange;
class Symbol;
class SystemText;
class TempoText;
class Text;
class TextBase;
class TextLine;
class TextLineSegment;
class TextLineBaseSegment;
class TimeSig;
class Tremolo;
class TremoloBar;
class Trill;
class TrillSegment;
class Vibrato;
class VibratoSegment;
class Volta;
class VoltaSegment;
}
namespace mu::engraving::compat {
class DummyElement;
}
namespace mu::engraving::rendering::single {
class SingleLayout
{
public:
SingleLayout() = default;
static void layoutItem(engraving::EngravingItem* item);
struct Context {
Context(engraving::Score* s)
: m_score(s) {}
const engraving::MStyle& style() const;
std::shared_ptr<engraving::IEngravingFont> engravingFont() const;
engraving::compat::DummyElement* dummyParent() const;
//! NOTE Temporarily, do not use
engraving::Score* dontUseScore() const { return m_score; }
private:
engraving::Score* m_score = nullptr;
};
static void layout(Accidental* item, const Context& ctx);
static void layout(ActionIcon* item, const Context& ctx);
static void layout(Ambitus* item, const Context& ctx);
static void layout(Arpeggio* item, const Context& ctx);
static void layout(Articulation* item, const Context& ctx);
static void layout(BagpipeEmbellishment* item, const Context& ctx);
static void layout(BarLine* item, const Context& ctx);
static void layout(Bend* item, const Context& ctx);
static void layout(Bracket* item, const Context& ctx);
static void layout(Breath* item, const Context&);
static void layout(Capo* item, const Context& ctx);
static void layout(Chord* item, const Context& ctx);
static void layout(ChordLine* item, const Context& ctx);
static void layout(Clef* item, const Context& ctx);
static void layout(Dynamic* item, const Context& ctx);
static void layout(Expression* item, const Context& ctx);
static void layout(Fermata* item, const Context& ctx);
static void layout(Fingering* item, const Context& ctx);
static void layout(FretDiagram* item, const Context& ctx);
static void layout(FSymbol* item, const Context& ctx);
static void layout(Glissando* item, const Context& ctx);
static void layout(GradualTempoChange* item, const Context& ctx);
static void layout(Hairpin* item, const Context& ctx);
static void layout(HarpPedalDiagram* item, const Context& ctx);
static void layout(InstrumentChange* item, const Context& ctx);
static void layout(Jump* item, const Context& ctx);
static void layout(KeySig* item, const Context& ctx);
static void layout(LayoutBreak* item, const Context& ctx);
static void layout(LetRing* item, const Context& ctx);
static void layout(NoteHead* item, const Context& ctx);
static void layout(Marker* item, const Context& ctx);
static void layout(MeasureNumber* item, const Context& ctx);
static void layout(MeasureRepeat* item, const Context& ctx);
static void layout(Ornament* item, const Context& ctx);
static void layout(Ottava* item, const Context& ctx);
static void layout(PalmMute* item, const Context& ctx);
static void layout(Pedal* item, const Context& ctx);
static void layout(PlayTechAnnotation* item, const Context& ctx);
static void layout(RehearsalMark* item, const Context& ctx);
static void layout(Slur* item, const Context& ctx);
static void layout(Spacer* item, const Context&);
static void layout(StaffText* item, const Context& ctx);
static void layout(StaffTypeChange* item, const Context& ctx);
static void layout(Symbol* item, const Context& ctx);
static void layout(SystemText* item, const Context& ctx);
static void layout(TempoText* item, const Context& ctx);
static void layout(TextLine* item, const Context& ctx);
static void layout(TimeSig* item, const Context& ctx);
static void layout(Tremolo* item, const Context& ctx);
static void layout(TremoloBar* item, const Context& ctx);
static void layout(Trill* item, const Context& ctx);
static void layout(Vibrato* item, const Context& ctx);
static void layout(Volta* item, const Context& ctx);
private:
static void layout(GlissandoSegment* item, const Context& ctx);
static void layout(GradualTempoChangeSegment* item, const Context& ctx);
static void layout(HairpinSegment* item, const Context& ctx);
static void layout(LetRingSegment* item, const Context& ctx);
static void layout(OttavaSegment* item, const Context& ctx);
static void layout(PalmMuteSegment* item, const Context& ctx);
static void layout(PedalSegment* item, const Context& ctx);
static void layout(TextLineSegment* item, const Context& ctx);
static void layout(TrillSegment* item, const Context& ctx);
static void layout(VibratoSegment* item, const Context& ctx);
static void layout(VoltaSegment* item, const Context& ctx);
static void layout(Text* item, const Context& ctx);
static void layoutTextBase(TextBase* item, const Context& ctx);
static void layout1TextBase(TextBase* item, const Context& ctx);
static void layoutLine(SLine* item, const Context& ctx);
static void layoutLineSegment(LineSegment* item, const Context& ctx);
static void layoutTextLineBaseSegment(TextLineBaseSegment* item, const Context& ctx);
};
}
#endif // MU_ENGRAVING_SINGLELAYOUT_H

View file

@ -0,0 +1,37 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2023 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "singlerendering.h"
#include "singlelayout.h"
#include "singledraw.h"
using namespace mu::engraving::rendering::single;
void SingleRendering::doLayoutItem(EngravingItem* item)
{
SingleLayout::layoutItem(item);
}
void SingleRendering::doDrawItem(const EngravingItem* item, draw::Painter* p)
{
SingleDraw::drawItem(item, p);
}

View file

@ -0,0 +1,39 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2023 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_ENGRAVING_SINGLERENDERING_H
#define MU_ENGRAVING_SINGLERENDERING_H
#include "../isinglerendering.h"
namespace mu::engraving::rendering::single {
class SingleRendering : public ISingleRendering
{
public:
SingleRendering() = default;
protected:
void doLayoutItem(EngravingItem* item) override;
void doDrawItem(const EngravingItem* item, draw::Painter* p) override;
};
}
#endif // MU_ENGRAVING_SINGLERENDERING_H

View file

@ -1,12 +1,12 @@
set(RENDERING_STABLE_SRC
${CMAKE_CURRENT_LIST_DIR}/scorerendering.cpp
${CMAKE_CURRENT_LIST_DIR}/scorerendering.h
${CMAKE_CURRENT_LIST_DIR}/tdraw.cpp
${CMAKE_CURRENT_LIST_DIR}/tdraw.h
${CMAKE_CURRENT_LIST_DIR}/tlayout.cpp
${CMAKE_CURRENT_LIST_DIR}/tlayout.h
${CMAKE_CURRENT_LIST_DIR}/layout.cpp
${CMAKE_CURRENT_LIST_DIR}/layout.h
${CMAKE_CURRENT_LIST_DIR}/layoutcontext.cpp
${CMAKE_CURRENT_LIST_DIR}/layoutcontext.h
${CMAKE_CURRENT_LIST_DIR}/scorelayout.cpp

View file

@ -19,7 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "layout.h"
#include "scorerendering.h"
#include "libmscore/arpeggio.h"
#include "libmscore/beam.h"
@ -40,23 +40,23 @@
using namespace mu::engraving;
using namespace mu::engraving::rendering::stable;
void Layout::layoutRange(Score* score, const Fraction& st, const Fraction& et)
void ScoreRendering::layoutRange(Score* score, const Fraction& st, const Fraction& et)
{
ScoreLayout::layoutRange(score, st, et);
}
void Layout::doLayoutItem(EngravingItem* item)
void ScoreRendering::doLayoutItem(EngravingItem* item)
{
LayoutContext ctx(item->score());
TLayout::layoutItem(item, ctx);
}
void Layout::doDrawItem(const EngravingItem* item, draw::Painter* p)
void ScoreRendering::doDrawItem(const EngravingItem* item, draw::Painter* p)
{
TDraw::drawItem(item, p);
}
void Layout::layoutText1(TextBase* item, bool base)
void ScoreRendering::layoutText1(TextBase* item, bool base)
{
LayoutContext ctx(item->score());
if (base) {
@ -71,35 +71,35 @@ void Layout::layoutText1(TextBase* item, bool base)
// ===============================================================
// Layout Elements on Edit
// ===============================================================
void Layout::layoutOnEdit(Arpeggio* item)
void ScoreRendering::layoutOnEdit(Arpeggio* item)
{
LayoutContext ctx(item->score());
ArpeggioLayout::layoutOnEdit(item, ctx);
}
double Layout::computePadding(const EngravingItem* item1, const EngravingItem* item2)
double ScoreRendering::computePadding(const EngravingItem* item1, const EngravingItem* item2)
{
return HorizontalSpacing::computePadding(item1, item2);
}
KerningType Layout::computeKerning(const EngravingItem* item1, const EngravingItem* item2)
KerningType ScoreRendering::computeKerning(const EngravingItem* item1, const EngravingItem* item2)
{
return HorizontalSpacing::computeKerning(item1, item2);
}
void Layout::layoutTextLineBaseSegment(TextLineBaseSegment* item)
void ScoreRendering::layoutTextLineBaseSegment(TextLineBaseSegment* item)
{
LayoutContext ctx(item->score());
TLayout::layoutTextLineBaseSegment(item, ctx);
}
void Layout::layoutBeam1(Beam* item)
void ScoreRendering::layoutBeam1(Beam* item)
{
LayoutContext ctx(item->score());
TLayout::layout1(item, ctx);
}
void Layout::layoutStem(Chord* item)
void ScoreRendering::layoutStem(Chord* item)
{
LayoutContext ctx(item->score());
ChordLayout::layoutStem(item, ctx);

View file

@ -19,17 +19,17 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_ENGRAVING_LAYOUT_STABLE_H
#define MU_ENGRAVING_LAYOUT_STABLE_H
#ifndef MU_ENGRAVING_SCORERENDERING_STABLE_H
#define MU_ENGRAVING_SCORERENDERING_STABLE_H
#include "../ilayout.h"
#include "../iscorerendering.h"
namespace mu::engraving {
class Score;
}
namespace mu::engraving::rendering::stable {
class Layout : public IRendering
class ScoreRendering : public IScoreRendering
{
public:
@ -60,4 +60,4 @@ private:
};
}
#endif // MU_ENGRAVING_LAYOUT_STABLE_H
#endif // MU_ENGRAVING_SCORERENDERING_STABLE_H

View file

@ -43,10 +43,6 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/internal/paletteuiactions.h
${CMAKE_CURRENT_LIST_DIR}/internal/paletteactionscontroller.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/paletteactionscontroller.h
${CMAKE_CURRENT_LIST_DIR}/internal/palettelayout.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/palettelayout.h
${CMAKE_CURRENT_LIST_DIR}/internal/palettedraw.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/palettedraw.h
${CMAKE_CURRENT_LIST_DIR}/internal/ipaletteprovider.h
${CMAKE_CURRENT_LIST_DIR}/internal/paletteprovider.cpp

View file

@ -39,8 +39,6 @@
#include "engraving/libmscore/imageStore.h"
#include "engraving/libmscore/masterscore.h"
#include "palettelayout.h"
#include "palettecell.h"
#include "palettecompat.h"
@ -107,7 +105,7 @@ PaletteCellPtr Palette::insertElement(size_t idx, ElementPtr element, const QStr
{
if (element) {
// layout may be important for comparing cells, e.g. filtering "More" popup content
PaletteLayout::layoutItem(element.get());
engravingRendering()->layoutItem(element.get());
}
PaletteCellPtr cell = std::make_shared<PaletteCell>(element, name, mag, offset, tag, this);
@ -131,7 +129,7 @@ PaletteCellPtr Palette::appendElement(ElementPtr element, const QString& name, q
{
if (element) {
// layout may be important for comparing cells, e.g. filtering "More" popup content
PaletteLayout::layoutItem(element.get());
engravingRendering()->layoutItem(element.get());
}
PaletteCellPtr cell = std::make_shared<PaletteCell>(element, name, mag, offset, tag, this);

View file

@ -26,7 +26,8 @@
#include "palettecell.h"
#include "libmscore/engravingitem.h"
#include "engraving/rendering/isinglerendering.h"
#include "engraving/libmscore/engravingitem.h"
#include "types/translatablestring.h"
#include "actions/actiontypes.h"
@ -51,6 +52,7 @@ class Palette : public QObject
INJECT_STATIC(IPaletteConfiguration, configuration)
INJECT_STATIC(ui::IUiActionsRegister, actionsRegister)
INJECT_STATIC(engraving::rendering::ISingleRendering, engravingRendering)
INJECT(framework::IInteractive, interactive)
public:

View file

@ -31,9 +31,6 @@
#include "engraving/libmscore/masterscore.h"
#include "engraving/style/defaultstyle.h"
#include "palettelayout.h"
#include "palettedraw.h"
#include "log.h"
using namespace mu::palette;
@ -117,7 +114,7 @@ void PaletteCellIconEngine::paintActionIcon(Painter& painter, const RectF& rect,
ActionIcon* action = toActionIcon(element);
action->setFontSize(ActionIcon::DEFAULT_FONT_SIZE * m_cell->mag * m_extraMag);
PaletteLayout::layoutItem(action);
engravingRendering()->layoutItem(action);
painter.translate(rect.center() - action->bbox().center());
action->draw(&painter);
@ -174,7 +171,7 @@ void PaletteCellIconEngine::paintScoreElement(Painter& painter, EngravingItem* i
painter.scale(sizeRatio, sizeRatio); // scale coordinates so element is drawn at correct size
// calculate bbox
PaletteLayout::layoutItem(item);
engravingRendering()->layoutItem(item);
PointF origin = item->bbox().center();
@ -214,7 +211,7 @@ void PaletteCellIconEngine::paintPaletteItem(void* context, EngravingItem* item)
item->setProperty(Pid::FRAME_FG_COLOR, color);
}
PaletteDraw::drawItem(item, painter);
engravingRendering()->drawItem(item, painter);
item->setColorsInverionEnabled(colorsInversionEnabledBackup);
item->setProperty(Pid::COLOR, colorBackup);

View file

@ -28,6 +28,7 @@
#include "modularity/ioc.h"
#include "ipaletteconfiguration.h"
#include "engraving/rendering/isinglerendering.h"
namespace mu::draw {
class Painter;
@ -37,6 +38,7 @@ namespace mu::palette {
class PaletteCellIconEngine : public QIconEngine
{
INJECT_STATIC(IPaletteConfiguration, configuration)
INJECT_STATIC(engraving::rendering::ISingleRendering, engravingRendering)
public:
explicit PaletteCellIconEngine(PaletteCellConstPtr cell, qreal extraMag = 1.0);

View file

@ -1,246 +0,0 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_PALETTE_PALETTELAYOUT_H
#define MU_PALETTE_PALETTELAYOUT_H
#include <memory>
namespace mu::engraving {
class MStyle;
class IEngravingFont;
class EngravingItem;
class Score;
class Accidental;
class ActionIcon;
class Ambitus;
class Arpeggio;
class Articulation;
class BagpipeEmbellishment;
class BarLine;
class Bend;
class Bracket;
class Breath;
class Capo;
class Chord;
class ChordLine;
class Clef;
class Dynamic;
class Expression;
class Fermata;
class Fingering;
class FretDiagram;
class FSymbol;
class Glissando;
class GlissandoSegment;
class GradualTempoChange;
class GradualTempoChangeSegment;
class Hairpin;
class HairpinSegment;
class HarpPedalDiagram;
class InstrumentChange;
class Jump;
class KeySig;
class LayoutBreak;
class LetRing;
class LetRingSegment;
class SLine;
class LineSegment;
class Marker;
class MeasureNumber;
class MeasureRepeat;
class NoteHead;
class Ornament;
class Ottava;
class OttavaSegment;
class PalmMute;
class PalmMuteSegment;
class Pedal;
class PedalSegment;
class PlayTechAnnotation;
class RehearsalMark;
class Slur;
class Spacer;
class StaffText;
class StaffTypeChange;
class Symbol;
class SystemText;
class TempoText;
class Text;
class TextBase;
class TextLine;
class TextLineSegment;
class TextLineBaseSegment;
class TimeSig;
class Tremolo;
class TremoloBar;
class Trill;
class TrillSegment;
class Vibrato;
class VibratoSegment;
class Volta;
class VoltaSegment;
}
namespace mu::engraving::compat {
class DummyElement;
}
namespace mu::palette {
class PaletteLayout
{
public:
PaletteLayout() = default;
static void layoutItem(engraving::EngravingItem* item);
struct Context {
Context(engraving::Score* s)
: m_score(s) {}
const engraving::MStyle& style() const;
std::shared_ptr<engraving::IEngravingFont> engravingFont() const;
engraving::compat::DummyElement* dummyParent() const;
//! NOTE Temporarily, do not use
engraving::Score* dontUseScore() const { return m_score; }
private:
engraving::Score* m_score = nullptr;
};
static void layout(engraving::Accidental* item, const Context& ctx);
static void layout(engraving::ActionIcon* item, const Context& ctx);
static void layout(engraving::Ambitus* item, const Context& ctx);
static void layout(engraving::Arpeggio* item, const Context& ctx);
static void layout(engraving::Articulation* item, const Context& ctx);
static void layout(engraving::BagpipeEmbellishment* item, const Context& ctx);
static void layout(engraving::BarLine* item, const Context& ctx);
static void layout(engraving::Bend* item, const Context& ctx);
static void layout(engraving::Bracket* item, const Context& ctx);
static void layout(engraving::Breath* item, const Context&);
static void layout(engraving::Capo* item, const Context& ctx);
static void layout(engraving::Chord* item, const Context& ctx);
static void layout(engraving::ChordLine* item, const Context& ctx);
static void layout(engraving::Clef* item, const Context& ctx);
static void layout(engraving::Dynamic* item, const Context& ctx);
static void layout(engraving::Expression* item, const Context& ctx);
static void layout(engraving::Fermata* item, const Context& ctx);
static void layout(engraving::Fingering* item, const Context& ctx);
static void layout(engraving::FretDiagram* item, const Context& ctx);
static void layout(engraving::FSymbol* item, const Context& ctx);
static void layout(engraving::Glissando* item, const Context& ctx);
static void layout(engraving::GradualTempoChange* item, const Context& ctx);
static void layout(engraving::Hairpin* item, const Context& ctx);
static void layout(engraving::HarpPedalDiagram* item, const Context& ctx);
static void layout(engraving::InstrumentChange* item, const Context& ctx);
static void layout(engraving::Jump* item, const Context& ctx);
static void layout(engraving::KeySig* item, const Context& ctx);
static void layout(engraving::LayoutBreak* item, const Context& ctx);
static void layout(engraving::LetRing* item, const Context& ctx);
static void layout(engraving::NoteHead* item, const Context& ctx);
static void layout(engraving::Marker* item, const Context& ctx);
static void layout(engraving::MeasureNumber* item, const Context& ctx);
static void layout(engraving::MeasureRepeat* item, const Context& ctx);
static void layout(engraving::Ornament* item, const Context& ctx);
static void layout(engraving::Ottava* item, const Context& ctx);
static void layout(engraving::PalmMute* item, const Context& ctx);
static void layout(engraving::Pedal* item, const Context& ctx);
static void layout(engraving::PlayTechAnnotation* item, const Context& ctx);
static void layout(engraving::RehearsalMark* item, const Context& ctx);
static void layout(engraving::Slur* item, const Context& ctx);
static void layout(engraving::Spacer* item, const Context&);
static void layout(engraving::StaffText* item, const Context& ctx);
static void layout(engraving::StaffTypeChange* item, const Context& ctx);
static void layout(engraving::Symbol* item, const Context& ctx);
static void layout(engraving::SystemText* item, const Context& ctx);
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);
static void layout(engraving::Vibrato* item, const Context& ctx);
static void layout(engraving::Volta* item, const Context& ctx);
private:
static void layout(engraving::GlissandoSegment* item, const Context& ctx);
static void layout(engraving::GradualTempoChangeSegment* item, const Context& ctx);
static void layout(engraving::HairpinSegment* item, const Context& ctx);
static void layout(engraving::LetRingSegment* item, const Context& ctx);
static void layout(engraving::OttavaSegment* item, const Context& ctx);
static void layout(engraving::PalmMuteSegment* item, const Context& ctx);
static void layout(engraving::PedalSegment* item, const Context& ctx);
static void layout(engraving::TextLineSegment* item, const Context& ctx);
static void layout(engraving::TrillSegment* item, const Context& ctx);
static void layout(engraving::VibratoSegment* item, const Context& ctx);
static void layout(engraving::VoltaSegment* item, const Context& ctx);
static void layout(engraving::Text* item, const Context& ctx);
static void layoutTextBase(engraving::TextBase* item, const Context& ctx);
static void layout1TextBase(engraving::TextBase* item, const Context& ctx);
static void layoutLine(engraving::SLine* item, const Context& ctx);
static void layoutLineSegment(engraving::LineSegment* item, const Context& ctx);
static void layoutTextLineBaseSegment(engraving::TextLineBaseSegment* item, const Context& ctx);
};
}
#endif // MU_PALETTE_PALETTELAYOUT_H

View file

@ -28,6 +28,7 @@
#include "modularity/ioc.h"
#include "ipaletteconfiguration.h"
#include "iengravingconfiguration.h"
#include "engraving/rendering/isinglerendering.h"
namespace mu::engraving {
class Accidental;
@ -45,6 +46,7 @@ class KeyCanvas : public QFrame
INJECT(IPaletteConfiguration, configuration)
INJECT(engraving::IEngravingConfiguration, engravingConfiguration)
INJECT(engraving::rendering::ISingleRendering, engravingRendering)
engraving::Accidental* dragElement = nullptr;
engraving::Accidental* moveElement = nullptr;

View file

@ -46,7 +46,6 @@
#include "keycanvas.h"
#include "palettewidget.h"
#include "internal/palettecreator.h"
#include "internal/palettelayout.h"
#include "log.h"
@ -153,7 +152,7 @@ void KeyCanvas::paintEvent(QPaintEvent*)
}
clef->setPos(0.0, 0.0);
PaletteLayout::layoutItem(clef);
engravingRendering()->layoutItem(clef);
painter.translate(clef->pagePos());
clef->draw(&painter);
@ -231,7 +230,7 @@ void KeyCanvas::dragEnterEvent(QDragEnterEvent* event)
dragElement->resetExplicitParent();
rw::RWRegister::reader()->readItem(dragElement, e);
PaletteLayout::layoutItem(dragElement);
engravingRendering()->layoutItem(dragElement);
} else {
if (MScore::debugMode) {
LOGD("KeyCanvas::dragEnterEvent: formats:");

View file

@ -34,8 +34,6 @@
#include "commonscene/commonscenetypes.h"
#include "internal/palettelayout.h"
#include "log.h"
using namespace mu;
@ -68,7 +66,7 @@ void NoteGroupsExampleView::dragEnterEvent(QDragEnterEvent* event)
if (m_dragElement) {
m_dragElement->resetExplicitParent();
rw::RWRegister::reader()->readItem(m_dragElement, e);
PaletteLayout::layoutItem(m_dragElement);
engravingRendering()->layoutItem(m_dragElement);
}
return;
}

View file

@ -25,6 +25,9 @@
#include "notation/view/widgets/exampleview.h"
#include "modularity/ioc.h"
#include "engraving/rendering/isinglerendering.h"
namespace mu::engraving {
class Note;
class Chord;
@ -36,6 +39,8 @@ class NoteGroupsExampleView : public notation::ExampleView
{
Q_OBJECT
INJECT_STATIC(engraving::rendering::ISingleRendering, engravingRendering)
public:
NoteGroupsExampleView(QWidget* parent = 0);

View file

@ -61,7 +61,6 @@
#include "engraving/compat/dummyelement.h"
#include "internal/palettecelliconengine.h"
#include "internal/palettelayout.h"
#include "log.h"
@ -595,7 +594,7 @@ QPixmap PaletteWidget::pixmapForCellAt(int paletteIdx) const
cellMag = 1.0;
}
PaletteLayout::layoutItem(element.get());
engravingRendering()->layoutItem(element.get());
RectF r = element->bbox();
int w = lrint(r.width() * cellMag);
@ -1058,7 +1057,7 @@ void PaletteWidget::paintEvent(QPaintEvent* /*event*/)
cellMag = 1.0;
}
PaletteLayout::layoutItem(el.get());
engravingRendering()->layoutItem(el.get());
if (drawStaff) {
qreal y = r.y() + vgridM * .5 - dy + yOffset() * _spatium * cellMag;

View file

@ -29,6 +29,7 @@
#include "../../internal/palette.h"
#include "engraving/libmscore/engravingitem.h"
#include "engraving/rendering/isinglerendering.h"
#include "modularity/ioc.h"
#include "../../ipaletteconfiguration.h"
@ -71,6 +72,7 @@ class PaletteWidget : public QWidget
INJECT_STATIC(IPaletteConfiguration, configuration)
INJECT_STATIC(ui::IUiActionsRegister, actionsRegister)
INJECT_STATIC(context::IGlobalContext, globalContext)
INJECT_STATIC(engraving::rendering::ISingleRendering, engravingRendering)
INJECT(framework::IInteractive, interactive)
INJECT(ui::IUiConfiguration, uiConfiguration)

View file

@ -34,8 +34,6 @@
#include "engraving/libmscore/timesig.h"
#include "engraving/compat/dummyelement.h"
#include "internal/palettelayout.h"
using namespace mu::palette;
using namespace mu::engraving;
@ -83,7 +81,7 @@ TimeDialog::TimeDialog(QWidget* parent)
ElementPtr el = sp->elementForCellAt(2);
PaletteLayout::layoutItem(el.get());
engravingRendering()->layoutItem(el.get());
sp->setSelected(2);
paletteChanged(2);

View file

@ -28,6 +28,7 @@
#include "modularity/ioc.h"
#include "ipaletteconfiguration.h"
#include "internal/ipaletteprovider.h"
#include "engraving/rendering/isinglerendering.h"
namespace mu::palette {
class PaletteWidget;
@ -41,6 +42,7 @@ class TimeDialog : public QWidget, Ui::TimeDialogBase
INJECT(IPaletteConfiguration, configuration)
INJECT(IPaletteProvider, paletteProvider)
INJECT(engraving::rendering::ISingleRendering, engravingRendering)
public:
TimeDialog(QWidget* parent = 0);