Ardour  8.12
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 #ifndef __gtk_ardour_region_edit_h__
23 #define __gtk_ardour_region_edit_h__
24 
25 #include <map>
26 
27 #include <gtkmm/label.h>
28 #include <gtkmm/entry.h>
29 #include <gtkmm/box.h>
30 #include <gtkmm/eventbox.h>
31 #include <gtkmm/togglebutton.h>
32 #include <gtkmm/button.h>
33 #include <gtkmm/arrow.h>
34 #include <gtkmm/frame.h>
35 #include <gtkmm/table.h>
36 #include <gtkmm/adjustment.h>
37 #include <gtkmm/separator.h>
38 #include <gtkmm/spinbutton.h>
39 #include <gtkmm/listviewtext.h>
40 #include <gtkmm/scrolledwindow.h>
41 
42 #include "gtkmm2ext/dndtreeview.h"
43 #include "gtkmm2ext/dndvbox.h"
44 
45 #include "pbd/signals.h"
46 
47 #include "audio_clock.h"
48 #include "ardour_dialog.h"
49 #include "plugin_interest.h"
50 #include "region_editor.h"
51 
52 namespace ARDOUR {
53  class Region;
54  class Session;
55  class RegionFxPlugin;
56 }
57 
58 class RegionView;
59 class ClockGroup;
60 
61 class RegionEditor : public ArdourDialog
62 {
63 public:
65  virtual ~RegionEditor ();
66 
67 protected:
68  virtual void region_changed (const PBD::PropertyChange&);
69  virtual void region_fx_changed ();
70 
73 
74 private:
75  class RegionFxEntry : public Gtkmm2ext::DnDVBoxChild, public sigc::trackable
76  {
77  public:
78  RegionFxEntry (std::shared_ptr<ARDOUR::RegionFxPlugin>, bool pre);
79 
81  Gtk::Widget& widget () { return _box; }
82  std::string drag_text () const { return name (); }
83  bool is_selectable() const { return _selectable; }
86  bool drag_data_get (Glib::RefPtr<Gdk::DragContext> const, Gtk::SelectionData &);
87  std::shared_ptr<ARDOUR::RegionFxPlugin> region_fx_plugin () const { return _rfx; }
88 
89  private:
90  std::string name () const;
91 
94  std::shared_ptr<ARDOUR::RegionFxPlugin> _rfx;
97  };
98 
99  class RegionFxBox : public Gtk::VBox, public PluginInterestedObject //, public ARDOUR::SessionHandlePtr
100  {
101  public:
102  RegionFxBox (std::shared_ptr<ARDOUR::Region>);
104 
105  private:
106  void add_fx_to_display (std::weak_ptr<ARDOUR::RegionFxPlugin>);
107  void show_plugin_gui (std::weak_ptr<ARDOUR::RegionFxPlugin>, bool custom_ui = true);
108  void queue_delete_region_fx (std::weak_ptr<ARDOUR::RegionFxPlugin>);
109  bool idle_delete_region_fx (std::weak_ptr<ARDOUR::RegionFxPlugin>);
110  void notify_plugin_load_fail (uint32_t cnt = 1);
112  void clear_automation (std::weak_ptr<ARDOUR::RegionFxPlugin>);
114 
115  /* PluginInterestedObject */
117 
118  /* DNDVbox signal handlers */
121 
122  void reordered ();
123  void plugin_drop (Gtk::SelectionData const&, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&);
124  void object_drop (Gtkmm2ext::DnDVBox<RegionFxEntry>*, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&);
125  void delete_dragged_plugins (std::list<std::shared_ptr<ARDOUR::RegionFxPlugin>> const&);
126 
127  std::shared_ptr<ARDOUR::RegionFxPlugin> find_drop_position (RegionFxEntry*);
128 
129  std::shared_ptr<ARDOUR::Region> _region;
135 
136  sigc::connection screen_update_connection;
137  };
138 
139  std::shared_ptr<ARDOUR::Region> _region;
140 
142 
146 
154 
156 
163 
165 
169 
171  void name_changed ();
172 
174 
175  void activation ();
176 
183 
185 
186  gint bpressed (GdkEventButton* ev, Gtk::SpinButton* but, void (RegionEditor::*pmf)());
187  gint breleased (GdkEventButton* ev, Gtk::SpinButton* but, void (RegionEditor::*pmf)());
188 
190  void handle_response (int);
191 
193 
196 
198 };
199 
200 #endif /* __gtk_ardour_region_edit_h__ */
Gtk::ScrolledWindow _scroller
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 >)
void clear_automation(std::weak_ptr< ARDOUR::RegionFxPlugin >)
sigc::connection screen_update_connection
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
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 &)
bool on_key_press(GdkEventKey *)
void queue_delete_region_fx(std::weak_ptr< ARDOUR::RegionFxPlugin >)
std::string name() const
std::shared_ptr< ARDOUR::RegionFxPlugin > _rfx
Definition: region_editor.h:94
ArdourWidgets::ArdourButton _fx_btn
Definition: region_editor.h:93
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:87
ARDOUR::PluginPresetPtr _plugin_preset_pointer
Definition: region_editor.h:95
std::string drag_text() const
Definition: region_editor.h:82
Gtk::EventBox & action_widget()
Definition: region_editor.h:80
bool can_copy_state(Gtkmm2ext::DnDVBoxChild *) const
void position_clock_changed()
void audition_button_toggled()
Gtk::Entry name_entry
Gtk::Table _table
Definition: region_editor.h:71
void audition_state_changed(bool)
void handle_response(int)
void name_changed()
Gtk::Label region_fx_label
bool spin_arrow_grab
PBD::ScopedConnection region_connection
Gtk::Label end_label
Gtk::Label sync_absolute_label
AudioClock length_clock
AudioClock end_clock
Gtk::Label position_label
virtual void region_changed(const PBD::PropertyChange &)
void set_clock_mode_from_primary()
void sync_offset_absolute_clock_changed()
void length_clock_changed()
Gtk::Label name_label
Gtk::Label start_label
AudioClock sync_offset_absolute_clock
sync offset relative to the start of the timeline
void end_clock_changed()
AudioClock sync_offset_relative_clock
sync offset relative to the start of the region
std::shared_ptr< ARDOUR::Region > _region
Gtk::Label length_label
void name_entry_changed()
Gtk::ListViewText _sources
Gtk::Label _sources_label
AudioClock start_clock
void bounds_changed(const PBD::PropertyChange &)
virtual void region_fx_changed()
bool on_delete_event(GdkEventAny *)
This is a default handler for the signal signal_delete_event().
PBD::ScopedConnection audition_connection
Gtk::ToggleButton audition_button
Gtk::Label sync_relative_label
RegionFxBox _region_fx_box
ClockGroup * _clock_group
gint bpressed(GdkEventButton *ev, Gtk::SpinButton *but, void(RegionEditor::*pmf)())
AudioClock position_clock
gint breleased(GdkEventButton *ev, Gtk::SpinButton *but, void(RegionEditor::*pmf)())
virtual ~RegionEditor()
RegionEditor(ARDOUR::Session *, RegionView *)
void connect_editor_events()
void sync_offset_relative_clock_changed()
void activation()
PBD::ScopedConnection state_connection
std::shared_ptr< PluginPreset > PluginPresetPtr
Definition: plugin.h:480
std::vector< ARDOUR::PluginPtr > SelectedPlugins