use scroll handling instead of button 4/5 (incomplete)
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 23 Dec 2005 15:34:02 +0000 (15:34 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 23 Dec 2005 15:34:02 +0000 (15:34 +0000)
git-svn-id: svn://localhost/trunk/ardour2@204 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_ui2.cc
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_route_list.cc
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_axis_view.h

index f8cfd210f68f4c3d3012d775a9eba0c8eb11b628..291a0df0b67360aef9137f708d619322d9f6dccf 100644 (file)
@@ -626,11 +626,6 @@ ARDOUR_UI::shuttle_box_button_press (GdkEventButton* ev)
        case 3:
                return TRUE;
                break;
-
-       case 4:
-               break;
-       case 5:
-               break;
        }
 
        return TRUE;
index 8bb7dd8cc4dbb1752a6f45b09ab934181c107595..c413209f9b047b20a4fa682bbc252f8e68f1ac16 100644 (file)
@@ -321,7 +321,7 @@ Editor::Editor (AudioEngine& eng)
        ignore_route_list_reorder = false;
        verbose_cursor_on = true;
        route_removal = false;
-       track_spacing = 0;
+       track_spacing = 2;
        show_automatic_regions_in_region_list = true;
        have_pending_keyboard_selection = false;
        _follow_playhead = true;
@@ -386,11 +386,12 @@ Editor::Editor (AudioEngine& eng)
        track_canvas.signal_map_event().connect (mem_fun (*this, &Editor::track_canvas_map_handler));
        time_canvas.signal_map_event().connect (mem_fun (*this, &Editor::time_canvas_map_handler));
        
-       // edit_controls_hbox.pack_start (edit_controls_vbox, true, true);
        controls_layout.add (edit_controls_vbox);
        controls_layout.set_name ("EditControlsBase");
+       controls_layout.add_events (Gdk::SCROLL_MASK);
        controls_layout.signal_size_request().connect (mem_fun(*this, &Editor::set_layout_width), false);
-       controls_layout.signal_expose_event().connect (mem_fun(*this, &Editor::layout_expose), false);
+       controls_layout.signal_expose_event().connect (mem_fun(*this, &Editor::control_layout_expose), false);
+       controls_layout.signal_scroll_event().connect (mem_fun(*this, &Editor::control_layout_scroll), false);
        
        controls_layout.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
        controls_layout.signal_button_release_event().connect (mem_fun(*this, &Editor::edit_controls_button_release));
@@ -3920,8 +3921,29 @@ Editor::set_layout_width(Gtk::Requisition *r)
 }
 
 bool
-Editor::layout_expose (GdkEventExpose* ex)
+Editor::control_layout_expose (GdkEventExpose* ex)
 {
-       cerr << "layout_expose() called" << endl;
-       return TRUE;
+       cerr << "control layout_expose() called" << endl;
+       return true;
+}
+
+bool
+Editor::control_layout_scroll (GdkEventScroll* ev)
+{
+       switch (ev->direction) {
+       case GDK_SCROLL_UP:
+               scroll_tracks_up_line ();
+               return true;
+               break;
+
+       case GDK_SCROLL_DOWN:
+               scroll_tracks_down_line ();
+               return true;
+               
+       default:
+               /* no left/right handling yet */
+               break;
+       }
+
+       return false;
 }
index 7dc8b64dba68992612391e556f165e7ac583942d..28b65989708b4af05150ad014eda3e5a0f777480 100644 (file)
@@ -643,7 +643,8 @@ class Editor : public PublicEditor
 
        Gtk::Layout         controls_layout;
        void set_layout_width(Gtk::Requisition *);
-       bool Editor::layout_expose (GdkEventExpose* ex);
+       bool Editor::control_layout_expose (GdkEventExpose* ev);
+       bool Editor::control_layout_scroll (GdkEventScroll* ev);
 
        Gtk::HScrollbar     edit_hscrollbar;
        bool                edit_hscroll_dragging;
index f53a0296672844cb5a6077620747bb40e02575a1..f7f336beb3518722816ded69a915a822e89b520f 100644 (file)
@@ -224,10 +224,11 @@ Editor::route_list_reordered ()
 {
        TreeModel::Children rows = route_display_model->children();
        TreeModel::Children::iterator i;
-       long order;
+       uint32_t position;
+       uint32_t order;
        int n;
        
-       for (n = 0, order = 0, i = rows.begin(); i != rows.end(); ++i, ++order) {
+       for (n = 0, order = 0, position = 0, i = rows.begin(); i != rows.end(); ++i, ++order) {
                TimeAxisView *tv = (*i)[route_display_columns.tv];
                AudioTimeAxisView* at; 
                if (!ignore_route_list_reorder) {
@@ -237,12 +238,12 @@ Editor::route_list_reordered ()
                                */
                        
                        if ((at = dynamic_cast<AudioTimeAxisView*> (tv)) != 0) {
-                               at->route().set_order_key (N_("editor"), order);
+                               at->route().set_order_key (N_("editor"), position);
                        }
                }
                if (tv->marked_for_display()) {
-                       order += tv->show_at (order, n, &edit_controls_vbox);
-                       order += track_spacing;
+                       position += tv->show_at (position, n, &edit_controls_vbox);
+                       position += track_spacing;
                } else {
                        tv->hide ();
                }
@@ -251,7 +252,7 @@ Editor::route_list_reordered ()
                
        }
 
-       // controls_layout.queue_resize ();
+       controls_layout.queue_resize ();
        reset_scrolling_region ();
        return FALSE;
 }
index 8f9ba4c7f4151d36715f2627bc62bd80ca4cf235..f2a529cdb232215694165ee44bd99163d4737c67 100644 (file)
@@ -52,6 +52,7 @@
 #include "i18n.h"
 
 using namespace Gtk;
+using namespace Gdk;
 using namespace sigc; 
 using namespace ARDOUR;
 using namespace Editing;
@@ -125,11 +126,12 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
 
        controls_ebox.set_name ("TimeAxisViewControlsBaseUnselected");
        controls_ebox.add (controls_vbox);
-       controls_ebox.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
-       controls_ebox.set_flags (Gtk::CAN_FOCUS);
+       controls_ebox.add_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK|SCROLL_MASK);
+       controls_ebox.set_flags (CAN_FOCUS);
 
        controls_ebox.signal_button_release_event().connect (mem_fun (*this, &TimeAxisView::controls_ebox_button_release));
-       
+       controls_ebox.signal_scroll_event().connect (mem_fun (*this, &TimeAxisView::controls_ebox_scroll));
+
        controls_lhs_pad.set_name ("TimeAxisViewControlsPadding");
        controls_hbox.pack_start (controls_lhs_pad,false,false);
        controls_hbox.pack_start (controls_ebox,true,true);
@@ -137,7 +139,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
 
        controls_frame.add (controls_hbox);
        controls_frame.set_name ("TimeAxisViewControlsBaseUnselected");
-       controls_frame.set_shadow_type (Gtk::SHADOW_OUT);
+       controls_frame.set_shadow_type (Gtk::SHADOW_IN);
 }
 
 TimeAxisView::~TimeAxisView()
@@ -233,9 +235,37 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
        return effective_height;
 }
 
-gint
+bool
+TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
+{
+       switch (ev->direction) {
+       case GDK_SCROLL_UP:
+               if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
+                       step_height (true);
+                       return true;
+               }
+               break;
+               
+       case GDK_SCROLL_DOWN:
+               if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
+                       step_height (false);
+                       return true;
+               }
+               break;
+
+       default:
+               /* no handling for left/right, yet */
+               break;
+       }
+
+       return false;
+}
+
+bool
 TimeAxisView::controls_ebox_button_release (GdkEventButton* ev)
 {
+       cerr << "controls ebox button release button " << ev->button << endl;
+
        switch (ev->button) {
        case 1:
                selection_click (ev);
@@ -244,27 +274,9 @@ TimeAxisView::controls_ebox_button_release (GdkEventButton* ev)
        case 3:
                popup_display_menu (ev->time);
                break;
-
-       case 4:
-               if (Keyboard::no_modifier_keys_pressed (ev)) {
-                       editor.scroll_tracks_up_line ();
-               } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
-                       step_height (true);
-               }
-               break;
-
-       case 5:
-               if (Keyboard::no_modifier_keys_pressed (ev)) {
-                       editor.scroll_tracks_down_line ();
-               } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
-                       step_height (false);
-               }
-               break;
-               
-
        }
 
-       return TRUE;
+       return true;
 }
 
 void
index b230087325c1af67cadf92f163358a3c3bf05b3a..b2e73e876ae87d05f886689c07b31b933d60522a 100644 (file)
@@ -218,7 +218,8 @@ class TimeAxisView : public virtual AxisView
         * 
         *@ param ev the event
         */
-       virtual gint controls_ebox_button_release (GdkEventButton *ev);
+       virtual bool controls_ebox_button_release (GdkEventButton *ev);
+       virtual bool controls_ebox_scroll (GdkEventScroll *ev);
 
        /**
         * Displays the standard LHS control menu at when.