13
0

Use an expander properly to control the visibility of plugin analysis.

git-svn-id: svn://localhost/ardour2/branches/3.0@5067 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sampo Savolainen 2009-05-08 17:21:17 +00:00
parent 05c597d0ee
commit 764e6f919f
3 changed files with 17 additions and 19 deletions

View 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);

View 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;

View 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);