1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2020 MuseScore BVBA and others
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19
20 #include "score.h"
21 #include "measurenumber.h"
22 #include "measure.h"
23
24 namespace Ms {
25
26 //---------------------------------------------------------
27 // measureNumberStyle
28 //---------------------------------------------------------
29
30 static const ElementStyle measureNumberStyle {
31 { Sid::measureNumberVPlacement, Pid::PLACEMENT },
32 { Sid::measureNumberHPlacement, Pid::HPLACEMENT },
33 };
34
35 //---------------------------------------------------------
36 // MeasureNumber
37 //---------------------------------------------------------
38
MeasureNumber(Score * s,Tid tid)39 MeasureNumber::MeasureNumber(Score* s, Tid tid)
40 : MeasureNumberBase(s, tid)
41 {
42 initElementStyle(&measureNumberStyle);
43
44 setHPlacement(score()->styleV(Sid::measureNumberHPlacement).value<HPlacement>());
45 }
46
47 //---------------------------------------------------------
48 // MeasureNumber
49 // Copy constructor
50 //---------------------------------------------------------
51
MeasureNumber(const MeasureNumber & other)52 MeasureNumber::MeasureNumber(const MeasureNumber& other): MeasureNumberBase(other)
53 {
54 initElementStyle(&measureNumberStyle);
55 }
56
57 //---------------------------------------------------------
58 // propertyDefault
59 //---------------------------------------------------------
60
propertyDefault(Pid id) const61 QVariant MeasureNumber::propertyDefault(Pid id) const
62 {
63 switch(id) {
64 case Pid::SUB_STYLE:
65 return int(Tid::MEASURE_NUMBER);
66 case Pid::PLACEMENT:
67 return score()->styleV(Sid::measureNumberVPlacement);
68 case Pid::HPLACEMENT:
69 return score()->styleV(Sid::measureNumberHPlacement);
70 default:
71 return MeasureNumberBase::propertyDefault(id);
72 }
73 }
74
75 } // namespace MS
76