2021-11-29 17:30:34 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2021 Ben Loftis <ben@harrisonconsoles.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "pbd/compose.h"
|
2021-12-12 07:43:40 -05:00
|
|
|
#include <algorithm>
|
2021-11-29 17:30:34 -05:00
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
#include "gtkmm2ext/actions.h"
|
2021-11-29 17:30:34 -05:00
|
|
|
#include "gtkmm2ext/gui_thread.h"
|
|
|
|
#include "gtkmm2ext/utils.h"
|
|
|
|
|
|
|
|
#include "ardour/location.h"
|
|
|
|
#include "ardour/profile.h"
|
|
|
|
#include "ardour/session.h"
|
|
|
|
|
|
|
|
#include "audio_clock.h"
|
|
|
|
#include "automation_line.h"
|
|
|
|
#include "control_point.h"
|
|
|
|
#include "editor.h"
|
|
|
|
#include "region_view.h"
|
|
|
|
|
|
|
|
#include "audio_region_properties_box.h"
|
|
|
|
|
|
|
|
#include "pbd/i18n.h"
|
|
|
|
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace ARDOUR;
|
2021-12-02 11:50:19 -05:00
|
|
|
using namespace ArdourWidgets;
|
2021-11-29 17:30:34 -05:00
|
|
|
using std::max;
|
2021-12-12 07:43:40 -05:00
|
|
|
using std::min;
|
2021-11-29 17:30:34 -05:00
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
RegionPropertiesBox::RegionPropertiesBox ()
|
|
|
|
: length_clock (X_("regionlength"), true, "", true, false, true)
|
2021-12-02 11:50:19 -05:00
|
|
|
, start_clock (X_("regionstart"), true, "", false, false)
|
|
|
|
, bbt_toggle (ArdourButton::led_default_elements)
|
2021-11-29 17:30:34 -05:00
|
|
|
{
|
2021-12-12 07:43:40 -05:00
|
|
|
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++;
|
2021-12-02 11:50:19 -05:00
|
|
|
|
|
|
|
pack_start (*bpm_table, false, false);
|
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
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++;
|
2021-12-02 11:50:19 -05:00
|
|
|
|
|
|
|
pack_start (*metrum_table, false, false);
|
2021-11-29 17:30:34 -05:00
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
row = 0;
|
2021-12-02 11:50:19 -05:00
|
|
|
|
2021-12-15 19:08:15 -05:00
|
|
|
bbt_toggle.set_text (_("Stretch"));
|
2021-12-12 07:43:40 -05:00
|
|
|
table.attach (bbt_toggle, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK);
|
|
|
|
row++;
|
2021-12-02 11:50:19 -05:00
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
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++;
|
2021-12-02 11:50:19 -05:00
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
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++;
|
2021-12-02 11:50:19 -05:00
|
|
|
|
|
|
|
table.set_homogeneous (false);
|
|
|
|
table.set_spacings (4);
|
|
|
|
table.set_border_width (2);
|
|
|
|
pack_start (table, false, false);
|
2021-11-29 17:30:34 -05:00
|
|
|
}
|
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
RegionPropertiesBox::~RegionPropertiesBox ()
|
2021-11-29 17:30:34 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-02 11:50:19 -05:00
|
|
|
RegionPropertiesBox::set_session (Session* s)
|
2021-11-29 17:30:34 -05:00
|
|
|
{
|
|
|
|
SessionHandlePtr::set_session (s);
|
2021-12-02 11:50:19 -05:00
|
|
|
|
|
|
|
length_clock.set_session (s);
|
|
|
|
start_clock.set_session (s);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
RegionPropertiesBox::set_region (std::shared_ptr<Region> r)
|
2021-12-02 11:50:19 -05:00
|
|
|
{
|
2021-12-12 07:43:40 -05:00
|
|
|
set_session (&r->session ());
|
2021-12-02 11:50:19 -05:00
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
state_connection.disconnect ();
|
2021-12-02 11:50:19 -05:00
|
|
|
|
|
|
|
_region = r;
|
|
|
|
|
|
|
|
PBD::PropertyChange interesting_stuff;
|
2021-12-12 07:43:40 -05:00
|
|
|
region_changed (interesting_stuff);
|
2021-12-02 11:50:19 -05:00
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
_region->PropertyChanged.connect (state_connection, invalidator (*this), boost::bind (&RegionPropertiesBox::region_changed, this, _1), gui_context ());
|
2021-12-02 11:50:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RegionPropertiesBox::region_changed (const PBD::PropertyChange& what_changed)
|
|
|
|
{
|
2021-12-12 07:43:40 -05:00
|
|
|
// TODO: refactor the region_editor.cc to cover this basic stuff
|
2021-12-02 11:50:19 -05:00
|
|
|
{
|
2021-12-12 07:43:40 -05:00
|
|
|
AudioClock::Mode mode = _region->position_time_domain () == Temporal::AudioTime ? AudioClock::Samples : AudioClock::BBT;
|
2021-12-02 11:50:19 -05:00
|
|
|
|
|
|
|
start_clock.set_mode (mode);
|
|
|
|
length_clock.set_mode (mode);
|
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
start_clock.set (_region->start ());
|
|
|
|
length_clock.set_duration (_region->length ());
|
2021-12-02 11:50:19 -05:00
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
bpm_button.set_text ("122.2");
|
|
|
|
metrum_button.set_text ("4/4");
|
2021-12-02 11:50:19 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AudioRegionPropertiesBox::AudioRegionPropertiesBox ()
|
|
|
|
{
|
2021-12-12 07:43:40 -05:00
|
|
|
_header_label.set_text (_("AUDIO Region Properties:"));
|
2021-12-02 11:50:19 -05:00
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
Gtk::Label* label;
|
2021-12-02 11:50:19 -05:00
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
Gtk::Table* audio_t = manage (new Gtk::Table ());
|
2021-12-02 11:50:19 -05:00
|
|
|
audio_t->set_homogeneous (true);
|
|
|
|
audio_t->set_spacings (4);
|
|
|
|
|
|
|
|
int row = 0;
|
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
label = manage (new Gtk::Label (_("Fades:")));
|
|
|
|
label->set_alignment (1.0, 0.5);
|
2023-10-28 08:45:33 -04:00
|
|
|
fade_in_enable_button.set_text (S_("Fade|In"));
|
2021-12-12 07:43:40 -05:00
|
|
|
fade_in_enable_button.set_name ("generic button");
|
2023-10-28 08:45:33 -04:00
|
|
|
fade_out_enable_button.set_text (S_("Fade|Out"));
|
2021-12-12 07:43:40 -05:00
|
|
|
fade_out_enable_button.set_name ("generic button");
|
|
|
|
audio_t->attach (*label, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK);
|
|
|
|
audio_t->attach (fade_in_enable_button, 1, 2, row, row + 1, Gtk::FILL, Gtk::SHRINK);
|
|
|
|
audio_t->attach (fade_out_enable_button, 2, 3, row, row + 1, Gtk::FILL, Gtk::SHRINK);
|
2021-12-02 11:50:19 -05:00
|
|
|
|
|
|
|
row++;
|
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
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);
|
2021-12-02 11:50:19 -05:00
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
gain_control.set_text (_("+6dB"));
|
|
|
|
gain_control.set_name ("generic button");
|
|
|
|
audio_t->attach (gain_control, 1, 3, row, row + 1, Gtk::FILL, Gtk::SHRINK);
|
2021-12-02 11:50:19 -05:00
|
|
|
|
|
|
|
row++;
|
|
|
|
|
2021-12-12 07:43:40 -05:00
|
|
|
pack_start (*audio_t);
|
2021-12-02 11:50:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
AudioRegionPropertiesBox::~AudioRegionPropertiesBox ()
|
|
|
|
{
|
2021-11-29 17:30:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
AudioRegionPropertiesBox::set_region (std::shared_ptr<Region> r)
|
2021-11-29 17:30:34 -05:00
|
|
|
{
|
2021-12-02 11:50:19 -05:00
|
|
|
RegionPropertiesBox::set_region (r);
|
2021-11-29 17:30:34 -05:00
|
|
|
}
|