From 9e4f8633f43f63993fce513960eae248f9d7fe78 Mon Sep 17 00:00:00 2001 From: Nick Mainsbridge Date: Sat, 20 Sep 2008 09:06:49 +0000 Subject: Don't defer Editor::track_canvas_size_allocated () (defer the timebar redrawing instead) + some performance improvements to said function, fix puzzling ineffective thinko wrt region movement, show/hide playhead more sensibly. git-svn-id: svn://localhost/ardour2/branches/3.0@3771 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardev_common.sh.in | 2 +- gtk2_ardour/editor.cc | 7 ++-- gtk2_ardour/editor.h | 2 -- gtk2_ardour/editor_canvas.cc | 72 ++++++++++++++---------------------------- gtk2_ardour/editor_cursors.cc | 8 +---- gtk2_ardour/editor_mixer.cc | 2 ++ gtk2_ardour/editor_mouse.cc | 8 ++--- 7 files changed, 34 insertions(+), 67 deletions(-) diff --git a/gtk2_ardour/ardev_common.sh.in b/gtk2_ardour/ardev_common.sh.in index 4da49bcb4c..3e223fe8cc 100644 --- a/gtk2_ardour/ardev_common.sh.in +++ b/gtk2_ardour/ardev_common.sh.in @@ -7,7 +7,7 @@ export ARDOUR_DATA_PATH=gtk2_ardour:. export GTK_PATH=libs/clearlooks export VAMP_PATH=libs/vamp-plugins:$VAMP_PATH -export LD_LIBRARY_PATH=libs/vamp-sdk:libs/surfaces/control_protocol:libs/ardour:libs/midi++2:libs/pbd:libs/rubberband:libs/soundtouch:libs/gtkmm2ext:libs/sigc++2:libs/glibmm2:libs/gtkmm2/atk:libs/gtkmm2/pango:libs/gtkmm2/gdk:libs/gtkmm2/gtk:libs/libgnomecanvasmm:libs/libsndfile:libs/appleutility:libs/cairomm:libs/taglib:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=libs/vamp-sdk:libs/surfaces/control_protocol:libs/ardour:libs/midi++2:libs/pbd:libs/rubberband:libs/soundtouch:libs/gtkmm2ext:libs/sigc++2:libs/glibmm2:libs/gtkmm2/atk:libs/gtkmm2/pango:libs/gtkmm2/gdk:libs/gtkmm2/gtk:libs/libgnomecanvasmm:libs/libsndfile:libs/appleutility:libs/cairomm:libs/taglib:libs/evoral:$LD_LIBRARY_PATH # DYLD_LIBRARY_PATH is for darwin. export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 510b0f8537..bc6a20de9f 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -347,7 +347,6 @@ Editor::Editor () last_canvas_frame = 0; playhead_cursor = 0; button_release_can_deselect = true; - canvas_idle_queued = false; _dragging_playhead = false; _dragging_edit_point = false; _dragging_hscrollbar = false; @@ -1267,6 +1266,8 @@ Editor::connect_to_session (Session *t) nudge_clock.set_session (session); nudge_clock.set (session->frame_rate() * 5); // default of 5 seconds + playhead_cursor->canvas_item.show (); + if (rhythm_ferret) { rhythm_ferret->set_session (session); } @@ -4304,8 +4305,6 @@ Editor::session_state_saved (string snap_name) void Editor::maximise_editing_space () { - initial_ruler_update_required = true; - mouse_mode_tearoff->set_visible (false); tools_tearoff->set_visible (false); @@ -4329,8 +4328,6 @@ Editor::maximise_editing_space () void Editor::restore_editing_space () { - initial_ruler_update_required = true; - // user changed width of pane during fullscreen if(post_maximal_pane_position != edit_pane.get_position()) { diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index d2b0043d66..9d1922ae09 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -261,7 +261,6 @@ class Editor : public PublicEditor void set_show_measures (bool yn); bool show_measures () const { return _show_measures; } - bool initial_ruler_update_required; #ifdef FFT_ANALYSIS /* analysis window */ @@ -1504,7 +1503,6 @@ public: bool track_canvas_motion_notify_event (GdkEventMotion* event); Gtk::Allocation canvas_allocation; - bool canvas_idle_queued; void track_canvas_allocate (Gtk::Allocation alloc); bool track_canvas_size_allocated (); diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 27a6eb479e..c72c9b4e3e 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -258,8 +258,6 @@ Editor::initialize_canvas () playhead_cursor = new Cursor (*this, &Editor::canvas_playhead_cursor_event); - initial_ruler_update_required = true; - if (logo_item) { logo_item->lower_to_bottom (); } @@ -303,26 +301,13 @@ void Editor::track_canvas_allocate (Gtk::Allocation alloc) { canvas_allocation = alloc; - - if (!initial_ruler_update_required) { - if (!canvas_idle_queued) { - /* call this first so that we do stuff before any pending redraw */ - Glib::signal_idle().connect (mem_fun (*this, &Editor::track_canvas_size_allocated), false); - canvas_idle_queued = true; - } - return; - } - - initial_ruler_update_required = false; track_canvas_size_allocated (); } bool Editor::track_canvas_size_allocated () { - if (canvas_idle_queued) { - canvas_idle_queued = false; - } + bool height_changed = canvas_height != canvas_allocation.get_height(); canvas_width = canvas_allocation.get_width(); canvas_height = canvas_allocation.get_height(); @@ -340,45 +325,36 @@ Editor::track_canvas_size_allocated () } full_canvas_height = height + canvas_timebars_vsize; + } else { + return true; } - zoom_range_clock.set ((nframes64_t) floor ((canvas_width * frames_per_unit))); - playhead_cursor->set_position (playhead_cursor->current_frame); - + if (height_changed) { + if (playhead_cursor) { + playhead_cursor->set_length (canvas_height); + } + + vertical_adjustment.set_page_size (canvas_height); + + for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) { + (*x)->set_line_vpos (0, canvas_height); + } + + // marker_drag_line_points.back().set_y(canvas_height); + range_marker_drag_rect->property_y2() = canvas_height; + transport_loop_range_rect->property_y2() = canvas_height; + transport_punch_range_rect->property_y2() = canvas_height; + transport_punchin_line->property_y2() = canvas_height; + transport_punchout_line->property_y2() = canvas_height; + } horizontal_adjustment.set_upper (session->current_end_frame()/frames_per_unit); horizontal_adjustment.set_page_size (current_page_frames()/frames_per_unit); - reset_hscrollbar_stepping (); - - if (playhead_cursor) { - playhead_cursor->set_length (canvas_height); - } - - vertical_adjustment.set_page_size (canvas_height); - - for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) { - (*x)->set_line_vpos (0, canvas_height); - } - - marker_drag_line_points.back().set_y(canvas_height); - range_marker_drag_rect->property_y2() = canvas_height; - transport_loop_range_rect->property_y2() = canvas_height; - transport_punch_range_rect->property_y2() = canvas_height; - transport_punchin_line->property_y2() = canvas_height; - transport_punchout_line->property_y2() = canvas_height; - - tempo_bar->property_x2() = canvas_width; - meter_bar->property_x2() = canvas_width; - marker_bar->property_x2() = canvas_width; - cd_marker_bar->property_x2() = canvas_width; - range_marker_bar->property_x2() = canvas_width; - transport_marker_bar->property_x2() = canvas_width; - update_fixed_rulers(); - redisplay_tempo (true); - + redisplay_tempo (false); + Resized (); /* EMIT_SIGNAL */ - + return false; } diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc index ca00ec61d2..0f5c414408 100644 --- a/gtk2_ardour/editor_cursors.cc +++ b/gtk2_ardour/editor_cursors.cc @@ -64,10 +64,6 @@ Editor::Cursor::set_position (nframes64_t frame) { double new_pos = editor.frame_to_unit (frame); - if (editor.session == 0) { - canvas_item.hide(); - } - current_frame = frame; if (new_pos != points.front().get_x()) { points.front().set_x (new_pos); @@ -75,6 +71,7 @@ Editor::Cursor::set_position (nframes64_t frame) canvas_item.property_points() = points; } + current_frame = frame; } void @@ -83,9 +80,6 @@ Editor::Cursor::set_length (double units) length = units; points.back().set_y (points.front().get_y() + length); canvas_item.property_points() = points; - if (editor.session != 0) { - canvas_item.show(); - } } void diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index e770e09960..d6ce61fc48 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -324,6 +324,8 @@ Editor::session_going_away () drag_info.item = 0; last_canvas_frame = 0; + playhead_cursor->canvas_item.hide (); + /* hide all tracks */ hide_all_tracks (false); diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 6574af5ecf..32b84434b1 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -3576,7 +3576,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) } rv2->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2); - rv2->get_canvas_group()->i2w (ix1, iy1); + rv2->get_canvas_frame()->i2w (ix1, iy1); iy1 += vertical_adjustment.get_value() - canvas_timebars_vsize; TimeAxisView* tvp2 = trackview_by_y_position (iy1); @@ -3735,7 +3735,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) double ix1, ix2, iy1, iy2; rv2->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2); - rv2->get_canvas_group()->i2w (ix1, iy1); + rv2->get_canvas_frame()->i2w (ix1, iy1); if (-x_delta > ix1 + horizontal_adjustment.get_value()) { // do_move = false; @@ -3802,7 +3802,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) */ rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2); - rv->get_canvas_group()->i2w (ix1, iy1); + rv->get_canvas_frame()->i2w (ix1, iy1); if (drag_info.first_move) { @@ -4009,7 +4009,7 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event RegionView* rv = (*i); double ix1, ix2, iy1, iy2; rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2); - rv->get_canvas_group()->i2w (ix1, iy1); + rv->get_canvas_frame()->i2w (ix1, iy1); iy1 += vertical_adjustment.get_value() - canvas_timebars_vsize; TimeAxisView* dest_tv = trackview_by_y_position (iy1); -- cgit v1.2.3