PropertyBoxen: initial draft of property-editing widgets that follow the Selection

This commit is contained in:
Ben Loftis 2021-11-29 16:30:34 -06:00
parent 62662f888c
commit 50aa2c490d
19 changed files with 1820 additions and 0 deletions

View File

@ -0,0 +1,103 @@
/*
* 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 "automation_line.h"
#include "control_point.h"
#include "editor.h"
#include "region_view.h"
#include "audio_region_operations_box.h"
#include "pbd/i18n.h"
using namespace Gtk;
using namespace ARDOUR;
using std::min;
using std::max;
AudioRegionOperationsBox::AudioRegionOperationsBox ()
{
_header_label.set_text(_("AUDIO 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);
reverse_button.set_text (_("Reverse"));
reverse_button.set_name ("generic button");
reverse_button.signal_clicked.connect (sigc::mem_fun (*this, &AudioRegionOperationsBox::reverse_button_clicked));
shift_button.set_text (_("Pitch Shift..."));
shift_button.set_name ("generic button");
shift_button.signal_clicked.connect (sigc::mem_fun (*this, &AudioRegionOperationsBox::shift_button_clicked));
normalize_button.set_text (_("Normalize..."));
normalize_button.set_name ("generic button");
normalize_button.signal_clicked.connect (sigc::mem_fun (*this, &AudioRegionOperationsBox::normalize_button_clicked));
int row = 0;
table.attach(reverse_button, 0, 1, row, row+1, Gtk::FILL, Gtk::FILL|Gtk::EXPAND ); row++;
table.attach(shift_button, 0, 1, row, row+1, Gtk::FILL, Gtk::FILL|Gtk::EXPAND ); row++;
table.attach(normalize_button, 0, 1, row, row+1, Gtk::FILL, Gtk::FILL|Gtk::EXPAND ); row++;
}
AudioRegionOperationsBox::~AudioRegionOperationsBox ()
{
}
void
AudioRegionOperationsBox::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
}
void
AudioRegionOperationsBox::reverse_button_clicked ()
{
Editor::instance().reverse_region();
}
void
AudioRegionOperationsBox::shift_button_clicked ()
{
Editor::instance().pitch_shift_region();
}
void
AudioRegionOperationsBox::normalize_button_clicked ()
{
Editor::instance().normalize_region();
}

View File

@ -0,0 +1,70 @@
/*
* 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.
*/
#ifndef __audio_region_operations_box_h__
#define __audio_region_operations_box_h__
#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 AudioRegionOperationsBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr
{
public:
AudioRegionOperationsBox ();
~AudioRegionOperationsBox ();
void set_session (ARDOUR::Session*);
PBD::ScopedConnectionList editor_connections;
PBD::ScopedConnectionList region_property_connections;
private:
Gtk::Table table;
Gtk::Label _header_label;
Gtk::Label mute_regions_label;
ArdourWidgets::ArdourButton reverse_button;
ArdourWidgets::ArdourButton shift_button;
ArdourWidgets::ArdourButton normalize_button;
void selection_changed ();
void reverse_button_clicked();
void shift_button_clicked();
void normalize_button_clicked();
};
#endif /* __audio_region_operations_box_h__ */

View File

@ -0,0 +1,72 @@
/*
* 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 "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 std::min;
using std::max;
AudioRegionPropertiesBox::AudioRegionPropertiesBox ()
{
pack_start (table, false, false);
table.set_homogeneous (true);
table.set_spacings (0);
table.set_border_width (2);
table.set_col_spacings (2);
}
AudioRegionPropertiesBox::~AudioRegionPropertiesBox ()
{
}
void
AudioRegionPropertiesBox::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
}
void
AudioRegionPropertiesBox::set_region (boost::shared_ptr<Region>)
{
}

View File

@ -0,0 +1,53 @@
/*
* 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.
*/
#ifndef __audio_region_properties_box_h__
#define __audio_region_properties_box_h__
#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 AudioRegionPropertiesBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr
{
public:
AudioRegionPropertiesBox ();
~AudioRegionPropertiesBox ();
void set_session (ARDOUR::Session*);
void set_region (boost::shared_ptr<ARDOUR::Region>);
private:
Gtk::Table table;
};
#endif /* __audio_region_properties_box_h__ */

View File

@ -0,0 +1,103 @@
/*
* 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 "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::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
}
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,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.
*/
#ifndef __midi_region_operations_box_h__
#define __midi_region_operations_box_h__
#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 MidiRegionOperationsBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr
{
public:
MidiRegionOperationsBox ();
~MidiRegionOperationsBox ();
void set_session (ARDOUR::Session*);
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();
};
#endif /* __midi_region_operations_box_h__ */

View File

@ -0,0 +1,208 @@
/*
* 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 "widgets/ardour_button.h"
#include "audio_clock.h"
#include "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::min;
using std::max;
MidiRegionPropertiesBox::MidiRegionPropertiesBox () : SessionHandlePtr()
, length_clock (X_("regionlength"), true, "", true, false, true)
, start_clock (X_("regionstart"), true, "", false, false)
, loop_length_clock (X_("regionlength"), true, "", true, false, true)
, loop_start_clock (X_("regionstart"), true, "", false, false)
, bbt_toggle (ArdourButton::led_default_elements)
, loop_toggle (ArdourButton::led_default_elements)
, patch_enable_button (ArdourButton::led_default_elements)
, cc_enable_button (ArdourButton::led_default_elements)
{
Gtk::Label *label;
int row = 0;
_header_label.set_text(_("MIDI Region Properties:"));
_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(_("BBT Sync"));
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++;
loop_toggle.set_text(_("Loop"));
table.attach(loop_toggle, 0, 1, row, row+1, Gtk::SHRINK, Gtk::SHRINK ); row++;
label = manage(new Gtk::Label(_("Loop Start:"))); label->set_alignment(1.0, 0.5);
table.attach(*label, 0, 1, row, row+1, Gtk::SHRINK, Gtk::SHRINK );
table.attach(loop_start_clock, 1, 2, row, row+1, Gtk::SHRINK, Gtk::SHRINK ); row++;
// label = manage(new Gtk::Label(_("Loop Length:"))); label->set_alignment(1.0, 0.5);
// table.attach(*label, 0, 1, row, row+1, Gtk::SHRINK, Gtk::SHRINK );
// table.attach(loop_length_clock, 1, 2, row, row+1, Gtk::SHRINK, Gtk::SHRINK ); row++;
patch_enable_button.set_text (_("Send Patches"));
patch_enable_button.set_name ("generic button");
// patch_enable_button.signal_clicked.connect (sigc::mem_fun (*this, &MidiRegionPropertiesBox::patch_enable_button_clicked));
patch_selector_button.set_text (_("Patches..."));
patch_selector_button.set_name ("generic button");
// patch_selector_button.signal_clicked.connect (sigc::mem_fun (*this, &MidiRegionPropertiesBox::patch_enable_button_clicked));
table.attach(patch_enable_button, 0, 1, row, row+1, Gtk::SHRINK, Gtk::SHRINK );
table.attach(patch_selector_button, 1, 2, row, row+1, Gtk::SHRINK, Gtk::SHRINK ); row++;
cc_enable_button.set_text (_("Send CCs"));
cc_enable_button.set_name ("generic button");
// cc_enable_button.signal_clicked.connect (sigc::mem_fun (*this, &MidiRegionPropertiesBox::patch_enable_button_clicked));
cc_selector_button.set_text (_("CCs..."));
cc_selector_button.set_name ("generic button");
// cc_selector_button.signal_clicked.connect (sigc::mem_fun (*this, &MidiRegionPropertiesBox::patch_enable_button_clicked));
table.attach(cc_enable_button, 0, 1, row, row+1, Gtk::SHRINK, Gtk::SHRINK );
table.attach(cc_selector_button, 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);
Gtk::Table *chans = manage(new Gtk::Table());
chans->set_homogeneous (true);
chans->set_spacings (4);
for (int c = 0; c<16; c++) {
Gtk::Label *ch_label = manage(new Gtk::Label());
ch_label->set_name("MetricLabel");
ch_label->set_text(string_compose("%1", c+1));
chans->attach(*ch_label, c%4, (c%4)+1, c/4, (c/4)+1, Gtk::SHRINK, Gtk::SHRINK );
}
// table.attach(*chans, 2, 3, 0, row, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
}
MidiRegionPropertiesBox::~MidiRegionPropertiesBox ()
{
}
void
MidiRegionPropertiesBox::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
length_clock.set_session (s);
start_clock.set_session (s);
loop_length_clock.set_session (s);
loop_start_clock.set_session (s);
}
void
MidiRegionPropertiesBox::set_region (boost::shared_ptr<Region> r)
{
printf(" slot, region name %s\n", r->name().c_str());
set_session(&r->session());
state_connection.disconnect();
_region = r;
PBD::PropertyChange interesting_stuff;
region_changed(interesting_stuff);
_region->PropertyChanged.connect (state_connection, invalidator (*this), boost::bind (&MidiRegionPropertiesBox::region_changed, this, _1), gui_context());
}
void
MidiRegionPropertiesBox::region_changed (const PBD::PropertyChange& what_changed)
{
//ToDo: refactor the region_editor.cc to cover this basic stuff
// if (what_changed.contains (ARDOUR::Properties::name)) {
// name_changed ();
// }
// PBD::PropertyChange interesting_stuff;
// interesting_stuff.add (ARDOUR::Properties::length);
// interesting_stuff.add (ARDOUR::Properties::start);
// if (what_changed.contains (interesting_stuff))
printf(" slot, region name %s\n", _region->name().c_str());
{
AudioClock::Mode mode = _region->position_time_domain() == Temporal::AudioTime ? AudioClock::Samples : AudioClock::BBT;
start_clock.set_mode (mode);
length_clock.set_mode (mode);
printf(" slot, region start %s\n", _region->start().str().c_str());
start_clock.set (_region->start());
length_clock.set_duration (_region->length());
bpm_button.set_text("122.2");
metrum_button.set_text("4/4");
}
}

View File

@ -0,0 +1,79 @@
/*
* 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.
*/
#ifndef __midi_region_properties_box_h__
#define __midi_region_properties_box_h__
#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_clock.h"
namespace ARDOUR {
class Session;
class Location;
}
class MidiRegionPropertiesBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr
{
public:
MidiRegionPropertiesBox ();
~MidiRegionPropertiesBox ();
void set_session (ARDOUR::Session*);
void set_region (boost::shared_ptr<ARDOUR::Region>);
void region_changed (const PBD::PropertyChange& what_changed);
private:
Gtk::Label _header_label;
Gtk::Table table;
AudioClock length_clock;
AudioClock start_clock;
AudioClock loop_length_clock;
AudioClock loop_start_clock;
ArdourWidgets::ArdourButton bpm_button;
ArdourWidgets::ArdourButton metrum_button;
ArdourWidgets::ArdourButton bbt_toggle;
ArdourWidgets::ArdourButton loop_toggle;
ArdourWidgets::ArdourButton patch_enable_button;
ArdourWidgets::ArdourButton patch_selector_button;
ArdourWidgets::ArdourButton cc_enable_button;
ArdourWidgets::ArdourButton cc_selector_button;
PBD::ScopedConnection state_connection;
boost::shared_ptr<ARDOUR::Region> _region;
};
#endif /* __midi_region_properties_box_h__ */

View File

@ -0,0 +1,210 @@
/*
* 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 "canvas/canvas.h"
#include "canvas/debug.h"
#include "canvas/utils.h"
#include "ardour/location.h"
#include "ardour/profile.h"
#include "ardour/session.h"
#include "widgets/ardour_button.h"
#include "audio_clock.h"
#include "automation_line.h"
#include "control_point.h"
#include "editor.h"
#include "region_view.h"
#include "ui_config.h"
#include "midi_region_trimmer_box.h"
#include "pbd/i18n.h"
using namespace Gtk;
using namespace ARDOUR;
using namespace ArdourWidgets;
using std::min;
using std::max;
/* ------------ */
MidiTrimmer::MidiTrimmer (ArdourCanvas::Item* parent)
: Rectangle (parent)
{
// set_homogenous (true);
// set_row_spacing (4);
set_fill_color (UIConfiguration::instance().color (X_("theme:darkest")));
set_fill (true);
const double scale = UIConfiguration::instance().get_ui_scale();
const double width = 600. * scale;
const double height = 210. * scale;
// name = string_compose ("trigger %1", _trigger.index());
Event.connect (sigc::mem_fun (*this, &MidiTrimmer::event_handler));
ArdourCanvas::Rect r (0, 0, width, height);
set (r);
set_outline_all ();
// selection_connection = PublicEditor::instance().get_selection().TriggersChanged.connect (sigc::mem_fun (*this, &TriggerBoxUI::selection_changed));
}
MidiTrimmer::~MidiTrimmer ()
{
}
void
MidiTrimmer::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context> cr) const
{
// ArdourCanvas::Rect self (item_to_window (_rect, NO_ROUND));
// boost::optional<ArdourCanvas::Rect> i = self.intersection (area);
// if (!i) {
// return;
// }
cr->set_identity_matrix();
cr->translate (area.x0, area.y0-0.5); //should be self
float height = area.height(); //should be self
float width = area.width();
//black border...this should be in draw_bg
Gtkmm2ext::set_source_rgba (cr, Gtkmm2ext::rgba_to_color (0,0,0,1));
cr->set_line_width(1);
cr->rectangle(0, 0, width, height);
cr->fill ();
}
bool
MidiTrimmer::event_handler (GdkEvent* ev)
{
switch (ev->type) {
case GDK_BUTTON_PRESS:
// PublicEditor::instance().get_selection().set (this);
break;
case GDK_ENTER_NOTIFY:
// redraw ();
break;
case GDK_LEAVE_NOTIFY:
// redraw ();
break;
default:
break;
}
return false;
}
/* ------------ */
TrimmerBoxWidget::TrimmerBoxWidget ()
{
trimmer = new MidiTrimmer (root());
set_background_color (UIConfiguration::instance().color (X_("theme:bg")));
}
void
TrimmerBoxWidget::size_request (double& w, double& h) const
{
trimmer->size_request (w, h);
w=600;
h=210;
}
void
TrimmerBoxWidget::on_map ()
{
GtkCanvas::on_map ();
}
void
TrimmerBoxWidget::on_unmap ()
{
GtkCanvas::on_unmap ();
}
/* ====================================================== */
MidiRegionTrimmerBox::MidiRegionTrimmerBox () : SessionHandlePtr()
{
_header_label.set_text(_("MIDI Region Trimmer:"));
_header_label.set_alignment(0.0, 0.5);
pack_start(_header_label, false, false, 6);
trimmer_widget = manage (new TrimmerBoxWidget());
trimmer_widget->set_size_request(600,120);
pack_start(*trimmer_widget, true, true);
trimmer_widget->show();
}
MidiRegionTrimmerBox::~MidiRegionTrimmerBox ()
{
}
void
MidiRegionTrimmerBox::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
}
void
MidiRegionTrimmerBox::set_region (boost::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), boost::bind (&MidiRegionTrimmerBox::region_changed, this, _1), gui_context());
}
void
MidiRegionTrimmerBox::region_changed (const PBD::PropertyChange& what_changed)
{
//ToDo: refactor the region_editor.cc to cover this basic stuff
// if (what_changed.contains (ARDOUR::Properties::name)) {
// name_changed ();
// }
// PBD::PropertyChange interesting_stuff;
// interesting_stuff.add (ARDOUR::Properties::length);
// interesting_stuff.add (ARDOUR::Properties::start);
// if (what_changed.contains (interesting_stuff))
{
}
}

View File

@ -0,0 +1,97 @@
/*
* 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.
*/
#ifndef __midi_region_trimmer_box_h__
#define __midi_region_trimmer_box_h__
#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 "canvas/table.h"
#include "canvas/canvas.h"
#include "canvas/rectangle.h"
#include "audio_clock.h"
namespace ARDOUR {
class Session;
class Location;
}
namespace ArdourCanvas {
class Text;
class Polygon;
};
class MidiTrimmer : public ArdourCanvas::Rectangle
{
public:
MidiTrimmer (ArdourCanvas::Item* parent);
~MidiTrimmer ();
void render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
// void _size_allocate (ArdourCanvas::Rect const &);
bool event_handler (GdkEvent*);
};
class TrimmerBoxWidget : public ArdourCanvas::GtkCanvas
{
public:
TrimmerBoxWidget ();
void size_request (double& w, double& h) const;
void on_map ();
void on_unmap ();
private:
MidiTrimmer* trimmer;
};
class MidiRegionTrimmerBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr
{
public:
MidiRegionTrimmerBox ();
~MidiRegionTrimmerBox ();
void set_session (ARDOUR::Session*);
void set_region (boost::shared_ptr<ARDOUR::Region>);
void region_changed (const PBD::PropertyChange& what_changed);
private:
Gtk::Label _header_label;
Gtk::Table table;
TrimmerBoxWidget *trimmer_widget;
PBD::ScopedConnection state_connection;
boost::shared_ptr<ARDOUR::Region> _region;
};
#endif /* __midi_region_trimmer_box_h__ */

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 "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,68 @@
/*
* 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.
*/
#ifndef __multi_region_properties_box_h__
#define __multi_region_properties_box_h__
#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();
};
#endif /* __multi_region_properties_box_h__ */

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 "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,51 @@
/*
* 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.
*/
#ifndef __midi_region_properties_box_h__
#define __midi_region_properties_box_h__
#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;
};
#endif /* __midi_region_properties_box_h__ */

View File

@ -0,0 +1,235 @@
/*
* 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 "automation_line.h"
#include "control_point.h"
#include "editor.h"
#include "region_view.h"
#include "time_info_box.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 "selection_properties_box.h"
#include "pbd/i18n.h"
using namespace Gtk;
using namespace ARDOUR;
using std::min;
using std::max;
SelectionPropertiesBox::SelectionPropertiesBox ()
{
_header_label.set_text(_("Selection Properties (ESC = Deselect All)"));
_header_label.set_alignment(0.0, 0.5);
pack_start(_header_label, false, false, 6);
/* Time Info, for Range selections ToDo: range operations*/
_time_info_box = new TimeInfoBox ("EditorTimeInfo", true);
pack_start(*_time_info_box, false, false, 0);
/* 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);
/* 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), boost::bind (&SelectionPropertiesBox::track_mouse_mode, this), gui_context());
selection_changed();
}
SelectionPropertiesBox::~SelectionPropertiesBox ()
{
delete _time_info_box;
delete _mregions_prop_box;
delete _slot_prop_box;
delete _midi_ops_box;
delete _audio_ops_box;
delete _midi_prop_box;
delete _audio_prop_box;
}
void
SelectionPropertiesBox::set_session (Session* s)
{
SessionHandlePtr::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);
}
void
SelectionPropertiesBox::track_mouse_mode ()
{
/* maybe do something here? */
}
void
SelectionPropertiesBox::selection_changed ()
{
Selection& selection (Editor::instance().get_selection());
_time_info_box->hide();
_mregions_prop_box->hide();
_midi_ops_box->hide();
_audio_ops_box->hide();
_midi_prop_box->hide();
_audio_prop_box->hide();
_slot_prop_box->hide();
if (selection.empty()) {
_header_label.set_text(_("Nothing Selected"));
} else {
_header_label.set_text(_("Selection Properties (ESC = Deselect All)"));
}
if (!selection.time.empty()) {
_time_info_box->show();
}
/* one or more regions, show the multi-region operations box (just MUTE? kinda boring) */
if (!selection.regions.empty()) {
_mregions_prop_box->show();
}
bool found_midi_regions = false;
for (RegionSelection::iterator s = selection.regions.begin(); s != selection.regions.end(); ++s) {
ARDOUR::Region* region = (*s)->region().get();
if (region->data_type() == DataType::MIDI) {
found_midi_regions = true;
break;
}
}
bool found_audio_regions = false;
for (RegionSelection::iterator s = selection.regions.begin(); s != selection.regions.end(); ++s) {
ARDOUR::Region* region = (*s)->region().get();
if (region->data_type() == DataType::AUDIO) {
found_audio_regions = true;
break;
}
}
if (found_midi_regions && ! found_audio_regions) {
_midi_ops_box->show();
}
if (found_audio_regions && ! found_midi_regions) {
_audio_ops_box->show();
}
boost::shared_ptr<ARDOUR::Region> selected_region = boost::shared_ptr<ARDOUR::Region>();
if (!selection.triggers.empty()) {
TriggerSelection ts = selection.triggers;
TriggerEntry* entry = *ts.begin();
Trigger* slot = &entry->trigger();
//slot properties incl "Follow Actions"
_slot_prop_box->set_slot(slot);
_slot_prop_box->show();
selected_region = slot->region();
} else if (selection.regions.size()==1) {
selected_region = (*(selection.regions.begin()))->region();
}
if (selected_region) {
//region properties
if (selected_region->data_type() == DataType::MIDI) {
_midi_prop_box->set_region(selected_region);
_midi_prop_box->show();
_midi_ops_box->show();
} else {
_audio_prop_box->set_region(selected_region);
_audio_prop_box->show();
_audio_ops_box->show();
}
}
}

View File

@ -0,0 +1,83 @@
/*
* 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.
*/
#ifndef __selection_properties_box_h__
#define __selection_properties_box_h__
#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 TimeInfoBox;
class MultiRegionPropertiesBox;
class SlotPropertiesBox;
class AudioRegionPropertiesBox;
class MidiRegionPropertiesBox;
class AudioRegionOperationsBox;
class MidiRegionOperationsBox;
class SelectionPropertiesBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr
{
public:
SelectionPropertiesBox ();
~SelectionPropertiesBox ();
void set_session (ARDOUR::Session*);
PBD::ScopedConnectionList editor_connections;
private:
Gtk::Table table;
Gtk::Label _header_label;
TimeInfoBox* _time_info_box;
MultiRegionPropertiesBox* _mregions_prop_box;
AudioRegionPropertiesBox* _audio_prop_box;
MidiRegionPropertiesBox* _midi_prop_box;
AudioRegionOperationsBox* _audio_ops_box;
MidiRegionOperationsBox* _midi_ops_box;
SlotPropertiesBox* _slot_prop_box;
void selection_changed ();
void track_mouse_mode ();
};
#endif /* __selection_properties_box_h__ */

View File

@ -0,0 +1,80 @@
/*
* 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 "automation_line.h"
#include "control_point.h"
#include "editor.h"
#include "region_view.h"
#include "trigger_ui.h"
#include "slot_properties_box.h"
#include "pbd/i18n.h"
using namespace Gtk;
using namespace ARDOUR;
using std::min;
using std::max;
SlotPropertiesBox::SlotPropertiesBox ()
{
_header_label.set_text(_("Slot Properties:"));
_header_label.set_alignment(0.0, 0.5);
pack_start(_header_label, false, false, 6);
_triggerwidget = manage (new TriggerWidget ());
_triggerwidget->show();
// double w;
// double h;
// _triggerwidget->size_request (w, h);
// _triggerwidget->set_size_request (w, h);
pack_start (*_triggerwidget, true, true);
}
SlotPropertiesBox::~SlotPropertiesBox ()
{
}
void
SlotPropertiesBox::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
}
void
SlotPropertiesBox::set_slot (Trigger* t)
{
_triggerwidget->set_trigger (t);
}

View File

@ -0,0 +1,61 @@
/*
* 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.
*/
#ifndef __slot_properties_box_h__
#define __slot_properties_box_h__
#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 TriggerWidget;
class SlotPropertiesBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr
{
public:
SlotPropertiesBox ();
~SlotPropertiesBox ();
void set_session (ARDOUR::Session*);
void set_slot (ARDOUR::Trigger*);
private:
Gtk::Table table;
Gtk::Label _header_label;
TriggerWidget* _triggerwidget;
};
#endif /* __multi_region_properties_box_h__ */

View File

@ -53,6 +53,8 @@ gtk2_ardour_sources = [
'audio_clock.cc',
'audio_region_editor.cc',
'audio_region_view.cc',
'audio_region_operations_box.cc',
'audio_region_properties_box.cc',
'audio_streamview.cc',
'audio_time_axis.cc',
'automation_controller.cc',
@ -164,6 +166,9 @@ gtk2_ardour_sources = [
'midi_export_dialog.cc',
'midi_list_editor.cc',
'midi_region_view.cc',
'midi_region_operations_box.cc',
'midi_region_properties_box.cc',
'midi_region_trimmer_box.cc',
'midi_scroomer.cc',
'midi_selection.cc',
'midi_streamview.cc',
@ -185,6 +190,7 @@ gtk2_ardour_sources = [
'mono_panner.cc',
'mono_panner_editor.cc',
'mouse_cursors.cc',
'multi_region_properties_box.cc',
'nag.cc',
'new_plugin_preset_dialog.cc',
'new_user_wizard.cc',
@ -260,6 +266,7 @@ gtk2_ardour_sources = [
'screensaver.cc',
'script_selector.cc',
'selection.cc',
'selection_properties_box.cc',
'selection_memento.cc',
'send_ui.cc',
'session_archive_dialog.cc',
@ -269,6 +276,7 @@ gtk2_ardour_sources = [
'session_option_editor.cc',
'sfdb_ui.cc',
'shuttle_control.cc',
'slot_properties_box.cc',
'soundcloud_export_selector.cc',
'splash.cc',
'speaker_dialog.cc',