summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-04-15 13:50:05 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-04-15 13:50:05 -0400
commit7e19053b88b4ab174052a44f2ee99dce92517aa9 (patch)
treed996b22ac8661421cc661d336322923deda00f73 /gtk2_ardour
parentaf4539f857a14be3856da89a20811bf39e4ffb6e (diff)
Fix dragging objects on the canvas and remove redundant canvas groups
Delivery of fake motion events to the editor needed the event coordinates to be in canvas space, as they are with "real" events. Editor and other objects had many redundant groups from timbyr's work on gnomecanvas to scroll by moving groups. We don't need this anymore with cairo-canvas (though possibly a stationay background group for the canvas might be useful again one day as in the SAE logo. Its implementation would be fairly different though, since we would have to explicitly move the group on every scroll, since nothing else ever moves on scroll). Also tweaks to text item placement, and switch TimeAxisViewItem from name_pixbuf to name_text, since ArdourCanvas::Text is already "pixbuf optimized".
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/audio_region_view.cc6
-rw-r--r--gtk2_ardour/automation_streamview.cc4
-rw-r--r--gtk2_ardour/editor.h12
-rw-r--r--gtk2_ardour/editor_canvas.cc23
-rw-r--r--gtk2_ardour/editor_drag.cc1
-rw-r--r--gtk2_ardour/imageframe_view.cc4
-rw-r--r--gtk2_ardour/marker.cc2
-rw-r--r--gtk2_ardour/midi_region_view.cc4
-rw-r--r--gtk2_ardour/public_editor.h1
-rw-r--r--gtk2_ardour/region_view.cc10
-rw-r--r--gtk2_ardour/streamview.cc18
-rw-r--r--gtk2_ardour/streamview.h8
-rw-r--r--gtk2_ardour/time_axis_view.cc9
-rw-r--r--gtk2_ardour/time_axis_view.h2
-rw-r--r--gtk2_ardour/time_axis_view_item.cc77
-rw-r--r--gtk2_ardour/time_axis_view_item.h8
16 files changed, 70 insertions, 119 deletions
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc
index 4f222f3413..eaa1f2fabb 100644
--- a/gtk2_ardour/audio_region_view.cc
+++ b/gtk2_ardour/audio_region_view.cc
@@ -41,7 +41,7 @@
#include "canvas/polygon.h"
#include "canvas/poly_line.h"
#include "canvas/line.h"
-#include "canvas/pixbuf.h"
+#include "canvas/text.h"
#include "streamview.h"
#include "audio_region_view.h"
@@ -511,8 +511,8 @@ AudioRegionView::set_height (gdouble height)
ArdourCanvas::Duple (pos_x, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
}
- if (name_pixbuf) {
- name_pixbuf->raise_to_top();
+ if (name_text) {
+ name_text->raise_to_top();
}
}
diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc
index 3904c2728e..cab176429d 100644
--- a/gtk2_ardour/automation_streamview.cc
+++ b/gtk2_ardour/automation_streamview.cc
@@ -45,9 +45,7 @@ using namespace PBD;
using namespace Editing;
AutomationStreamView::AutomationStreamView (AutomationTimeAxisView& tv)
- : StreamView (*dynamic_cast<RouteTimeAxisView*>(tv.get_parent()),
- new ArdourCanvas::Group (tv.canvas_background()),
- new ArdourCanvas::Group (tv.canvas_display()))
+ : StreamView (*dynamic_cast<RouteTimeAxisView*>(tv.get_parent()))
, _automation_view(tv)
, _pending_automation_state (Off)
{
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 558f24f31c..e35e206881 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -735,16 +735,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
ArdourCanvas::Group* transport_marker_bar_group;
ArdourCanvas::Group* cd_marker_bar_group;
- /** The group containing all items that require horizontal scrolling. */
- ArdourCanvas::Group* _background_group;
- /*
- The _master_group is the group containing all items
- that require horizontal scrolling..
- It is primarily used to separate canvas items
- that require horizontal scrolling from those that do not.
- */
- ArdourCanvas::Group* _master_group;
-
/* The group containing all trackviews. Only scrolled vertically. */
ArdourCanvas::Group* _trackview_group;
@@ -1016,8 +1006,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
bool deferred_control_scroll (framepos_t);
sigc::connection control_scroll_connection;
- ArdourCanvas::Group* get_background_group () const { return _background_group; }
ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
+
void tie_vertical_scrolling ();
void set_horizontal_position (double);
double horizontal_position () const;
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index faaae52ff6..06e40ce91f 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -100,13 +100,7 @@ Editor::initialize_canvas ()
transport_punch_range_rect->set_outline_width (0);
transport_punch_range_rect->hide();
-
- _background_group = new ArdourCanvas::Group (_track_canvas->root());
- CANVAS_DEBUG_NAME (_background_group, "Canvas Background");
- _master_group = new ArdourCanvas::Group (_track_canvas->root());
- CANVAS_DEBUG_NAME (_master_group, "Canvas Master");
-
- _trackview_group = new ArdourCanvas::Group (_master_group);
+ _trackview_group = new ArdourCanvas::Group (_track_canvas->root());
CANVAS_DEBUG_NAME (_trackview_group, "Canvas TrackViews");
_region_motion_group = new ArdourCanvas::Group (_trackview_group);
CANVAS_DEBUG_NAME (_region_motion_group, "Canvas Region Motion");
@@ -168,14 +162,14 @@ Editor::initialize_canvas ()
transport_bar_drag_rect->set_outline (false);
transport_bar_drag_rect->hide ();
- transport_punchin_line = new ArdourCanvas::Line (_master_group);
+ transport_punchin_line = new ArdourCanvas::Line (_track_canvas->root());
transport_punchin_line->set_x0 (0);
transport_punchin_line->set_y0 (0);
transport_punchin_line->set_x1 (0);
transport_punchin_line->set_y1 (ArdourCanvas::COORD_MAX);
transport_punchin_line->hide ();
- transport_punchout_line = new ArdourCanvas::Line (_master_group);
+ transport_punchout_line = new ArdourCanvas::Line (_track_canvas->root());
transport_punchout_line->set_x0 (0);
transport_punchout_line->set_y0 (0);
transport_punchout_line->set_x1 (0);
@@ -183,7 +177,7 @@ Editor::initialize_canvas ()
transport_punchout_line->hide();
// used to show zoom mode active zooming
- zoom_rect = new ArdourCanvas::Rectangle (_master_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
+ zoom_rect = new ArdourCanvas::Rectangle (_track_canvas->root(), ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
zoom_rect->set_outline_width (1);
zoom_rect->hide();
@@ -544,7 +538,6 @@ Editor::autoscroll_canvas ()
{
framepos_t new_frame;
framepos_t limit = max_framepos - current_page_samples();
- GdkEventMotion ev;
double new_pixel;
double target_pixel;
@@ -640,11 +633,15 @@ Editor::autoscroll_canvas ()
Glib::RefPtr<Gdk::Window> canvas_window = const_cast<Editor*>(this)->_track_canvas->get_window();
gint x, y;
Gdk::ModifierType mask;
+ GdkEventMotion ev;
canvas_window->get_pointer (x, y, mask);
ev.type = GDK_MOTION_NOTIFY;
ev.state = Gdk::BUTTON1_MASK;
- ev.x = x;
- ev.y = y;
+
+ /* the motion handler expects events in canvas coordinate space */
+ ArdourCanvas::Duple d = _track_canvas->window_to_canvas (ArdourCanvas::Duple (x, y));
+ ev.x = d.x;
+ ev.y = d.y;
motion_handler (0, (GdkEvent*) &ev, true);
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 1b9a820ae6..09ac4ba120 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -637,6 +637,7 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
double const x_delta = compute_x_delta (event, &pending_region_position);
/* Work out the change in y */
+
int delta_time_axis_view = current_pointer_time_axis_view - _last_pointer_time_axis_view;
double delta_layer = current_pointer_layer - _last_pointer_layer;
diff --git a/gtk2_ardour/imageframe_view.cc b/gtk2_ardour/imageframe_view.cc
index 857780ffe2..4956779af8 100644
--- a/gtk2_ardour/imageframe_view.cc
+++ b/gtk2_ardour/imageframe_view.cc
@@ -262,11 +262,11 @@ ImageFrameView::set_height (gdouble h)
frame->raise_to_top();
imageframe->raise_to_top();
name_highlight->raise_to_top();
- name_pixbuf->raise_to_top();
+ name_text->raise_to_top();
frame_handle_start->raise_to_top();
frame_handle_end->raise_to_top();
- name_pixbuf->property_y() = h - TimeAxisViewItem::NAME_Y_OFFSET;
+ name_text->property_y() = h - TimeAxisViewItem::NAME_Y_OFFSET;
frame->property_y2() = h;
name_highlight->property_y1() = (gdouble) h - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE;
diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc
index 20f28bd785..59ed01f177 100644
--- a/gtk2_ardour/marker.cc
+++ b/gtk2_ardour/marker.cc
@@ -276,7 +276,7 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
#ifdef CANVAS_DEBUG
_name_item->name = string_compose ("Marker::_name_item for %1", annotation);
#endif
- _name_item->set_position (ArdourCanvas::Duple (_label_offset, 13 / 2 - name_height / 2));
+ _name_item->set_position (ArdourCanvas::Duple (_label_offset, (13.0 / 2.0) - (name_height / 2.0)));
set_name (annotation.c_str());
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 26ddb2c338..db53215137 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -1387,8 +1387,8 @@ MidiRegionView::set_height (double height)
midi_stream_view()->highest_note(),
height != old_height + FUDGE);
- if (name_pixbuf) {
- name_pixbuf->raise_to_top();
+ if (name_text) {
+ name_text->raise_to_top();
}
for (PatchChanges::iterator x = _patch_changes.begin(); x != _patch_changes.end(); ++x) {
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index 42ff531a35..6110bca046 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -381,7 +381,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
#endif
virtual ArdourCanvas::Group* get_trackview_group () const = 0;
- virtual ArdourCanvas::Group* get_background_group () const = 0;
virtual TimeAxisView* axis_view_from_route (boost::shared_ptr<ARDOUR::Route>) const = 0;
diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc
index 1b6ed3a6ff..2edad1cd16 100644
--- a/gtk2_ardour/region_view.cc
+++ b/gtk2_ardour/region_view.cc
@@ -183,9 +183,9 @@ RegionView::init (Gdk::Color const & basic_color, bool wfd)
}
}
- if (name_pixbuf) {
- name_pixbuf->set_data ("regionview", this);
- name_pixbuf->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_event), name_pixbuf, this));
+ if (name_text) {
+ name_text->set_data ("regionview", this);
+ name_text->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_event), name_text, this));
}
if (wfd) {
@@ -838,8 +838,8 @@ RegionView::update_coverage_frames (LayerDisplay d)
name_highlight->raise_to_top ();
}
- if (name_pixbuf) {
- name_pixbuf->raise_to_top ();
+ if (name_text) {
+ name_text->raise_to_top ();
}
}
diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc
index fac4572c92..774e150f13 100644
--- a/gtk2_ardour/streamview.cc
+++ b/gtk2_ardour/streamview.cc
@@ -50,12 +50,9 @@ using namespace ARDOUR;
using namespace PBD;
using namespace Editing;
-StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* background_group, ArdourCanvas::Group* canvas_group)
+StreamView::StreamView (RouteTimeAxisView& tv)
: _trackview (tv)
- , owns_background_group (background_group == 0)
- , owns_canvas_group (canvas_group == 0)
- , _background_group (background_group ? background_group : new ArdourCanvas::Group (_trackview.canvas_background()))
- , _canvas_group (canvas_group ? canvas_group : new ArdourCanvas::Group (_trackview.canvas_display()))
+ , _canvas_group (new ArdourCanvas::Group (_trackview.canvas_display()))
, _samples_per_pixel (_trackview.editor().get_current_zoom ())
, rec_updating(false)
, rec_active(false)
@@ -65,12 +62,11 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* background_g
, height(tv.height)
, last_rec_data_frame(0)
{
- CANVAS_DEBUG_NAME (_background_group, string_compose ("SV background group %1", _trackview.name()));
CANVAS_DEBUG_NAME (_canvas_group, string_compose ("SV canvas group %1", _trackview.name()));
/* set_position() will position the group */
- canvas_rect = new ArdourCanvas::Rectangle (_background_group);
+ canvas_rect = new ArdourCanvas::Rectangle (_canvas_group);
CANVAS_DEBUG_NAME (canvas_rect, string_compose ("SV canvas rectangle %1", _trackview.name()));
canvas_rect->set (ArdourCanvas::Rect (0, 0, ArdourCanvas::COORD_MAX, tv.current_height ()));
canvas_rect->raise(1); // raise above tempo lines
@@ -99,14 +95,6 @@ StreamView::~StreamView ()
undisplay_track ();
delete canvas_rect;
-
- if (owns_background_group) {
- delete _background_group;
- }
-
- if (owns_canvas_group) {
- delete _canvas_group;
- }
}
void
diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h
index 869772ed20..ce7991d2eb 100644
--- a/gtk2_ardour/streamview.h
+++ b/gtk2_ardour/streamview.h
@@ -83,7 +83,6 @@ public:
void set_layer_display (LayerDisplay);
LayerDisplay layer_display () const { return _layer_display; }
- ArdourCanvas::Group* background_group() { return _background_group; }
ArdourCanvas::Group* canvas_item() { return _canvas_group; }
enum ColorTarget {
@@ -129,7 +128,7 @@ public:
sigc::signal<void> ContentsHeightChanged;
protected:
- StreamView (RouteTimeAxisView&, ArdourCanvas::Group* background_group = 0, ArdourCanvas::Group* canvas_group = 0);
+ StreamView (RouteTimeAxisView&);
void transport_changed();
void transport_looped();
@@ -152,11 +151,8 @@ protected:
virtual void color_handler () = 0;
RouteTimeAxisView& _trackview;
- bool owns_background_group;
- bool owns_canvas_group;
- ArdourCanvas::Group* _background_group;
ArdourCanvas::Group* _canvas_group;
- ArdourCanvas::Rectangle* canvas_rect; /* frame around the whole thing */
+ ArdourCanvas::Rectangle* canvas_rect; /* frame around the whole thing */
typedef std::list<RegionView* > RegionViewList;
RegionViewList region_views;
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index a426656cf6..7d30ffed49 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -94,7 +94,6 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
compute_heights ();
}
- _canvas_background = new Group (ed.get_background_group (), ArdourCanvas::Duple (0.0, 0.0));
_canvas_display = new Group (ed.get_trackview_group (), ArdourCanvas::Duple (0.0, 0.0));
_canvas_display->hide(); // reveal as needed
@@ -189,9 +188,6 @@ TimeAxisView::~TimeAxisView()
delete selection_group;
selection_group = 0;
- delete _canvas_background;
- _canvas_background = 0;
-
delete _canvas_display;
_canvas_display = 0;
@@ -209,7 +205,6 @@ TimeAxisView::hide ()
}
_canvas_display->hide ();
- _canvas_background->hide ();
if (control_parent) {
control_parent->remove (time_axis_vbox);
@@ -255,15 +250,11 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
if (_y_position != y) {
_canvas_display->set_y_position (y);
- _canvas_background->set_y_position (y);
_y_position = y;
}
- _canvas_background->raise_to_top ();
_canvas_display->raise_to_top ();
-
- _canvas_background->show ();
_canvas_display->show ();
_hidden = false;
diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h
index 17b702ec38..7dc3ba9494 100644
--- a/gtk2_ardour/time_axis_view.h
+++ b/gtk2_ardour/time_axis_view.h
@@ -105,7 +105,6 @@ class TimeAxisView : public virtual AxisView
virtual void leave_internal_edit_mode () {}
ArdourCanvas::Group* canvas_display () { return _canvas_display; }
- ArdourCanvas::Group* canvas_background () { return _canvas_background; }
ArdourCanvas::Group* ghost_group () { return _ghost_group; }
/** @return effective height (taking children into account) in canvas units, or
@@ -279,7 +278,6 @@ class TimeAxisView : public virtual AxisView
void build_size_menu ();
private:
- ArdourCanvas::Group* _canvas_background;
Gtk::VBox* control_parent;
int _order;
uint32_t _effective_height;
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index bd00f5484d..ede06796df 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -29,7 +29,7 @@
#include "canvas/group.h"
#include "canvas/rectangle.h"
#include "canvas/debug.h"
-#include "canvas/pixbuf.h"
+#include "canvas/text.h"
#include "ardour_ui.h"
/*
@@ -80,7 +80,7 @@ TimeAxisViewItem::set_constant_heights ()
Gtkmm2ext::get_ink_pixel_size (layout, width, height);
NAME_HEIGHT = height;
- NAME_Y_OFFSET = height + 3;
+ NAME_Y_OFFSET = height + 4;
NAME_HIGHLIGHT_SIZE = height + 2;
NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 3;
}
@@ -157,7 +157,7 @@ TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & ba
show_vestigial = true;
visibility = vis;
_sensitive = true;
- name_pixbuf_width = 0;
+ name_text_width = 0;
last_item_width = 0;
wide_enough_for_name = wide;
high_enough_for_name = high;
@@ -169,7 +169,6 @@ TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & ba
vestigial_frame = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, 1.0, 2.0, trackview.current_height()));
vestigial_frame->hide ();
- vestigial_frame->set_outline_what (0xF);
vestigial_frame->set_outline_color (ARDOUR_UI::config()->canvasvar_VestigialFrame.get());
vestigial_frame->set_fill_color (ARDOUR_UI::config()->canvasvar_VestigialFrame.get());
@@ -179,18 +178,14 @@ TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & ba
trackview.editor().sample_to_pixel(duration),
trackview.current_height()));
- frame->set_outline_width (1);
- frame->set_outline_what (0xF);
-
if (_recregion) {
frame->set_outline_color (ARDOUR_UI::config()->canvasvar_RecordingRect.get());
} else {
frame->set_outline_color (ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get());
}
- frame->set_outline_what (0x1|0x2|0x4|0x8);
-
} else {
+
frame = 0;
}
@@ -199,15 +194,17 @@ TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & ba
if (visibility & FullWidthNameHighlight) {
name_highlight = new ArdourCanvas::Rectangle (group,
ArdourCanvas::Rect (0.0, trackview.editor().sample_to_pixel(item_duration),
- trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, trackview.current_height()));
+ trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE,
+ trackview.current_height()));
} else {
name_highlight = new ArdourCanvas::Rectangle (group,
ArdourCanvas::Rect (1.0, trackview.editor().sample_to_pixel(item_duration) - 1,
- trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, trackview.current_height()));
+ trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE,
+ trackview.current_height()));
}
name_highlight->set_data ("timeaxisviewitem", this);
- name_highlight->set_outline_what (0x4);
+ name_highlight->set_outline_what (ArdourCanvas::Rectangle::TOP);
/* we should really use a canvas color property here */
name_highlight->set_outline_color (RGBA_TO_UINT (0,0,0,255));
@@ -216,11 +213,12 @@ TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & ba
}
if (visibility & ShowNameText) {
- name_pixbuf = new ArdourCanvas::Pixbuf(group);
- name_pixbuf->set_position (ArdourCanvas::Duple (NAME_X_OFFSET, trackview.current_height() + 1 - NAME_Y_OFFSET));
-
+ name_text = new ArdourCanvas::Text (group);
+ name_text->set_position (ArdourCanvas::Duple (NAME_X_OFFSET, trackview.current_height() - NAME_Y_OFFSET));
+ name_text->set_font_description (NAME_FONT);
+
} else {
- name_pixbuf = 0;
+ name_text = 0;
}
/* create our grab handles used for trimming/duration etc */
@@ -229,9 +227,9 @@ TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & ba
double width = TimeAxisViewItem::GRAB_HANDLE_WIDTH;
frame_handle_start = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()));
- frame_handle_start->set_outline_what (0x0);
+ frame_handle_start->set_outline_what (ArdourCanvas::Rectangle::What (0));
frame_handle_end = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()));
- frame_handle_end->set_outline_what (0x0);
+ frame_handle_end->set_outline_what (ArdourCanvas::Rectangle::What (0));
} else {
frame_handle_start = frame_handle_end = 0;
}
@@ -256,7 +254,7 @@ TimeAxisViewItem::hide_rect ()
set_frame_color ();
if (name_highlight) {
- name_highlight->set_outline_what (0);
+ name_highlight->set_outline_what (ArdourCanvas::Rectangle::What (0));
name_highlight->set_fill_color (UINT_RGBA_CHANGE_A (fill_color, 64));
}
}
@@ -268,12 +266,11 @@ TimeAxisViewItem::show_rect ()
set_frame_color ();
if (name_highlight) {
- name_highlight->set_outline_what (0x4);
+ name_highlight->set_outline_what (ArdourCanvas::Rectangle::TOP);
name_highlight->set_fill_color (fill_color);
}
}
-
/**
* Set the position of this item on the timeline.
*
@@ -519,16 +516,16 @@ TimeAxisViewItem::get_time_axis_view () const
void
TimeAxisViewItem::set_name_text(const string& new_name)
{
- if (!name_pixbuf) {
+ if (!name_text) {
return;
}
last_item_width = trackview.editor().sample_to_pixel(item_duration);
- name_pixbuf_width = pixel_width (new_name, NAME_FONT) + 2;
- name_pixbuf->set (pixbuf_from_string(new_name, NAME_FONT, name_pixbuf_width, NAME_HEIGHT, Gdk::Color ("#000000")));
+ name_text_width = pixel_width (new_name, NAME_FONT) + 2;
+ name_text->set (new_name);
+ // CAIROCANVAS need to limit text to name_text_width or something
}
-
/**
* Set the height of this item.
*
@@ -561,7 +558,7 @@ TimeAxisViewItem::set_height (double height)
}
if (visibility & ShowNameText) {
- name_pixbuf->set_y_position (height + 1 - NAME_Y_OFFSET);
+ name_text->set_y_position (height + 1 - NAME_Y_OFFSET);
}
if (frame) {
@@ -574,7 +571,7 @@ TimeAxisViewItem::set_height (double height)
vestigial_frame->set_y1 (height - 1);
- update_name_pixbuf_visibility ();
+ update_name_text_visibility ();
set_colors ();
}
@@ -603,12 +600,6 @@ TimeAxisViewItem::get_name_highlight()
return name_highlight;
}
-ArdourCanvas::Pixbuf*
-TimeAxisViewItem::get_name_pixbuf()
-{
- return name_pixbuf;
-}
-
/**
* Calculate some contrasting color for displaying various parts of this item, based upon the base color.
*
@@ -887,7 +878,7 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
wide_enough_for_name = true;
}
- update_name_pixbuf_visibility ();
+ update_name_text_visibility ();
}
void
@@ -897,12 +888,12 @@ TimeAxisViewItem::reset_name_width (double /*pixel_width*/)
int pb_width;
bool pixbuf_holds_full_name;
- if (!name_pixbuf) {
+ if (!name_text) {
return;
}
it_width = trackview.editor().sample_to_pixel(item_duration);
- pb_width = name_pixbuf_width;
+ pb_width = name_text_width;
pixbuf_holds_full_name = last_item_width > pb_width + NAME_X_OFFSET;
last_item_width = it_width;
@@ -925,13 +916,15 @@ TimeAxisViewItem::reset_name_width (double /*pixel_width*/)
wide_enough_for_name = true;
}
- update_name_pixbuf_visibility ();
+ update_name_text_visibility ();
if (pb_width < 1) {
pb_width = 1;
}
- name_pixbuf->set (pixbuf_from_string(item_name, NAME_FONT, pb_width, NAME_HEIGHT, Gdk::Color ("#000000")));
+ name_text->set (item_name);
+ // CAIROCANVAS need to limit text length to pb_width
+
}
/**
@@ -958,16 +951,16 @@ TimeAxisViewItem::set_y (double y)
}
void
-TimeAxisViewItem::update_name_pixbuf_visibility ()
+TimeAxisViewItem::update_name_text_visibility ()
{
- if (!name_pixbuf) {
+ if (!name_text) {
return;
}
if (wide_enough_for_name && high_enough_for_name) {
- name_pixbuf->show ();
+ name_text->show ();
} else {
- name_pixbuf->hide ();
+ name_text->hide ();
}
}
diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h
index 2f4e5f465d..dd6ebe0120 100644
--- a/gtk2_ardour/time_axis_view_item.h
+++ b/gtk2_ardour/time_axis_view_item.h
@@ -33,6 +33,7 @@ namespace ArdourCanvas {
class Rectangle;
class Item;
class Group;
+ class Text;
}
using ARDOUR::framepos_t;
@@ -75,7 +76,6 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
ArdourCanvas::Item* get_canvas_frame();
ArdourCanvas::Group* get_canvas_group();
ArdourCanvas::Item* get_name_highlight();
- ArdourCanvas::Pixbuf* get_name_pixbuf();
virtual void set_samples_per_pixel (double);
@@ -165,7 +165,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
virtual void reset_width_dependent_items (double);
void reset_name_width (double);
- void update_name_pixbuf_visibility ();
+ void update_name_text_visibility ();
static gint idle_remove_this_item(TimeAxisViewItem*, void*);
@@ -228,7 +228,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
uint32_t lock_handle_color_g;
uint32_t lock_handle_color_b;
uint32_t last_item_width;
- int name_pixbuf_width;
+ int name_text_width;
bool wide_enough_for_name;
bool high_enough_for_name;
bool rect_visible;
@@ -236,7 +236,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
ArdourCanvas::Group* group;
ArdourCanvas::Rectangle* vestigial_frame;
ArdourCanvas::Rectangle* frame;
- ArdourCanvas::Pixbuf* name_pixbuf;
+ ArdourCanvas::Text* name_text;
ArdourCanvas::Rectangle* name_highlight;
/* with these two values, if frame_handle_start == 0 then frame_handle_end will also be 0 */