use virtual bool canvas_group_event () in TimeAxisViewItems to get suitably delegatab...
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 25 Apr 2013 20:06:12 +0000 (16:06 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 25 Apr 2013 20:06:12 +0000 (16:06 -0400)
gtk2_ardour/midi_region_view.cc
gtk2_ardour/midi_region_view.h
gtk2_ardour/note_base.cc
gtk2_ardour/region_view.cc
gtk2_ardour/region_view.h
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_axis_view_item.cc
gtk2_ardour/time_axis_view_item.h

index 08211b6e840da2a2059b1fba834e9e67a1f0913d..e5a48994f8ecc7972ea037af7301055bce23d7d7 100644 (file)
@@ -43,7 +43,7 @@
 #include "evoral/Control.hpp"
 #include "evoral/midi_util.h"
 
-#include "canvas/pixbuf.h"
+#include "canvas/debug.h"
 
 #include "automation_region_view.h"
 #include "automation_time_axis.h"
@@ -114,6 +114,7 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
        , pre_press_cursor (0)
        , _note_player (0)
 {
+       CANVAS_DEBUG_NAME (_note_group, string_compose ("note group for %1", get_item_name()));
        _note_group->raise_to_top();
        PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
 
@@ -150,7 +151,9 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
        , pre_press_cursor (0)
        , _note_player (0)
 {
+       CANVAS_DEBUG_NAME (_note_group, string_compose ("note group for %1", get_item_name()));
        _note_group->raise_to_top();
+
        PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
 
        connect_to_diskstream ();
@@ -276,8 +279,6 @@ MidiRegionView::init (Gdk::Color const & basic_color, bool wfd)
        reset_width_dependent_items (_pixel_width);
 
        group->raise_to_top();
-       group->Event.connect (sigc::mem_fun (this, &MidiRegionView::canvas_event));
-
 
        midi_view()->midi_track()->PlaybackChannelModeChanged.connect (_channel_mode_changed_connection, invalidator (*this),
                                                                       boost::bind (&MidiRegionView::midi_channel_mode_changed, this),
@@ -319,7 +320,7 @@ MidiRegionView::connect_to_diskstream ()
 }
 
 bool
-MidiRegionView::canvas_event(GdkEvent* ev)
+MidiRegionView::canvas_group_event(GdkEvent* ev)
 {
        bool r;
 
@@ -385,7 +386,7 @@ MidiRegionView::canvas_event(GdkEvent* ev)
                break;
        }
 
-       return false;
+       return trackview.editor().canvas_region_view_event (ev, group, this);
 }
 
 void
@@ -626,7 +627,6 @@ MidiRegionView::motion (GdkEventMotion* ev)
                        MouseMode m = editor.current_mouse_mode();
                        
                        if (m == MouseDraw || (m == MouseObject && Keyboard::modifier_state_contains (ev->state, Keyboard::insert_note_modifier()))) {
-                       
                                editor.drags()->set (new NoteCreateDrag (dynamic_cast<Editor *> (&editor), group, this), (GdkEvent *) ev);
                                _mouse_state = AddDragging;
                                remove_ghost_note ();
index 3c001473935a82f0228966dec18ee9ef9cd27102..5a5c74cb2ca5c5ea9f067edae35f47ee8a73b38f 100644 (file)
@@ -349,7 +349,7 @@ private:
 
        void clear_events (bool with_selection_signal = true);
 
-       bool canvas_event(GdkEvent* ev);
+       bool canvas_group_event(GdkEvent* ev);
        bool note_canvas_event(GdkEvent* ev);
 
        void midi_channel_mode_changed ();
index e2ff2c1797707bfb177913a83f765587e865de99..93316741590cc4433b08cf99cf70b59388f82d48 100644 (file)
@@ -199,7 +199,7 @@ NoteBase::set_selected(bool selected)
        }
 
        _selected = selected;
-       set_fill_color (base_color ());
+       set_fill_color (base_color());
         
        if (_selected) {
                set_outline_color(calculate_outline(ARDOUR_UI::config()->get_canvasvar_MidiNoteSelected()));
index ac7fe7e8fa05a376d77b9878bc7afe1824068c16..530d046f5ae8d823cb1471b62a01dc099ec71380 100644 (file)
@@ -196,8 +196,6 @@ RegionView::init (Gdk::Color const & basic_color, bool wfd)
 
        _region->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&RegionView::region_changed, this, _1), gui_context());
 
-       group->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_event), group, this));
-
        set_colors ();
 
        ColorsChanged.connect (sigc::mem_fun (*this, &RegionView::color_handler));
@@ -222,6 +220,12 @@ RegionView::~RegionView ()
        delete editor;
 }
 
+bool
+RegionView::canvas_group_event (GdkEvent* event)
+{
+       return trackview.editor().canvas_region_view_event (event, group, this);
+}
+
 void
 RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*threshold*/)
 {
index 74d1f29581cb762de84c5d748f0ff7e3ec964c00..16df6be245c1705e0bddd2679e22921d40aa95e6 100644 (file)
@@ -135,6 +135,8 @@ class RegionView : public TimeAxisViewItem
                    bool recording,
                    TimeAxisViewItem::Visibility);
 
+        bool canvas_group_event (GdkEvent*);
+
        virtual void region_resized (const PBD::PropertyChange&);
        virtual void region_muted ();
        void         region_locked ();
index 280802ab6818132854852a28a418fc169727c421..7957a591f887ee8d259bf56e653f70ff73c64ca4 100644 (file)
@@ -942,16 +942,18 @@ TimeAxisView::get_selection_rect (uint32_t id)
 
                rect->rect = new ArdourCanvas::Rectangle (selection_group);
                CANVAS_DEBUG_NAME (rect->rect, "selection rect");
-               rect->rect->set_outline_what (0);
+               rect->rect->set_outline (false);
                rect->rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_SelectionRect());
 
                rect->start_trim = new ArdourCanvas::Rectangle (selection_group);
                CANVAS_DEBUG_NAME (rect->rect, "selection rect start trim");
-               rect->start_trim->set_outline_what (0);
+               rect->start_trim->set_outline (false);
+               rect->start_trim->set_fill (false);
 
                rect->end_trim = new ArdourCanvas::Rectangle (selection_group);
                CANVAS_DEBUG_NAME (rect->rect, "selection rect end trim");
-               rect->end_trim->set_outline_what (0);
+               rect->end_trim->set_outline (false);
+               rect->end_trim->set_fill (false);
 
                free_selection_rects.push_front (rect);
 
index 76a21ce4aaae9adfd0614afcffce73ada497f706..b25ed5a934b33528e6285de25c661f60e0ac22dd 100644 (file)
@@ -111,10 +111,7 @@ TimeAxisViewItem::TimeAxisViewItem(
        , _automation (automation)
        , _dragging (false)
 {
-       group = new ArdourCanvas::Group (&parent);
-       CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", it_name));
-
-       init (it_name, spu, base_color, start, duration, vis, true, true);
+       init (it_name, &parent, spu, base_color, start, duration, vis, true, true);
 }
 
 TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
@@ -136,21 +133,22 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
        /* share the other's parent, but still create a new group */
 
        ArdourCanvas::Group* parent = other.group->parent();
-
-       group = new ArdourCanvas::Group (parent);
-       CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", get_item_name()));
-
+       
        _selected = other._selected;
-
-       init (other.item_name, other.samples_per_pixel, c, other.frame_position,
+       
+       init (other.item_name, parent, other.samples_per_pixel, c, other.frame_position,
              other.item_duration, other.visibility, other.wide_enough_for_name, other.high_enough_for_name);
 }
 
 void
-TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & base_color, 
+TimeAxisViewItem::init (const string& it_name, ArdourCanvas::Group* parent, double fpp, Gdk::Color const & base_color, 
                        framepos_t start, framepos_t duration, Visibility vis, 
                        bool wide, bool high)
 {
+       group = new ArdourCanvas::Group (parent);
+       CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", get_item_name()));
+       group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event));
+
        item_name = it_name;
        samples_per_pixel = fpp;
        frame_position = start;
@@ -266,6 +264,12 @@ TimeAxisViewItem::~TimeAxisViewItem()
        delete group;
 }
 
+bool
+TimeAxisViewItem::canvas_group_event (GdkEvent* ev)
+{
+       return false;
+}
+
 void
 TimeAxisViewItem::hide_rect ()
 {
index 08cc4212020cc56509a0e98050f5f6449793c396..fc9ab4106e6b0604c2234fd20d26c7d0eed7a00b 100644 (file)
@@ -157,7 +157,9 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
 
        TimeAxisViewItem (const TimeAxisViewItem&);
 
-       void init (const std::string&, double, Gdk::Color const &, framepos_t, framepos_t, Visibility, bool, bool);
+        void init (const std::string&, ArdourCanvas::Group*, double, Gdk::Color const &, framepos_t, framepos_t, Visibility, bool, bool);
+
+        virtual bool canvas_group_event (GdkEvent*);
 
        virtual void compute_colors (Gdk::Color const &);
        virtual void set_colors();