Compare commits

...

14 Commits

Author SHA1 Message Date
Ben Loftis 50430f134d New region-property placeholders should not be Properties (mostly reverts 045cf7)
Properties are created for announcing changes, but values are not actually stored as undo-able properties.
2021-12-06 18:13:17 -06:00
Ben Loftis 3186a85b0c PropertyBoxen: add some proposed audio-region property controls. (can be squashed) 2021-12-02 11:26:17 -06:00
Ben Loftis 7635e5e6a2 Property Boxen: handle more {audio|midi} cases; move code around. (can be squashed) 2021-12-02 10:50:19 -06:00
Ben Loftis ab44ede65d Property Boxen: populate the Trigger page with property-editor placeholders 2021-12-01 23:52:03 -06:00
Ben Loftis 99ce14558b PropertyBoxen: provide all slot property editors in a popup dialog (?) 2021-12-01 23:51:18 -06:00
Ben Loftis 2b0eb2ac5d squash to de-canvas 2021-12-01 23:50:16 -06:00
Ben Loftis 045cf7709f Add New Region Properties for Clips 2021-12-01 23:08:51 -06:00
Ben Loftis c07a7736b7 PropertyBoxen: move selection-properties into the sidebar 2021-12-01 23:08:51 -06:00
Ben Loftis aff4715eb2 PropertyBoxen: initial draft of property-editing widgets that follow the Selection 2021-12-01 23:08:51 -06:00
Ben Loftis f315778d10 PropertyBoxen: Publish some region operations to PublicEditor so we can access them more easily 2021-12-01 23:08:51 -06:00
Ben Loftis f5a9c7118c Trigger_UI: De-Canvas the trigger_ui widget so it can be reused in other places 2021-12-01 22:35:25 -06:00
Ben Loftis 87b052085e Trigger_UI: change API to use set_trigger() instead of constructor arg 2021-12-01 22:35:25 -06:00
Ben Loftis 0e60872950 Selection: Region Operations in a Slot need a RegionView proxy (ToDo) 2021-12-01 22:35:25 -06:00
Ben Loftis 210fa7a97a Selection: make trigger slots more exclusive wrt some other selectables 2021-12-01 22:35:25 -06:00
33 changed files with 2598 additions and 190 deletions

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 "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::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,75 @@
/*
* 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 RegionOperationsBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr
{
public:
RegionOperationsBox () {}
~RegionOperationsBox () {}
};
class AudioRegionOperationsBox : public RegionOperationsBox
{
public:
AudioRegionOperationsBox ();
~AudioRegionOperationsBox ();
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,226 @@
/*
* 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 namespace ArdourWidgets;
using std::min;
using std::max;
RegionPropertiesBox::RegionPropertiesBox() :
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)
{
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(_("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++;
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);
length_clock.set_session (s);
start_clock.set_session (s);
loop_length_clock.set_session (s);
loop_start_clock.set_session (s);
}
void
RegionPropertiesBox::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 (&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
// 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");
}
}
/* ================== */
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(_("Stretch Mode:"))); label->set_alignment(1.0, 0.5);
audio_t->attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
stretch_selector.set_text ("Mixed");
stretch_selector.set_name ("generic button");
// stretch_selector.signal_clicked.connect (sigc::mem_fun (*this, &MidiRegionPropertiesBox::patch_enable_button_clicked));
audio_t->attach(stretch_selector, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK );
row++;
label = manage(new Gtk::Label(_("Fades:"))); label->set_alignment(1.0, 0.5);
fade_in_enable_button.set_text (_("In"));
fade_in_enable_button.set_name ("generic button");
// fade_in_enable_button.signal_clicked.connect (sigc::mem_fun (*this, &MidiRegionPropertiesBox::patch_enable_button_clicked));
fade_out_enable_button.set_text (_("Out"));
fade_out_enable_button.set_name ("generic button");
// fade_out_enable_button.signal_clicked.connect (sigc::mem_fun (*this, &MidiRegionPropertiesBox::patch_enable_button_clicked));
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");
// gain_control.signal_clicked.connect (sigc::mem_fun (*this, &MidiRegionPropertiesBox::patch_enable_button_clicked));
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 (boost::shared_ptr<Region> r)
{
RegionPropertiesBox::set_region (r);
}

View File

@ -0,0 +1,93 @@
/*
* 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 "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 (boost::shared_ptr<ARDOUR::Region>);
void set_session (ARDOUR::Session* s);
protected:
boost::shared_ptr<ARDOUR::Region> _region;
Gtk::Label _header_label;
private:
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;
void region_changed (const PBD::PropertyChange& what_changed);
PBD::ScopedConnection state_connection;
};
class AudioRegionPropertiesBox : public RegionPropertiesBox
{
public:
AudioRegionPropertiesBox ();
~AudioRegionPropertiesBox ();
virtual void set_region (boost::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;
};
#endif /* __audio_region_properties_box_h__ */

View File

@ -0,0 +1,204 @@
/*
* 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 "audio_region_trimmer_box.h"
#include "pbd/i18n.h"
using namespace Gtk;
using namespace ARDOUR;
using namespace ArdourWidgets;
using std::min;
using std::max;
/* ------------ */
AudioTrimmerCanvas::AudioTrimmerCanvas (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, &AudioTrimmerCanvas::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));
}
AudioTrimmerCanvas::~AudioTrimmerCanvas ()
{
}
void
AudioTrimmerCanvas::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
AudioTrimmerCanvas::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;
}
/* ------------ */
AudioTrimmerBoxWidget::AudioTrimmerBoxWidget ()
{
trimmer = new AudioTrimmerCanvas (root());
set_background_color (UIConfiguration::instance().color (X_("theme:bg")));
}
void
AudioTrimmerBoxWidget::size_request (double& w, double& h) const
{
trimmer->size_request (w, h);
w=600;
h=210;
}
void
AudioTrimmerBoxWidget::on_map ()
{
GtkCanvas::on_map ();
}
void
AudioTrimmerBoxWidget::on_unmap ()
{
GtkCanvas::on_unmap ();
}
/* ====================================================== */
AudioRegionTrimmerBox::AudioRegionTrimmerBox ()
{
_header_label.set_text(_("AUDIO Region Trimmer:"));
_header_label.set_alignment(0.0, 0.5);
pack_start(_header_label, false, false, 6);
trimmer_widget = manage (new AudioTrimmerBoxWidget());
trimmer_widget->set_size_request(600,120);
pack_start(*trimmer_widget, true, true);
trimmer_widget->show();
}
AudioRegionTrimmerBox::~AudioRegionTrimmerBox ()
{
}
void
AudioRegionTrimmerBox::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 (&AudioRegionTrimmerBox::region_changed, this, _1), gui_context());
}
void
AudioRegionTrimmerBox::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,105 @@
/*
* 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_trimmer_box_h__
#define __audio_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 RegionTrimmerBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr
{
public:
RegionTrimmerBox () {}
~RegionTrimmerBox () {}
virtual void set_region (boost::shared_ptr<ARDOUR::Region>) =0;
};
class AudioTrimmerCanvas : public ArdourCanvas::Rectangle
{
public:
AudioTrimmerCanvas (ArdourCanvas::Item* parent);
~AudioTrimmerCanvas ();
void render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
// void _size_allocate (ArdourCanvas::Rect const &);
bool event_handler (GdkEvent*);
};
class AudioTrimmerBoxWidget : public ArdourCanvas::GtkCanvas
{
public:
AudioTrimmerBoxWidget ();
void size_request (double& w, double& h) const;
void on_map ();
void on_unmap ();
private:
AudioTrimmerCanvas* trimmer;
};
class AudioRegionTrimmerBox : public RegionTrimmerBox
{
public:
AudioRegionTrimmerBox ();
~AudioRegionTrimmerBox ();
void set_region (boost::shared_ptr<ARDOUR::Region>);
void region_changed (const PBD::PropertyChange& what_changed);
private:
Gtk::Label _header_label;
Gtk::Table table;
AudioTrimmerBoxWidget *trimmer_widget;
PBD::ScopedConnection state_connection;
boost::shared_ptr<ARDOUR::Region> _region;
};
#endif /* __audio_region_trimmer_box_h__ */

View File

@ -147,11 +147,11 @@
#include "rhythm_ferret.h"
#include "route_sorter.h"
#include "selection.h"
#include "selection_properties_box.h"
#include "simple_progress_dialog.h"
#include "sfdb_ui.h"
#include "grid_lines.h"
#include "time_axis_view.h"
#include "time_info_box.h"
#include "timers.h"
#include "ui_config.h"
#include "utils.h"
@ -254,7 +254,7 @@ Editor::Editor ()
: PublicEditor (global_hpacker)
, editor_mixer_strip_width (Wide)
, constructed (false)
, _time_info_box (0)
, _properties_box (0)
, no_save_visual (false)
, _leftmost_sample (0)
, samples_per_pixel (2048)
@ -660,7 +660,7 @@ Editor::Editor ()
_sources = new EditorSources (this);
_snapshots = new EditorSnapshots (this);
_locations = new EditorLocations (this);
_time_info_box = new TimeInfoBox ("EditorTimeInfo", true);
_properties_box = new SelectionPropertiesBox ();
/* these are static location signals */
@ -668,6 +668,7 @@ Editor::Editor ()
Location::end_changed.connect (*this, invalidator (*this), boost::bind (&Editor::location_changed, this, _1), gui_context());
Location::changed.connect (*this, invalidator (*this), boost::bind (&Editor::location_changed, this, _1), gui_context());
add_notebook_page (_("Selection"), *_properties_box);
add_notebook_page (_("Tracks & Busses"), _routes->widget ());
add_notebook_page (_("Sources"), _sources->widget ());
add_notebook_page (_("Regions"), _regions->widget ());
@ -724,8 +725,8 @@ Editor::Editor ()
editor_summary_pane.add (_summary_hbox);
edit_pane.set_check_divider_position (true);
edit_pane.add (editor_summary_pane);
_editor_list_vbox.pack_start (*_time_info_box, false, false, 0);
_editor_list_vbox.pack_start (_the_notebook);
// _editor_list_vbox.pack_start (*_properties_box, false, false, 0);
edit_pane.add (_editor_list_vbox);
edit_pane.set_child_minsize (_editor_list_vbox, 30); /* rough guess at width of notebook tabs */
@ -892,7 +893,7 @@ Editor::~Editor()
delete _regions;
delete _snapshots;
delete _locations;
delete _time_info_box;
delete _properties_box;
delete selection;
delete cut_buffer;
delete _cursors;
@ -1324,7 +1325,7 @@ Editor::set_session (Session *t)
_snapshots->set_session (_session);
_routes->set_session (_session);
_locations->set_session (_session);
_time_info_box->set_session (_session);
_properties_box->set_session (_session);
if (rhythm_ferret) {
rhythm_ferret->set_session (_session);
@ -5309,9 +5310,8 @@ Editor::get_regions_from_selection_and_mouse (timepos_t const & pos)
return regions;
}
/** Start with regions that are selected, or the entered regionview if none are selected.
* Then add equivalent regions on tracks in the same active edit-enabled route group as any
* of the regions that we started with.
/** Start with the selected Region(s) or TriggerSlot
* if neither is found, try using the entered_regionview (region under the mouse).
*/
RegionSelection
@ -5319,6 +5319,10 @@ Editor::get_regions_from_selection_and_entered () const
{
RegionSelection regions = selection->regions;
if (regions.empty() && !selection->triggers.empty()) {
regions = selection->trigger_regionview_proxy();
}
if (regions.empty() && entered_regionview) {
regions.add (entered_regionview);
}

View File

@ -142,6 +142,7 @@ class RegionPeakCursor;
class RhythmFerret;
class RulerDialog;
class Selection;
class SelectionPropertiesBox;
class SoundFileOmega;
class StreamView;
class GridLines;
@ -637,7 +638,7 @@ private:
// to keep track of the playhead position for control_scroll
boost::optional<samplepos_t> _control_scroll_target;
TimeInfoBox* _time_info_box;
SelectionPropertiesBox* _properties_box;
typedef std::pair<TimeAxisView*,XMLNode*> TAVState;

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 "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,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"
#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();
};
#endif /* __midi_region_operations_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 "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 () :
patch_enable_button (ArdourButton::led_default_elements)
, cc_enable_button (ArdourButton::led_default_elements)
{
_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_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));
midi_t->attach(patch_enable_button, 0, 1, row, row+1, Gtk::SHRINK, Gtk::SHRINK );
midi_t->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));
midi_t->attach(cc_enable_button, 0, 1, row, row+1, Gtk::SHRINK, Gtk::SHRINK );
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 (boost::shared_ptr<Region> r)
{
RegionPropertiesBox::set_region (r);
_region->PropertyChanged.connect (midi_state_connection, invalidator (*this), boost::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,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 __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_region_properties_box.h"
namespace ARDOUR {
class Session;
class Location;
}
class MidiRegionPropertiesBox : public RegionPropertiesBox
{
public:
MidiRegionPropertiesBox ();
~MidiRegionPropertiesBox ();
void set_region (boost::shared_ptr<ARDOUR::Region>);
private:
PBD::ScopedConnection midi_state_connection;
void region_changed (const PBD::PropertyChange& what_changed);
ArdourWidgets::ArdourButton patch_enable_button;
ArdourWidgets::ArdourButton patch_selector_button;
ArdourWidgets::ArdourButton cc_enable_button;
ArdourWidgets::ArdourButton cc_selector_button;
};
#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;
/* ------------ */
MidiTrimmerCanvas::MidiTrimmerCanvas (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, &MidiTrimmerCanvas::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));
}
MidiTrimmerCanvas::~MidiTrimmerCanvas ()
{
}
void
MidiTrimmerCanvas::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
MidiTrimmerCanvas::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;
}
/* ------------ */
MidiTrimmerBoxWidget::MidiTrimmerBoxWidget ()
{
trimmer = new MidiTrimmerCanvas (root());
set_background_color (UIConfiguration::instance().color (X_("theme:bg")));
}
void
MidiTrimmerBoxWidget::size_request (double& w, double& h) const
{
trimmer->size_request (w, h);
w=600;
h=210;
}
void
MidiTrimmerBoxWidget::on_map ()
{
GtkCanvas::on_map ();
}
void
MidiTrimmerBoxWidget::on_unmap ()
{
GtkCanvas::on_unmap ();
}
/* ====================================================== */
MidiRegionTrimmerBox::MidiRegionTrimmerBox ()
{
_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 MidiTrimmerBoxWidget());
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,99 @@
/*
* 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_region_trimmer_box.h"
#include "audio_clock.h"
namespace ARDOUR {
class Session;
class Location;
}
namespace ArdourCanvas {
class Text;
class Polygon;
};
class MidiTrimmerCanvas : public ArdourCanvas::Rectangle
{
public:
MidiTrimmerCanvas (ArdourCanvas::Item* parent);
~MidiTrimmerCanvas ();
void render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
// void _size_allocate (ArdourCanvas::Rect const &);
bool event_handler (GdkEvent*);
};
class MidiTrimmerBoxWidget : public ArdourCanvas::GtkCanvas
{
public:
MidiTrimmerBoxWidget ();
void size_request (double& w, double& h) const;
void on_map ();
void on_unmap ();
private:
MidiTrimmerCanvas* trimmer;
};
class MidiRegionTrimmerBox : public RegionTrimmerBox
{
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;
MidiTrimmerBoxWidget *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

@ -210,6 +210,14 @@ public:
virtual void new_region_from_selection () = 0;
virtual void separate_region_from_selection () = 0;
virtual void reverse_region () = 0;
virtual void normalize_region () = 0;
virtual void quantize_region () = 0;
virtual void legatize_region (bool shrink_only) = 0;
virtual void transform_region () = 0;
virtual void transpose_region () = 0;
virtual void pitch_shift_region () = 0;
virtual void transition_to_rolling (bool fwd) = 0;
virtual samplepos_t pixel_to_sample (double pixel) const = 0;
virtual samplepos_t playhead_cursor_sample () const = 0;

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

@ -117,6 +117,7 @@ Selection::clear ()
clear_playlists ();
clear_midi_notes ();
clear_markers ();
clear_triggers ();
pending_midi_note_selection.clear();
}
@ -128,6 +129,7 @@ Selection::clear_objects (bool with_signal)
clear_lines(with_signal);
clear_playlists (with_signal);
clear_midi_notes (with_signal);
clear_triggers (with_signal);
}
void
@ -219,11 +221,30 @@ Selection::clear_markers (bool with_signal)
}
}
void
Selection::clear_triggers (bool with_signal)
{
if (!triggers.empty()) {
triggers.clear ();
if (with_signal) {
TriggersChanged ();
}
}
}
RegionSelection
Selection::trigger_regionview_proxy () const
{
RegionSelection rs;
return rs;
}
void
Selection::toggle (boost::shared_ptr<Playlist> pl)
{
clear_time(); // enforce object/range exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
PlaylistSelection::iterator i;
@ -242,6 +263,7 @@ Selection::toggle (const MidiNoteSelection& midi_note_list)
{
clear_time(); // enforce object/range exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
for (MidiNoteSelection::const_iterator i = midi_note_list.begin(); i != midi_note_list.end(); ++i) {
toggle ((*i));
@ -270,6 +292,7 @@ Selection::toggle (RegionView* r)
{
clear_time(); // enforce object/range exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
RegionSelection::iterator i;
@ -287,6 +310,7 @@ Selection::toggle (vector<RegionView*>& r)
{
clear_time(); // enforce object/range exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
RegionSelection::iterator i;
@ -326,6 +350,7 @@ Selection::add (boost::shared_ptr<Playlist> pl)
if (find (playlists.begin(), playlists.end(), pl) == playlists.end()) {
clear_time(); // enforce object/range exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
pl->use ();
playlists.push_back(pl);
PlaylistsChanged ();
@ -348,6 +373,7 @@ Selection::add (const list<boost::shared_ptr<Playlist> >& pllist)
if (changed) {
clear_time(); // enforce object/range exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
PlaylistsChanged ();
}
}
@ -361,6 +387,7 @@ Selection::add (const MidiNoteSelection& midi_list)
if (!midi_list.empty()) {
clear_time(); // enforce object/range exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
midi_notes.insert (midi_notes.end(), b, e);
MidiNotesChanged ();
}
@ -503,6 +530,7 @@ Selection::add (boost::shared_ptr<Evoral::ControlList> cl)
if (!cl->empty()) {
clear_time(); // enforce object/range exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
}
/* The original may change so we must store a copy (not a pointer) here.
@ -640,6 +668,7 @@ Selection::set (const MidiNoteSelection& midi_list)
if (!midi_list.empty()) {
clear_time (); // enforce region/object exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
}
clear_objects ();
add (midi_list);
@ -651,6 +680,7 @@ Selection::set (boost::shared_ptr<Playlist> playlist)
if (playlist) {
clear_time (); // enforce region/object exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
}
clear_objects ();
add (playlist);
@ -802,7 +832,8 @@ Selection::empty (bool internal_selection)
lines.empty () &&
time.empty () &&
playlists.empty () &&
markers.empty()
markers.empty() &&
triggers.empty()
;
if (!internal_selection) {
@ -821,6 +852,7 @@ Selection::toggle (ControlPoint* cp)
{
clear_time(); // enforce region/object exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
cp->set_selected (!cp->selected ());
PointSelection::iterator i = find (points.begin(), points.end(), cp);
@ -838,6 +870,7 @@ Selection::toggle (vector<ControlPoint*> const & cps)
{
clear_time(); // enforce region/object exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
for (vector<ControlPoint*>::const_iterator i = cps.begin(); i != cps.end(); ++i) {
toggle (*i);
@ -849,6 +882,7 @@ Selection::toggle (list<Selectable*> const & selectables)
{
clear_time(); // enforce region/object exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
RegionView* rv;
ControlPoint* cp;
@ -892,6 +926,7 @@ Selection::add (PointSelection const & s)
{
clear_time (); // enforce region/object exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
for (PointSelection::const_iterator i = s.begin(); i != s.end(); ++i) {
points.push_back (*i);
@ -903,6 +938,7 @@ Selection::add (list<Selectable*> const & selectables)
{
clear_time (); // enforce region/object exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
RegionView* rv;
ControlPoint* cp;
@ -947,6 +983,7 @@ Selection::add (ControlPoint* cp)
{
clear_time (); // enforce region/object exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
cp->set_selected (true);
points.push_back (cp);
@ -958,6 +995,7 @@ Selection::add (vector<ControlPoint*> const & cps)
{
clear_time (); // enforce region/object exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
for (vector<ControlPoint*>::const_iterator i = cps.begin(); i != cps.end(); ++i) {
(*i)->set_selected (true);
@ -971,6 +1009,7 @@ Selection::set (ControlPoint* cp)
{
clear_time (); // enforce region/object exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
if (cp->selected () && points.size () == 1) {
return;
@ -989,6 +1028,7 @@ Selection::set (ArdourMarker* m)
{
clear_time (); // enforce region/object exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
markers.clear ();
add (m);
@ -1022,6 +1062,7 @@ Selection::add (ArdourMarker* m)
{
clear_time (); //enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
if (find (markers.begin(), markers.end(), m) == markers.end()) {
markers.push_back (m);
@ -1034,6 +1075,7 @@ Selection::add (const list<ArdourMarker*>& m)
{
clear_time (); // enforce region/object exclusivity
clear_tracks(); // enforce object/track exclusivity
clear_triggers(); // enforce trigger exclusivity
markers.insert (markers.end(), m.begin(), m.end());
markers.sort ();
@ -1169,6 +1211,7 @@ Selection::set_state (XMLNode const & node, int)
clear_points ();
clear_time ();
clear_markers ();
clear_triggers();
/* NOTE: stripable/time-axis-view selection is saved/restored by
* ARDOUR::CoreSelection, not this Selection object
@ -1660,6 +1703,7 @@ Selection::selected (TriggerEntry* te) const
void
Selection::set (TriggerEntry* te)
{
clear();
clear_triggers ();
add (te);
}
@ -1695,12 +1739,3 @@ Selection::toggle (TriggerEntry* te)
TriggersChanged ();
}
void
Selection::clear_triggers ()
{
if (!triggers.empty()) {
triggers.clear ();
TriggersChanged ();
}
}

View File

@ -131,6 +131,12 @@ public:
bool selected (ControlPoint*) const;
bool selected (TriggerEntry*) const;
/* ToDo: some region operations (midi quantize, audio reverse) expect
* a RegionSelection (a list of regionviews). We're likely going to
* need a region_view + time_axis_view proxy, and this will get it.
*/
RegionSelection trigger_regionview_proxy () const;
void set (std::list<Selectable*> const &);
void add (std::list<Selectable*> const &);
void toggle (std::list<Selectable*> const &);
@ -228,9 +234,7 @@ public:
void clear_points (bool with_signal = true);
void clear_markers (bool with_signal = true);
void clear_midi_notes (bool with_signal = true);
/* triggers are only mutually exclusive with regions */
void clear_triggers ();
void clear_triggers (bool with_signal = true);
void foreach_region (void (ARDOUR::Region::*method)(void));
void foreach_regionview (void (RegionView::*method)(void));

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

@ -30,9 +30,18 @@
#include "actions.h"
#include "ardour_ui.h"
#include "editor.h"
#include "gui_thread.h"
#include "public_editor.h"
#include "timers.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 "midi_region_trimmer_box.h"
#include "trigger_page.h"
#include "trigger_strip.h"
#include "ui_config.h"
@ -53,10 +62,40 @@ TriggerPage::TriggerPage ()
load_bindings ();
register_actions ();
_slot_prop_box = new SlotPropertiesBox ();
_audio_prop_box = new AudioRegionPropertiesBox ();
_midi_prop_box = new MidiRegionPropertiesBox ();
_audio_ops_box = new AudioRegionOperationsBox ();
_midi_ops_box = new MidiRegionOperationsBox ();
_audio_trim_box = new AudioRegionTrimmerBox ();
_midi_trim_box = new MidiRegionTrimmerBox ();
Gtk::Table* table = manage (new Gtk::Table);
table->set_homogeneous (false);
table->set_spacings (8);
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=1;
table->attach(*_audio_prop_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++;
table->attach(*_audio_trim_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++;
table->attach(*_audio_ops_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++;
col=1; /* audio and midi boxen share the same table locations; shown and hidden depending on region type */
table->attach(*_midi_prop_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++;
table->attach(*_midi_trim_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++;
table->attach(*_midi_ops_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++;
_parameter_box.pack_start (*table);
#if 1 /* Placeholders */
_slot_area_box.pack_start (*Gtk::manage (new Gtk::Label ("Fixed\nWidth\nSlot\nArea")));
_browser_box.pack_start (*Gtk::manage (new Gtk::Label ("File Browser")));
_parameter_box.pack_start (*Gtk::manage (new Gtk::Label ("Parameter HBox")));
_slot_area_box.show_all ();
_browser_box.show_all ();
_parameter_box.show_all ();
@ -93,7 +132,6 @@ TriggerPage::TriggerPage ()
_strip_packer.show ();
_slot_area_box.show ();
_browser_box.show ();
_parameter_box.show ();
/* setup keybidings */
_content.set_data ("ardour-bindings", bindings);
@ -121,6 +159,16 @@ TriggerPage::TriggerPage ()
TriggerPage::~TriggerPage ()
{
delete _slot_prop_box;
delete _audio_ops_box;
delete _midi_ops_box;
delete _audio_prop_box;
delete _midi_prop_box;
delete _audio_trim_box;
delete _midi_trim_box;
}
Gtk::Window*
@ -196,10 +244,23 @@ TriggerPage::set_session (Session* s)
_session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&TriggerPage::parameter_changed, this, _1), gui_context ());
Editor::instance().get_selection().TriggersChanged.connect (sigc::mem_fun (*this, &TriggerPage::selection_changed));
initial_track_display ();
_slot_prop_box->set_session(s);
_audio_prop_box->set_session(s);
_audio_ops_box->set_session(s);
_audio_trim_box->set_session(s);
_midi_prop_box->set_session(s);
_midi_ops_box->set_session(s);
_midi_trim_box->set_session(s);
update_title ();
start_updating ();
selection_changed();
}
void
@ -262,6 +323,51 @@ TriggerPage::initial_track_display ()
add_routes (rl);
}
void
TriggerPage::selection_changed ()
{
Selection& selection (Editor::instance().get_selection());
_slot_prop_box->hide();
_audio_ops_box->hide();
_audio_prop_box->hide();
_audio_trim_box->hide();
_midi_ops_box->hide();
_midi_prop_box->hide();
_midi_trim_box->hide();
_parameter_box.hide ();
if (!selection.triggers.empty()) {
TriggerSelection ts = selection.triggers;
TriggerEntry* entry = *ts.begin();
Trigger* slot = &entry->trigger();
_slot_prop_box->set_slot(slot);
_slot_prop_box->show();
if (slot->region()) {
if (slot->region()->data_type() == DataType::AUDIO) {
_audio_prop_box->set_region(slot->region());
_audio_trim_box->set_region(slot->region());
_audio_prop_box->show();
_audio_trim_box->show();
_audio_ops_box->show();
} else {
_midi_prop_box->set_region(slot->region());
_midi_trim_box->set_region(slot->region());
_midi_prop_box->show();
_midi_trim_box->show();
_midi_ops_box->show();
}
}
_parameter_box.show ();
}
}
void
TriggerPage::add_routes (RouteList& rl)
{

View File

@ -30,6 +30,13 @@
#include "widgets/tabbable.h"
class TriggerStrip;
class SlotPropertiesBox;
class AudioRegionPropertiesBox;
class MidiRegionPropertiesBox;
class AudioRegionOperationsBox;
class MidiRegionOperationsBox;
class AudioRegionTrimmerBox;
class MidiRegionTrimmerBox;
class TriggerPage : public ArdourWidgets::Tabbable, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList
{
@ -59,6 +66,9 @@ private:
void pi_property_changed (PBD::PropertyChange const&);
void stripable_property_changed (PBD::PropertyChange const&, boost::weak_ptr<ARDOUR::Stripable>);
void selection_changed ();
PBD::ScopedConnectionList editor_connections;
gint start_updating ();
gint stop_updating ();
void fast_update_strips ();
@ -76,6 +86,16 @@ private:
Gtk::VBox _browser_box;
Gtk::HBox _parameter_box;
SlotPropertiesBox* _slot_prop_box;
AudioRegionPropertiesBox* _audio_prop_box;
AudioRegionOperationsBox* _audio_ops_box;
AudioRegionTrimmerBox* _audio_trim_box;
MidiRegionPropertiesBox* _midi_prop_box;
MidiRegionOperationsBox* _midi_ops_box;
MidiRegionTrimmerBox* _midi_trim_box;
std::list<TriggerStrip*> _strips;
sigc::connection _fast_screen_update_connection;
};

View File

@ -27,14 +27,18 @@
#include "ardour/region.h"
#include "ardour/triggerbox.h"
#include "canvas/polygon.h"
#include "canvas/text.h"
#include "canvas/widget.h"
#include "widgets/ardour_button.h"
#include "widgets/slider_controller.h"
#include "gtkmm2ext/utils.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 "midi_region_trimmer_box.h"
#include "ardour_ui.h"
#include "gui_thread.h"
#include "trigger_ui.h"
@ -45,7 +49,6 @@
#include "pbd/i18n.h"
using namespace ARDOUR;
using namespace ArdourCanvas;
using namespace ArdourWidgets;
using namespace Gtkmm2ext;
using namespace PBD;
@ -58,10 +61,11 @@ static std::string longest_quantize;
static std::vector<std::string> launch_strings;
static std::string longest_launch;
TriggerUI::TriggerUI (Item* parent, Trigger& t)
: Table (parent)
, trigger (t)
TriggerUI::TriggerUI () :
_follow_percent_adjustment(0,100,1)
{
trigger = NULL;
using namespace Gtk::Menu_Helpers;
if (follow_strings.empty()) {
@ -93,72 +97,60 @@ TriggerUI::TriggerUI (Item* parent, Trigger& t)
}
}
set_fill_color (UIConfiguration::instance().color (X_("theme:bg")));
name = "triggerUI-table";
set_row_spacing (10);
set_col_spacing (10);
set_padding ({10});
set_homogenous (false);
// set_fill_color (UIConfiguration::instance().color (X_("theme:bg")));
// name = "triggerUI-table";
// set_row_spacing (2);
set_spacings (2);
// set_padding (2);
set_homogeneous (false);
_follow_action_button = new ArdourButton ();
_follow_action_button = new ArdourButton (ArdourButton::led_default_elements);
_follow_action_button->set_name("FollowAction");
_follow_action_button->set_text (_("Follow Action"));
_follow_action_button->set_active_color (UIConfiguration::instance().color ("alert:greenish"));
follow_action_button = new ArdourCanvas::Widget (canvas(), *_follow_action_button);
follow_action_button->name = "FollowAction";
// _follow_action_button->set_active_color (UIConfiguration::instance().color ("alert:greenish"));
_follow_action_button->signal_event().connect (sigc::mem_fun (*this, (&TriggerUI::follow_action_button_event)));
_follow_percent_adjustment.set_lower (0.0);
_follow_percent_adjustment.set_upper (100.0);
_follow_percent_adjustment.set_step_increment (1.0);
_follow_percent_adjustment.set_page_increment (5.0);
_follow_percent_slider = new HSliderController (&_follow_percent_adjustment, boost::shared_ptr<PBD::Controllable>(), 24/*length*/, 12/*girth*/ );
_follow_percent_slider->set_name("FollowAction");
_follow_percent_slider->set_text (_("100% Left"));
// _follow_percent_slider->set_active_color (UIConfiguration::instance().color ("alert:greenish"));
// _follow_percent_slider->signal_event().connect (sigc::mem_fun (*this, (&TriggerUI::follow_action_button_event)));
_follow_left = new ArdourDropdown;
_follow_left->set_name("FollowAction");
_follow_left->append_text_item (_("None"));
_follow_left->append_text_item (_("Repeat"));
_follow_left->append_text_item (_("Next"));
_follow_left->append_text_item (_("Previous"));
_follow_left->set_sizing_text (longest_follow);
follow_left = new Widget (canvas(), *_follow_left);
follow_left->name = "FollowLeft";
_follow_right = new ArdourDropdown;
_follow_right->set_name("FollowAction");
_follow_right->append_text_item (_("None"));
_follow_right->append_text_item (_("Repeat"));
_follow_right->append_text_item (_("Next"));
_follow_right->append_text_item (_("Previous"));
_follow_right->set_sizing_text (longest_follow);
follow_right = new Widget (canvas(), *_follow_right);
follow_right->name = "FollowRight";
launch_text = new Text (canvas());
launch_text->set (_("Launch"));
launch_text->name = "LaunchText";
launch_text->set_color (Gtkmm2ext::contrasting_text_color (UIConfiguration::instance().color (X_("theme:bg"))));
launch_text->set_font_description (UIConfiguration::instance ().get_NormalBoldFont ());
_launch_style_button = new ArdourDropdown();
_launch_style_button->set_name("FollowAction");
_launch_style_button->set_sizing_text (longest_launch);
_launch_style_button->AddMenuElem (MenuElem (launch_style_to_string (Trigger::OneShot), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_launch_style), Trigger::OneShot)));
_launch_style_button->AddMenuElem (MenuElem (launch_style_to_string (Trigger::Gate), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_launch_style), Trigger::Gate)));
_launch_style_button->AddMenuElem (MenuElem (launch_style_to_string (Trigger::Toggle), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_launch_style), Trigger::Toggle)));
_launch_style_button->AddMenuElem (MenuElem (launch_style_to_string (Trigger::Repeat), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_launch_style), Trigger::Repeat)));
launch_style_button = new Widget (canvas(), *_launch_style_button);
launch_style_button->name = "LaunchButton";
_legato_button = new ArdourButton();
_legato_button = new ArdourButton(ArdourButton::led_default_elements);
_launch_style_button->set_name("FollowAction");
_legato_button->set_text (_("Legato"));
_legato_button->set_active_color (UIConfiguration::instance().color ("alert:greenish"));
_legato_button->signal_event().connect (sigc::mem_fun (*this, (&TriggerUI::legato_button_event)));
legato_button = new ArdourCanvas::Widget (canvas(), *_legato_button);
legato_button->name = "Legato";
quantize_text = new Text (canvas());
quantize_text->set (_("Quantize"));
quantize_text->name = "QuantizeText";
quantize_text->set_color (launch_text->color());
quantize_text->set_font_description (UIConfiguration::instance ().get_NormalBoldFont ());
_quantize_button = new ArdourDropdown;
#define quantize_item(b) _quantize_button->AddMenuElem (MenuElem (quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_quantize), b)));
@ -178,56 +170,44 @@ TriggerUI::TriggerUI (Item* parent, Trigger& t)
}
}
_quantize_button->set_sizing_text (longest_quantize);
_quantize_button->set_name("FollowAction");
#undef quantize_item
quantize_button = new Widget (canvas(), *_quantize_button);
quantize_button->name = "quantize";
int row=0;
Gtk::Label *label;
velocity = new Rectangle (canvas());
velocity->name = "VelocityRect";
velocity->set_fill_color (UIConfiguration::instance().color (X_("theme:bg")));
velocity->set_outline_color (UIConfiguration::instance().color (X_("neutral:foreground")));
label = manage(new Gtk::Label(_("Velocity Sense:"))); label->set_alignment(1.0, 0.5);
attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
label = manage(new Gtk::Label(_("100%"))); label->set_alignment(0.0, 0.5);
attach(*label, 1, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
velocity_text = new Text (velocity);
velocity_text->set (_("100 %"));
velocity_text->name = "VelocityText";
velocity_text->set_color (quantize_text->color());
velocity_text->set_font_description (UIConfiguration::instance ().get_NormalFont ());
label = manage(new Gtk::Label(_("Launch Style:"))); label->set_alignment(1.0, 0.5);
attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
attach(*_launch_style_button, 1, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
velocity_label = new Text (canvas());
velocity_label->set (_("Velocity"));
velocity_label->name = "VelocityLabel";
velocity_label->set_color (quantize_text->color());
velocity_label->set_font_description (UIConfiguration::instance ().get_NormalBoldFont ());
label = manage(new Gtk::Label(_("Launch Quantize:"))); label->set_alignment(1.0, 0.5);
attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
attach(*_quantize_button, 1, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
/* Row 0 */
label = manage(new Gtk::Label(_("Legato Mode:"))); label->set_alignment(1.0, 0.5);
attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
attach(*_legato_button, 1, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
attach_with_span (follow_action_button, 0, 0, 2, 1, PackExpand, PackExpand);
attach(*_follow_action_button, 0, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
attach(*_follow_percent_slider, 0, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
attach(*_follow_left, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
attach(*_follow_right, 1, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
}
/* Row 1 */
TriggerUI::~TriggerUI ()
{
}
attach (follow_left, 0, 1, PackExpand, PackExpand);
attach (follow_right, 1, 1, PackExpand, PackExpand);
/* Row 2 */
attach (launch_text, 0, 2);
/* Row 3 */
attach (launch_style_button, 0, 3, PackExpand, PackExpand);
attach (legato_button, 1, 3, PackExpand, PackExpand);
/* Row 4 */
attach (quantize_text, 0, 4);
attach (velocity_label, 1, 4);
/* Row 5 */
attach (quantize_button, 0, 5, PackExpand, PackExpand);
attach (velocity, 1, 5, PackExpand, PackExpand);
void
TriggerUI::set_trigger (ARDOUR::Trigger* t)
{
trigger = t;
PropertyChange pc;
@ -240,12 +220,9 @@ TriggerUI::TriggerUI (Item* parent, Trigger& t)
trigger_changed (pc);
trigger.PropertyChanged.connect (trigger_connections, invalidator (*this), boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context());
trigger->PropertyChanged.connect (trigger_connections, invalidator (*this), boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context());
}
TriggerUI::~TriggerUI ()
{
}
void
TriggerUI::set_quantize (BBT_Offset bbo)
@ -255,7 +232,7 @@ TriggerUI::set_quantize (BBT_Offset bbo)
bbo = BBT_Offset (1, 2, 3); /* XXX get grid from editor */
}
trigger.set_quantization (bbo);
trigger->set_quantization (bbo);
}
bool
@ -263,7 +240,7 @@ TriggerUI::follow_action_button_event (GdkEvent* ev)
{
switch (ev->type) {
case GDK_BUTTON_PRESS:
trigger.set_use_follow (!trigger.use_follow());
trigger->set_use_follow (!trigger->use_follow());
return true;
default:
@ -278,7 +255,7 @@ TriggerUI::legato_button_event (GdkEvent* ev)
{
switch (ev->type) {
case GDK_BUTTON_PRESS:
trigger.set_legato (!trigger.legato());
trigger->set_legato (!trigger->legato());
return true;
default:
@ -291,7 +268,7 @@ TriggerUI::legato_button_event (GdkEvent* ev)
void
TriggerUI::set_launch_style (Trigger::LaunchStyle ls)
{
trigger.set_launch_style (ls);
trigger->set_launch_style (ls);
}
std::string
@ -364,61 +341,82 @@ void
TriggerUI::trigger_changed (PropertyChange pc)
{
if (pc.contains (Properties::quantization)) {
BBT_Offset bbo (trigger.quantization());
BBT_Offset bbo (trigger->quantization());
_quantize_button->set_active (quantize_length_to_string (bbo));
std::cerr << "\n\n !!! quantize is " << quantize_length_to_string (bbo) << std::endl << std::endl;
}
if (pc.contains (Properties::use_follow)) {
_follow_action_button->set_active_state (trigger.use_follow() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
_follow_action_button->set_active_state (trigger->use_follow() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
}
if (pc.contains (Properties::legato)) {
_legato_button->set_active_state (trigger.legato() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
_legato_button->set_active_state (trigger->legato() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
}
if (pc.contains (Properties::launch_style)) {
_launch_style_button->set_active (launch_style_to_string (trigger.launch_style()));
_launch_style_button->set_active (launch_style_to_string (trigger->launch_style()));
}
if (pc.contains (Properties::follow_action0)) {
_follow_right->set_text (follow_action_to_string (trigger.follow_action (0)));
_follow_right->set_text (follow_action_to_string (trigger->follow_action (0)));
}
if (pc.contains (Properties::follow_action1)) {
_follow_left->set_text (follow_action_to_string (trigger.follow_action (1)));
_follow_left->set_text (follow_action_to_string (trigger->follow_action (1)));
}
}
/* ------------ */
TriggerWidget::TriggerWidget (Trigger& t)
TriggerWidget::TriggerWidget ()
{
ui = new TriggerUI (root(), t);
set_background_color (UIConfiguration::instance().color (X_("theme:bg")));
}
void
TriggerWidget::size_request (double& w, double& h) const
{
ui->size_request (w, h);
ui = new TriggerUI ();
pack_start(*ui);
ui->show();
// set_background_color (UIConfiguration::instance().color (X_("theme:bg")));
}
/* ------------ */
TriggerWindow::TriggerWindow (Trigger& t)
TriggerWindow::TriggerWindow (Trigger* slot)
{
TriggerWidget* tw = manage (new TriggerWidget (t));
set_title (string_compose (_("Trigger: %1"), t.name()));
set_title (string_compose (_("Trigger: %1"), slot->name()));
double w;
double h;
SlotPropertiesBox* slot_prop_box = manage (new SlotPropertiesBox ());
slot_prop_box->set_slot(slot);
tw->show ();
tw->size_request (w, h);
set_default_size (w, h);
std::cerr << "TW: set default win size to " << w << " x " << h << std::endl;
add (*tw);
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 (slot->region()) {
if (slot->region()->data_type() == DataType::AUDIO) {
_prop_box = manage(new AudioRegionPropertiesBox ());
_ops_box = manage(new AudioRegionOperationsBox ());
_trim_box = manage(new AudioRegionTrimmerBox ());
} else {
_prop_box = manage(new MidiRegionPropertiesBox ());
_ops_box = manage(new MidiRegionOperationsBox ());
_trim_box = manage(new MidiRegionTrimmerBox ());
}
_prop_box->set_region(slot->region());
_trim_box->set_region(slot->region());
_ops_box->set_session(&slot->region()->session());
table->attach(*_prop_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++;
table->attach(*_ops_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++;
}
add (*table);
table->show_all();
}
bool

View File

@ -21,63 +21,37 @@
#include "ardour/triggerbox.h"
#include "canvas/box.h"
#include "canvas/canvas.h"
#include "canvas/table.h"
namespace ArdourWidgets {
class ArdourButton;
class HSliderController;
}
namespace ArdourCanvas {
class Text;
class Polygon;
class Widget;
class Rectangle;
};
class RegionPropertiesBox;
class RegionOperationsBox;
class RegionTrimmerBox;
class TriggerUI : public ArdourCanvas::Table, public sigc::trackable
class TriggerUI : public Gtk::Table //, public sigc::trackable
{
public:
TriggerUI (ArdourCanvas::Item* parent, ARDOUR::Trigger&);
TriggerUI ();
~TriggerUI ();
void set_trigger (ARDOUR::Trigger*);
private:
ARDOUR::Trigger& trigger;
ARDOUR::Trigger* trigger;
ArdourWidgets::ArdourButton* _follow_action_button;
ArdourCanvas::Widget* follow_action_button;
ArdourWidgets::ArdourDropdown* _follow_left;
ArdourCanvas::Widget* follow_left;
ArdourWidgets::ArdourButton* _follow_left_percentage;
ArdourCanvas::Widget* follow_left_percentage;
ArdourWidgets::ArdourDropdown* _follow_right;
ArdourCanvas::Widget* follow_right;
ArdourWidgets::ArdourButton* _follow_right_percentage;
ArdourCanvas::Widget* follow_right_percentage;
ArdourCanvas::Rectangle* percentage_slider;
ArdourCanvas::Rectangle* follow_count;
ArdourCanvas::Text* follow_count_text;
ArdourWidgets::ArdourButton* _follow_action_button;
Gtk::Adjustment _follow_percent_adjustment;
ArdourWidgets::HSliderController* _follow_percent_slider;
ArdourWidgets::ArdourDropdown* _follow_left;
ArdourWidgets::ArdourDropdown* _follow_right;
ArdourWidgets::ArdourButton* _legato_button;
ArdourCanvas::Widget* legato_button;
ArdourWidgets::ArdourDropdown* _quantize_button;
ArdourCanvas::Widget* quantize_button;
ArdourCanvas::Text* quantize_text;
ArdourWidgets::ArdourDropdown* _launch_style_button;
ArdourCanvas::Widget* launch_style_button;
ArdourCanvas::Text* launch_text;
ArdourCanvas::Rectangle* velocity;
ArdourCanvas::Text* velocity_text;
ArdourCanvas::Text* velocity_label;
void set_quantize (Temporal::BBT_Offset);
void set_launch_style (ARDOUR::Trigger::LaunchStyle);
@ -95,11 +69,11 @@ class TriggerUI : public ArdourCanvas::Table, public sigc::trackable
static std::string launch_style_to_string (ARDOUR::Trigger::LaunchStyle);
};
class TriggerWidget : public ArdourCanvas::GtkCanvas
class TriggerWidget : public Gtk::VBox
{
public:
TriggerWidget (ARDOUR::Trigger& tb);
void size_request (double& w, double& h) const;
TriggerWidget ();
void set_trigger (ARDOUR::Trigger* t) const {ui->set_trigger(t);}
private:
TriggerUI* ui;
@ -110,10 +84,14 @@ class TriggerWidget : public ArdourCanvas::GtkCanvas
class TriggerWindow : public Gtk::Window
{
public:
TriggerWindow (ARDOUR::Trigger&);
TriggerWindow (ARDOUR::Trigger*);
bool on_key_press_event (GdkEventKey*);
bool on_key_release_event (GdkEventKey*);
RegionPropertiesBox *_prop_box;
RegionOperationsBox *_ops_box;
RegionTrimmerBox *_trim_box;
};
#endif /* __ardour_gtk_trigger_ui_h__ */

View File

@ -596,7 +596,7 @@ TriggerBoxUI::edit_trigger (uint64_t n)
TriggerWindow* tw = static_cast<TriggerWindow*> (trigger->ui());
if (!tw) {
tw = new TriggerWindow (*_triggerbox.trigger (n));
tw = new TriggerWindow (_triggerbox.trigger (n));
trigger->set_ui (tw);
}

View File

@ -52,6 +52,9 @@ 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_region_trimmer_box.cc',
'audio_streamview.cc',
'audio_time_axis.cc',
'automation_controller.cc',
@ -161,6 +164,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',
@ -182,6 +188,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',
@ -257,6 +264,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',
@ -266,6 +274,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',

View File

@ -74,7 +74,15 @@ namespace Properties {
LIBARDOUR_API extern PBD::PropertyDescriptor<uint64_t> layering_index;
LIBARDOUR_API extern PBD::PropertyDescriptor<std::string> tags;
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> contents; // type doesn't matter here
/* these properties are used as a convenience for announcing changes to state, but aren't stored as properties */
LIBARDOUR_API extern PBD::PropertyDescriptor<Temporal::TimeDomain> time_domain;
LIBARDOUR_API extern PBD::PropertyDescriptor<float> bpm;
LIBARDOUR_API extern PBD::PropertyDescriptor<uint8_t> metrum_numerator; //pulses per bar (typically 4)
LIBARDOUR_API extern PBD::PropertyDescriptor<uint8_t> metrum_divisor; //divisor note type (typically 4 = quarter-note)
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> sync_to_bbt;
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> loop_enabled;
LIBARDOUR_API extern PBD::PropertyDescriptor<timepos_t> loop_start;
};
class Playlist;
@ -124,6 +132,14 @@ public:
timepos_t end() const;
timepos_t nt_last() const { return end().decrement(); }
/** Note: these values are currently only used when the region is in a trigger slot */
float bpm () const { return _bpm; }
uint8_t metrum_numerator () const { return _metrum_numerator; }
uint8_t metrum_divisor () const { return _metrum_divisor; }
bool sync_to_bbt () const { return _sync_to_bbt; }
bool loop_enabled () const { return _loop_enabled; }
timepos_t loop_start () const { return _loop_start; }
timepos_t source_position () const;
timepos_t source_relative_position (Temporal::timepos_t const &) const;
timepos_t region_relative_position (Temporal::timepos_t const &) const;
@ -279,6 +295,13 @@ public:
void set_video_locked (bool yn);
void set_position_locked (bool yn);
void set_bpm (float bpm);
void set_metrum_numerator (uint8_t num);
void set_metrum_divisor (uint8_t div);
void set_sync_to_bbt (bool sync);
void set_loop_enabled (bool en);
void set_loop_start (timepos_t);
Temporal::timepos_t region_beats_to_absolute_time(Temporal::Beats beats) const;
/** Convert a timestamp in beats into timepos_t (both relative to region position) */
Temporal::timepos_t region_beats_to_region_time (Temporal::Beats beats) const {
@ -521,6 +544,14 @@ private:
PBD::Property<std::string> _tags;
PBD::Property<bool> _contents; // type is irrelevant
/* these values are (currently) only used when the region is in a trigger slot */
float _bpm;
uint8_t _metrum_numerator; //pulses per bar (typically 4)
uint8_t _metrum_divisor; //divisor note type (typically 4 = quarter-note)
bool _sync_to_bbt;
bool _loop_enabled;
timepos_t _loop_start;
timecnt_t _last_length;
mutable RegionEditState _first_edit;
layer_t _layer;

View File

@ -82,7 +82,15 @@ namespace ARDOUR {
PBD::PropertyDescriptor<uint64_t> layering_index;
PBD::PropertyDescriptor<std::string> tags;
PBD::PropertyDescriptor<bool> contents;
/* these properties are used as a convenience for announcing changes to state, but aren't stored as properties */
PBD::PropertyDescriptor<Temporal::TimeDomain> time_domain;
PBD::PropertyDescriptor<float> bpm;
PBD::PropertyDescriptor<uint8_t> metrum_numerator;
PBD::PropertyDescriptor<uint8_t> metrum_divisor;
PBD::PropertyDescriptor<bool> sync_to_bbt;
PBD::PropertyDescriptor<bool> loop_enabled;
PBD::PropertyDescriptor<timepos_t> loop_start;
}
}
@ -204,7 +212,13 @@ Region::register_properties ()
, _shift (Properties::shift, 1.0) \
, _layering_index (Properties::layering_index, 0) \
, _tags (Properties::tags, "") \
, _contents (Properties::contents, false)
, _contents (Properties::contents, false) \
, _bpm (110) \
, _metrum_numerator (4) \
, _metrum_divisor (4) \
, _sync_to_bbt (false) \
, _loop_enabled (false) \
, _loop_start (0)
#define REGION_COPY_STATE(other) \
_sync_marked (Properties::sync_marked, other->_sync_marked) \
@ -236,7 +250,13 @@ Region::register_properties ()
, _shift (Properties::shift, other->_shift) \
, _layering_index (Properties::layering_index, other->_layering_index) \
, _tags (Properties::tags, other->_tags) \
, _contents (Properties::contents, other->_contents)
, _contents (Properties::contents, other->_contents) \
, _bpm (other->_bpm) \
, _metrum_numerator (other->_metrum_numerator) \
, _metrum_divisor (other->_metrum_divisor) \
, _sync_to_bbt (other->_sync_to_bbt) \
, _loop_enabled (other->_loop_enabled) \
, _loop_start (other->_loop_start)
/* derived-from-derived constructor (no sources in constructor) */
Region::Region (Session& s, timepos_t const & start, timecnt_t const & length, const string& name, DataType type)
@ -583,6 +603,13 @@ Region::set_position_time_domain (Temporal::TimeDomain td)
}
}
void Region::set_bpm (float bpm) { _bpm = bpm; send_change (Properties::bpm);}
void Region::set_metrum_numerator (uint8_t num) { _metrum_numerator = num; send_change (Properties::metrum_numerator);}
void Region::set_metrum_divisor (uint8_t div) { _metrum_divisor = div; send_change (Properties::metrum_divisor);}
void Region::set_sync_to_bbt (bool sync) { _sync_to_bbt = sync; send_change (Properties::sync_to_bbt);}
void Region::set_loop_enabled (bool en) { _loop_enabled = en; send_change (Properties::loop_enabled);}
void Region::set_loop_start (timepos_t ls) { _loop_start = ls; send_change (Properties::loop_start);}
void
Region::recompute_position_from_time_domain ()
{