2021-09-07 00:59:52 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2021 Paul Davis <paul@linuxaudiosystems.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.
|
|
|
|
*/
|
|
|
|
|
2022-11-16 20:15:55 -05:00
|
|
|
#include <glib/gstdio.h>
|
|
|
|
|
2021-12-14 10:36:43 -05:00
|
|
|
#include <gtkmm/alignment.h>
|
2021-09-07 00:59:52 -04:00
|
|
|
#include <gtkmm/filechooserdialog.h>
|
|
|
|
#include <gtkmm/menu.h>
|
|
|
|
#include <gtkmm/menuitem.h>
|
|
|
|
#include <gtkmm/stock.h>
|
|
|
|
|
|
|
|
#include "pbd/compose.h"
|
|
|
|
#include "pbd/convert.h"
|
|
|
|
|
2021-12-29 12:21:44 -05:00
|
|
|
#include "pbd/basename.h"
|
|
|
|
#include "pbd/file_utils.h"
|
|
|
|
#include "pbd/pathexpand.h"
|
|
|
|
#include "pbd/search_path.h"
|
2021-12-30 22:25:06 -05:00
|
|
|
#include "pbd/unwind.h"
|
2021-12-29 12:21:44 -05:00
|
|
|
|
2022-01-06 02:23:49 -05:00
|
|
|
#include "ardour/audioengine.h"
|
2021-12-29 12:21:44 -05:00
|
|
|
#include "ardour/directory_names.h"
|
|
|
|
#include "ardour/filesystem_paths.h"
|
2021-09-07 00:59:52 -04:00
|
|
|
#include "ardour/region.h"
|
|
|
|
#include "ardour/triggerbox.h"
|
|
|
|
|
2022-08-10 23:11:52 -04:00
|
|
|
#include "gtkmm2ext/colors.h"
|
|
|
|
|
2021-12-02 00:51:18 -05:00
|
|
|
#include "slot_properties_box.h"
|
|
|
|
|
2021-09-07 00:59:52 -04:00
|
|
|
#include "ardour_ui.h"
|
|
|
|
#include "gui_thread.h"
|
2021-12-29 12:20:41 -05:00
|
|
|
#include "keyboard.h"
|
2021-12-30 22:25:06 -05:00
|
|
|
#include "public_editor.h"
|
|
|
|
#include "region_view.h"
|
2022-01-30 20:00:29 -05:00
|
|
|
#include "trigger_jump_dialog.h"
|
2021-09-07 00:59:52 -04:00
|
|
|
#include "ui_config.h"
|
|
|
|
|
2022-01-30 20:00:29 -05:00
|
|
|
#include "trigger_ui.h"
|
|
|
|
|
2021-09-27 10:28:10 -04:00
|
|
|
#include "pbd/i18n.h"
|
|
|
|
|
2021-09-07 00:59:52 -04:00
|
|
|
using namespace ARDOUR;
|
2021-09-10 15:05:19 -04:00
|
|
|
using namespace ArdourWidgets;
|
2021-09-07 00:59:52 -04:00
|
|
|
using namespace Gtkmm2ext;
|
|
|
|
using namespace PBD;
|
2021-09-29 13:20:44 -04:00
|
|
|
using namespace Temporal;
|
2021-09-07 00:59:52 -04:00
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
std::vector<std::string> TriggerUI::follow_strings;
|
|
|
|
std::string TriggerUI::longest_follow;
|
|
|
|
std::vector<std::string> TriggerUI::quantize_strings;
|
|
|
|
std::string TriggerUI::longest_quantize;
|
|
|
|
std::vector<std::string> TriggerUI::launch_strings;
|
|
|
|
std::string TriggerUI::longest_launch;
|
2022-01-11 17:27:44 -05:00
|
|
|
std::vector<std::string> TriggerUI::stretch_mode_strings;
|
|
|
|
std::string TriggerUI::longest_stretch_mode;
|
2021-09-10 15:05:19 -04:00
|
|
|
|
2021-12-24 16:13:36 -05:00
|
|
|
TriggerUI::TriggerUI ()
|
2021-12-29 12:20:41 -05:00
|
|
|
: _renaming (false)
|
2022-01-06 18:50:26 -05:00
|
|
|
, _file_chooser (0)
|
2021-12-30 22:25:06 -05:00
|
|
|
, _launch_context_menu (0)
|
|
|
|
, _follow_context_menu (0)
|
|
|
|
, _context_menu (0)
|
|
|
|
, _ignore_menu_action (false)
|
2023-10-05 10:17:33 -04:00
|
|
|
, _color_dialog (nullptr)
|
2021-09-07 00:59:52 -04:00
|
|
|
{
|
2021-12-30 11:25:00 -05:00
|
|
|
if (follow_strings.empty()) {
|
2022-01-19 17:50:47 -05:00
|
|
|
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::None)));
|
|
|
|
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::Stop)));
|
|
|
|
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::Again)));
|
|
|
|
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::ForwardTrigger)));
|
|
|
|
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::ReverseTrigger)));
|
|
|
|
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::FirstTrigger)));
|
|
|
|
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::LastTrigger)));
|
2022-01-20 13:01:14 -05:00
|
|
|
follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::JumpTrigger)));
|
2021-12-30 11:25:00 -05:00
|
|
|
|
|
|
|
for (std::vector<std::string>::const_iterator i = follow_strings.begin(); i != follow_strings.end(); ++i) {
|
|
|
|
if (i->length() > longest_follow.length()) {
|
|
|
|
longest_follow = *i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
launch_strings.push_back (launch_style_to_string (Trigger::OneShot));
|
2022-01-03 19:45:13 -05:00
|
|
|
launch_strings.push_back (launch_style_to_string (Trigger::ReTrigger));
|
2021-12-30 11:25:00 -05:00
|
|
|
launch_strings.push_back (launch_style_to_string (Trigger::Gate));
|
|
|
|
launch_strings.push_back (launch_style_to_string (Trigger::Toggle));
|
|
|
|
launch_strings.push_back (launch_style_to_string (Trigger::Repeat));
|
|
|
|
|
|
|
|
for (std::vector<std::string>::const_iterator i = launch_strings.begin(); i != launch_strings.end(); ++i) {
|
|
|
|
if (i->length() > longest_launch.length()) {
|
|
|
|
longest_launch = *i;
|
|
|
|
}
|
|
|
|
}
|
2022-01-11 17:27:44 -05:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2021-12-30 11:25:00 -05:00
|
|
|
}
|
2021-11-29 20:21:04 -05:00
|
|
|
}
|
|
|
|
|
2021-12-30 10:05:24 -05:00
|
|
|
TriggerUI::~TriggerUI()
|
2021-11-29 20:21:04 -05:00
|
|
|
{
|
2023-10-05 10:17:33 -04:00
|
|
|
delete _color_dialog;
|
2021-12-30 13:10:50 -05:00
|
|
|
trigger_swap_connection.disconnect ();
|
2022-01-11 10:45:46 -05:00
|
|
|
trigger_connections.drop_connections ();
|
2021-11-29 20:21:04 -05:00
|
|
|
}
|
|
|
|
|
2021-12-30 13:10:50 -05:00
|
|
|
void
|
|
|
|
TriggerUI::trigger_swap (uint32_t n)
|
|
|
|
{
|
|
|
|
if (n != tref.slot) {
|
|
|
|
/* some other slot in the same box got swapped. we don't care */
|
|
|
|
return;
|
|
|
|
}
|
2022-01-11 10:45:46 -05:00
|
|
|
trigger_connections.drop_connections ();
|
|
|
|
|
2022-02-21 17:01:36 -05:00
|
|
|
trigger()->PropertyChanged.connect (trigger_connections, invalidator (*this), boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context ());
|
|
|
|
tref.box->PropertyChanged.connect (trigger_connections, invalidator (*this), boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context ());
|
2022-01-11 10:45:46 -05:00
|
|
|
|
2021-12-30 13:10:50 -05:00
|
|
|
trigger_changed (Properties::name);
|
|
|
|
}
|
|
|
|
|
2021-12-30 08:46:11 -05:00
|
|
|
void
|
|
|
|
TriggerUI::choose_color ()
|
|
|
|
{
|
2023-10-05 10:17:33 -04:00
|
|
|
if (!_color_dialog) {
|
|
|
|
_color_dialog = new Gtk::ColorSelectionDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
_color_dialog->get_color_selection()->set_has_opacity_control (false);
|
|
|
|
_color_dialog->get_color_selection()->set_has_palette (true);
|
|
|
|
_color_dialog->get_ok_button()->signal_clicked().connect (sigc::bind (sigc::mem_fun (_color_dialog, &Gtk::Dialog::response), Gtk::RESPONSE_ACCEPT));
|
|
|
|
_color_dialog->get_cancel_button()->signal_clicked().connect (sigc::bind (sigc::mem_fun (_color_dialog, &Gtk::Dialog::response), Gtk::RESPONSE_CANCEL));
|
2021-12-30 08:46:11 -05:00
|
|
|
|
2022-08-10 23:11:52 -04:00
|
|
|
Gdk::Color c = Gtkmm2ext::gdk_color_from_rgba(trigger()->color());
|
2021-12-30 08:46:11 -05:00
|
|
|
|
2023-10-05 10:17:33 -04:00
|
|
|
_color_dialog->get_color_selection()->set_previous_color (c);
|
|
|
|
_color_dialog->get_color_selection()->set_current_color (c);
|
2021-12-30 08:46:11 -05:00
|
|
|
|
2023-10-05 10:17:33 -04:00
|
|
|
switch (_color_dialog->run()) {
|
2021-12-30 08:46:11 -05:00
|
|
|
case Gtk::RESPONSE_ACCEPT: {
|
2023-10-05 10:17:33 -04:00
|
|
|
c = _color_dialog->get_color_selection()->get_current_color();
|
2022-08-10 23:11:52 -04:00
|
|
|
color_t ct = Gtkmm2ext::gdk_color_to_rgba(c);
|
2021-12-30 08:46:11 -05:00
|
|
|
trigger()->set_color(ct);
|
|
|
|
} break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2023-10-05 10:17:33 -04:00
|
|
|
_color_dialog->hide ();
|
2021-12-30 08:46:11 -05:00
|
|
|
}
|
|
|
|
|
2021-12-29 12:21:44 -05:00
|
|
|
void
|
2022-01-06 17:28:57 -05:00
|
|
|
TriggerUI::choose_sample (bool allow_multiple_select)
|
2021-12-29 12:21:44 -05:00
|
|
|
{
|
|
|
|
if (!_file_chooser) {
|
2022-07-13 18:06:48 -04:00
|
|
|
_file_chooser = new Gtk::FileChooserDialog (_("Select file to load into slot"), Gtk::FILE_CHOOSER_ACTION_OPEN);
|
2021-12-29 12:21:44 -05:00
|
|
|
_file_chooser->add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
|
|
|
_file_chooser->add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK);
|
|
|
|
|
|
|
|
/* for newbies, start in the bundled media folder */
|
|
|
|
Searchpath spath (ardour_data_search_path ());
|
|
|
|
spath.add_subdirectory_to_paths (media_dir_name);
|
|
|
|
for (auto const& f : spath) {
|
|
|
|
if (Glib::file_test (f, Glib::FILE_TEST_IS_DIR | Glib::FILE_TEST_EXISTS)) {
|
|
|
|
_file_chooser->set_current_folder (f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO: add various shortcut paths to user's media folders
|
|
|
|
|
|
|
|
_file_chooser->add_shortcut_folder_uri(Glib::build_filename (user_config_directory (), media_dir_name);
|
|
|
|
|
|
|
|
Searchpath cpath (Config->get_sample_lib_path ());
|
|
|
|
for (auto const& f : cpath) {
|
|
|
|
_file_chooser->add_shortcut_folder_uri (f);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
try {
|
|
|
|
/* add_shortcut_folder throws an exception if the folder being added already has a shortcut */
|
|
|
|
_file_chooser->add_shortcut_folder_uri("file:///Library/GarageBand/Apple Loops");
|
|
|
|
_file_chooser->add_shortcut_folder_uri("file:///Library/Audio/Apple Loops");
|
|
|
|
_file_chooser->add_shortcut_folder_uri("file:///Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files");
|
|
|
|
}
|
|
|
|
catch (Glib::Error & e) {
|
|
|
|
std::cerr << "sfdb.add_shortcut_folder() threw Glib::Error " << e.what() << std::endl;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-01-06 17:28:57 -05:00
|
|
|
_file_chooser->set_select_multiple (allow_multiple_select);
|
|
|
|
|
2021-12-29 12:21:44 -05:00
|
|
|
_file_chooser_connection.disconnect ();
|
2022-01-16 17:04:31 -05:00
|
|
|
_file_chooser_connection = _file_chooser->signal_response ().connect (sigc::mem_fun (*this, &TriggerUI::sample_chosen));
|
2021-12-29 12:21:44 -05:00
|
|
|
|
|
|
|
_file_chooser->present ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerUI::sample_chosen (int response)
|
|
|
|
{
|
|
|
|
_file_chooser->hide ();
|
|
|
|
|
|
|
|
switch (response) {
|
|
|
|
case Gtk::RESPONSE_OK:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::list<std::string> paths = _file_chooser->get_filenames ();
|
|
|
|
|
|
|
|
for (std::list<std::string>::iterator s = paths.begin (); s != paths.end (); ++s) {
|
2021-12-30 21:27:26 -05:00
|
|
|
trigger()->box().set_from_path (trigger()->index(), *s);
|
2021-12-29 12:21:44 -05:00
|
|
|
}
|
|
|
|
}
|
2021-12-29 12:20:41 -05:00
|
|
|
|
|
|
|
/* ****************************************************************************/
|
|
|
|
|
|
|
|
bool
|
|
|
|
TriggerUI::namebox_button_press (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
if (_renaming) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if ((ev->button == 1 && ev->type == GDK_2BUTTON_PRESS) || Keyboard::is_edit_event (ev)) {
|
|
|
|
start_rename ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TriggerUI::start_rename ()
|
|
|
|
{
|
|
|
|
if (_renaming) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
assert (_entry_connections.empty ());
|
|
|
|
|
|
|
|
GtkRequisition r (_name_label.size_request ());
|
|
|
|
_nameentry.set_size_request (r.width, -1);
|
|
|
|
_nameentry.set_text (trigger()->name ());
|
|
|
|
_namebox.remove ();
|
|
|
|
_namebox.add (_nameentry);
|
|
|
|
_nameentry.show ();
|
|
|
|
_nameentry.grab_focus ();
|
|
|
|
_nameentry.add_modal_grab ();
|
|
|
|
_renaming = true;
|
|
|
|
|
2022-01-16 17:04:31 -05:00
|
|
|
_entry_connections.push_back (_nameentry.signal_changed().connect (sigc::mem_fun (*this, &TriggerUI::entry_changed)));
|
|
|
|
_entry_connections.push_back (_nameentry.signal_activate().connect (sigc::mem_fun (*this, &TriggerUI::entry_activated)));
|
|
|
|
_entry_connections.push_back (_nameentry.signal_key_press_event().connect (sigc::mem_fun (*this, &TriggerUI::entry_key_press), false));
|
|
|
|
_entry_connections.push_back (_nameentry.signal_key_release_event().connect (sigc::mem_fun (*this, &TriggerUI::entry_key_release), false));
|
|
|
|
_entry_connections.push_back (_nameentry.signal_button_press_event ().connect (sigc::mem_fun (*this, &TriggerUI::entry_button_press), false));
|
|
|
|
_entry_connections.push_back (_nameentry.signal_focus_in_event ().connect (sigc::mem_fun (*this, &TriggerUI::entry_focus_in)));
|
|
|
|
_entry_connections.push_back (_nameentry.signal_focus_out_event ().connect (sigc::mem_fun (*this, &TriggerUI::entry_focus_out)));
|
2021-12-29 12:20:41 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerUI::end_rename (bool ignore_change)
|
|
|
|
{
|
|
|
|
if (!_renaming) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
std::string result = _nameentry.get_text ();
|
|
|
|
disconnect_entry_signals ();
|
|
|
|
_nameentry.remove_modal_grab ();
|
|
|
|
_namebox.remove ();
|
|
|
|
_namebox.add (_name_label);
|
|
|
|
_name_label.show ();
|
|
|
|
_renaming = false;
|
|
|
|
|
|
|
|
if (ignore_change) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
trigger()->set_name (result);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerUI::entry_changed ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerUI::entry_activated ()
|
|
|
|
{
|
|
|
|
end_rename (false);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TriggerUI::entry_focus_in (GdkEventFocus*)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TriggerUI::entry_focus_out (GdkEventFocus*)
|
|
|
|
{
|
|
|
|
end_rename (false);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TriggerUI::entry_button_press (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
|
|
|
return false;
|
|
|
|
} else if (Gtkmm2ext::event_inside_widget_window (_namebox, (GdkEvent*) ev)) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
end_rename (false);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TriggerUI::entry_key_press (GdkEventKey* ev)
|
|
|
|
{
|
|
|
|
switch (ev->keyval) {
|
|
|
|
case GDK_Escape:
|
|
|
|
/* fallthrough */
|
|
|
|
case GDK_ISO_Left_Tab:
|
|
|
|
/* fallthrough */
|
|
|
|
case GDK_Tab:
|
|
|
|
/* fallthrough */
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TriggerUI::entry_key_release (GdkEventKey* ev)
|
|
|
|
{
|
|
|
|
switch (ev->keyval) {
|
|
|
|
case GDK_Escape:
|
|
|
|
end_rename (true);
|
|
|
|
return true;
|
|
|
|
case GDK_ISO_Left_Tab:
|
|
|
|
end_rename (false);
|
|
|
|
// EditNextName (this, false); /* TODO */
|
|
|
|
return true;
|
|
|
|
case GDK_Tab:
|
|
|
|
end_rename (false);
|
|
|
|
// EditNextName (this, true); /* TODO */
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerUI::disconnect_entry_signals ()
|
|
|
|
{
|
|
|
|
for (std::list<sigc::connection>::iterator i = _entry_connections.begin(); i != _entry_connections.end(); ++i) {
|
|
|
|
i->disconnect ();
|
|
|
|
}
|
|
|
|
_entry_connections.clear ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ****************************************************************************/
|
|
|
|
|
2021-12-30 22:25:06 -05:00
|
|
|
void
|
|
|
|
TriggerUI::context_menu ()
|
|
|
|
{
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace Gtk::Menu_Helpers;
|
|
|
|
using namespace Temporal;
|
|
|
|
|
|
|
|
delete _context_menu;
|
|
|
|
|
|
|
|
_context_menu = new Menu;
|
|
|
|
MenuList& items = _context_menu->items ();
|
|
|
|
_context_menu->set_name ("ArdourContextMenu");
|
|
|
|
|
2022-03-17 09:57:16 -04:00
|
|
|
items.push_back (MenuElem (_("Load..."), sigc::bind(sigc::mem_fun (*this, (&TriggerUI::choose_sample)), true)));
|
2021-12-30 22:25:06 -05:00
|
|
|
items.push_back (SeparatorElem());
|
|
|
|
items.push_back (MenuElem (_("Color..."), sigc::mem_fun (*this, &TriggerUI::choose_color)));
|
|
|
|
items.push_back (MenuElem (_("Clear"), sigc::mem_fun (*this, &TriggerUI::clear_trigger)));
|
2022-10-21 00:08:00 -04:00
|
|
|
items.push_back (SeparatorElem());
|
|
|
|
items.push_back (MenuElem (_("MIDI Learn"), sigc::mem_fun (*this, &TriggerUI::trigger_midi_learn)));
|
|
|
|
items.push_back (MenuElem (_("MIDI un-Learn"), sigc::mem_fun (*this, &TriggerUI::trigger_midi_unlearn)));
|
2021-12-30 22:25:06 -05:00
|
|
|
|
2022-02-08 17:08:23 -05:00
|
|
|
|
2022-10-16 18:02:21 -04:00
|
|
|
_context_menu->popup (3, gtk_get_current_event_time ());
|
2021-12-30 22:25:06 -05:00
|
|
|
}
|
|
|
|
|
2022-10-21 00:08:00 -04:00
|
|
|
void
|
|
|
|
TriggerUI::trigger_midi_learn ()
|
|
|
|
{
|
|
|
|
if (!trigger()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
tref.box->begin_midi_learn (trigger()->index());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerUI::trigger_midi_unlearn ()
|
|
|
|
{
|
|
|
|
tref.box->midi_unlearn (trigger()->index());
|
|
|
|
}
|
|
|
|
|
2021-12-30 22:25:06 -05:00
|
|
|
void
|
|
|
|
TriggerUI::launch_context_menu ()
|
|
|
|
{
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace Gtk::Menu_Helpers;
|
|
|
|
using namespace Temporal;
|
|
|
|
|
|
|
|
delete _launch_context_menu;
|
2021-12-29 12:20:41 -05:00
|
|
|
|
2021-12-30 22:25:06 -05:00
|
|
|
_launch_context_menu = new Menu;
|
|
|
|
MenuList& items = _launch_context_menu->items ();
|
|
|
|
_launch_context_menu->set_name ("ArdourContextMenu");
|
|
|
|
|
|
|
|
RadioMenuItem::Group lagroup;
|
|
|
|
RadioMenuItem::Group qgroup;
|
|
|
|
|
|
|
|
Menu* launch_menu = manage (new Menu);
|
|
|
|
MenuList& litems = launch_menu->items ();
|
|
|
|
|
|
|
|
litems.push_back (RadioMenuElem (lagroup, TriggerUI::launch_style_to_string(Trigger::OneShot), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_launch_style), Trigger::OneShot)));
|
|
|
|
if (trigger ()->launch_style () == Trigger::OneShot) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&litems.back ())->set_active (true);
|
|
|
|
}
|
2022-01-03 19:45:13 -05:00
|
|
|
litems.push_back (RadioMenuElem (lagroup, TriggerUI::launch_style_to_string(Trigger::ReTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_launch_style), Trigger::ReTrigger)));
|
|
|
|
if (trigger ()->launch_style () == Trigger::ReTrigger) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&litems.back ())->set_active (true);
|
|
|
|
}
|
2021-12-30 22:25:06 -05:00
|
|
|
litems.push_back (RadioMenuElem (lagroup, TriggerUI::launch_style_to_string(Trigger::Gate), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_launch_style), Trigger::Gate)));
|
|
|
|
if (trigger ()->launch_style () == Trigger::Gate) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&litems.back ())->set_active (true);
|
|
|
|
}
|
|
|
|
litems.push_back (RadioMenuElem (lagroup, TriggerUI::launch_style_to_string(Trigger::Toggle), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_launch_style), Trigger::Toggle)));
|
|
|
|
if (trigger ()->launch_style () == Trigger::Toggle) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&litems.back ())->set_active (true);
|
|
|
|
}
|
|
|
|
litems.push_back (RadioMenuElem (lagroup, TriggerUI::launch_style_to_string(Trigger::Repeat), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_launch_style), Trigger::Repeat)));
|
|
|
|
if (trigger ()->launch_style () == Trigger::Repeat) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&litems.back ())->set_active (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
Menu* quant_menu = manage (new Menu);
|
|
|
|
MenuList& qitems = quant_menu->items ();
|
|
|
|
|
|
|
|
BBT_Offset b;
|
|
|
|
|
|
|
|
#if TRIGGER_PAGE_GLOBAL_QUANTIZATION_IS_IMPLEMENTED
|
|
|
|
bool success;
|
|
|
|
Beats grid_beats (PublicEditor::instance ().get_grid_type_as_beats (success, timepos_t (0)));
|
|
|
|
if (success) {
|
|
|
|
b = BBT_Offset (0, grid_beats.get_beats (), grid_beats.get_ticks ());
|
|
|
|
qitems.push_back (RadioMenuElem (qgroup, _("Main Grid"), sigc::bind(sigc::mem_fun (*this, &TriggerBoxUI::set_quantization), b)));
|
|
|
|
/* can't mark this active because the current trigger quant setting may just a specific setting below */
|
|
|
|
/* XXX HOW TO GET THIS TO FOLLOW GRID CHANGES (which are GUI only) */
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-01-07 09:51:18 -05:00
|
|
|
b = BBT_Offset (4, 0, 0);
|
|
|
|
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b)));
|
|
|
|
if (trigger ()->quantization () == b) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
|
|
|
|
}
|
|
|
|
b = BBT_Offset (2, 0, 0);
|
2021-12-30 22:25:06 -05:00
|
|
|
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b)));
|
|
|
|
if (trigger ()->quantization () == b) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
|
|
|
|
}
|
2022-01-07 09:51:18 -05:00
|
|
|
b = BBT_Offset (1, 0, 0);
|
2021-12-30 22:25:06 -05:00
|
|
|
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b)));
|
|
|
|
if (trigger ()->quantization () == b) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
|
|
|
|
}
|
|
|
|
b = BBT_Offset (0, 2, 0);
|
|
|
|
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b)));
|
|
|
|
if (trigger ()->quantization () == b) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
|
|
|
|
}
|
|
|
|
b = BBT_Offset (0, 1, 0);
|
|
|
|
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b)));
|
|
|
|
if (trigger ()->quantization () == b) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
|
|
|
|
}
|
|
|
|
b = BBT_Offset (0, 0, ticks_per_beat / 2);
|
|
|
|
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b)));
|
|
|
|
if (trigger ()->quantization () == b) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
|
|
|
|
}
|
|
|
|
b = BBT_Offset (0, 0, ticks_per_beat / 4);
|
|
|
|
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b)));
|
|
|
|
if (trigger ()->quantization () == b) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
|
|
|
|
}
|
|
|
|
b = BBT_Offset (0, 0, ticks_per_beat / 8);
|
|
|
|
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b)));
|
|
|
|
if (trigger ()->quantization () == b) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
|
|
|
|
}
|
|
|
|
b = BBT_Offset (0, 0, ticks_per_beat / 16);
|
|
|
|
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b)));
|
|
|
|
if (trigger ()->quantization () == b) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
|
|
|
|
}
|
2022-01-07 19:06:31 -05:00
|
|
|
b = BBT_Offset (-1, 0, 0);
|
|
|
|
qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b)));
|
|
|
|
if (trigger ()->quantization () == b) {
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
|
|
|
|
}
|
2021-12-30 22:25:06 -05:00
|
|
|
|
|
|
|
items.push_back (MenuElem (_("Launch Style..."), *launch_menu));
|
|
|
|
items.push_back (MenuElem (_("Quantization..."), *quant_menu));
|
|
|
|
|
|
|
|
items.push_back (CheckMenuElem (_("Cue Isolate"), sigc::mem_fun (*this, &TriggerUI::toggle_trigger_isolated)));
|
2022-01-25 20:07:13 -05:00
|
|
|
if (trigger ()->cue_isolated ()) {
|
2021-12-30 22:25:06 -05:00
|
|
|
PBD::Unwinder<bool> uw (_ignore_menu_action, true);
|
|
|
|
dynamic_cast<Gtk::CheckMenuItem*> (&items.back ())->set_active (true);
|
|
|
|
}
|
|
|
|
|
2023-10-31 15:10:49 -04:00
|
|
|
_launch_context_menu->popup (3, gtk_get_current_event_time ());
|
2021-12-30 22:25:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-10-31 15:10:49 -04:00
|
|
|
TriggerUI::follow_context_menu (GdkEventButton* ev)
|
2021-12-30 22:25:06 -05:00
|
|
|
{
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace Gtk::Menu_Helpers;
|
|
|
|
using namespace Temporal;
|
|
|
|
|
|
|
|
delete _follow_context_menu;
|
|
|
|
|
|
|
|
_follow_context_menu = new Menu;
|
|
|
|
MenuList& items = _follow_context_menu->items ();
|
|
|
|
_follow_context_menu->set_name ("ArdourContextMenu");
|
|
|
|
|
|
|
|
_ignore_menu_action = true;
|
|
|
|
|
2022-03-19 17:56:28 -04:00
|
|
|
items.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::None))));
|
2022-01-30 20:00:29 -05:00
|
|
|
items.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::Stop))));
|
|
|
|
items.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::Again))));
|
|
|
|
items.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::ForwardTrigger))));
|
|
|
|
items.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::ReverseTrigger))));
|
2022-01-27 14:06:50 -05:00
|
|
|
|
2022-01-21 15:48:28 -05:00
|
|
|
Menu* jump_menu = manage (new Menu);
|
|
|
|
MenuList& jitems = jump_menu->items ();
|
2022-01-31 15:59:24 -05:00
|
|
|
jitems.push_back (MenuElem (_("Multi..."), sigc::bind (sigc::mem_fun (*this, &TriggerUI::edit_jump), false)));
|
2022-10-04 21:55:15 -04:00
|
|
|
for (int i = 0; i < TriggerBox::default_triggers_per_box; i++) {
|
2022-01-21 15:48:28 -05:00
|
|
|
FollowAction jump_fa = (FollowAction::JumpTrigger);
|
|
|
|
jump_fa.targets.set(i);
|
2022-02-11 13:33:43 -05:00
|
|
|
jitems.push_back (MenuElem (cue_marker_name (i), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), jump_fa)));
|
2022-01-21 15:48:28 -05:00
|
|
|
}
|
2022-01-30 20:00:29 -05:00
|
|
|
|
2022-01-31 15:59:24 -05:00
|
|
|
items.push_back (MenuElem (_("Jump"), *jump_menu));
|
2022-01-20 13:01:14 -05:00
|
|
|
|
2021-12-30 22:25:06 -05:00
|
|
|
_ignore_menu_action = false;
|
|
|
|
|
2023-10-31 15:10:49 -04:00
|
|
|
_follow_context_menu->popup (ev->button, ev->time);
|
2021-12-30 22:25:06 -05:00
|
|
|
}
|
|
|
|
|
2022-01-30 20:00:29 -05:00
|
|
|
void
|
2022-01-31 15:59:24 -05:00
|
|
|
TriggerUI::edit_jump (bool right_fa)
|
2022-01-30 20:00:29 -05:00
|
|
|
{
|
|
|
|
if (_ignore_menu_action) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-31 15:59:24 -05:00
|
|
|
TriggerJumpDialog* d = new TriggerJumpDialog (right_fa);
|
2022-01-30 20:00:29 -05:00
|
|
|
d->set_trigger(tref);
|
|
|
|
d->show_all ();
|
|
|
|
|
|
|
|
d->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &TriggerUI::edit_jump_done), d));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerUI::edit_jump_done (int r, TriggerJumpDialog* d)
|
|
|
|
{
|
|
|
|
d->done (r);
|
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
|
2021-12-30 22:25:06 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
TriggerUI::toggle_trigger_isolated ()
|
|
|
|
{
|
|
|
|
if (_ignore_menu_action) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-25 20:07:13 -05:00
|
|
|
trigger()->set_cue_isolated (!trigger()->cue_isolated ());
|
2021-12-30 22:25:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerUI::clear_trigger ()
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
trigger()->set_region (std::shared_ptr<Region>());
|
2021-12-30 22:25:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerUI::edit_trigger ()
|
|
|
|
{
|
|
|
|
SlotPropertyWindow* tw = static_cast<SlotPropertyWindow*> (trigger()->ui ());
|
|
|
|
|
|
|
|
if (!tw) {
|
|
|
|
tw = new SlotPropertyWindow (TriggerReference (trigger()->box(), trigger()->index()));
|
|
|
|
trigger()->set_ui (tw);
|
|
|
|
}
|
|
|
|
|
|
|
|
tw->present ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2022-01-19 17:50:47 -05:00
|
|
|
TriggerUI::set_follow_action (FollowAction const & fa)
|
2021-12-30 22:25:06 -05:00
|
|
|
{
|
|
|
|
if (_ignore_menu_action) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-25 20:07:13 -05:00
|
|
|
trigger()->set_follow_action0 (fa);
|
2021-12-30 22:25:06 -05:00
|
|
|
trigger()->set_follow_action_probability (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerUI::set_launch_style (Trigger::LaunchStyle ls)
|
|
|
|
{
|
|
|
|
trigger()->set_launch_style (ls);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerUI::set_quantization (Temporal::BBT_Offset const& q)
|
|
|
|
{
|
|
|
|
trigger()->set_quantization (q);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerUI::set_from_selection ()
|
|
|
|
{
|
|
|
|
Selection& selection (PublicEditor::instance ().get_selection ());
|
|
|
|
RegionSelection rselection (selection.regions);
|
|
|
|
|
|
|
|
if (rselection.empty ()) {
|
|
|
|
/* XXX possible message about no selection ? */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int n = trigger()->index();
|
|
|
|
|
|
|
|
for (RegionSelection::iterator r = rselection.begin (); r != rselection.end (); ++r) {
|
|
|
|
trigger()->box().set_from_selection (n, (*r)->region ());
|
|
|
|
++n;
|
|
|
|
}
|
|
|
|
}
|
2021-12-30 10:05:24 -05:00
|
|
|
|
|
|
|
std::string
|
|
|
|
TriggerUI::launch_style_to_string (Trigger::LaunchStyle ls)
|
|
|
|
{
|
|
|
|
switch (ls) {
|
|
|
|
case Trigger::OneShot:
|
2022-01-18 09:14:05 -05:00
|
|
|
return _("Trigger");
|
2022-01-03 19:45:13 -05:00
|
|
|
case Trigger::ReTrigger:
|
|
|
|
return _("Retrigger");
|
2021-12-30 10:05:24 -05:00
|
|
|
case Trigger::Gate:
|
|
|
|
return _("Gate");
|
|
|
|
case Trigger::Toggle:
|
|
|
|
return _("Toggle");
|
|
|
|
case Trigger::Repeat:
|
|
|
|
return _("Repeat");
|
|
|
|
}
|
|
|
|
/*NOTREACHED*/
|
|
|
|
return std::string();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string
|
|
|
|
TriggerUI::quantize_length_to_string (BBT_Offset const & ql)
|
|
|
|
{
|
|
|
|
if (ql < Temporal::BBT_Offset (0, 0, 0)) {
|
|
|
|
/* negative quantization == do not quantize */
|
|
|
|
return _("None");
|
|
|
|
}
|
|
|
|
|
2022-01-07 09:51:18 -05:00
|
|
|
if (ql == BBT_Offset (4, 0, 0)) {
|
|
|
|
return _("4 Bars");
|
|
|
|
} else if (ql == BBT_Offset (2, 0, 0)) {
|
|
|
|
return _("2 Bars");
|
|
|
|
} else if (ql == BBT_Offset (1, 0, 0)) {
|
2021-12-30 10:05:24 -05:00
|
|
|
return _("1 Bar");
|
|
|
|
} else if (ql == BBT_Offset (0, 1, 0)) {
|
|
|
|
return _("1/4");
|
|
|
|
} else if (ql == BBT_Offset (0, 2, 0)) {
|
|
|
|
return _("1/2");
|
|
|
|
} else if (ql == BBT_Offset (0, 4, 0)) {
|
|
|
|
return _("Whole");
|
|
|
|
} else if (ql == BBT_Offset (0, 0,Temporal::ticks_per_beat/2)) {
|
|
|
|
return _("1/8");
|
|
|
|
} else if (ql == BBT_Offset (0, 0,Temporal::ticks_per_beat/4)) {
|
|
|
|
return _("1/16");
|
|
|
|
} else if (ql == BBT_Offset (0, 0,Temporal::ticks_per_beat/8)) {
|
|
|
|
return _("1/32");
|
|
|
|
} else if (ql == BBT_Offset (0, 0,Temporal::ticks_per_beat/16)) {
|
|
|
|
return _("1/64");
|
|
|
|
} else {
|
|
|
|
return "???";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string
|
2022-01-31 15:59:24 -05:00
|
|
|
TriggerUI::follow_action_to_string (FollowAction const & fa, bool with_targets)
|
2021-12-30 10:05:24 -05:00
|
|
|
{
|
2022-01-19 17:50:47 -05:00
|
|
|
switch (fa.type) {
|
|
|
|
case FollowAction::None:
|
2022-03-19 17:56:28 -04:00
|
|
|
return _("None");
|
2022-01-19 17:50:47 -05:00
|
|
|
case FollowAction::Stop:
|
2021-12-30 10:05:24 -05:00
|
|
|
return _("Stop");
|
2022-01-19 17:50:47 -05:00
|
|
|
case FollowAction::Again:
|
2021-12-30 10:05:24 -05:00
|
|
|
return _("Again");
|
2022-01-19 17:50:47 -05:00
|
|
|
case FollowAction::ForwardTrigger:
|
2022-01-02 19:10:18 -05:00
|
|
|
return _("Forward");
|
2022-01-19 17:50:47 -05:00
|
|
|
case FollowAction::ReverseTrigger:
|
2022-01-02 19:10:18 -05:00
|
|
|
return _("Reverse");
|
2022-01-19 17:50:47 -05:00
|
|
|
case FollowAction::FirstTrigger:
|
2021-12-30 10:05:24 -05:00
|
|
|
return _("First");
|
2022-01-19 17:50:47 -05:00
|
|
|
case FollowAction::LastTrigger:
|
2021-12-30 10:05:24 -05:00
|
|
|
return _("Last");
|
2022-01-20 13:01:14 -05:00
|
|
|
case FollowAction::JumpTrigger:
|
2022-01-31 15:59:24 -05:00
|
|
|
if (!with_targets) {
|
|
|
|
return _("Jump");
|
|
|
|
}
|
2021-12-30 10:05:24 -05:00
|
|
|
}
|
2022-01-31 15:59:24 -05:00
|
|
|
|
|
|
|
/* Jump case, and target(s) are desired */
|
|
|
|
if ( fa.targets.count() == 1 ) { //jump to a specific row
|
2022-10-04 21:55:15 -04:00
|
|
|
for (int i = 0; i < TriggerBox::default_triggers_per_box; i++) {
|
2022-01-31 15:59:24 -05:00
|
|
|
if (fa.targets.test(i)) {
|
2022-02-11 13:33:43 -05:00
|
|
|
return string_compose (_("Jump to: %1"), cue_marker_name (i));
|
2022-01-31 15:59:24 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return _("Jump: Multi");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* should never be reached */
|
|
|
|
return "";
|
2021-12-30 10:05:24 -05:00
|
|
|
}
|
|
|
|
|
2022-01-11 17:27:44 -05:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2021-12-24 16:13:36 -05:00
|
|
|
TriggerPtr
|
|
|
|
TriggerUI::trigger() const
|
|
|
|
{
|
|
|
|
return tref.trigger();
|
|
|
|
}
|
|
|
|
|
2021-12-30 10:05:24 -05:00
|
|
|
void
|
2021-12-30 13:10:50 -05:00
|
|
|
TriggerUI::trigger_changed (PropertyChange const& what)
|
2021-12-30 10:05:24 -05:00
|
|
|
{
|
|
|
|
on_trigger_changed(what);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-11-29 20:21:04 -05:00
|
|
|
void
|
2021-12-24 16:13:36 -05:00
|
|
|
TriggerUI::set_trigger (ARDOUR::TriggerReference tr)
|
2021-11-29 20:21:04 -05:00
|
|
|
{
|
2022-01-11 10:45:46 -05:00
|
|
|
trigger_connections.drop_connections();
|
2021-12-30 21:27:26 -05:00
|
|
|
trigger_swap_connection.disconnect();
|
2021-12-30 13:10:50 -05:00
|
|
|
|
2021-12-24 16:13:36 -05:00
|
|
|
tref = tr;
|
2021-09-14 23:38:48 -04:00
|
|
|
|
2022-03-15 09:53:41 -04:00
|
|
|
trigger_changed (TriggerBox::all_trigger_props());
|
2021-09-28 19:45:58 -04:00
|
|
|
|
2022-02-21 17:01:36 -05:00
|
|
|
trigger()->PropertyChanged.connect (trigger_connections, invalidator (*this), boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context());
|
|
|
|
tref.box->PropertyChanged.connect (trigger_connections, invalidator (*this), boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context ());
|
2022-01-11 10:45:46 -05:00
|
|
|
|
2022-02-21 17:01:36 -05:00
|
|
|
tref.box->TriggerSwapped.connect (trigger_swap_connection, invalidator (*this), boost::bind (&TriggerUI::trigger_swap, this, _1), gui_context ());
|
2022-01-30 20:00:29 -05:00
|
|
|
|
|
|
|
on_trigger_set(); //derived classes can do initialization here
|
2021-09-10 15:05:19 -04:00
|
|
|
}
|