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"
|
2024-09-20 22:00:46 -04:00
|
|
|
#include "editor_automation_line.h"
|
2021-11-29 17:30:34 -05:00
|
|
|
#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"
|
|
|
|
|
2024-11-12 22:06:04 -05:00
|
|
|
#include "audio_route_properties_box.h"
|
|
|
|
|
2021-11-29 17:30:34 -05:00
|
|
|
#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
|
|
|
|
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);
|
|
|
|
|
2024-11-12 22:06:04 -05:00
|
|
|
/* ROUTE properties, for Track selections */
|
|
|
|
_route_prop_box = new RoutePropertiesBox ();
|
|
|
|
pack_start(*_route_prop_box, false, false, 0);
|
|
|
|
|
|
|
|
_time_info_box->set_no_show_all();
|
|
|
|
_mregions_prop_box->set_no_show_all();
|
|
|
|
_audio_prop_box->set_no_show_all();
|
|
|
|
_midi_ops_box->set_no_show_all();
|
|
|
|
_audio_ops_box->set_no_show_all();
|
|
|
|
_slot_prop_box->set_no_show_all();
|
|
|
|
_route_prop_box->set_no_show_all();
|
2021-11-29 17:30:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
SelectionPropertiesBox::~SelectionPropertiesBox ()
|
|
|
|
{
|
|
|
|
delete _time_info_box;
|
|
|
|
|
|
|
|
delete _mregions_prop_box;
|
|
|
|
|
|
|
|
delete _slot_prop_box;
|
|
|
|
|
|
|
|
delete _midi_ops_box;
|
|
|
|
delete _audio_ops_box;
|
|
|
|
|
|
|
|
delete _midi_prop_box;
|
|
|
|
delete _audio_prop_box;
|
2024-11-12 22:06:04 -05:00
|
|
|
|
|
|
|
delete _route_prop_box; //todo: split into midi/audio
|
2021-11-29 17:30:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SelectionPropertiesBox::set_session (Session* s)
|
|
|
|
{
|
|
|
|
SessionHandlePtr::set_session (s);
|
|
|
|
|
2024-11-07 11:23:42 -05:00
|
|
|
if (!s) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-29 17:30:34 -05:00
|
|
|
_time_info_box->set_session(s);
|
2022-01-17 14:02:30 -05:00
|
|
|
|
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);
|
2024-11-12 22:06:04 -05:00
|
|
|
|
|
|
|
_route_prop_box->set_session(s);
|
|
|
|
|
|
|
|
/* 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), std::bind (&SelectionPropertiesBox::track_mouse_mode, this), gui_context());
|
|
|
|
|
|
|
|
selection_changed();
|
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();
|
|
|
|
|
|
|
|
_mregions_prop_box->hide();
|
|
|
|
|
|
|
|
_midi_ops_box->hide();
|
|
|
|
_audio_ops_box->hide();
|
|
|
|
|
|
|
|
_midi_prop_box->hide();
|
|
|
|
_audio_prop_box->hide();
|
|
|
|
|
|
|
|
_slot_prop_box->hide();
|
2024-11-12 22:06:04 -05:00
|
|
|
|
|
|
|
_route_prop_box->hide();
|
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
|
|
|
}
|
|
|
|
|
2024-11-12 22:06:04 -05:00
|
|
|
if (!selection.tracks.empty()) {
|
|
|
|
_route_prop_box->show();
|
|
|
|
TimeAxisView *tav = *(selection.tracks.begin());
|
|
|
|
RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView *>(tav);
|
|
|
|
_route_prop_box->set_route(rtav->route());
|
|
|
|
_header_label.set_text(_("Track Properties (Press ESC to Deselect All)"));
|
|
|
|
_header_label.hide();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
}
|
2024-11-12 22:06:04 -05:00
|
|
|
#endif
|
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>();
|
2024-11-12 22:06:04 -05:00
|
|
|
RegionView *selected_regionview = NULL;
|
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();
|
|
|
|
|
2024-11-12 22:06:04 -05:00
|
|
|
// selected_region = ref.trigger()->region();
|
2021-11-29 17:30:34 -05:00
|
|
|
} else if (selection.regions.size()==1) {
|
2024-11-12 22:06:04 -05:00
|
|
|
selected_regionview = *(selection.regions.begin());
|
2021-11-29 17:30:34 -05:00
|
|
|
}
|
|
|
|
|
2024-11-12 22:06:04 -05:00
|
|
|
#if 0 // TODO pack region-properties here
|
|
|
|
if (selected_regionview) {
|
|
|
|
std::shared_ptr<ARDOUR::Region> r = selected_regionview->region();
|
2021-11-29 17:30:34 -05:00
|
|
|
//region properties
|
2024-11-12 22:06:04 -05:00
|
|
|
if (r && r->data_type() == DataType::MIDI) {
|
|
|
|
_midi_prop_box->set_regionview(selected_regionview);
|
2021-11-29 17:30:34 -05:00
|
|
|
_midi_prop_box->show();
|
2024-11-12 22:06:04 -05:00
|
|
|
} else if (r) {
|
|
|
|
_audio_prop_box->set_regionview(selected_regionview); //retains a SessionHandler reference somewhere @robin
|
2021-11-29 17:30:34 -05:00
|
|
|
_audio_prop_box->show();
|
|
|
|
}
|
|
|
|
}
|
2022-01-17 14:02:30 -05:00
|
|
|
#endif
|
2021-11-29 17:30:34 -05:00
|
|
|
}
|