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__
26 #include <sigc++/signal.h>
28 #include "ardour/ardour.h"
29 #include "pbd/signals.h"
30 #include "canvas/types.h"
37 namespace ArdourCanvas {
48 class Marker : public sigc::trackable
55 SessionStart, ///< session start
56 SessionEnd, ///< session end
66 Marker (PublicEditor& editor, ArdourCanvas::Group &, guint32 rgba, const std::string& text, Type,
67 framepos_t frame = 0, bool handle_events = true);
71 static PBD::Signal1<void,Marker*> CatchDeletion;
73 ArdourCanvas::Item& the_item() const;
75 void set_selected (bool);
76 void set_show_line (bool);
77 void canvas_height_set (double);
79 void set_position (framepos_t);
80 void set_name (const std::string&);
81 void set_color_rgba (uint32_t rgba);
84 framepos_t position() const { return frame_position; }
86 ArdourCanvas::Group * get_parent() { return _parent; }
87 void reparent (ArdourCanvas::Group & parent);
92 Type type () { return _type; }
94 void set_left_label_limit (double);
95 void set_right_label_limit (double);
97 std::string name () const {
101 bool label_on_left () const;
104 PublicEditor& editor;
106 Pango::FontDescription name_font;
108 ArdourCanvas::Group* _parent;
109 ArdourCanvas::Group *group;
110 ArdourCanvas::Polygon *mark;
111 ArdourCanvas::Pixbuf *name_pixbuf;
112 ArdourCanvas::Points *points;
113 ArdourCanvas::Line* _line;
114 ArdourCanvas::Points *line_points;
115 ArdourCanvas::Rectangle* _name_background;
118 double unit_position;
119 framepos_t frame_position;
126 double _canvas_height;
128 double _left_label_limit; ///< the number of pixels available to the left of this marker for a label
129 double _right_label_limit; ///< the number of pixels available to the right of this marker for a label
130 double _label_offset;
133 void setup_line_x ();
134 void setup_name_display ();
137 /* disallow copy construction */
138 Marker (Marker const &);
139 Marker & operator= (Marker const &);
142 class TempoMarker : public Marker
145 TempoMarker (PublicEditor& editor, ArdourCanvas::Group &, guint32 rgba, const std::string& text, ARDOUR::TempoSection&);
148 ARDOUR::TempoSection& tempo() const { return _tempo; }
151 ARDOUR::TempoSection& _tempo;
154 class MeterMarker : public Marker
157 MeterMarker (PublicEditor& editor, ArdourCanvas::Group &, guint32 rgba, const std::string& text, ARDOUR::MeterSection&);
160 ARDOUR::MeterSection& meter() const { return _meter; }
163 ARDOUR::MeterSection& _meter;
166 #endif /* __gtk_ardour_marker_h__ */