Chris@58: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@0: Chris@0: /* Chris@59: Sonic Visualiser Chris@59: An audio file viewer and annotation editor. Chris@59: Centre for Digital Music, Queen Mary, University of London. Chris@59: This file copyright 2006 Chris Cannam. Chris@0: Chris@59: This program is free software; you can redistribute it and/or Chris@59: modify it under the terms of the GNU General Public License as Chris@59: published by the Free Software Foundation; either version 2 of the Chris@59: License, or (at your option) any later version. See the file Chris@59: COPYING included with this distribution for more information. Chris@0: */ Chris@0: Chris@1407: #ifndef SV_TIME_RULER_H Chris@1407: #define SV_TIME_RULER_H Chris@0: Chris@287: #include "SingleColourLayer.h" Chris@0: Chris@0: #include Chris@0: #include Chris@0: Chris@0: class View; Chris@0: class Model; Chris@0: class QPainter; Chris@0: Chris@287: class TimeRulerLayer : public SingleColourLayer Chris@0: { Chris@0: Q_OBJECT Chris@0: Chris@0: public: Chris@44: TimeRulerLayer(); Chris@0: Chris@1406: void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const override; Chris@0: Chris@0: void setModel(Model *); Chris@1406: const Model *getModel() const override { return m_model; } Chris@0: Chris@0: enum LabelHeight { LabelTop, LabelMiddle, LabelBottom }; Chris@0: void setLabelHeight(LabelHeight h) { m_labelHeight = h; } Chris@0: LabelHeight getLabelHeight() const { return m_labelHeight; } Chris@0: Chris@1406: bool snapToFeatureFrame(LayerGeometryProvider *, sv_frame_t &, int &, SnapType) const override; Chris@271: Chris@1406: ColourSignificance getLayerColourSignificance() const override { Chris@287: return ColourIrrelevant; Chris@287: } Chris@0: Chris@1406: bool getValueExtents(double &, double &, bool &, QString &) const override { Chris@79: return false; Chris@79: } Chris@79: Chris@1406: QString getLayerPresentationName() const override; Chris@335: Chris@1406: int getVerticalScaleWidth(LayerGeometryProvider *, bool, QPainter &) const override { return 0; } Chris@607: Chris@1406: void toXml(QTextStream &stream, QString indent = "", Chris@1406: QString extraAttributes = "") const override; Chris@6: Chris@1406: void setProperties(const QXmlAttributes &attributes) override; Chris@11: Chris@1406: bool canExistWithoutModel() const override { return true; } Chris@947: Chris@0: protected: Chris@0: Model *m_model; Chris@0: LabelHeight m_labelHeight; Chris@271: Chris@1406: int getDefaultColourHint(bool dark, bool &impose) override; Chris@287: Chris@1346: int64_t getMajorTickUSec(LayerGeometryProvider *, bool &quarterTicks) const; Chris@1341: int getXForUSec(LayerGeometryProvider *, double usec) const; Chris@0: }; Chris@0: Chris@0: #endif