1 //=============================================================================
2 //  MuseScore
3 //  Music Composition & Notation
4 //
5 //  Copyright (C) 2019 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 #ifndef __PALETTECELLDIALOGS_H__
21 #define __PALETTECELLDIALOGS_H__
22 
23 namespace Ui {
24       class PaletteCellProperties;
25 }
26 
27 namespace Ms {
28       struct PaletteCell;
29 
30 //---------------------------------------------------------
31 //   PaletteCellProperties
32 //---------------------------------------------------------
33 
34 class PaletteCellPropertiesDialog : public QDialog {
35       Q_OBJECT
36 
37       Ui::PaletteCellProperties* ui;
38       PaletteCell* cell;
39 
40       virtual void hideEvent(QHideEvent*);
41       virtual void reject();
42 
43       void applyInitialPropertiesToThePalette();
44       bool areInitialPropertiesChanged() const;
45       void fillControlsWithData();
46       void setInitialProperties();
47 
48       bool isDrawStaffCheckBoxChanged = false;
49       bool isNameChanged = false;
50       bool isXOffsetChanged = false;
51       bool isYOffsetChanged = false;
52       bool isScaleChanged = false;
53 
54       int drawStaffCheckboxInitialState = 0;
55       QString initialName;
56       QString initialTranslatedName;
57       double initialXOffset = 0.f;
58       double initialYOffset = 0.f;
59       double initialScale = 0.f;
60       bool initialCustomState = false;
61 
62 public:
63       PaletteCellPropertiesDialog(PaletteCell* p, QWidget* parent = 0);
64       ~PaletteCellPropertiesDialog();
65 
66       void drawStaffCheckBoxChanged(int state);
67       void nameChanged(const QString &text);
68       void xOffsetChanged(double xOffset);
69       void yOffsetChanged(double yOffset);
70       void scaleChanged(double scale);
71 
72 signals:
73       void changed();
74 };
75 
76 } // namespace Ms
77 
78 #endif //__PALETTECELLDIALOGS_H__
79