summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-11-09 13:28:45 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-11-09 13:28:45 +0000
commit79ba9960964c8ea701abfe00dbef128ca7da9fbd (patch)
tree3f303f7a8e7c0ab265d392fe8d2bb3b6f1339b9d
parent96fa1cd0b636d47d4b0787281fc9401693a77af9 (diff)
catch markers as they go away, to avoid selection corruption; add select-range-between-cursors (F3); add unimplemented select-all-within-cursors (different from select-all-between-cursors); make ctrl-x/delete delete a marker if the mouse is pointing at it
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2611 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/ardour-sae.menus2
-rw-r--r--gtk2_ardour/ardour.menus2
-rw-r--r--gtk2_ardour/editor.cc14
-rw-r--r--gtk2_ardour/editor.h3
-rw-r--r--gtk2_ardour/editor_actions.cc7
-rw-r--r--gtk2_ardour/editor_ops.cc24
-rw-r--r--gtk2_ardour/editor_selection.cc32
-rw-r--r--gtk2_ardour/marker.cc2
-rw-r--r--gtk2_ardour/marker.h4
-rw-r--r--gtk2_ardour/selection.cc8
-rw-r--r--libs/ardour/location.cc3
11 files changed, 86 insertions, 15 deletions
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 @@
<menuitem action='remove-last-capture'/>
<separator/>
<menu action="EditSelectRangeOptions">
+ <menuitem action='select-range-between-cursors'/>
<menuitem action='extend-range-to-start-of-region'/>
<menuitem action='extend-range-to-end-of-region'/>
<menuitem action='start-range'/>
@@ -93,6 +94,7 @@
<menuitem action='select-all-after-playhead'/>
<menuitem action='select-all-before-playhead'/>
<menuitem action='select-all-between-cursors'/>
+ <menuitem action='select-all-within-cursors'/>
<menuitem action='select-all-in-punch-range'/>
<menuitem action='select-all-in-loop-range'/>
</menu>
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 @@
<menuitem action='remove-last-capture'/>
<separator/>
<menu action="EditSelectRangeOptions">
+ <menuitem action='select-range-between-cursors'/>
<menuitem action='extend-range-to-start-of-region'/>
<menuitem action='extend-range-to-end-of-region'/>
<menuitem action='start-range'/>
@@ -94,6 +95,7 @@
<menuitem action='select-all-after-playhead'/>
<menuitem action='select-all-before-playhead'/>
<menuitem action='select-all-between-cursors'/>
+ <menuitem action='select-all-within-cursors'/>
<menuitem action='select-all-in-punch-range'/>
<menuitem action='select-all-in-loop-range'/>
</menu>
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<ARDOUR::Region> 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<Selectable *> 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 <string>
#include <glib.h>
#include <ardour/ardour.h>
-#include <sigc++/signal.h>
+#include <pbd/destructible.h>
#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 */