select all, musical (fuzzy) loop/punch/range region selections, soundtouch patch for gcc 4.1, needs 's' key to not clear selection.

git-svn-id: svn://localhost/trunk/ardour2@289 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Nick Mainsbridge 2006-01-23 16:02:48 +00:00
parent 51093cc589
commit dfcd837d67
8 changed files with 165 additions and 7 deletions

View File

@ -13,6 +13,7 @@
(gtk_accel_path "<Actions>/Editor/set-edit-cursor" "e")
(gtk_accel_path "<Actions>/Editor/split-region" "s")
(gtk_accel_path "<Actions>/Editor/set-region-sync-position" "v")
(gtk_accel_path "<Actions>/Editor/mute-unmute-region" "m")
(gtk_accel_path "<Actions>/Editor/insert-region" "i")
(gtk_accel_path "<Actions>/Editor/normalize-region" "n")
(gtk_accel_path "<Actions>/Transport/loop" "l")
@ -45,12 +46,20 @@
(gtk_accel_path "<Actions>/Editor/temporal-zoom-in" "minus")
(gtk_accel_path "<Actions>/Editor/temporal-zoom-out" "equal")
(gtk_accel_path "<Actions>/Editor/select-all" "<control>a")
(gtk_accel_path "<Actions>/Editor/select-all-after-edit-cursor" "<Control>e")
(gtk_accel_path "<Actions>/Editor/select-all-before-edit-cursor" "<shift><control>e")
(gtk_accel_path "<Actions>/Editor/select-all-after-playhead" "<Control>p")
(gtk_accel_path "<Actions>/Editor/select-all-before-playhead" "<shift><control>p")
(gtk_accel_path "<Actions>/Editor/select-all-in-punch-range" "<Control>d")
(gtk_accel_path "<Actions>/Editor/select-all-in-loop-range" "<Control>l")
(gtk_accel_path "<Actions>/Editor/extend-range-to-start-of-region" "leftanglebracket")
(gtk_accel_path "<Actions>/Editor/extend-range-to-end-of-region" "rightanglebracket")
(gtk_accel_path "<Actions>/Editor/align-regions-sync" "<meta>a")
(gtk_accel_path "<Actions>/Editor/align-regions-end" "<meta><control>a")
(gtk_accel_path "<Actions>/Editor/align-regions-start-relative" "<control>a")
(gtk_accel_path "<Actions>/Editor/align-regions-start-relative" "<shift>a")
(gtk_accel_path "<Actions>/Editor/brush-at-mouse" "<control>b")
(gtk_accel_path "<Actions>/Editor/audition-at-mouse" "period")

View File

@ -67,6 +67,14 @@
<menuitem action='editor-cut'/>
<menuitem action='editor-copy'/>
<menuitem action='editor-paste'/>
<separator/>
<menuitem action='select-all'/>
<menuitem action='select-all-after-edit-cursor'/>
<menuitem action='select-all-before-edit-cursor'/>
<menuitem action='select-all-after-playhead'/>
<menuitem action='select-all-before-playhead'/>
<menuitem action='select-all-in-punch-range'/>
<menuitem action='select-all-in-loop-range'/>
<separator/>
<menuitem action='extend-range-to-start-of-region'/>
<menuitem action='extend-range-to-end-of-region'/>

View File

@ -1878,6 +1878,11 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
select_items.push_back (MenuElem (_("Select loop range"), mem_fun(*this, &Editor::set_selection_from_loop)));
select_items.push_back (MenuElem (_("Select punch range"), mem_fun(*this, &Editor::set_selection_from_punch)));
select_items.push_back (SeparatorElem());
select_items.push_back (MenuElem (_("Select all after edit cursor"), bind (mem_fun(*this, &Editor::select_all_after_cursor), edit_cursor, true)));
select_items.push_back (MenuElem (_("Select all before edit cursor"), bind (mem_fun(*this, &Editor::select_all_after_cursor), edit_cursor, false)));
select_items.push_back (MenuElem (_("Select all after playhead"), bind (mem_fun(*this, &Editor::select_all_after_cursor), playhead_cursor, true)));
select_items.push_back (MenuElem (_("Select all before playhead"), bind (mem_fun(*this, &Editor::select_all_after_cursor), playhead_cursor, false)));
select_items.push_back (SeparatorElem());
edit_items.push_back (MenuElem (_("Select"), *select_menu));
@ -1963,6 +1968,11 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items)
select_items.push_back (MenuElem (_("Select loop range"), mem_fun(*this, &Editor::set_selection_from_loop)));
select_items.push_back (MenuElem (_("Select punch range"), mem_fun(*this, &Editor::set_selection_from_punch)));
select_items.push_back (SeparatorElem());
select_items.push_back (MenuElem (_("Select all after edit cursor"), bind (mem_fun(*this, &Editor::select_all_after_cursor), edit_cursor, true)));
select_items.push_back (MenuElem (_("Select all before edit cursor"), bind (mem_fun(*this, &Editor::select_all_after_cursor), edit_cursor, false)));
select_items.push_back (MenuElem (_("Select all after playhead"), bind (mem_fun(*this, &Editor::select_all_after_cursor), playhead_cursor, true)));
select_items.push_back (MenuElem (_("Select all before playhead"), bind (mem_fun(*this, &Editor::select_all_after_cursor), playhead_cursor, false)));
select_items.push_back (SeparatorElem());
edit_items.push_back (MenuElem (_("Select"), *select_menu));

View File

@ -635,6 +635,7 @@ class Editor : public PublicEditor
void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
void cursor_to_selection_start (Cursor *);
void cursor_to_selection_end (Cursor *);
void select_all_after_cursor (Cursor *, bool);
ARDOUR::Region* find_next_region (jack_nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
@ -1002,7 +1003,8 @@ class Editor : public PublicEditor
void cursor_align (bool playhead_to_edit);
void remove_last_capture ();
void select_all_from_loop();
void select_all_from_punch();
void set_selection_from_range (ARDOUR::Location&);
void set_selection_from_punch ();
void set_selection_from_loop ();
@ -1248,6 +1250,7 @@ class Editor : public PublicEditor
void marker_menu_rename ();
void marker_menu_hide ();
void marker_menu_loop_range ();
void marker_menu_select_all_from_range ();
void marker_menu_play_from ();
void marker_menu_set_playhead ();
void marker_menu_set_from_playhead ();
@ -1261,6 +1264,7 @@ class Editor : public PublicEditor
void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
void build_range_marker_menu ();
void build_marker_menu ();
void build_tm_marker_menu ();
void build_transport_marker_menu ();

View File

@ -76,7 +76,23 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "edit-cursor-to-range-end", _("edit cursor to range end"), bind (mem_fun(*this, &Editor::cursor_to_selection_end), edit_cursor));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "select-all", _("select all"), bind (mem_fun(*this, &Editor::select_all), false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "select-all-after-edit-cursor", _("select all after edit cursor"), bind (mem_fun(*this, &Editor::select_all_after_cursor), edit_cursor, true));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "select-all-before-edit-cursor", _("select all before edit cursor"), bind (mem_fun(*this, &Editor::select_all_after_cursor), edit_cursor, false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "select-all-after-playhead", _("select all after playhead"), bind (mem_fun(*this, &Editor::select_all_after_cursor), playhead_cursor, true));
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_after_cursor), playhead_cursor, false));
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_from_punch));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "select-all-in-loop-range", _("select all in loop range"), mem_fun(*this, &Editor::select_all_from_loop));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "jump-forward-to-mark", _("jump forward to mark"), mem_fun(*this, &Editor::jump_forward_to_mark));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "jump-backward-to-mark", _("jump backward to mark"), mem_fun(*this, &Editor::jump_backward_to_mark));
@ -136,6 +152,7 @@ Editor::register_actions ()
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "align-regions-end-relative", _("align regions end relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::End));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "align-regions-sync", _("align regions sync"), bind (mem_fun(*this, &Editor::align), ARDOUR::SyncPoint));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "align-regions-sync-relative", _("align regions sync relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::SyncPoint));
@ -146,6 +163,7 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "brush-at-mouse", _("brush at mouse"), mem_fun(*this, &Editor::kbd_brush));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-edit-cursor", _("set edit cursor"), mem_fun(*this, &Editor::kbd_set_edit_cursor));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "mute-unmute-region", _("mute/unmute region"), mem_fun(*this, &Editor::kbd_mute_unmute_region));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-playhead", _("set playhead"), mem_fun(*this, &Editor::kbd_set_playhead_cursor));

View File

@ -386,10 +386,13 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
}
marker_menu_item = item;
transport_marker_menu->popup (1, ev->time);
}
else {
} else {
if (marker_menu == 0) {
if (loc->is_mark()) {
build_marker_menu ();
} else {
build_range_marker_menu ();
}
}
// GTK2FIX use action group sensitivity
@ -453,6 +456,33 @@ Editor::build_marker_menu ()
items.push_back (MenuElem (_("Rename"), mem_fun(*this, &Editor::marker_menu_rename)));
items.push_back (MenuElem (_("Hide"), mem_fun(*this, &Editor::marker_menu_hide)));
items.push_back (MenuElem (_("Remove"), mem_fun(*this, &Editor::marker_menu_remove)));
}
void
Editor::build_range_marker_menu ()
{
using namespace Menu_Helpers;
marker_menu = new Menu;
MenuList& items = marker_menu->items();
marker_menu->set_name ("ArdourContextMenu");
items.push_back (MenuElem (_("Locate to"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
items.push_back (MenuElem (_("Play from"), mem_fun(*this, &Editor::marker_menu_play_from)));
items.push_back (MenuElem (_("Loop range"), mem_fun(*this, &Editor::marker_menu_loop_range)));
items.push_back (MenuElem (_("Set from playhead"), mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
items.push_back (MenuElem (_("Set from range"), mem_fun(*this, &Editor::marker_menu_set_from_selection)));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Rename"), mem_fun(*this, &Editor::marker_menu_rename)));
items.push_back (MenuElem (_("Hide"), mem_fun(*this, &Editor::marker_menu_hide)));
items.push_back (MenuElem (_("Remove"), mem_fun(*this, &Editor::marker_menu_remove)));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Select all in Range"), mem_fun(*this, &Editor::marker_menu_select_all_from_range)));
}
void
@ -498,6 +528,7 @@ Editor::build_transport_marker_menu ()
items.push_back (MenuElem (_("Set from range"), mem_fun(*this, &Editor::marker_menu_set_from_selection)));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Hide"), mem_fun(*this, &Editor::marker_menu_hide)));
}
void
@ -518,6 +549,25 @@ Editor::marker_menu_hide ()
}
}
void
Editor::marker_menu_select_all_from_range ()
{
Marker* marker;
if ((marker = reinterpret_cast<Marker *> (marker_menu_item->get_data ("marker"))) == 0) {
fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg;
/*NOTREACHED*/
}
Location* l;
bool is_start;
if ((l = find_location_from_marker (marker, is_start)) != 0) {
select_all_within (l->start(), l->end(), 0, DBL_MAX, false);
}
}
void
Editor::marker_menu_play_from ()
{

View File

@ -1306,10 +1306,47 @@ Editor::set_selection_from_loop()
if ((location = session->locations()->auto_loop_location()) == 0) {
return;
}
set_selection_from_range (*location);
}
void
Editor::select_all_from_punch()
{
Location* location;
list<Selectable *> touched;
if ((location = session->locations()->auto_punch_location()) == 0) {
return;
}
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
if ((*iter)->hidden()) {
continue;
}
(*iter)->get_selectables (location->start(), location->end(), 0, DBL_MAX, touched);
}
selection->set (touched);
}
void
Editor::select_all_from_loop()
{
Location* location;
list<Selectable *> touched;
if ((location = session->locations()->auto_loop_location()) == 0) {
return;
}
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
if ((*iter)->hidden()) {
continue;
}
(*iter)->get_selectables (location->start(), location->end(), 0, DBL_MAX, touched);
}
selection->set (touched);
}
void
Editor::set_selection_from_range (Location& range)
{
@ -1322,6 +1359,29 @@ Editor::set_selection_from_range (Location& range)
commit_reversible_command ();
}
void
Editor::select_all_after_cursor (Cursor *cursor, bool after)
{
jack_nframes_t start;
jack_nframes_t end;
list<Selectable *> touched;
if (after) {
start = cursor->current_frame ;
end = session->current_end_frame();
} else {
start = 0;
end = cursor->current_frame ;
}
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
if ((*iter)->hidden()) {
continue;
}
(*iter)->get_selectables (start, end, 0, DBL_MAX, touched);
}
selection->set (touched);
}
void
Editor::amplitude_zoom_step (bool in)
{
@ -2654,7 +2714,6 @@ Editor::set_region_sync_from_edit_cursor ()
}
Region& region (clicked_regionview->region);
begin_reversible_command (_("set sync from edit cursor"));
session->add_undo (region.playlist()->get_memento());
region.set_sync_position (edit_cursor->current_frame);

View File

@ -159,7 +159,7 @@ public:
static const char *getVersionString();
/// Get SoundTouch library version Id
static uint SoundTouch::getVersionId();
static uint getVersionId();
/// Sets new rate control value. Normal rate = 1.0, smaller values
/// represent slower rate, larger faster rates.