From a53b99b307f8f2244bd9c2e987c82ecb7be19398 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 13 Nov 2024 04:06:04 +0100 Subject: [PATCH] Introduction of route property boxen and editor properties pane --- gtk2_ardour/audio_route_properties_box.cc | 60 ++++++++++ gtk2_ardour/audio_route_properties_box.h | 45 ++++++++ gtk2_ardour/editor.cc | 6 +- gtk2_ardour/route_properties_box.cc | 68 +++++++++++ gtk2_ardour/route_properties_box.h | 62 ++++++++++ gtk2_ardour/selection_properties_box.cc | 135 +++++++++++++--------- gtk2_ardour/selection_properties_box.h | 8 +- gtk2_ardour/wscript | 2 + 8 files changed, 322 insertions(+), 64 deletions(-) create mode 100644 gtk2_ardour/audio_route_properties_box.cc create mode 100644 gtk2_ardour/audio_route_properties_box.h create mode 100644 gtk2_ardour/route_properties_box.cc create mode 100644 gtk2_ardour/route_properties_box.h diff --git a/gtk2_ardour/audio_route_properties_box.cc b/gtk2_ardour/audio_route_properties_box.cc new file mode 100644 index 0000000000..849bcece32 --- /dev/null +++ b/gtk2_ardour/audio_route_properties_box.cc @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2011-2017 Paul Davis + * Copyright (C) 2024 Ben Loftis + * + * 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 "pbd/compose.h" +#include + +#include "gtkmm2ext/actions.h" +#include "gtkmm2ext/gui_thread.h" +#include "gtkmm2ext/utils.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 "audio_route_properties_box.h" + +#include "pbd/i18n.h" + +using namespace Gtk; +using namespace ARDOUR; +using namespace ArdourWidgets; +using std::max; +using std::min; + +AudioRoutePropertiesBox::AudioRoutePropertiesBox () +{ + _header_label.set_text (_("AUDIO Region Properties:")); + + Gtk::Table* audio_t = manage (new Gtk::Table ()); + audio_t->set_homogeneous (true); + audio_t->set_spacings (4); + + pack_start (*audio_t); +} + +AudioRoutePropertiesBox::~AudioRoutePropertiesBox () +{ +} diff --git a/gtk2_ardour/audio_route_properties_box.h b/gtk2_ardour/audio_route_properties_box.h new file mode 100644 index 0000000000..1625508e11 --- /dev/null +++ b/gtk2_ardour/audio_route_properties_box.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 Paul Davis + * Copyright (C) 2024 Ben Loftis + * + * 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. + */ + +#pragma once + +#include + +#include +#include +#include + +#include "ardour/ardour.h" +#include "ardour/session_handle.h" + +#include "widgets/ardour_button.h" + +#include "gtkmm2ext/cairo_packer.h" + +#include "route_properties_box.h" + +class AudioRoutePropertiesBox : public RoutePropertiesBox +{ +public: + AudioRoutePropertiesBox (); + ~AudioRoutePropertiesBox (); + +private: + +}; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 6b859523d8..f089beb7f4 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -600,10 +600,6 @@ Editor::Editor () Location::end_changed.connect (*this, invalidator (*this), std::bind (&Editor::location_changed, this, _1), gui_context()); Location::changed.connect (*this, invalidator (*this), std::bind (&Editor::location_changed, this, _1), gui_context()); -#if SELECTION_PROPERTIES_BOX_TODO - add_notebook_page (_("Selection"), *_properties_box); -#warning Fix Properties Sidebar Layout to fit < 720px height -#endif add_notebook_page (_("Tracks & Busses"), _routes->widget ()); add_notebook_page (_("Sources"), _sources->widget ()); add_notebook_page (_("Regions"), _regions->widget ()); @@ -661,7 +657,6 @@ Editor::Editor () editor_summary_pane.add (_summary_hbox); _editor_list_vbox.pack_start (_the_notebook); - _editor_list_vbox.pack_start (*_properties_box, false, false, 0); content_right_pane.set_drag_cursor (*_cursors->expand_left_right); editor_summary_pane.set_drag_cursor (*_cursors->expand_up_down); @@ -689,6 +684,7 @@ Editor::Editor () */ content_app_bar.add (_application_bar); content_att_right.add (_editor_list_vbox); + content_att_bottom.add (*_properties_box); content_toolbar.add (global_vpacker); content_innermost_hbox.add (editor_summary_pane); diff --git a/gtk2_ardour/route_properties_box.cc b/gtk2_ardour/route_properties_box.cc new file mode 100644 index 0000000000..8820abc17e --- /dev/null +++ b/gtk2_ardour/route_properties_box.cc @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2011-2017 Paul Davis + * Copyright (C) 2024 Ben Loftis + * + * 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 "pbd/compose.h" +#include + +#include "gtkmm2ext/actions.h" +#include "gtkmm2ext/gui_thread.h" +#include "gtkmm2ext/utils.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 "route_properties_box.h" + +#include "pbd/i18n.h" + +using namespace Gtk; +using namespace ARDOUR; +using namespace ArdourWidgets; +using std::max; +using std::min; + +RoutePropertiesBox::RoutePropertiesBox () +{ + show_all(); +} + +RoutePropertiesBox::~RoutePropertiesBox () +{ +} + +void +RoutePropertiesBox::set_route (std::shared_ptr rt) +{ + //TODO: route properties +// rt->PropertyChanged.connect (state_connection, invalidator (*this), boost::bind (&RoutePropertiesBox::region_changed, this, _1), gui_context ()); +} + +void +RoutePropertiesBox::property_changed (const PBD::PropertyChange& what_changed) +{ + + +} diff --git a/gtk2_ardour/route_properties_box.h b/gtk2_ardour/route_properties_box.h new file mode 100644 index 0000000000..bedb5dacc9 --- /dev/null +++ b/gtk2_ardour/route_properties_box.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2021 Paul Davis + * Copyright (C) 2024 Ben Loftis + * + * 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. + */ + +#pragma once + +#include + +#include +#include +#include + +#include "ardour/ardour.h" +#include "ardour/session_handle.h" + +#include "widgets/ardour_button.h" + +#include "gtkmm2ext/cairo_packer.h" + +#include "region_editor.h" +#include "audio_clock.h" + +namespace ARDOUR +{ + class Session; + class Location; +} + +class RoutePropertiesBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr +{ +public: + RoutePropertiesBox (); + ~RoutePropertiesBox (); + + virtual void set_route (std::shared_ptr); + +protected: + std::shared_ptr _route; + + Gtk::Label _header_label; + +private: + void property_changed (const PBD::PropertyChange& what_changed); + + PBD::ScopedConnection state_connection; +}; + diff --git a/gtk2_ardour/selection_properties_box.cc b/gtk2_ardour/selection_properties_box.cc index ee0be23bcc..a8545e96a1 100644 --- a/gtk2_ardour/selection_properties_box.cc +++ b/gtk2_ardour/selection_properties_box.cc @@ -46,6 +46,8 @@ #include "slot_properties_box.h" +#include "audio_route_properties_box.h" + #include "selection_properties_box.h" #include "pbd/i18n.h" @@ -65,12 +67,10 @@ SelectionPropertiesBox::SelectionPropertiesBox () _time_info_box = new TimeInfoBox ("EditorTimeInfo", true); pack_start(*_time_info_box, false, false, 0); -#if SELECTION_PROPERTIES_BOX_TODO /* 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); @@ -79,7 +79,6 @@ SelectionPropertiesBox::SelectionPropertiesBox () _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); @@ -88,11 +87,62 @@ SelectionPropertiesBox::SelectionPropertiesBox () _audio_ops_box = new AudioRegionOperationsBox (); pack_start(*_audio_ops_box, false, false, 0); - /* SLOT properties, for Trigger slot selections */ _slot_prop_box = new SlotPropertiesBox (); pack_start(*_slot_prop_box, false, false, 0); -#endif + + /* 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(); +} + +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; + + delete _route_prop_box; //todo: split into midi/audio +} + +void +SelectionPropertiesBox::set_session (Session* s) +{ + SessionHandlePtr::set_session (s); + + if (!s) { + return; + } + + _time_info_box->set_session(s); + + _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); + + _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)); @@ -111,47 +161,6 @@ SelectionPropertiesBox::SelectionPropertiesBox () selection_changed(); } -SelectionPropertiesBox::~SelectionPropertiesBox () -{ - delete _time_info_box; - -#if SELECTION_PROPERTIES_BOX_TODO - delete _mregions_prop_box; - - delete _slot_prop_box; - - delete _midi_ops_box; - delete _audio_ops_box; - - delete _midi_prop_box; - delete _audio_prop_box; -#endif -} - -void -SelectionPropertiesBox::set_session (Session* s) -{ - SessionHandlePtr::set_session (s); - - if (!s) { - return; - } - - _time_info_box->set_session(s); - -#if SELECTION_PROPERTIES_BOX_TODO - _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); -#endif -} - void SelectionPropertiesBox::track_mouse_mode () { @@ -165,7 +174,6 @@ SelectionPropertiesBox::selection_changed () _time_info_box->hide(); -#if SELECTION_PROPERTIES_BOX_TODO _mregions_prop_box->hide(); _midi_ops_box->hide(); @@ -175,7 +183,8 @@ SelectionPropertiesBox::selection_changed () _audio_prop_box->hide(); _slot_prop_box->hide(); -#endif + + _route_prop_box->hide(); _header_label.hide(); @@ -185,6 +194,16 @@ SelectionPropertiesBox::selection_changed () _header_label.show(); } + if (!selection.tracks.empty()) { + _route_prop_box->show(); + TimeAxisView *tav = *(selection.tracks.begin()); + RouteTimeAxisView *rtav = dynamic_cast(tav); + _route_prop_box->set_route(rtav->route()); + _header_label.set_text(_("Track Properties (Press ESC to Deselect All)")); + _header_label.hide(); + + } + #if SELECTION_PROPERTIES_BOX_TODO /* one or more regions, show the multi-region operations box (just MUTE? kinda boring) */ if (!selection.regions.empty()) { @@ -215,8 +234,10 @@ SelectionPropertiesBox::selection_changed () if (found_audio_regions && ! found_midi_regions) { _audio_ops_box->show(); } +#endif std::shared_ptr selected_region = std::shared_ptr(); + RegionView *selected_regionview = NULL; if (!selection.triggers.empty()) { TriggerSelection ts = selection.triggers; @@ -227,21 +248,21 @@ SelectionPropertiesBox::selection_changed () _slot_prop_box->set_slot(ref); _slot_prop_box->show(); - selected_region = ref.trigger()->region(); +// selected_region = ref.trigger()->region(); } else if (selection.regions.size()==1) { - selected_region = (*(selection.regions.begin()))->region(); + selected_regionview = *(selection.regions.begin()); } - if (selected_region) { +#if 0 // TODO pack region-properties here + if (selected_regionview) { + std::shared_ptr r = selected_regionview->region(); //region properties - if (selected_region->data_type() == DataType::MIDI) { - _midi_prop_box->set_region(selected_region); + if (r && r->data_type() == DataType::MIDI) { + _midi_prop_box->set_regionview(selected_regionview); _midi_prop_box->show(); - _midi_ops_box->show(); - } else { - _audio_prop_box->set_region(selected_region); + } else if (r) { + _audio_prop_box->set_regionview(selected_regionview); //retains a SessionHandler reference somewhere @robin _audio_prop_box->show(); - _audio_ops_box->show(); } } #endif diff --git a/gtk2_ardour/selection_properties_box.h b/gtk2_ardour/selection_properties_box.h index 447eabb4a6..93864bed9d 100644 --- a/gtk2_ardour/selection_properties_box.h +++ b/gtk2_ardour/selection_properties_box.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2021 Paul Davis - * Copyright (C) 2021 Ben Loftis + * Copyright (C) 2024 Ben Loftis * * 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 @@ -47,7 +47,9 @@ class MidiRegionPropertiesBox; class AudioRegionOperationsBox; class MidiRegionOperationsBox; -class SelectionPropertiesBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr +class RoutePropertiesBox; + +class SelectionPropertiesBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr { public: SelectionPropertiesBox (); @@ -74,6 +76,8 @@ private: SlotPropertiesBox* _slot_prop_box; + RoutePropertiesBox* _route_prop_box; + void selection_changed (); void track_mouse_mode (); diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index eaacced799..92d170a65e 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -45,6 +45,7 @@ gtk2_ardour_sources = [ 'audio_region_view.cc', 'audio_region_operations_box.cc', 'audio_region_properties_box.cc', + 'audio_route_properties_box.cc', 'audio_trigger_properties_box.cc', 'audio_streamview.cc', 'audio_time_axis.cc', @@ -265,6 +266,7 @@ gtk2_ardour_sources = [ 'route_group_menu.cc', 'route_list_base.cc', 'route_params_ui.cc', + 'route_properties_box.cc', 'route_processor_selection.cc', 'route_time_axis.cc', 'route_ui.cc',