13
0

Compare commits

..

No commits in common. "4f119795a6b2fbfc64fdafe3eeb2782420d24271" and "dd23aadd62dd3947706cadbb6eeb2159edfb23d1" have entirely different histories.

35 changed files with 1405 additions and 385 deletions

View File

@ -132,6 +132,8 @@ 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 ()
@ -357,4 +359,5 @@ 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,3 +104,4 @@ private:
PBD::ScopedConnection _peak_amplitude_connection; PBD::ScopedConnection _peak_amplitude_connection;
CrossThreadChannel _peak_channel; CrossThreadChannel _peak_channel;
}; };

View File

@ -0,0 +1,201 @@
/*
* 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

@ -0,0 +1,89 @@
/*
* 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,6 +1819,17 @@ 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,6 +122,8 @@ 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

@ -0,0 +1,60 @@
/*
* 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

@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2024 Robin Gareus <robin@gareus.org> * Copyright (C) 2021 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 * 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
@ -18,22 +19,27 @@
#pragma once #pragma once
#include "ardour_window.h" #include <map>
class RegionEditor; #include <gtkmm/box.h>
class RegionView; #include <gtkmm/label.h>
#include <gtkmm/table.h>
class RegionEditorWindow : public ArdourWindow #include "ardour/ardour.h"
#include "ardour/session_handle.h"
#include "widgets/ardour_button.h"
#include "gtkmm2ext/cairo_packer.h"
#include "route_properties_box.h"
class AudioRoutePropertiesBox : public RoutePropertiesBox
{ {
public: public:
RegionEditorWindow (ARDOUR::Session*, RegionView*); AudioRoutePropertiesBox ();
~RegionEditorWindow (); ~AudioRoutePropertiesBox ();
void set_session (ARDOUR::Session*);
protected:
void on_unmap ();
private: private:
RegionEditor* _region_editor;
}; };

View File

@ -84,11 +84,10 @@ 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, bool ctrls_only) GenericPluginUI::GenericPluginUI (std::shared_ptr<PlugInsertBase> pib, bool scrollable)
: 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)))
@ -122,9 +121,7 @@ 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 (ctrls_only) { if (_pib->ui_elements () & PlugInsertBase::MIDIKeyboard) {
// relax
} else if (_pib->ui_elements () & PlugInsertBase::MIDIKeyboard) {
_piano = new APianoKeyboard (); _piano = new APianoKeyboard ();
_piano->set_can_focus (); _piano->set_can_focus ();
@ -152,11 +149,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 (!ctrls_only && _pib->provides_stats ()) { if (_pib->provides_stats ()) {
pack_end (cpuload_expander, false, false); pack_end (cpuload_expander, false, false);
} }
if (!ctrls_only && !plugin->get_docs().empty()) { if (!plugin->get_docs().empty()) {
pack_end (description_expander, false, false); pack_end (description_expander, false, false);
} }
@ -178,9 +175,7 @@ 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);
} }
if (!ctrls_only) { main_contents.pack_start (settings_box, false, false);
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());
@ -503,7 +498,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 && !want_ctrl_only) { } else if (cui->display) {
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);
@ -624,7 +619,7 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
delete output_table; delete output_table;
} }
if (!want_ctrl_only && plugin->has_inline_display () && plugin->inline_display_in_gui ()) { if (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

@ -0,0 +1,97 @@
/*
* 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

@ -0,0 +1,64 @@
/*
* 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

@ -0,0 +1,90 @@
/*
* 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

@ -0,0 +1,57 @@
/*
* 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

@ -0,0 +1,108 @@
/*
* 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

@ -0,0 +1,66 @@
/*
* 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, bool ctrls_only = false); GenericPluginUI (std::shared_ptr<ARDOUR::PlugInsertBase> plug, bool scrollable=false);
~GenericPluginUI (); ~GenericPluginUI ();
gint get_preferred_height () { return prefheight; } gint get_preferred_height () { return prefheight; }
@ -236,7 +236,6 @@ 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,7 +5,6 @@
* 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
@ -65,7 +64,7 @@ using namespace std;
using namespace Gtkmm2ext; using namespace Gtkmm2ext;
RegionEditor::RegionEditor (Session* s, RegionView* rv) RegionEditor::RegionEditor (Session* s, RegionView* rv)
: SessionHandlePtr (s) : ArdourDialog (_("Region"))
, _table (9, 3) , _table (9, 3)
, _table_row (0) , _table_row (0)
, _region (rv->region ()) , _region (rv->region ())
@ -82,6 +81,8 @@ 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 */
@ -193,7 +194,16 @@ 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
add (_table); 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()));
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());
@ -237,7 +247,6 @@ RegionEditor::RegionEditor (Session* s, RegionView* rv)
RegionEditor::~RegionEditor () RegionEditor::~RegionEditor ()
{ {
remove (); /* unpack and unmap table */
delete _clock_group; delete _clock_group;
} }
@ -497,6 +506,12 @@ 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>
@ -520,7 +535,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 (), Gdk::ACTION_COPY | Gdk::ACTION_MOVE) , _display (drop_targets ())
, _no_redisplay (false) , _no_redisplay (false)
, _placement (-1) , _placement (-1)
{ {
@ -541,7 +556,6 @@ 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);
@ -899,13 +913,6 @@ 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,14 +57,12 @@ namespace ARDOUR {
class RegionView; class RegionView;
class ClockGroup; class ClockGroup;
class RegionEditor : public ArdourWidgets::Frame, public ARDOUR::SessionHandlePtr class RegionEditor : public ArdourDialog
{ {
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 ();
@ -124,7 +122,6 @@ 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*);
@ -189,6 +186,7 @@ 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;
@ -197,3 +195,4 @@ private:
void set_clock_mode_from_primary (); void set_clock_mode_from_primary ();
}; };

View File

@ -1,59 +0,0 @@
/*
* 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

@ -0,0 +1,65 @@
/*
* 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

@ -0,0 +1,49 @@
/*
* 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_window.h" #include "region_editor.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 RegionEditorWindow (trackview.session(), this); editor = new RegionEditor (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 ArdourWindow; class RegionEditor;
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);
void show_region_editor (); virtual 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
ArdourWindow* _editor; RegionEditor* editor;
std::vector<ControlPoint *> control_points; std::vector<ControlPoint *> control_points;
double current_visible_sync_position; double current_visible_sync_position;

View File

@ -17,41 +17,35 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include <cassert>
#include <gtkmm/widget.h>
#include "pbd/compose.h" #include "pbd/compose.h"
#include <algorithm>
#include "ardour/plugin_insert.h" #include "gtkmm2ext/actions.h"
#include "ardour/port_insert.h"
#include "ardour/route.h"
#include "ardour/session.h"
#include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/utils.h" #include "gtkmm2ext/utils.h"
#include "widgets/frame.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 "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();
} }
@ -60,98 +54,15 @@ RoutePropertiesBox::~RoutePropertiesBox ()
} }
void void
RoutePropertiesBox::session_going_away () RoutePropertiesBox::set_route (std::shared_ptr<ARDOUR::Route> rt)
{ {
ENSURE_GUI_THREAD (*this, &RoutePropertiesBox::session_going_away); //TODO: route properties
SessionHandlePtr::session_going_away (); // rt->PropertyChanged.connect (state_connection, invalidator (*this), boost::bind (&RoutePropertiesBox::region_changed, this, _1), gui_context ());
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,7 +1,6 @@
/* /*
* 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
@ -20,21 +19,27 @@
#pragma once #pragma once
#include <vector> #include <map>
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/scrolledwindow.h> #include <gtkmm/label.h>
#include <gtkmm/table.h>
#include "ardour/ardour.h" #include "ardour/ardour.h"
#include "ardour/session_handle.h" #include "ardour/session_handle.h"
namespace ARDOUR { #include "widgets/ardour_button.h"
class Route;
class Processor;
class Session;
}
class GenericPluginUI; #include "gtkmm2ext/cairo_packer.h"
#include "region_editor.h"
#include "audio_clock.h"
namespace ARDOUR
{
class Session;
class Location;
}
class RoutePropertiesBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr class RoutePropertiesBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr
{ {
@ -42,23 +47,16 @@ public:
RoutePropertiesBox (); RoutePropertiesBox ();
~RoutePropertiesBox (); ~RoutePropertiesBox ();
void set_route (std::shared_ptr<ARDOUR::Route>); virtual 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);
Gtk::ScrolledWindow _scroller; PBD::ScopedConnection state_connection;
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,7 +1,6 @@
/* /*
* 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
@ -18,20 +17,38 @@
* 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_region_editor.h" #include "audio_clock.h"
#include "audio_region_view.h" #include "editor_automation_line.h"
#include "control_point.h"
#include "editor.h" #include "editor.h"
#include "region_view.h" #include "region_view.h"
#include "route_properties_box.h"
#include "selection_properties_box.h"
#include "time_info_box.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 "selection_properties_box.h"
#include "pbd/i18n.h" #include "pbd/i18n.h"
@ -41,53 +58,67 @@ using std::min;
using std::max; using std::max;
SelectionPropertiesBox::SelectionPropertiesBox () SelectionPropertiesBox::SelectionPropertiesBox ()
: _region_editor (nullptr)
{ {
init (); _header_label.set_text(_("Selection Properties (ESC = Deselect All)"));
_header_label.set_alignment(0.0, 0.5);
_time_info_box = new TimeInfoBox ("EditorTimeInfo", true); pack_start(_header_label, false, false, 6);
_route_prop_box = new RoutePropertiesBox ();
/* Time Info, for Range selections ToDo: range operations*/
_time_info_box = new TimeInfoBox ("EditorTimeInfo", true);
pack_start(*_time_info_box, false, false, 0); 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 (); /* Region ops (mute/unmute), for multiple-Region selections */
_route_prop_box->set_no_show_all (); _mregions_prop_box = new MultiRegionPropertiesBox ();
_region_editor_box.set_no_show_all (); pack_start(*_mregions_prop_box, false, false, 0);
_time_info_box->hide (); /* MIDI Region props, for Clips */
_route_prop_box->hide (); _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 ();
pack_start(*_route_prop_box, false, false, 0);
_time_info_box->set_no_show_all();
_mregions_prop_box->set_no_show_all();
_audio_prop_box->set_no_show_all();
_midi_ops_box->set_no_show_all();
_audio_ops_box->set_no_show_all();
_slot_prop_box->set_no_show_all();
_route_prop_box->set_no_show_all();
} }
SelectionPropertiesBox::~SelectionPropertiesBox () SelectionPropertiesBox::~SelectionPropertiesBox ()
{ {
delete _time_info_box; delete _time_info_box;
delete _route_prop_box;
delete _region_editor;
}
void delete _mregions_prop_box;
SelectionPropertiesBox::init ()
{
#ifdef LIVETRAX
return;
#endif
Selection& selection (Editor::instance().get_selection());
/* watch for any change in our selection, so we can show an appropriate property editor */ delete _slot_prop_box;
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));
/* maybe we care about mouse mode?? */ delete _midi_ops_box;
Editor::instance().MouseModeChanged.connect (_editor_connection, invalidator(*this), std::bind (&SelectionPropertiesBox::track_mouse_mode, this), gui_context()); delete _audio_ops_box;
delete _midi_prop_box;
delete _audio_prop_box;
delete _route_prop_box; //todo: split into midi/audio
} }
void void
@ -100,8 +131,33 @@ 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();
} }
@ -111,71 +167,103 @@ 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());
if (!selection.time.empty ()) { _time_info_box->hide();
_time_info_box->show ();
} else { _mregions_prop_box->hide();
_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()) {
TimeAxisView *tav = selection.tracks.front ();
RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView *>(tav);
_route_prop_box->set_route (rtav->route());
_route_prop_box->show(); _route_prop_box->show();
} else { TimeAxisView *tav = *(selection.tracks.begin());
_route_prop_box->hide(); RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView *>(tav);
_route_prop_box->set_route(rtav->route());
_header_label.set_text(_("Track Properties (Press ESC to Deselect All)"));
_header_label.hide();
} }
if (selection.regions.size () == 1) { #if SELECTION_PROPERTIES_BOX_TODO
RegionView* rv = (selection.regions.front ()); /* one or more regions, show the multi-region operations box (just MUTE? kinda boring) */
if (!_region_editor || _region_editor->region () != rv->region ()) { if (!selection.regions.empty()) {
delete_region_editor (); _mregions_prop_box->show();
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (rv); }
if (arv) {
_region_editor = new AudioRegionEditor (_session, arv); bool found_midi_regions = false;
} else { for (RegionSelection::iterator s = selection.regions.begin(); s != selection.regions.end(); ++s) {
_region_editor = new RegionEditor (_session, rv); ARDOUR::Region* region = (*s)->region().get();
} if (region->data_type() == DataType::MIDI) {
// TODO subscribe to region name changes found_midi_regions = true;
_region_editor->set_label (string_compose (_("Region '%1'"), rv->region()->name ())); break;
_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,7 +1,6 @@
/* /*
* 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
@ -20,6 +19,8 @@
#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>
@ -27,14 +28,25 @@
#include "ardour/ardour.h" #include "ardour/ardour.h"
#include "ardour/session_handle.h" #include "ardour/session_handle.h"
#include "widgets/eventboxext.h" #include "gtkmm2ext/cairo_packer.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
@ -45,18 +57,29 @@ public:
void set_session (ARDOUR::Session*); void set_session (ARDOUR::Session*);
PBD::ScopedConnectionList editor_connections;
private: private:
void init (); 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 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,8 +50,13 @@
#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"
@ -718,3 +723,69 @@ 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,3 +166,19 @@ 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,10 +30,13 @@
#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,6 +628,14 @@ 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,6 +43,9 @@ 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',
@ -171,6 +174,8 @@ 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',
@ -193,6 +198,7 @@ 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',
@ -250,7 +256,6 @@ 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,9 +62,8 @@ 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, Gdk::DragAction actions = Gdk::ACTION_COPY) DnDVBox (std::list<Gtk::TargetEntry> targets)
: _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)
@ -86,7 +85,7 @@ public:
_internal_vbox.show (); _internal_vbox.show ();
drag_dest_set (_targets, Gtk::DEST_DEFAULT_ALL, _actions); drag_dest_set (_targets);
signal_drag_data_received().connect (mem_fun (*this, &DnDVBox::drag_data_received)); signal_drag_data_received().connect (mem_fun (*this, &DnDVBox::drag_data_received));
} }
@ -101,9 +100,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, Gdk::MODIFIER_MASK, _actions); child->action_widget().drag_source_set (_targets);
} else { } else {
child->action_widget().drag_source_set (targets, Gdk::MODIFIER_MASK, _actions); child->action_widget().drag_source_set (targets);
} }
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));
@ -256,8 +255,6 @@ 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
@ -481,13 +478,6 @@ 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
@ -522,7 +512,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 (ctx->get_suggested_action (), tme); ctx->drag_status (Gdk::ACTION_COPY, tme);
} }
} else { } else {
ctx->drag_status (Gdk::ACTION_LINK, tme); ctx->drag_status (Gdk::ACTION_LINK, tme);
@ -674,7 +664,6 @@ 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,7 +19,6 @@
#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"
@ -61,22 +60,22 @@ public:
}; };
StackAllocator () StackAllocator ()
: _ptr ((pointer)&_buf) : _ptr (_buf.data())
{ } { }
StackAllocator (const StackAllocator&) StackAllocator (const StackAllocator&)
: _ptr ((pointer)&_buf) : StackAllocator ()
{ } { }
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>&)
: _ptr ((pointer)&_buf) : StackAllocator ()
{ } { }
/* 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 ((pointer)&_buf + stack_capacity >= _ptr + n) { if (_buf.data() + 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;
@ -108,12 +107,12 @@ public:
bool operator== (StackAllocator const& a) const bool operator== (StackAllocator const& a) const
{ {
return &_buf == &a._buf; return _buf.data() == a._buf.data();
} }
bool operator!= (StackAllocator const& a) const bool operator!= (StackAllocator const& a) const
{ {
return &_buf != &a._buf; return _buf.data() != a._buf.data();
} }
template <class U> template <class U>
@ -147,12 +146,10 @@ private:
bool pointer_in_buffer (pointer const p) bool pointer_in_buffer (pointer const p)
{ {
return ((pointer const)&_buf <= p && p < (pointer const)&_buf + stack_capacity); return (_buf.data() <= p && p < _buf.data() + stack_capacity);
} }
typedef typename boost::aligned_storage<sizeof (T) * stack_capacity, 16>::type align_t; alignas(16) std::array<value_type, stack_capacity> _buf;
align_t _buf;
pointer _ptr; pointer _ptr;
}; };

View File

@ -550,6 +550,7 @@ 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
@ -734,7 +735,7 @@ int main() { return 0; }''',
# need ISOC9X for llabs() # need ISOC9X for llabs()
compiler_flags.extend( compiler_flags.extend(
('-DBOOST_SYSTEM_NO_DEPRECATED', '-D_ISOC9X_SOURCE', ('-DBOOST_SYSTEM_NO_DEPRECATED', '-DBOOST_BIND_GLOBAL_PLACEHOLDERS', '-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',