13
0

Compare commits

...

10 Commits

Author SHA1 Message Date
4f119795a6
Merge branch 'ardour' 2024-11-19 23:27:11 +01:00
4a99026cc9
Revert "Replace boost::aligned_storage with alignas std::array"
This reverts commit 32ff87f7f6.

This causes issues on macOS/clang
```
../libs/pbd/pbd/stack_allocator.h:152:53: note: destructor of 'StackAllocator<std::__tree_node<std::__value_type<ARDOUR::DataType, std::map<unsigned int, unsigned int, std::less<unsigned int>, PBD::StackAllocator<std::pair<const unsigned int, unsigned int>, 16>>>, void *>, 2>' is implicitly deleted because field '_buf' has a deleted destructor
  152 |         alignas(16) std::array<value_type, stack_capacity> _buf;
```
2024-11-19 18:03:23 +01:00
2a620c64e9
Show plugin UIs in Route Property Box 2024-11-19 17:45:29 +01:00
49c7464b9c
Allow to move (cut/paste DnD) region FX
This also prevents copying effects to another RegionFX
Box of the same region (e.g. when using Region Property
Bottom Pane)
2024-11-19 17:45:26 +01:00
d8a197a63f
Implement Editor Region Properties 2024-11-19 17:45:21 +01:00
00f3ce2e76
Remove unused property boxes, prepare for Region Editor
Using that old template code would introduce significant
tech-dept.

This also properly initializes the selection property box
and handles edge cases during session setup and deletion.
2024-11-19 17:41:55 +01:00
c35fa54b3f
Refactor RegionEditor to be a Widget 2024-11-19 17:37:12 +01:00
3c5681b2c9
Add option to only show controls in generic plugin UI
The intention here is to show a minimal UI in the
Route Property Box
2024-11-19 17:37:06 +01:00
4a966d5015
DndVBox: implement drag-refuse and drag move action 2024-11-19 17:36:53 +01:00
Alejandro Domínguez
4687a5a886
Use std::placeholders by default 2024-11-18 19:05:14 +01:00
35 changed files with 386 additions and 1406 deletions

View File

@ -132,8 +132,6 @@ AudioRegionEditor::AudioRegionEditor (Session* s, AudioRegionView* arv)
snprintf (name, 64, "peak amplitude-%p", this); snprintf (name, 64, "peak amplitude-%p", this);
pthread_create_and_store (name, &_peak_amplitude_thread_handle, _peak_amplitude_thread, this); pthread_create_and_store (name, &_peak_amplitude_thread_handle, _peak_amplitude_thread, this);
signal_peak_thread (); signal_peak_thread ();
} }
AudioRegionEditor::~AudioRegionEditor () AudioRegionEditor::~AudioRegionEditor ()
@ -359,5 +357,4 @@ void
AudioRegionEditor::on_unmap () AudioRegionEditor::on_unmap ()
{ {
_show_on_touch.set_active (false); _show_on_touch.set_active (false);
ArdourDialog::on_unmap ();
} }

View File

@ -104,4 +104,3 @@ private:
PBD::ScopedConnection _peak_amplitude_connection; PBD::ScopedConnection _peak_amplitude_connection;
CrossThreadChannel _peak_channel; CrossThreadChannel _peak_channel;
}; };

View File

@ -1,201 +0,0 @@
/*
* 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 "pbd/compose.h"
#include <algorithm>
#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<Region> 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<Region> r)
{
RegionPropertiesBox::set_region (r);
}

View File

@ -1,89 +0,0 @@
/*
* Copyright (C) 2021 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.
*/
#pragma once
#include <map>
#include <gtkmm/box.h>
#include <gtkmm/label.h>
#include <gtkmm/table.h>
#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<ARDOUR::Region>);
void set_session (ARDOUR::Session* s);
protected:
std::shared_ptr<ARDOUR::Region> _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<ARDOUR::Region>);
private:
ArdourWidgets::ArdourButton fade_in_enable_button;
ArdourWidgets::ArdourButton fade_out_enable_button;
ArdourWidgets::ArdourButton gain_control;
ArdourWidgets::ArdourButton stretch_selector;
};

View File

@ -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 void
AudioRegionView::transients_changed () AudioRegionView::transients_changed ()
{ {

View File

@ -122,8 +122,6 @@ public:
void update_transient(float old_pos, float new_pos); void update_transient(float old_pos, float new_pos);
void remove_transient(float pos); void remove_transient(float pos);
void show_region_editor ();
void set_frame_color (); void set_frame_color ();
uint32_t get_fill_color () const; uint32_t get_fill_color () const;

View File

@ -1,60 +0,0 @@
/*
* Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2024 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 "pbd/compose.h"
#include <algorithm>
#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 ()
{
}

View File

@ -84,10 +84,11 @@ using namespace ArdourWidgets;
using namespace Gtk; using namespace Gtk;
using namespace ARDOUR_UI_UTILS; using namespace ARDOUR_UI_UTILS;
GenericPluginUI::GenericPluginUI (std::shared_ptr<PlugInsertBase> pib, bool scrollable) GenericPluginUI::GenericPluginUI (std::shared_ptr<PlugInsertBase> pib, bool scrollable, bool ctrls_only)
: PlugUIBase (pib) : PlugUIBase (pib)
, automation_menu (0) , automation_menu (0)
, is_scrollable(scrollable) , is_scrollable(scrollable)
, want_ctrl_only(ctrls_only)
, _plugin_pianokeyboard_expander (_("MIDI Keyboard (audition only)")) , _plugin_pianokeyboard_expander (_("MIDI Keyboard (audition only)"))
, _piano (0) , _piano (0)
, _piano_velocity (*manage (new Adjustment (100, 1, 127, 1, 16))) , _piano_velocity (*manage (new Adjustment (100, 1, 127, 1, 16)))
@ -121,7 +122,9 @@ GenericPluginUI::GenericPluginUI (std::shared_ptr<PlugInsertBase> pib, bool scro
automation_latch_all_button.set_text (GainMeterBase::astate_string (ARDOUR::Latch)); automation_latch_all_button.set_text (GainMeterBase::astate_string (ARDOUR::Latch));
automation_latch_all_button.set_name (X_("generic button")); 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 = new APianoKeyboard ();
_piano->set_can_focus (); _piano->set_can_focus ();
@ -149,11 +152,11 @@ GenericPluginUI::GenericPluginUI (std::shared_ptr<PlugInsertBase> pib, bool scro
pack_end (plugin_analysis_expander, false, false); pack_end (plugin_analysis_expander, false, false);
} }
if (_pib->provides_stats ()) { if (!ctrls_only && _pib->provides_stats ()) {
pack_end (cpuload_expander, false, false); pack_end (cpuload_expander, false, false);
} }
if (!plugin->get_docs().empty()) { if (!ctrls_only && !plugin->get_docs().empty()) {
pack_end (description_expander, false, false); pack_end (description_expander, false, false);
} }
@ -175,7 +178,9 @@ GenericPluginUI::GenericPluginUI (std::shared_ptr<PlugInsertBase> pib, bool scro
settings_box.pack_start (*automation_hbox, false, false, 6); 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) { if (_pi) {
_pi->ActiveChanged.connect (active_connection, invalidator (*this), std::bind (&GenericPluginUI::processor_active_changed, this, std::weak_ptr<Processor>(_pi)), gui_context()); _pi->ActiveChanged.connect (active_connection, invalidator (*this), std::bind (&GenericPluginUI::processor_active_changed, this, std::weak_ptr<Processor>(_pi)), gui_context());
@ -498,7 +503,7 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
// we can lay them out a bit more nicely later. // we can lay them out a bit more nicely later.
cui_controls_list.push_back(cui); 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, output_table->attach (*cui, output_col, output_col + 1, output_row, output_row+1,
FILL|EXPAND, FILL); FILL|EXPAND, FILL);
@ -619,7 +624,7 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
delete output_table; 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)); PluginDisplay* pd = manage (new PluginDisplay (plugin, 300));
hpacker.pack_end (*pd, true, true); hpacker.pack_end (*pd, true, true);
} }

View File

@ -1,97 +0,0 @@
/*
* Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2021 Ben Loftis <ben@harrisonconsoles.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <algorithm>
#include "pbd/compose.h"
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/actions.h"
#include "ardour/location.h"
#include "ardour/profile.h"
#include "ardour/session.h"
#include "audio_clock.h"
#include "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();
}

View File

@ -1,64 +0,0 @@
/*
* Copyright (C) 2021 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.
*/
#pragma once
#include <map>
#include <gtkmm/box.h>
#include <gtkmm/label.h>
#include <gtkmm/table.h>
#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();
};

View File

@ -1,90 +0,0 @@
/*
* 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 "pbd/compose.h"
#include <algorithm>
#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<Region> 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 ...? */
}

View File

@ -1,57 +0,0 @@
/*
* Copyright (C) 2021 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.
*/
#pragma once
#include <map>
#include <gtkmm/box.h>
#include <gtkmm/label.h>
#include <gtkmm/table.h>
#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<ARDOUR::Region>);
private:
void region_changed (const PBD::PropertyChange& what_changed);
PBD::ScopedConnection midi_state_connection;
ArdourWidgets::ArdourButton patch_selector_button;
ArdourWidgets::ArdourButton cc_selector_button;
};

View File

@ -1,108 +0,0 @@
/*
* Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2021 Ben Loftis <ben@harrisonconsoles.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <algorithm>
#include "pbd/compose.h"
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/actions.h"
#include "ardour/location.h"
#include "ardour/profile.h"
#include "ardour/session.h"
#include "audio_clock.h"
#include "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);
}
}

View File

@ -1,66 +0,0 @@
/*
* Copyright (C) 2021 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.
*/
#pragma once
#include <map>
#include <gtkmm/box.h>
#include <gtkmm/label.h>
#include <gtkmm/table.h>
#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();
};

View File

@ -219,7 +219,7 @@ private:
class GenericPluginUI : public PlugUIBase, public Gtk::VBox class GenericPluginUI : public PlugUIBase, public Gtk::VBox
{ {
public: public:
GenericPluginUI (std::shared_ptr<ARDOUR::PlugInsertBase> plug, bool scrollable=false); GenericPluginUI (std::shared_ptr<ARDOUR::PlugInsertBase> plug, bool scrollable = false, bool ctrls_only = false);
~GenericPluginUI (); ~GenericPluginUI ();
gint get_preferred_height () { return prefheight; } gint get_preferred_height () { return prefheight; }
@ -236,6 +236,7 @@ private:
gint prefheight; gint prefheight;
bool is_scrollable; bool is_scrollable;
bool want_ctrl_only;
struct MeterInfo { struct MeterInfo {
ArdourWidgets::FastMeter* meter; ArdourWidgets::FastMeter* meter;

View File

@ -5,6 +5,7 @@
* Copyright (C) 2010-2012 Carl Hetherington <carl@carlh.net> * Copyright (C) 2010-2012 Carl Hetherington <carl@carlh.net>
* Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org> * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
* Copyright (C) 2014-2015 Nick Mainsbridge <mainsbridge@gmail.com> * Copyright (C) 2014-2015 Nick Mainsbridge <mainsbridge@gmail.com>
* Copyright (C) 2024 Ben Loftis <ben.loftis@harrisonaudio.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -64,7 +65,7 @@ using namespace std;
using namespace Gtkmm2ext; using namespace Gtkmm2ext;
RegionEditor::RegionEditor (Session* s, RegionView* rv) RegionEditor::RegionEditor (Session* s, RegionView* rv)
: ArdourDialog (_("Region")) : SessionHandlePtr (s)
, _table (9, 3) , _table (9, 3)
, _table_row (0) , _table_row (0)
, _region (rv->region ()) , _region (rv->region ())
@ -81,8 +82,6 @@ RegionEditor::RegionEditor (Session* s, RegionView* rv)
, _region_fx_box (_region) , _region_fx_box (_region)
, _sources (1) , _sources (1)
{ {
set_session (s);
switch (_region->time_domain()) { switch (_region->time_domain()) {
case Temporal::AudioTime: case Temporal::AudioTime:
/* XXX check length of region and choose samples or minsec */ /* 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); _table.attach (_region_fx_box, 2, 3, 1, _table_row + 2, Gtk::FILL, Gtk::FILL);
#endif #endif
get_vbox()->pack_start (_table, true, true); add (_table);
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()));
for (uint32_t i = 0; i < _region->sources().size(); ++i) { for (uint32_t i = 0; i < _region->sources().size(); ++i) {
_sources.append (_region->source(i)->name()); _sources.append (_region->source(i)->name());
@ -247,6 +237,7 @@ RegionEditor::RegionEditor (Session* s, RegionView* rv)
RegionEditor::~RegionEditor () RegionEditor::~RegionEditor ()
{ {
remove (); /* unpack and unmap table */
delete _clock_group; delete _clock_group;
} }
@ -506,12 +497,6 @@ RegionEditor::on_delete_event (GdkEventAny*)
return true; return true;
} }
void
RegionEditor::handle_response (int)
{
hide ();
}
/* ****************************************************************************/ /* ****************************************************************************/
static std::list<Gtk::TargetEntry> static std::list<Gtk::TargetEntry>
@ -535,7 +520,7 @@ drag_targets ()
RegionEditor::RegionFxBox::RegionFxBox (std::shared_ptr<ARDOUR::Region> r) RegionEditor::RegionFxBox::RegionFxBox (std::shared_ptr<ARDOUR::Region> r)
: _region (r) : _region (r)
, _display (drop_targets ()) , _display (drop_targets (), Gdk::ACTION_COPY | Gdk::ACTION_MOVE)
, _no_redisplay (false) , _no_redisplay (false)
, _placement (-1) , _placement (-1)
{ {
@ -556,6 +541,7 @@ RegionEditor::RegionFxBox::RegionFxBox (std::shared_ptr<ARDOUR::Region> r)
_display.Reordered.connect (sigc::mem_fun (*this, &RegionFxBox::reordered)); _display.Reordered.connect (sigc::mem_fun (*this, &RegionFxBox::reordered));
_display.DropFromAnotherBox.connect (sigc::mem_fun (*this, &RegionFxBox::object_drop)); _display.DropFromAnotherBox.connect (sigc::mem_fun (*this, &RegionFxBox::object_drop));
_display.DropFromExternal.connect (sigc::mem_fun (*this, &RegionFxBox::plugin_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); _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 (); redisplay_plugins ();
} }
bool
RegionEditor::RegionFxBox::drag_refuse (Gtkmm2ext::DnDVBox<RegionFxEntry>* source, RegionFxEntry*)
{
RegionFxBox* other = reinterpret_cast<RegionFxBox*> (source->get_data ("regionfxbox"));
return (other && other->_region == _region);
}
void void
RegionEditor::RegionFxBox::object_drop (Gtkmm2ext::DnDVBox<RegionFxEntry>* source, RegionFxEntry* pos, Glib::RefPtr<Gdk::DragContext> const& context) RegionEditor::RegionFxBox::object_drop (Gtkmm2ext::DnDVBox<RegionFxEntry>* source, RegionFxEntry* pos, Glib::RefPtr<Gdk::DragContext> const& context)
{ {

View File

@ -41,12 +41,12 @@
#include "gtkmm2ext/dndtreeview.h" #include "gtkmm2ext/dndtreeview.h"
#include "gtkmm2ext/dndvbox.h" #include "gtkmm2ext/dndvbox.h"
#include "widgets/frame.h"
#include "pbd/signals.h" #include "pbd/signals.h"
#include "audio_clock.h" #include "audio_clock.h"
#include "ardour_dialog.h"
#include "plugin_interest.h" #include "plugin_interest.h"
#include "region_editor.h"
namespace ARDOUR { namespace ARDOUR {
class Region; class Region;
@ -57,12 +57,14 @@ namespace ARDOUR {
class RegionView; class RegionView;
class ClockGroup; class ClockGroup;
class RegionEditor : public ArdourDialog class RegionEditor : public ArdourWidgets::Frame, public ARDOUR::SessionHandlePtr
{ {
public: public:
RegionEditor (ARDOUR::Session*, RegionView*); RegionEditor (ARDOUR::Session*, RegionView*);
virtual ~RegionEditor (); virtual ~RegionEditor ();
std::shared_ptr<ARDOUR::Region> region () const { return _region; }
protected: protected:
virtual void region_changed (const PBD::PropertyChange&); virtual void region_changed (const PBD::PropertyChange&);
virtual void region_fx_changed (); virtual void region_fx_changed ();
@ -122,6 +124,7 @@ private:
void plugin_drop (Gtk::SelectionData const&, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&); void plugin_drop (Gtk::SelectionData const&, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&);
void object_drop (Gtkmm2ext::DnDVBox<RegionFxEntry>*, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&); void object_drop (Gtkmm2ext::DnDVBox<RegionFxEntry>*, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&);
void delete_dragged_plugins (std::list<std::shared_ptr<ARDOUR::RegionFxPlugin>> const&); void delete_dragged_plugins (std::list<std::shared_ptr<ARDOUR::RegionFxPlugin>> const&);
bool drag_refuse (Gtkmm2ext::DnDVBox<RegionFxEntry>*, RegionFxEntry*);
std::shared_ptr<ARDOUR::RegionFxPlugin> find_drop_position (RegionFxEntry*); std::shared_ptr<ARDOUR::RegionFxPlugin> find_drop_position (RegionFxEntry*);
@ -186,7 +189,6 @@ private:
gint breleased (GdkEventButton* ev, Gtk::SpinButton* but, void (RegionEditor::*pmf)()); gint breleased (GdkEventButton* ev, Gtk::SpinButton* but, void (RegionEditor::*pmf)());
bool on_delete_event (GdkEventAny *); bool on_delete_event (GdkEventAny *);
void handle_response (int);
bool spin_arrow_grab; bool spin_arrow_grab;
@ -195,4 +197,3 @@ private:
void set_clock_mode_from_primary (); void set_clock_mode_from_primary ();
}; };

View File

@ -0,0 +1,59 @@
/*
* Copyright (C) 2024 Robin Gareus <robin@gareus.org>
*
* 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<AudioRegionView*> (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 ();
}

View File

@ -1,6 +1,5 @@
/* /*
* Copyright (C) 2021 Paul Davis <paul@linuxaudiosystems.com> * Copyright (C) 2024 Robin Gareus <robin@gareus.org>
* Copyright (C) 2024 Ben Loftis <ben@harrisonconsoles.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -19,27 +18,22 @@
#pragma once #pragma once
#include <map> #include "ardour_window.h"
#include <gtkmm/box.h> class RegionEditor;
#include <gtkmm/label.h> class RegionView;
#include <gtkmm/table.h>
#include "ardour/ardour.h" class RegionEditorWindow : public ArdourWindow
#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: public:
AudioRoutePropertiesBox (); RegionEditorWindow (ARDOUR::Session*, RegionView*);
~AudioRoutePropertiesBox (); ~RegionEditorWindow ();
void set_session (ARDOUR::Session*);
protected:
void on_unmap ();
private: private:
RegionEditor* _region_editor;
}; };

View File

@ -1,65 +0,0 @@
/*
* Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2021 Ben Loftis <ben@harrisonconsoles.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <algorithm>
#include "pbd/compose.h"
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/actions.h"
#include "ardour/location.h"
#include "ardour/profile.h"
#include "ardour/session.h"
#include "audio_clock.h"
#include "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);
}

View File

@ -1,49 +0,0 @@
/*
* Copyright (C) 2021 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.
*/
#pragma once
#include <map>
#include <gtkmm/box.h>
#include <gtkmm/label.h>
#include <gtkmm/table.h>
#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;
};

View File

@ -48,7 +48,7 @@
#include "region_view.h" #include "region_view.h"
#include "automation_region_view.h" #include "automation_region_view.h"
#include "public_editor.h" #include "public_editor.h"
#include "region_editor.h" #include "region_editor_window.h"
#include "ghostregion.h" #include "ghostregion.h"
#include "ui_config.h" #include "ui_config.h"
#include "utils.h" #include "utils.h"
@ -82,7 +82,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent,
, _region (r) , _region (r)
, sync_mark (nullptr) , sync_mark (nullptr)
, sync_line (nullptr) , sync_line (nullptr)
, editor (nullptr) , _editor (nullptr)
, current_visible_sync_position (0.0) , current_visible_sync_position (0.0)
, valid (false) , valid (false)
, _disable_display (0) , _disable_display (0)
@ -162,7 +162,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent,
, _region (r) , _region (r)
, sync_mark (nullptr) , sync_mark (nullptr)
, sync_line (nullptr) , sync_line (nullptr)
, editor (nullptr) , _editor (nullptr)
, current_visible_sync_position (0.0) , current_visible_sync_position (0.0)
, valid (false) , valid (false)
, _disable_display (0) , _disable_display (0)
@ -181,7 +181,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent,
void void
RegionView::init (bool wfd) RegionView::init (bool wfd)
{ {
editor = nullptr; _editor = nullptr;
valid = true; valid = true;
in_destructor = false; in_destructor = false;
wait_for_data = wfd; wait_for_data = wfd;
@ -268,7 +268,7 @@ RegionView::~RegionView ()
drop_silent_frames (); drop_silent_frames ();
delete editor; delete _editor;
} }
bool bool
@ -749,19 +749,19 @@ RegionView::set_sync_mark_color ()
void void
RegionView::show_region_editor () RegionView::show_region_editor ()
{ {
if (!editor) { if (!_editor) {
editor = new RegionEditor (trackview.session(), this); _editor = new RegionEditorWindow (trackview.session(), this);
} }
editor->present (); _editor->present ();
editor->show_all(); _editor->show_all();
} }
void void
RegionView::hide_region_editor() RegionView::hide_region_editor()
{ {
if (editor) { if (_editor) {
editor->hide_all (); _editor->hide_all ();
} }
} }

View File

@ -40,7 +40,7 @@
#include "marker.h" #include "marker.h"
class TimeAxisView; class TimeAxisView;
class RegionEditor; class ArdourWindow;
class GhostRegion; class GhostRegion;
class AutomationTimeAxisView; class AutomationTimeAxisView;
class AutomationRegionView; class AutomationRegionView;
@ -87,7 +87,7 @@ public:
bool set_position(Temporal::timepos_t const & pos, void* src, double* delta = 0); 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 (); void hide_region_editor ();
virtual void region_changed (const PBD::PropertyChange&); virtual void region_changed (const PBD::PropertyChange&);
@ -202,7 +202,7 @@ protected:
ArdourCanvas::Polygon* sync_mark; ///< polygon for sync position ArdourCanvas::Polygon* sync_mark; ///< polygon for sync position
ArdourCanvas::Line* sync_line; ///< polygon for sync position ArdourCanvas::Line* sync_line; ///< polygon for sync position
RegionEditor* editor; ArdourWindow* _editor;
std::vector<ControlPoint *> control_points; std::vector<ControlPoint *> control_points;
double current_visible_sync_position; double current_visible_sync_position;

View File

@ -17,35 +17,41 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include "pbd/compose.h" #include <cassert>
#include <algorithm> #include <gtkmm/widget.h>
#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/gui_thread.h"
#include "gtkmm2ext/utils.h" #include "gtkmm2ext/utils.h"
#include "ardour/location.h" #include "widgets/frame.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 "plugin_selector.h"
#include "plugin_ui.h"
#include "port_insert_ui.h"
#include "route_properties_box.h" #include "route_properties_box.h"
#include "timers.h"
#include "pbd/i18n.h" #include "pbd/i18n.h"
using namespace Gtk; using namespace Gtk;
using namespace ARDOUR; using namespace ARDOUR;
using namespace ArdourWidgets; using namespace ArdourWidgets;
using std::max;
using std::min;
RoutePropertiesBox::RoutePropertiesBox () 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(); show_all();
} }
@ -54,15 +60,98 @@ RoutePropertiesBox::~RoutePropertiesBox ()
} }
void void
RoutePropertiesBox::set_route (std::shared_ptr<ARDOUR::Route> rt) RoutePropertiesBox::session_going_away ()
{ {
//TODO: route properties ENSURE_GUI_THREAD (*this, &RoutePropertiesBox::session_going_away);
// rt->PropertyChanged.connect (state_connection, invalidator (*this), boost::bind (&RoutePropertiesBox::region_changed, this, _1), gui_context ()); SessionHandlePtr::session_going_away ();
drop_plugin_uis ();
drop_route ();
}
void
RoutePropertiesBox::set_route (std::shared_ptr<Route> 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 void
RoutePropertiesBox::property_changed (const PBD::PropertyChange& what_changed) 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<Gtk::Widget*> 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<Processor> w)
{
std::shared_ptr<Processor> p = w.lock ();
std::shared_ptr<PlugInsertBase> pib = std::dynamic_pointer_cast<PlugInsertBase> (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<int> (h, ui->get_preferred_height () + /* frame label */ 22);
}
h = std::min<int> (h, 300);
_scroller.set_size_request (-1, h);
_scroller.show_all ();
}
} }

View File

@ -1,6 +1,7 @@
/* /*
* Copyright (C) 2021 Paul Davis <paul@linuxaudiosystems.com> * Copyright (C) 2021 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2024 Ben Loftis <ben@harrisonconsoles.com> * Copyright (C) 2024 Ben Loftis <ben@harrisonconsoles.com>
* Copyright (C) 2024 Robin Gareus <robin@gareus.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -19,44 +20,45 @@
#pragma once #pragma once
#include <map> #include <vector>
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/label.h> #include <gtkmm/scrolledwindow.h>
#include <gtkmm/table.h>
#include "ardour/ardour.h" #include "ardour/ardour.h"
#include "ardour/session_handle.h" #include "ardour/session_handle.h"
#include "widgets/ardour_button.h" namespace ARDOUR {
class Route;
#include "gtkmm2ext/cairo_packer.h" class Processor;
#include "region_editor.h"
#include "audio_clock.h"
namespace ARDOUR
{
class Session; class Session;
class Location;
} }
class GenericPluginUI;
class RoutePropertiesBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr class RoutePropertiesBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr
{ {
public: public:
RoutePropertiesBox (); RoutePropertiesBox ();
~RoutePropertiesBox (); ~RoutePropertiesBox ();
virtual void set_route (std::shared_ptr<ARDOUR::Route>); void set_route (std::shared_ptr<ARDOUR::Route>);
protected:
std::shared_ptr<ARDOUR::Region> _route;
Gtk::Label _header_label;
private: private:
void property_changed (const PBD::PropertyChange& what_changed); 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<ARDOUR::Processor> w);
PBD::ScopedConnection state_connection; Gtk::ScrolledWindow _scroller;
Gtk::HBox _box;
std::shared_ptr<ARDOUR::Route> _route;
std::vector <GenericPluginUI*> _proc_uis;
PBD::ScopedConnectionList _processor_connections;
PBD::ScopedConnectionList _route_connections;
}; };

View File

@ -1,6 +1,7 @@
/* /*
* Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com> * Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2021 Ben Loftis <ben@harrisonconsoles.com> * Copyright (C) 2021 Ben Loftis <ben@harrisonconsoles.com>
* Copyright (C) 2024 Robin Gareus <robin@gareus.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include <algorithm>
#include "pbd/compose.h" #include "pbd/compose.h"
#include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/utils.h" #include "gtkmm2ext/utils.h"
#include "gtkmm2ext/actions.h"
#include "ardour/location.h"
#include "ardour/profile.h"
#include "ardour/session.h" #include "ardour/session.h"
#include "audio_clock.h" #include "audio_region_editor.h"
#include "editor_automation_line.h" #include "audio_region_view.h"
#include "control_point.h"
#include "editor.h" #include "editor.h"
#include "region_view.h" #include "region_view.h"
#include "time_info_box.h" #include "route_properties_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 "selection_properties_box.h" #include "selection_properties_box.h"
#include "time_info_box.h"
#include "pbd/i18n.h" #include "pbd/i18n.h"
@ -58,67 +41,53 @@ using std::min;
using std::max; using std::max;
SelectionPropertiesBox::SelectionPropertiesBox () SelectionPropertiesBox::SelectionPropertiesBox ()
: _region_editor (nullptr)
{ {
_header_label.set_text(_("Selection Properties (ESC = Deselect All)")); init ();
_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);
_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 */
_route_prop_box = new RoutePropertiesBox (); _route_prop_box = new RoutePropertiesBox ();
pack_start(*_route_prop_box, false, false, 0);
_time_info_box->set_no_show_all(); pack_start(*_time_info_box, false, false, 0);
_mregions_prop_box->set_no_show_all(); pack_start(*_route_prop_box, true, true, 0);
_audio_prop_box->set_no_show_all(); pack_start(_region_editor_box, false, false, 0);
_midi_ops_box->set_no_show_all();
_audio_ops_box->set_no_show_all(); _time_info_box->set_no_show_all ();
_slot_prop_box->set_no_show_all(); _route_prop_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 () SelectionPropertiesBox::~SelectionPropertiesBox ()
{ {
delete _time_info_box; 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; /* maybe we care about mouse mode?? */
delete _audio_ops_box; Editor::instance().MouseModeChanged.connect (_editor_connection, invalidator(*this), std::bind (&SelectionPropertiesBox::track_mouse_mode, this), gui_context());
delete _midi_prop_box;
delete _audio_prop_box;
delete _route_prop_box; //todo: split into midi/audio
} }
void void
@ -131,33 +100,8 @@ SelectionPropertiesBox::set_session (Session* s)
} }
_time_info_box->set_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); _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(); selection_changed();
} }
@ -167,103 +111,71 @@ SelectionPropertiesBox::track_mouse_mode ()
/* maybe do something here? */ /* 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 void
SelectionPropertiesBox::selection_changed () 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()); Selection& selection (Editor::instance().get_selection());
_time_info_box->hide(); if (!selection.time.empty ()) {
_time_info_box->show ();
_mregions_prop_box->hide(); } else {
_time_info_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.tracks.empty()) { if (!selection.tracks.empty ()) {
_route_prop_box->show(); TimeAxisView *tav = selection.tracks.front ();
TimeAxisView *tav = *(selection.tracks.begin());
RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView *>(tav); RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView *>(tav);
_route_prop_box->set_route(rtav->route()); _route_prop_box->set_route (rtav->route());
_header_label.set_text(_("Track Properties (Press ESC to Deselect All)")); _route_prop_box->show();
_header_label.hide(); } else {
_route_prop_box->hide();
} }
#if SELECTION_PROPERTIES_BOX_TODO if (selection.regions.size () == 1) {
/* one or more regions, show the multi-region operations box (just MUTE? kinda boring) */ RegionView* rv = (selection.regions.front ());
if (!selection.regions.empty()) { if (!_region_editor || _region_editor->region () != rv->region ()) {
_mregions_prop_box->show(); delete_region_editor ();
} AudioRegionView* arv = dynamic_cast<AudioRegionView*> (rv);
if (arv) {
bool found_midi_regions = false; _region_editor = new AudioRegionEditor (_session, arv);
for (RegionSelection::iterator s = selection.regions.begin(); s != selection.regions.end(); ++s) { } else {
ARDOUR::Region* region = (*s)->region().get(); _region_editor = new RegionEditor (_session, rv);
if (region->data_type() == DataType::MIDI) { }
found_midi_regions = true; // TODO subscribe to region name changes
break; _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<ARDOUR::Region> selected_region = std::shared_ptr<ARDOUR::Region>();
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<ARDOUR::Region> 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
} }

View File

@ -1,6 +1,7 @@
/* /*
* Copyright (C) 2021 Paul Davis <paul@linuxaudiosystems.com> * Copyright (C) 2021 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2024 Ben Loftis <ben@harrisonconsoles.com> * Copyright (C) 2024 Ben Loftis <ben@harrisonconsoles.com>
* Copyright (C) 2024 Robin Gareus <robin@gareus.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -19,8 +20,6 @@
#pragma once #pragma once
#include <map>
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/label.h> #include <gtkmm/label.h>
#include <gtkmm/table.h> #include <gtkmm/table.h>
@ -28,25 +27,14 @@
#include "ardour/ardour.h" #include "ardour/ardour.h"
#include "ardour/session_handle.h" #include "ardour/session_handle.h"
#include "gtkmm2ext/cairo_packer.h" #include "widgets/eventboxext.h"
namespace ARDOUR { namespace ARDOUR {
class Session; class Session;
class Location;
} }
class TimeInfoBox; class TimeInfoBox;
class RegionEditor;
class MultiRegionPropertiesBox;
class SlotPropertiesBox;
class AudioRegionPropertiesBox;
class MidiRegionPropertiesBox;
class AudioRegionOperationsBox;
class MidiRegionOperationsBox;
class RoutePropertiesBox; class RoutePropertiesBox;
class SelectionPropertiesBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr class SelectionPropertiesBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr
@ -57,29 +45,18 @@ public:
void set_session (ARDOUR::Session*); void set_session (ARDOUR::Session*);
PBD::ScopedConnectionList editor_connections;
private: private:
Gtk::Table table; void init ();
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 selection_changed (); void selection_changed ();
void track_mouse_mode (); 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;
}; };

View File

@ -50,13 +50,8 @@
#include "utils.h" #include "utils.h"
#include "audio_clip_editor.h" #include "audio_clip_editor.h"
#include "audio_region_properties_box.h"
#include "audio_trigger_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 "midi_cue_editor.h"
#include "slot_properties_box.h" #include "slot_properties_box.h"
@ -723,69 +718,3 @@ SlotPropertyWidget::SlotPropertyWidget ()
pack_start(*ui); pack_start(*ui);
ui->show(); 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);
}

View File

@ -166,19 +166,3 @@ private:
SlotPropertyWidget* _triggerwidget; 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;
};

View File

@ -30,13 +30,10 @@
#include "application_bar.h" #include "application_bar.h"
#include "audio_region_operations_box.h" #include "audio_region_operations_box.h"
#include "audio_region_properties_box.h"
#include "audio_trigger_properties_box.h" #include "audio_trigger_properties_box.h"
#include "axis_provider.h" #include "axis_provider.h"
#include "cuebox_ui.h" #include "cuebox_ui.h"
#include "fitted_canvas_widget.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 "midi_trigger_properties_box.h"
#include "route_processor_selection.h" #include "route_processor_selection.h"
#include "slot_properties_box.h" #include "slot_properties_box.h"

View File

@ -628,14 +628,6 @@ TriggerUI::clear_trigger ()
void void
TriggerUI::edit_trigger () TriggerUI::edit_trigger ()
{ {
SlotPropertyWindow* tw = static_cast<SlotPropertyWindow*> (trigger()->ui ());
if (!tw) {
tw = new SlotPropertyWindow (TriggerReference (trigger()->boxptr(), trigger()->index()));
trigger()->set_ui (tw);
}
tw->present ();
} }
void void

View File

@ -43,9 +43,6 @@ gtk2_ardour_sources = [
'audio_clip_editor.cc', 'audio_clip_editor.cc',
'audio_region_editor.cc', 'audio_region_editor.cc',
'audio_region_view.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_trigger_properties_box.cc',
'audio_streamview.cc', 'audio_streamview.cc',
'audio_time_axis.cc', 'audio_time_axis.cc',
@ -174,8 +171,6 @@ gtk2_ardour_sources = [
'midi_export_dialog.cc', 'midi_export_dialog.cc',
'midi_list_editor.cc', 'midi_list_editor.cc',
'midi_region_view.cc', 'midi_region_view.cc',
'midi_region_operations_box.cc',
'midi_region_properties_box.cc',
'midi_trigger_properties_box.cc', 'midi_trigger_properties_box.cc',
'midi_selection.cc', 'midi_selection.cc',
'midi_streamview.cc', 'midi_streamview.cc',
@ -198,7 +193,6 @@ gtk2_ardour_sources = [
'mono_panner.cc', 'mono_panner.cc',
'mono_panner_editor.cc', 'mono_panner_editor.cc',
'mouse_cursors.cc', 'mouse_cursors.cc',
'multi_region_properties_box.cc',
'nag.cc', 'nag.cc',
'new_plugin_preset_dialog.cc', 'new_plugin_preset_dialog.cc',
'new_user_wizard.cc', 'new_user_wizard.cc',
@ -256,6 +250,7 @@ gtk2_ardour_sources = [
'recorder_group_tabs.cc', 'recorder_group_tabs.cc',
'recorder_ui.cc', 'recorder_ui.cc',
'region_editor.cc', 'region_editor.cc',
'region_editor_window.cc',
'region_fx_line.cc', 'region_fx_line.cc',
'region_gain_line.cc', 'region_gain_line.cc',
'region_layering_order_editor.cc', 'region_layering_order_editor.cc',

View File

@ -62,8 +62,9 @@ template <class T>
class /*LIBGTKMM2EXT_API*/ DnDVBox : public Gtk::EventBox class /*LIBGTKMM2EXT_API*/ DnDVBox : public Gtk::EventBox
{ {
public: public:
DnDVBox (std::list<Gtk::TargetEntry> targets) DnDVBox (std::list<Gtk::TargetEntry> targets, Gdk::DragAction actions = Gdk::ACTION_COPY)
: _targets (targets) : _targets (targets)
, _actions (actions)
, _active (0) , _active (0)
, _drag_icon (0) , _drag_icon (0)
, _expecting_unwanted_button_event (false) , _expecting_unwanted_button_event (false)
@ -85,7 +86,7 @@ public:
_internal_vbox.show (); _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)); signal_drag_data_received().connect (mem_fun (*this, &DnDVBox::drag_data_received));
} }
@ -100,9 +101,9 @@ public:
void add_child (T* child, std::list<Gtk::TargetEntry> targets = std::list<Gtk::TargetEntry>()) void add_child (T* child, std::list<Gtk::TargetEntry> targets = std::list<Gtk::TargetEntry>())
{ {
if (targets.empty ()) { if (targets.empty ()) {
child->action_widget().drag_source_set (_targets); child->action_widget().drag_source_set (_targets, Gdk::MODIFIER_MASK, _actions);
} else { } 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_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)); 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<void> SelectionChanged; sigc::signal<void> SelectionChanged;
sigc::signal<void,T&> SelectionAdded; sigc::signal<void,T&> SelectionAdded;
sigc::signal<bool, DnDVBox*, T*> DragRefuse;
private: private:
/** @return the bottom y position of a child, pretending any placeholder /** @return the bottom y position of a child, pretending any placeholder
@ -478,6 +481,13 @@ private:
bool top_half = (c - int (c)) < .5; bool top_half = (c - int (c)) < .5;
bool bottom_half = !top_half; 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 */ if (_drag_source != this /* re-order */
&& _drag_source && at && _drag_source && at
&& _drag_source->_drag_child && _drag_source->_drag_child
@ -512,7 +522,7 @@ private:
if (_drag_source == this /* re-order */) { if (_drag_source == this /* re-order */) {
ctx->drag_status (Gdk::ACTION_MOVE, tme); ctx->drag_status (Gdk::ACTION_MOVE, tme);
} else { } else {
ctx->drag_status (Gdk::ACTION_COPY, tme); ctx->drag_status (ctx->get_suggested_action (), tme);
} }
} else { } else {
ctx->drag_status (Gdk::ACTION_LINK, tme); ctx->drag_status (Gdk::ACTION_LINK, tme);
@ -664,6 +674,7 @@ private:
Gtk::VBox _internal_vbox; Gtk::VBox _internal_vbox;
std::list<Gtk::TargetEntry> _targets; std::list<Gtk::TargetEntry> _targets;
Gdk::DragAction _actions;
std::list<T*> _children; std::list<T*> _children;
std::list<T*> _selection; std::list<T*> _selection;
T* _active; T* _active;

View File

@ -19,6 +19,7 @@
#ifndef PBD_STACK_ALLOCATOR_H #ifndef PBD_STACK_ALLOCATOR_H
#define PBD_STACK_ALLOCATOR_H #define PBD_STACK_ALLOCATOR_H
#include <boost/type_traits/aligned_storage.hpp>
#include <limits> #include <limits>
#include "pbd/libpbd_visibility.h" #include "pbd/libpbd_visibility.h"
@ -60,22 +61,22 @@ public:
}; };
StackAllocator () StackAllocator ()
: _ptr (_buf.data()) : _ptr ((pointer)&_buf)
{ } { }
StackAllocator (const StackAllocator&) StackAllocator (const StackAllocator&)
: StackAllocator () : _ptr ((pointer)&_buf)
{ } { }
template <typename U, size_t other_capacity> template <typename U, size_t other_capacity>
StackAllocator (const StackAllocator<U, other_capacity>&) StackAllocator (const StackAllocator<U, other_capacity>&)
: StackAllocator () : _ptr ((pointer)&_buf)
{ } { }
/* inspired by http://howardhinnant.github.io/stack_alloc.h */ /* inspired by http://howardhinnant.github.io/stack_alloc.h */
pointer allocate (size_type n, void* hint = 0) 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)); DEBUG_STACK_ALLOC ("Allocate %ld item(s) of size %zu on the stack\n", n, sizeof (T));
pointer rv = _ptr; pointer rv = _ptr;
_ptr += n; _ptr += n;
@ -107,12 +108,12 @@ public:
bool operator== (StackAllocator const& a) const bool operator== (StackAllocator const& a) const
{ {
return _buf.data() == a._buf.data(); return &_buf == &a._buf;
} }
bool operator!= (StackAllocator const& a) const bool operator!= (StackAllocator const& a) const
{ {
return _buf.data() != a._buf.data(); return &_buf != &a._buf;
} }
template <class U> template <class U>
@ -146,10 +147,12 @@ private:
bool pointer_in_buffer (pointer const p) 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<value_type, stack_capacity> _buf; typedef typename boost::aligned_storage<sizeof (T) * stack_capacity, 16>::type align_t;
align_t _buf;
pointer _ptr; pointer _ptr;
}; };

View File

@ -550,7 +550,6 @@ int main() { return 0; }''',
cxx_flags.append('-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION') cxx_flags.append('-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION')
else: else:
cxx_flags.append('-DBOOST_NO_AUTO_PTR') cxx_flags.append('-DBOOST_NO_AUTO_PTR')
cxx_flags.append('-DBOOST_BIND_GLOBAL_PLACEHOLDERS')
if (is_clang and platform == "darwin"): if (is_clang and platform == "darwin"):
# Silence warnings about the non-existing osx clang compiler flags # Silence warnings about the non-existing osx clang compiler flags
@ -735,7 +734,7 @@ int main() { return 0; }''',
# need ISOC9X for llabs() # need ISOC9X for llabs()
compiler_flags.extend( 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')) '-D_LARGEFILE64_SOURCE', '-D_FILE_OFFSET_BITS=64'))
cxx_flags.extend( cxx_flags.extend(
('-D__STDC_LIMIT_MACROS', '-D__STDC_FORMAT_MACROS', ('-D__STDC_LIMIT_MACROS', '-D__STDC_FORMAT_MACROS',