diff options
-rw-r--r-- | gtk2_ardour/editor.cc | 61 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 7 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 9 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/editor_keyboard.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 4 |
7 files changed, 18 insertions, 73 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index d55a1aaf37..45e77a6e96 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -262,7 +262,6 @@ Editor::Editor () */ , vertical_adjustment (0.0, 0.0, 10.0, 400.0) - , horizontal_adjustment (0.0, 0.0, 20.0, 1200.0) /* tool bar related */ @@ -468,7 +467,6 @@ Editor::Editor () selection->MarkersChanged.connect (sigc::mem_fun(*this, &Editor::marker_selection_changed)); edit_controls_vbox.set_spacing (0); - horizontal_adjustment.signal_value_changed().connect (sigc::mem_fun(*this, &Editor::scroll_canvas_horizontally), false); vertical_adjustment.signal_value_changed().connect (sigc::mem_fun(*this, &Editor::tie_vertical_scrolling), true); track_canvas->signal_map_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_map_handler)); @@ -992,24 +990,6 @@ Editor::center_screen_internal (nframes64_t frame, float page) reset_x_origin (frame); } -void -Editor::handle_new_duration () -{ - if (!_session) { - return; - } - - ENSURE_GUI_THREAD (*this, &Editor::handle_new_duration) - nframes64_t new_end = _session->current_end_frame() + (nframes64_t) floorf (current_page_frames() * 0.10f); - - 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); - } - //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 Editor::update_title () @@ -1092,7 +1072,6 @@ Editor::set_session (Session *t) _session->TransportStateChange.connect (_session_connections, invalidator (*this), boost::bind (&Editor::map_transport_state, this), gui_context()); _session->PositionChanged.connect (_session_connections, invalidator (*this), ui_bind (&Editor::map_position_change, this, _1), gui_context()); _session->RouteAdded.connect (_session_connections, invalidator (*this), ui_bind (&Editor::handle_new_route, this, _1), gui_context()); - _session->DurationChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::handle_new_duration, this), gui_context()); _session->DirtyChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_title, this), gui_context()); _session->TimecodeOffsetChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_just_timecode, this), gui_context()); _session->tempo_map().PropertyChanged.connect (_session_connections, invalidator (*this), ui_bind (&Editor::tempo_map_changed, this, _1), gui_context()); @@ -1103,7 +1082,6 @@ Editor::set_session (Session *t) _session->locations()->removed.connect (_session_connections, invalidator (*this), ui_bind (&Editor::location_gone, this, _1), gui_context()); _session->locations()->changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::refresh_location_display, this), gui_context()); _session->locations()->StateChanged.connect (_session_connections, invalidator (*this), ui_bind (&Editor::refresh_location_display_s, this, _1), gui_context()); - _session->locations()->session_range_location()->changed.connect (_session_connections, invalidator (*this), ui_bind (&Editor::session_range_location_changed, this, _1), gui_context()); _session->history().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::history_changed, this), gui_context()); if (Profile->get_sae()) { @@ -1152,7 +1130,6 @@ Editor::set_session (Session *t) _session->config.map_parameters (pc); refresh_location_display (); - handle_new_duration (); restore_ruler_visibility (); //tempo_map_changed (PropertyChange (0)); @@ -3867,15 +3844,6 @@ Editor::get_nudge_distance (nframes64_t pos, nframes64_t& next) return ret; } -void -Editor::session_range_location_changed (Location* location) -{ - ENSURE_GUI_THREAD (*this, &Editor::session_range_location_changed, location) - //reset_scrolling_region (); - nframes64_t const session_span = location->end() + (nframes64_t) floorf (current_page_frames() * 0.10f); - horizontal_adjustment.set_upper (session_span / frames_per_unit); -} - int Editor::playlist_deletion_dialog (boost::shared_ptr<Playlist> pl) { @@ -4139,7 +4107,6 @@ Editor::reset_zoom (double fpu) void Editor::reposition_and_zoom (nframes64_t frame, double fpu) { - //cerr << "Editor::reposition_and_zoom () called ha v:l:u:ps:fpu = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << frames_per_unit << endl;//DEBUG reset_x_origin (frame); reset_zoom (fpu); @@ -4270,8 +4237,6 @@ Editor::set_frames_per_unit (double fpu) void Editor::post_zoom () { - nframes64_t cef = 0; - // convert fpu to frame count nframes64_t frames = (nframes64_t) floor (frames_per_unit * _canvas_width); @@ -4286,15 +4251,10 @@ Editor::post_zoom () } } - leftmost_frame = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit); + leftmost_frame = (nframes64_t) floor (_horizontal_position * frames_per_unit); ZoomChanged (); /* EMIT_SIGNAL */ - if (_session) { - cef = _session->current_end_frame() + (current_page_frames() / 10);// Add a little extra so we can see the end marker - } - horizontal_adjustment.set_upper (cef / frames_per_unit); - //reset_scrolling_region (); if (playhead_cursor) { @@ -4311,17 +4271,7 @@ void Editor::queue_visual_change (nframes64_t where) { pending_visual_change.add (VisualChange::TimeOrigin); - - /* if we're moving beyond the end, make sure the upper limit of the horizontal adjustment - can reach. - */ - - if (_session && (where > _session->current_end_frame())) { - horizontal_adjustment.set_upper ((where + current_page_frames()) / frames_per_unit); - } - pending_visual_change.time_origin = where; - ensure_visual_change_idle_handler (); } @@ -4363,7 +4313,7 @@ Editor::idle_visual_changer () VisualChange::Type p = pending_visual_change.pending; pending_visual_change.pending = (VisualChange::Type) 0; - double last_time_origin = horizontal_adjustment.get_value(); + double last_time_origin = _horizontal_position; if (p & VisualChange::ZoomLevel) { set_frames_per_unit (pending_visual_change.frames_per_unit); @@ -4374,13 +4324,13 @@ Editor::idle_visual_changer () update_tempo_based_rulers (); } if (p & VisualChange::TimeOrigin) { - horizontal_adjustment.set_value (pending_visual_change.time_origin / frames_per_unit); + set_horizontal_position (pending_visual_change.time_origin / frames_per_unit); } if (p & VisualChange::YOrigin) { vertical_adjustment.set_value (pending_visual_change.y_origin); } - if (last_time_origin == horizontal_adjustment.get_value()) { + if (last_time_origin == _horizontal_position) { /* changed signal not emitted */ update_fixed_rulers (); redisplay_tempo (true); @@ -4388,7 +4338,6 @@ Editor::idle_visual_changer () _summary->set_overlays_dirty (); - // cerr << "Editor::idle_visual_changer () called ha v:l:u:ps:fpu = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << frames_per_unit << endl;//DEBUG pending_visual_change.idle_handler_id = -1; return 0; /* this is always a one-shot call */ } @@ -5209,7 +5158,7 @@ Editor::super_rapid_screen_update () } current = target; - horizontal_adjustment.set_value (current); + set_horizontal_position (current); #endif } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 38129be33b..a772d9eef9 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -898,7 +898,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::Table edit_packer; Gtk::Adjustment vertical_adjustment; - Gtk::Adjustment horizontal_adjustment; + double _horizontal_position; Gtk::Layout controls_layout; bool control_layout_scroll (GdkEventScroll* ev); @@ -935,7 +935,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; } double last_trackview_group_vertical_offset; void tie_vertical_scrolling (); - void scroll_canvas_horizontally (); + void set_horizontal_position (double); void scroll_canvas_vertically (); struct VisualChange { @@ -969,8 +969,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void queue_visual_change_y (double); void ensure_visual_change_idle_handler (); - void session_range_location_changed (ARDOUR::Location*); - /* track views */ TrackViewList track_views; std::pair<TimeAxisView*, ARDOUR::layer_t> trackview_by_y_position (double); @@ -1396,7 +1394,6 @@ public: void kbd_do_brush (GdkEvent*); void kbd_do_audition (GdkEvent*); - void handle_new_duration (); void initialize_canvas (); /* display control */ diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index d47799b622..52e381b032 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -361,7 +361,6 @@ Editor::track_canvas_size_allocated () } } - handle_new_duration (); update_fixed_rulers(); redisplay_tempo (false); _summary->set_overlays_dirty (); @@ -779,20 +778,22 @@ Editor::tie_vertical_scrolling () } void -Editor::scroll_canvas_horizontally () +Editor::set_horizontal_position (double p) { + _horizontal_position = p; + /* horizontal scrolling only */ double x1, y1, x2, y2, x_delta; _master_group->get_bounds (x1, y1, x2, y2); - x_delta = - (x1 + horizontal_adjustment.get_value()); + x_delta = - (x1 + _horizontal_position); _master_group->move (x_delta, 0); timebar_group->move (x_delta, 0); time_line_group->move (x_delta, 0); cursor_group->move (x_delta, 0); - leftmost_frame = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit); + leftmost_frame = (nframes64_t) floor (_horizontal_position * frames_per_unit); update_fixed_rulers (); redisplay_tempo (true); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index e039ae94a6..f1ad6e773a 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -560,7 +560,7 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, nframes64_t* pending_ rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2); rv->get_canvas_frame()->i2w (ix1, iy1); - if (-x_delta > ix1 + _editor->horizontal_adjustment.get_value()) { + if (-x_delta > ix1 + _editor->_horizontal_position) { x_delta = 0; *pending_region_position = _last_frame_position; break; @@ -3321,7 +3321,7 @@ SelectionDrag::motion (GdkEvent* event, bool first_move) break; } - if (event->button.x >= _editor->horizontal_adjustment.get_value() + _editor->_canvas_width) { + if (event->button.x >= _editor->_horizontal_position + _editor->_canvas_width) { _editor->start_canvas_autoscroll (1, 0); } @@ -3478,7 +3478,7 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move) } } - if (event->button.x >= _editor->horizontal_adjustment.get_value() + _editor->_canvas_width) { + if (event->button.x >= _editor->_horizontal_position + _editor->_canvas_width) { _editor->start_canvas_autoscroll (1, 0); } diff --git a/gtk2_ardour/editor_keyboard.cc b/gtk2_ardour/editor_keyboard.cc index e6936232cd..bb047a1440 100644 --- a/gtk2_ardour/editor_keyboard.cc +++ b/gtk2_ardour/editor_keyboard.cc @@ -66,7 +66,7 @@ Editor::kbd_driver (sigc::slot<void,GdkEvent*> theslot, bool use_track_canvas, b } track_canvas->window_to_world (x, y, worldx, worldy); - worldx += horizontal_adjustment.get_value(); + worldx += _horizontal_position; worldy += vertical_adjustment.get_value(); ev.type = GDK_BUTTON_PRESS; diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index d75dce8079..551183d205 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -2005,7 +2005,7 @@ Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos, if (xpos >= 0 && ypos >=0) { set_verbose_canvas_cursor (buf, xpos + offset, ypos + offset); } else { - set_verbose_canvas_cursor (buf, _drags->current_pointer_x() + offset - horizontal_adjustment.get_value(), _drags->current_pointer_y() + offset - vertical_adjustment.get_value() + canvas_timebars_vsize); + set_verbose_canvas_cursor (buf, _drags->current_pointer_x() + offset - _horizontal_position, _drags->current_pointer_y() + offset - vertical_adjustment.get_value() + canvas_timebars_vsize); } show_verbose_canvas_cursor (); } diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index e5513159b0..2e5055e755 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -2191,8 +2191,6 @@ Editor::insert_region_list_drag (boost::shared_ptr<Region> region, int x, int y) boost::shared_ptr<Playlist> playlist; track_canvas->window_to_world (x, y, wx, wy); - //wx += horizontal_adjustment.get_value(); - //wy += vertical_adjustment.get_value(); GdkEvent event; event.type = GDK_BUTTON_RELEASE; @@ -2237,7 +2235,7 @@ Editor::insert_route_list_drag (boost::shared_ptr<Route> route, int x, int y) { RouteTimeAxisView *source_rtv = 0; track_canvas->window_to_world (x, y, wx, wy); - wx += horizontal_adjustment.get_value(); + wx += _horizontal_position; wy += vertical_adjustment.get_value(); GdkEvent event; |