Add a couple of missing attach_buffers() calls after _ports has been changed. I...
[ardour2.git] / gtk2_ardour / marker.h
blob6bf6d08f5132a6bb697ff36bbf4bba073e51fb18
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>
26 #include <libgnomecanvasmm/pixbuf.h>
27 #include <sigc++/signal.h>
29 #include "ardour/ardour.h"
30 #include "pbd/signals.h"
32 #include "canvas.h"
34 namespace ARDOUR {
35 class TempoSection;
36 class MeterSection;
39 class PublicEditor;
41 class Marker : public sigc::trackable
43 public:
44 enum Type {
45 Mark,
46 Tempo,
47 Meter,
48 SessionStart, ///< session start
49 SessionEnd, ///< session end
50 RangeStart,
51 RangeEnd,
52 LoopStart,
53 LoopEnd,
54 PunchIn,
55 PunchOut
59 Marker (PublicEditor& editor, ArdourCanvas::Group &, guint32 rgba, const std::string& text, Type,
60 framepos_t frame = 0, bool handle_events = true);
62 virtual ~Marker ();
64 static PBD::Signal1<void,Marker*> CatchDeletion;
66 ArdourCanvas::Item& the_item() const;
68 void set_selected (bool);
69 void set_show_line (bool);
70 void canvas_height_set (double);
72 void set_position (framepos_t);
73 void set_name (const std::string&);
74 void set_color_rgba (uint32_t rgba);
75 void setup_line ();
77 framepos_t position() const { return frame_position; }
79 ArdourCanvas::Group * get_parent() { return _parent; }
80 void reparent (ArdourCanvas::Group & parent);
82 void hide ();
83 void show ();
85 Type type () { return _type; }
87 void set_left_label_limit (double);
88 void set_right_label_limit (double);
90 std::string name () const {
91 return _name;
94 bool label_on_left () const;
96 protected:
97 PublicEditor& editor;
99 Pango::FontDescription name_font;
101 ArdourCanvas::Group* _parent;
102 ArdourCanvas::Group *group;
103 ArdourCanvas::Polygon *mark;
104 ArdourCanvas::Pixbuf *name_pixbuf;
105 ArdourCanvas::Points *points;
106 ArdourCanvas::SimpleLine* _line;
107 ArdourCanvas::Points *line_points;
108 ArdourCanvas::SimpleRect* _name_background;
110 std::string _name;
111 double unit_position;
112 framepos_t frame_position;
113 double _shift;
114 Type _type;
115 int name_height;
116 bool _selected;
117 bool _shown;
118 bool _line_shown;
119 double _canvas_height;
120 uint32_t _color;
121 double _left_label_limit; ///< the number of pixels available to the left of this marker for a label
122 double _right_label_limit; ///< the number of pixels available to the right of this marker for a label
123 double _label_offset;
125 void reposition ();
126 void setup_line_x ();
127 void setup_name_display ();
129 private:
130 /* disallow copy construction */
131 Marker (Marker const &);
132 Marker & operator= (Marker const &);
135 class TempoMarker : public Marker
137 public:
138 TempoMarker (PublicEditor& editor, ArdourCanvas::Group &, guint32 rgba, const std::string& text, ARDOUR::TempoSection&);
139 ~TempoMarker ();
141 ARDOUR::TempoSection& tempo() const { return _tempo; }
143 private:
144 ARDOUR::TempoSection& _tempo;
147 class MeterMarker : public Marker
149 public:
150 MeterMarker (PublicEditor& editor, ArdourCanvas::Group &, guint32 rgba, const std::string& text, ARDOUR::MeterSection&);
151 ~MeterMarker ();
153 ARDOUR::MeterSection& meter() const { return _meter; }
155 private:
156 ARDOUR::MeterSection& _meter;
159 #endif /* __gtk_ardour_marker_h__ */