annotate layer/TimeRulerLayer.h @ 1427:f792a5001d80 single-point

Update to use external set of commands
author Chris Cannam
date Fri, 15 Mar 2019 11:09:17 +0000
parents 05d614f6e46d
children 696e569ff21b
rev   line source
Chris@58 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@59 4 Sonic Visualiser
Chris@59 5 An audio file viewer and annotation editor.
Chris@59 6 Centre for Digital Music, Queen Mary, University of London.
Chris@59 7 This file copyright 2006 Chris Cannam.
Chris@0 8
Chris@59 9 This program is free software; you can redistribute it and/or
Chris@59 10 modify it under the terms of the GNU General Public License as
Chris@59 11 published by the Free Software Foundation; either version 2 of the
Chris@59 12 License, or (at your option) any later version. See the file
Chris@59 13 COPYING included with this distribution for more information.
Chris@0 14 */
Chris@0 15
Chris@1407 16 #ifndef SV_TIME_RULER_H
Chris@1407 17 #define SV_TIME_RULER_H
Chris@0 18
Chris@287 19 #include "SingleColourLayer.h"
Chris@0 20
Chris@0 21 #include <QRect>
Chris@0 22 #include <QColor>
Chris@0 23
Chris@0 24 class View;
Chris@0 25 class Model;
Chris@0 26 class QPainter;
Chris@0 27
Chris@287 28 class TimeRulerLayer : public SingleColourLayer
Chris@0 29 {
Chris@0 30 Q_OBJECT
Chris@0 31
Chris@0 32 public:
Chris@44 33 TimeRulerLayer();
Chris@0 34
Chris@1406 35 void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const override;
Chris@0 36
Chris@0 37 void setModel(Model *);
Chris@1406 38 const Model *getModel() const override { return m_model; }
Chris@0 39
Chris@0 40 enum LabelHeight { LabelTop, LabelMiddle, LabelBottom };
Chris@0 41 void setLabelHeight(LabelHeight h) { m_labelHeight = h; }
Chris@0 42 LabelHeight getLabelHeight() const { return m_labelHeight; }
Chris@0 43
Chris@1406 44 bool snapToFeatureFrame(LayerGeometryProvider *, sv_frame_t &, int &, SnapType) const override;
Chris@271 45
Chris@1406 46 ColourSignificance getLayerColourSignificance() const override {
Chris@287 47 return ColourIrrelevant;
Chris@287 48 }
Chris@0 49
Chris@1406 50 bool getValueExtents(double &, double &, bool &, QString &) const override {
Chris@79 51 return false;
Chris@79 52 }
Chris@79 53
Chris@1406 54 QString getLayerPresentationName() const override;
Chris@335 55
Chris@1406 56 int getVerticalScaleWidth(LayerGeometryProvider *, bool, QPainter &) const override { return 0; }
Chris@607 57
Chris@1406 58 void toXml(QTextStream &stream, QString indent = "",
Chris@1406 59 QString extraAttributes = "") const override;
Chris@6 60
Chris@1406 61 void setProperties(const QXmlAttributes &attributes) override;
Chris@11 62
Chris@1406 63 bool canExistWithoutModel() const override { return true; }
Chris@947 64
Chris@0 65 protected:
Chris@0 66 Model *m_model;
Chris@0 67 LabelHeight m_labelHeight;
Chris@271 68
Chris@1406 69 int getDefaultColourHint(bool dark, bool &impose) override;
Chris@287 70
Chris@1346 71 int64_t getMajorTickUSec(LayerGeometryProvider *, bool &quarterTicks) const;
Chris@1341 72 int getXForUSec(LayerGeometryProvider *, double usec) const;
Chris@0 73 };
Chris@0 74
Chris@0 75 #endif