diff --git a/gtk2_ardour/ardour-sae.menus b/gtk2_ardour/ardour-sae.menus index 2ee23797ec..111678429f 100644 --- a/gtk2_ardour/ardour-sae.menus +++ b/gtk2_ardour/ardour-sae.menus @@ -80,6 +80,7 @@ + @@ -93,6 +94,7 @@ + diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index 75f5280b05..d6f40a3fff 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -81,6 +81,7 @@ + @@ -94,6 +95,7 @@ + diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index ac577cf085..bde42378e9 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1911,11 +1911,15 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items) select_items.push_back (MenuElem (_("Set range to loop range"), mem_fun(*this, &Editor::set_selection_from_loop))); select_items.push_back (MenuElem (_("Set range to punch range"), mem_fun(*this, &Editor::set_selection_from_punch))); select_items.push_back (SeparatorElem()); - select_items.push_back (MenuElem (_("Select all after edit point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), true))); - select_items.push_back (MenuElem (_("Select all before edit point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), false))); - select_items.push_back (MenuElem (_("Select all after playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true))); - select_items.push_back (MenuElem (_("Select all before playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false))); - select_items.push_back (MenuElem (_("Select all between cursors"), mem_fun(*this, &Editor::select_all_selectables_between))); + select_items.push_back (MenuElem (_("Select All After Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), true))); + select_items.push_back (MenuElem (_("Select All Before Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), false))); + select_items.push_back (MenuElem (_("Select All After Playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true))); + select_items.push_back (MenuElem (_("Select All Before Playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false))); + select_items.push_back (MenuElem (_("Select All Between Playhead & Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_between), false))); + select_items.push_back (MenuElem (_("Select All Within Playhead & Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_between), true))); + select_items.push_back (MenuElem (_("Select Range Between Playhead & Edit Point"), mem_fun(*this, &Editor::select_range_between))); + + select_items.push_back (SeparatorElem()); edit_items.push_back (MenuElem (_("Select"), *select_menu)); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 6b3ae58250..c627e8da63 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -653,7 +653,8 @@ class Editor : public PublicEditor void select_all_selectables_using_cursor (Cursor *, bool); void select_all_selectables_using_edit (bool); - void select_all_selectables_between (); + void select_all_selectables_between (bool within); + void select_range_between (); boost::shared_ptr find_next_region (nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index e5298aac9b..3742edcf70 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -132,7 +132,12 @@ Editor::register_actions () ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "select-all-before-playhead", _("Select All Before Playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false)); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (editor_actions, "select-all-between-cursors", _("Select All Between Cursors"), mem_fun(*this, &Editor::select_all_selectables_between)); + act = ActionManager::register_action (editor_actions, "select-all-between-cursors", _("Select All Between Playhead & Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_between), false)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "select-all-within-cursors", _("Select All Between Playhead & Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_between), true)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (editor_actions, "select-range-between-cursors", _("Select Range Between Playhead & Edit Point"), mem_fun(*this, &Editor::select_range_between)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "select-all-in-punch-range", _("Select All in Punch Range"), mem_fun(*this, &Editor::select_all_selectables_using_punch)); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 3cbe7f20e7..442397f4f8 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -2889,6 +2889,20 @@ Editor::cut_copy (CutCopyOp op) cut_buffer->clear (); + if (entered_marker) { + + /* cut/delete op while pointing at a marker */ + + bool ignored; + Location* loc = find_location_from_marker (entered_marker, ignored); + + if (session && loc) { + Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::really_remove_marker), loc)); + } + + return; + } + switch (current_mouse_mode()) { case MouseObject: if (!selection->regions.empty() || !selection->points.empty()) { @@ -3103,7 +3117,15 @@ Editor::cut_copy_regions (CutCopyOp op) void Editor::cut_copy_ranges (CutCopyOp op) { - for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { + TrackSelection* ts; + + if (selection->tracks.empty()) { + ts = &track_views; + } else { + ts = &selection->tracks; + } + + for (TrackSelection::iterator i = ts->begin(); i != ts->end(); ++i) { (*i)->cut_copy_clear (*selection, op); } } diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 9ccd47d87d..91d3a3b939 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -1034,7 +1034,7 @@ Editor::select_all_selectables_using_edit (bool after) } void -Editor::select_all_selectables_between () +Editor::select_all_selectables_between (bool within) { nframes64_t start; nframes64_t end; @@ -1055,8 +1055,6 @@ Editor::select_all_selectables_between () swap (start, end); } - begin_reversible_command (_("select all between cursors")); - end -= 1; for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) { @@ -1066,6 +1064,32 @@ Editor::select_all_selectables_between () (*iter)->get_selectables (start, end, 0, DBL_MAX, touched); } selection->set (touched); - commit_reversible_command (); } +void +Editor::select_range_between () +{ + nframes64_t start; + nframes64_t end; + list touched; + + if (_edit_point == EditAtPlayhead) { + return; + } + + start = get_preferred_edit_position(); + end = playhead_cursor->current_frame; + + if (start == end) { + return; + } + + if (start > end) { + swap (start, end); + } + + end -= 1; + + set_mouse_mode (MouseRange); + selection->set (0, start, end); +} diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index e5dd23668a..505e577c42 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -273,6 +273,8 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con Marker::~Marker () { + drop_references (); + /* destroying the parent group destroys its contents, namely any polygons etc. that we added */ delete text; delete mark; diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h index fd29f5411f..5ffd6c5dd1 100644 --- a/gtk2_ardour/marker.h +++ b/gtk2_ardour/marker.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include "canvas.h" @@ -34,7 +34,7 @@ namespace ARDOUR { class PublicEditor; -class Marker : public sigc::trackable +class Marker : public PBD::Destructible { public: enum Type { diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 6b2915ac02..5ee9e48e29 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -772,11 +772,17 @@ Selection::remove (Marker* m) } } - void Selection::add (Marker* m) { if (find (markers.begin(), markers.end(), m) == markers.end()) { + + /* disambiguate which remove() for the compiler */ + + void (Selection::*pmf)(Marker*) = &Selection::remove; + + m->GoingAway.connect (bind (mem_fun (*this, pmf), m)); + markers.push_back (m); MarkersChanged(); } diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 7826c6c49b..aa7e799c8f 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -73,6 +73,9 @@ Location::operator= (const Location& other) _start = other._start; _end = other._end; _flags = other._flags; + + /* copy is not locked even if original was */ + _locked = false; /* "changed" not emitted on purpose */