[engravint] added ilayout interface
This commit is contained in:
parent
754224bfc0
commit
46f32dcff2
12 changed files with 68 additions and 18 deletions
|
@ -146,11 +146,12 @@ set(MODULE_SRC
|
|||
${CMAKE_CURRENT_LIST_DIR}/style/defaultstyle.h
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/layout/README.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/layout/ilayout.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/layout/layoutoptions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/layout/v0/tlayout.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/layout/v0/tlayout.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/layout/v0/layout.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/layout/v0/layout.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/layout/v0/layoutoptions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/layout/v0/layoutcontext.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/layout/v0/layoutcontext.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/layout/v0/lyricslayout.cpp
|
||||
|
|
37
src/engraving/layout/ilayout.h
Normal file
37
src/engraving/layout/ilayout.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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_ENGRAVING_ILAYOUT_H
|
||||
#define MU_ENGRAVING_ILAYOUT_H
|
||||
|
||||
#include "layoutoptions.h"
|
||||
|
||||
namespace mu::engraving::layout {
|
||||
class ILayout
|
||||
{
|
||||
public:
|
||||
virtual ~ILayout() = default;
|
||||
|
||||
virtual void layoutRange(const LayoutOptions& options, const Fraction&, const Fraction&) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MU_ENGRAVING_ILAYOUT_H
|
|
@ -75,6 +75,11 @@ Layout::Layout(Score* score)
|
|||
{
|
||||
}
|
||||
|
||||
void Layout::layoutRange(const LayoutOptions& options, const Fraction& st, const Fraction& et)
|
||||
{
|
||||
doLayoutRange(options, st, et);
|
||||
}
|
||||
|
||||
void Layout::doLayoutRange(const LayoutOptions& options, const Fraction& st, const Fraction& et)
|
||||
{
|
||||
CmdStateLocker cmdStateLocker(m_score);
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
#ifndef MU_ENGRAVING_LAYOUT_H
|
||||
#define MU_ENGRAVING_LAYOUT_H
|
||||
|
||||
#include "layoutoptions.h"
|
||||
#include "../ilayout.h"
|
||||
#include "../layoutoptions.h"
|
||||
#include "layoutcontext.h"
|
||||
|
||||
namespace mu::engraving {
|
||||
|
@ -30,15 +31,15 @@ class Score;
|
|||
}
|
||||
|
||||
namespace mu::engraving::layout::v0 {
|
||||
class Layout
|
||||
class Layout : public ILayout
|
||||
{
|
||||
public:
|
||||
Layout(Score* score);
|
||||
|
||||
void doLayoutRange(const LayoutOptions& options, const Fraction&, const Fraction&);
|
||||
void layoutRange(const LayoutOptions& options, const Fraction& st, const Fraction& et) override;
|
||||
|
||||
private:
|
||||
|
||||
void doLayoutRange(const LayoutOptions& options, const Fraction&, const Fraction&);
|
||||
void layoutLinear(const LayoutOptions& options, LayoutContext& ctx);
|
||||
void layoutLinear(bool layoutAll, const LayoutOptions& options, LayoutContext& lc);
|
||||
void resetSystems(bool layoutAll, const LayoutOptions& options, LayoutContext& lc);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef MU_ENGRAVING_LYRICSLAYOUT_H
|
||||
#define MU_ENGRAVING_LYRICSLAYOUT_H
|
||||
|
||||
#include "layoutoptions.h"
|
||||
#include "../layoutoptions.h"
|
||||
#include "layoutcontext.h"
|
||||
|
||||
namespace mu::engraving {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef MU_ENGRAVING_MEASURELAYOUT_H
|
||||
#define MU_ENGRAVING_MEASURELAYOUT_H
|
||||
|
||||
#include "layoutoptions.h"
|
||||
#include "../layoutoptions.h"
|
||||
#include "layoutcontext.h"
|
||||
|
||||
namespace mu::engraving {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef MU_ENGRAVING_PAGELAYOUT_H
|
||||
#define MU_ENGRAVING_PAGELAYOUT_H
|
||||
|
||||
#include "layoutoptions.h"
|
||||
#include "../layoutoptions.h"
|
||||
#include "layoutcontext.h"
|
||||
|
||||
namespace mu::engraving {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include "layoutoptions.h"
|
||||
#include "../layoutoptions.h"
|
||||
#include "layoutcontext.h"
|
||||
|
||||
namespace mu::engraving {
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "types/translatablestring.h"
|
||||
#include "types/typesconv.h"
|
||||
#include "layout/v0/tlayout.h"
|
||||
#include "layout/v0/layout.h"
|
||||
|
||||
#include "articulation.h"
|
||||
#include "audio.h"
|
||||
|
@ -309,10 +310,8 @@ void MeasureBaseList::change(MeasureBase* ob, MeasureBase* nb)
|
|||
//---------------------------------------------------------
|
||||
|
||||
Score::Score()
|
||||
: EngravingObject(ElementType::SCORE, nullptr), _headersText(MAX_HEADERS, nullptr), _footersText(
|
||||
MAX_FOOTERS, nullptr),
|
||||
_selection(this),
|
||||
m_layout(this)
|
||||
: EngravingObject(ElementType::SCORE, nullptr), _headersText(MAX_HEADERS, nullptr)
|
||||
, _footersText(MAX_FOOTERS, nullptr), _selection(this)
|
||||
{
|
||||
Score::validScores.insert(this);
|
||||
_masterScore = 0;
|
||||
|
@ -333,6 +332,8 @@ Score::Score()
|
|||
|
||||
m_shadowNote = new ShadowNote(this);
|
||||
m_shadowNote->setVisible(false);
|
||||
|
||||
m_layout = new layout::v0::Layout(this);
|
||||
}
|
||||
|
||||
Score::Score(MasterScore* parent, bool forcePartStyle /* = true */)
|
||||
|
@ -428,6 +429,7 @@ Score::~Score()
|
|||
|
||||
delete m_rootItem;
|
||||
delete m_shadowNote;
|
||||
delete m_layout;
|
||||
}
|
||||
|
||||
mu::async::Channel<POS, unsigned> Score::posChanged() const
|
||||
|
@ -5749,7 +5751,7 @@ void Score::doLayoutRange(const Fraction& st, const Fraction& et)
|
|||
_noteHeadWidth = m_engravingFont->width(SymId::noteheadBlack, spatium() / SPATIUM20);
|
||||
|
||||
m_layoutOptions.updateFromStyle(style());
|
||||
m_layout.doLayoutRange(m_layoutOptions, st, et);
|
||||
m_layout->layoutRange(m_layoutOptions, st, et);
|
||||
|
||||
if (_resetAutoplace) {
|
||||
_resetAutoplace = false;
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
#include "draw/iimageprovider.h"
|
||||
#include "iengravingfontsprovider.h"
|
||||
|
||||
#include "layout/v0/layout.h"
|
||||
#include "layout/v0/layoutoptions.h"
|
||||
#include "layout/ilayout.h"
|
||||
#include "layout/layoutoptions.h"
|
||||
|
||||
#include "style/style.h"
|
||||
#include "style/pagestyle.h"
|
||||
|
@ -70,6 +70,10 @@ class Read302;
|
|||
class WriteScoreHook;
|
||||
}
|
||||
|
||||
namespace mu::engraving::layout::v0 {
|
||||
class Layout;
|
||||
}
|
||||
|
||||
namespace mu::engraving {
|
||||
class Articulation;
|
||||
class Audio;
|
||||
|
@ -441,7 +445,7 @@ private:
|
|||
double _noteHeadWidth { 0.0 }; // cached value
|
||||
|
||||
RootItem* m_rootItem = nullptr;
|
||||
layout::v0::Layout m_layout;
|
||||
layout::ILayout* m_layout = nullptr;
|
||||
LayoutOptions m_layoutOptions;
|
||||
|
||||
mu::async::Channel<EngravingItem*> m_elementDestroyed;
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
#include "libmscore/system.h"
|
||||
#include "libmscore/timesig.h"
|
||||
|
||||
#include "engraving/layout/v0/layoutoptions.h"
|
||||
#include "engraving/layout/layoutoptions.h"
|
||||
|
||||
namespace mu::notation {
|
||||
using Page = mu::engraving::Page;
|
||||
|
|
Loading…
Reference in a new issue