diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-11-03 10:07:00 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-11-03 10:07:00 -0500 |
commit | 08b485db75082a21c3814b0a4517f2b2fc994b77 (patch) | |
tree | 9ab7d5bf9190977d58767de9e246bf24fbe628a8 | |
parent | 85daa31ab56b078c556addb3c9faee0f88697c4d (diff) |
send enter events to EVERY newly entered item (ignore the bool return from the event handler); other canvas debugging aids;switch items_at_point() to use canvas coordinates
-rw-r--r-- | gtk2_ardour/automation_time_axis.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/ghostregion.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.h | 2 | ||||
-rw-r--r-- | libs/canvas/canvas.cc | 12 | ||||
-rw-r--r-- | libs/canvas/group.cc | 13 | ||||
-rw-r--r-- | libs/canvas/lookup_table.cc | 13 |
9 files changed, 43 insertions, 22 deletions
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index fd3c7aab52..21360bcab7 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -31,6 +31,8 @@ #include "ardour/route.h" #include "ardour/session.h" +#include "canvas/debug.h" + #include "ardour_ui.h" #include "automation_time_axis.h" #include "automation_streamview.h" @@ -88,6 +90,10 @@ AutomationTimeAxisView::AutomationTimeAxisView ( , auto_button (X_("")) /* force addition of a label */ , _show_regions (show_regions) { + CANVAS_DEBUG_NAME (_canvas_display, string_compose ("main for auto %2/%1", _name, r->name())); + CANVAS_DEBUG_NAME (selection_group, string_compose ("selections for auto %2/%1", _name, r->name())); + CANVAS_DEBUG_NAME (_ghost_group, string_compose ("ghosts for auto %2/%1", _name, r->name())); + if (!have_name_font) { name_font = get_font_for_style (X_("AutomationTrackName")); have_name_font = true; @@ -109,6 +115,7 @@ AutomationTimeAxisView::AutomationTimeAxisView ( first_call_to_set_height = true; _base_rect = new ArdourCanvas::Rectangle (_canvas_display); + CANVAS_DEBUG_NAME (_base_rect, string_compose ("base rect for %1", _name)); _base_rect->set_x1 (ArdourCanvas::COORD_MAX); _base_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_AutomationTrackOutline()); diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index e0ceb7a8e2..ac4c845dd6 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -91,11 +91,14 @@ Editor::initialize_canvas () /* a group to hold time (measure) lines */ time_line_group = new ArdourCanvas::Group (_track_canvas->root()); + CANVAS_DEBUG_NAME (time_line_group, "time line group"); transport_loop_range_rect = new ArdourCanvas::Rectangle (time_line_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, ArdourCanvas::COORD_MAX)); + CANVAS_DEBUG_NAME (transport_loop_range_rect, "loop rect"); transport_loop_range_rect->hide(); transport_punch_range_rect = new ArdourCanvas::Rectangle (time_line_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, ArdourCanvas::COORD_MAX)); + CANVAS_DEBUG_NAME (transport_punch_range_rect, "punch rect"); transport_punch_range_rect->hide(); _trackview_group = new ArdourCanvas::Group (_track_canvas->root()); diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc index 5350a0e459..f75982cc76 100644 --- a/gtk2_ardour/ghostregion.cc +++ b/gtk2_ardour/ghostregion.cc @@ -43,7 +43,7 @@ GhostRegion::GhostRegion (ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxi , source_trackview (source_tv) { group = new ArdourCanvas::Group (parent); - CANVAS_DEBUG_NAME (group, "ghost region group"); + CANVAS_DEBUG_NAME (group, "ghost region"); group->set_position (ArdourCanvas::Duple (initial_pos, 0)); base_rect = new ArdourCanvas::Rectangle (group); diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index ad2ad2233d..b1f758fd26 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -50,8 +50,11 @@ #include "ardour/route_group.h" #include "ardour/session.h" #include "ardour/session_playlists.h" + #include "evoral/Parameter.hpp" +#include "canvas/debug.h" + #include "ardour_ui.h" #include "ardour_button.h" #include "debug.h" @@ -111,6 +114,10 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt) { RouteUI::set_route (rt); + CANVAS_DEBUG_NAME (_canvas_display, string_compose ("main for %1", rt->name())); + CANVAS_DEBUG_NAME (selection_group, string_compose ("selections for %1", rt->name())); + CANVAS_DEBUG_NAME (_ghost_group, string_compose ("ghosts for %1", rt->name())); + int meter_width = 3; if (_route && _route->shared_peak_meter()->input_streams().n_total() == 1) { meter_width = 6; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index fa181476cf..c45887cb7e 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -26,6 +26,7 @@ #include "pbd/error.h" #include "pbd/convert.h" +#include "pbd/stacktrace.h" #include <gtkmm2ext/doi.h> #include <gtkmm2ext/utils.h> @@ -76,6 +77,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie , display_menu (0) , parent (rent) , selection_group (0) + , _ghost_group (0) , _hidden (false) , in_destructor (false) , _size_menu (0) @@ -89,7 +91,6 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie , _resize_drag_start (-1) , _preresize_cursor (0) , _have_preresize_cursor (false) - , _ghost_group (0) , _ebox_release_can_act (true) { if (extra_height == 0) { @@ -97,13 +98,16 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie } _canvas_display = new Group (ed.get_trackview_group (), ArdourCanvas::Duple (0.0, 0.0)); + CANVAS_DEBUG_NAME (_canvas_display, "main for TAV"); _canvas_display->hide(); // reveal as needed selection_group = new Group (_canvas_display); + CANVAS_DEBUG_NAME (selection_group, "selection for TAV"); selection_group->set_data (X_("timeselection"), (void *) 1); selection_group->hide(); _ghost_group = new Group (_canvas_display); + CANVAS_DEBUG_NAME (_ghost_group, "ghost for TAV"); _ghost_group->lower_to_bottom(); _ghost_group->show(); diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index 7dc3ba9494..a22ba94439 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -212,6 +212,7 @@ class TimeAxisView : public virtual AxisView Gtk::Menu* display_menu; /* The standard LHS Track control popup-menus */ TimeAxisView* parent; ArdourCanvas::Group* selection_group; + ArdourCanvas::Group* _ghost_group; std::list<GhostRegion*> ghosts; std::list<SelectionRect*> free_selection_rects; std::list<SelectionRect*> used_selection_rects; @@ -284,7 +285,6 @@ private: double _resize_drag_start; GdkCursor* _preresize_cursor; bool _have_preresize_cursor; - ArdourCanvas::Group* _ghost_group; bool _ebox_release_can_act; static uint32_t button_height; diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc index e8e72d6540..22243edc8f 100644 --- a/libs/canvas/canvas.cc +++ b/libs/canvas/canvas.cc @@ -355,7 +355,7 @@ GtkCanvas::enter_leave_items (Duple const & point, int state) for (i = items.begin(); i != items.end(); ++i) { new_item = *i; - + if (new_item->ignore_events() || !new_item->visible()) { continue; } @@ -380,7 +380,6 @@ GtkCanvas::enter_leave_items (Duple const & point, int state) boost::optional<Rect> bbox = new_item->bounding_box(); - if (bbox) { if (!new_item->item_to_canvas (bbox.get()).contains (point)) { leave_event.detail = GDK_NOTIFY_UNKNOWN; @@ -400,14 +399,11 @@ GtkCanvas::enter_leave_items (Duple const & point, int state) for (vector<Item const*>::const_iterator i = newly_entered.begin(); i != newly_entered.end(); ++i) { new_item = *i; - - if (new_item->Event (reinterpret_cast<GdkEvent*> (&enter_event))) { - DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("Enter %1 %2\n", new_item->whatami(), new_item->name)); - break; - } + new_item->Event (reinterpret_cast<GdkEvent*> (&enter_event)); + DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("Enter %1 %2\n", new_item->whatami(), new_item->name)); } -#if 1 +#if 0 cerr << "Within:\n"; for (set<Item const *>::const_iterator i = within_items.begin(); i != within_items.end(); ++i) { cerr << '\t' << (*i)->whatami() << '/' << (*i)->name << endl; diff --git a/libs/canvas/group.cc b/libs/canvas/group.cc index 54c50ac595..6293155021 100644 --- a/libs/canvas/group.cc +++ b/libs/canvas/group.cc @@ -99,7 +99,7 @@ Group::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const if (!item_bbox) { #ifdef CANVAS_DEBUG if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) { - // cerr << _canvas->render_indent() << "Item " << (*i)->whatami() << " [" << (*i)->name << "] empty - skipped\n"; + cerr << _canvas->render_indent() << "Item " << (*i)->whatami() << " [" << (*i)->name << "] empty - skipped\n"; } #endif continue; @@ -136,8 +136,8 @@ Group::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const #ifdef CANVAS_DEBUG if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) { - //cerr << string_compose ("%1skip render of %2 %3, no intersection\n", _canvas->render_indent(), (*i)->whatami(), - // (*i)->name); + cerr << string_compose ("%1skip render of %2 %3, no intersection\n", _canvas->render_indent(), (*i)->whatami(), + (*i)->name); } #endif @@ -293,17 +293,16 @@ Group::child_changed () void Group::add_items_at_point (Duple const point, vector<Item const *>& items) const { - /* Point is in parent coordinate system */ + /* Point is in canvas coordinate system */ boost::optional<Rect> const bbox = bounding_box (); - if (!bbox || !bbox.get().contains (point)) { + if (!bbox || !item_to_canvas (bbox.get()).contains (point)) { return; } /* this adds this group itself to the list of items at point */ Item::add_items_at_point (point, items); - /* now recurse and add any items within our group that contain point */ @@ -311,7 +310,7 @@ Group::add_items_at_point (Duple const point, vector<Item const *>& items) const vector<Item*> our_items = _lut->items_at_point (point); for (vector<Item*>::iterator i = our_items.begin(); i != our_items.end(); ++i) { - (*i)->add_items_at_point (point - (*i)->position(), items); + (*i)->add_items_at_point (point, items); } } diff --git a/libs/canvas/lookup_table.cc b/libs/canvas/lookup_table.cc index 9b47dcf0d7..38b8be4afb 100644 --- a/libs/canvas/lookup_table.cc +++ b/libs/canvas/lookup_table.cc @@ -52,16 +52,21 @@ DumbLookupTable::get (Rect const &) vector<Item *> DumbLookupTable::items_at_point (Duple point) const { - /* Point is in parent coordinate system */ + /* Point is in canvas coordinate system */ - list<Item *> items = _group.items (); + list<Item *> const & items (_group.items ()); vector<Item *> vitems; for (list<Item *>::const_iterator i = items.begin(); i != items.end(); ++i) { + + if (!(*i)->visible()) { + continue; + } + boost::optional<Rect> item_bbox = (*i)->bounding_box (); + if (item_bbox) { - Rect canvas_bbox = (*i)->item_to_parent (item_bbox.get ()); - if (canvas_bbox.contains (point)) { + if ((*i)->item_to_canvas (item_bbox.get ()).contains (point)) { vitems.push_back (*i); } } |