(Source List) Implement insert-region action... now uses the Source List.

This commit is contained in:
Ben Loftis 2019-07-30 13:02:15 -05:00
parent 50786b3e5c
commit da3d8e5418
7 changed files with 18 additions and 9 deletions

View File

@ -166,7 +166,7 @@ This mode provides many different operations on both regions and control points,
@edit|Editor/alternate-redo|<@PRIMARY@>y|redo
@select|Editor/select-all-between-cursors|<@PRIMARY@>u|all enclosed by edit range
@select|Editor/select-all-within-cursors|u|all present in edit range
@eep|Region/insert-region-from-region-list|i|insert from region list
@eep|Region/insert-region-from-source-list|i|insert from region list
@sess|Common/addExistingAudioFiles|<@PRIMARY@>i|import audio files
@gselect|Common/invert-selection|<@TERTIARY@>i|invert selection
@edtrk|Editor/toggle-midi-input-active|<@SECONDARY@>i|toggle sel. track MIDI input

View File

@ -293,7 +293,7 @@
</menu>
<menu name='RegionMenu' action='RegionMenu'>
<menuitem action='insert-region-from-region-list'/>
<menuitem action='insert-region-from-source-list'/>
<menuitem action='play-selected-regions'/>
<menuitem action='tag-selected-regions'/>
<menuitem action='loop-region'/>

View File

@ -2041,7 +2041,7 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
/* Adding new material */
edit_items.push_back (SeparatorElem());
edit_items.push_back (MenuElem (_("Insert Selected Region"), sigc::bind (sigc::mem_fun(*this, &Editor::insert_region_list_selection), 1.0f)));
edit_items.push_back (MenuElem (_("Insert Selected Region"), sigc::bind (sigc::mem_fun(*this, &Editor::insert_source_list_selection), 1.0f)));
edit_items.push_back (MenuElem (_("Insert Existing Media"), sigc::bind (sigc::mem_fun(*this, &Editor::add_external_audio_action), ImportToTrack)));
/* Nudge track */

View File

@ -1322,7 +1322,7 @@ private:
void temporal_zoom_by_sample (samplepos_t start, samplepos_t end);
void temporal_zoom_to_sample (bool coarser, samplepos_t sample);
void insert_region_list_selection (float times);
void insert_source_list_selection (float times);
/* import & embed */

View File

@ -1559,7 +1559,7 @@ Editor::register_region_actions ()
/* PART 2: actions that are not related to the selection, but for which the edit point type and location is important */
// register_region_action (_region_actions, RegionActionTarget (ListSelection), "insert-region-from-region-list", _("Insert Region from Region List"), sigc::bind (sigc::mem_fun (*this, &Editor::insert_region_list_selection), 1));
register_region_action (_region_actions, RegionActionTarget (ListSelection), "insert-region-from-source-list", _("Insert Region from Source List"), sigc::bind (sigc::mem_fun (*this, &Editor::insert_source_list_selection), 1));
/* PART 3: actions that operate on the selection and also require the edit point location */

View File

@ -84,6 +84,7 @@
#include "editor_cursors.h"
#include "editor_drag.h"
#include "editor_regions.h"
#include "editor_sources.h"
#include "editor_routes.h"
#include "gui_thread.h"
#include "insert_remove_time_dialog.h"
@ -2542,7 +2543,7 @@ Editor::unhide_ranges ()
/* INSERT/REPLACE */
void
Editor::insert_region_list_selection (float times)
Editor::insert_source_list_selection (float times)
{
RouteTimeAxisView *tv = 0;
boost::shared_ptr<Playlist> playlist;
@ -2565,7 +2566,7 @@ Editor::insert_region_list_selection (float times)
return;
}
boost::shared_ptr<Region> region = _regions->get_single_selection ();
boost::shared_ptr<Region> region = _sources->get_single_selection ();
if (region == 0) {
return;
}

View File

@ -35,6 +35,7 @@
#include "editor.h"
#include "editor_drag.h"
#include "editor_routes.h"
#include "editor_sources.h"
#include "actions.h"
#include "audio_time_axis.h"
#include "audio_region_view.h"
@ -1214,6 +1215,7 @@ Editor::sensitize_the_right_region_actions (bool because_canvas_crossing)
bool have_selection = false;
bool have_entered = false;
bool have_edit_point = false;
bool have_selected_source = false;
RegionSelection rs;
// std::cerr << "STRRA: crossing ? " << because_canvas_crossing << " within ? " << within_track_canvas
@ -1229,6 +1231,10 @@ Editor::sensitize_the_right_region_actions (bool because_canvas_crossing)
rs.add (entered_regionview);
}
if ( _sources->get_single_selection() ) {
have_selected_source = true;
}
if (rs.empty() && !selection->tracks.empty()) {
/* no selected regions, but some selected tracks.
@ -1278,6 +1284,8 @@ Editor::sensitize_the_right_region_actions (bool because_canvas_crossing)
sensitive = true;
} else if ((tgt & EditPointRegions) && have_edit_point) {
sensitive = true;
} else if ((tgt & ListSelection) && have_selected_source ) {
sensitive = true;
}
x->second.action->set_sensitive (sensitive);
@ -1507,9 +1515,9 @@ Editor::sensitize_the_right_region_actions (bool because_canvas_crossing)
/* XXX: should also check that there is a track of the appropriate type for the selected region */
#if 0
if (_edit_point == EditAtMouse || _regions->get_single_selection() == 0 || selection->tracks.empty()) {
_region_actions->get_action("insert-region-from-region-list")->set_sensitive (false);
_region_actions->get_action("insert-region-from-source-list")->set_sensitive (false);
} else {
_region_actions->get_action("insert-region-from-region-list")->set_sensitive (true);
_region_actions->get_action("insert-region-from-source-list")->set_sensitive (true);
}
#endif