annotate view/PaneStack.h @ 277:8acd30ed735c

* Fix up and simplify the LayerTreeModel, removing a horrible memory leak * Move phase-unwrapped frequency estimation from SpectrogramLayer to FFTDataServer * Make the spectrum show peak phase-unwrapped frequencies as well (still needs work) * Start adding piano keyboard horizontal scale to spectrum * Debug output for id3 tags
author Chris Cannam
date Tue, 03 Jul 2007 12:46:18 +0000
parents 1a49bd0d8375
children 6de6f78b13a1
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@127 22 class QWidget;
Chris@127 23 class QLabel;
Chris@127 24 class QStackedWidget;
Chris@127 25 class QSplitter;
Chris@127 26 class QHBoxLayout;
Chris@127 27 class View;
Chris@127 28 class Pane;
Chris@127 29 class Layer;
Chris@127 30 class ViewManager;
Chris@127 31 class PropertyContainer;
Chris@127 32 class PropertyStack;
Chris@127 33
Chris@127 34 class PaneStack : public QFrame
Chris@127 35 {
Chris@127 36 Q_OBJECT
Chris@127 37
Chris@127 38 public:
Chris@127 39 PaneStack(QWidget *parent, ViewManager *viewManager);
Chris@127 40
Chris@127 41 Pane *addPane(bool suppressPropertyBox = false); // I own the returned value
Chris@127 42 void deletePane(Pane *pane); // Deletes the pane, but _not_ its layers
Chris@127 43
Chris@127 44 int getPaneCount() const; // Returns only count of visible panes
Chris@127 45 Pane *getPane(int n); // Of visible panes; I own the returned value
Chris@277 46 int getPaneIndex(Pane *pane); // so getPane(index)==pane; -1 if absent
Chris@127 47
Chris@127 48 void hidePane(Pane *pane); // Also removes pane from getPane/getPaneCount
Chris@127 49 void showPane(Pane *pane); // Returns pane to getPane/getPaneCount
Chris@127 50
Chris@127 51 int getHiddenPaneCount() const;
Chris@127 52 Pane *getHiddenPane(int n); // I own the returned value
Chris@127 53
Chris@127 54 void setCurrentPane(Pane *pane);
Chris@127 55 void setCurrentLayer(Pane *pane, Layer *layer);
Chris@127 56 Pane *getCurrentPane();
Chris@127 57
Chris@127 58 enum LayoutStyle {
Chris@179 59 NoPropertyStacks = 0,
Chris@127 60 SinglePropertyStackLayout = 1,
Chris@127 61 PropertyStackPerPaneLayout = 2
Chris@127 62 };
Chris@127 63
Chris@127 64 LayoutStyle getLayoutStyle() const { return m_layoutStyle; }
Chris@127 65 void setLayoutStyle(LayoutStyle style);
Chris@127 66
Chris@235 67 void setPropertyStackMinWidth(int mw);
Chris@235 68
Chris@127 69 signals:
Chris@127 70 void currentPaneChanged(Pane *pane);
Chris@127 71 void currentLayerChanged(Pane *pane, Layer *layer);
Chris@127 72 void rightButtonMenuRequested(Pane *pane, QPoint position);
Chris@180 73 void propertyStacksResized();
Chris@189 74 void contextHelpChanged(const QString &);
Chris@127 75
Chris@271 76 void paneAdded(Pane *pane);
Chris@271 77 void paneAdded();
Chris@271 78 void paneAboutToBeDeleted(Pane *pane);
Chris@271 79 void paneDeleted();
Chris@271 80
Chris@127 81 public slots:
Chris@127 82 void propertyContainerAdded(PropertyContainer *);
Chris@127 83 void propertyContainerRemoved(PropertyContainer *);
Chris@127 84 void propertyContainerSelected(View *client, PropertyContainer *);
Chris@190 85 void viewSelected(View *v);
Chris@127 86 void paneInteractedWith();
Chris@127 87 void rightButtonMenuRequested(QPoint);
Chris@127 88
Chris@127 89 protected:
Chris@127 90 Pane *m_currentPane;
Chris@127 91
Chris@127 92 struct PaneRec
Chris@127 93 {
Chris@127 94 Pane *pane;
Chris@127 95 QWidget *propertyStack;
Chris@127 96 QLabel *currentIndicator;
Chris@127 97 QFrame *frame;
Chris@127 98 QHBoxLayout *layout;
Chris@127 99 };
Chris@127 100
Chris@127 101 std::vector<PaneRec> m_panes;
Chris@127 102 std::vector<PaneRec> m_hiddenPanes;
Chris@127 103
Chris@127 104 QSplitter *m_splitter;
Chris@127 105 QStackedWidget *m_propertyStackStack;
Chris@127 106
Chris@127 107 ViewManager *m_viewManager; // I don't own this
Chris@235 108 int m_propertyStackMinWidth;
Chris@127 109 void sizePropertyStacks();
Chris@127 110
Chris@127 111 LayoutStyle m_layoutStyle;
Chris@127 112 };
Chris@127 113
Chris@127 114 #endif
Chris@127 115