annotate view/Overview.h @ 1546:ec837d223bd9

Update getPointToDrag to prefer boxes that are containing the mouse position in height as well as width
author Chris Cannam
date Thu, 17 Oct 2019 10:26:21 +0100
parents e540aa5d89cd
children a0b2f3b4dd2f
rev   line source
Chris@173 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@173 2
Chris@173 3 /*
Chris@173 4 Sonic Visualiser
Chris@173 5 An audio file viewer and annotation editor.
Chris@173 6 Centre for Digital Music, Queen Mary, University of London.
Chris@182 7 This file copyright 2006 Chris Cannam and QMUL.
Chris@173 8
Chris@173 9 This program is free software; you can redistribute it and/or
Chris@173 10 modify it under the terms of the GNU General Public License as
Chris@173 11 published by the Free Software Foundation; either version 2 of the
Chris@173 12 License, or (at your option) any later version. See the file
Chris@173 13 COPYING included with this distribution for more information.
Chris@173 14 */
Chris@173 15
Chris@1325 16 #ifndef SV_OVERVIEW_H
Chris@1325 17 #define SV_OVERVIEW_H
Chris@173 18
Chris@173 19 #include "View.h"
Chris@173 20
Chris@173 21 #include <QPoint>
Chris@274 22 #include <QTime>
Chris@173 23
Chris@173 24 class QWidget;
Chris@173 25 class QPaintEvent;
Chris@173 26 class Layer;
Chris@173 27 class View;
Chris@173 28
Chris@173 29 #include <map>
Chris@173 30
Chris@173 31 class Overview : public View
Chris@173 32 {
Chris@173 33 Q_OBJECT
Chris@173 34
Chris@173 35 public:
Chris@173 36 Overview(QWidget *parent = 0);
Chris@173 37
Chris@211 38 void registerView(View *view);
Chris@211 39 void unregisterView(View *view);
Chris@173 40
Chris@1406 41 QString getPropertyContainerIconName() const override { return "panner"; }
Chris@173 42
Chris@173 43 public slots:
Chris@1481 44 void modelChangedWithin(ModelId, sv_frame_t startFrame, sv_frame_t endFrame) override;
Chris@1406 45 void modelReplaced() override;
Chris@173 46
Chris@1406 47 void globalCentreFrameChanged(sv_frame_t) override;
Chris@1406 48 void viewCentreFrameChanged(View *, sv_frame_t) override;
Chris@1406 49 void viewZoomLevelChanged(View *, ZoomLevel, bool) override;
Chris@1406 50 void viewManagerPlaybackFrameChanged(sv_frame_t) override;
Chris@173 51
Chris@965 52 virtual void setBoxColour(QColor);
Chris@965 53
Chris@173 54 protected:
Chris@1406 55 void paintEvent(QPaintEvent *e) override;
Chris@1406 56 void mousePressEvent(QMouseEvent *e) override;
Chris@1406 57 void mouseReleaseEvent(QMouseEvent *e) override;
Chris@1406 58 void mouseMoveEvent(QMouseEvent *e) override;
Chris@1406 59 void mouseDoubleClickEvent(QMouseEvent *e) override;
Chris@1406 60 void enterEvent(QEvent *) override;
Chris@1406 61 void leaveEvent(QEvent *) override;
Chris@1406 62 bool shouldLabelSelections() const override { return false; }
Chris@173 63
Chris@871 64 QColor getFillWithin() const;
Chris@871 65 QColor getFillWithout() const;
Chris@871 66
Chris@173 67 QPoint m_clickPos;
Chris@173 68 QPoint m_mousePos;
Chris@173 69 bool m_clickedInRange;
Chris@908 70 sv_frame_t m_dragCentreFrame;
Chris@274 71 QTime m_modelTestTime;
Chris@965 72 QColor m_boxColour;
Chris@173 73
Chris@211 74 typedef std::set<View *> ViewSet;
Chris@211 75 ViewSet m_views;
Chris@173 76 };
Chris@173 77
Chris@173 78 #endif
Chris@173 79