Ardour  9.0-pre0-582-g084a23a80d
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 "gtkmm/colorselection.h"
22 #include "gtkmm/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 class TriggerJumpDialog;
38 
39 class TriggerUI : virtual public sigc::trackable
40 {
41 public:
43  virtual ~TriggerUI ();
44 
46 
47  virtual void on_trigger_set () {}
48  virtual void on_trigger_changed (PBD::PropertyChange const& ) = 0;
49 
50  static std::string follow_action_to_string (ARDOUR::FollowAction const &, bool with_targets=false);
51  static std::string quantize_length_to_string (Temporal::BBT_Offset const &);
54 
55  static std::vector<std::string> follow_strings;
56  static std::string longest_follow;
57  static std::vector<std::string> quantize_strings;
58  static std::string longest_quantize;
59  static std::vector<std::string> launch_strings;
60  static std::string longest_launch;
61  static std::vector<std::string> stretch_mode_strings;
62  static std::string longest_stretch_mode;
63 
65 
68  ARDOUR::TriggerBox& triggerbox() const { return trigger()->box(); }
69 
70  void choose_color ();
71  void choose_sample (bool allow_multiple_select);
72  void sample_chosen (int r);
73 
76  void context_menu ();
77 
79  void edit_jump(bool right_fa);
80 
85 
87  void clear_trigger ();
88  void edit_trigger ();
89 
92 
93 private:
94  void trigger_changed (PBD::PropertyChange const& ); //calls on_trigger_changed to subclasses
95 
96 protected:
97  /* all of this for name editing ... */
99  bool start_rename ();
100  void end_rename (bool);
101  void entry_changed ();
109  std::list<sigc::connection> _entry_connections;
110  bool _renaming;
115 
117  sigc::connection _file_chooser_connection;
118 
123 
125 
126  void trigger_swap (uint32_t);
128 
131 };
132 
133 
134 
sigc::connection _file_chooser_connection
Definition: trigger_ui.h:117
void choose_sample(bool allow_multiple_select)
Gtk::Label _name_label
Definition: trigger_ui.h:112
static std::string longest_follow
Definition: trigger_ui.h:56
void set_quantization(Temporal::BBT_Offset const &)
virtual ~TriggerUI()
void trigger_changed(PBD::PropertyChange const &)
static std::string longest_launch
Definition: trigger_ui.h:60
void set_launch_style(ARDOUR::Trigger::LaunchStyle)
virtual void on_trigger_set()
Definition: trigger_ui.h:47
void set_follow_action(ARDOUR::FollowAction const &)
Gtk::FileChooserDialog * _file_chooser
Definition: trigger_ui.h:116
bool entry_focus_in(GdkEventFocus *)
static std::string longest_stretch_mode
Definition: trigger_ui.h:62
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:109
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:68
void launch_context_menu()
ARDOUR::TriggerPtr trigger() const
bool _renaming
Definition: trigger_ui.h:110
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:66
void set_from_selection()
static std::string quantize_length_to_string(Temporal::BBT_Offset const &)
Gtk::Menu * _launch_context_menu
Definition: trigger_ui.h:119
PBD::ScopedConnectionList trigger_connections
Definition: trigger_ui.h:130
ArdourWidgets::Frame _name_frame
Definition: trigger_ui.h:114
static std::vector< std::string > launch_strings
Definition: trigger_ui.h:59
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:61
static std::string longest_quantize
Definition: trigger_ui.h:58
Gtk::ColorSelectionDialog * _color_dialog
Definition: trigger_ui.h:124
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:122
void trigger_midi_unlearn()
Gtk::Entry _nameentry
Definition: trigger_ui.h:111
static std::vector< std::string > follow_strings
Definition: trigger_ui.h:55
void toggle_trigger_isolated()
PBD::ScopedConnection trigger_swap_connection
Definition: trigger_ui.h:127
Gtk::Menu * _follow_context_menu
Definition: trigger_ui.h:120
ARDOUR::TriggerReference tref
Definition: trigger_ui.h:129
Gtk::Menu * _context_menu
Definition: trigger_ui.h:121
void sample_chosen(int r)
Gtk::EventBox _namebox
Definition: trigger_ui.h:113
bool start_rename()
void entry_activated()
static std::vector< std::string > quantize_strings
Definition: trigger_ui.h:57
std::shared_ptr< Trigger > TriggerPtr
Definition: triggerbox.h:83
Definition: ardour_ui.h:188