summaryrefslogtreecommitdiff
path: root/muse_qt4_evolution/muse/arranger.h
blob: 1c9f6e389f0863f005c04ffd768c1ee3ef1a0c93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
//=============================================================================
//  MusE
//  Linux Music Editor
//  $Id:$
//
//  Copyright (C) 2002-2006 by Werner Schweer and others
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License version 2.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================

#ifndef __ARRANGER_H__
#define __ARRANGER_H__

#include "widgets/tools.h"
#include "track.h"

namespace AL {
      class Xml;
      class Pos;
      };
using AL::Xml;
class AL::Pos;

class Track;
class TrackInfo;
class TLWidget;
class TLSWidget;
class PartCanvas;
class Part;
class SimpleButton;
class Strip;
class ArrangerTrack;
class Splitter;
class TlsvLayout;
class TLayout;

//---------------------------------------------------------
//   InfoStack
//---------------------------------------------------------

class InfoStack : public QStackedWidget {
      Q_OBJECT;

      virtual QSize sizeHint() const;

   public:
      InfoStack() : QStackedWidget() {}
      };

//---------------------------------------------------------
//   TrackListWidget
//---------------------------------------------------------

class TrackListWidget : public QWidget {
      Q_OBJECT

      void mousePressEvent(QMouseEvent*);
      void wheelEvent(QWheelEvent*);
      virtual void paintEvent(QPaintEvent*);

   signals:
      void mouseWheel(QWheelEvent*);

   public:
      TrackListWidget(QWidget* parent = 0);
      };

//---------------------------------------------------------
//   Arranger
//---------------------------------------------------------

class Arranger : public QWidget {
      Q_OBJECT

      QAction* infoDockAction;
      QAction* mixerDockAction;

      TrackInfo* trackInfos[Track::TRACK_TYPES];
      QWidget* zeroTrackInfo;
      Tool tool;
      QWidget* trackList;
      PartCanvas* canvas;
      TLayout* tl;               // tracklist layout
      TrackListWidget* tlsv;
      TlsvLayout* tlsvLayout;
      QDialog* configTrackEditor;
      QStackedWidget* trackInfo;
      QScrollArea* infoView;
      Track* _curTrack;             // current selected track
      SimpleButton* gmute;
      SimpleButton* gsolo;
      SimpleButton* gar;
      SimpleButton* gaw;
      Strip* strip;
      QStackedWidget* info;

      Splitter* split;
      QDockWidget* infoDock;
      QDockWidget* mixerDock;

      int startH;    // start value for resize track height

      bool trackInfoVisible;
      bool mixerStripVisible;

      void updateIndex();
      TrackInfo* createTrackInfo();
      int tlIndex(Track*) const;
      int tlIndex(ArrangerTrack* t) const;
      bool initSubtrack(Track* t, ArrangerTrack*);
      ArrangerTrack* atrack(int idx);
      void insertTrack1(Track*);

   private slots:
      void startDrag(int idx);
      void drag(int idx, int);
      void setTLViewPos(int, int);
      void appendSubtrack(TLWidget*);
      void removeSubtrack(TLSWidget*);
      void configTrackList();
      void toggleTrackInfo(bool);
      void toggleMixerStrip(bool);
      void setGMute();
      void setGSolo();
      void setGar();
      void setGaw();
      void offGMute();
      void offGSolo();
      void offGar();
      void offGaw();
      void setSelectedTrack(Track*);
      void moveTrack(Track* src, Track* dst);
      void kbdMovementUpdate(Track* t, Part* p);
      void mouseWheel(QWheelEvent*);
      void setPos(int, const AL::Pos&);
      void addMarker(const AL::Pos&);
      void removeMarker(const AL::Pos&);

   public slots:
      void insertTrack(Track*);
      void removeTrack(Track*);
      void setTool(int t);
      void updateConfiguration();
      void startLoadSong();

   signals:
      void configChanged();
      void toolChanged(int);
      void editPart(Part*);
      void cursorPos(const AL::Pos&,bool);

   public:
      Arranger(QMainWindow* parent = 0);
      void readStatus(QDomNode);
      void writeStatus(Xml&);
      Track* curTrack() const { return _curTrack; }
      void endLoadSong();
      Strip* getStrip() const { return strip;  }

   protected:
      virtual void keyPressEvent(QKeyEvent* e);
      };

#endif