annotate view/PaneStack.h @ 473:4f4f943bfdfc

* Merge from one-fftdataserver-per-fftmodel branch. This bit of reworking (which is not described very accurately by the title of the branch) turns the MatrixFile object into something that either reads or writes, but not both, and separates the FFT file cache reader and writer implementations separately. This allows the FFT data server to have a single thread owning writers and one reader per "customer" thread, and for all locking to be vastly simplified and concentrated in the data server alone (because none of the classes it makes use of is used in more than one thread at a time). The result is faster and more trustworthy code.
author Chris Cannam
date Tue, 27 Jan 2009 13:25:10 +0000
parents 6167a28d25fc
children 92b89764eb3b
rev   line source
Chris@127 1
Chris@127 2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@127 3
Chris@127 4 /*
Chris@127 5 Sonic Visualiser
Chris@127 6 An audio file viewer and annotation editor.
Chris@127 7 Centre for Digital Music, Queen Mary, University of London.
Chris@182 8 This file copyright 2006 Chris Cannam and QMUL.
Chris@127 9
Chris@127 10 This program is free software; you can redistribute it and/or
Chris@127 11 modify it under the terms of the GNU General Public License as
Chris@127 12 published by the Free Software Foundation; either version 2 of the
Chris@127 13 License, or (at your option) any later version. See the file
Chris@127 14 COPYING included with this distribution for more information.
Chris@127 15 */
Chris@127 16
Chris@127 17 #ifndef _PANESTACK_H_
Chris@127 18 #define _PANESTACK_H_
Chris@127 19
Chris@127 20 #include <QFrame>
Chris@127 21
Chris@323 22 #include <map>
Chris@323 23
Chris@127 24 class QWidget;
Chris@127 25 class QLabel;
Chris@127 26 class QStackedWidget;
Chris@127 27 class QSplitter;
Chris@127 28 class QHBoxLayout;
Chris@127 29 class View;
Chris@127 30 class Pane;
Chris@127 31 class Layer;
Chris@127 32 class ViewManager;
Chris@127 33 class PropertyContainer;
Chris@127 34 class PropertyStack;
Chris@127 35
Chris@127 36 class PaneStack : public QFrame
Chris@127 37 {
Chris@127 38 Q_OBJECT
Chris@127 39
Chris@127 40 public:
Chris@127 41 PaneStack(QWidget *parent, ViewManager *viewManager);
Chris@127 42
Chris@127 43 Pane *addPane(bool suppressPropertyBox = false); // I own the returned value
Chris@127 44 void deletePane(Pane *pane); // Deletes the pane, but _not_ its layers
Chris@127 45
Chris@127 46 int getPaneCount() const; // Returns only count of visible panes
Chris@127 47 Pane *getPane(int n); // Of visible panes; I own the returned value
Chris@277 48 int getPaneIndex(Pane *pane); // so getPane(index)==pane; -1 if absent
Chris@127 49
Chris@127 50 void hidePane(Pane *pane); // Also removes pane from getPane/getPaneCount
Chris@127 51 void showPane(Pane *pane); // Returns pane to getPane/getPaneCount
Chris@127 52
Chris@127 53 int getHiddenPaneCount() const;
Chris@127 54 Pane *getHiddenPane(int n); // I own the returned value
Chris@127 55
Chris@127 56 void setCurrentPane(Pane *pane);
Chris@127 57 void setCurrentLayer(Pane *pane, Layer *layer);
Chris@127 58 Pane *getCurrentPane();
Chris@127 59
Chris@127 60 enum LayoutStyle {
Chris@179 61 NoPropertyStacks = 0,
Chris@127 62 SinglePropertyStackLayout = 1,
Chris@127 63 PropertyStackPerPaneLayout = 2
Chris@127 64 };
Chris@127 65
Chris@127 66 LayoutStyle getLayoutStyle() const { return m_layoutStyle; }
Chris@127 67 void setLayoutStyle(LayoutStyle style);
Chris@127 68
Chris@235 69 void setPropertyStackMinWidth(int mw);
Chris@235 70
Chris@320 71 void sizePanesEqually();
Chris@320 72
Chris@127 73 signals:
Chris@127 74 void currentPaneChanged(Pane *pane);
Chris@127 75 void currentLayerChanged(Pane *pane, Layer *layer);
Chris@127 76 void rightButtonMenuRequested(Pane *pane, QPoint position);
Chris@363 77 void propertyStacksResized(int width);
Chris@180 78 void propertyStacksResized();
Chris@189 79 void contextHelpChanged(const QString &);
Chris@127 80
Chris@271 81 void paneAdded(Pane *pane);
Chris@271 82 void paneAdded();
Chris@319 83 void paneHidden(Pane *pane);
Chris@319 84 void paneHidden();
Chris@271 85 void paneAboutToBeDeleted(Pane *pane);
Chris@271 86 void paneDeleted();
Chris@271 87
Chris@312 88 void dropAccepted(Pane *pane, QStringList uriList);
Chris@312 89 void dropAccepted(Pane *pane, QString text);
Chris@312 90
Chris@323 91 void paneDeleteButtonClicked(Pane *pane);
Chris@323 92
Chris@127 93 public slots:
Chris@127 94 void propertyContainerAdded(PropertyContainer *);
Chris@127 95 void propertyContainerRemoved(PropertyContainer *);
Chris@127 96 void propertyContainerSelected(View *client, PropertyContainer *);
Chris@190 97 void viewSelected(View *v);
Chris@127 98 void paneInteractedWith();
Chris@127 99 void rightButtonMenuRequested(QPoint);
Chris@312 100 void paneDropAccepted(QStringList);
Chris@312 101 void paneDropAccepted(QString);
Chris@323 102 void paneDeleteButtonClicked();
Chris@127 103
Chris@127 104 protected:
Chris@127 105 Pane *m_currentPane;
Chris@127 106
Chris@127 107 struct PaneRec
Chris@127 108 {
Chris@127 109 Pane *pane;
Chris@127 110 QWidget *propertyStack;
Chris@127 111 QLabel *currentIndicator;
Chris@127 112 QFrame *frame;
Chris@127 113 QHBoxLayout *layout;
Chris@127 114 };
Chris@127 115
Chris@127 116 std::vector<PaneRec> m_panes;
Chris@127 117 std::vector<PaneRec> m_hiddenPanes;
Chris@127 118
Chris@323 119 std::map<QWidget *, Pane *> m_xButtonMap;
Chris@323 120
Chris@127 121 QSplitter *m_splitter;
Chris@127 122 QStackedWidget *m_propertyStackStack;
Chris@127 123
Chris@127 124 ViewManager *m_viewManager; // I don't own this
Chris@235 125 int m_propertyStackMinWidth;
Chris@127 126 void sizePropertyStacks();
Chris@127 127
Chris@127 128 LayoutStyle m_layoutStyle;
Chris@127 129 };
Chris@127 130
Chris@127 131 #endif
Chris@127 132