move all (G)UI related configuration parameters into UIConfiguration, not RCConfiguration
[ardour.git] / gtk2_ardour / editor_canvas_events.cc
index 4eeb323e9e7101f7d576a1e0b2c75e06793246e1..93c0abea356bf2be94e2ae58f9525151e8b067f9 100644 (file)
 
 #include "canvas/canvas.h"
 #include "canvas/text.h"
+#include "canvas/scroll_group.h"
 
 #include "editor.h"
 #include "keyboard.h"
 #include "public_editor.h"
+#include "ardour_ui.h"
 #include "audio_region_view.h"
 #include "audio_streamview.h"
 #include "audio_time_axis.h"
@@ -72,7 +74,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
         */
 
        Duple event_coords = _track_canvas->window_to_canvas (Duple (ev->x, ev->y));
-       
+
   retry:
        switch (direction) {
        case GDK_SCROLL_UP:
@@ -99,7 +101,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
                        current_stepping_trackview->step_height (false);
                        return true;
                } else {
-                       scroll_tracks_up_line ();
+                       scroll_up_one_track ();
                        return true;
                }
                break;
@@ -128,7 +130,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
                        current_stepping_trackview->step_height (true);
                        return true;
                } else {
-                       scroll_tracks_down_line ();
+                       scroll_down_one_track ();
                        return true;
                }
                break;
@@ -199,16 +201,6 @@ Editor::track_canvas_motion_notify_event (GdkEventMotion */*event*/)
        return false;
 }
 
-bool
-Editor::track_canvas_motion (GdkEvent *ev)
-{
-       if (_verbose_cursor->visible ()) {
-               _verbose_cursor->set_position (ev->motion.x + 10, ev->motion.y + 10);
-       }
-
-       return false;
-}
-
 bool
 Editor::typed_event (ArdourCanvas::Item* item, GdkEvent *event, ItemType type)
 {
@@ -1094,12 +1086,6 @@ Editor::canvas_playhead_cursor_event (GdkEvent *event, ArdourCanvas::Item* item)
        return typed_event (item, event, PlayheadCursorItem);
 }
 
-bool
-Editor::canvas_zoom_rect_event (GdkEvent *event, ArdourCanvas::Item* item)
-{
-       return typed_event (item, event, NoItem);
-}
-
 bool
 Editor::canvas_note_event (GdkEvent *event, ArdourCanvas::Item* item)
 {
@@ -1111,8 +1097,40 @@ Editor::canvas_note_event (GdkEvent *event, ArdourCanvas::Item* item)
 }
 
 bool
-Editor::canvas_drop_zone_event (GdkEvent* /*event*/)
+Editor::canvas_drop_zone_event (GdkEvent* event)
 {
+       GdkEventScroll scroll;  
+       ArdourCanvas::Duple winpos;
+       
+       switch (event->type) {
+       case GDK_BUTTON_RELEASE:
+               if (event->button.button == 1) {
+                       selection->clear_objects ();
+                       selection->clear_tracks ();
+               }
+               break;
+
+       case GDK_SCROLL:
+               /* convert coordinates back into window space so that
+                  we can just call canvas_scroll_event().
+               */
+               winpos = _track_canvas->canvas_to_window (Duple (event->scroll.x, event->scroll.y));
+               scroll = event->scroll;
+               scroll.x = winpos.x;
+               scroll.y = winpos.y;
+               return canvas_scroll_event (&scroll, true);
+               break;
+
+       case GDK_ENTER_NOTIFY:
+               return typed_event (_canvas_drop_zone, event, DropZoneItem);
+
+       case GDK_LEAVE_NOTIFY:
+               return typed_event (_canvas_drop_zone, event, DropZoneItem);
+
+       default:
+               break;
+       }
+
        return true;
 }
 
@@ -1140,7 +1158,7 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context,
 
        (void) window_event_sample (&event, &px, &py);
 
-       std::pair<TimeAxisView*, int> const tv = trackview_by_y_position (py);
+       std::pair<TimeAxisView*, int> const tv = trackview_by_y_position (py, false);
        bool can_drop = false;
        
        if (tv.first != 0) {
@@ -1184,7 +1202,7 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context,
                         * TODO: check if file is audio/midi, allow drops on same track-type only,
                         * currently: if audio is dropped on a midi-track, it is only added to the region-list
                         */
-                       if (Profile->get_sae() || Config->get_only_copy_imported_files()) {
+                       if (Profile->get_sae() || ARDOUR_UI::config()->get_only_copy_imported_files()) {
                                context->drag_status(Gdk::ACTION_COPY, time);
                        } else {
                                if ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY) {
@@ -1223,7 +1241,7 @@ Editor::drop_regions (const Glib::RefPtr<Gdk::DragContext>& /*context*/,
 
        framepos_t const pos = window_event_sample (&event, &px, &py);
 
-       std::pair<TimeAxisView*, int> const tv = trackview_by_y_position (py);
+       std::pair<TimeAxisView*, int> const tv = trackview_by_y_position (py, false);
 
        if (tv.first != 0) {