diff --git a/gtk2_ardour/audio_region_editor.cc b/gtk2_ardour/audio_region_editor.cc index dd43d88f7b..a313e74ed2 100644 --- a/gtk2_ardour/audio_region_editor.cc +++ b/gtk2_ardour/audio_region_editor.cc @@ -132,8 +132,6 @@ AudioRegionEditor::AudioRegionEditor (Session* s, AudioRegionView* arv) snprintf (name, 64, "peak amplitude-%p", this); pthread_create_and_store (name, &_peak_amplitude_thread_handle, _peak_amplitude_thread, this); signal_peak_thread (); - - } AudioRegionEditor::~AudioRegionEditor () @@ -359,5 +357,4 @@ void AudioRegionEditor::on_unmap () { _show_on_touch.set_active (false); - ArdourDialog::on_unmap (); } diff --git a/gtk2_ardour/audio_region_editor.h b/gtk2_ardour/audio_region_editor.h index ec94e6fb52..7185ff88f7 100644 --- a/gtk2_ardour/audio_region_editor.h +++ b/gtk2_ardour/audio_region_editor.h @@ -104,4 +104,3 @@ private: PBD::ScopedConnection _peak_amplitude_connection; CrossThreadChannel _peak_channel; }; - diff --git a/gtk2_ardour/audio_region_properties_box.cc b/gtk2_ardour/audio_region_properties_box.cc deleted file mode 100644 index 2c84c57ab8..0000000000 --- a/gtk2_ardour/audio_region_properties_box.cc +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (C) 2011-2017 Paul Davis - * Copyright (C) 2021 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 "editor_automation_line.h" -#include "control_point.h" -#include "editor.h" -#include "region_view.h" - -#include "audio_region_properties_box.h" - -#include "pbd/i18n.h" - -using namespace Gtk; -using namespace ARDOUR; -using namespace ArdourWidgets; -using std::max; -using std::min; - -RegionPropertiesBox::RegionPropertiesBox () - : length_clock (X_("regionlength"), true, "", true, false, true) - , start_clock (X_("regionstart"), true, "", false, false) - , bbt_toggle (ArdourButton::led_default_elements) -{ - Gtk::Label* label; - int row = 0; - - _header_label.set_alignment (0.0, 0.5); - pack_start (_header_label, false, false, 6); - - Gtk::Table* bpm_table = manage (new Gtk::Table ()); - bpm_table->set_homogeneous (false); - bpm_table->set_spacings (4); - bpm_table->set_border_width (2); - label = manage (new Gtk::Label (_("BPM:"))); - label->set_alignment (1.0, 0.5); - bpm_table->attach (*label, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); - bpm_table->attach (bpm_button, 1, 2, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); - row++; - - pack_start (*bpm_table, false, false); - - Gtk::Table* metrum_table = manage (new Gtk::Table ()); - metrum_table->set_homogeneous (false); - metrum_table->set_spacings (4); - metrum_table->set_border_width (2); - label = manage (new Gtk::Label (_("Time Sig:"))); - label->set_alignment (1.0, 0.5); - bpm_table->attach (*label, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); - bpm_table->attach (metrum_button, 1, 2, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); - row++; - - pack_start (*metrum_table, false, false); - - row = 0; - - bbt_toggle.set_text (_("Stretch")); - table.attach (bbt_toggle, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); - row++; - - label = manage (new Gtk::Label (_("Start:"))); - label->set_alignment (1.0, 0.5); - table.attach (*label, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); - table.attach (start_clock, 1, 2, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); - row++; - - label = manage (new Gtk::Label (_("Length:"))); - label->set_alignment (1.0, 0.5); - table.attach (*label, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); - table.attach (length_clock, 1, 2, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); - row++; - - table.set_homogeneous (false); - table.set_spacings (4); - table.set_border_width (2); - pack_start (table, false, false); -} - -RegionPropertiesBox::~RegionPropertiesBox () -{ -} - -void -RegionPropertiesBox::set_session (Session* s) -{ - SessionHandlePtr::set_session (s); - - if (s) { - return; - } - - length_clock.set_session (s); - start_clock.set_session (s); -} - -void -RegionPropertiesBox::set_region (std::shared_ptr r) -{ - set_session (&r->session ()); - - state_connection.disconnect (); - - _region = r; - - PBD::PropertyChange interesting_stuff; - region_changed (interesting_stuff); - - _region->PropertyChanged.connect (state_connection, invalidator (*this), std::bind (&RegionPropertiesBox::region_changed, this, _1), gui_context ()); -} - -void -RegionPropertiesBox::region_changed (const PBD::PropertyChange& what_changed) -{ - // TODO: refactor the region_editor.cc to cover this basic stuff - { - AudioClock::Mode mode = _region->position_time_domain () == Temporal::AudioTime ? AudioClock::Samples : AudioClock::BBT; - - start_clock.set_mode (mode); - length_clock.set_mode (mode); - - start_clock.set (_region->start ()); - length_clock.set_duration (_region->length ()); - - bpm_button.set_text ("122.2"); - metrum_button.set_text ("4/4"); - } -} - -AudioRegionPropertiesBox::AudioRegionPropertiesBox () -{ - _header_label.set_text (_("AUDIO Region Properties:")); - - Gtk::Label* label; - - Gtk::Table* audio_t = manage (new Gtk::Table ()); - audio_t->set_homogeneous (true); - audio_t->set_spacings (4); - - int row = 0; - - label = manage (new Gtk::Label (_("Fades:"))); - label->set_alignment (1.0, 0.5); - fade_in_enable_button.set_text (S_("Fade|In")); - fade_in_enable_button.set_name ("generic button"); - fade_out_enable_button.set_text (S_("Fade|Out")); - fade_out_enable_button.set_name ("generic button"); - audio_t->attach (*label, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK); - audio_t->attach (fade_in_enable_button, 1, 2, row, row + 1, Gtk::FILL, Gtk::SHRINK); - audio_t->attach (fade_out_enable_button, 2, 3, row, row + 1, Gtk::FILL, Gtk::SHRINK); - - row++; - - label = manage (new Gtk::Label (_("Gain:"))); - label->set_alignment (1.0, 0.5); - audio_t->attach (*label, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK); - - gain_control.set_text (_("+6dB")); - gain_control.set_name ("generic button"); - audio_t->attach (gain_control, 1, 3, row, row + 1, Gtk::FILL, Gtk::SHRINK); - - row++; - - pack_start (*audio_t); -} - -AudioRegionPropertiesBox::~AudioRegionPropertiesBox () -{ -} - -void -AudioRegionPropertiesBox::set_region (std::shared_ptr r) -{ - RegionPropertiesBox::set_region (r); -} diff --git a/gtk2_ardour/audio_region_properties_box.h b/gtk2_ardour/audio_region_properties_box.h deleted file mode 100644 index 131be9fae9..0000000000 --- a/gtk2_ardour/audio_region_properties_box.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2021 Paul Davis - * Copyright (C) 2021 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 "audio_clock.h" - -namespace ARDOUR -{ - class Session; - class Location; -} - -class RegionPropertiesBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr -{ -public: - RegionPropertiesBox (); - ~RegionPropertiesBox (); - - virtual void set_region (std::shared_ptr); - - void set_session (ARDOUR::Session* s); - -protected: - std::shared_ptr _region; - - Gtk::Label _header_label; - -private: - void region_changed (const PBD::PropertyChange& what_changed); - - Gtk::Table table; - - AudioClock length_clock; - AudioClock start_clock; - - ArdourWidgets::ArdourButton bpm_button; - ArdourWidgets::ArdourButton metrum_button; - - ArdourWidgets::ArdourButton bbt_toggle; - - PBD::ScopedConnection state_connection; -}; - -class AudioRegionPropertiesBox : public RegionPropertiesBox -{ -public: - AudioRegionPropertiesBox (); - ~AudioRegionPropertiesBox (); - - virtual void set_region (std::shared_ptr); - -private: - ArdourWidgets::ArdourButton fade_in_enable_button; - ArdourWidgets::ArdourButton fade_out_enable_button; - - ArdourWidgets::ArdourButton gain_control; - ArdourWidgets::ArdourButton stretch_selector; -}; - diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 396a684238..dee27c553e 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -1819,17 +1819,6 @@ AudioRegionView::update_coverage_frame (LayerDisplay d) } } -void -AudioRegionView::show_region_editor () -{ - if (editor == 0) { - editor = new AudioRegionEditor (trackview.session(), this); - } - - editor->present (); - editor->show_all(); -} - void AudioRegionView::transients_changed () { diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index e4765028bb..f8f85b97ea 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -122,8 +122,6 @@ public: void update_transient(float old_pos, float new_pos); void remove_transient(float pos); - void show_region_editor (); - void set_frame_color (); uint32_t get_fill_color () const; diff --git a/gtk2_ardour/audio_route_properties_box.cc b/gtk2_ardour/audio_route_properties_box.cc deleted file mode 100644 index 849bcece32..0000000000 --- a/gtk2_ardour/audio_route_properties_box.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index e90d3b2502..d1a52ef813 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -84,10 +84,11 @@ using namespace ArdourWidgets; using namespace Gtk; using namespace ARDOUR_UI_UTILS; -GenericPluginUI::GenericPluginUI (std::shared_ptr pib, bool scrollable) +GenericPluginUI::GenericPluginUI (std::shared_ptr pib, bool scrollable, bool ctrls_only) : PlugUIBase (pib) , automation_menu (0) , is_scrollable(scrollable) + , want_ctrl_only(ctrls_only) , _plugin_pianokeyboard_expander (_("MIDI Keyboard (audition only)")) , _piano (0) , _piano_velocity (*manage (new Adjustment (100, 1, 127, 1, 16))) @@ -121,7 +122,9 @@ GenericPluginUI::GenericPluginUI (std::shared_ptr pib, bool scro automation_latch_all_button.set_text (GainMeterBase::astate_string (ARDOUR::Latch)); automation_latch_all_button.set_name (X_("generic button")); - if (_pib->ui_elements () & PlugInsertBase::MIDIKeyboard) { + if (ctrls_only) { + // relax + } else if (_pib->ui_elements () & PlugInsertBase::MIDIKeyboard) { _piano = new APianoKeyboard (); _piano->set_can_focus (); @@ -149,11 +152,11 @@ GenericPluginUI::GenericPluginUI (std::shared_ptr pib, bool scro pack_end (plugin_analysis_expander, false, false); } - if (_pib->provides_stats ()) { + if (!ctrls_only && _pib->provides_stats ()) { pack_end (cpuload_expander, false, false); } - if (!plugin->get_docs().empty()) { + if (!ctrls_only && !plugin->get_docs().empty()) { pack_end (description_expander, false, false); } @@ -175,7 +178,9 @@ GenericPluginUI::GenericPluginUI (std::shared_ptr pib, bool scro settings_box.pack_start (*automation_hbox, false, false, 6); } - main_contents.pack_start (settings_box, false, false); + if (!ctrls_only) { + main_contents.pack_start (settings_box, false, false); + } if (_pi) { _pi->ActiveChanged.connect (active_connection, invalidator (*this), std::bind (&GenericPluginUI::processor_active_changed, this, std::weak_ptr(_pi)), gui_context()); @@ -498,7 +503,7 @@ GenericPluginUI::automatic_layout (const std::vector& control_uis) // we can lay them out a bit more nicely later. cui_controls_list.push_back(cui); - } else if (cui->display) { + } else if (cui->display && !want_ctrl_only) { output_table->attach (*cui, output_col, output_col + 1, output_row, output_row+1, FILL|EXPAND, FILL); @@ -619,7 +624,7 @@ GenericPluginUI::automatic_layout (const std::vector& control_uis) delete output_table; } - if (plugin->has_inline_display () && plugin->inline_display_in_gui ()) { + if (!want_ctrl_only && plugin->has_inline_display () && plugin->inline_display_in_gui ()) { PluginDisplay* pd = manage (new PluginDisplay (plugin, 300)); hpacker.pack_end (*pd, true, true); } diff --git a/gtk2_ardour/midi_region_operations_box.cc b/gtk2_ardour/midi_region_operations_box.cc deleted file mode 100644 index 2005c9ac87..0000000000 --- a/gtk2_ardour/midi_region_operations_box.cc +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2011-2017 Paul Davis - * Copyright (C) 2021 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 -#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 "editor_automation_line.h" -#include "control_point.h" -#include "editor.h" -#include "region_view.h" - -#include "midi_region_operations_box.h" - -#include "pbd/i18n.h" - -using namespace Gtk; -using namespace ARDOUR; -using std::min; -using std::max; - -MidiRegionOperationsBox::MidiRegionOperationsBox () -{ - _header_label.set_text(_("MIDI Region Operations:")); - _header_label.set_alignment(0.0, 0.5); - pack_start(_header_label, false, false, 6); - - pack_start (table, false, false); - - table.set_homogeneous (true); - table.set_spacings (4); - table.set_border_width (8); - table.set_col_spacings (2); - - quantize_button.set_text (_("Quantize...")); - quantize_button.set_name ("generic button"); - quantize_button.signal_clicked.connect (sigc::mem_fun (*this, &MidiRegionOperationsBox::quantize_button_clicked)); - - legatize_button.set_text (_("Legatize...")); - legatize_button.set_name ("generic button"); - legatize_button.signal_clicked.connect (sigc::mem_fun (*this, &MidiRegionOperationsBox::legatize_button_clicked)); - - transform_button.set_text (_("Transform...")); - transform_button.set_name ("generic button"); - transform_button.signal_clicked.connect (sigc::mem_fun (*this, &MidiRegionOperationsBox::transform_button_clicked)); - - int row = 0; - table.attach(quantize_button, 0, 1, row, row+1, Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND ); row++; - table.attach(legatize_button, 0, 1, row, row+1, Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND ); row++; - table.attach(transform_button, 0, 1, row, row+1, Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND ); row++; -} - -MidiRegionOperationsBox::~MidiRegionOperationsBox () -{ -} - -void -MidiRegionOperationsBox::quantize_button_clicked () -{ - Editor::instance().quantize_region(); -} - -void -MidiRegionOperationsBox::legatize_button_clicked () -{ - Editor::instance().legatize_region(true); -} - -void -MidiRegionOperationsBox::transform_button_clicked () -{ - Editor::instance().transform_region(); -} diff --git a/gtk2_ardour/midi_region_operations_box.h b/gtk2_ardour/midi_region_operations_box.h deleted file mode 100644 index 4e937eb56e..0000000000 --- a/gtk2_ardour/midi_region_operations_box.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2021 Paul Davis - * Copyright (C) 2021 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 "audio_region_operations_box.h" - -namespace ARDOUR { - class Session; - class Location; -} - -class MidiRegionOperationsBox : public RegionOperationsBox -{ -public: - MidiRegionOperationsBox (); - ~MidiRegionOperationsBox (); - - PBD::ScopedConnectionList editor_connections; - PBD::ScopedConnectionList region_property_connections; - -private: - Gtk::Table table; - - Gtk::Label _header_label; - - ArdourWidgets::ArdourButton quantize_button; - ArdourWidgets::ArdourButton legatize_button; - ArdourWidgets::ArdourButton transform_button; - - void quantize_button_clicked(); - void legatize_button_clicked(); - void transform_button_clicked(); -}; - diff --git a/gtk2_ardour/midi_region_properties_box.cc b/gtk2_ardour/midi_region_properties_box.cc deleted file mode 100644 index 89557086d8..0000000000 --- a/gtk2_ardour/midi_region_properties_box.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2011-2017 Paul Davis - * Copyright (C) 2021 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 "widgets/ardour_button.h" - -#include "audio_clock.h" -#include "editor_automation_line.h" -#include "control_point.h" -#include "editor.h" -#include "region_view.h" - -#include "midi_region_properties_box.h" - -#include "pbd/i18n.h" - -using namespace Gtk; -using namespace ARDOUR; -using namespace ArdourWidgets; -using std::max; -using std::min; - -MidiRegionPropertiesBox::MidiRegionPropertiesBox () -{ - _header_label.set_text (_("MIDI Region Properties:")); - - Gtk::Table* midi_t = manage (new Gtk::Table ()); - midi_t->set_homogeneous (true); - midi_t->set_spacings (4); - - int row = 0; - - patch_selector_button.set_text (_("Patches...")); - patch_selector_button.set_name ("generic button"); - - midi_t->attach (patch_selector_button, 1, 2, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); - row++; - - cc_selector_button.set_text (_("CCs...")); - cc_selector_button.set_name ("generic button"); - - midi_t->attach (cc_selector_button, 1, 2, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); - row++; - - pack_start (*midi_t); -} - -MidiRegionPropertiesBox::~MidiRegionPropertiesBox () -{ -} - -void -MidiRegionPropertiesBox::set_region (std::shared_ptr r) -{ - RegionPropertiesBox::set_region (r); - - _region->PropertyChanged.connect (midi_state_connection, invalidator (*this), std::bind (&MidiRegionPropertiesBox::region_changed, this, _1), gui_context ()); -} - -void -MidiRegionPropertiesBox::region_changed (const PBD::PropertyChange& what_changed) -{ - /* CC and Pgm stuff ...? */ -} diff --git a/gtk2_ardour/midi_region_properties_box.h b/gtk2_ardour/midi_region_properties_box.h deleted file mode 100644 index 8488a2b65b..0000000000 --- a/gtk2_ardour/midi_region_properties_box.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2021 Paul Davis - * Copyright (C) 2021 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 "gtkmm2ext/cairo_packer.h" - -#include "audio_region_properties_box.h" - -namespace ARDOUR -{ - class Session; - class Location; -} - -class MidiRegionPropertiesBox : public RegionPropertiesBox -{ -public: - MidiRegionPropertiesBox (); - ~MidiRegionPropertiesBox (); - - void set_region (std::shared_ptr); - -private: - void region_changed (const PBD::PropertyChange& what_changed); - - PBD::ScopedConnection midi_state_connection; - - ArdourWidgets::ArdourButton patch_selector_button; - ArdourWidgets::ArdourButton cc_selector_button; -}; - diff --git a/gtk2_ardour/multi_region_properties_box.cc b/gtk2_ardour/multi_region_properties_box.cc deleted file mode 100644 index fe5680ead0..0000000000 --- a/gtk2_ardour/multi_region_properties_box.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2011-2017 Paul Davis - * Copyright (C) 2021 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 -#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 "editor_automation_line.h" -#include "control_point.h" -#include "editor.h" -#include "region_view.h" - -#include "multi_region_properties_box.h" - -#include "pbd/i18n.h" - -using namespace Gtk; -using namespace ARDOUR; -using std::min; -using std::max; - -MultiRegionPropertiesBox::MultiRegionPropertiesBox () -{ - pack_start (table, false, false); - - table.set_homogeneous (false); - table.set_spacings (4); - table.set_border_width (8); - - mute_regions_label.set_text (_("Some regions are muted")); - - mute_regions_button.set_text ("Mute All"); - mute_regions_button.set_name ("generic button"); - mute_regions_button.signal_clicked.connect (sigc::mem_fun (*this, &MultiRegionPropertiesBox::mute_selected_regions)); - - unmute_regions_button.set_text ("Un-Mute All"); - unmute_regions_button.set_name ("generic button"); - unmute_regions_button.signal_clicked.connect (sigc::mem_fun (*this, &MultiRegionPropertiesBox::unmute_selected_regions)); - - int row = 0; - table.attach(mute_regions_label, 0, 1, row, row+1, Gtk::SHRINK, Gtk::SHRINK ); - table.attach(mute_regions_button, 1, 2, row, row+1, Gtk::SHRINK, Gtk::SHRINK ); - table.attach(unmute_regions_button, 2, 3, row, row+1, Gtk::SHRINK, Gtk::SHRINK ); - - Editor::instance().get_selection().RegionsChanged.connect (sigc::mem_fun (*this, &MultiRegionPropertiesBox::region_selection_changed)); -} - -MultiRegionPropertiesBox::~MultiRegionPropertiesBox () -{ -} - -void -MultiRegionPropertiesBox::set_session (Session* s) -{ - SessionHandlePtr::set_session (s); -} - -void -MultiRegionPropertiesBox::region_selection_changed () -{ - // timepos_t s, e; - // Selection& selection (Editor::instance().get_selection()); -} - - -void -MultiRegionPropertiesBox::mute_selected_regions () -{ - Selection& selection (Editor::instance().get_selection()); - for (RegionSelection::iterator s = selection.regions.begin(); s != selection.regions.end(); ++s) { - ARDOUR::Region* region = (*s)->region().get(); - region->set_muted(true); - } -} - -void -MultiRegionPropertiesBox::unmute_selected_regions () -{ - Selection& selection (Editor::instance().get_selection()); - for (RegionSelection::iterator s = selection.regions.begin(); s != selection.regions.end(); ++s) { - ARDOUR::Region* region = (*s)->region().get(); - region->set_muted(false); - } -} diff --git a/gtk2_ardour/multi_region_properties_box.h b/gtk2_ardour/multi_region_properties_box.h deleted file mode 100644 index 8bdbc5dafb..0000000000 --- a/gtk2_ardour/multi_region_properties_box.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2021 Paul Davis - * Copyright (C) 2021 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" - -namespace ARDOUR { - class Session; - class Location; -} - -class MultiRegionPropertiesBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr -{ -public: - MultiRegionPropertiesBox (); - ~MultiRegionPropertiesBox (); - - void set_session (ARDOUR::Session*); - - PBD::ScopedConnectionList editor_connections; - PBD::ScopedConnectionList region_property_connections; - -private: - Gtk::Table table; - - Gtk::Label mute_regions_label; - ArdourWidgets::ArdourButton mute_regions_button; - ArdourWidgets::ArdourButton unmute_regions_button; - - void selection_changed (); - void region_selection_changed (); - - void track_mouse_mode (); - - void mute_selected_regions(); - void unmute_selected_regions(); -}; - diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 4503c30bd8..8a4e1dc80c 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -219,7 +219,7 @@ private: class GenericPluginUI : public PlugUIBase, public Gtk::VBox { public: - GenericPluginUI (std::shared_ptr plug, bool scrollable=false); + GenericPluginUI (std::shared_ptr plug, bool scrollable = false, bool ctrls_only = false); ~GenericPluginUI (); gint get_preferred_height () { return prefheight; } @@ -236,6 +236,7 @@ private: gint prefheight; bool is_scrollable; + bool want_ctrl_only; struct MeterInfo { ArdourWidgets::FastMeter* meter; diff --git a/gtk2_ardour/region_editor.cc b/gtk2_ardour/region_editor.cc index 94a0e7336b..f95cbb1e7a 100644 --- a/gtk2_ardour/region_editor.cc +++ b/gtk2_ardour/region_editor.cc @@ -5,6 +5,7 @@ * Copyright (C) 2010-2012 Carl Hetherington * Copyright (C) 2013-2019 Robin Gareus * Copyright (C) 2014-2015 Nick Mainsbridge + * 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 @@ -64,7 +65,7 @@ using namespace std; using namespace Gtkmm2ext; RegionEditor::RegionEditor (Session* s, RegionView* rv) - : ArdourDialog (_("Region")) + : SessionHandlePtr (s) , _table (9, 3) , _table_row (0) , _region (rv->region ()) @@ -81,8 +82,6 @@ RegionEditor::RegionEditor (Session* s, RegionView* rv) , _region_fx_box (_region) , _sources (1) { - set_session (s); - switch (_region->time_domain()) { case Temporal::AudioTime: /* XXX check length of region and choose samples or minsec */ @@ -194,16 +193,7 @@ RegionEditor::RegionEditor (Session* s, RegionView* rv) _table.attach (_region_fx_box, 2, 3, 1, _table_row + 2, Gtk::FILL, Gtk::FILL); #endif - get_vbox()->pack_start (_table, true, true); - - add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_ACCEPT); - - set_name ("RegionEditorWindow"); - add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK); - - signal_response().connect (sigc::mem_fun (*this, &RegionEditor::handle_response)); - - set_title (string_compose (_("Region '%1'"), _region->name())); + add (_table); for (uint32_t i = 0; i < _region->sources().size(); ++i) { _sources.append (_region->source(i)->name()); @@ -247,6 +237,7 @@ RegionEditor::RegionEditor (Session* s, RegionView* rv) RegionEditor::~RegionEditor () { + remove (); /* unpack and unmap table */ delete _clock_group; } @@ -506,12 +497,6 @@ RegionEditor::on_delete_event (GdkEventAny*) return true; } -void -RegionEditor::handle_response (int) -{ - hide (); -} - /* ****************************************************************************/ static std::list @@ -535,7 +520,7 @@ drag_targets () RegionEditor::RegionFxBox::RegionFxBox (std::shared_ptr r) : _region (r) - , _display (drop_targets ()) + , _display (drop_targets (), Gdk::ACTION_COPY | Gdk::ACTION_MOVE) , _no_redisplay (false) , _placement (-1) { @@ -556,6 +541,7 @@ RegionEditor::RegionFxBox::RegionFxBox (std::shared_ptr r) _display.Reordered.connect (sigc::mem_fun (*this, &RegionFxBox::reordered)); _display.DropFromAnotherBox.connect (sigc::mem_fun (*this, &RegionFxBox::object_drop)); _display.DropFromExternal.connect (sigc::mem_fun (*this, &RegionFxBox::plugin_drop)); + _display.DragRefuse.connect (sigc::mem_fun (*this, &RegionFxBox::drag_refuse)); _display.signal_key_press_event ().connect (sigc::mem_fun (*this, &RegionFxBox::on_key_press), false); @@ -913,6 +899,13 @@ RegionEditor::RegionFxBox::delete_dragged_plugins (Region::RegionFxList const& f redisplay_plugins (); } +bool +RegionEditor::RegionFxBox::drag_refuse (Gtkmm2ext::DnDVBox* source, RegionFxEntry*) +{ + RegionFxBox* other = reinterpret_cast (source->get_data ("regionfxbox")); + return (other && other->_region == _region); +} + void RegionEditor::RegionFxBox::object_drop (Gtkmm2ext::DnDVBox* source, RegionFxEntry* pos, Glib::RefPtr const& context) { diff --git a/gtk2_ardour/region_editor.h b/gtk2_ardour/region_editor.h index b53d71391a..3f3dc86687 100644 --- a/gtk2_ardour/region_editor.h +++ b/gtk2_ardour/region_editor.h @@ -41,12 +41,12 @@ #include "gtkmm2ext/dndtreeview.h" #include "gtkmm2ext/dndvbox.h" +#include "widgets/frame.h" + #include "pbd/signals.h" #include "audio_clock.h" -#include "ardour_dialog.h" #include "plugin_interest.h" -#include "region_editor.h" namespace ARDOUR { class Region; @@ -57,12 +57,14 @@ namespace ARDOUR { class RegionView; class ClockGroup; -class RegionEditor : public ArdourDialog +class RegionEditor : public ArdourWidgets::Frame, public ARDOUR::SessionHandlePtr { public: RegionEditor (ARDOUR::Session*, RegionView*); virtual ~RegionEditor (); + std::shared_ptr region () const { return _region; } + protected: virtual void region_changed (const PBD::PropertyChange&); virtual void region_fx_changed (); @@ -122,6 +124,7 @@ private: void plugin_drop (Gtk::SelectionData const&, RegionFxEntry*, Glib::RefPtr const&); void object_drop (Gtkmm2ext::DnDVBox*, RegionFxEntry*, Glib::RefPtr const&); void delete_dragged_plugins (std::list> const&); + bool drag_refuse (Gtkmm2ext::DnDVBox*, RegionFxEntry*); std::shared_ptr find_drop_position (RegionFxEntry*); @@ -186,7 +189,6 @@ private: gint breleased (GdkEventButton* ev, Gtk::SpinButton* but, void (RegionEditor::*pmf)()); bool on_delete_event (GdkEventAny *); - void handle_response (int); bool spin_arrow_grab; @@ -195,4 +197,3 @@ private: void set_clock_mode_from_primary (); }; - diff --git a/gtk2_ardour/region_editor_window.cc b/gtk2_ardour/region_editor_window.cc new file mode 100644 index 0000000000..434c9647ac --- /dev/null +++ b/gtk2_ardour/region_editor_window.cc @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2024 Robin Gareus + * + * 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 "region_editor_window.h" +#include "audio_region_editor.h" +#include "audio_region_view.h" + +#include "pbd/i18n.h" + +using namespace ARDOUR; + +RegionEditorWindow::RegionEditorWindow (Session* s, RegionView* rv) + : ArdourWindow (_("Region")) +{ + AudioRegionView* arv = dynamic_cast (rv); + if (arv) { + _region_editor = new AudioRegionEditor (s, arv); + } else { + _region_editor = new RegionEditor (s, rv); + } + add (*_region_editor); + set_name ("RegionEditorWindow"); +} + +RegionEditorWindow::~RegionEditorWindow () +{ + delete _region_editor; +} + +void +RegionEditorWindow::set_session (Session* s) +{ + ArdourWindow::set_session (s); + if (s) { + _region_editor->set_session (s); + } +} + +void +RegionEditorWindow::on_unmap () +{ + _region_editor->unmap (); + ArdourWindow::on_unmap (); +} diff --git a/gtk2_ardour/audio_route_properties_box.h b/gtk2_ardour/region_editor_window.h similarity index 60% rename from gtk2_ardour/audio_route_properties_box.h rename to gtk2_ardour/region_editor_window.h index 1625508e11..e345afc65c 100644 --- a/gtk2_ardour/audio_route_properties_box.h +++ b/gtk2_ardour/region_editor_window.h @@ -1,6 +1,5 @@ /* - * Copyright (C) 2021 Paul Davis - * Copyright (C) 2024 Ben Loftis + * Copyright (C) 2024 Robin Gareus * * 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 @@ -19,27 +18,22 @@ #pragma once -#include +#include "ardour_window.h" -#include -#include -#include +class RegionEditor; +class RegionView; -#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 +class RegionEditorWindow : public ArdourWindow { public: - AudioRoutePropertiesBox (); - ~AudioRoutePropertiesBox (); + RegionEditorWindow (ARDOUR::Session*, RegionView*); + ~RegionEditorWindow (); + + void set_session (ARDOUR::Session*); + +protected: + void on_unmap (); private: - + RegionEditor* _region_editor; }; diff --git a/gtk2_ardour/region_properties_box.cc b/gtk2_ardour/region_properties_box.cc deleted file mode 100644 index 16d3b55b19..0000000000 --- a/gtk2_ardour/region_properties_box.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2011-2017 Paul Davis - * Copyright (C) 2021 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 -#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 "editor_automation_line.h" -#include "control_point.h" -#include "editor.h" -#include "region_view.h" - -#include "pbd/i18n.h" - -using namespace Gtk; -using namespace ARDOUR; -using std::min; -using std::max; - -MidiRegionPropertiesBox::MidiRegionPropertiesBox () -{ - pack_start (table, false, false); - - table.set_homogeneous (true); - table.set_spacings (0); - table.set_border_width (2); - table.set_col_spacings (2); - - -} - -MidiRegionPropertiesBox::~MidiRegionPropertiesBox () -{ -} - -void -MidiRegionPropertiesBox::set_session (Session* s) -{ - SessionHandlePtr::set_session (s); -} - diff --git a/gtk2_ardour/region_properties_box.h b/gtk2_ardour/region_properties_box.h deleted file mode 100644 index 63cbc156c1..0000000000 --- a/gtk2_ardour/region_properties_box.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2021 Paul Davis - * Copyright (C) 2021 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 "gtkmm2ext/cairo_packer.h" - -namespace ARDOUR { - class Session; - class Location; -} - -class MidiRegionPropertiesBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr -{ -public: - MidiRegionPropertiesBox (); - ~MidiRegionPropertiesBox (); - - void set_session (ARDOUR::Session*); - -private: - Gtk::Table table; -}; - diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index 52b1e945ea..3a85d1419c 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -48,7 +48,7 @@ #include "region_view.h" #include "automation_region_view.h" #include "public_editor.h" -#include "region_editor.h" +#include "region_editor_window.h" #include "ghostregion.h" #include "ui_config.h" #include "utils.h" @@ -82,7 +82,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent, , _region (r) , sync_mark (nullptr) , sync_line (nullptr) - , editor (nullptr) + , _editor (nullptr) , current_visible_sync_position (0.0) , valid (false) , _disable_display (0) @@ -162,7 +162,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent, , _region (r) , sync_mark (nullptr) , sync_line (nullptr) - , editor (nullptr) + , _editor (nullptr) , current_visible_sync_position (0.0) , valid (false) , _disable_display (0) @@ -181,7 +181,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent, void RegionView::init (bool wfd) { - editor = nullptr; + _editor = nullptr; valid = true; in_destructor = false; wait_for_data = wfd; @@ -268,7 +268,7 @@ RegionView::~RegionView () drop_silent_frames (); - delete editor; + delete _editor; } bool @@ -749,19 +749,19 @@ RegionView::set_sync_mark_color () void RegionView::show_region_editor () { - if (!editor) { - editor = new RegionEditor (trackview.session(), this); + if (!_editor) { + _editor = new RegionEditorWindow (trackview.session(), this); } - editor->present (); - editor->show_all(); + _editor->present (); + _editor->show_all(); } void RegionView::hide_region_editor() { - if (editor) { - editor->hide_all (); + if (_editor) { + _editor->hide_all (); } } diff --git a/gtk2_ardour/region_view.h b/gtk2_ardour/region_view.h index 4a27eeef6b..13d701a6d6 100644 --- a/gtk2_ardour/region_view.h +++ b/gtk2_ardour/region_view.h @@ -40,7 +40,7 @@ #include "marker.h" class TimeAxisView; -class RegionEditor; +class ArdourWindow; class GhostRegion; class AutomationTimeAxisView; class AutomationRegionView; @@ -87,7 +87,7 @@ public: bool set_position(Temporal::timepos_t const & pos, void* src, double* delta = 0); - virtual void show_region_editor (); + void show_region_editor (); void hide_region_editor (); virtual void region_changed (const PBD::PropertyChange&); @@ -202,7 +202,7 @@ protected: ArdourCanvas::Polygon* sync_mark; ///< polygon for sync position ArdourCanvas::Line* sync_line; ///< polygon for sync position - RegionEditor* editor; + ArdourWindow* _editor; std::vector control_points; double current_visible_sync_position; diff --git a/gtk2_ardour/route_properties_box.cc b/gtk2_ardour/route_properties_box.cc index 8820abc17e..46ecd63c7b 100644 --- a/gtk2_ardour/route_properties_box.cc +++ b/gtk2_ardour/route_properties_box.cc @@ -17,35 +17,41 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "pbd/compose.h" -#include +#include +#include + +#include "pbd/compose.h" + +#include "ardour/plugin_insert.h" +#include "ardour/port_insert.h" +#include "ardour/route.h" +#include "ardour/session.h" -#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 "widgets/frame.h" +#include "plugin_selector.h" +#include "plugin_ui.h" +#include "port_insert_ui.h" #include "route_properties_box.h" +#include "timers.h" #include "pbd/i18n.h" using namespace Gtk; using namespace ARDOUR; using namespace ArdourWidgets; -using std::max; -using std::min; RoutePropertiesBox::RoutePropertiesBox () { + _scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER); + _scroller.add (_box); + + _box.set_spacing (4); + + pack_start (_scroller, true, true); show_all(); } @@ -54,15 +60,98 @@ RoutePropertiesBox::~RoutePropertiesBox () } void -RoutePropertiesBox::set_route (std::shared_ptr rt) +RoutePropertiesBox::session_going_away () { - //TODO: route properties -// rt->PropertyChanged.connect (state_connection, invalidator (*this), boost::bind (&RoutePropertiesBox::region_changed, this, _1), gui_context ()); + ENSURE_GUI_THREAD (*this, &RoutePropertiesBox::session_going_away); + SessionHandlePtr::session_going_away (); + + drop_plugin_uis (); + drop_route (); +} + +void +RoutePropertiesBox::set_route (std::shared_ptr r) +{ + assert (r); + _route = r; + _route_connections.drop_connections (); + + _route->processors_changed.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::refill_processors, this), gui_context()); + _route->PropertyChanged.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::property_changed, this, _1), gui_context ()); + _route->DropReferences.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::drop_route, this), gui_context()); + refill_processors (); } void RoutePropertiesBox::property_changed (const PBD::PropertyChange& what_changed) { - - +} + +void +RoutePropertiesBox::drop_route () +{ + drop_plugin_uis (); + _route.reset (); + _route_connections.drop_connections (); +} + +void +RoutePropertiesBox::drop_plugin_uis () +{ + std::list children = _box.get_children (); + for (auto const& child : children) { + child->hide (); + _box.remove (*child); + delete child; + } + + for (auto const& ui : _proc_uis) { + ui->stop_updating (0); + delete ui; + } + + _processor_connections.drop_connections (); + _proc_uis.clear (); +} + +void +RoutePropertiesBox::add_processor_to_display (std::weak_ptr w) +{ + std::shared_ptr p = w.lock (); + std::shared_ptr pib = std::dynamic_pointer_cast (p); + if (!pib) { + return; + } + GenericPluginUI* plugin_ui = new GenericPluginUI (pib, true, true); + pib->DropReferences.connect (_processor_connections, invalidator (*this), std::bind (&RoutePropertiesBox::refill_processors, this), gui_context()); + _proc_uis.push_back (plugin_ui); + + ArdourWidgets::Frame* frame = new ArdourWidgets::Frame (); + frame->set_label (p->display_name ()); + frame->add (*plugin_ui); + _box.pack_start (*frame, false, false); + plugin_ui->show (); +} + +void +RoutePropertiesBox::refill_processors () +{ + if (!_session || _session->deletion_in_progress()) { + return; + } + drop_plugin_uis (); + + assert (_route); + _route->foreach_processor (sigc::mem_fun (*this, &RoutePropertiesBox::add_processor_to_display)); + if (_proc_uis.empty ()) { + _scroller.hide (); + } else { + int h = 60; + for (auto const& ui : _proc_uis) { + h = std::max (h, ui->get_preferred_height () + /* frame label */ 22); + } + h = std::min (h, 300); + _scroller.set_size_request (-1, h); + _scroller.show_all (); + } } diff --git a/gtk2_ardour/route_properties_box.h b/gtk2_ardour/route_properties_box.h index bedb5dacc9..9ee1556fbd 100644 --- a/gtk2_ardour/route_properties_box.h +++ b/gtk2_ardour/route_properties_box.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2021 Paul Davis * Copyright (C) 2024 Ben Loftis + * Copyright (C) 2024 Robin Gareus * * 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 @@ -19,44 +20,45 @@ #pragma once -#include +#include #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 -{ +namespace ARDOUR { + class Route; + class Processor; class Session; - class Location; } +class GenericPluginUI; + 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; + void set_route (std::shared_ptr); private: void property_changed (const PBD::PropertyChange& what_changed); + void session_going_away (); + void drop_route (); + void drop_plugin_uis (); + void refill_processors (); + void add_processor_to_display (std::weak_ptr w); - PBD::ScopedConnection state_connection; + Gtk::ScrolledWindow _scroller; + Gtk::HBox _box; + + std::shared_ptr _route; + std::vector _proc_uis; + + PBD::ScopedConnectionList _processor_connections; + PBD::ScopedConnectionList _route_connections; }; diff --git a/gtk2_ardour/selection_properties_box.cc b/gtk2_ardour/selection_properties_box.cc index 00b738af3d..b2765582cb 100644 --- a/gtk2_ardour/selection_properties_box.cc +++ b/gtk2_ardour/selection_properties_box.cc @@ -1,6 +1,7 @@ /* * Copyright (C) 2011-2017 Paul Davis * Copyright (C) 2021 Ben Loftis + * Copyright (C) 2024 Robin Gareus * * 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 @@ -17,38 +18,20 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include #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 "editor_automation_line.h" -#include "control_point.h" +#include "audio_region_editor.h" +#include "audio_region_view.h" #include "editor.h" #include "region_view.h" -#include "time_info_box.h" -#include "triggerbox_ui.h" - -#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 "audio_route_properties_box.h" - +#include "route_properties_box.h" #include "selection_properties_box.h" +#include "time_info_box.h" #include "pbd/i18n.h" @@ -58,67 +41,53 @@ using std::min; using std::max; SelectionPropertiesBox::SelectionPropertiesBox () + : _region_editor (nullptr) { - _header_label.set_text(_("Selection Properties (ESC = Deselect All)")); - _header_label.set_alignment(0.0, 0.5); - pack_start(_header_label, false, false, 6); + init (); - /* Time Info, for Range selections ToDo: range operations*/ - _time_info_box = new TimeInfoBox ("EditorTimeInfo", true); - pack_start(*_time_info_box, false, false, 0); - - /* 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); - - /* SLOT properties, for Trigger slot selections */ - _slot_prop_box = new SlotPropertiesBox (); - pack_start(*_slot_prop_box, false, false, 0); - - /* ROUTE properties, for Track selections */ + _time_info_box = new TimeInfoBox ("EditorTimeInfo", true); _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(); + pack_start(*_time_info_box, false, false, 0); + pack_start(*_route_prop_box, true, true, 0); + pack_start(_region_editor_box, false, false, 0); + + _time_info_box->set_no_show_all (); + _route_prop_box->set_no_show_all (); + _region_editor_box.set_no_show_all (); + + _time_info_box->hide (); + _route_prop_box->hide (); } SelectionPropertiesBox::~SelectionPropertiesBox () { delete _time_info_box; + delete _route_prop_box; + delete _region_editor; +} - delete _mregions_prop_box; +void +SelectionPropertiesBox::init () +{ +#ifdef LIVETRAX + return; +#endif + Selection& selection (Editor::instance().get_selection()); - delete _slot_prop_box; + /* watch for any change in our selection, so we can show an appropriate property editor */ + selection.TracksChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed)); + selection.RegionsChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed)); + selection.TimeChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed)); + selection.LinesChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed)); + selection.PlaylistsChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed)); + selection.PointsChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed)); + selection.MarkersChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed)); + selection.MidiNotesChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed)); + selection.TriggersChanged.connect (sigc::mem_fun (*this, &SelectionPropertiesBox::selection_changed)); - 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 + /* maybe we care about mouse mode?? */ + Editor::instance().MouseModeChanged.connect (_editor_connection, invalidator(*this), std::bind (&SelectionPropertiesBox::track_mouse_mode, this), gui_context()); } void @@ -131,33 +100,8 @@ SelectionPropertiesBox::set_session (Session* s) } _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)); - 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(); } @@ -167,103 +111,71 @@ SelectionPropertiesBox::track_mouse_mode () /* maybe do something here? */ } +void +SelectionPropertiesBox::delete_region_editor () +{ + if (!_region_editor) { + return; + } + _region_editor_box.remove (); + delete _region_editor; + _region_editor = nullptr; + _region_editor_box.hide (); +} + void SelectionPropertiesBox::selection_changed () { +#ifdef LIVETRAX + return; +#endif + if (!_session || _session->inital_connect_or_deletion_in_progress ()) { + _time_info_box->hide (); + _route_prop_box->hide (); + delete_region_editor (); + return; + } + 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(); - - _route_prop_box->hide(); - - _header_label.hide(); - - if (Profile->get_livetrax() || !selection.time.empty()) { - _time_info_box->show(); - _header_label.set_text(_("Range Properties (Press ESC to Deselect All)")); - _header_label.show(); + if (!selection.time.empty ()) { + _time_info_box->show (); + } else { + _time_info_box->hide (); } - if (!selection.tracks.empty()) { - _route_prop_box->show(); - TimeAxisView *tav = *(selection.tracks.begin()); + if (!selection.tracks.empty ()) { + TimeAxisView *tav = selection.tracks.front (); 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(); - + _route_prop_box->set_route (rtav->route()); + _route_prop_box->show(); + } else { + _route_prop_box->hide(); } -#if SELECTION_PROPERTIES_BOX_TODO - /* 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; + if (selection.regions.size () == 1) { + RegionView* rv = (selection.regions.front ()); + if (!_region_editor || _region_editor->region () != rv->region ()) { + delete_region_editor (); + AudioRegionView* arv = dynamic_cast (rv); + if (arv) { + _region_editor = new AudioRegionEditor (_session, arv); + } else { + _region_editor = new RegionEditor (_session, rv); + } + // TODO subscribe to region name changes + _region_editor->set_label (string_compose (_("Region '%1'"), rv->region()->name ())); + _region_editor->set_padding (4); + _region_editor->set_edge_color (0x000000ff); // black + _region_editor->show_all (); + _region_editor_box.add (*_region_editor); + rv->RegionViewGoingAway.connect_same_thread (_region_connection, std::bind (&SelectionPropertiesBox::delete_region_editor, this)); + } + _region_editor_box.show (); + } else { + /* only hide region props when selecting a track or trigger ..*/ + if (_route_prop_box->get_visible () || !selection.markers.empty () || !selection.playlists.empty () || !selection.triggers.empty ()) { + delete_region_editor (); } } - - 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(); - } -#endif - - std::shared_ptr selected_region = std::shared_ptr(); - RegionView *selected_regionview = NULL; - - if (!selection.triggers.empty()) { - TriggerSelection ts = selection.triggers; - TriggerEntry* entry = *ts.begin(); - TriggerReference ref = entry->trigger_reference(); - - //slot properties incl "Follow Actions" - _slot_prop_box->set_slot(ref); - _slot_prop_box->show(); - -// selected_region = ref.trigger()->region(); - } else if (selection.regions.size()==1) { - selected_regionview = *(selection.regions.begin()); - } - -#if 0 // TODO pack region-properties here - if (selected_regionview) { - std::shared_ptr r = selected_regionview->region(); - //region properties - if (r && r->data_type() == DataType::MIDI) { - _midi_prop_box->set_regionview(selected_regionview); - _midi_prop_box->show(); - } else if (r) { - _audio_prop_box->set_regionview(selected_regionview); //retains a SessionHandler reference somewhere @robin - _audio_prop_box->show(); - } - } -#endif } diff --git a/gtk2_ardour/selection_properties_box.h b/gtk2_ardour/selection_properties_box.h index 93864bed9d..809977964a 100644 --- a/gtk2_ardour/selection_properties_box.h +++ b/gtk2_ardour/selection_properties_box.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2021 Paul Davis * Copyright (C) 2024 Ben Loftis + * Copyright (C) 2024 Robin Gareus * * 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 @@ -19,8 +20,6 @@ #pragma once -#include - #include #include #include @@ -28,25 +27,14 @@ #include "ardour/ardour.h" #include "ardour/session_handle.h" -#include "gtkmm2ext/cairo_packer.h" +#include "widgets/eventboxext.h" namespace ARDOUR { class Session; - class Location; } class TimeInfoBox; - -class MultiRegionPropertiesBox; - -class SlotPropertiesBox; - -class AudioRegionPropertiesBox; -class MidiRegionPropertiesBox; - -class AudioRegionOperationsBox; -class MidiRegionOperationsBox; - +class RegionEditor; class RoutePropertiesBox; class SelectionPropertiesBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr @@ -57,29 +45,18 @@ public: void set_session (ARDOUR::Session*); - PBD::ScopedConnectionList editor_connections; - private: - Gtk::Table table; - - Gtk::Label _header_label; - - TimeInfoBox* _time_info_box; - - MultiRegionPropertiesBox* _mregions_prop_box; - - AudioRegionPropertiesBox* _audio_prop_box; - MidiRegionPropertiesBox* _midi_prop_box; - - AudioRegionOperationsBox* _audio_ops_box; - MidiRegionOperationsBox* _midi_ops_box; - - SlotPropertiesBox* _slot_prop_box; - - RoutePropertiesBox* _route_prop_box; - + void init (); void selection_changed (); - void track_mouse_mode (); + void delete_region_editor (); + + TimeInfoBox* _time_info_box; + RoutePropertiesBox* _route_prop_box; + ArdourWidgets::EventBoxExt _region_editor_box; + RegionEditor* _region_editor; + + PBD::ScopedConnection _region_connection; + PBD::ScopedConnection _editor_connection; }; diff --git a/gtk2_ardour/slot_properties_box.cc b/gtk2_ardour/slot_properties_box.cc index 811826c9fa..4a8f71f8ce 100644 --- a/gtk2_ardour/slot_properties_box.cc +++ b/gtk2_ardour/slot_properties_box.cc @@ -50,13 +50,8 @@ #include "utils.h" #include "audio_clip_editor.h" -#include "audio_region_properties_box.h" #include "audio_trigger_properties_box.h" -#include "audio_region_operations_box.h" -#include "midi_trigger_properties_box.h" -#include "midi_region_properties_box.h" -#include "midi_region_operations_box.h" #include "midi_cue_editor.h" #include "slot_properties_box.h" @@ -723,69 +718,3 @@ SlotPropertyWidget::SlotPropertyWidget () pack_start(*ui); ui->show(); } - -/* ------------ */ - -SlotPropertyWindow::SlotPropertyWindow (TriggerReference tref) -{ - TriggerPtr trigger (tref.trigger()); - - assert (trigger); - - set_title (string_compose (_("Trigger Slot: %1"), trigger->name())); - - SlotPropertiesBox* slot_prop_box = manage (new SlotPropertiesBox ()); - slot_prop_box->set_slot (tref); - - Gtk::Table* table = manage (new Gtk::Table); - table->set_homogeneous (false); - table->set_spacings (16); - table->set_border_width (8); - - int col = 0; - table->attach(*slot_prop_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; - - if (trigger->the_region()) { - if (trigger->the_region()->data_type() == DataType::AUDIO) { - _trig_box = manage(new AudioTriggerPropertiesBox ()); - _ops_box = manage(new AudioRegionOperationsBox ()); - _trim_box = manage(new AudioClipEditorBox ()); - - _trig_box->set_trigger (tref); - _trim_box->set_region(trigger->the_region(), tref); - _ops_box->set_session(&trigger->the_region()->session()); - - table->attach(*_trig_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; - table->attach(*_ops_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; - table->attach(*_trim_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; - - } else { - _trig_box = manage(new MidiTriggerPropertiesBox ()); - _trig_box->set_trigger (tref); - - _midi_editor = new MidiCueEditor; - - std::cerr << "here\n"; - - table->attach(*_trig_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; - table->attach(_midi_editor->viewport(), col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; - } - } - - add (*table); - table->show_all(); -} - -bool -SlotPropertyWindow::on_key_press_event (GdkEventKey* ev) -{ - Gtk::Window& main_window (ARDOUR_UI::instance()->main_window()); - return ARDOUR_UI_UTILS::relay_key_press (ev, &main_window); -} - -bool -SlotPropertyWindow::on_key_release_event (GdkEventKey* ev) -{ - Gtk::Window& main_window (ARDOUR_UI::instance()->main_window()); - return ARDOUR_UI_UTILS::relay_key_press (ev, &main_window); -} diff --git a/gtk2_ardour/slot_properties_box.h b/gtk2_ardour/slot_properties_box.h index 3367d85ae2..b570a8a29b 100644 --- a/gtk2_ardour/slot_properties_box.h +++ b/gtk2_ardour/slot_properties_box.h @@ -166,19 +166,3 @@ private: SlotPropertyWidget* _triggerwidget; }; - -/* XXX probably for testing only */ - -class SlotPropertyWindow : public Gtk::Window -{ - public: - SlotPropertyWindow (ARDOUR::TriggerReference); - - bool on_key_press_event (GdkEventKey*); - bool on_key_release_event (GdkEventKey*); - - TriggerPropertiesBox *_trig_box; - RegionOperationsBox *_ops_box; - ClipEditorBox *_trim_box; - MidiCueEditor* _midi_editor; -}; diff --git a/gtk2_ardour/trigger_page.h b/gtk2_ardour/trigger_page.h index 3f5ad2cc72..82e11d8fb6 100644 --- a/gtk2_ardour/trigger_page.h +++ b/gtk2_ardour/trigger_page.h @@ -30,13 +30,10 @@ #include "application_bar.h" #include "audio_region_operations_box.h" -#include "audio_region_properties_box.h" #include "audio_trigger_properties_box.h" #include "axis_provider.h" #include "cuebox_ui.h" #include "fitted_canvas_widget.h" -#include "midi_region_operations_box.h" -#include "midi_region_properties_box.h" #include "midi_trigger_properties_box.h" #include "route_processor_selection.h" #include "slot_properties_box.h" diff --git a/gtk2_ardour/trigger_ui.cc b/gtk2_ardour/trigger_ui.cc index 8c5f042754..34770b9642 100644 --- a/gtk2_ardour/trigger_ui.cc +++ b/gtk2_ardour/trigger_ui.cc @@ -628,14 +628,6 @@ TriggerUI::clear_trigger () void TriggerUI::edit_trigger () { - SlotPropertyWindow* tw = static_cast (trigger()->ui ()); - - if (!tw) { - tw = new SlotPropertyWindow (TriggerReference (trigger()->boxptr(), trigger()->index())); - trigger()->set_ui (tw); - } - - tw->present (); } void diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index c572a52cdf..a0424d7dfc 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -43,9 +43,6 @@ gtk2_ardour_sources = [ 'audio_clip_editor.cc', 'audio_region_editor.cc', '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', @@ -174,8 +171,6 @@ gtk2_ardour_sources = [ 'midi_export_dialog.cc', 'midi_list_editor.cc', 'midi_region_view.cc', - 'midi_region_operations_box.cc', - 'midi_region_properties_box.cc', 'midi_trigger_properties_box.cc', 'midi_selection.cc', 'midi_streamview.cc', @@ -198,7 +193,6 @@ gtk2_ardour_sources = [ 'mono_panner.cc', 'mono_panner_editor.cc', 'mouse_cursors.cc', - 'multi_region_properties_box.cc', 'nag.cc', 'new_plugin_preset_dialog.cc', 'new_user_wizard.cc', @@ -256,6 +250,7 @@ gtk2_ardour_sources = [ 'recorder_group_tabs.cc', 'recorder_ui.cc', 'region_editor.cc', + 'region_editor_window.cc', 'region_fx_line.cc', 'region_gain_line.cc', 'region_layering_order_editor.cc', diff --git a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h index 27c10b79b6..a30e94ca24 100644 --- a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h +++ b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h @@ -62,8 +62,9 @@ template class /*LIBGTKMM2EXT_API*/ DnDVBox : public Gtk::EventBox { public: - DnDVBox (std::list targets) + DnDVBox (std::list targets, Gdk::DragAction actions = Gdk::ACTION_COPY) : _targets (targets) + , _actions (actions) , _active (0) , _drag_icon (0) , _expecting_unwanted_button_event (false) @@ -85,7 +86,7 @@ public: _internal_vbox.show (); - drag_dest_set (_targets); + drag_dest_set (_targets, Gtk::DEST_DEFAULT_ALL, _actions); signal_drag_data_received().connect (mem_fun (*this, &DnDVBox::drag_data_received)); } @@ -100,9 +101,9 @@ public: void add_child (T* child, std::list targets = std::list()) { if (targets.empty ()) { - child->action_widget().drag_source_set (_targets); + child->action_widget().drag_source_set (_targets, Gdk::MODIFIER_MASK, _actions); } else { - child->action_widget().drag_source_set (targets); + child->action_widget().drag_source_set (targets, Gdk::MODIFIER_MASK, _actions); } child->action_widget().signal_drag_begin().connect (sigc::bind (mem_fun (*this, &DnDVBox::drag_begin), child)); child->action_widget().signal_drag_data_get().connect (sigc::bind (mem_fun (*this, &DnDVBox::drag_data_get), child)); @@ -255,6 +256,8 @@ public: sigc::signal SelectionChanged; sigc::signal SelectionAdded; + sigc::signal DragRefuse; + private: /** @return the bottom y position of a child, pretending any placeholder @@ -478,6 +481,13 @@ private: bool top_half = (c - int (c)) < .5; bool bottom_half = !top_half; + if (_drag_source != this) { + if (DragRefuse (_drag_source, at)) { + ctx->drag_refuse (tme); + return true; + } + } + if (_drag_source != this /* re-order */ && _drag_source && at && _drag_source->_drag_child @@ -512,7 +522,7 @@ private: if (_drag_source == this /* re-order */) { ctx->drag_status (Gdk::ACTION_MOVE, tme); } else { - ctx->drag_status (Gdk::ACTION_COPY, tme); + ctx->drag_status (ctx->get_suggested_action (), tme); } } else { ctx->drag_status (Gdk::ACTION_LINK, tme); @@ -664,6 +674,7 @@ private: Gtk::VBox _internal_vbox; std::list _targets; + Gdk::DragAction _actions; std::list _children; std::list _selection; T* _active; diff --git a/libs/pbd/pbd/stack_allocator.h b/libs/pbd/pbd/stack_allocator.h index 742cf39b6d..9eed081ec0 100644 --- a/libs/pbd/pbd/stack_allocator.h +++ b/libs/pbd/pbd/stack_allocator.h @@ -19,6 +19,7 @@ #ifndef PBD_STACK_ALLOCATOR_H #define PBD_STACK_ALLOCATOR_H +#include #include #include "pbd/libpbd_visibility.h" @@ -60,22 +61,22 @@ public: }; StackAllocator () - : _ptr (_buf.data()) + : _ptr ((pointer)&_buf) { } StackAllocator (const StackAllocator&) - : StackAllocator () + : _ptr ((pointer)&_buf) { } template StackAllocator (const StackAllocator&) - : StackAllocator () + : _ptr ((pointer)&_buf) { } /* inspired by http://howardhinnant.github.io/stack_alloc.h */ pointer allocate (size_type n, void* hint = 0) { - if (_buf.data() + stack_capacity >= _ptr + n) { + if ((pointer)&_buf + stack_capacity >= _ptr + n) { DEBUG_STACK_ALLOC ("Allocate %ld item(s) of size %zu on the stack\n", n, sizeof (T)); pointer rv = _ptr; _ptr += n; @@ -107,12 +108,12 @@ public: bool operator== (StackAllocator const& a) const { - return _buf.data() == a._buf.data(); + return &_buf == &a._buf; } bool operator!= (StackAllocator const& a) const { - return _buf.data() != a._buf.data(); + return &_buf != &a._buf; } template @@ -146,10 +147,12 @@ private: bool pointer_in_buffer (pointer const p) { - return (_buf.data() <= p && p < _buf.data() + stack_capacity); + return ((pointer const)&_buf <= p && p < (pointer const)&_buf + stack_capacity); } - alignas(16) std::array _buf; + typedef typename boost::aligned_storage::type align_t; + + align_t _buf; pointer _ptr; }; diff --git a/wscript b/wscript index e9d1e7b94b..0ee5aa3005 100644 --- a/wscript +++ b/wscript @@ -550,7 +550,6 @@ int main() { return 0; }''', cxx_flags.append('-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION') else: cxx_flags.append('-DBOOST_NO_AUTO_PTR') - cxx_flags.append('-DBOOST_BIND_GLOBAL_PLACEHOLDERS') if (is_clang and platform == "darwin"): # Silence warnings about the non-existing osx clang compiler flags @@ -735,7 +734,7 @@ int main() { return 0; }''', # need ISOC9X for llabs() compiler_flags.extend( - ('-DBOOST_SYSTEM_NO_DEPRECATED', '-DBOOST_BIND_GLOBAL_PLACEHOLDERS', '-D_ISOC9X_SOURCE', + ('-DBOOST_SYSTEM_NO_DEPRECATED', '-D_ISOC9X_SOURCE', '-D_LARGEFILE64_SOURCE', '-D_FILE_OFFSET_BITS=64')) cxx_flags.extend( ('-D__STDC_LIMIT_MACROS', '-D__STDC_FORMAT_MACROS',