Ardour  9.0-pre0-1159-gcb8dd39f31
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 
70 
71 protected:
72  virtual void region_changed (const PBD::PropertyChange&);
73  virtual void region_fx_changed ();
74 
77 
78 private:
79  class RegionFxEntry : public Gtkmm2ext::DnDVBoxChild, public sigc::trackable
80  {
81  public:
82  RegionFxEntry (std::shared_ptr<ARDOUR::RegionFxPlugin>, bool pre);
83 
85  Gtk::Widget& widget () { return _box; }
86  std::string drag_text () const { return name (); }
87  bool is_selectable() const { return _selectable; }
90  bool drag_data_get (Glib::RefPtr<Gdk::DragContext> const, Gtk::SelectionData &);
91  std::shared_ptr<ARDOUR::RegionFxPlugin> region_fx_plugin () const { return _rfx; }
92 
93  private:
94  std::string name () const;
95 
98  std::shared_ptr<ARDOUR::RegionFxPlugin> _rfx;
101  };
102 
103  class RegionFxBox : public Gtk::VBox, public PluginInterestedObject //, public ARDOUR::SessionHandlePtr
104  {
105  public:
106  RegionFxBox (std::shared_ptr<ARDOUR::Region>);
108 
109  static void register_actions ();
110 
111  private:
112  static void load_bindings ();
113  static void static_delete ();
114 
115  static Glib::RefPtr<Gtk::ActionGroup> rfx_box_actions;
118 
119  void add_fx_to_display (std::weak_ptr<ARDOUR::RegionFxPlugin>);
120  void show_plugin_gui (std::weak_ptr<ARDOUR::RegionFxPlugin>, bool custom_ui = true);
121  void queue_delete_region_fx (std::weak_ptr<ARDOUR::RegionFxPlugin>);
122  bool idle_delete_region_fx (std::weak_ptr<ARDOUR::RegionFxPlugin>);
123  void notify_plugin_load_fail (uint32_t cnt = 1);
126  void clear_automation (std::weak_ptr<ARDOUR::RegionFxPlugin>);
129 
130  /* PluginInterestedObject */
132 
133  /* DNDVbox signal handlers */
136 
137  void reordered ();
138  void plugin_drop (Gtk::SelectionData const&, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&);
139  void object_drop (Gtkmm2ext::DnDVBox<RegionFxEntry>*, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&);
140  void delete_dragged_plugins (std::list<std::shared_ptr<ARDOUR::RegionFxPlugin>> const&);
142 
143  std::shared_ptr<ARDOUR::RegionFxPlugin> find_drop_position (RegionFxEntry*);
144 
145  std::shared_ptr<ARDOUR::Region> _region;
151 
152  sigc::connection screen_update_connection;
153  };
154 
155  std::shared_ptr<ARDOUR::Region> _region;
156 
158 
168 
170 
172 
179 
181 
183 
186 
190 
192  void name_changed ();
193 
195 
196  void activation ();
197 
204 
206 
207  gint bpressed (GdkEventButton* ev, Gtk::SpinButton* but, void (RegionEditor::*pmf) ());
208  gint breleased (GdkEventButton* ev, Gtk::SpinButton* but, void (RegionEditor::*pmf) ());
209 
211 
213 };
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:98
ArdourWidgets::ArdourButton _fx_btn
Definition: region_editor.h:97
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:91
ARDOUR::PluginPresetPtr _plugin_preset_pointer
Definition: region_editor.h:99
std::string drag_text() const
Definition: region_editor.h:86
Gtk::EventBox & action_widget()
Definition: region_editor.h:84
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:76
std::shared_ptr< ARDOUR::Region > _region
void name_entry_changed()
Gtk::ListViewText _sources
Gtk::Table _table_main
Definition: region_editor.h:75
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 *)
This is a default handler for the signal signal_delete_event().
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)())
static void setup_actions_and_bindings()
virtual ~RegionEditor()
AudioClock _end_clock
void connect_editor_events()
void sync_offset_relative_clock_changed()
void activation()
std::shared_ptr< PluginPreset > PluginPresetPtr
Definition: plugin.h:479
std::vector< ARDOUR::PluginPtr > SelectedPlugins