21 #include "gtk2ardour-config.h"
33 #include <gtkmm/widget.h>
34 #include <gtkmm/box.h>
47 #ifdef WINDOWS_VST_SUPPORT
87 , _keyboard_focused (false)
88 #ifdef AUDIOUNIT_SUPPORT
89 , pre_deactivate_x (-1)
90 , pre_deactivate_y (-1)
94 bool have_gui =
false;
95 Label* label = manage (
new Label());
96 label->set_markup (
"<b>THIS IS THE PLUGIN UI</b>");
98 if (editor && insert->
plugin()->has_editor()) {
99 switch (insert->
type()) {
113 error <<
_(
"Eh? LADSPA plugins don't have editors!") <<
endmsg;
121 #ifndef WINDOWS_VST_SUPPORT
122 error <<
string_compose (
_(
"unknown type of editor-supplying plugin (note: no VST support in this version of %1)"), PROGRAM_NAME)
125 error <<
_(
"unknown type of editor-supplying plugin")
139 set_wmclass (
X_(
"ardour_plugin_editor"), PROGRAM_NAME);
145 set_name (
"PluginEditor");
146 add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
154 if (h > 600) h = 600;
157 set_default_size (w, h);
164 cerr <<
"PluginWindow deleted for " <<
this << endl;
172 set_role(
"plugin_ui");
180 #if defined (HAVE_AUDIOUNITS) && defined(GTKOSX)
181 if (pre_deactivate_x >= 0) {
182 move (pre_deactivate_x, pre_deactivate_y);
195 #if defined (HAVE_AUDIOUNITS) && defined(GTKOSX)
196 get_position (pre_deactivate_x, pre_deactivate_y);
209 Gtk::Window::set_title(title);
214 #ifdef WINDOWS_VST_SUPPORT
220 #ifndef WINDOWS_VST_SUPPORT
226 if ((vp = boost::dynamic_pointer_cast<WindowsVSTPlugin> (insert->
plugin())) == 0) {
227 error <<
string_compose (
_(
"unknown type of editor-supplying plugin (note: no VST support in this version of %1)"), PROGRAM_NAME)
250 #ifndef LXVST_SUPPORT
256 if ((lxvp = boost::dynamic_pointer_cast<LXVSTPlugin> (insert->
plugin())) == 0) {
257 error <<
string_compose (
_(
"unknown type of editor-supplying plugin (note: no linuxVST support in this version of %1)"), PROGRAM_NAME)
261 LXVSTPluginUI* lxvpu =
new LXVSTPluginUI (insert, lxvp);
266 lxvpu->package (*
this);
274 #ifdef AUDIOUNIT_SUPPORT
280 #ifndef AUDIOUNIT_SUPPORT
301 #ifdef AUDIOUNIT_SUPPORT
305 _pluginui->activate ();
306 if (pre_deactivate_x >= 0) {
307 move (pre_deactivate_x, pre_deactivate_y);
313 was_visible = is_visible();
314 get_position (pre_deactivate_x, pre_deactivate_y);
316 _pluginui->deactivate ();
328 if ((vp = boost::dynamic_pointer_cast<LV2Plugin> (insert->
plugin())) == 0) {
329 error <<
_(
"create_lv2_editor called on non-LV2 plugin") <<
endmsg;
332 LV2PluginUI* lpu =
new LV2PluginUI (insert, vp);
335 lpu->package (*
this);
417 , plugin (insert->plugin())
418 , add_button (
_(
"Add"))
419 , save_button (
_(
"Save"))
420 , delete_button (
_(
"Delete"))
421 , reset_button (
_(
"Reset"))
423 , description_expander (
_(
"Description"))
424 , plugin_analysis_expander (
_(
"Plugin analysis"))
461 focus_button.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
464 focus_button.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
517 t =
string_compose (
P_(
"latency (%1 sample)",
"latency (%1 samples)", l), l);
519 t =
string_compose (
_(
"latency (%1 ms)"), (
float) l / ((
float) sr / 1000.0
f));
534 latency_dialog->set_keep_above (
true);
535 Window* win =
dynamic_cast<Window*
> (
bypass_button.get_toplevel ());
537 latency_dialog->set_transient_for (*win);
563 if (!preset.
label.empty()) {
571 #ifdef NO_PLUGIN_STATE
572 static bool seen_saving_message =
false;
574 static void show_no_plugin_message()
576 info <<
string_compose (
_(
"Plugin presets are not supported in this build of %1. Consider paying for a full version"),
579 info <<
_(
"To get full access to updates without this limitation\n"
580 "consider becoming a subscriber for a low cost every month.")
582 info <<
X_(
"https://community.ardour.org/s/subscribe")
591 #ifndef NO_PLUGIN_STATE
595 case Gtk::RESPONSE_ACCEPT:
596 if (d.
name().empty()) {
605 if (!r.
uri.empty ()) {
611 if (!seen_saving_message) {
612 seen_saving_message =
true;
613 show_no_plugin_message();
621 #ifndef NO_PLUGIN_STATE
625 if (!r.
uri.empty ()) {
629 if (!seen_saving_message) {
630 seen_saving_message =
true;
631 show_no_plugin_message();
639 #ifndef NO_PLUGIN_STATE
642 if (!seen_saving_message) {
643 seen_saving_message =
true;
644 show_no_plugin_message();
666 if (view_says_bypassed != insert->
active()) {
667 if (view_says_bypassed) {
680 if (Keyboard::the_keyboard().some_magic_widget_has_focus()) {
681 Keyboard::the_keyboard().magic_widget_drop_focus();
688 Keyboard::the_keyboard().magic_widget_grab_focus();
709 Gtk::Label* label = manage(
new Gtk::Label(text));
710 label->set_line_wrap(
true);
711 label->set_line_wrap_mode(Pango::WRAP_WORD);
761 using namespace Menu_Helpers;
769 for (vector<ARDOUR::Plugin::PresetRecord>::const_iterator i = presets.begin(); i != presets.end(); ++i) {
bool relay_key_press(GdkEventKey *ev, Gtk::Window *win)
PlugUIBase * create_au_gui(boost::shared_ptr< PluginInsert > plugin_insert, VBox **box)
PBD::Signal0< void > DropReferences
bool stop_updating(GdkEventAny *)
void toggle_description()
sigc::signal< void, bool > KeyboardFocused
Session & session() const
PluginUIWindow(boost::shared_ptr< ARDOUR::PluginInsert > insert, bool scrollable=false, bool editor=true)
Gtk::Image * focus_in_image
void latency_button_clicked()
static ARDOUR_UI * instance()
ArdourDropdown _preset_combo
void preset_added_or_removed()
PresetRecord save_preset(std::string)
virtual bool non_gtk_gui() const
void update_preset_modified()
ArdourButton delete_button
LIBPBD_API Transmitter error
void automation_state_changed()
ArdourButton latency_button
std::ostream & endmsg(std::ostream &ostr)
virtual void grab_focus()
#define P_(Singular, Plural, HowMany)
boost::shared_ptr< Plugin > plugin(uint32_t num=0) const
bool can_reset_all_parameters()
framecnt_t frame_rate() const
PBD::Signal2< void, uint32_t, float > ParameterChanged
#define ENSURE_GUI_THREAD(obj, method,...)
ArdourButton bypass_button
void processor_active_changed(boost::weak_ptr< ARDOUR::Processor > p)
Gtk::Requisition pre_eq_size
virtual gint get_preferred_height()=0
void save_plugin_setting()
bool create_lv2_editor(boost::shared_ptr< ARDOUR::PluginInsert >)
bool reset_parameters_to_default()
Gtk::Expander description_expander
bool bypass_button_release(GdkEventButton *)
virtual void forward_key_event(GdkEventKey *)
bool create_windows_vst_editor(boost::shared_ptr< ARDOUR::PluginInsert >)
Gtk::Expander plugin_analysis_expander
PBD::Signal0< void > PresetLoaded
bool on_key_release_event(GdkEventKey *)
Gtk::EventBox focus_button
virtual bool stop_updating(GdkEventAny *)=0
virtual bool on_window_show(const std::string &)
framecnt_t effective_latency() const
Gtk::Image * focus_out_image
PBD::Signal0< void > PresetAdded
void add_plugin_setting()
PBD::ScopedConnection death_connection
PBD::Signal0< void > AutomationStateChanged
void set_title(const std::string &title)
bool create_audiounit_editor(boost::shared_ptr< ARDOUR::PluginInsert >)
bool parameter_changed_since_last_preset() const
int package(Gtk::Window &)
LIBPBD_API Transmitter info
void keyboard_focused(bool yn)
void set_tip(Gtk::Widget &w, const gchar *tip)
static PublicEditor & instance()
PBD::ScopedConnection active_connection
bool focus_toggled(GdkEventButton *)
pframes_t get_block_size() const
PBD::ScopedConnection death_connection
PBD::Signal0< void > ActiveChanged
bool create_lxvst_editor(boost::shared_ptr< ARDOUR::PluginInsert >)
virtual gint get_preferred_width()=0
void update_preset_list()
void delete_plugin_setting()
boost::shared_ptr< ARDOUR::Plugin > plugin
virtual void on_window_hide()
void toggle_plugin_analysis()
Gtk::Label _preset_modified
virtual void parameter_changed(uint32_t, float)
Glib::RefPtr< Gdk::Pixbuf > get_icon(const char *cname)
ArdourWindow * latency_dialog
bool start_updating(GdkEventAny *)
virtual std::string get_docs() const
PBD::Signal0< void > PresetRemoved
std::vector< PresetRecord > get_presets()
virtual bool load_preset(PresetRecord)
ArdourButton reset_button
bool on_key_press_event(GdkEventKey *)
void AddMenuElem(Gtk::Menu_Helpers::MenuElem e)
PresetRecord last_preset() const
void remove_preset(std::string)
std::string string_compose(const std::string &fmt, const T1 &o1)
PlugUIBase(boost::shared_ptr< ARDOUR::PluginInsert >)
virtual void preset_selected(ARDOUR::Plugin::PresetRecord preset)
void reset_plugin_parameters()
void popup_error(const std::string &text)