Ardour  9.2-79-gba93f2fe52
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 #pragma once
20 
21 #include "ytkmm/colorselection.h"
22 #include "ytkmm/entry.h"
23 
24 #include "gtkmm2ext/actions.h"
25 #include "gtkmm2ext/bindings.h"
26 
27 #include "ardour/triggerbox.h"
28 #include "widgets/ardour_button.h"
29 #include "widgets/frame.h"
30 
31 namespace Gtk
32 {
33  class FileChooserDialog;
34  class Menu;
35 }
36 
37 namespace ArdourWidgets {
38  class PopUp;
39 }
40 
41 class TriggerJumpDialog;
42 class ArdourColorDialog;
43 
44 class TriggerUI : virtual public sigc::trackable
45 {
46 public:
48  virtual ~TriggerUI ();
49 
51 
52  virtual void on_trigger_set () {}
53  virtual void on_trigger_changed (PBD::PropertyChange const& ) = 0;
54 
55  static std::string follow_action_to_string (ARDOUR::FollowAction const &, bool with_targets=false);
56  static std::string quantize_length_to_string (Temporal::BBT_Offset const &);
59 
60  static std::vector<std::string> follow_strings;
61  static std::string longest_follow;
62  static std::vector<std::string> quantize_strings;
63  static std::string longest_quantize;
64  static std::vector<std::string> launch_strings;
65  static std::string longest_launch;
66  static std::vector<std::string> stretch_mode_strings;
67  static std::string longest_stretch_mode;
68 
70 
73  ARDOUR::TriggerBox& triggerbox() const { return trigger()->box(); }
74 
76  void choose_sample (bool allow_multiple_select);
77  void sample_chosen (int r);
78 
81  void context_menu ();
82 
84  void edit_jump(bool right_fa);
85 
90 
92  void clear_trigger ();
93  void edit_trigger ();
94 
99 
100 private:
101  void trigger_changed (PBD::PropertyChange const& ); //calls on_trigger_changed to subclasses
102 
103 protected:
104  /* all of this for name editing ... */
106  bool start_rename ();
107  void end_rename (bool);
108  void entry_changed ();
116  std::list<sigc::connection> _entry_connections;
117  bool _renaming;
122 
124  sigc::connection _file_chooser_connection;
125 
130 
132 
133  void trigger_swap (uint32_t);
135 
137  sigc::connection color_connection;
139 
141 };
142 
143 
144 
sigc::connection _file_chooser_connection
Definition: trigger_ui.h:124
void choose_sample(bool allow_multiple_select)
Gtk::Label _name_label
Definition: trigger_ui.h:119
static std::string longest_follow
Definition: trigger_ui.h:61
void set_quantization(Temporal::BBT_Offset const &)
virtual ~TriggerUI()
void trigger_changed(PBD::PropertyChange const &)
static std::string longest_launch
Definition: trigger_ui.h:65
void set_launch_style(ARDOUR::Trigger::LaunchStyle)
virtual void on_trigger_set()
Definition: trigger_ui.h:52
void set_follow_action(ARDOUR::FollowAction const &)
Gtk::FileChooserDialog * _file_chooser
Definition: trigger_ui.h:123
bool entry_focus_in(GdkEventFocus *)
static std::string longest_stretch_mode
Definition: trigger_ui.h:67
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_learning_finished(ArdourWidgets::PopUp *)
void trigger_midi_learn()
virtual void on_trigger_changed(PBD::PropertyChange const &)=0
std::list< sigc::connection > _entry_connections
Definition: trigger_ui.h:116
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:73
void launch_context_menu()
ARDOUR::TriggerPtr trigger() const
bool _renaming
Definition: trigger_ui.h:117
bool entry_focus_out(GdkEventFocus *)
void follow_context_menu(GdkEventButton *)
void end_rename(bool)
sigc::connection color_connection
Definition: trigger_ui.h:137
ARDOUR::TriggerReference trigger_reference() const
Definition: trigger_ui.h:71
void set_from_selection()
static std::string quantize_length_to_string(Temporal::BBT_Offset const &)
Gtk::Menu * _launch_context_menu
Definition: trigger_ui.h:126
PBD::ScopedConnectionList trigger_connections
Definition: trigger_ui.h:138
ArdourWidgets::Frame _name_frame
Definition: trigger_ui.h:121
static std::vector< std::string > launch_strings
Definition: trigger_ui.h:64
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:66
static std::string longest_quantize
Definition: trigger_ui.h:63
bool entry_key_press(GdkEventKey *)
void disconnect_entry_signals()
bool entry_button_press(GdkEventButton *)
ArdourColorDialog * _color_dialog
Definition: trigger_ui.h:131
void edit_jump(bool right_fa)
bool _ignore_menu_action
Definition: trigger_ui.h:129
void trigger_midi_unlearn()
Gtk::Entry _nameentry
Definition: trigger_ui.h:118
static std::vector< std::string > follow_strings
Definition: trigger_ui.h:60
PBD::ScopedConnection learning_connection
Definition: trigger_ui.h:140
void toggle_trigger_isolated()
PBD::ScopedConnection trigger_swap_connection
Definition: trigger_ui.h:134
Gtk::Menu * _follow_context_menu
Definition: trigger_ui.h:127
ARDOUR::TriggerReference tref
Definition: trigger_ui.h:136
Gtk::Menu * _context_menu
Definition: trigger_ui.h:128
void sample_chosen(int r)
Gtk::EventBox _namebox
Definition: trigger_ui.h:120
bool start_rename()
void entry_activated()
void trigger_stop_midi_learn()
static std::vector< std::string > quantize_strings
Definition: trigger_ui.h:62
void choose_color(Gtk::Window *)
std::shared_ptr< Trigger > TriggerPtr
Definition: triggerbox.h:82
Definition: ardour_ui.h:192