Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-Studio-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2026 MuseScore Limited
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 : #include "palettescoreprovider.h"
23 :
24 : #ifndef ENGRAVING_NO_ACCESSIBILITY
25 : #include "../accessibility/accessibleitem.h"
26 : #endif
27 :
28 : #include "../compat/scoreaccess.h"
29 : #include "../infrastructure/localfileinfoprovider.h"
30 : #include "../style/defaultstyle.h"
31 :
32 : using namespace muse;
33 : using namespace mu::engraving;
34 :
35 0 : PaletteScoreProvider::PaletteScoreProvider(const modularity::ContextPtr& iocCtx)
36 0 : : muse::Contextable(iocCtx)
37 : {
38 0 : }
39 :
40 0 : PaletteScoreProvider::~PaletteScoreProvider()
41 : {
42 0 : }
43 :
44 0 : void PaletteScoreProvider::init()
45 : {
46 : #ifndef ENGRAVING_NO_ACCESSIBILITY
47 0 : AccessibleItem::enabled = false;
48 : #endif
49 0 : m_paletteScore = compat::ScoreAccess::createMasterScore(iocContext());
50 0 : m_paletteScore->setFileInfoProvider(std::make_shared<LocalFileInfoProvider>(""));
51 :
52 : #ifndef ENGRAVING_NO_ACCESSIBILITY
53 0 : AccessibleItem::enabled = true;
54 : #endif
55 :
56 0 : if (m_paletteScore->elementsProvider()) {
57 0 : m_paletteScore->elementsProvider()->unreg(m_paletteScore);
58 : }
59 :
60 0 : m_paletteScore->setStyle(DefaultStyle::baseStyle());
61 0 : m_paletteScore->style().set(Sid::musicalTextFont, String(u"Leland Text"));
62 0 : IEngravingFontPtr scoreFont = engravingfonts()->fontByName("Leland");
63 0 : m_paletteScore->setEngravingFont(scoreFont);
64 0 : m_paletteScore->setNoteHeadWidth(scoreFont->width(SymId::noteheadBlack,
65 0 : m_paletteScore->style().spatium()) / m_paletteScore->style().defaultSpatium());
66 0 : }
67 :
68 0 : void PaletteScoreProvider::deinit()
69 : {
70 0 : delete m_paletteScore;
71 0 : m_paletteScore = nullptr;
72 0 : }
73 :
74 0 : MasterScore* PaletteScoreProvider::paletteScore() const
75 : {
76 0 : return m_paletteScore;
77 : }
|