#include "ardour/tempo.h"
#include "canvas/rectangle.h"
-#include "canvas/group.h"
+#include "canvas/container.h"
#include "canvas/line.h"
#include "canvas/polygon.h"
#include "canvas/text.h"
#include "canvas/canvas.h"
+#include "canvas/scroll_group.h"
#include "canvas/debug.h"
#include "ardour_ui.h"
using namespace std;
using namespace ARDOUR;
+using namespace ARDOUR_UI_UTILS;
using namespace Gtkmm2ext;
PBD::Signal1<void,Marker*> Marker::CatchDeletion;
static const double marker_height = 13.0;
-Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, const string& annotation,
+Marker::Marker (PublicEditor& ed, ArdourCanvas::Container& parent, guint32 rgba, const string& annotation,
Type type, framepos_t frame, bool handle_events)
: editor (ed)
, _parent (&parent)
- , _time_bars_line (0)
, _track_canvas_line (0)
, _type (type)
, _selected (false)
unit_position = editor.sample_to_pixel (frame);
unit_position -= _shift;
- group = new ArdourCanvas::Group (&parent, ArdourCanvas::Duple (unit_position, 0));
+ group = new ArdourCanvas::Container (&parent, ArdourCanvas::Duple (unit_position, 0));
#ifdef CANVAS_DEBUG
group->name = string_compose ("Marker::group for %1", annotation);
#endif
- _name_background = new ArdourCanvas::Rectangle (group);
+ _name_background = new ArdourCanvas::TimeRectangle (group);
#ifdef CANVAS_DEBUG
_name_background->name = string_compose ("Marker::_name_background for %1", annotation);
#endif
/* destroying the parent group destroys its contents, namely any polygons etc. that we added */
delete group;
- delete _time_bars_line;
delete _track_canvas_line;
}
-void Marker::reparent(ArdourCanvas::Group & parent)
+void Marker::reparent(ArdourCanvas::Container & parent)
{
group->reparent (&parent);
_parent = &parent;
{
if (_shown && (_selected || _line_shown)) {
- if (_time_bars_line == 0) {
+ if (_track_canvas_line == 0) {
- _time_bars_line = new ArdourCanvas::Line (editor.get_time_bars_group());
- _time_bars_line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_EditPoint());
- _time_bars_line->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), group, this));
-
- _track_canvas_line = new ArdourCanvas::Line (editor.get_track_canvas_group());
- _track_canvas_line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_EditPoint());
+ _track_canvas_line = new ArdourCanvas::Line (editor.get_hscroll_group());
+ _track_canvas_line->set_outline_color (ARDOUR_UI::config()->get_EditPoint());
_track_canvas_line->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), group, this));
}
- ArdourCanvas::Duple g = group->item_to_canvas (ArdourCanvas::Duple (0, 0));
- ArdourCanvas::Duple d = _time_bars_line->canvas_to_item (ArdourCanvas::Duple (g.x + _shift, 0));
-
- _time_bars_line->set_x0 (d.x);
- _time_bars_line->set_x1 (d.x);
- _time_bars_line->set_y0 (d.y);
- _time_bars_line->set_y1 (ArdourCanvas::COORD_MAX);
- _time_bars_line->set_outline_color (_selected ? ARDOUR_UI::config()->get_canvasvar_EditPoint() : _color);
- _time_bars_line->raise_to_top ();
- _time_bars_line->show ();
+ ArdourCanvas::Duple g = group->canvas_origin();
+ ArdourCanvas::Duple d = _track_canvas_line->canvas_to_item (ArdourCanvas::Duple (g.x + _shift, 0));
- d = _track_canvas_line->canvas_to_item (ArdourCanvas::Duple (g.x + _shift, 0));
_track_canvas_line->set_x0 (d.x);
_track_canvas_line->set_x1 (d.x);
_track_canvas_line->set_y0 (d.y);
_track_canvas_line->set_y1 (ArdourCanvas::COORD_MAX);
- _track_canvas_line->set_outline_color (_selected ? ARDOUR_UI::config()->get_canvasvar_EditPoint() : _color);
+ _track_canvas_line->set_outline_color (_selected ? ARDOUR_UI::config()->get_EditPoint() : _color);
_track_canvas_line->raise_to_top ();
_track_canvas_line->show ();
} else {
- if (_time_bars_line) {
- _time_bars_line->hide ();
+ if (_track_canvas_line) {
_track_canvas_line->hide ();
}
}
_name_item->set (_name);
if (label_on_left ()) {
+ /* adjust right edge of background to fit text */
_name_background->set_x0 (_name_item->position().x - 2);
_name_background->set_x1 (_name_item->position().x + name_width + _shift);
} else {
- _name_background->set_x0 (_name_item->position().x - _label_offset + 2);
- _name_background->set_x1 (_name_item->position().x + name_width);
+ /* right edge remains at zero (group-relative). Add
+ * arbitrary 4 pixels of extra padding at the end
+ */
+ _name_background->set_x1 (_name_item->position().x + name_width + 4.0);
}
}
mark->set_fill_color (_color);
mark->set_outline_color (_color);
- if (_time_bars_line && !_selected) {
- _time_bars_line->set_outline_color (_color);
+ if (_track_canvas_line && !_selected) {
_track_canvas_line->set_outline_color (_color);
}
/***********************************************************************/
-TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const string& text,
+TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Container& parent, guint32 rgba, const string& text,
ARDOUR::TempoSection& temp)
: Marker (editor, parent, rgba, text, Tempo, 0, false),
_tempo (temp)
/***********************************************************************/
-MeterMarker::MeterMarker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const string& text,
+MeterMarker::MeterMarker (PublicEditor& editor, ArdourCanvas::Container& parent, guint32 rgba, const string& text,
ARDOUR::MeterSection& m)
: Marker (editor, parent, rgba, text, Meter, 0, false),
_meter (m)