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
This commit is contained in:
Paul Davis 2007-11-09 13:28:45 +00:00
parent 96fa1cd0b6
commit 79ba996096
11 changed files with 86 additions and 15 deletions

View file

@ -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>

View file

@ -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>

View file

@ -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));

View file

@ -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);

View file

@ -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));

View file

@ -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);
}
}

View file

@ -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);
}

View file

@ -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;

View file

@ -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 {

View file

@ -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();
}

View file

@ -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 */