1 //============================================================================= 2 // MusE Score 3 // Linux Music Score Editor 4 // 5 // Copyright (C) 2002-2010 Werner Schweer 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 __EDITSTYLE_H__ 21 #define __EDITSTYLE_H__ 22 23 #include "ui_editstyle.h" 24 #include "abstractdialog.h" 25 #include "globals.h" 26 #include "libmscore/mscore.h" 27 #include "libmscore/style.h" 28 29 class QScrollArea; 30 31 namespace Ms { 32 33 class Score; 34 class EditStyle; 35 36 //--------------------------------------------------------- 37 // StyleWidget 38 //--------------------------------------------------------- 39 40 struct StyleWidget { 41 Sid idx; 42 bool showPercent; 43 QObject* widget; 44 QToolButton* reset; 45 }; 46 47 //--------------------------------------------------------- 48 // EditStylePage 49 /// This is a type for a pointer to any QWidget that is a member of EditStyle. 50 /// It's used to create static references to the pointers to pages. 51 //--------------------------------------------------------- 52 53 typedef QWidget* EditStyle::* EditStylePage; 54 55 //--------------------------------------------------------- 56 // EditStyle 57 //--------------------------------------------------------- 58 59 class EditStyle : public AbstractDialog, private Ui::EditStyleBase { 60 Q_OBJECT 61 62 Score* cs = nullptr; 63 QPushButton* buttonApplyToAllParts = nullptr; 64 QVector<StyleWidget> styleWidgets; 65 QScrollArea* scrollArea = nullptr; 66 bool isTooBig = false; 67 bool hasShown = false; 68 bool needResetStyle = false; 69 70 virtual void showEvent(QShowEvent*); 71 virtual void hideEvent(QHideEvent*); 72 QVariant getValue(Sid idx); 73 void setValues(); 74 75 void resetStyle(Score* score); 76 void applyToAllParts(); 77 const StyleWidget& styleWidget(Sid) const; 78 79 void adjustPagesStackSize(int currentPageIndex); 80 void setHeaderFooterToolTip(); 81 82 static EditStylePage pageForElement(Element*); 83 84 private slots: 85 void selectChordDescriptionFile(); 86 void setChordStyle(bool); 87 void enableStyleWidget(const Sid idx, bool enable); 88 void enableVerticalSpreadClicked(bool); 89 void disableVerticalSpreadClicked(bool); 90 void toggleHeaderOddEven(bool); 91 void toggleFooterOddEven(bool); 92 void buttonClicked(QAbstractButton*); 93 void setSwingParams(bool); 94 void concertPitchToggled(bool); 95 void lyricsDashMinLengthValueChanged(double); 96 void lyricsDashMaxLengthValueChanged(double); 97 void systemMinDistanceValueChanged(double); 98 void systemMaxDistanceValueChanged(double); 99 void resetStyleValue(int); 100 void valueChanged(int); 101 void textStyleChanged(int); 102 void resetTextStyle(Pid); 103 void textStyleValueChanged(Pid, QVariant); 104 void on_comboFBFont_currentIndexChanged(int index); 105 void on_buttonTogglePagelist_clicked(); 106 void on_resetStylesButton_clicked(); 107 void editUserStyleName(); 108 void endEditUserStyleName(); 109 void resetUserStyleName(); 110 111 protected: 112 void retranslate(); 113 114 public: 115 EditStyle(Score*, QWidget*); 116 void setPage(int no); setScore(Score * s)117 void setScore(Score* s) { cs = s; } 118 119 void gotoElement(Element* e); 120 void gotoHeaderFooterPage(); 121 static bool elementHasPage(Element* e); 122 123 public slots: 124 void accept(); 125 void reject(); 126 }; 127 128 } // namespace Ms 129 #endif 130