From e2afdb21c348e89c39cd2d5f46e06d7f2726a43c Mon Sep 17 00:00:00 2001 From: ben Date: Sun, 20 Oct 2013 16:02:56 -0500 Subject: minor tweaks to Cut Time dialog. Use an enum to tell preferred_edit_location what to ignore, so cut and insert dialogs will never use mouse location. --- gtk2_ardour/editing.h | 7 +++++++ gtk2_ardour/editor.cc | 12 ++++++++---- gtk2_ardour/editor.h | 2 +- gtk2_ardour/editor_ops.cc | 16 ++++++++-------- gtk2_ardour/insert_time_dialog.cc | 2 +- gtk2_ardour/public_editor.h | 2 +- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/gtk2_ardour/editing.h b/gtk2_ardour/editing.h index 6ce6b74a51..8dd6f2ed6c 100644 --- a/gtk2_ardour/editing.h +++ b/gtk2_ardour/editing.h @@ -208,6 +208,13 @@ enum XFadeType { At }; +enum EditIgnoreOption { + EDIT_IGNORE_NONE, + EDIT_IGNORE_PHEAD, + EDIT_IGNORE_MOUSE, + EDIT_IGNORE_MARKER +}; + } // namespace Editing #endif // __gtk_ardour_editing_h__ diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 09d70e40d6..b1a1d7c4c6 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1796,7 +1796,7 @@ Editor::add_region_context_items (Menu_Helpers::MenuList& edit_items, boost::sha _popup_region_menu_item->set_label (menu_item_name); } - const framepos_t position = get_preferred_edit_position (false, true); + const framepos_t position = get_preferred_edit_position (EDIT_IGNORE_NONE, true); edit_items.push_back (*_popup_region_menu_item); if (track->playlist()->count_regions_at (position) > 1 && (layering_order_editor == 0 || !layering_order_editor->is_visible ())) { @@ -4655,7 +4655,7 @@ Editor::sort_track_selection (TrackViewList& sel) } framepos_t -Editor::get_preferred_edit_position (bool ignore_playhead, bool from_context_menu, bool from_outside_canvas) +Editor::get_preferred_edit_position (EditIgnoreOption ignore, bool from_context_menu, bool from_outside_canvas) { bool ignored; framepos_t where = 0; @@ -4676,10 +4676,14 @@ Editor::get_preferred_edit_position (bool ignore_playhead, bool from_context_men return entered_marker->position(); } - if (ignore_playhead && ep == EditAtPlayhead) { + if ( (ignore==EDIT_IGNORE_PHEAD) && ep == EditAtPlayhead) { ep = EditAtSelectedMarker; } + if ( (ignore==EDIT_IGNORE_MOUSE) && ep == EditAtMouse) { + ep = EditAtPlayhead; + } + switch (ep) { case EditAtPlayhead: if (_dragging_playhead) { @@ -5773,7 +5777,7 @@ Editor::show_editor_list (bool yn) void Editor::change_region_layering_order (bool from_context_menu) { - const framepos_t position = get_preferred_edit_position (false, from_context_menu); + const framepos_t position = get_preferred_edit_position (EDIT_IGNORE_NONE, from_context_menu); if (!clicked_routeview) { if (layering_order_editor) { diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index e0737626ac..73e7582a81 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -385,7 +385,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void reset_zoom (framecnt_t); void reposition_and_zoom (framepos_t, double); - framepos_t get_preferred_edit_position (bool ignore_playhead = false, + framepos_t get_preferred_edit_position (Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE, bool use_context_click = false, bool from_outside_canvas = false); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 185ab5f1a8..0cef0d90e5 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -2435,7 +2435,7 @@ Editor::play_from_edit_point_and_return () framepos_t start_frame; framepos_t return_frame; - start_frame = get_preferred_edit_position (true); + start_frame = get_preferred_edit_position ( EDIT_IGNORE_PHEAD ); if (_session->transport_rolling()) { _session->request_locate (start_frame, false); @@ -4533,7 +4533,7 @@ Editor::paste (float times, bool from_context) { DEBUG_TRACE (DEBUG::CutNPaste, "paste to preferred edit pos\n"); - paste_internal (get_preferred_edit_position (false, from_context), times); + paste_internal (get_preferred_edit_position (EDIT_IGNORE_NONE, from_context), times); } void @@ -5204,7 +5204,7 @@ Editor::insert_patch_change (bool from_context) return; } - const framepos_t p = get_preferred_edit_position (false, from_context); + const framepos_t p = get_preferred_edit_position (EDIT_IGNORE_NONE, from_context); /* XXX: bit of a hack; use the MIDNAM from the first selected region; there may be more than one, but the PatchChangeDialog can only offer @@ -7025,15 +7025,15 @@ Editor::do_cut_time () return; } - framepos_t pos = get_preferred_edit_position (); + framepos_t pos = get_preferred_edit_position (EDIT_IGNORE_MOUSE); ArdourDialog d (*this, _("Cut Time")); VButtonBox button_box; VBox option_box; - CheckButton glue_button (_("Move Glued Regions")); - CheckButton marker_button (_("Move Markers")); - CheckButton tempo_button (_("Move Tempo & Meters")); - AudioClock clock ("insertTimeClock", true, X_("InsertTimeClock"), true, true, true); + CheckButton glue_button (_("Move Glued Regions")); glue_button.set_active(); + CheckButton marker_button (_("Move Markers")); marker_button.set_active(); + CheckButton tempo_button (_("Move Tempo & Meters")); tempo_button.set_active(); + AudioClock clock ("cutTimeClock", true, "", true, false, true, false); HBox clock_box; clock.set (0); diff --git a/gtk2_ardour/insert_time_dialog.cc b/gtk2_ardour/insert_time_dialog.cc index a63d885fdc..10b187578f 100644 --- a/gtk2_ardour/insert_time_dialog.cc +++ b/gtk2_ardour/insert_time_dialog.cc @@ -35,7 +35,7 @@ InsertTimeDialog::InsertTimeDialog (PublicEditor& e) { set_session (_editor.session ()); - framepos_t const pos = _editor.get_preferred_edit_position (); + framepos_t const pos = _editor.get_preferred_edit_position (EDIT_IGNORE_MOUSE); get_vbox()->set_border_width (12); get_vbox()->set_spacing (4); diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 69471ef152..cf68f35fb9 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -282,7 +282,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi virtual void restore_editing_space () = 0; virtual void update_tearoff_visibility () = 0; virtual void reattach_all_tearoffs () = 0; - virtual framepos_t get_preferred_edit_position (bool ignore_playhead = false, bool from_context_menu = false, bool from_outside_canvas = false) = 0; + virtual framepos_t get_preferred_edit_position (Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE, bool from_context_menu = false, bool from_outside_canvas = false) = 0; virtual void toggle_meter_updating() = 0; virtual void split_regions_at (framepos_t, RegionSelection&) = 0; virtual void split_region_at_points (boost::shared_ptr, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false) = 0; -- cgit v1.2.3