allow the use of static_cast for MGR ghost events (speeds things up a bit).
[ardour.git] / gtk2_ardour / editor_mouse.cc
index 01cb2175c16a056d0840048729f66b9a664f7bbf..e34c38c43cb61291291a7bff4bcc6aa0637dce88 100644 (file)
@@ -47,6 +47,7 @@
 #include "ardour/types.h"
 
 #include "actions.h"
+#include "ardour_ui.h"
 #include "editor.h"
 #include "time_axis_view.h"
 #include "audio_time_axis.h"
@@ -574,8 +575,13 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
                if (eff_mouse_mode != MouseRange) {
                        AutomationLine* al = reinterpret_cast<AutomationLine*> (item->get_data ("line"));
                        std::list<Selectable*> selectables;
+                       double mx = event->button.x;
+                       double my = event->button.y;
+
+                       al->grab_item().canvas_to_item (mx, my);
+
                        uint32_t before, after;
-                       framecnt_t const  where = (framecnt_t) floor (event->button.x * samples_per_pixel);
+                       framecnt_t const  where = (framecnt_t) floor (mx * samples_per_pixel);
 
                        if (!al || !al->control_points_adjacent (where, before, after)) {
                                break;
@@ -2136,6 +2142,16 @@ Editor::note_edit_done (int r, EditNoteDialog* d)
        commit_reversible_command();
 }
 
+void
+Editor::edit_region (RegionView* rv)
+{
+       if (UIConfiguration::instance().get_use_double_click_to_zoom_to_selection()) {
+               temporal_zoom_selection (Both);
+       } else {
+               rv->show_region_editor ();
+       }
+}
+
 void
 Editor::visible_order_range (int* low, int* high) const
 {
@@ -2510,7 +2526,7 @@ Editor::escape ()
                selection->clear ();
        }
 
-       reset_focus (&contents());
+       ARDOUR_UI::instance()->reset_focus (&contents());
 }
 
 /** Update _join_object_range_state which indicate whether we are over the top
@@ -2535,6 +2551,10 @@ Editor::update_join_object_range_location (double y)
 
        if (entered_regionview) {
 
+               //ToDo:  there is currently a bug here(?)
+               //when we are inside a region fade handle, it acts as though we are in range mode because it is in the top half of the region
+               //can it be fixed here?
+
                ArdourCanvas::Duple const item_space = entered_regionview->get_canvas_group()->canvas_to_item (ArdourCanvas::Duple (0, y));
                double const c = item_space.y / entered_regionview->height();