Ardour  8.12
trigger_ui.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Paul Davis <paul@linuxaudiosystems.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __ardour_gtk_trigger_ui_h__
20 #define __ardour_gtk_trigger_ui_h__
21 
22 #include "gtkmm/colorselection.h"
23 #include "gtkmm/entry.h"
24 
25 #include "gtkmm2ext/actions.h"
26 #include "gtkmm2ext/bindings.h"
27 
28 #include "ardour/triggerbox.h"
29 #include "widgets/ardour_button.h"
30 #include "widgets/frame.h"
31 
32 namespace Gtk
33 {
34  class FileChooserDialog;
35  class Menu;
36 }
37 
38 class TriggerJumpDialog;
39 
40 class TriggerUI : virtual public sigc::trackable
41 {
42 public:
44  virtual ~TriggerUI ();
45 
47 
48  virtual void on_trigger_set () {}
49  virtual void on_trigger_changed (PBD::PropertyChange const& ) = 0;
50 
51  static std::string follow_action_to_string (ARDOUR::FollowAction const &, bool with_targets=false);
52  static std::string quantize_length_to_string (Temporal::BBT_Offset const &);
55 
56  static std::vector<std::string> follow_strings;
57  static std::string longest_follow;
58  static std::vector<std::string> quantize_strings;
59  static std::string longest_quantize;
60  static std::vector<std::string> launch_strings;
61  static std::string longest_launch;
62  static std::vector<std::string> stretch_mode_strings;
63  static std::string longest_stretch_mode;
64 
66 
69  ARDOUR::TriggerBox& triggerbox() const { return trigger()->box(); }
70 
71  void choose_color ();
72  void choose_sample (bool allow_multiple_select);
73  void sample_chosen (int r);
74 
77  void context_menu ();
78 
80  void edit_jump(bool right_fa);
81 
86 
88  void clear_trigger ();
89  void edit_trigger ();
90 
93 
94 private:
95  void trigger_changed (PBD::PropertyChange const& ); //calls on_trigger_changed to subclasses
96 
97 protected:
98  /* all of this for name editing ... */
100  bool start_rename ();
101  void end_rename (bool);
102  void entry_changed ();
110  std::list<sigc::connection> _entry_connections;
111  bool _renaming;
116 
118  sigc::connection _file_chooser_connection;
119 
124 
126 
127  void trigger_swap (uint32_t);
129 
132 };
133 
134 
135 
136 #endif /* __ardour_gtk_trigger_ui_h__ */
sigc::connection _file_chooser_connection
Definition: trigger_ui.h:118
void choose_sample(bool allow_multiple_select)
Gtk::Label _name_label
Definition: trigger_ui.h:113
static std::string longest_follow
Definition: trigger_ui.h:57
void set_quantization(Temporal::BBT_Offset const &)
virtual ~TriggerUI()
void trigger_changed(PBD::PropertyChange const &)
static std::string longest_launch
Definition: trigger_ui.h:61
void set_launch_style(ARDOUR::Trigger::LaunchStyle)
virtual void on_trigger_set()
Definition: trigger_ui.h:48
void set_follow_action(ARDOUR::FollowAction const &)
Gtk::FileChooserDialog * _file_chooser
Definition: trigger_ui.h:117
bool entry_focus_in(GdkEventFocus *)
static std::string longest_stretch_mode
Definition: trigger_ui.h:63
static std::string stretch_mode_to_string(ARDOUR::Trigger::StretchMode)
void edit_jump_done(int r, TriggerJumpDialog *d)
static std::string launch_style_to_string(ARDOUR::Trigger::LaunchStyle)
bool namebox_button_press(GdkEventButton *)
void trigger_midi_learn()
virtual void on_trigger_changed(PBD::PropertyChange const &)=0
std::list< sigc::connection > _entry_connections
Definition: trigger_ui.h:110
void edit_trigger()
void entry_changed()
bool entry_key_release(GdkEventKey *)
void set_trigger(ARDOUR::TriggerReference)
static void setup_actions_and_bindings()
void trigger_swap(uint32_t)
ARDOUR::TriggerBox & triggerbox() const
Definition: trigger_ui.h:69
void launch_context_menu()
ARDOUR::TriggerPtr trigger() const
bool _renaming
Definition: trigger_ui.h:111
bool entry_focus_out(GdkEventFocus *)
void choose_color()
void follow_context_menu(GdkEventButton *)
void end_rename(bool)
ARDOUR::TriggerReference trigger_reference() const
Definition: trigger_ui.h:67
void set_from_selection()
static std::string quantize_length_to_string(Temporal::BBT_Offset const &)
Gtk::Menu * _launch_context_menu
Definition: trigger_ui.h:120
PBD::ScopedConnectionList trigger_connections
Definition: trigger_ui.h:131
ArdourWidgets::Frame _name_frame
Definition: trigger_ui.h:115
static std::vector< std::string > launch_strings
Definition: trigger_ui.h:60
void context_menu()
void clear_trigger()
static std::string follow_action_to_string(ARDOUR::FollowAction const &, bool with_targets=false)
static std::vector< std::string > stretch_mode_strings
Definition: trigger_ui.h:62
static std::string longest_quantize
Definition: trigger_ui.h:59
Gtk::ColorSelectionDialog * _color_dialog
Definition: trigger_ui.h:125
bool entry_key_press(GdkEventKey *)
void disconnect_entry_signals()
bool entry_button_press(GdkEventButton *)
void edit_jump(bool right_fa)
bool _ignore_menu_action
Definition: trigger_ui.h:123
void trigger_midi_unlearn()
Gtk::Entry _nameentry
Definition: trigger_ui.h:112
static std::vector< std::string > follow_strings
Definition: trigger_ui.h:56
void toggle_trigger_isolated()
PBD::ScopedConnection trigger_swap_connection
Definition: trigger_ui.h:128
Gtk::Menu * _follow_context_menu
Definition: trigger_ui.h:121
ARDOUR::TriggerReference tref
Definition: trigger_ui.h:130
Gtk::Menu * _context_menu
Definition: trigger_ui.h:122
void sample_chosen(int r)
Gtk::EventBox _namebox
Definition: trigger_ui.h:114
bool start_rename()
void entry_activated()
static std::vector< std::string > quantize_strings
Definition: trigger_ui.h:58
std::shared_ptr< Trigger > TriggerPtr
Definition: triggerbox.h:80
Definition: ardour_ui.h:188