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) 2021 MuseScore Limited and others
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 : #pragma once
23 :
24 : #include "../../dom/connector.h"
25 :
26 : //---------------------------------------------------------
27 : // @@ ConnectorInfoWriter
28 : /// Helper class for writing connecting elements.
29 : /// Subclasses should fill _prevInfo and _nextInfo with
30 : /// the proper information on the connector's endpoints.
31 : //---------------------------------------------------------
32 :
33 : namespace mu::engraving {
34 : class XmlWriter;
35 : class Spanner;
36 : class MeasureBase;
37 : }
38 :
39 : namespace mu::engraving::write {
40 : class WriteContext;
41 : class ConnectorInfoWriter : public ConnectorInfo
42 : {
43 0 : OBJECT_ALLOCATOR(engraving, ConnectorInfoWriter)
44 :
45 : public:
46 : ConnectorInfoWriter(XmlWriter& xml, WriteContext* ctx, const EngravingItem* current, const EngravingItem* connector, int track = -1,
47 : Fraction = { -1, 1 });
48 0 : virtual ~ConnectorInfoWriter() = default;
49 :
50 : void write();
51 :
52 : protected:
53 : const EngravingItem* _connector;
54 :
55 : virtual const char* tagName() const = 0;
56 :
57 : private:
58 : XmlWriter* m_xml = nullptr;
59 : WriteContext* m_ctx = nullptr;
60 : };
61 :
62 : //-----------------------------------------------------------------------------
63 : // @@ SpannerWriter
64 : /// Helper class for writing Spanners
65 : //-----------------------------------------------------------------------------
66 :
67 : class SpannerWriter : public ConnectorInfoWriter
68 : {
69 0 : OBJECT_ALLOCATOR(engraving, SpannerWriter)
70 : protected:
71 0 : const char* tagName() const override { return "Spanner"; }
72 : public:
73 : SpannerWriter(XmlWriter& xml, WriteContext* ctx, const EngravingItem* current, const Spanner* spanner, int track, Fraction frac,
74 : bool start);
75 :
76 : static void fillSpannerPosition(Location& l, const MeasureBase* endpoint, const Fraction& tick, bool clipboardmode);
77 : };
78 : }
|