fix incorrect marker/range marker right-click menus, try to clarify the text in them, select all between cursors ('u' is the shortcut) separate regions using range marker (a new right click menu on a range matker), easter egg
git-svn-id: svn://localhost/trunk/ardour2@438 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
2aced5ff65
commit
825d7a769d
|
@ -66,6 +66,7 @@
|
|||
(gtk_accel_path "<Actions>/Editor/select-all-before-edit-cursor" "<control>e")
|
||||
(gtk_accel_path "<Actions>/Editor/select-all-after-playhead" "<shift><Control>p")
|
||||
(gtk_accel_path "<Actions>/Editor/select-all-before-playhead" "<control>p")
|
||||
(gtk_accel_path "<Actions>/Editor/select-all-between-cursors" "u")
|
||||
(gtk_accel_path "<Actions>/Editor/select-all-in-punch-range" "<Control>d")
|
||||
(gtk_accel_path "<Actions>/Editor/select-all-in-loop-range" "<Control>l")
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
<menuitem action='select-all-before-edit-cursor'/>
|
||||
<menuitem action='select-all-after-playhead'/>
|
||||
<menuitem action='select-all-before-playhead'/>
|
||||
<menuitem action='select-all-between-cursors'/>
|
||||
<menuitem action='select-all-in-punch-range'/>
|
||||
<menuitem action='select-all-in-loop-range'/>
|
||||
</menu>
|
||||
|
|
|
@ -285,6 +285,7 @@ Editor::Editor (AudioEngine& eng)
|
|||
route_list_menu = 0;
|
||||
region_list_menu = 0;
|
||||
marker_menu = 0;
|
||||
range_marker_menu = 0;
|
||||
marker_menu_item = 0;
|
||||
tm_marker_menu = 0;
|
||||
transport_marker_menu = 0;
|
||||
|
@ -1961,6 +1962,7 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
|
|||
select_items.push_back (MenuElem (_("Select all before edit cursor"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), edit_cursor, 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"), bind (mem_fun(*this, &Editor::select_all_selectables_between_cursors), playhead_cursor, edit_cursor)));
|
||||
select_items.push_back (SeparatorElem());
|
||||
|
||||
edit_items.push_back (MenuElem (_("Select"), *select_menu));
|
||||
|
|
|
@ -168,6 +168,7 @@ class Editor : public PublicEditor
|
|||
|
||||
void new_region_from_selection ();
|
||||
void separate_region_from_selection ();
|
||||
void separate_regions_using_location (ARDOUR::Location&);
|
||||
void toggle_playback (bool with_abort);
|
||||
|
||||
/* undo related */
|
||||
|
@ -667,6 +668,7 @@ class Editor : public PublicEditor
|
|||
void cursor_to_selection_start (Cursor *);
|
||||
void cursor_to_selection_end (Cursor *);
|
||||
void select_all_selectables_using_cursor (Cursor *, bool);
|
||||
void select_all_selectables_between_cursors (Cursor *, Cursor *);
|
||||
|
||||
ARDOUR::Region* find_next_region (jack_nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
|
||||
|
||||
|
@ -1256,6 +1258,7 @@ class Editor : public PublicEditor
|
|||
void marker_menu_hide ();
|
||||
void marker_menu_loop_range ();
|
||||
void marker_menu_select_all_selectables_using_range ();
|
||||
void marker_menu_separate_regions_using_location ();
|
||||
void marker_menu_play_from ();
|
||||
void marker_menu_set_playhead ();
|
||||
void marker_menu_set_from_playhead ();
|
||||
|
@ -1277,6 +1280,7 @@ class Editor : public PublicEditor
|
|||
|
||||
Gtk::Menu* tm_marker_menu;
|
||||
Gtk::Menu* marker_menu;
|
||||
Gtk::Menu* range_marker_menu;
|
||||
Gtk::Menu* transport_marker_menu;
|
||||
Gtk::Menu* new_transport_marker_menu;
|
||||
ArdourCanvas::Item* marker_menu_item;
|
||||
|
|
|
@ -108,6 +108,8 @@ 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"), bind (mem_fun(*this, &Editor::select_all_selectables_between_cursors), playhead_cursor, edit_cursor));
|
||||
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));
|
||||
ActionManager::session_sensitive_actions.push_back (act);
|
||||
|
|
|
@ -368,7 +368,6 @@ Editor::tm_marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
|
|||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
|
||||
{
|
||||
|
@ -387,13 +386,12 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
|
|||
marker_menu_item = item;
|
||||
transport_marker_menu->popup (1, ev->time);
|
||||
} else {
|
||||
if (marker_menu == 0) {
|
||||
if (loc->is_mark()) {
|
||||
build_marker_menu ();
|
||||
} else {
|
||||
build_range_marker_menu ();
|
||||
}
|
||||
}
|
||||
|
||||
if (loc->is_mark()) {
|
||||
if (marker_menu == 0) {
|
||||
build_marker_menu ();
|
||||
}
|
||||
|
||||
|
||||
// GTK2FIX use action group sensitivity
|
||||
#ifdef GTK2FIX
|
||||
|
@ -411,10 +409,18 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
|
|||
#endif
|
||||
marker_menu_item = item;
|
||||
marker_menu->popup (1, ev->time);
|
||||
}
|
||||
|
||||
if (loc->is_range_marker()) {
|
||||
if (range_marker_menu == 0){
|
||||
build_range_marker_menu ();
|
||||
}
|
||||
marker_menu_item = item;
|
||||
range_marker_menu->popup (1, ev->time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Editor::new_transport_marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
|
||||
{
|
||||
|
@ -445,11 +451,9 @@ Editor::build_marker_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 (MenuElem (_("Locate to mark"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
|
||||
items.push_back (MenuElem (_("Play from mark"), mem_fun(*this, &Editor::marker_menu_play_from)));
|
||||
items.push_back (MenuElem (_("Set mark from playhead"), mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
|
||||
|
||||
items.push_back (SeparatorElem());
|
||||
|
||||
|
@ -464,24 +468,26 @@ Editor::build_range_marker_menu ()
|
|||
{
|
||||
using namespace Menu_Helpers;
|
||||
|
||||
marker_menu = new Menu;
|
||||
MenuList& items = marker_menu->items();
|
||||
marker_menu->set_name ("ArdourContextMenu");
|
||||
range_marker_menu = new Menu;
|
||||
MenuList& items = range_marker_menu->items();
|
||||
range_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 (_("Locate to range mark"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
|
||||
items.push_back (MenuElem (_("Play from range mark"), 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 (MenuElem (_("Set range mark from playhead"), mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
|
||||
items.push_back (MenuElem (_("Set range from range selection"), 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 (MenuElem (_("Rename range"), mem_fun(*this, &Editor::marker_menu_rename)));
|
||||
items.push_back (MenuElem (_("Hide range"), mem_fun(*this, &Editor::marker_menu_hide)));
|
||||
items.push_back (MenuElem (_("Remove range"), 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_selectables_using_range)));
|
||||
|
||||
items.push_back (MenuElem (_("Separate regions from range"), mem_fun(*this, &Editor::marker_menu_separate_regions_using_location)));
|
||||
items.push_back (MenuElem (_("Select all in range"), mem_fun(*this, &Editor::marker_menu_select_all_selectables_using_range)));
|
||||
|
||||
}
|
||||
|
||||
|
@ -564,7 +570,26 @@ Editor::marker_menu_select_all_selectables_using_range ()
|
|||
bool is_start;
|
||||
|
||||
if (((l = find_location_from_marker (marker, is_start)) != 0) && (l->end() > l->start())) {
|
||||
select_all_within (l->start(), l->end(), 0, DBL_MAX, Selection::Set);
|
||||
select_all_within (l->start(), l->end() - 1, 0, DBL_MAX, Selection::Set);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
Editor::marker_menu_separate_regions_using_location ()
|
||||
{
|
||||
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) && (l->end() > l->start())) {
|
||||
separate_regions_using_location (*l);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1513,6 +1513,36 @@ Editor::select_all_selectables_using_cursor (Cursor *cursor, bool after)
|
|||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::select_all_selectables_between_cursors (Cursor *cursor, Cursor *other_cursor)
|
||||
{
|
||||
jack_nframes_t start;
|
||||
jack_nframes_t end;
|
||||
list<Selectable *> touched;
|
||||
bool other_cursor_is_first = cursor->current_frame > other_cursor->current_frame;
|
||||
if (cursor->current_frame == other_cursor->current_frame) {
|
||||
return;
|
||||
}
|
||||
begin_reversible_command (_("select all between cursors"));
|
||||
if ( other_cursor_is_first) {
|
||||
start = other_cursor->current_frame;
|
||||
end = cursor->current_frame - 1;
|
||||
|
||||
} else {
|
||||
start = cursor->current_frame;
|
||||
end = other_cursor->current_frame - 1;
|
||||
}
|
||||
|
||||
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);
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::amplitude_zoom_step (bool in)
|
||||
{
|
||||
|
@ -2184,6 +2214,53 @@ Editor::separate_region_from_selection ()
|
|||
if (doing_undo) commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::separate_regions_using_location (Location& loc)
|
||||
{
|
||||
bool doing_undo = false;
|
||||
|
||||
if (loc.is_mark()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Playlist *playlist;
|
||||
|
||||
/* XXX i'm unsure as to whether this should operate on selected tracks only
|
||||
or the entire enchillada. uncomment the below line to correct the behaviour
|
||||
(currently set for all tracks)
|
||||
*/
|
||||
|
||||
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
|
||||
//for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
|
||||
|
||||
AudioTimeAxisView* atv;
|
||||
|
||||
if ((atv = dynamic_cast<AudioTimeAxisView*> ((*i))) != 0) {
|
||||
|
||||
if (atv->is_audio_track()) {
|
||||
|
||||
if ((playlist = atv->playlist()) != 0) {
|
||||
if (!doing_undo) {
|
||||
begin_reversible_command (_("separate"));
|
||||
doing_undo = true;
|
||||
}
|
||||
if (doing_undo) session->add_undo ((playlist)->get_memento());
|
||||
|
||||
/* XXX need to consider musical time selections here at some point */
|
||||
|
||||
double speed = atv->get_diskstream()->speed();
|
||||
|
||||
|
||||
playlist->partition ((jack_nframes_t)(loc.start() * speed), (jack_nframes_t)(loc.end() * speed), true);
|
||||
if (doing_undo) session->add_redo_no_execute (playlist->get_memento());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (doing_undo) commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::crop_region_to_selection ()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue