summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-12-30 17:28:05 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-12-30 17:28:05 +0000
commitccc93c4aef54a29d0a85a3fae098e47c2d6e671d (patch)
treea4ea4e060ef364cc48c41ac755b899910c68679b /gtk2_ardour
parent6df1d06f8b5fc8813b89c07b43df12b0ba1ac754 (diff)
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
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor.cc18
-rw-r--r--gtk2_ardour/editor.h4
-rw-r--r--gtk2_ardour/editor_ops.cc13
-rw-r--r--gtk2_ardour/public_editor.h2
4 files changed, 15 insertions, 22 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index bcd91e0760..7a74312119 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -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) {
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 28701ef559..b1162287a9 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -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);
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index b16eac3fd4..9bdd2e26a8 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -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);
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index 0d8bbbacef..ecaa77880b 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -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;