mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 13:46:30 +01:00
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
This commit is contained in:
parent
f7a174a59b
commit
d41f7a0a70
6 changed files with 39 additions and 33 deletions
|
|
@ -343,7 +343,7 @@ Editor::Editor ()
|
|||
initialize_canvas ();
|
||||
|
||||
edit_controls_vbox.set_spacing (0);
|
||||
horizontal_adjustment.signal_value_changed().connect (mem_fun(*this, &Editor::canvas_horizontally_scrolled));
|
||||
horizontal_adjustment.signal_value_changed().connect (mem_fun(*this, &Editor::canvas_horizontally_scrolled), false);
|
||||
vertical_adjustment.signal_value_changed().connect (mem_fun(*this, &Editor::tie_vertical_scrolling), true);
|
||||
|
||||
track_canvas.set_hadjustment (horizontal_adjustment);
|
||||
|
|
@ -4093,10 +4093,11 @@ Editor::idle_visual_changer ()
|
|||
}
|
||||
|
||||
if (p & VisualChange::TimeOrigin) {
|
||||
double val = horizontal_adjustment.get_value();
|
||||
if ((nframes_t) floor (val * frames_per_unit) != pending_visual_change.time_origin) {
|
||||
|
||||
nframes_t time_origin = (nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
|
||||
|
||||
if (time_origin != pending_visual_change.time_origin) {
|
||||
horizontal_adjustment.set_value (pending_visual_change.time_origin/frames_per_unit);
|
||||
/* the signal handler will do the rest */
|
||||
} else {
|
||||
update_fixed_rulers();
|
||||
redisplay_tempo (true);
|
||||
|
|
|
|||
|
|
@ -749,6 +749,7 @@ class Editor : public PublicEditor
|
|||
|
||||
void tie_vertical_scrolling ();
|
||||
void canvas_horizontally_scrolled ();
|
||||
void canvas_scroll_to (nframes64_t);
|
||||
|
||||
struct VisualChange {
|
||||
enum Type {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
time_canvas.set_scroll_region ( 0.0, 0.0, last_canvas_unit, 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;
|
||||
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);
|
||||
|
||||
leftmost_frame = (nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
|
||||
if (time_origin != leftmost_frame) {
|
||||
canvas_scroll_to (time_origin);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -1518,6 +1518,7 @@ Editor::temporal_zoom (gdouble fpu)
|
|||
nframes64_t where;
|
||||
bool in_track_canvas;
|
||||
double nfpu;
|
||||
double l;
|
||||
|
||||
nfpu = fpu;
|
||||
|
||||
|
|
@ -1548,11 +1549,18 @@ Editor::temporal_zoom (gdouble fpu)
|
|||
break;
|
||||
|
||||
case ZoomFocusPlayhead:
|
||||
/* try to keep the playhead in the center */
|
||||
if (playhead_cursor->current_frame < half_page_size) {
|
||||
/* try to keep the playhead in the same place */
|
||||
|
||||
where = playhead_cursor->current_frame;
|
||||
|
||||
l = - ((new_page_size * ((where - current_leftmost)/(double)current_page)) - where);
|
||||
|
||||
if (l < 0) {
|
||||
leftmost_after_zoom = 0;
|
||||
} else if (l > max_frames) {
|
||||
leftmost_after_zoom = max_frames - new_page_size;
|
||||
} else {
|
||||
leftmost_after_zoom = playhead_cursor->current_frame - half_page_size;
|
||||
leftmost_after_zoom = (nframes64_t) l;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -1571,7 +1579,7 @@ Editor::temporal_zoom (gdouble fpu)
|
|||
|
||||
} else {
|
||||
|
||||
double l = - ((new_page_size * ((where - current_leftmost)/(double)current_page)) - where);
|
||||
l = - ((new_page_size * ((where - current_leftmost)/(double)current_page)) - where);
|
||||
|
||||
if (l < 0) {
|
||||
leftmost_after_zoom = 0;
|
||||
|
|
@ -1585,7 +1593,7 @@ Editor::temporal_zoom (gdouble fpu)
|
|||
break;
|
||||
|
||||
case ZoomFocusEdit:
|
||||
/* try to keep the edit point in the center */
|
||||
/* try to keep the edit point in the same place */
|
||||
where = get_preferred_edit_position ();
|
||||
|
||||
if (where > 0) {
|
||||
|
|
|
|||
|
|
@ -382,8 +382,6 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op,
|
|||
vector<RegionView*> all_equivalent_regions;
|
||||
bool commit = false;
|
||||
|
||||
cerr << "Set selected regionview from click, op = " << op << " press ? " << press << " ntr ? " << no_track_remove << endl;
|
||||
|
||||
if (!clicked_regionview || !clicked_audio_trackview) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,18 +93,15 @@ class DnDTreeView : public DnDTreeViewBase
|
|||
*/
|
||||
suggested_action = Gdk::DragAction (0);
|
||||
TreeView::on_drag_data_received (context, x, y, selection_data, info, time);
|
||||
std::cerr << "DDR, suggested action\n";
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection_data.get_target() == "GTK_TREE_MODEL_ROW") {
|
||||
|
||||
TreeView::on_drag_data_received (context, x, y, selection_data, info, time);
|
||||
std::cerr << "\n\nREGULAR TREEVIEW DRAG HAS DROPPED HERE @ " << x << '.' << y << std::endl;
|
||||
|
||||
} else if (data_column >= 0) {
|
||||
|
||||
std::cerr << "DDR, data/object drop\n";
|
||||
/* object D-n-D */
|
||||
|
||||
const void* data = selection_data.get_data();
|
||||
|
|
@ -115,7 +112,6 @@ class DnDTreeView : public DnDTreeViewBase
|
|||
}
|
||||
|
||||
} else {
|
||||
std::cerr << "DDR, unknown drop\n";
|
||||
/* some kind of target type added by the app, which will be handled by a signal handler */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue