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 : #include "pagestyle.h"
23 :
24 : #include "style.h"
25 :
26 : namespace mu::engraving {
27 0 : const std::vector<Sid>& pageStyles()
28 : {
29 : static const std::vector<Sid> styles {
30 : Sid::pageWidth,
31 : Sid::pageHeight,
32 : Sid::pagePrintableWidth,
33 : Sid::pageEvenTopMargin,
34 : Sid::pageEvenBottomMargin,
35 : Sid::pageEvenLeftMargin,
36 : Sid::pageOddTopMargin,
37 : Sid::pageOddBottomMargin,
38 : Sid::pageOddLeftMargin,
39 : Sid::pageTwosided,
40 : Sid::spatium
41 0 : };
42 :
43 0 : return styles;
44 : }
45 :
46 0 : PageSizeGetAccessor::PageSizeGetAccessor(const MStyle& style)
47 0 : : m_style(style)
48 : {
49 0 : }
50 :
51 0 : double PageSizeGetAccessor::width() const
52 : {
53 0 : return m_style.styleD(Sid::pageWidth);
54 : }
55 :
56 0 : double PageSizeGetAccessor::height() const
57 : {
58 0 : return m_style.styleD(Sid::pageHeight);
59 : }
60 :
61 0 : double PageSizeGetAccessor::printableWidth() const
62 : {
63 0 : return m_style.styleD(Sid::pagePrintableWidth);
64 : }
65 :
66 0 : double PageSizeGetAccessor::evenTopMargin() const
67 : {
68 0 : return m_style.styleD(Sid::pageEvenTopMargin);
69 : }
70 :
71 0 : double PageSizeGetAccessor::evenBottomMargin() const
72 : {
73 0 : return m_style.styleD(Sid::pageEvenBottomMargin);
74 : }
75 :
76 0 : double PageSizeGetAccessor::evenLeftMargin() const
77 : {
78 0 : return m_style.styleD(Sid::pageEvenLeftMargin);
79 : }
80 :
81 0 : double PageSizeGetAccessor::oddTopMargin() const
82 : {
83 0 : return m_style.styleD(Sid::pageOddTopMargin);
84 : }
85 :
86 0 : double PageSizeGetAccessor::oddBottomMargin() const
87 : {
88 0 : return m_style.styleD(Sid::pageOddBottomMargin);
89 : }
90 :
91 0 : double PageSizeGetAccessor::oddLeftMargin() const
92 : {
93 0 : return m_style.styleD(Sid::pageOddLeftMargin);
94 : }
95 :
96 0 : double PageSizeGetAccessor::twosided() const
97 : {
98 0 : return m_style.styleD(Sid::pageTwosided);
99 : }
100 :
101 0 : double PageSizeGetAccessor::spatium() const
102 : {
103 0 : return m_style.styleD(Sid::spatium);
104 : }
105 :
106 0 : PageSizeSetAccessor::PageSizeSetAccessor(MStyle& style)
107 0 : : m_style(style)
108 : {
109 0 : }
110 :
111 0 : double PageSizeSetAccessor::width() const
112 : {
113 0 : return m_style.styleD(Sid::pageWidth);
114 : }
115 :
116 0 : double PageSizeSetAccessor::height() const
117 : {
118 0 : return m_style.styleD(Sid::pageHeight);
119 : }
120 :
121 0 : double PageSizeSetAccessor::printableWidth() const
122 : {
123 0 : return m_style.styleD(Sid::pagePrintableWidth);
124 : }
125 :
126 0 : double PageSizeSetAccessor::evenTopMargin() const
127 : {
128 0 : return m_style.styleD(Sid::pageEvenTopMargin);
129 : }
130 :
131 0 : double PageSizeSetAccessor::evenBottomMargin() const
132 : {
133 0 : return m_style.styleD(Sid::pageEvenBottomMargin);
134 : }
135 :
136 0 : double PageSizeSetAccessor::evenLeftMargin() const
137 : {
138 0 : return m_style.styleD(Sid::pageEvenLeftMargin);
139 : }
140 :
141 0 : double PageSizeSetAccessor::oddTopMargin() const
142 : {
143 0 : return m_style.styleD(Sid::pageOddTopMargin);
144 : }
145 :
146 0 : double PageSizeSetAccessor::oddBottomMargin() const
147 : {
148 0 : return m_style.styleD(Sid::pageOddBottomMargin);
149 : }
150 :
151 0 : double PageSizeSetAccessor::oddLeftMargin() const
152 : {
153 0 : return m_style.styleD(Sid::pageOddLeftMargin);
154 : }
155 :
156 0 : double PageSizeSetAccessor::twosided() const
157 : {
158 0 : return m_style.styleD(Sid::pageTwosided);
159 : }
160 :
161 0 : double PageSizeSetAccessor::spatium() const
162 : {
163 0 : return m_style.styleD(Sid::spatium);
164 : }
165 :
166 0 : void PageSizeSetAccessor::setWidth(double v)
167 : {
168 0 : m_style.set(Sid::pageWidth, v);
169 0 : }
170 :
171 0 : void PageSizeSetAccessor::setHeight(double v)
172 : {
173 0 : m_style.set(Sid::pageHeight, v);
174 0 : }
175 :
176 0 : void PageSizeSetAccessor::setPrintableWidth(double v)
177 : {
178 0 : m_style.set(Sid::pagePrintableWidth, v);
179 0 : }
180 :
181 0 : void PageSizeSetAccessor::setEvenTopMargin(double v)
182 : {
183 0 : m_style.set(Sid::pageEvenTopMargin, v);
184 0 : }
185 :
186 0 : void PageSizeSetAccessor::setEvenBottomMargin(double v)
187 : {
188 0 : m_style.set(Sid::pageEvenBottomMargin, v);
189 0 : }
190 :
191 0 : void PageSizeSetAccessor::setEvenLeftMargin(double v)
192 : {
193 0 : m_style.set(Sid::pageEvenLeftMargin, v);
194 0 : }
195 :
196 0 : void PageSizeSetAccessor::setOddTopMargin(double v)
197 : {
198 0 : m_style.set(Sid::pageOddTopMargin, v);
199 0 : }
200 :
201 0 : void PageSizeSetAccessor::setOddBottomMargin(double v)
202 : {
203 0 : m_style.set(Sid::pageOddBottomMargin, v);
204 0 : }
205 :
206 0 : void PageSizeSetAccessor::setOddLeftMargin(double v)
207 : {
208 0 : m_style.set(Sid::pageOddLeftMargin, v);
209 0 : }
210 :
211 0 : void PageSizeSetAccessor::setTwosided(double v)
212 : {
213 0 : m_style.set(Sid::pageTwosided, v);
214 0 : }
215 :
216 0 : void PageSizeSetAccessor::setSpatium(double v)
217 : {
218 0 : m_style.set(Sid::spatium, v);
219 0 : }
220 : }
|