Ardour  9.0-pre0-582-g084a23a80d
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 <gtkmm/label.h>
27 #include <gtkmm/entry.h>
28 #include <gtkmm/box.h>
29 #include <gtkmm/eventbox.h>
30 #include <gtkmm/togglebutton.h>
31 #include <gtkmm/button.h>
32 #include <gtkmm/arrow.h>
33 #include <gtkmm/frame.h>
34 #include <gtkmm/table.h>
35 #include <gtkmm/adjustment.h>
36 #include <gtkmm/separator.h>
37 #include <gtkmm/spinbutton.h>
38 #include <gtkmm/listviewtext.h>
39 #include <gtkmm/scrolledwindow.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:
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 
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 
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);
123  void clear_automation (std::weak_ptr<ARDOUR::RegionFxPlugin>);
126 
127  /* PluginInterestedObject */
129 
130  /* DNDVbox signal handlers */
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;
148 
149  sigc::connection screen_update_connection;
150  };
151 
152  std::shared_ptr<ARDOUR::Region> _region;
153 
155 
159 
167 
169 
176 
178 
182 
184  void name_changed ();
185 
187 
188  void activation ();
189 
196 
198 
199  gint bpressed (GdkEventButton* ev, Gtk::SpinButton* but, void (RegionEditor::*pmf)());
200  gint breleased (GdkEventButton* ev, Gtk::SpinButton* but, void (RegionEditor::*pmf)());
201 
203 
205 
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
void position_clock_changed()
void audition_button_toggled()
Gtk::Entry name_entry
Gtk::Table _table
Definition: region_editor.h:73
void audition_state_changed(bool)
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()
std::shared_ptr< ARDOUR::Region > region() const
Definition: region_editor.h:67
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:479
std::vector< ARDOUR::PluginPtr > SelectedPlugins