summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_canvas.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-01-04 17:23:51 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-01-04 17:23:51 +0000
commitd41f7a0a701bb7af04ab4b3c2a26ff23f96407f9 (patch)
tree011fcafb38e617b16a3069dd8cbab5d816e0a6ca /gtk2_ardour/editor_canvas.cc
parentf7a174a59b091ca545bffbd5b1d1bcaced95285f (diff)
a few fixes for zoom, plus the results of unfinished work on zoom redrawing, plus cleanup of debugging code in DnDTreevew
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2827 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_canvas.cc')
-rw-r--r--gtk2_ardour/editor_canvas.cc36
1 files changed, 19 insertions, 17 deletions
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 574d10719b..1af8bad997 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -356,20 +356,18 @@ Editor::reset_scrolling_region (Gtk::Allocation* alloc)
}
}
- double last_canvas_unit = last_canvas_frame / frames_per_unit;
+ double last_canvas_unit = max ((last_canvas_frame / frames_per_unit), canvas_width);
- track_canvas.set_scroll_region (0.0, 0.0, max (last_canvas_unit, canvas_width), pos);
+ track_canvas.set_scroll_region (0.0, 0.0, last_canvas_unit, pos);
// XXX what is the correct height value for the time canvas ? this overstates it
- time_canvas.set_scroll_region ( 0.0, 0.0, max (last_canvas_unit, canvas_width), canvas_height);
-
- guint track_canvas_width,track_canvas_height;
- track_canvas.get_size(track_canvas_width,track_canvas_height);
- range_marker_drag_rect->property_y2() = track_canvas_height;
- transport_loop_range_rect->property_y2() = track_canvas_height;
- transport_punch_range_rect->property_y2() = track_canvas_height;
- transport_punchin_line->property_y2() = track_canvas_height;
- transport_punchout_line->property_y2() = track_canvas_height;
+ time_canvas.set_scroll_region ( 0.0, 0.0, last_canvas_unit, 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;
update_punch_range_view (true);
@@ -687,13 +685,17 @@ Editor::left_track_canvas (GdkEventCrossing *ev)
void
Editor::canvas_horizontally_scrolled ()
{
- /* this is the core function that controls horizontal scrolling of the canvas. it is called
- whenever the horizontal_adjustment emits its "value_changed" signal. it typically executes in an
- idle handler, which is important because tempo_map_changed() should issue redraws immediately
- and not defer them to an idle handler.
- */
+ nframes64_t time_origin = (nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
+
+ if (time_origin != leftmost_frame) {
+ canvas_scroll_to (time_origin);
+ }
+}
- leftmost_frame = (nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
+void
+Editor::canvas_scroll_to (nframes64_t time_origin)
+{
+ leftmost_frame = time_origin;
nframes_t rightmost_frame = leftmost_frame + current_page_frames ();
if (rightmost_frame > last_canvas_frame) {