make autoscroll a bit easier to use, fix missing measure lines when moving the editor...
authorNick Mainsbridge <beatroute@iprimus.com.au>
Sat, 2 Sep 2006 02:54:04 +0000 (02:54 +0000)
committerNick Mainsbridge <beatroute@iprimus.com.au>
Sat, 2 Sep 2006 02:54:04 +0000 (02:54 +0000)
git-svn-id: svn://localhost/ardour2/trunk@885 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/canvas-simplerect.c
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_canvas.cc
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_ui.cc
gtk2_ardour/route_ui.h

index abddf5756b14d35246bb4c19af4c50db5ac439e4..d59096e68b40279d28139eedd078b2399077f69b 100644 (file)
@@ -263,7 +263,7 @@ gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item)
        GnomeCanvasSimpleRect* simplerect;
        double x1, x2, y1, y2;
        double old_x1, old_x2, old_y1, old_y2;
-       double a, b;
+       double a, b, c, d;
        
        old_x1 = item->x1;
        old_y1 = item->y1;
@@ -287,42 +287,24 @@ gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item)
        gnome_canvas_w2c (GNOME_CANVAS(item->canvas), x2, y2, &simplerect->bbox_lrx, &simplerect->bbox_lry);
 
        /* now queue redraws for changed areas */
-
-       if (item->x1 != old_x1) {
-               
-               /* left edge changed. redraw the area that altered */
                
                a = MIN(item->x1, old_x1); 
                b = MAX(item->x1, old_x1);
-               gnome_canvas_request_redraw (item->canvas, a - 1, item->y1, b + 1, item->y2);
-       }
-       
-       if (item->x2 != old_x2) {
-               
-               /* right edge changed. redraw the area that altered */
-               
-               a = MIN(item->x2, old_x2);
-               b = MAX(item->x2, old_x2);
-               gnome_canvas_request_redraw (item->canvas, a - 1, item->y1, b + 1, item->y2);
-       }
-       
-       if (item->y1 != old_y1) {
-               
-               /* top edge changed. redraw the area that altered */
-               
-               a = MIN(item->y1, old_y1);
-               b = MAX(item->y1, old_y1);
-               gnome_canvas_request_redraw (item->canvas, item->x1, a - 1, item->x2, b + 1);
-       }
-       
-       if (item->y2 != old_y2) {
-               
-               /* lower edge changed. redraw the area that altered */
-               
-               a = MIN(item->y2, old_y2);
-               b = MAX(item->y2, old_y2);
-               gnome_canvas_request_redraw (item->canvas, item->x1, a - 1, item->x2, b + 1);
-       }
+
+               a = MIN(a, item->x2);
+               a = MIN(a, old_x2);
+               b = MAX(b, item->x2);
+               b = MAX(b, old_x2);
+
+               c = MIN(item->y1, old_y1);
+               d = MAX(item->y1, old_y1);
+
+               c = MIN(c,item->y2);
+               c = MIN(c, old_y2);
+               d = MAX(d,item->y2);
+               d = MAX(d, old_y2);
+
+               gnome_canvas_request_redraw (item->canvas, a, c, b + 0.5, d + 0.5);
 }
 
 /* 
@@ -494,8 +476,8 @@ gnome_canvas_simplerect_update (GnomeCanvasItem *item, double *affine, ArtSVP *c
                gnome_canvas_request_redraw (item->canvas, 
                                           simplerect->bbox_ulx,
                                           simplerect->bbox_uly,
-                                          simplerect->bbox_lrx+1,
-                                          simplerect->bbox_lry+1);
+                                          simplerect->bbox_lrx+0.5,
+                                          simplerect->bbox_lry+0.5);
                simplerect->full_draw_on_update = FALSE;
        }
 
index f86b83504e12f6f8491c783ec2d89ac09845ed3a..7a8341dc2fa9a8777996f201bbbbb5ba27d35668 100644 (file)
@@ -643,7 +643,7 @@ Editor::Editor (AudioEngine& eng)
        edit_pane.pack1 (edit_packer, true, true);
        edit_pane.pack2 (the_notebook, false, true);
        
-       edit_pane.signal_size_allocate().connect_notify (bind (mem_fun(*this, &Editor::pane_allocation_handler), static_cast<Paned*> (&edit_pane)));
+       edit_pane.signal_size_allocate().connect (bind (mem_fun(*this, &Editor::pane_allocation_handler), static_cast<Paned*> (&edit_pane)));
 
        top_hbox.pack_start (toolbar_frame, true, true);
 
index 689e7e8ab817f48039744f065d91679e7e70f618..246fa7c608f2e17cfe21d786bd59542c04a7939f 100644 (file)
@@ -1506,7 +1506,7 @@ class Editor : public PublicEditor
        jack_nframes_t autoscroll_distance;
      
        static gint _autoscroll_canvas (void *);
-       gint autoscroll_canvas ();
+       bool autoscroll_canvas ();
        void start_canvas_autoscroll (int direction);
        void stop_canvas_autoscroll ();
        void maybe_autoscroll (GdkEvent*);
index 51138a5a673a167465f8ec7124f176e25e4a1ef3..946df13334291e71054be72d3c97865074f3c85c 100644 (file)
@@ -273,7 +273,6 @@ Editor::initialize_canvas ()
 void
 Editor::track_canvas_allocate (Gtk::Allocation alloc)
 {
-       static bool first_time = true;
 
        canvas_width = alloc.get_width();
        canvas_height = alloc.get_height();
@@ -320,12 +319,9 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc)
                
        update_fixed_rulers ();
 
-       if (is_visible() && first_time) {
+       if (is_visible()) {
                tempo_map_changed (Change (0));
-               first_time = false;
-       } else {
-               redisplay_tempo ();
-       }
+       } 
        
        Resized (); /* EMIT_SIGNAL */
 }
@@ -531,7 +527,7 @@ Editor::maybe_autoscroll (GdkEvent* event)
        }
 
 
-       if (autoscroll_direction != last_autoscroll_direction) {
+       if ((autoscroll_direction != last_autoscroll_direction) || (leftmost_frame < frame < rightmost_frame)) {
                stop_canvas_autoscroll ();
        }
        
@@ -545,14 +541,13 @@ Editor::maybe_autoscroll (GdkEvent* event)
 gint
 Editor::_autoscroll_canvas (void *arg)
 {
-       return ((Editor *) arg)->autoscroll_canvas ();
+        return ((Editor *) arg)->autoscroll_canvas ();
 }
 
-gint
+bool
 Editor::autoscroll_canvas ()
 {
        jack_nframes_t new_frame;
-       bool keep_calling = true;
        jack_nframes_t limit = max_frames - current_page_frames();
        GdkEventMotion ev;
        jack_nframes_t target_frame;
@@ -573,10 +568,6 @@ Editor::autoscroll_canvas ()
                target_frame = drag_info.current_pointer_frame + autoscroll_distance;
        }
 
-       if (new_frame != leftmost_frame) {
-               reposition_x_origin (new_frame);
-       }
-
        /* now fake a motion event to get the object that is being dragged to move too */
 
        ev.type = GDK_MOTION_NOTIFY;
@@ -596,20 +587,26 @@ Editor::autoscroll_canvas ()
 
                /* connect the timeout so that we get called repeatedly */
 
-               autoscroll_timeout_tag = g_timeout_add (20, _autoscroll_canvas, this);
-               keep_calling = false;
+               autoscroll_timeout_tag = g_idle_add ( _autoscroll_canvas, this);
+               return false;
+
+       } 
 
-       } else if (autoscroll_cnt == 50) { /* 0.5 seconds */
+       if (new_frame != leftmost_frame) {
+               reposition_x_origin (new_frame);
+       }
+
+       if (autoscroll_cnt == 50) { /* 0.5 seconds */
                
                /* after about a while, speed up a bit by changing the timeout interval */
 
-               autoscroll_distance = (jack_nframes_t) floor (current_page_frames()/50.0f);
+               autoscroll_distance = (jack_nframes_t) floor (current_page_frames()/30.0f);
                
-       } else if (autoscroll_cnt == 75) { /* 1.0 seconds */
+       } else if (autoscroll_cnt == 150) { /* 1.0 seconds */
 
                autoscroll_distance = (jack_nframes_t) floor (current_page_frames()/20.0f);
 
-       } else if (autoscroll_cnt == 100) { /* 1.5 seconds */
+       } else if (autoscroll_cnt == 300) { /* 1.5 seconds */
 
                /* after about another while, speed up by increasing the shift per callback */
 
@@ -617,7 +614,7 @@ Editor::autoscroll_canvas ()
 
        } 
 
-       return keep_calling;
+       return true;
 }
 
 void
@@ -634,7 +631,7 @@ Editor::start_canvas_autoscroll (int dir)
        autoscroll_cnt = 0;
        
        /* do it right now, which will start the repeated callbacks */
-       
+
        autoscroll_canvas ();
 }
 
index 27d1739fd4df44db426e37ea26c71d10a4efac97..c94d3d2e719c8af2f115082446d61b215d142871 100644 (file)
@@ -118,6 +118,8 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
 
        hide_button.add (*(manage (new Image (get_xpm("small_x.xpm")))));
 
+       /* XXX is this incomplete? i don't think its very useful atm
+
        solo_button->signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
        mute_button->signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
        playlist_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
@@ -125,6 +127,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
        size_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
        visual_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
        hide_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
+       */
 
        solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
        solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
@@ -140,7 +143,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
        if (is_track()) {
                rec_enable_button->set_active (false);
                rec_enable_button->set_name ("TrackRecordEnableButton");
-               rec_enable_button->signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
+               //rec_enable_button->signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
                rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
                controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
                ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record"));
index 2b95ff9cfb2804a3f94f5eb088812cead5530ee9..67433c33a4ad5bce7517cd02a3a87e00536f5e0c 100644 (file)
@@ -98,7 +98,7 @@ RouteUI::~RouteUI()
        delete mute_menu;
 }
 
-gint
+bool
 RouteUI::mute_press(GdkEventButton* ev)
 {
        if (!ignore_toggle) {
@@ -159,7 +159,7 @@ RouteUI::mute_press(GdkEventButton* ev)
        return true;
 }
 
-gint
+bool
 RouteUI::mute_release(GdkEventButton* ev)
 {
        if (!ignore_toggle) {
@@ -173,7 +173,7 @@ RouteUI::mute_release(GdkEventButton* ev)
        return true;
 }
 
-gint
+bool
 RouteUI::solo_press(GdkEventButton* ev)
 {
        if (!ignore_toggle) {
@@ -253,7 +253,7 @@ RouteUI::solo_press(GdkEventButton* ev)
        return true;
 }
 
-gint
+bool
 RouteUI::solo_release(GdkEventButton* ev)
 {
        if (!ignore_toggle) {
@@ -269,7 +269,7 @@ RouteUI::solo_release(GdkEventButton* ev)
        return true;
 }
 
-gint
+bool
 RouteUI::rec_enable_press(GdkEventButton* ev)
 {
        if (!ignore_toggle && is_track() && rec_enable_button) {
index 8a257028e9e7b868c216adc551630e6a1535615d..ea860419860883ad8496b2c713fb647571654de1 100644 (file)
@@ -87,11 +87,11 @@ class RouteUI : public virtual AxisView
 
        XMLNode* get_child_xml_node (const string & childname);
        
-       gint mute_press(GdkEventButton*);
-       gint mute_release(GdkEventButton*);
-       gint solo_press(GdkEventButton*);
-       gint solo_release(GdkEventButton*);
-       gint rec_enable_press(GdkEventButton*);
+       bool mute_press(GdkEventButton*);
+       bool mute_release(GdkEventButton*);
+       bool solo_press(GdkEventButton*);
+       bool solo_release(GdkEventButton*);
+       bool rec_enable_press(GdkEventButton*);
 
        void solo_changed(void*);
        void mute_changed(void*);