Remove unused editor hscroller code. Add buttons to the left and right of the summar...
authorCarl Hetherington <carl@carlh.net>
Tue, 1 Dec 2009 04:10:06 +0000 (04:10 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 1 Dec 2009 04:10:06 +0000 (04:10 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6239 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_hscroller.cc [deleted file]
gtk2_ardour/wscript

index 9034f4820a1bbd3747210fee03e9063b120c9f20..81e7974eb445d9a1681908a1755436188f47426c 100644 (file)
@@ -337,7 +337,6 @@ Editor::Editor ()
        button_release_can_deselect = true;
        _dragging_playhead = false;
        _dragging_edit_point = false;
-       _dragging_hscrollbar = false;
        select_new_marker = false;
        rhythm_ferret = 0;
        _bundle_manager = 0;
@@ -363,7 +362,6 @@ Editor::Editor ()
        current_canvas_cursor = 0;
 
        frames_per_unit = 2048; /* too early to use reset_zoom () */
-       reset_hscrollbar_stepping ();
 
        zoom_focus = ZoomFocusLeft;
        set_zoom_focus (ZoomFocusLeft);
@@ -462,15 +460,6 @@ Editor::Editor ()
        controls_layout.signal_button_release_event().connect (mem_fun(*this, &Editor::edit_controls_button_release));
        controls_layout_size_request_connection = controls_layout.signal_size_request().connect (mem_fun (*this, &Editor::controls_layout_size_request));
 
-       edit_vscrollbar.set_adjustment (vertical_adjustment);
-       edit_hscrollbar.set_adjustment (horizontal_adjustment);
-
-       edit_hscrollbar.signal_button_press_event().connect (mem_fun(*this, &Editor::hscrollbar_button_press), false);
-       edit_hscrollbar.signal_button_release_event().connect (mem_fun(*this, &Editor::hscrollbar_button_release), false);
-       edit_hscrollbar.signal_size_allocate().connect (mem_fun(*this, &Editor::hscrollbar_allocate));
-
-       edit_hscrollbar.set_name ("EditorHScrollbar");
-
        build_cursors ();
 
        ArdourCanvas::Canvas* time_pad = manage(new ArdourCanvas::Canvas());
@@ -557,12 +546,37 @@ Editor::Editor ()
        VPaned *editor_summary_pane = manage(new VPaned());
        editor_summary_pane->pack1(edit_packer);
 
+       Button* summary_arrows_left_left = manage (new Button);
+       summary_arrows_left_left->add (*manage (new Arrow (ARROW_LEFT, SHADOW_NONE)));
+       summary_arrows_left_left->signal_clicked().connect (mem_fun (*this, &Editor::horizontal_scroll_left));
+       Button* summary_arrows_left_right = manage (new Button);
+       summary_arrows_left_right->add (*manage (new Arrow (ARROW_RIGHT, SHADOW_NONE)));
+       summary_arrows_left_right->signal_clicked().connect (mem_fun (*this, &Editor::horizontal_scroll_right));
+       VBox* summary_arrows_left = manage (new VBox);
+       summary_arrows_left->pack_start (*summary_arrows_left_left);
+       summary_arrows_left->pack_start (*summary_arrows_left_right);
+
+       Button* summary_arrows_right_left = manage (new Button);
+       summary_arrows_right_left->add (*manage (new Arrow (ARROW_LEFT, SHADOW_NONE)));
+       summary_arrows_right_left->signal_clicked().connect (mem_fun (*this, &Editor::horizontal_scroll_left));
+       Button* summary_arrows_right_right = manage (new Button);
+       summary_arrows_right_right->add (*manage (new Arrow (ARROW_RIGHT, SHADOW_NONE)));
+       summary_arrows_right_right->signal_clicked().connect (mem_fun (*this, &Editor::horizontal_scroll_right));
+       VBox* summary_arrows_right = manage (new VBox);
+       summary_arrows_right->pack_start (*summary_arrows_right_left);
+       summary_arrows_right->pack_start (*summary_arrows_right_right);
+
        Frame* summary_frame = manage (new Frame);
        summary_frame->set_shadow_type (Gtk::SHADOW_ETCHED_IN);
        summary_frame->add (*_summary);
        summary_frame->show ();
 
-       editor_summary_pane->pack2(*summary_frame);
+       HBox* summary_hbox = manage (new HBox);
+       summary_hbox->pack_start (*summary_arrows_left, false, false);
+       summary_hbox->pack_start (*summary_frame, true, true);
+       summary_hbox->pack_start (*summary_arrows_right, false, false);
+       
+       editor_summary_pane->pack2(*summary_hbox);
 
        edit_pane.pack1 (*editor_summary_pane, true, true);
        edit_pane.pack2 (the_notebook, false, true);
@@ -4280,8 +4294,6 @@ Editor::post_zoom ()
 
        ZoomChanged (); /* EMIT_SIGNAL */
 
-       reset_hscrollbar_stepping ();
-
        if (session) {
                cef = session->current_end_frame() + (current_page_frames() / 10);// Add a little extra so we can see the end marker
        }
@@ -5058,3 +5070,20 @@ Editor::check_step_edit ()
 
        return true; // do it again, till we stop
 }
+
+void
+Editor::horizontal_scroll_left ()
+{
+       double x = leftmost_position() - current_page_frames() / 5;
+       if (x < 0) {
+               x = 0;
+       }
+       
+       reset_x_origin (x);
+}
+
+void
+Editor::horizontal_scroll_right ()
+{
+       reset_x_origin (leftmost_position() + current_page_frames() / 5);
+}
index 684637740c15a7c7b46ba67adbd54b49c5c4764c..bccc4b640dac82070f4f659596b97360e101f2ca 100644 (file)
@@ -882,14 +882,8 @@ class Editor : public PublicEditor
        void controls_layout_size_request (Gtk::Requisition*);
        sigc::connection controls_layout_size_request_connection;
 
-       Gtk::HScrollbar     edit_hscrollbar;
-       bool                _dragging_hscrollbar;
-
-       void reset_hscrollbar_stepping ();
-
-       bool hscrollbar_button_press (GdkEventButton*);
-       bool hscrollbar_button_release (GdkEventButton*);
-       void hscrollbar_allocate (Gtk::Allocation &alloc);
+       void horizontal_scroll_left ();
+       void horizontal_scroll_right ();
 
        double _canvas_width;
        double _canvas_height;
index 86d6256f1f9ec20cb090d45eddf415f19cd80cda..6ce5e79bce16e3501a6667442014ebbd6ecbb6e2 100644 (file)
@@ -363,7 +363,6 @@ Editor::track_canvas_size_allocated ()
        }
 
        handle_new_duration ();
-       reset_hscrollbar_stepping ();
        update_fixed_rulers();
        redisplay_tempo (false);
        _summary->set_overlays_dirty ();
diff --git a/gtk2_ardour/editor_hscroller.cc b/gtk2_ardour/editor_hscroller.cc
deleted file mode 100644 (file)
index 802d635..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-    Copyright (C) 2002 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "editor.h"
-
-#include "ardour/session.h"
-
-using namespace std;
-using namespace ARDOUR;
-using namespace PBD;
-
-void
-Editor::hscrollbar_allocate (Gtk::Allocation &)
-{
-}
-
-bool
-Editor::hscrollbar_button_press (GdkEventButton *)
-{
-       _dragging_hscrollbar = true;
-       return false;
-}
-
-bool
-Editor::hscrollbar_button_release (GdkEventButton *)
-{
-       _dragging_hscrollbar = false;
-
-       if (session) {
-
-       }
-
-       return false;
-}
-
-void
-Editor::reset_hscrollbar_stepping ()
-{
-       horizontal_adjustment.set_step_increment ((current_page_frames() / 5)/frames_per_unit); /* 5 clicks to scroll the entire page */
-       horizontal_adjustment.set_page_increment (current_page_frames()/frames_per_unit);
-}
index 216626709261a80ded54dfaf6a66ac80acd3efca..9c1b8ae3bfc6042fe35d116e01c1b71653d339d9 100644 (file)
@@ -79,7 +79,6 @@ gtk2_ardour_sources = [
        'editor_route_groups.cc',
        'editor_export_audio.cc',
        'editor_group_tabs.cc',
-       'editor_hscroller.cc',
        'editor_keyboard.cc',
        'editor_keys.cc',
        'editor_locations.cc',