Ardour  9.0-pre0-844-g046623df59
region_editor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2018 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
4  * Copyright (C) 2009-2011 David Robillard <d@drobilla.net>
5  * Copyright (C) 2010 Carl Hetherington <carl@carlh.net>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #pragma once
23 
24 #include <map>
25 
26 #include <ytkmm/adjustment.h>
27 #include <ytkmm/arrow.h>
28 #include <ytkmm/box.h>
29 #include <ytkmm/button.h>
30 #include <ytkmm/entry.h>
31 #include <ytkmm/eventbox.h>
32 #include <ytkmm/frame.h>
33 #include <ytkmm/label.h>
34 #include <ytkmm/listviewtext.h>
35 #include <ytkmm/scrolledwindow.h>
36 #include <ytkmm/separator.h>
37 #include <ytkmm/spinbutton.h>
38 #include <ytkmm/table.h>
39 #include <ytkmm/togglebutton.h>
40 
41 #include "gtkmm2ext/bindings.h"
42 #include "gtkmm2ext/dndtreeview.h"
43 #include "gtkmm2ext/dndvbox.h"
44 
45 #include "widgets/frame.h"
46 
47 #include "pbd/signals.h"
48 
49 #include "audio_clock.h"
50 #include "plugin_interest.h"
51 
52 namespace ARDOUR {
53  class Region;
54  class Session;
55  class RegionFxPlugin;
56 }
57 
58 class RegionView;
59 class ClockGroup;
60 
62 {
63 public:
64  RegionEditor (ARDOUR::Session*, std::shared_ptr<ARDOUR::Region>);
65  virtual ~RegionEditor ();
66 
67  std::shared_ptr<ARDOUR::Region> region () const { return _region; }
68 
69 protected:
70  virtual void region_changed (const PBD::PropertyChange&);
71  virtual void region_fx_changed ();
72 
75 
76 private:
77  class RegionFxEntry : public Gtkmm2ext::DnDVBoxChild, public sigc::trackable
78  {
79  public:
80  RegionFxEntry (std::shared_ptr<ARDOUR::RegionFxPlugin>, bool pre);
81 
82  Gtk::EventBox& action_widget () { return _fx_btn; }
83  Gtk::Widget& widget () { return _box; }
84  std::string drag_text () const { return name (); }
85  bool is_selectable() const { return _selectable; }
88  bool drag_data_get (Glib::RefPtr<Gdk::DragContext> const, Gtk::SelectionData &);
89  std::shared_ptr<ARDOUR::RegionFxPlugin> region_fx_plugin () const { return _rfx; }
90 
91  private:
92  std::string name () const;
93 
94  Gtk::VBox _box;
96  std::shared_ptr<ARDOUR::RegionFxPlugin> _rfx;
99  };
100 
101  class RegionFxBox : public Gtk::VBox, public PluginInterestedObject //, public ARDOUR::SessionHandlePtr
102  {
103  public:
104  RegionFxBox (std::shared_ptr<ARDOUR::Region>);
106 
107  private:
108  static void register_actions ();
109  static void load_bindings ();
110  static void static_delete ();
111 
112  static Glib::RefPtr<Gtk::ActionGroup> rfx_box_actions;
115 
116  void add_fx_to_display (std::weak_ptr<ARDOUR::RegionFxPlugin>);
117  void show_plugin_gui (std::weak_ptr<ARDOUR::RegionFxPlugin>, bool custom_ui = true);
118  void queue_delete_region_fx (std::weak_ptr<ARDOUR::RegionFxPlugin>);
119  bool idle_delete_region_fx (std::weak_ptr<ARDOUR::RegionFxPlugin>);
120  void notify_plugin_load_fail (uint32_t cnt = 1);
121  bool enter_notify (GdkEventCrossing*);
122  bool leave_notify (GdkEventCrossing*);
123  void clear_automation (std::weak_ptr<ARDOUR::RegionFxPlugin>);
126 
127  /* PluginInterestedObject */
129 
130  /* DNDVbox signal handlers */
131  bool fxe_button_press_event (GdkEventButton*, RegionFxEntry*);
132  bool fxe_button_release_event (GdkEventButton*, RegionFxEntry*);
133 
134  void reordered ();
135  void plugin_drop (Gtk::SelectionData const&, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&);
136  void object_drop (Gtkmm2ext::DnDVBox<RegionFxEntry>*, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&);
137  void delete_dragged_plugins (std::list<std::shared_ptr<ARDOUR::RegionFxPlugin>> const&);
139 
140  std::shared_ptr<ARDOUR::RegionFxPlugin> find_drop_position (RegionFxEntry*);
141 
142  std::shared_ptr<ARDOUR::Region> _region;
144  Gtk::ScrolledWindow _scroller;
145  Gtk::EventBox _base;
148 
149  sigc::connection screen_update_connection;
150  };
151 
152  std::shared_ptr<ARDOUR::Region> _region;
153 
155 
156  Gtk::Label _name_label;
157  Gtk::Entry _name_entry;
158  Gtk::Label _position_label;
159  Gtk::Label _end_label;
160  Gtk::Label _length_label;
163  Gtk::Label _start_label;
164  Gtk::Label _region_fx_label;
165 
166  Gtk::ToggleButton _audition_button;
167 
169 
176 
178 
180 
181  Gtk::Label _sources_label;
182  Gtk::ListViewText _sources;
183 
187 
189  void name_changed ();
190 
192 
193  void activation ();
194 
201 
203 
204  gint bpressed (GdkEventButton* ev, Gtk::SpinButton* but, void (RegionEditor::*pmf) ());
205  gint breleased (GdkEventButton* ev, Gtk::SpinButton* but, void (RegionEditor::*pmf) ());
206 
207  bool on_delete_event (GdkEventAny*);
208 
210 };
static void register_actions()
Gtk::ScrolledWindow _scroller
static void static_delete()
static Glib::RefPtr< Gtk::ActionGroup > rfx_box_actions
void notify_plugin_load_fail(uint32_t cnt=1)
bool use_plugins(SelectedPlugins const &)
bool fxe_button_release_event(GdkEventButton *, RegionFxEntry *)
bool fxe_button_press_event(GdkEventButton *, RegionFxEntry *)
void add_fx_to_display(std::weak_ptr< ARDOUR::RegionFxPlugin >)
bool enter_notify(GdkEventCrossing *)
void clear_automation(std::weak_ptr< ARDOUR::RegionFxPlugin >)
sigc::connection screen_update_connection
static RegionFxBox * current_rfx_box
static void load_bindings()
std::shared_ptr< ARDOUR::Region > _region
std::shared_ptr< ARDOUR::RegionFxPlugin > find_drop_position(RegionFxEntry *)
void delete_dragged_plugins(std::list< std::shared_ptr< ARDOUR::RegionFxPlugin >> const &)
bool idle_delete_region_fx(std::weak_ptr< ARDOUR::RegionFxPlugin >)
Gtkmm2ext::DnDVBox< RegionFxEntry > _display
bool leave_notify(GdkEventCrossing *)
RegionFxBox(std::shared_ptr< ARDOUR::Region >)
void plugin_drop(Gtk::SelectionData const &, RegionFxEntry *, Glib::RefPtr< Gdk::DragContext > const &)
void show_plugin_gui(std::weak_ptr< ARDOUR::RegionFxPlugin >, bool custom_ui=true)
void object_drop(Gtkmm2ext::DnDVBox< RegionFxEntry > *, RegionFxEntry *, Glib::RefPtr< Gdk::DragContext > const &)
static Gtkmm2ext::Bindings * bindings
bool drag_refuse(Gtkmm2ext::DnDVBox< RegionFxEntry > *, RegionFxEntry *)
void queue_delete_region_fx(std::weak_ptr< ARDOUR::RegionFxPlugin >)
std::string name() const
std::shared_ptr< ARDOUR::RegionFxPlugin > _rfx
Definition: region_editor.h:96
ArdourWidgets::ArdourButton _fx_btn
Definition: region_editor.h:95
RegionFxEntry(std::shared_ptr< ARDOUR::RegionFxPlugin >, bool pre)
void set_visual_state(Gtkmm2ext::VisualState, bool)
bool drag_data_get(Glib::RefPtr< Gdk::DragContext > const, Gtk::SelectionData &)
std::shared_ptr< ARDOUR::RegionFxPlugin > region_fx_plugin() const
Definition: region_editor.h:89
ARDOUR::PluginPresetPtr _plugin_preset_pointer
Definition: region_editor.h:97
std::string drag_text() const
Definition: region_editor.h:84
Gtk::EventBox & action_widget()
Definition: region_editor.h:82
bool can_copy_state(Gtkmm2ext::DnDVBoxChild *) const
Gtk::Label _sync_absolute_label
void position_clock_changed()
void audition_button_toggled()
AudioClock _length_clock
Gtk::Label _region_fx_label
void audition_state_changed(bool)
PBD::ScopedConnection _region_connection
AudioClock _start_clock
Gtk::Entry _name_entry
bool _spin_arrow_grab
void name_changed()
PBD::ScopedConnection _audition_connection
AudioClock _position_clock
Gtk::ToggleButton _audition_button
RegionEditor(ARDOUR::Session *, std::shared_ptr< ARDOUR::Region >)
virtual void region_changed(const PBD::PropertyChange &)
Gtk::Label _length_label
void set_clock_mode_from_primary()
void sync_offset_absolute_clock_changed()
PBD::ScopedConnection _state_connection
void length_clock_changed()
Gtk::Label _name_label
void end_clock_changed()
Gtk::Table _table_clocks
Definition: region_editor.h:74
std::shared_ptr< ARDOUR::Region > _region
void name_entry_changed()
Gtk::ListViewText _sources
Gtk::Table _table_main
Definition: region_editor.h:73
Gtk::Label _sources_label
AudioClock _sync_offset_relative_clock
sync offset relative to the start of the region
Gtk::Label _end_label
void bounds_changed(const PBD::PropertyChange &)
virtual void region_fx_changed()
std::shared_ptr< ARDOUR::Region > region() const
Definition: region_editor.h:67
Gtk::Label _start_label
bool on_delete_event(GdkEventAny *)
AudioClock _sync_offset_absolute_clock
sync offset relative to the start of the timeline
RegionFxBox _region_fx_box
Gtk::Label _sync_relative_label
Gtk::Label _position_label
ClockGroup * _clock_group
gint bpressed(GdkEventButton *ev, Gtk::SpinButton *but, void(RegionEditor::*pmf)())
gint breleased(GdkEventButton *ev, Gtk::SpinButton *but, void(RegionEditor::*pmf)())
virtual ~RegionEditor()
AudioClock _end_clock
void connect_editor_events()
void sync_offset_relative_clock_changed()
void activation()
struct Table Table
std::shared_ptr< PluginPreset > PluginPresetPtr
Definition: plugin.h:479
std::vector< ARDOUR::PluginPtr > SelectedPlugins