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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ardour_gtk_trigger_ui_h__
|
|
|
|
#define __ardour_gtk_trigger_ui_h__
|
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
#include "gtkmm/colorselection.h"
|
|
|
|
|
2021-12-30 11:53:17 -05:00
|
|
|
#include "gtkmm2ext/actions.h"
|
|
|
|
#include "gtkmm2ext/bindings.h"
|
|
|
|
|
2021-09-07 00:59:52 -04:00
|
|
|
#include "ardour/triggerbox.h"
|
2021-12-14 11:40:25 -05:00
|
|
|
#include "widgets/ardour_button.h"
|
|
|
|
#include "widgets/slider_controller.h"
|
2021-12-29 12:20:41 -05:00
|
|
|
#include "widgets/frame.h"
|
2021-09-07 00:59:52 -04:00
|
|
|
|
2021-12-30 13:10:50 -05:00
|
|
|
namespace Gtk
|
|
|
|
{
|
|
|
|
class FileChooserDialog;
|
|
|
|
class Menu;
|
|
|
|
}
|
|
|
|
|
2022-01-30 20:00:29 -05:00
|
|
|
class TriggerJumpDialog;
|
|
|
|
|
2021-12-30 10:05:24 -05:00
|
|
|
class TriggerUI
|
2021-09-07 00:59:52 -04:00
|
|
|
{
|
2021-12-30 10:05:24 -05:00
|
|
|
public:
|
2021-11-30 13:14:19 -05:00
|
|
|
TriggerUI ();
|
2021-12-30 22:46:38 -05:00
|
|
|
virtual ~TriggerUI ();
|
2021-09-07 00:59:52 -04:00
|
|
|
|
2021-12-24 16:13:36 -05:00
|
|
|
void set_trigger (ARDOUR::TriggerReference);
|
2021-11-29 20:21:04 -05:00
|
|
|
|
2022-01-30 20:00:29 -05:00
|
|
|
virtual void on_trigger_set () {}
|
2021-12-30 13:10:50 -05:00
|
|
|
virtual void on_trigger_changed (PBD::PropertyChange const& ) = 0;
|
2021-12-30 10:05:24 -05:00
|
|
|
|
2022-01-31 15:59:24 -05:00
|
|
|
static std::string follow_action_to_string (ARDOUR::FollowAction const &, bool with_targets=false);
|
2021-12-23 23:17:06 -05:00
|
|
|
static std::string quantize_length_to_string (Temporal::BBT_Offset const &);
|
|
|
|
static std::string launch_style_to_string (ARDOUR::Trigger::LaunchStyle);
|
2022-01-11 17:27:44 -05:00
|
|
|
static std::string stretch_mode_to_string (ARDOUR::Trigger::StretchMode);
|
2021-12-23 23:17:06 -05:00
|
|
|
|
2021-12-30 11:25:00 -05:00
|
|
|
static std::vector<std::string> follow_strings;
|
|
|
|
static std::string longest_follow;
|
|
|
|
static std::vector<std::string> quantize_strings;
|
|
|
|
static std::string longest_quantize;
|
|
|
|
static std::vector<std::string> launch_strings;
|
|
|
|
static std::string longest_launch;
|
2022-01-11 17:27:44 -05:00
|
|
|
static std::vector<std::string> stretch_mode_strings;
|
|
|
|
static std::string longest_stretch_mode;
|
2021-12-30 11:25:00 -05:00
|
|
|
|
2021-12-30 11:53:17 -05:00
|
|
|
static void setup_actions_and_bindings ();
|
|
|
|
|
2021-12-30 13:10:50 -05:00
|
|
|
ARDOUR::TriggerReference trigger_reference() const { return tref; }
|
|
|
|
ARDOUR::TriggerPtr trigger() const;
|
2021-12-30 21:27:26 -05:00
|
|
|
ARDOUR::TriggerBox& triggerbox() const { return trigger()->box(); }
|
|
|
|
|
|
|
|
void choose_color ();
|
2022-02-08 17:08:23 -05:00
|
|
|
void choose_patch ();
|
2022-01-06 17:28:57 -05:00
|
|
|
void choose_sample (bool allow_multiple_select);
|
2021-12-30 21:27:26 -05:00
|
|
|
void sample_chosen (int r);
|
2021-12-30 13:10:50 -05:00
|
|
|
|
2021-12-30 22:25:06 -05:00
|
|
|
void launch_context_menu ();
|
|
|
|
void follow_context_menu ();
|
|
|
|
void context_menu ();
|
|
|
|
|
2022-01-30 20:00:29 -05:00
|
|
|
void edit_jump_done (int r, TriggerJumpDialog* d);
|
2022-01-31 15:59:24 -05:00
|
|
|
void edit_jump(bool right_fa);
|
2022-01-30 20:00:29 -05:00
|
|
|
|
2022-01-19 17:50:47 -05:00
|
|
|
void set_follow_action (ARDOUR::FollowAction const &);
|
2021-12-30 22:25:06 -05:00
|
|
|
void set_launch_style (ARDOUR::Trigger::LaunchStyle);
|
|
|
|
void set_quantization (Temporal::BBT_Offset const&);
|
|
|
|
void set_from_selection ();
|
|
|
|
|
|
|
|
void toggle_trigger_isolated ();
|
|
|
|
void clear_trigger ();
|
|
|
|
void edit_trigger ();
|
|
|
|
|
2021-12-30 10:05:24 -05:00
|
|
|
private:
|
2021-12-30 13:10:50 -05:00
|
|
|
void trigger_changed (PBD::PropertyChange const& ); //calls on_trigger_changed to subclasses
|
2021-12-30 10:05:24 -05:00
|
|
|
|
2021-12-30 11:53:17 -05:00
|
|
|
/* Actions for Triggers: accessed via ardour_ui and shortcuts and lua */
|
|
|
|
static Glib::RefPtr<Gtk::ActionGroup> trigger_actions;
|
2022-01-31 19:32:36 -05:00
|
|
|
static void trigger_cue (int32_t);
|
2021-12-30 11:53:17 -05:00
|
|
|
static Gtkmm2ext::Bindings* bindings;
|
|
|
|
static void load_bindings ();
|
|
|
|
static void register_actions ();
|
|
|
|
|
2021-12-30 10:05:24 -05:00
|
|
|
protected:
|
|
|
|
/* all of this for name editing ... */
|
2021-12-29 12:20:41 -05:00
|
|
|
bool namebox_button_press (GdkEventButton*);
|
|
|
|
bool start_rename ();
|
|
|
|
void end_rename (bool);
|
|
|
|
void entry_changed ();
|
|
|
|
void entry_activated ();
|
|
|
|
bool entry_focus_in (GdkEventFocus*);
|
|
|
|
bool entry_focus_out (GdkEventFocus*);
|
|
|
|
bool entry_key_press (GdkEventKey*);
|
|
|
|
bool entry_key_release (GdkEventKey*);
|
|
|
|
bool entry_button_press (GdkEventButton*);
|
|
|
|
void disconnect_entry_signals ();
|
|
|
|
std::list<sigc::connection> _entry_connections;
|
|
|
|
bool _renaming;
|
|
|
|
Gtk::Entry _nameentry;
|
|
|
|
Gtk::Label _name_label;
|
|
|
|
Gtk::EventBox _namebox;
|
|
|
|
ArdourWidgets::Frame _name_frame;
|
|
|
|
|
2021-12-30 22:25:06 -05:00
|
|
|
Gtk::FileChooserDialog* _file_chooser;
|
|
|
|
sigc::connection _file_chooser_connection;
|
|
|
|
|
|
|
|
Gtk::Menu* _launch_context_menu;
|
|
|
|
Gtk::Menu* _follow_context_menu;
|
|
|
|
Gtk::Menu* _context_menu;
|
|
|
|
bool _ignore_menu_action;
|
2021-12-30 08:46:11 -05:00
|
|
|
|
2021-12-30 22:25:06 -05:00
|
|
|
Gtk::ColorSelectionDialog _color_dialog;
|
2021-12-30 10:05:24 -05:00
|
|
|
|
2021-12-30 13:10:50 -05:00
|
|
|
void trigger_swap (uint32_t);
|
|
|
|
PBD::ScopedConnection trigger_swap_connection;
|
|
|
|
|
2021-12-30 10:05:24 -05:00
|
|
|
ARDOUR::TriggerReference tref;
|
2022-01-11 10:45:46 -05:00
|
|
|
PBD::ScopedConnectionList trigger_connections;
|
2021-12-30 10:05:24 -05:00
|
|
|
};
|
|
|
|
|
2021-09-10 15:05:19 -04:00
|
|
|
|
2021-09-07 00:59:52 -04:00
|
|
|
|
|
|
|
#endif /* __ardour_gtk_trigger_ui_h__ */
|