2021-11-29 17:30:34 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2021 Ben Loftis <ben@harrisonconsoles.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 "pbd/compose.h"
|
|
|
|
|
|
|
|
#include "gtkmm2ext/gui_thread.h"
|
|
|
|
#include "gtkmm2ext/utils.h"
|
|
|
|
#include "gtkmm2ext/actions.h"
|
|
|
|
|
|
|
|
#include "ardour/location.h"
|
|
|
|
#include "ardour/profile.h"
|
|
|
|
#include "ardour/session.h"
|
|
|
|
|
|
|
|
#include "audio_clock.h"
|
|
|
|
#include "automation_line.h"
|
|
|
|
#include "control_point.h"
|
|
|
|
#include "editor.h"
|
|
|
|
#include "region_view.h"
|
|
|
|
#include "time_info_box.h"
|
2022-01-10 22:06:52 -05:00
|
|
|
#include "triggerbox_ui.h"
|
2021-11-29 17:30:34 -05:00
|
|
|
|
|
|
|
#include "multi_region_properties_box.h"
|
|
|
|
|
|
|
|
#include "audio_region_properties_box.h"
|
|
|
|
#include "midi_region_properties_box.h"
|
|
|
|
|
|
|
|
#include "audio_region_operations_box.h"
|
|
|
|
#include "midi_region_operations_box.h"
|
|
|
|
|
|
|
|
#include "slot_properties_box.h"
|
|
|
|
|
|
|
|
#include "selection_properties_box.h"
|
|
|
|
|
|
|
|
#include "pbd/i18n.h"
|
|
|
|
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace ARDOUR;
|
|
|
|
using std::min;
|
|
|
|
using std::max;
|
|
|
|
|
|
|
|
SelectionPropertiesBox::SelectionPropertiesBox ()
|
|
|
|
{
|
|
|
|
_header_label.set_text(_("Selection Properties (ESC = Deselect All)"));
|
|
|
|
_header_label.set_alignment(0.0, 0.5);
|
|
|
|
pack_start(_header_label, false, false, 6);
|
|
|
|
|
|
|
|
/* Time Info, for Range selections ToDo: range operations*/
|
|
|
|
_time_info_box = new TimeInfoBox ("EditorTimeInfo", true);
|
|
|
|
pack_start(*_time_info_box, false, false, 0);
|
2021-12-21 15:38:22 -05:00
|
|
|
|
2022-01-17 14:02:30 -05:00
|
|
|
#if SELECTION_PROPERTIES_BOX_TODO
|
2021-11-29 17:30:34 -05:00
|
|
|
/* Region ops (mute/unmute), for multiple-Region selections */
|
|
|
|
_mregions_prop_box = new MultiRegionPropertiesBox ();
|
|
|
|
pack_start(*_mregions_prop_box, false, false, 0);
|
|
|
|
|
|
|
|
|
|
|
|
/* MIDI Region props, for Clips */
|
|
|
|
_midi_prop_box = new MidiRegionPropertiesBox ();
|
|
|
|
pack_start(*_midi_prop_box, false, false, 0);
|
|
|
|
|
|
|
|
/* AUDIO Region props for Clips */
|
|
|
|
_audio_prop_box = new AudioRegionPropertiesBox ();
|
|
|
|
pack_start(*_audio_prop_box, false, false, 0);
|
|
|
|
|
|
|
|
|
|
|
|
/* MIDI Region ops (transpose, quantize), for only-midi selections */
|
|
|
|
_midi_ops_box = new MidiRegionOperationsBox ();
|
|
|
|
pack_start(*_midi_ops_box, false, false, 0);
|
|
|
|
|
|
|
|
/* AUDIO Region ops (reverse, normalize), for only-audio selections */
|
|
|
|
_audio_ops_box = new AudioRegionOperationsBox ();
|
|
|
|
pack_start(*_audio_ops_box, false, false, 0);
|
2021-12-21 15:38:22 -05:00
|
|
|
|
2021-11-29 17:30:34 -05:00
|
|
|
|
|
|
|
/* SLOT properties, for Trigger slot selections */
|
|
|
|
_slot_prop_box = new SlotPropertiesBox ();
|
|
|
|
pack_start(*_slot_prop_box, false, false, 0);
|
2022-01-17 14:02:30 -05:00
|
|
|
#endif
|
2021-11-29 17:30:34 -05:00
|
|
|
|
|
|
|
/* watch for any change in our selection, so we can show an appropriate property editor */
|
|
|
|
Editor::instance().get_selection().TracksChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed));
|
|
|
|
Editor::instance().get_selection().RegionsChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed));
|
|
|
|
Editor::instance().get_selection().TimeChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed));
|
|
|
|
Editor::instance().get_selection().LinesChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed));
|
|
|
|
Editor::instance().get_selection().PlaylistsChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed));
|
|
|
|
Editor::instance().get_selection().PointsChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed));
|
|
|
|
Editor::instance().get_selection().MarkersChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed));
|
|
|
|
Editor::instance().get_selection().MidiNotesChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed));
|
|
|
|
Editor::instance().get_selection().TriggersChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed));
|
|
|
|
|
|
|
|
/* maybe we care about mouse mode?? */
|
|
|
|
Editor::instance().MouseModeChanged.connect (editor_connections, invalidator(*this), boost::bind (&SelectionPropertiesBox::track_mouse_mode, this), gui_context());
|
|
|
|
|
|
|
|
selection_changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
SelectionPropertiesBox::~SelectionPropertiesBox ()
|
|
|
|
{
|
|
|
|
delete _time_info_box;
|
|
|
|
|
2022-01-17 14:02:30 -05:00
|
|
|
#if SELECTION_PROPERTIES_BOX_TODO
|
2021-11-29 17:30:34 -05:00
|
|
|
delete _mregions_prop_box;
|
|
|
|
|
|
|
|
delete _slot_prop_box;
|
|
|
|
|
|
|
|
delete _midi_ops_box;
|
|
|
|
delete _audio_ops_box;
|
|
|
|
|
|
|
|
delete _midi_prop_box;
|
|
|
|
delete _audio_prop_box;
|
2022-01-17 14:02:30 -05:00
|
|
|
#endif
|
2021-11-29 17:30:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SelectionPropertiesBox::set_session (Session* s)
|
|
|
|
{
|
|
|
|
SessionHandlePtr::set_session (s);
|
|
|
|
|
|
|
|
_time_info_box->set_session(s);
|
2022-01-17 14:02:30 -05:00
|
|
|
|
|
|
|
#if SELECTION_PROPERTIES_BOX_TODO
|
2021-11-29 17:30:34 -05:00
|
|
|
_mregions_prop_box->set_session(s);
|
|
|
|
|
|
|
|
_midi_prop_box->set_session(s);
|
|
|
|
_audio_prop_box->set_session(s);
|
|
|
|
|
|
|
|
_midi_ops_box->set_session(s);
|
|
|
|
_audio_ops_box->set_session(s);
|
|
|
|
|
|
|
|
_slot_prop_box->set_session(s);
|
2022-01-17 14:02:30 -05:00
|
|
|
#endif
|
2021-11-29 17:30:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SelectionPropertiesBox::track_mouse_mode ()
|
|
|
|
{
|
|
|
|
/* maybe do something here? */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SelectionPropertiesBox::selection_changed ()
|
|
|
|
{
|
|
|
|
Selection& selection (Editor::instance().get_selection());
|
|
|
|
|
|
|
|
_time_info_box->hide();
|
|
|
|
|
2022-01-17 14:02:30 -05:00
|
|
|
#if SELECTION_PROPERTIES_BOX_TODO
|
2021-11-29 17:30:34 -05:00
|
|
|
_mregions_prop_box->hide();
|
|
|
|
|
|
|
|
_midi_ops_box->hide();
|
|
|
|
_audio_ops_box->hide();
|
|
|
|
|
|
|
|
_midi_prop_box->hide();
|
|
|
|
_audio_prop_box->hide();
|
|
|
|
|
|
|
|
_slot_prop_box->hide();
|
2022-01-17 14:02:30 -05:00
|
|
|
#endif
|
2021-11-29 17:30:34 -05:00
|
|
|
|
2022-01-26 10:22:48 -05:00
|
|
|
_header_label.hide();
|
2021-12-21 15:38:22 -05:00
|
|
|
|
2021-11-29 17:30:34 -05:00
|
|
|
if (!selection.time.empty()) {
|
|
|
|
_time_info_box->show();
|
2022-01-26 10:22:48 -05:00
|
|
|
_header_label.set_text(_("Range Properties (Press ESC to Deselect All)"));
|
|
|
|
_header_label.show();
|
2021-11-29 17:30:34 -05:00
|
|
|
}
|
|
|
|
|
2022-01-17 14:02:30 -05:00
|
|
|
#if SELECTION_PROPERTIES_BOX_TODO
|
2021-11-29 17:30:34 -05:00
|
|
|
/* one or more regions, show the multi-region operations box (just MUTE? kinda boring) */
|
|
|
|
if (!selection.regions.empty()) {
|
|
|
|
_mregions_prop_box->show();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool found_midi_regions = false;
|
|
|
|
for (RegionSelection::iterator s = selection.regions.begin(); s != selection.regions.end(); ++s) {
|
|
|
|
ARDOUR::Region* region = (*s)->region().get();
|
|
|
|
if (region->data_type() == DataType::MIDI) {
|
|
|
|
found_midi_regions = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool found_audio_regions = false;
|
|
|
|
for (RegionSelection::iterator s = selection.regions.begin(); s != selection.regions.end(); ++s) {
|
|
|
|
ARDOUR::Region* region = (*s)->region().get();
|
|
|
|
if (region->data_type() == DataType::AUDIO) {
|
|
|
|
found_audio_regions = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found_midi_regions && ! found_audio_regions) {
|
|
|
|
_midi_ops_box->show();
|
|
|
|
}
|
|
|
|
if (found_audio_regions && ! found_midi_regions) {
|
|
|
|
_audio_ops_box->show();
|
|
|
|
}
|
2021-12-21 15:38:22 -05:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::Region> selected_region = std::shared_ptr<ARDOUR::Region>();
|
2021-11-29 17:30:34 -05:00
|
|
|
|
|
|
|
if (!selection.triggers.empty()) {
|
|
|
|
TriggerSelection ts = selection.triggers;
|
|
|
|
TriggerEntry* entry = *ts.begin();
|
2021-12-24 16:13:36 -05:00
|
|
|
TriggerReference ref = entry->trigger_reference();
|
2021-11-29 17:30:34 -05:00
|
|
|
|
|
|
|
//slot properties incl "Follow Actions"
|
2021-12-24 16:13:36 -05:00
|
|
|
_slot_prop_box->set_slot(ref);
|
2021-11-29 17:30:34 -05:00
|
|
|
_slot_prop_box->show();
|
|
|
|
|
2021-12-24 16:13:36 -05:00
|
|
|
selected_region = ref.trigger()->region();
|
2021-11-29 17:30:34 -05:00
|
|
|
} else if (selection.regions.size()==1) {
|
|
|
|
selected_region = (*(selection.regions.begin()))->region();
|
|
|
|
}
|
|
|
|
|
2021-12-21 15:38:22 -05:00
|
|
|
if (selected_region) {
|
2021-11-29 17:30:34 -05:00
|
|
|
//region properties
|
|
|
|
if (selected_region->data_type() == DataType::MIDI) {
|
|
|
|
_midi_prop_box->set_region(selected_region);
|
|
|
|
_midi_prop_box->show();
|
|
|
|
_midi_ops_box->show();
|
|
|
|
} else {
|
|
|
|
_audio_prop_box->set_region(selected_region);
|
|
|
|
_audio_prop_box->show();
|
|
|
|
_audio_ops_box->show();
|
|
|
|
}
|
|
|
|
}
|
2022-01-17 14:02:30 -05:00
|
|
|
#endif
|
2021-11-29 17:30:34 -05:00
|
|
|
}
|