Use an expander properly to control the visibility of plugin analysis.
authorSampo Savolainen <v2@iki.fi>
Fri, 8 May 2009 17:21:17 +0000 (17:21 +0000)
committerSampo Savolainen <v2@iki.fi>
Fri, 8 May 2009 17:21:17 +0000 (17:21 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@5067 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/generic_pluginui.cc
gtk2_ardour/plugin_ui.cc
gtk2_ardour/plugin_ui.h

index 713fcfcc8779573c2be567ac6dae826c25c0dc34..0184635b60840f6969b9f53a2c247ec9b503611e 100644 (file)
@@ -74,7 +74,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
        set_border_width (10);
        //set_homogeneous (false);
 
-       pack1(main_contents);
+       pack_start(main_contents);
        settings_box.set_homogeneous (false);
 
        HBox* constraint_hbox = manage (new HBox);
@@ -96,8 +96,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
        
        VBox* v1_box = manage (new VBox);
        VBox* v2_box = manage (new VBox);
-       constraint_hbox->pack_start (eqgui_toggle, false, false);
-       add2(plugin_eq_bin);
+       pack_end(plugin_analysis_expander);
 
        v1_box->pack_start (*smaller_hbox, false, true);
        v2_box->pack_start (focus_button, false, true);
index 21f0a938d6c8c7182f2b81bf71e65320718f0cf7..f398c23d7c9cf0d81fe36d446e83d5e37c6f10e6 100644 (file)
@@ -348,7 +348,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
          save_button(_("Add")),
          bypass_button (_("Bypass")),
          latency_gui (0),
-         eqgui_toggle (_("Freq Analysis"))
+         plugin_analysis_expander (_("Plugin analysis"))
 {
        //preset_combo.set_use_arrows_always(true);
        update_presets();
@@ -363,10 +363,6 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
                        mem_fun(*this, &PlugUIBase::processor_active_changed),
                        boost::weak_ptr<Processor>(insert)));
 
-       eqgui_toggle.set_active (false);
-       eqgui_toggle.signal_toggled().connect( mem_fun(*this, &PlugUIBase::toggle_plugin_analysis));
-
-       
        bypass_button.set_active (!pi->active());
 
        bypass_button.set_name ("PluginBypassButton");
@@ -386,7 +382,9 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
        ARDOUR_UI::instance()->set_tip (&focus_button, _("Click to allow the plugin to receive keyboard events that Ardour would normally use as a shortcut"), "");
        ARDOUR_UI::instance()->set_tip (&bypass_button, _("Click to enable/disable this plugin"), "");
 
-       plugin_eq_bin.set_expanded(true);
+       plugin_analysis_expander.property_expanded().signal_changed().connect( mem_fun(*this, &PlugUIBase::toggle_plugin_analysis));
+
+       plugin_analysis_expander.set_expanded(false);
 }
 
 PlugUIBase::~PlugUIBase()
@@ -510,24 +508,26 @@ PlugUIBase::focus_toggled (GdkEventButton* ev)
 void
 PlugUIBase::toggle_plugin_analysis()
 {
-       if (eqgui_toggle.get_active() && !plugin_eq_bin.get_child()) {
+       if (plugin_analysis_expander.get_expanded() && 
+            !plugin_analysis_expander.get_child()) {
                // Create the GUI
                PluginEqGui *foo = new PluginEqGui(insert);
-               plugin_eq_bin.add( *foo );
-               plugin_eq_bin.show_all();
+               plugin_analysis_expander.add( *foo );
+               plugin_analysis_expander.show_all();
        } 
        
        Gtk::Widget *gui;
 
-       if (!eqgui_toggle.get_active() && (gui = plugin_eq_bin.get_child())) {
+       if (!plugin_analysis_expander.get_expanded() && 
+            (gui = plugin_analysis_expander.get_child())) {
                // Hide & remove
                gui->hide();
-               //plugin_eq_bin.remove(*gui);
-               plugin_eq_bin.remove();
+               //plugin_analysis_expander.remove(*gui);
+               plugin_analysis_expander.remove();
 
                delete gui;
 
-               Gtk::Widget *toplevel = plugin_eq_bin.get_toplevel();
+               Gtk::Widget *toplevel = plugin_analysis_expander.get_toplevel();
                if (!toplevel) {
                        std::cerr << "No toplevel widget?!?!" << std::endl;
                        return;
index e65abbac59d33a8741988d6d1c441aa943f426c1..1e0498212cde6cda851689c4ee2b99b0c1e865cc 100644 (file)
@@ -101,8 +101,7 @@ class PlugUIBase : public virtual sigc::trackable
        LatencyGUI* latency_gui;
        ArdourDialog* latency_dialog;
 
-       Gtk::Expander plugin_eq_bin;
-       Gtk::ToggleButton eqgui_toggle;
+       Gtk::Expander plugin_analysis_expander;
 
        Gtk::Image* focus_out_image;
        Gtk::Image* focus_in_image;
@@ -115,7 +114,7 @@ class PlugUIBase : public virtual sigc::trackable
        void processor_active_changed (boost::weak_ptr<ARDOUR::Processor> p);
 };
 
-class GenericPluginUI : public PlugUIBase, public Gtk::HPaned
+class GenericPluginUI : public PlugUIBase, public Gtk::VBox
 {
   public:
        GenericPluginUI (boost::shared_ptr<ARDOUR::PluginInsert> plug, bool scrollable=false);