annotate layer/TimeRulerLayer.h @ 1352:4949061fcb8c zoom

Debug tweaks
author Chris Cannam
date Fri, 05 Oct 2018 09:59:41 +0100
parents 4c28e3302045
children a18e78b9c78b
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@0 16 #ifndef _TIME_RULER_H_
Chris@0 17 #define _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@916 35 virtual void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const;
Chris@0 36
Chris@0 37 void setModel(Model *);
Chris@0 38 virtual const Model *getModel() const { 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@918 44 virtual bool snapToFeatureFrame(LayerGeometryProvider *, sv_frame_t &, int &, SnapType) const;
Chris@271 45
Chris@287 46 virtual ColourSignificance getLayerColourSignificance() const {
Chris@287 47 return ColourIrrelevant;
Chris@287 48 }
Chris@0 49
Chris@905 50 virtual bool getValueExtents(double &, double &, bool &, QString &) const {
Chris@79 51 return false;
Chris@79 52 }
Chris@79 53
Chris@335 54 virtual QString getLayerPresentationName() const;
Chris@335 55
Chris@918 56 virtual int getVerticalScaleWidth(LayerGeometryProvider *, bool, QPainter &) const { return 0; }
Chris@607 57
Chris@316 58 virtual void toXml(QTextStream &stream, QString indent = "",
Chris@316 59 QString extraAttributes = "") const;
Chris@6 60
Chris@11 61 void setProperties(const QXmlAttributes &attributes);
Chris@11 62
Chris@947 63 virtual bool canExistWithoutModel() const { 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@287 69 virtual int getDefaultColourHint(bool dark, bool &impose);
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