+ insert->deactivate ();
+ }
+ }
+
+ return false;
+}
+
+bool
+PlugUIBase::focus_toggled (GdkEventButton*)
+{
+ if (Keyboard::the_keyboard().some_magic_widget_has_focus()) {
+ Keyboard::the_keyboard().magic_widget_drop_focus();
+ focus_button.remove ();
+ focus_button.add (*focus_out_image);
+ focus_out_image->show ();
+ ARDOUR_UI::instance()->set_tip (focus_button, string_compose (_("Click to allow the plugin to receive keyboard events that %1 would normally use as a shortcut"), PROGRAM_NAME));
+ KeyboardFocused (false);
+ } else {
+ Keyboard::the_keyboard().magic_widget_grab_focus();
+ focus_button.remove ();
+ focus_button.add (*focus_in_image);
+ focus_in_image->show ();
+ ARDOUR_UI::instance()->set_tip (focus_button, string_compose (_("Click to allow normal use of %1 keyboard shortcuts"), PROGRAM_NAME));
+ KeyboardFocused (true);
+ }
+
+ return true;
+}
+
+void
+PlugUIBase::toggle_description()
+{
+ if (description_expander.get_expanded() &&
+ !description_expander.get_child()) {
+ const std::string text = plugin->get_docs();
+ if (text.empty()) {
+ return;
+ }
+
+ Gtk::Label* label = manage(new Gtk::Label(text));
+ label->set_line_wrap(true);
+ label->set_line_wrap_mode(Pango::WRAP_WORD);
+ description_expander.add(*label);
+ description_expander.show_all();
+ }
+
+ if (!description_expander.get_expanded()) {
+ description_expander.remove();
+ }
+}
+
+
+void
+PlugUIBase::toggle_plugin_analysis()
+{
+ if (plugin_analysis_expander.get_expanded() &&
+ !plugin_analysis_expander.get_child()) {
+ // Create the GUI
+ if (eqgui == 0) {
+ 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 ();
+ }
+
+ if (!plugin_analysis_expander.get_expanded()) {
+ // Hide & remove from expander
+
+ eqgui->hide ();
+ eqgui->stop_listening ();
+ plugin_analysis_expander.remove();
+
+ 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);