annotate widgets/Pane.h @ 66:e9eac9368e29

* basics of selectable vertical scale in time value layer * clear selection when closing session
author Chris Cannam
date Mon, 27 Mar 2006 16:44:12 +0000
parents 705f05ab42e3
children 803830f186ef
rev   line source
Chris@0 1
Chris@58 2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 3
Chris@0 4 /*
Chris@59 5 Sonic Visualiser
Chris@59 6 An audio file viewer and annotation editor.
Chris@59 7 Centre for Digital Music, Queen Mary, University of London.
Chris@59 8 This file copyright 2006 Chris Cannam.
Chris@0 9
Chris@59 10 This program is free software; you can redistribute it and/or
Chris@59 11 modify it under the terms of the GNU General Public License as
Chris@59 12 published by the Free Software Foundation; either version 2 of the
Chris@59 13 License, or (at your option) any later version. See the file
Chris@59 14 COPYING included with this distribution for more information.
Chris@0 15 */
Chris@0 16
Chris@0 17 #ifndef _PANE_H_
Chris@0 18 #define _PANE_H_
Chris@0 19
Chris@0 20 #include <QFrame>
Chris@0 21 #include <QPoint>
Chris@0 22
Chris@0 23 #include "base/ZoomConstraint.h"
Chris@0 24 #include "base/View.h"
Chris@13 25 #include "base/Selection.h"
Chris@0 26
Chris@0 27 class QWidget;
Chris@0 28 class QPaintEvent;
Chris@0 29 class Layer;
Chris@0 30
Chris@0 31 class Pane : public View
Chris@0 32 {
Chris@0 33 Q_OBJECT
Chris@0 34
Chris@0 35 public:
Chris@0 36 Pane(QWidget *parent = 0);
Chris@34 37 virtual QString getPropertyContainerIconName() const { return "pane"; }
Chris@0 38
Chris@44 39 virtual bool shouldIlluminateLocalFeatures(const Layer *layer,
Chris@44 40 QPoint &pos) const;
Chris@42 41 virtual bool shouldIlluminateLocalSelection(QPoint &pos,
Chris@42 42 bool &closeToLeft,
Chris@44 43 bool &closeToRight) const;
Chris@0 44
Chris@0 45 void setCentreLineVisible(bool visible);
Chris@0 46 bool getCentreLineVisible() const { return m_centreLineVisible; }
Chris@0 47
Chris@8 48 virtual QString toXmlString(QString indent = "",
Chris@8 49 QString extraAttributes = "") const;
Chris@8 50
Chris@0 51 signals:
Chris@0 52 void paneInteractedWith();
Chris@0 53
Chris@13 54 public slots:
Chris@13 55 virtual void toolModeChanged();
Chris@13 56
Chris@0 57 protected:
Chris@0 58 virtual void paintEvent(QPaintEvent *e);
Chris@0 59 virtual void mousePressEvent(QMouseEvent *e);
Chris@0 60 virtual void mouseReleaseEvent(QMouseEvent *e);
Chris@0 61 virtual void mouseMoveEvent(QMouseEvent *e);
Chris@0 62 virtual void mouseDoubleClickEvent(QMouseEvent *e);
Chris@0 63 virtual void leaveEvent(QEvent *e);
Chris@0 64 virtual void wheelEvent(QWheelEvent *e);
Chris@0 65
Chris@44 66 Selection getSelectionAt(int x, bool &closeToLeft, bool &closeToRight) const;
Chris@17 67
Chris@42 68 bool editSelectionStart(QMouseEvent *e);
Chris@42 69 bool editSelectionDrag(QMouseEvent *e);
Chris@42 70 bool editSelectionEnd(QMouseEvent *e);
Chris@42 71 bool selectionIsBeingEdited() const;
Chris@42 72
Chris@0 73 bool m_identifyFeatures;
Chris@0 74 QPoint m_identifyPoint;
Chris@0 75 QPoint m_clickPos;
Chris@0 76 QPoint m_mousePos;
Chris@0 77 bool m_clickedInRange;
Chris@0 78 bool m_shiftPressed;
Chris@13 79 bool m_ctrlPressed;
Chris@17 80 bool m_navigating;
Chris@17 81 bool m_resizing;
Chris@0 82 size_t m_dragCentreFrame;
Chris@0 83 bool m_centreLineVisible;
Chris@13 84 size_t m_selectionStartFrame;
Chris@42 85 Selection m_editingSelection;
Chris@42 86 int m_editingSelectionEdge;
Chris@0 87 };
Chris@0 88
Chris@0 89 #endif
Chris@0 90