/*
- Copyright (C) 2000-2018 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2007-2015 David Robillard <d@drobilla.net>
+ * Copyright (C) 2007-2018 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2013-2017 Nick Mainsbridge <mainsbridge@gmail.com>
+ * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2014-2019 Ben Loftis <ben@harrisonconsoles.com>
+ * Copyright (C) 2015 André Nusser <andre.nusser@googlemail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
#include <algorithm>
#include <cstdlib>
#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"
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
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.
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);
_region_actions->get_action("naturalize-region")->set_sensitive (false);
}
-/* Todo: insert-region-from-source-list
+ /* Todo: insert-region-from-source-list */
/* 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
sensitize_the_right_region_actions (false);
/* propagate into backend */
+ assert (_session);
- if (_session) {
- if (!selection->regions.empty()) {
- _session->set_object_selection (selection->regions.start(), selection->regions.end_sample());
- } else {
- _session->clear_object_selection ();
- }
+ if (!selection->regions.empty()) {
+ _session->set_object_selection (selection->regions.start(), selection->regions.end_sample());
+ } else {
+ _session->clear_object_selection ();
}
if (_session->solo_selection_active()) {
{
if (internal_editing()) {
- for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
+ for (MidiRegionSelection::iterator i = selection->midi_regions.begin(); i != selection->midi_regions.end(); ++i) {
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*i);
if (mrv) {
mrv->invert_selection ();