diff options
author | Nick Mainsbridge <beatroute@iprimus.com.au> | 2008-10-18 12:51:48 +0000 |
---|---|---|
committer | Nick Mainsbridge <beatroute@iprimus.com.au> | 2008-10-18 12:51:48 +0000 |
commit | 97e678dfe3b1950b6ab4b18998e1b0cfacf0c053 (patch) | |
tree | ad554ad0e8b7630d576c3c85f261865ef270f483 /gtk2_ardour | |
parent | 9b49147d3ad92f7a9343bdd2a5637c4d349df421 (diff) |
Handle changed session duration & resizing canvas better wrt end marker, remove unused last_canvas_frame, don't redraw the entire mixer every time its presented, consistent space between rightmost horizontal scroller position and end marker when zooming.
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3981 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor.cc | 23 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 23 | ||||
-rw-r--r-- | gtk2_ardour/editor_mixer.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_tempodisplay.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 23 |
7 files changed, 33 insertions, 45 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 51bf6ef9a1..b2faedcfa5 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -338,7 +338,6 @@ Editor::Editor () _new_regionviews_show_envelope = false; current_timefx = 0; in_edit_group_row_change = false; - last_canvas_frame = 0; playhead_cursor = 0; button_release_can_deselect = true; _dragging_playhead = false; @@ -1121,16 +1120,15 @@ Editor::handle_new_duration () ENSURE_GUI_THREAD (mem_fun (*this, &Editor::handle_new_duration)); - nframes64_t new_end = session->current_end_frame() - session->current_start_frame() + (nframes64_t) floorf (current_page_frames() * 0.10f); + nframes64_t new_end = session->current_end_frame() + (nframes64_t) floorf (current_page_frames() * 0.10f); - if (new_end > last_canvas_frame) { - last_canvas_frame = new_end; - horizontal_adjustment.set_upper (last_canvas_frame / frames_per_unit); - horizontal_adjustment.set_page_size (current_page_frames()/frames_per_unit); - //reset_scrolling_region (); + horizontal_adjustment.set_upper (new_end / frames_per_unit); + horizontal_adjustment.set_page_size (current_page_frames()/frames_per_unit); + + if (horizontal_adjustment.get_value() + canvas_width > horizontal_adjustment.get_upper()) { + horizontal_adjustment.set_value (horizontal_adjustment.get_upper() - canvas_width); } - horizontal_adjustment.set_value (leftmost_frame/frames_per_unit); - //cerr << "Editor::handle_new_duration () called ha v:l:u:ps:lcf = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << last_canvas_frame << endl;//DEBUG + //cerr << "Editor::handle_new_duration () called ha v:l:u:ps:lcf = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << endl;//DEBUG } void @@ -1276,7 +1274,6 @@ Editor::connect_to_session (Session *t) sfbrowser->set_session (session); } - last_canvas_frame = 0; // force update in handle_new_duration() handle_new_duration (); redisplay_regions (); @@ -4408,14 +4405,14 @@ Editor::idle_visual_changer () if (session) { csf = session->current_start_frame(); - cef = session->current_end_frame() + (current_page_frames() / 10);// Add a little extra so we can see the end marker + cef = session->current_end_frame(); } /* if we seek beyond the current end of the canvas, move the end */ if (current_time_origin != pending_visual_change.time_origin) { - last_canvas_frame = (cef > (pending_visual_change.time_origin + current_page_frames())) ? cef : pending_visual_change.time_origin + current_page_frames(); - horizontal_adjustment.set_upper ((cef - csf) / frames_per_unit); + cef += current_page_frames() / 10; // Add a little extra so we can see the end marker + horizontal_adjustment.set_upper (cef / frames_per_unit); horizontal_adjustment.set_value (pending_visual_change.time_origin / frames_per_unit); } else { update_fixed_rulers(); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index f17a1c6336..fab3e8ec03 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -828,7 +828,6 @@ class Editor : public PublicEditor double canvas_width; double canvas_height; double full_canvas_height; - nframes64_t last_canvas_frame; bool track_canvas_map_handler (GdkEventAny*); diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 7b1eca282f..6373810678 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -324,20 +324,20 @@ Editor::track_canvas_size_allocated () } vertical_adjustment.set_page_size (canvas_height); + last_trackview_group_vertical_offset = get_trackview_group_vertical_offset (); + if ((vertical_adjustment.get_value() + canvas_height) >= vertical_adjustment.get_upper()) { + /* + We're increasing the size of the canvas while the bottom is visible. + We scroll down to keep in step with the controls layout. + */ + vertical_adjustment.set_value (full_canvas_height - canvas_height); + } } handle_new_duration (); reset_hscrollbar_stepping (); update_fixed_rulers(); redisplay_tempo (false); - last_trackview_group_vertical_offset = get_trackview_group_vertical_offset (); - if ((vertical_adjustment.get_value() + canvas_height) >= vertical_adjustment.get_upper()) { - /* - We're increasing the size of the canvas while the bottom is visible. - We scroll down to keep in step with the controls layout. - */ - vertical_adjustment.set_value (full_canvas_height - canvas_height); - } Resized (); /* EMIT_SIGNAL */ @@ -836,13 +836,6 @@ void Editor::canvas_scroll_to (nframes64_t time_origin) { leftmost_frame = time_origin; - nframes64_t rightmost_frame = leftmost_frame + current_page_frames (); - - if (rightmost_frame > last_canvas_frame) { - last_canvas_frame = rightmost_frame; - //reset_scrolling_region (); - } - } void diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index 42407100f0..58a2d55a0c 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -310,7 +310,6 @@ Editor::session_going_away () entered_track = 0; last_update_frame = 0; drag_info.item = 0; - last_canvas_frame = 0; playhead_cursor->canvas_item.hide (); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index c47f33e17b..63a3607c68 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1841,7 +1841,6 @@ Editor::temporal_zoom_session () ENSURE_GUI_THREAD (mem_fun (*this, &Editor::temporal_zoom_session)); if (session) { - last_canvas_frame = ((session->current_end_frame() - session->current_start_frame()) + (current_page_frames() / 24)); temporal_zoom_by_frame (session->current_start_frame(), session->current_end_frame(), "zoom to session"); } } diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 65e086f9e1..92efed3b27 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -106,7 +106,7 @@ Editor::tempo_map_changed (Change ignored) tempo_lines->tempo_map_changed(); } - compute_current_bbt_points(leftmost_frame, leftmost_frame + (nframes_t)(edit_packer.get_width() * frames_per_unit)); + compute_current_bbt_points(leftmost_frame, leftmost_frame + current_page_frames()); session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers redraw_measures (); update_tempo_based_rulers (); @@ -123,7 +123,7 @@ Editor::redisplay_tempo (bool immediate_redraw) return; } - compute_current_bbt_points (leftmost_frame, leftmost_frame + (nframes_t)(edit_packer.get_width() * frames_per_unit)); // redraw rulers and measures + compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames()); if (immediate_redraw) { redraw_measures (); } else { @@ -133,7 +133,7 @@ Editor::redisplay_tempo (bool immediate_redraw) Glib::signal_idle().connect (mem_fun (*this, &Editor::redraw_measures)); #endif } - update_tempo_based_rulers (); + update_tempo_based_rulers (); // redraw rulers and measures } void diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 5353b73571..a24f7046b0 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -240,18 +240,19 @@ void Mixer_UI::show_window () { show_all (); + if (!_visible) { + set_window_pos_and_size (); - set_window_pos_and_size (); - - /* now reset each strips width so the right widgets are shown */ - MixerStrip* ms; - - TreeModel::Children rows = track_model->children(); - TreeModel::Children::iterator ri; - - for (ri = rows.begin(); ri != rows.end(); ++ri) { - ms = (*ri)[track_columns.strip]; - ms->set_width (ms->get_width(), ms->width_owner()); + /* now reset each strips width so the right widgets are shown */ + MixerStrip* ms; + + TreeModel::Children rows = track_model->children(); + TreeModel::Children::iterator ri; + + for (ri = rows.begin(); ri != rows.end(); ++ri) { + ms = (*ri)[track_columns.strip]; + ms->set_width (ms->get_width(), ms->width_owner()); + } } _visible = true; } |