centralize use of "from-context-menu" in Editor::get_preferred_edit_position(), and use it when pasting as well

git-svn-id: svn://localhost/ardour2/branches/3.0@11118 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-12-30 17:28:05 +00:00
parent 6df1d06f8b
commit ccc93c4aef
4 changed files with 15 additions and 22 deletions

View File

@ -1947,7 +1947,7 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
cutnpaste_items.push_back (MenuElem (_("Cut"), sigc::mem_fun(*this, &Editor::cut)));
cutnpaste_items.push_back (MenuElem (_("Copy"), sigc::mem_fun(*this, &Editor::copy)));
cutnpaste_items.push_back (MenuElem (_("Paste"), sigc::bind (sigc::mem_fun(*this, &Editor::paste), 1.0f)));
cutnpaste_items.push_back (MenuElem (_("Paste"), sigc::bind (sigc::mem_fun(*this, &Editor::paste), 1.0f, true)));
cutnpaste_items.push_back (SeparatorElem());
@ -2018,7 +2018,7 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items)
cutnpaste_items.push_back (MenuElem (_("Cut"), sigc::mem_fun(*this, &Editor::cut)));
cutnpaste_items.push_back (MenuElem (_("Copy"), sigc::mem_fun(*this, &Editor::copy)));
cutnpaste_items.push_back (MenuElem (_("Paste"), sigc::bind (sigc::mem_fun(*this, &Editor::paste), 1.0f)));
cutnpaste_items.push_back (MenuElem (_("Paste"), sigc::bind (sigc::mem_fun(*this, &Editor::paste), 1.0f, true)));
Menu *nudge_menu = manage (new Menu());
MenuList& nudge_items = nudge_menu->items();
@ -4356,12 +4356,16 @@ Editor::sort_track_selection (TrackViewList& sel)
}
framepos_t
Editor::get_preferred_edit_position (bool ignore_playhead)
Editor::get_preferred_edit_position (bool ignore_playhead, bool from_context_menu)
{
bool ignored;
framepos_t where = 0;
EditPoint ep = _edit_point;
if (from_context_menu && (ep == EditAtMouse)) {
return event_frame (&context_click_event, 0, 0);
}
if (entered_marker) {
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("GPEP: use entered marker @ %1\n", entered_marker->position()));
return entered_marker->position();
@ -5358,13 +5362,7 @@ Editor::show_editor_list (bool yn)
void
Editor::change_region_layering_order (bool from_context_menu)
{
framepos_t position;
if (!from_context_menu || (_edit_point != EditAtMouse)) {
position = get_preferred_edit_position ();
} else {
position = event_frame (&context_click_event, 0, 0);
}
const framepos_t position = get_preferred_edit_position (false, from_context_menu);
if (!clicked_routeview) {
if (layering_order_editor) {

View File

@ -394,7 +394,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void reset_zoom (double);
void reposition_and_zoom (framepos_t, double);
framepos_t get_preferred_edit_position (bool ignore_playhead = false);
framepos_t get_preferred_edit_position (bool ignore_playhead = false, bool use_context_click = false);
bool update_mouse_speed ();
bool decelerate_mouse_speed ();
@ -1172,7 +1172,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void delete_ ();
void cut ();
void copy ();
void paste (float times);
void paste (float times, bool from_context_menu = false);
void place_transient ();
void remove_transient (ArdourCanvas::Item* item);

View File

@ -3957,10 +3957,11 @@ Editor::cut_copy_ranges (CutCopyOp op)
}
void
Editor::paste (float times)
Editor::paste (float times, bool from_context)
{
DEBUG_TRACE (DEBUG::CutNPaste, "paste to preferred edit pos\n");
paste_internal (get_preferred_edit_position(), times);
paste_internal (get_preferred_edit_position (false, from_context), times);
}
void
@ -4563,13 +4564,7 @@ Editor::insert_patch_change (bool from_context)
return;
}
framepos_t p;
if (!from_context || (_edit_point != EditAtMouse)) {
p = get_preferred_edit_position (false);
} else {
p = event_frame (&context_click_event, 0, 0);
}
const framepos_t p = get_preferred_edit_position (false, from_context);
Evoral::PatchChange<Evoral::MusicalTime> empty (0, 0, 0, 0);
PatchChangeDialog d (0, _session, empty, Gtk::Stock::ADD);

View File

@ -266,7 +266,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
virtual void remove_last_capture () = 0;
virtual void maximise_editing_space () = 0;
virtual void restore_editing_space () = 0;
virtual framepos_t get_preferred_edit_position (bool ignore_playhead = false) = 0;
virtual framepos_t get_preferred_edit_position (bool ignore_playhead = false, bool from_context_menu = false) = 0;
virtual void toggle_meter_updating() = 0;
virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false) = 0;
virtual void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false) = 0;