TimeRulerLayer.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Sonic Visualiser
5  An audio file viewer and annotation editor.
6  Centre for Digital Music, Queen Mary, University of London.
7  This file copyright 2006 Chris Cannam.
8 
9  This program is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of the
12  License, or (at your option) any later version. See the file
13  COPYING included with this distribution for more information.
14 */
15 
16 #ifndef SV_TIME_RULER_H
17 #define SV_TIME_RULER_H
18 
19 #include "SingleColourLayer.h"
20 
21 #include <QRect>
22 #include <QColor>
23 
24 class View;
25 class Model;
26 class QPainter;
27 
29 {
30  Q_OBJECT
31 
32 public:
34 
35  void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const override;
36 
37  void setModel(ModelId);
38  ModelId getModel() const override { return m_model; }
39 
43 
44  bool snapToFeatureFrame(LayerGeometryProvider *, sv_frame_t &, int &,
45  SnapType, int) const override;
46 
48  return ColourIrrelevant;
49  }
50 
51  bool getValueExtents(double &, double &, bool &, QString &) const override {
52  return false;
53  }
54 
55  QString getLayerPresentationName() const override;
56 
57  int getVerticalScaleWidth(LayerGeometryProvider *, bool, QPainter &) const override { return 0; }
58 
59  void toXml(QTextStream &stream, QString indent = "",
60  QString extraAttributes = "") const override;
61 
62  void setProperties(const QXmlAttributes &attributes) override;
63 
64  bool canExistWithoutModel() const override { return true; }
65 
66 protected:
67  ModelId m_model;
69 
70  int getDefaultColourHint(bool dark, bool &impose) override;
71 
72  int64_t getMajorTickUSec(LayerGeometryProvider *, bool &quarterTicks) const;
73  int getXForUSec(LayerGeometryProvider *, double usec) const;
74 };
75 
76 #endif
int getXForUSec(LayerGeometryProvider *, double usec) const
LabelHeight getLabelHeight() const
int getDefaultColourHint(bool dark, bool &impose) override
ModelId getModel() const override
Return the ID of the model represented in this layer.
void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const override
Paint the given rectangle of this layer onto the given view using the given painter, superimposing it on top of any existing material in that view.
ColourSignificance
Definition: Layer.h:348
void toXml(QTextStream &stream, QString indent="", QString extraAttributes="") const override
void setProperties(const QXmlAttributes &attributes) override
Set the particular properties of a layer (those specific to the subclass) from a set of XML attribute...
void setLabelHeight(LabelHeight h)
Interface for classes that provide geometry information (such as size, start frame, and a large number of other properties) about the disposition of a layer.
ColourSignificance getLayerColourSignificance() const override
Implements Layer::getLayerColourSignificance()
SnapType
Definition: Layer.h:195
bool snapToFeatureFrame(LayerGeometryProvider *, sv_frame_t &, int &, SnapType, int) const override
Adjust the given frame to snap to the nearest feature, if possible.
QString getLayerPresentationName() const override
int getVerticalScaleWidth(LayerGeometryProvider *, bool, QPainter &) const override
void setModel(ModelId)
View is the base class of widgets that display one or more overlaid views of data against a horizonta...
Definition: View.h:55
LabelHeight m_labelHeight
bool getValueExtents(double &, double &, bool &, QString &) const override
Return the minimum and maximum values for the y axis of the model in this layer, as well as whether t...
bool canExistWithoutModel() const override
Return true if this layer type can function without a model being set.
int64_t getMajorTickUSec(LayerGeometryProvider *, bool &quarterTicks) const