svgui  1.9
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 _TIME_RULER_H_
17 #define _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  virtual void paint(View *v, QPainter &paint, QRect rect) const;
36 
37  void setModel(Model *);
38  virtual const Model *getModel() const { return m_model; }
39 
43 
44  virtual bool snapToFeatureFrame(View *, int &, int &, SnapType) const;
45 
47  return ColourIrrelevant;
48  }
49 
50  virtual bool getValueExtents(float &, float &, bool &, QString &) const {
51  return false;
52  }
53 
54  virtual QString getLayerPresentationName() const;
55 
56  virtual int getVerticalScaleWidth(View *, bool, QPainter &) const { return 0; }
57 
58  virtual void toXml(QTextStream &stream, QString indent = "",
59  QString extraAttributes = "") const;
60 
61  void setProperties(const QXmlAttributes &attributes);
62 
63 protected:
64  Model *m_model;
66 
67  virtual int getDefaultColourHint(bool dark, bool &impose);
68 
69  int getMajorTickSpacing(View *, bool &quarterTicks) const;
70 };
71 
72 #endif
virtual int getDefaultColourHint(bool dark, bool &impose)
void setProperties(const QXmlAttributes &attributes)
Set the particular properties of a layer (those specific to the subclass) from a set of XML attribute...
ColourSignificance
Definition: Layer.h:304
void setModel(Model *)
virtual int getVerticalScaleWidth(View *, bool, QPainter &) const
virtual void paint(View *v, QPainter &paint, QRect rect) const
Paint the given rectangle of this layer onto the given view using the given painter,...
virtual bool snapToFeatureFrame(View *, int &, int &, SnapType) const
Adjust the given frame to snap to the nearest feature, if possible.
virtual const Model * getModel() const
void setLabelHeight(LabelHeight h)
virtual ColourSignificance getLayerColourSignificance() const
Implements Layer::getLayerColourSignificance()
LabelHeight getLabelHeight() const
SnapType
Definition: Layer.h:157
View is the base class of widgets that display one or more overlaid views of data against a horizonta...
Definition: View.h:50
LabelHeight m_labelHeight
virtual QString getLayerPresentationName() const
virtual void toXml(QTextStream &stream, QString indent="", QString extraAttributes="") const
Convert the layer's data (though not those of the model it refers to) into XML for file output.
int getMajorTickSpacing(View *, bool &quarterTicks) const
virtual bool getValueExtents(float &, float &, bool &, QString &) const
Return the minimum and maximum values for the y axis of the model in this layer, as well as whether t...