X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fplugin_ui.cc;h=1f70537a41dc4cc402c09a7e47faba3dc1e593b4;hb=87c38e1a269e09b40e8e8866961498c36ce95fbb;hp=37c01462b28348e631edeca709bb8394cbe82744;hpb=7804a524dc106ec1540fa5f02e26f84c71cbef9a;p=ardour.git diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index 37c01462b2..1f70537a41 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -58,6 +58,7 @@ #endif #include "ardour_window.h" +#include "ardour_ui.h" #include "prompter.h" #include "plugin_ui.h" #include "utils.h" @@ -69,7 +70,7 @@ #include "new_plugin_preset_dialog.h" #include "tooltips.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; @@ -177,7 +178,7 @@ PluginUIWindow::on_show () } if (_pluginui) { -#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX) +#if defined (HAVE_AUDIOUNITS) && defined(__APPLE__) if (pre_deactivate_x >= 0) { move (pre_deactivate_x, pre_deactivate_y); } @@ -192,7 +193,7 @@ PluginUIWindow::on_show () void PluginUIWindow::on_hide () { -#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX) +#if defined (HAVE_AUDIOUNITS) && defined(__APPLE__) get_position (pre_deactivate_x, pre_deactivate_y); #endif @@ -292,7 +293,7 @@ PluginUIWindow::create_audiounit_editor (boost::shared_ptr) } void -#ifdef GTKOSX +#ifdef __APPLE__ PluginUIWindow::app_activated (bool yn) #else PluginUIWindow::app_activated (bool) @@ -361,27 +362,26 @@ PluginUIWindow::on_key_press_event (GdkEventKey* event) } } return true; - } else { - /* for us to be getting key press events, there really - MUST be a _pluginui, but just to be safe, check ... - */ + } + /* for us to be getting key press events, there really + MUST be a _pluginui, but just to be safe, check ... + */ - if (_pluginui) { - _pluginui->grab_focus(); - if (_pluginui->non_gtk_gui()) { - /* pass editor window as the window for the event - to be handled in, not this one, because there are - no widgets in this window that we want to have - key focus. - */ - return relay_key_press (event, &PublicEditor::instance()); - } else { - return relay_key_press (event, this); - } + if (_pluginui) { + _pluginui->grab_focus(); + if (_pluginui->non_gtk_gui()) { + /* pass main window as the window for the event + to be handled in, not this one, because there are + no widgets in this window that we want to have + key focus. + */ + return relay_key_press (event, &ARDOUR_UI::instance()->main_window()); } else { - return false; + return relay_key_press (event, this); } } + + return false; } bool @@ -456,7 +456,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr pi) bypass_button.set_name ("plugin bypass button"); bypass_button.set_text (_("Bypass")); - bypass_button.set_active (!pi->active()); + bypass_button.set_active (!pi->enabled ()); bypass_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PlugUIBase::bypass_button_release), false); focus_button.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK); @@ -484,7 +484,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr pi) plugin->PresetAdded.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::preset_added_or_removed, this), gui_context ()); plugin->PresetRemoved.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::preset_added_or_removed, this), gui_context ()); plugin->PresetLoaded.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::update_preset, this), gui_context ()); - plugin->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::parameter_changed, this, _1, _2), gui_context ()); + plugin->PresetDirty.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::update_preset_modified, this), gui_context ()); insert->AutomationStateChanged.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::automation_state_changed, this), gui_context()); @@ -550,7 +550,7 @@ PlugUIBase::processor_active_changed (boost::weak_ptr weak_p) boost::shared_ptr p (weak_p.lock()); if (p) { - bypass_button.set_active (!p->active()); + bypass_button.set_active (!p->enabled ()); } } @@ -561,7 +561,7 @@ PlugUIBase::preset_selected (Plugin::PresetRecord preset) return; } if (!preset.label.empty()) { - plugin->load_preset (preset); + insert->load_preset (preset); } else { // blank selected = no preset plugin->clear_preset(); @@ -589,7 +589,7 @@ void PlugUIBase::add_plugin_setting () { #ifndef NO_PLUGIN_STATE - NewPluginPresetDialog d (plugin); + NewPluginPresetDialog d (plugin, _("New Preset")); switch (d.run ()) { case Gtk::RESPONSE_ACCEPT: @@ -663,12 +663,8 @@ PlugUIBase::bypass_button_release (GdkEventButton*) { bool view_says_bypassed = (bypass_button.active_state() != 0); - if (view_says_bypassed != insert->active()) { - if (view_says_bypassed) { - insert->activate (); - } else { - insert->deactivate (); - } + if (view_says_bypassed != insert->enabled ()) { + insert->enable (view_says_bypassed); } return false; @@ -714,7 +710,19 @@ PlugUIBase::toggle_description() } if (!description_expander.get_expanded()) { + const int child_height = description_expander.get_child ()->get_height (); + description_expander.remove(); + + Gtk::Window *toplevel = (Gtk::Window*) description_expander.get_ancestor (GTK_TYPE_WINDOW); + + if (toplevel) { + Gtk::Requisition wr; + toplevel->get_size (wr.width, wr.height); + wr.height -= child_height; + toplevel->resize (wr.width, wr.height); + } + } } @@ -729,12 +737,6 @@ PlugUIBase::toggle_plugin_analysis() eqgui = new PluginEqGui (insert); } - Gtk::Window *toplevel = (Gtk::Window*) plugin_analysis_expander.get_ancestor (GTK_TYPE_WINDOW); - - if (toplevel) { - toplevel->get_size (pre_eq_size.width, pre_eq_size.height); - } - plugin_analysis_expander.add (*eqgui); plugin_analysis_expander.show_all (); eqgui->start_listening (); @@ -742,6 +744,7 @@ PlugUIBase::toggle_plugin_analysis() if (!plugin_analysis_expander.get_expanded()) { // Hide & remove from expander + const int child_height = plugin_analysis_expander.get_child ()->get_height (); eqgui->hide (); eqgui->stop_listening (); @@ -750,7 +753,10 @@ PlugUIBase::toggle_plugin_analysis() Gtk::Window *toplevel = (Gtk::Window*) plugin_analysis_expander.get_ancestor (GTK_TYPE_WINDOW); if (toplevel) { - toplevel->resize (pre_eq_size.width, pre_eq_size.height); + Gtk::Requisition wr; + toplevel->get_size (wr.width, wr.height); + wr.height -= child_height; + toplevel->resize (wr.width, wr.height); } } } @@ -813,12 +819,6 @@ PlugUIBase::update_preset_modified () } } -void -PlugUIBase::parameter_changed (uint32_t, float) -{ - update_preset_modified (); -} - void PlugUIBase::preset_added_or_removed () {