diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-04-06 16:51:27 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-04-06 16:51:27 +0000 |
commit | e9f9ca5278c6bcafd6a22ad273185c31664c32a5 (patch) | |
tree | 6000ae75223bfa5b2f476337558e3a20923641bd /gtk2_ardour/editor.cc | |
parent | 06764a3b0704e06ec8de42533938b1b50ab1ad4d (diff) |
3 different data wheel modes for tranzport, plus lock on writes, and more
git-svn-id: svn://localhost/trunk/ardour2@448 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor.cc')
-rw-r--r-- | gtk2_ardour/editor.cc | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 04b9ede947..5cae99e369 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -719,7 +719,7 @@ Editor::Editor (AudioEngine& eng) ControlProtocol::ZoomToSession.connect (mem_fun (*this, &Editor::temporal_zoom_session)); ControlProtocol::ZoomIn.connect (bind (mem_fun (*this, &Editor::temporal_zoom_step), false)); ControlProtocol::ZoomOut.connect (bind (mem_fun (*this, &Editor::temporal_zoom_step), true)); - + ControlProtocol::ScrollTimeline.connect (mem_fun (*this, &Editor::control_scroll)); constructed = true; instant_save (); } @@ -917,7 +917,6 @@ Editor::reposition_x_origin (jack_nframes_t frame) horizontal_adjustment.set_upper (frame_to_pixel (frame + (current_page_frames()))); } horizontal_adjustment.set_value (frame/frames_per_unit); - XOriginChanged (); /* EMIT_SIGNAL */ } } @@ -950,11 +949,58 @@ Editor::zoom_adjustment_changed () temporal_zoom (fpu); } +void +Editor::control_scroll (float fraction) +{ + ENSURE_GUI_THREAD(bind (mem_fun (*this, &Editor::control_scroll), fraction)); + + if (!session) { + return; + } + + double step = fraction * current_page_frames(); + jack_nframes_t target; + + if ((fraction < 0.0f) && (session->transport_frame() < (jack_nframes_t) fabs(step))) { + target = 0; + } else if ((fraction > 0.0f) && (max_frames - session->transport_frame() < step)) { + target = (max_frames - (current_page_frames()*2)); // allow room for slop in where the PH is on the screen + } else { + target = (session->transport_frame() + (fraction * current_page_frames())); + } + + /* move visuals, we'll catch up with it later */ + + playhead_cursor->set_position (target); + + if (target > (current_page_frames() / 2)) { + /* try to center PH in window */ + reposition_x_origin (target - (current_page_frames()/2)); + } else { + reposition_x_origin (0); + } + + /* cancel the existing */ + + control_scroll_connection.disconnect (); + + /* add the next one */ + + control_scroll_connection = Glib::signal_timeout().connect (bind (mem_fun (*this, &Editor::deferred_control_scroll), target), 50); +} + +bool +Editor::deferred_control_scroll (jack_nframes_t target) +{ + session->request_locate (target); + return false; +} + void Editor::canvas_horizontally_scrolled () { leftmost_frame = (jack_nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit); - + update_fixed_rulers (); if (!edit_hscroll_dragging) { @@ -968,7 +1014,7 @@ void Editor::reposition_and_zoom (jack_nframes_t frame, double nfpu) { if (!repos_zoom_queued) { - Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::deferred_reposition_and_zoom), frame, nfpu)); + Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::deferred_reposition_and_zoom), frame, nfpu)); repos_zoom_queued = true; } } |