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) 2025 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 :
23 : #include "editproperty.h"
24 :
25 : #include "../dom/bracketitem.h"
26 : #include "../dom/score.h"
27 : #include "../dom/staff.h"
28 : #include "../dom/textline.h"
29 :
30 : #include "log.h"
31 : #define LOG_UNDO() if (0) LOGD()
32 :
33 : using namespace mu::engraving;
34 :
35 : //---------------------------------------------------------
36 : // ChangeProperty::flip
37 : //---------------------------------------------------------
38 :
39 3887 : void ChangeProperty::flip()
40 : {
41 : LOG_UNDO() << element->typeName() << int(id) << "(" << propertyName(id) << ")" << element->getProperty(id) << "->" << property;
42 :
43 3887 : PropertyValue v = element->getProperty(id);
44 3887 : PropertyFlags ps = element->propertyFlags(id);
45 :
46 3887 : element->setProperty(id, property);
47 3887 : element->setPropertyFlags(id, flags);
48 :
49 3887 : property = v;
50 3887 : flags = ps;
51 3887 : }
52 :
53 2307 : std::vector<EngravingObject*> ChangeProperty::objectItems() const
54 : {
55 2307 : return compoundObjects(element);
56 : }
57 :
58 : //---------------------------------------------------------
59 : // ChangeBracketProperty::flip
60 : //---------------------------------------------------------
61 :
62 3 : void ChangeBracketProperty::flip()
63 : {
64 3 : if (!staff) {
65 0 : return;
66 : }
67 :
68 3 : element = staff->score()->brackets(staff->idx())[level];
69 3 : ChangeProperty::flip();
70 3 : level = toBracketItem(element)->column();
71 : }
72 :
73 : //---------------------------------------------------------
74 : // ChangeTextLineProperty::flip
75 : //---------------------------------------------------------
76 :
77 0 : void ChangeTextLineProperty::flip()
78 : {
79 0 : ChangeProperty::flip();
80 0 : if (element->isTextLine()) {
81 0 : toTextLine(element)->initStyle();
82 : }
83 0 : }
|