make marker labels and regionview name text (now drawn with pixbufs) be color-adjusta...
[ardour2.git] / gtk2_ardour / marker.h
blob8d5674c7b0e802eda38d1389e5d2c88247f42500
1 /*
2 Copyright (C) 2001 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __gtk_ardour_marker_h__
21 #define __gtk_ardour_marker_h__
23 #include <string>
24 #include <glib.h>
25 #include <ardour/ardour.h>
26 #include <pbd/destructible.h>
28 #include <libgnomecanvasmm/pixbuf.h>
30 #include "canvas.h"
32 namespace ARDOUR {
33 class TempoSection;
34 class MeterSection;
37 class PublicEditor;
39 class Marker : public PBD::Destructible
41 public:
42 enum Type {
43 Mark,
44 Tempo,
45 Meter,
46 Start,
47 End,
48 LoopStart,
49 LoopEnd,
50 PunchIn,
51 PunchOut
55 Marker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const string& text, Type,
56 nframes_t frame = 0, bool handle_events = true);
58 virtual ~Marker ();
60 ArdourCanvas::Item& the_item() const;
62 void add_line (ArdourCanvas::Group*, double y_origin, double initial_height);
63 void show_line ();
64 void hide_line ();
65 void set_line_vpos (double y_origin, double height);
67 void set_position (nframes_t);
68 void set_name (const string&);
69 void set_color_rgba (uint32_t rgba);
71 nframes64_t position() const { return frame_position; }
73 ArdourCanvas::Group * get_parent() { return _parent; }
74 void reparent (ArdourCanvas::Group & parent);
76 void hide ();
77 void show ();
79 Type type () { return _type; }
81 protected:
82 PublicEditor& editor;
84 Pango::FontDescription* name_font;
86 ArdourCanvas::Group * _parent;
87 ArdourCanvas::Group *group;
88 ArdourCanvas::Polygon *mark;
89 ArdourCanvas::Pixbuf *name_pixbuf;
90 ArdourCanvas::Points *points;
91 ArdourCanvas::SimpleLine *line;
92 ArdourCanvas::Points *line_points;
94 double unit_position;
95 nframes64_t frame_position;
96 unsigned char shift; /* should be double, but its always small and integral */
97 Type _type;
98 int name_height;
99 std::string _annotation;
101 void reposition ();
102 void color_handler ();
105 class TempoMarker : public Marker
107 public:
108 TempoMarker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const string& text, ARDOUR::TempoSection&);
109 ~TempoMarker ();
111 ARDOUR::TempoSection& tempo() const { return _tempo; }
113 private:
114 ARDOUR::TempoSection& _tempo;
117 class MeterMarker : public Marker
119 public:
120 MeterMarker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const string& text, ARDOUR::MeterSection&);
121 ~MeterMarker ();
123 ARDOUR::MeterSection& meter() const { return _meter; }
125 private:
126 ARDOUR::MeterSection& _meter;
129 #endif /* __gtk_ardour_marker_h__ */