MuseScore  3.4
Music composition and notation
scoretab.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Linux Music Score Editor
4 //
5 // Copyright (C) 2009 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 __SCORETAB_H__
21 #define __SCORETAB_H__
22 
23 namespace Ms {
24 
25 class MuseScore;
26 class ScoreView;
27 class Score;
28 enum class MagIdx : char;
29 
30 //---------------------------------------------------------
31 // TabScoreView
32 //---------------------------------------------------------
33 
34 struct TabScoreView {
36  int part;
38  score = s;
39  part = 0;
40  }
41  };
42 
43 //---------------------------------------------------------
44 // ScoreTab
45 //---------------------------------------------------------
46 
47 class ScoreTab : public QWidget {
48  Q_OBJECT
49  QList<MasterScore*>* scoreList;
50  QTabBar* tab; // list of scores
51  QTabBar* tab2; // list of excerpts for current score
52  QStackedLayout* stack;
54  void clearTab2();
55  TabScoreView* tabScoreView(int idx) { return static_cast<TabScoreView*>(tab->tabData(idx).value<void*>()); }
56  const TabScoreView* tabScoreView(int idx) const { return const_cast<ScoreTab*>(this)->tabScoreView(idx); }
57 
58  signals:
59  void currentScoreViewChanged(ScoreView*);
60  void tabCloseRequested(int);
61  void actionTriggered(QAction*);
62  void tabInserted(int);
63  void tabRemoved(int);
64  void tabRenamed(int);
65 
66  private slots:
67  void setCurrent(int);
68 
69  public slots:
70  void updateExcerpts();
71  void setExcerpt(int);
72  void tabMoved(int, int);
73 
74  public:
75  ScoreTab(QList<MasterScore*>*, QWidget* parent = 0);
76  ~ScoreTab();
77 
78  QTabBar* getTab() const { return tab; }
79 
80  void insertTab(MasterScore*);
81  void setTabText(int, const QString&);
82  int currentIndex() const;
83  void setCurrentIndex(int);
84  bool setCurrentScore(Score* s);
85  void removeTab(int, bool noCurrentChangedSignal = false);
86  int count() const { return scoreList->size(); }
87  ScoreView* view(int) const;
88  QSplitter* viewSplitter(int n) const;
89  ScoreView* view() const { return view(currentIndex()); }
90  bool contains(ScoreView*) const;
91  void initScoreView(int idx, double mag, MagIdx magIdx, double xoffset, double yoffset);
92  };
93 
94 
95 } // namespace Ms
96 #endif
97 
MuseScore * mainWindow
Definition: scoretab.h:53
Definition: musescore.h:180
QTabBar * tab
Definition: scoretab.h:50
Definition: score.h:1227
Definition: scoreview.h:90
int part
Definition: scoretab.h:36
MasterScore * score
Definition: scoretab.h:35
Definition: scoretab.h:47
Definition: score.h:391
const TabScoreView * tabScoreView(int idx) const
Definition: scoretab.h:56
Definition: scoretab.h:34
MagIdx
Definition: magbox.h:32
QTabBar * getTab() const
Definition: scoretab.h:78
Definition: aeolus.cpp:26
QList< MasterScore * > * scoreList
Definition: scoretab.h:49
ScoreView * view() const
Definition: scoretab.h:89
TabScoreView(MasterScore *s)
Definition: scoretab.h:37
TabScoreView * tabScoreView(int idx)
Definition: scoretab.h:55
int count() const
Definition: scoretab.h:86
QTabBar * tab2
Definition: scoretab.h:51
QStackedLayout * stack
Definition: scoretab.h:52