mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
trigger_ui: stretch_mode selector (gtk part)
This commit is contained in:
parent
ac97b30e55
commit
f0843e3cd9
4 changed files with 59 additions and 11 deletions
|
|
@ -20,9 +20,13 @@
|
||||||
#include "pbd/compose.h"
|
#include "pbd/compose.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <gtkmm/menu.h>
|
||||||
|
#include <gtkmm/menuitem.h>
|
||||||
|
|
||||||
#include "gtkmm2ext/actions.h"
|
#include "gtkmm2ext/actions.h"
|
||||||
#include "gtkmm2ext/gui_thread.h"
|
#include "gtkmm2ext/gui_thread.h"
|
||||||
#include "gtkmm2ext/utils.h"
|
#include "gtkmm2ext/utils.h"
|
||||||
|
#include "gtkmm2ext/menu_elems.h"
|
||||||
|
|
||||||
#include "ardour/location.h"
|
#include "ardour/location.h"
|
||||||
#include "ardour/profile.h"
|
#include "ardour/profile.h"
|
||||||
|
|
@ -90,6 +94,7 @@ AudioTriggerPropertiesBox::AudioTriggerPropertiesBox ()
|
||||||
|
|
||||||
_stretch_toggle.set_text (_("Stretch"));
|
_stretch_toggle.set_text (_("Stretch"));
|
||||||
_table.attach (_stretch_toggle, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK);
|
_table.attach (_stretch_toggle, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK);
|
||||||
|
_table.attach (_stretch_selector, 1, 2, row, row + 1, Gtk::SHRINK, Gtk::SHRINK);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
label = manage (new Gtk::Label (_("Start:")));
|
label = manage (new Gtk::Label (_("Start:")));
|
||||||
|
|
@ -124,16 +129,6 @@ AudioTriggerPropertiesBox::AudioTriggerPropertiesBox ()
|
||||||
|
|
||||||
row = 0;
|
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");
|
|
||||||
audio_t->attach (_stretch_selector, 1, 3, row, row + 1, Gtk::FILL, Gtk::SHRINK);
|
|
||||||
|
|
||||||
row++;
|
|
||||||
|
|
||||||
label = manage (new Gtk::Label (_("Gain:")));
|
label = manage (new Gtk::Label (_("Gain:")));
|
||||||
label->set_alignment (1.0, 0.5);
|
label->set_alignment (1.0, 0.5);
|
||||||
Gtk::Label *db_label = manage (new Gtk::Label (_("(dB)")));
|
Gtk::Label *db_label = manage (new Gtk::Label (_("(dB)")));
|
||||||
|
|
@ -146,6 +141,15 @@ AudioTriggerPropertiesBox::AudioTriggerPropertiesBox ()
|
||||||
|
|
||||||
pack_start (*audio_t);
|
pack_start (*audio_t);
|
||||||
|
|
||||||
|
using namespace Menu_Helpers;
|
||||||
|
|
||||||
|
_stretch_selector.set_text ("??");
|
||||||
|
_stretch_selector.set_name ("generic button");
|
||||||
|
_stretch_selector.set_sizing_text (TriggerUI::longest_stretch_mode);
|
||||||
|
_stretch_selector.AddMenuElem (MenuElem (TriggerUI::stretch_mode_to_string(Trigger::Crisp), sigc::bind (sigc::mem_fun(*this, &AudioTriggerPropertiesBox::set_stretch_mode), Trigger::Crisp)));
|
||||||
|
_stretch_selector.AddMenuElem (MenuElem (TriggerUI::stretch_mode_to_string(Trigger::Mixed), sigc::bind (sigc::mem_fun(*this, &AudioTriggerPropertiesBox::set_stretch_mode), Trigger::Mixed)));
|
||||||
|
_stretch_selector.AddMenuElem (MenuElem (TriggerUI::stretch_mode_to_string(Trigger::Smooth), sigc::bind (sigc::mem_fun(*this, &AudioTriggerPropertiesBox::set_stretch_mode), Trigger::Smooth)));
|
||||||
|
|
||||||
_stretch_toggle.signal_clicked.connect (sigc::mem_fun (*this, &AudioTriggerPropertiesBox::toggle_stretch));
|
_stretch_toggle.signal_clicked.connect (sigc::mem_fun (*this, &AudioTriggerPropertiesBox::toggle_stretch));
|
||||||
|
|
||||||
_follow_length_spinner.set_can_focus(false);
|
_follow_length_spinner.set_can_focus(false);
|
||||||
|
|
@ -169,6 +173,15 @@ AudioTriggerPropertiesBox::toggle_stretch ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AudioTriggerPropertiesBox::set_stretch_mode (Trigger::StretchMode sm)
|
||||||
|
{
|
||||||
|
TriggerPtr trigger (tref.trigger());
|
||||||
|
if (trigger) {
|
||||||
|
trigger->set_stretch_mode (sm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioTriggerPropertiesBox::set_session (Session* s)
|
AudioTriggerPropertiesBox::set_session (Session* s)
|
||||||
{
|
{
|
||||||
|
|
@ -205,6 +218,9 @@ AudioTriggerPropertiesBox::on_trigger_changed (const PBD::PropertyChange& what_c
|
||||||
|
|
||||||
_stretch_toggle.set_active (tref.trigger()->stretchable () ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
_stretch_toggle.set_active (tref.trigger()->stretchable () ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
|
||||||
|
|
||||||
|
_stretch_selector.set_sensitive(tref.trigger()->stretchable ());
|
||||||
|
_stretch_selector.set_text(stretch_mode_to_string(tref.trigger()->stretch_mode ()));
|
||||||
|
|
||||||
float gain = accurate_coefficient_to_dB(tref.trigger()->gain());
|
float gain = accurate_coefficient_to_dB(tref.trigger()->gain());
|
||||||
if (gain != _gain_adjustment.get_value()) {
|
if (gain != _gain_adjustment.get_value()) {
|
||||||
_gain_adjustment.set_value (gain);
|
_gain_adjustment.set_value (gain);
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
#include "ardour/triggerbox.h"
|
#include "ardour/triggerbox.h"
|
||||||
|
|
||||||
#include "widgets/ardour_button.h"
|
#include "widgets/ardour_button.h"
|
||||||
|
#include "widgets/ardour_dropdown.h"
|
||||||
|
|
||||||
#include "audio_clock.h"
|
#include "audio_clock.h"
|
||||||
#include "trigger_ui.h"
|
#include "trigger_ui.h"
|
||||||
|
|
@ -57,6 +58,7 @@ protected:
|
||||||
virtual void on_trigger_changed (const PBD::PropertyChange& what_changed);
|
virtual void on_trigger_changed (const PBD::PropertyChange& what_changed);
|
||||||
|
|
||||||
void toggle_stretch ();
|
void toggle_stretch ();
|
||||||
|
void set_stretch_mode (ARDOUR::Trigger::StretchMode sm);
|
||||||
|
|
||||||
void start_clock_changed();
|
void start_clock_changed();
|
||||||
void length_clock_changed();
|
void length_clock_changed();
|
||||||
|
|
@ -82,7 +84,7 @@ private:
|
||||||
|
|
||||||
ArdourWidgets::ArdourButton _stretch_toggle;
|
ArdourWidgets::ArdourButton _stretch_toggle;
|
||||||
|
|
||||||
ArdourWidgets::ArdourButton _stretch_selector;
|
ArdourWidgets::ArdourDropdown _stretch_selector;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,8 @@ std::vector<std::string> TriggerUI::quantize_strings;
|
||||||
std::string TriggerUI::longest_quantize;
|
std::string TriggerUI::longest_quantize;
|
||||||
std::vector<std::string> TriggerUI::launch_strings;
|
std::vector<std::string> TriggerUI::launch_strings;
|
||||||
std::string TriggerUI::longest_launch;
|
std::string TriggerUI::longest_launch;
|
||||||
|
std::vector<std::string> TriggerUI::stretch_mode_strings;
|
||||||
|
std::string TriggerUI::longest_stretch_mode;
|
||||||
|
|
||||||
Gtkmm2ext::Bindings* TriggerUI::bindings = 0;
|
Gtkmm2ext::Bindings* TriggerUI::bindings = 0;
|
||||||
Glib::RefPtr<Gtk::ActionGroup> TriggerUI::trigger_actions;
|
Glib::RefPtr<Gtk::ActionGroup> TriggerUI::trigger_actions;
|
||||||
|
|
@ -104,6 +106,16 @@ TriggerUI::TriggerUI ()
|
||||||
longest_launch = *i;
|
longest_launch = *i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stretch_mode_strings.push_back (stretch_mode_to_string (Trigger::Crisp));
|
||||||
|
stretch_mode_strings.push_back (stretch_mode_to_string (Trigger::Mixed));
|
||||||
|
stretch_mode_strings.push_back (stretch_mode_to_string (Trigger::Smooth));
|
||||||
|
|
||||||
|
for (std::vector<std::string>::const_iterator i = stretch_mode_strings.begin(); i != stretch_mode_strings.end(); ++i) {
|
||||||
|
if (i->length() > longest_stretch_mode.length()) {
|
||||||
|
longest_stretch_mode = *i;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -799,6 +811,21 @@ TriggerUI::follow_action_to_string (Trigger::FollowAction fa)
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
TriggerUI::stretch_mode_to_string (Trigger::StretchMode sm)
|
||||||
|
{
|
||||||
|
switch (sm) {
|
||||||
|
case Trigger::Crisp:
|
||||||
|
return _("Crisp");
|
||||||
|
case Trigger::Mixed:
|
||||||
|
return _("Mixed");
|
||||||
|
case Trigger::Smooth:
|
||||||
|
return _("Smooth");
|
||||||
|
}
|
||||||
|
/*NOTREACHED*/
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
TriggerPtr
|
TriggerPtr
|
||||||
TriggerUI::trigger() const
|
TriggerUI::trigger() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ public:
|
||||||
static ARDOUR::Trigger::FollowAction string_to_follow_action (std::string const &);
|
static ARDOUR::Trigger::FollowAction string_to_follow_action (std::string const &);
|
||||||
static std::string quantize_length_to_string (Temporal::BBT_Offset const &);
|
static std::string quantize_length_to_string (Temporal::BBT_Offset const &);
|
||||||
static std::string launch_style_to_string (ARDOUR::Trigger::LaunchStyle);
|
static std::string launch_style_to_string (ARDOUR::Trigger::LaunchStyle);
|
||||||
|
static std::string stretch_mode_to_string (ARDOUR::Trigger::StretchMode);
|
||||||
|
|
||||||
static std::vector<std::string> follow_strings;
|
static std::vector<std::string> follow_strings;
|
||||||
static std::string longest_follow;
|
static std::string longest_follow;
|
||||||
|
|
@ -56,6 +57,8 @@ public:
|
||||||
static std::string longest_quantize;
|
static std::string longest_quantize;
|
||||||
static std::vector<std::string> launch_strings;
|
static std::vector<std::string> launch_strings;
|
||||||
static std::string longest_launch;
|
static std::string longest_launch;
|
||||||
|
static std::vector<std::string> stretch_mode_strings;
|
||||||
|
static std::string longest_stretch_mode;
|
||||||
|
|
||||||
static void setup_actions_and_bindings ();
|
static void setup_actions_and_bindings ();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue