Chris@127
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@127
|
2
|
Chris@127
|
3 /*
|
Chris@127
|
4 Sonic Visualiser
|
Chris@127
|
5 An audio file viewer and annotation editor.
|
Chris@127
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@182
|
7 This file copyright 2006 Chris Cannam and QMUL.
|
Chris@127
|
8
|
Chris@127
|
9 This program is free software; you can redistribute it and/or
|
Chris@127
|
10 modify it under the terms of the GNU General Public License as
|
Chris@127
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@127
|
12 License, or (at your option) any later version. See the file
|
Chris@127
|
13 COPYING included with this distribution for more information.
|
Chris@127
|
14 */
|
Chris@127
|
15
|
Chris@127
|
16 #ifndef _PANESTACK_H_
|
Chris@127
|
17 #define _PANESTACK_H_
|
Chris@127
|
18
|
Chris@127
|
19 #include <QFrame>
|
Chris@127
|
20
|
Chris@323
|
21 #include <map>
|
Chris@323
|
22
|
Chris@908
|
23 #include "base/BaseTypes.h"
|
Chris@908
|
24
|
Chris@127
|
25 class QWidget;
|
Chris@127
|
26 class QLabel;
|
Chris@127
|
27 class QStackedWidget;
|
Chris@127
|
28 class QSplitter;
|
Chris@495
|
29 class QGridLayout;
|
Chris@605
|
30 class QPushButton;
|
Chris@127
|
31 class View;
|
Chris@127
|
32 class Pane;
|
Chris@127
|
33 class Layer;
|
Chris@127
|
34 class ViewManager;
|
Chris@127
|
35 class PropertyContainer;
|
Chris@127
|
36 class PropertyStack;
|
Chris@127
|
37
|
Chris@127
|
38 class PaneStack : public QFrame
|
Chris@127
|
39 {
|
Chris@127
|
40 Q_OBJECT
|
Chris@127
|
41
|
Chris@127
|
42 public:
|
Chris@127
|
43 PaneStack(QWidget *parent, ViewManager *viewManager);
|
Chris@127
|
44
|
Chris@127
|
45 Pane *addPane(bool suppressPropertyBox = false); // I own the returned value
|
Chris@539
|
46 Pane *insertPane(int index, bool suppressPropertyBox = false); // I own the returned value
|
Chris@127
|
47 void deletePane(Pane *pane); // Deletes the pane, but _not_ its layers
|
Chris@127
|
48
|
Chris@127
|
49 int getPaneCount() const; // Returns only count of visible panes
|
Chris@127
|
50 Pane *getPane(int n); // Of visible panes; I own the returned value
|
Chris@277
|
51 int getPaneIndex(Pane *pane); // so getPane(index)==pane; -1 if absent
|
Chris@127
|
52
|
Chris@127
|
53 void hidePane(Pane *pane); // Also removes pane from getPane/getPaneCount
|
Chris@127
|
54 void showPane(Pane *pane); // Returns pane to getPane/getPaneCount
|
Chris@127
|
55
|
Chris@127
|
56 int getHiddenPaneCount() const;
|
Chris@127
|
57 Pane *getHiddenPane(int n); // I own the returned value
|
Chris@127
|
58
|
Chris@127
|
59 void setCurrentPane(Pane *pane);
|
Chris@127
|
60 void setCurrentLayer(Pane *pane, Layer *layer);
|
Chris@127
|
61 Pane *getCurrentPane();
|
Chris@127
|
62
|
Chris@127
|
63 enum LayoutStyle {
|
Chris@179
|
64 NoPropertyStacks = 0,
|
Chris@127
|
65 SinglePropertyStackLayout = 1,
|
Chris@127
|
66 PropertyStackPerPaneLayout = 2
|
Chris@127
|
67 };
|
Chris@127
|
68
|
Chris@127
|
69 LayoutStyle getLayoutStyle() const { return m_layoutStyle; }
|
Chris@127
|
70 void setLayoutStyle(LayoutStyle style);
|
Chris@127
|
71
|
Chris@235
|
72 void setPropertyStackMinWidth(int mw);
|
Chris@712
|
73
|
Chris@712
|
74 void setShowPaneAccessories(bool show); // current indicator, close button
|
Chris@235
|
75
|
Chris@320
|
76 void sizePanesEqually();
|
Chris@320
|
77
|
Chris@127
|
78 signals:
|
Chris@127
|
79 void currentPaneChanged(Pane *pane);
|
Chris@127
|
80 void currentLayerChanged(Pane *pane, Layer *layer);
|
Chris@127
|
81 void rightButtonMenuRequested(Pane *pane, QPoint position);
|
Chris@363
|
82 void propertyStacksResized(int width);
|
Chris@180
|
83 void propertyStacksResized();
|
Chris@189
|
84 void contextHelpChanged(const QString &);
|
Chris@127
|
85
|
Chris@271
|
86 void paneAdded(Pane *pane);
|
Chris@271
|
87 void paneAdded();
|
Chris@319
|
88 void paneHidden(Pane *pane);
|
Chris@319
|
89 void paneHidden();
|
Chris@271
|
90 void paneAboutToBeDeleted(Pane *pane);
|
Chris@271
|
91 void paneDeleted();
|
Chris@271
|
92
|
Chris@312
|
93 void dropAccepted(Pane *pane, QStringList uriList);
|
Chris@312
|
94 void dropAccepted(Pane *pane, QString text);
|
Chris@312
|
95
|
Chris@323
|
96 void paneDeleteButtonClicked(Pane *pane);
|
Chris@323
|
97
|
Chris@908
|
98 void doubleClickSelectInvoked(sv_frame_t frame);
|
Chris@716
|
99
|
Chris@127
|
100 public slots:
|
Chris@127
|
101 void propertyContainerAdded(PropertyContainer *);
|
Chris@127
|
102 void propertyContainerRemoved(PropertyContainer *);
|
Chris@127
|
103 void propertyContainerSelected(View *client, PropertyContainer *);
|
Chris@190
|
104 void viewSelected(View *v);
|
Chris@127
|
105 void paneInteractedWith();
|
Chris@127
|
106 void rightButtonMenuRequested(QPoint);
|
Chris@312
|
107 void paneDropAccepted(QStringList);
|
Chris@312
|
108 void paneDropAccepted(QString);
|
Chris@323
|
109 void paneDeleteButtonClicked();
|
Chris@500
|
110 void indicatorClicked();
|
Chris@127
|
111
|
Chris@127
|
112 protected:
|
Chris@127
|
113 Pane *m_currentPane;
|
Chris@127
|
114
|
Chris@127
|
115 struct PaneRec
|
Chris@127
|
116 {
|
Chris@127
|
117 Pane *pane;
|
Chris@127
|
118 QWidget *propertyStack;
|
Chris@605
|
119 QPushButton *xButton;
|
Chris@127
|
120 QLabel *currentIndicator;
|
Chris@127
|
121 QFrame *frame;
|
Chris@495
|
122 QGridLayout *layout;
|
Chris@127
|
123 };
|
Chris@127
|
124
|
Chris@127
|
125 std::vector<PaneRec> m_panes;
|
Chris@127
|
126 std::vector<PaneRec> m_hiddenPanes;
|
Chris@127
|
127
|
Chris@712
|
128 bool m_showAccessories;
|
Chris@712
|
129
|
Chris@127
|
130 QSplitter *m_splitter;
|
Chris@127
|
131 QStackedWidget *m_propertyStackStack;
|
Chris@127
|
132
|
Chris@127
|
133 ViewManager *m_viewManager; // I don't own this
|
Chris@235
|
134 int m_propertyStackMinWidth;
|
Chris@127
|
135 void sizePropertyStacks();
|
Chris@127
|
136
|
Chris@605
|
137 void showOrHidePaneAccessories();
|
Chris@605
|
138
|
Chris@127
|
139 LayoutStyle m_layoutStyle;
|
Chris@127
|
140 };
|
Chris@127
|
141
|
Chris@127
|
142 #endif
|
Chris@127
|
143
|