2 * Copyright (C) 2005-2017 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
4 * Copyright (C) 2008-2011 David Robillard <d@drobilla.net>
5 * Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
6 * Copyright (C) 2014-2017 Robin Gareus <robin@gareus.org>
7 * Copyright (C) 2016-2017 Nick Mainsbridge <mainsbridge@gmail.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #ifndef __gtk_ardour_marker_h__
25 #define __gtk_ardour_marker_h__
30 #include <sigc++/signal.h>
32 #include "ardour/ardour.h"
33 #include "pbd/signals.h"
35 #include "canvas/fwd.h"
36 #include "canvas/types.h"
47 * Editor ruler representation of a location marker or range on the timeline.
49 class ArdourMarker : public sigc::trackable
56 SessionStart, ///< session start
57 SessionEnd, ///< session end
67 ArdourMarker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, Type,
68 samplepos_t sample = 0, bool handle_events = true);
70 virtual ~ArdourMarker ();
72 static PBD::Signal1<void,ArdourMarker*> CatchDeletion;
74 static void setup_sizes (const double timebar_height);
76 ArdourCanvas::Item& the_item() const;
78 void set_selected (bool);
79 void set_show_line (bool);
80 void canvas_height_set (double);
82 void set_position (samplepos_t);
83 void set_name (const std::string&);
84 void set_points_color (uint32_t rgba);
85 void set_color_rgba (uint32_t rgba);
88 samplepos_t position() const { return sample_position; }
90 ArdourCanvas::Container * get_parent() { return _parent; }
91 void reparent (ArdourCanvas::Container & parent);
96 Type type () { return _type; }
98 void set_left_label_limit (double);
99 void set_right_label_limit (double);
101 std::string name () const {
105 bool label_on_left () const;
108 PublicEditor& editor;
110 Pango::FontDescription name_font;
112 ArdourCanvas::Container* _parent;
113 ArdourCanvas::Container *group;
114 ArdourCanvas::Polygon *mark;
115 ArdourCanvas::Text *_name_item;
116 ArdourCanvas::Points *points;
117 ArdourCanvas::Line* _track_canvas_line;
118 ArdourCanvas::Rectangle* _name_background;
121 double unit_position;
122 samplepos_t sample_position;
129 double _canvas_height;
131 uint32_t _points_color;
132 double _left_label_limit; ///< the number of pixels available to the left of this marker for a label
133 double _right_label_limit; ///< the number of pixels available to the right of this marker for a label
134 double _label_offset;
137 void setup_line_x ();
138 void setup_name_display ();
141 /* disallow copy construction */
142 ArdourMarker (ArdourMarker const &);
143 ArdourMarker & operator= (ArdourMarker const &);
146 class TempoMarker : public ArdourMarker
149 TempoMarker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, ARDOUR::TempoSection&);
152 ARDOUR::TempoSection& tempo() const { return _tempo; }
154 void update_height_mark (const double ratio);
156 ARDOUR::TempoSection& _tempo;
159 class MeterMarker : public ArdourMarker
162 MeterMarker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, ARDOUR::MeterSection&);
165 ARDOUR::MeterSection& meter() const { return _meter; }
168 ARDOUR::MeterSection& _meter;
171 #endif /* __gtk_ardour_marker_h__ */