annotate layer/TimeRulerLayer.h @ 1608:6616e1899daa

Make ImageLayer able to report whether an image format can be opened
author Chris Cannam
date Mon, 11 May 2020 17:28:12 +0100
parents e6362cf5ff1d
children
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@1470 37 void setModel(ModelId);
Chris@1470 38 ModelId 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@1547 44 bool snapToFeatureFrame(LayerGeometryProvider *, sv_frame_t &, int &,
Chris@1547 45 SnapType, int) const override;
Chris@271 46
Chris@1406 47 ColourSignificance getLayerColourSignificance() const override {
Chris@287 48 return ColourIrrelevant;
Chris@287 49 }
Chris@0 50
Chris@1406 51 bool getValueExtents(double &, double &, bool &, QString &) const override {
Chris@79 52 return false;
Chris@79 53 }
Chris@79 54
Chris@1406 55 QString getLayerPresentationName() const override;
Chris@335 56
Chris@1406 57 int getVerticalScaleWidth(LayerGeometryProvider *, bool, QPainter &) const override { return 0; }
Chris@607 58
Chris@1406 59 void toXml(QTextStream &stream, QString indent = "",
Chris@1406 60 QString extraAttributes = "") const override;
Chris@6 61
Chris@1406 62 void setProperties(const QXmlAttributes &attributes) override;
Chris@11 63
Chris@1406 64 bool canExistWithoutModel() const override { return true; }
Chris@947 65
Chris@0 66 protected:
Chris@1470 67 ModelId m_model;
Chris@0 68 LabelHeight m_labelHeight;
Chris@271 69
Chris@1406 70 int getDefaultColourHint(bool dark, bool &impose) override;
Chris@287 71
Chris@1346 72 int64_t getMajorTickUSec(LayerGeometryProvider *, bool &quarterTicks) const;
Chris@1341 73 int getXForUSec(LayerGeometryProvider *, double usec) const;
Chris@0 74 };
Chris@0 75
Chris@0 76 #endif