2 Copyright (C) 2000 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include <pbd/stl_delete.h>
26 #include <pbd/xml++.h>
27 #include <pbd/failed_constructor.h>
29 #include <gtkmm2ext/click_box.h>
30 #include <gtkmm2ext/fastmeter.h>
31 #include <gtkmm2ext/barcontroller.h>
32 #include <gtkmm2ext/utils.h>
33 #include <gtkmm2ext/doi.h>
34 #include <gtkmm2ext/slider_controller.h>
36 #include <midi++/manager.h>
38 #include <ardour/plugin.h>
39 #include <ardour/plugin_insert.h>
40 #include <ardour/ladspa_plugin.h>
42 #include <ardour/lv2_plugin.h>
47 #include "ardour_ui.h"
49 #include "plugin_ui.h"
51 #include "gui_thread.h"
52 #include "automation_controller.h"
53 #include "plugin_eq_gui.h"
58 using namespace ARDOUR;
60 using namespace Gtkmm2ext;
64 GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrollable)
66 button_table (initial_button_rows, initial_button_cols),
67 output_table (initial_output_rows, initial_output_cols),
68 eqgui_toggle(_("Freq Analysis")),
69 hAdjustment(0.0, 0.0, 0.0),
70 vAdjustment(0.0, 0.0, 0.0),
71 scroller_view(hAdjustment, vAdjustment),
73 is_scrollable(scrollable)
75 set_name ("PluginEditor");
76 set_border_width (10);
77 //set_homogeneous (false);
81 settings_box.set_homogeneous (false);
83 HBox* constraint_hbox = manage (new HBox);
84 HBox* smaller_hbox = manage (new HBox);
85 Label* combo_label = manage (new Label (_("<span size=\"large\">Presets</span>")));
86 combo_label->set_use_markup (true);
88 Label* latency_label = manage (new Label (_("<span size=\"large\">Latency</span>")));
89 latency_label->set_use_markup (true);
91 smaller_hbox->pack_start (*latency_label, false, false, 10);
92 smaller_hbox->pack_start (latency_gui, false, false, 10);
93 smaller_hbox->pack_start (preset_combo, false, false);
94 smaller_hbox->pack_start (save_button, false, false);
96 constraint_hbox->set_spacing (5);
97 constraint_hbox->pack_start (*smaller_hbox, true, false);
98 constraint_hbox->pack_end (bypass_button, false, false);
99 constraint_hbox->pack_start (eqgui_toggle, false, false);
101 settings_box.pack_end (*constraint_hbox, false, false);
103 main_contents.pack_start (settings_box, false, false);
105 if ( is_scrollable ) {
106 scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
107 scroller.set_name ("PluginEditor");
108 scroller_view.set_name("PluginEditor");
109 scroller_view.add (hpacker);
110 scroller.add (scroller_view);
112 main_contents.pack_start (scroller, true, true);
116 main_contents.pack_start (hpacker, false, false);
119 eqgui_toggle.set_active (false);
120 eqgui_toggle.signal_toggled().connect( mem_fun(*this, &GenericPluginUI::toggle_plugin_analysis));
122 pi->ActiveChanged.connect (bind(mem_fun(*this, &GenericPluginUI::processor_active_changed),
123 boost::weak_ptr<Processor>(pi)));
124 bypass_button.set_active (!pi->active());
129 GenericPluginUI::~GenericPluginUI ()
131 if (output_controls.size() > 0) {
132 screen_update_connection.disconnect();
137 GenericPluginUI::build ()
145 int output_row, output_col;
146 int button_row, button_col;
147 int output_rows, output_cols;
148 int button_rows, button_cols;
151 hpacker.set_spacing (10);
153 output_rows = initial_output_rows;
154 output_cols = initial_output_cols;
155 button_rows = initial_button_rows;
156 button_cols = initial_button_cols;
162 button_table.set_homogeneous (false);
163 button_table.set_row_spacings (2);
164 button_table.set_col_spacings (2);
165 output_table.set_homogeneous (true);
166 output_table.set_row_spacings (2);
167 output_table.set_col_spacings (2);
168 button_table.set_border_width (5);
169 output_table.set_border_width (5);
171 hpacker.set_border_width (10);
173 bt_frame = manage (new Frame);
174 bt_frame->set_name ("BaseFrame");
175 bt_frame->add (button_table);
176 hpacker.pack_start(*bt_frame, true, true);
178 box = manage (new VBox);
179 box->set_border_width (5);
180 box->set_spacing (1);
182 frame = manage (new Frame);
183 frame->set_name ("BaseFrame");
184 frame->set_label (_("Controls"));
186 hpacker.pack_start(*frame, true, true);
188 /* find all ports. build control elements for all appropriate control ports */
190 for (i = 0; i < plugin->parameter_count(); ++i) {
192 if (plugin->parameter_is_control (i)) {
194 /* Don't show latency control ports */
196 if (plugin->describe_parameter (Evoral::Parameter(PluginAutomation, 0, i)) == X_("latency")) {
202 /* if we are scrollable, just use one long column */
204 if (!is_scrollable) {
206 frame = manage (new Frame);
207 frame->set_name ("BaseFrame");
208 box = manage (new VBox);
210 box->set_border_width (5);
211 box->set_spacing (1);
214 hpacker.pack_start(*frame,true,true);
220 boost::shared_ptr<ARDOUR::AutomationControl> c
221 = boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(
222 insert->data().control(Evoral::Parameter(PluginAutomation, 0, i)));
224 if ((cui = build_control_ui (i, c)) == 0) {
225 error << string_compose(_("Plugin Editor: could not build control element for port %1"), i) << endmsg;
229 if (cui->controller || cui->clickbox || cui->combo) {
231 box->pack_start (*cui, false, false);
233 } else if (cui->button) {
235 if (button_row == button_rows) {
237 if (++button_col == button_cols) {
239 button_table.resize (button_rows, button_cols);
243 button_table.attach (*cui, button_col, button_col + 1, button_row, button_row+1,
247 } else if (cui->display) {
249 output_table.attach (*cui, output_col, output_col + 1, output_row, output_row+1,
252 // TODO: The meters should be divided into multiple rows
254 if (++output_col == output_cols) {
256 output_table.resize (output_rows, output_cols);
259 /* old code, which divides meters into
260 * columns first, rows later. New code divides into one row
262 if (output_row == output_rows) {
264 if (++output_col == output_cols) {
266 output_table.resize (output_rows, output_cols);
270 output_table.attach (*cui, output_col, output_col + 1, output_row, output_row+1,
277 /* HACK: ideally the preferred height would be queried from
278 the complete hpacker, but I can't seem to get that
279 information in time, so this is an estimation
287 if (box->children().empty()) {
288 hpacker.remove (*frame);
291 if (button_table.children().empty()) {
292 hpacker.remove (*bt_frame);
295 if (!output_table.children().empty()) {
296 frame = manage (new Frame);
297 frame->set_name ("BaseFrame");
298 frame->add (output_table);
299 hpacker.pack_end (*frame, true, true);
304 output_table.show_all ();
305 button_table.show_all ();
308 GenericPluginUI::ControlUI::ControlUI ()
309 : automate_button (X_("")) // force creation of a label
311 automate_button.set_name ("PluginAutomateButton");
312 ARDOUR_UI::instance()->tooltips().set_tip (automate_button, _("Automation control"));
314 /* XXX translators: use a string here that will be at least as long
315 as the longest automation label (see ::automation_state_changed()
316 below). be sure to include a descender.
319 set_size_request_to_display_given_text (*automate_button.get_child(), _("Mgnual"), 5, 5);
328 GenericPluginUI::ControlUI::~ControlUI()
331 delete meterinfo->meter;
337 GenericPluginUI::automation_state_changed (ControlUI* cui)
339 /* update button label */
341 // don't lock to avoid deadlock because we're triggered by
342 // AutomationControl::Changed() while the automation lock is taken
343 switch (insert->get_parameter_automation_state (cui->parameter(), false)
344 & (Off|Play|Touch|Write)) {
346 cui->automate_button.set_label (_("Manual"));
349 cui->automate_button.set_label (_("Play"));
352 cui->automate_button.set_label (_("Write"));
355 cui->automate_button.set_label (_("Touch"));
358 cui->automate_button.set_label (_("???"));
364 static void integer_printer (char buf[32], Adjustment &adj, void *arg)
366 snprintf (buf, 32, "%.0f", adj.get_value());
370 GenericPluginUI::print_parameter (char *buf, uint32_t len, uint32_t param)
372 plugin->print_parameter (param, buf, len);
375 GenericPluginUI::ControlUI*
376 GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<AutomationControl> mcontrol)
378 ControlUI* control_ui = NULL;
382 Plugin::ParameterDescriptor desc;
384 plugin->get_parameter_descriptor (port_index, desc);
386 control_ui = manage (new ControlUI ());
387 control_ui->combo = 0;
388 control_ui->combo_map = 0;
389 control_ui->control = mcontrol;
390 control_ui->update_pending = false;
391 control_ui->label.set_text (desc.label);
392 control_ui->label.set_alignment (0.0, 0.5);
393 control_ui->label.set_name ("PluginParameterLabel");
395 control_ui->set_spacing (5);
397 Gtk::Requisition req (control_ui->automate_button.size_request());
399 if (plugin->parameter_is_input (port_index)) {
401 boost::shared_ptr<LadspaPlugin> lp;
403 boost::shared_ptr<LV2Plugin> lv2p;
405 if ((lp = boost::dynamic_pointer_cast<LadspaPlugin>(plugin)) != 0) {
407 // FIXME: not all plugins have a numeric unique ID
408 uint32_t id = atol (lp->unique_id().c_str());
409 lrdf_defaults* defaults = lrdf_get_scale_values(id, port_index);
411 if (defaults && defaults->count > 0) {
413 control_ui->combo = new Gtk::ComboBoxText;
414 //control_ui->combo->set_value_in_list(true, false);
415 set_popdown_strings (*control_ui->combo, setup_scale_values(port_index, control_ui));
416 control_ui->combo->signal_changed().connect (bind (mem_fun(*this, &GenericPluginUI::control_combo_changed), control_ui));
417 mcontrol->Changed.connect (bind (mem_fun (*this, &GenericPluginUI::parameter_changed), control_ui));
418 control_ui->pack_start(control_ui->label, true, true);
419 control_ui->pack_start(*control_ui->combo, false, true);
421 update_control_display(control_ui);
423 lrdf_free_setting_values(defaults);
428 } else if ((lv2p = boost::dynamic_pointer_cast<LV2Plugin>(plugin)) != 0) {
430 SLV2Port port = lv2p->slv2_port(port_index);
431 SLV2ScalePoints points = slv2_port_get_scale_points(lv2p->slv2_plugin(), port);
434 control_ui->combo = new Gtk::ComboBoxText;
435 //control_ui->combo->set_value_in_list(true, false);
436 set_popdown_strings (*control_ui->combo, setup_scale_values(port_index, control_ui));
437 control_ui->combo->signal_changed().connect (bind (mem_fun(*this, &GenericPluginUI::control_combo_changed), control_ui));
438 mcontrol->Changed.connect (bind (mem_fun (*this, &GenericPluginUI::parameter_changed), control_ui));
439 control_ui->pack_start(control_ui->label, true, true);
440 control_ui->pack_start(*control_ui->combo, false, true);
442 update_control_display(control_ui);
444 slv2_scale_points_free(points);
454 control_ui->button = manage (new ToggleButton ());
455 control_ui->button->set_name ("PluginEditorButton");
456 control_ui->button->set_size_request (20, 20);
458 control_ui->pack_start (control_ui->label, true, true);
459 control_ui->pack_start (*control_ui->button, false, true);
460 control_ui->pack_start (control_ui->automate_button, false, false);
462 control_ui->button->signal_clicked().connect (bind (mem_fun(*this, &GenericPluginUI::control_port_toggled), control_ui));
464 if(plugin->get_parameter (port_index) == 1){
465 control_ui->button->set_active(true);
471 /* create the controller */
473 control_ui->controller = AutomationController::create(insert, mcontrol->parameter(), mcontrol);
474 /* XXX this code is not right yet, because it doesn't handle
475 the absence of bounds in any sensible fashion.
479 control_ui->controller->adjustment()->set_lower (desc.lower);
480 control_ui->controller->adjustment()->set_upper (desc.upper);
482 control_ui->logarithmic = false; // just disable it for now
484 control_ui->logarithmic = desc.logarithmic;
485 if (control_ui->logarithmic) {
486 if (control_ui->controller->adjustment()->get_lower() == 0.0) {
487 control_ui->controller->adjustment()->set_lower (control_ui->controller->adjustment()->get_upper()/10000);
489 control_ui->controller->adjustment()->set_upper (log(control_ui->controller->adjustment()->get_upper()));
490 control_ui->controller->adjustment()->set_lower (log(control_ui->controller->adjustment()->get_lower()));
494 float delta = desc.upper - desc.lower;
496 control_ui->controller->adjustment()->set_page_size (delta/100.0);
497 control_ui->controller->adjustment()->set_step_increment (desc.step);
498 control_ui->controller->adjustment()->set_page_increment (desc.largestep);
501 if (desc.integer_step) {
502 control_ui->clickbox = new ClickBox (control_ui->controller->adjustment(), "PluginUIClickBox");
503 Gtkmm2ext::set_size_request_to_display_given_text (*control_ui->clickbox, "g9999999", 2, 2);
504 control_ui->clickbox->set_print_func (integer_printer, 0);
506 //sigc::slot<void,char*,uint32_t> pslot = sigc::bind (mem_fun(*this, &GenericPluginUI::print_parameter), (uint32_t) port_index);
508 control_ui->controller->set_size_request (200, req.height);
509 control_ui->controller->set_name (X_("PluginSlider"));
510 control_ui->controller->set_style (BarController::LeftToRight);
511 control_ui->controller->set_use_parent (true);
513 control_ui->controller->StartGesture.connect (bind (mem_fun(*this, &GenericPluginUI::start_touch), control_ui));
514 control_ui->controller->StopGesture.connect (bind (mem_fun(*this, &GenericPluginUI::stop_touch), control_ui));
518 if (control_ui->logarithmic) {
519 control_ui->controller->adjustment()->set_value(log(plugin->get_parameter(port_index)));
521 control_ui->controller->adjustment()->set_value(plugin->get_parameter(port_index));
524 /* XXX memory leak: SliderController not destroyed by ControlUI
525 destructor, and manage() reports object hierarchy
529 control_ui->pack_start (control_ui->label, true, true);
530 if (desc.integer_step) {
531 control_ui->pack_start (*control_ui->clickbox, false, false);
533 control_ui->pack_start (*control_ui->controller, false, false);
536 control_ui->pack_start (control_ui->automate_button, false, false);
537 control_ui->automate_button.signal_clicked().connect (bind (mem_fun(*this, &GenericPluginUI::astate_clicked), control_ui, (uint32_t) port_index));
539 automation_state_changed (control_ui);
541 mcontrol->Changed.connect (bind (mem_fun (*this, &GenericPluginUI::parameter_changed), control_ui));
542 mcontrol->alist()->automation_state_changed.connect
543 (bind (mem_fun(*this, &GenericPluginUI::automation_state_changed), control_ui));
545 } else if (plugin->parameter_is_output (port_index)) {
547 control_ui->display = manage (new EventBox);
548 control_ui->display->set_name ("ParameterValueDisplay");
550 control_ui->display_label = manage (new Label);
552 control_ui->display_label->set_name ("ParameterValueDisplay");
554 control_ui->display->add (*control_ui->display_label);
555 Gtkmm2ext::set_size_request_to_display_given_text (*control_ui->display, "-99,99", 2, 2);
557 control_ui->display->show_all ();
560 /* TODO: only make a meter if the port is Hinted for it */
562 MeterInfo * info = new MeterInfo(port_index);
563 control_ui->meterinfo = info;
565 info->meter = new FastMeter (5, 5, FastMeter::Vertical);
567 info->min_unbound = desc.min_unbound;
568 info->max_unbound = desc.max_unbound;
570 info->min = desc.lower;
571 info->max = desc.upper;
573 control_ui->vbox = manage (new VBox);
574 control_ui->hbox = manage (new HBox);
576 control_ui->label.set_angle(90);
577 control_ui->hbox->pack_start (control_ui->label, false, false);
578 control_ui->hbox->pack_start (*info->meter, false, false);
580 control_ui->vbox->pack_start (*control_ui->hbox, false, false);
582 control_ui->vbox->pack_start (*control_ui->display, false, false);
584 control_ui->pack_start (*control_ui->vbox);
586 control_ui->meterinfo->meter->show_all();
587 control_ui->meterinfo->packed = true;
589 output_controls.push_back (control_ui);
592 mcontrol->Changed.connect (bind (mem_fun (*this, &GenericPluginUI::parameter_changed), control_ui));
598 GenericPluginUI::start_touch (GenericPluginUI::ControlUI* cui)
600 cui->control->start_touch ();
604 GenericPluginUI::stop_touch (GenericPluginUI::ControlUI* cui)
606 cui->control->stop_touch ();
610 GenericPluginUI::astate_clicked (ControlUI* cui, uint32_t port)
612 using namespace Menu_Helpers;
614 if (automation_menu == 0) {
615 automation_menu = manage (new Menu);
616 automation_menu->set_name ("ArdourContextMenu");
619 MenuList& items (automation_menu->items());
622 items.push_back (MenuElem (_("Manual"),
623 bind (mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Off, cui)));
624 items.push_back (MenuElem (_("Play"),
625 bind (mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Play, cui)));
626 items.push_back (MenuElem (_("Write"),
627 bind (mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Write, cui)));
628 items.push_back (MenuElem (_("Touch"),
629 bind (mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Touch, cui)));
631 automation_menu->popup (1, gtk_get_current_event_time());
635 GenericPluginUI::set_automation_state (AutoState state, ControlUI* cui)
637 insert->set_parameter_automation_state (cui->parameter(), state);
641 GenericPluginUI::parameter_changed (ControlUI* cui)
643 if (!cui->update_pending) {
644 cui->update_pending = true;
645 Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &GenericPluginUI::update_control_display), cui));
650 GenericPluginUI::update_control_display (ControlUI* cui)
652 /* XXX how do we handle logarithmic stuff here ? */
654 cui->update_pending = false;
656 float val = cui->control->get_value();
658 cui->ignore_change++;
660 std::map<string,float>::iterator it;
661 for (it = cui->combo_map->begin(); it != cui->combo_map->end(); ++it) {
662 if (it->second == val) {
663 cui->combo->set_active_text(it->first);
667 } else if (cui->button) {
670 cui->button->set_active (true);
672 cui->button->set_active (false);
676 if( cui->controller ) {
677 cui->controller->display_effective_value();
682 if (cui->logarithmic) {
685 if (val != cui->adjustment->get_value()) {
686 cui->adjustment->set_value (val);
689 cui->ignore_change--;
693 GenericPluginUI::control_port_toggled (ControlUI* cui)
695 if (!cui->ignore_change) {
696 insert->automation_control(cui->parameter())->set_value(cui->button->get_active());
701 GenericPluginUI::control_combo_changed (ControlUI* cui)
703 if (!cui->ignore_change) {
704 string value = cui->combo->get_active_text();
705 std::map<string,float> mapping = *cui->combo_map;
706 insert->automation_control(cui->parameter())->set_value(mapping[value]);
711 GenericPluginUI::processor_active_changed (boost::weak_ptr<Processor> weak_processor)
713 ENSURE_GUI_THREAD(bind (mem_fun(*this, &GenericPluginUI::processor_active_changed), weak_processor));
715 boost::shared_ptr<Processor> processor = weak_processor.lock();
717 bypass_button.set_active (!processor || !processor->active());
721 GenericPluginUI::start_updating (GdkEventAny* ignored)
723 if (output_controls.size() > 0 ) {
724 screen_update_connection.disconnect();
725 screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect
726 (mem_fun(*this, &GenericPluginUI::output_update));
732 GenericPluginUI::stop_updating (GdkEventAny* ignored)
734 if (output_controls.size() > 0 ) {
735 screen_update_connection.disconnect();
741 GenericPluginUI::output_update ()
743 for (vector<ControlUI*>::iterator i = output_controls.begin(); i != output_controls.end(); ++i) {
744 float val = plugin->get_parameter ((*i)->parameter().id());
746 snprintf (buf, sizeof(buf), "%.2f", val);
747 (*i)->display_label->set_text (buf);
749 /* autoscaling for the meter */
750 if ((*i)->meterinfo && (*i)->meterinfo->packed) {
752 if (val < (*i)->meterinfo->min) {
753 if ((*i)->meterinfo->min_unbound)
754 (*i)->meterinfo->min = val;
756 val = (*i)->meterinfo->min;
759 if (val > (*i)->meterinfo->max) {
760 if ((*i)->meterinfo->max_unbound)
761 (*i)->meterinfo->max = val;
763 val = (*i)->meterinfo->max;
766 if ((*i)->meterinfo->max > (*i)->meterinfo->min ) {
767 float lval = (val - (*i)->meterinfo->min) / ((*i)->meterinfo->max - (*i)->meterinfo->min) ;
768 (*i)->meterinfo->meter->set (lval );
775 GenericPluginUI::setup_scale_values(guint32 port_index, ControlUI* cui)
777 vector<string> enums;
778 boost::shared_ptr<LadspaPlugin> lp;
780 boost::shared_ptr<LV2Plugin> lv2p;
783 if ((lp = boost::dynamic_pointer_cast<LadspaPlugin>(plugin)) != 0) {
784 // all LADPSA plugins have a numeric unique ID
785 uint32_t id = atol (lp->unique_id().c_str());
787 cui->combo_map = new std::map<string, float>;
788 lrdf_defaults* defaults = lrdf_get_scale_values(id, port_index);
790 for (uint32_t i = 0; i < defaults->count; ++i) {
791 enums.push_back(defaults->items[i].label);
792 pair<string, float> newpair;
793 newpair.first = defaults->items[i].label;
794 newpair.second = defaults->items[i].value;
795 cui->combo_map->insert(newpair);
798 lrdf_free_setting_values(defaults);
802 } else if ((lv2p = boost::dynamic_pointer_cast<LV2Plugin>(plugin)) != 0) {
804 SLV2Port port = lv2p->slv2_port(port_index);
805 SLV2ScalePoints points = slv2_port_get_scale_points(lv2p->slv2_plugin(), port);
806 cui->combo_map = new std::map<string, float>;
808 for (unsigned i=0; i < slv2_scale_points_size(points); ++i) {
809 SLV2ScalePoint p = slv2_scale_points_get_at(points, i);
810 SLV2Value label = slv2_scale_point_get_label(p);
811 SLV2Value value = slv2_scale_point_get_value(p);
812 if (label && (slv2_value_is_float(value) || slv2_value_is_int(value))) {
813 enums.push_back(slv2_value_as_string(label));
814 pair<string, float> newpair;
815 newpair.first = slv2_value_as_string(label);
816 newpair.second = slv2_value_as_float(value);
817 cui->combo_map->insert(newpair);
821 slv2_scale_points_free(points);
831 GenericPluginUI::toggle_plugin_analysis()
836 if (eqgui_toggle.get_active() && !get_child2()) {
838 PluginEqGui *foo = new PluginEqGui(insert);
845 if (!eqgui_toggle.get_active() && (gui = get_child2())) {
852 Gtk::Widget *toplevel = get_toplevel();
854 std::cerr << "No toplevel widget?!?!" << std::endl;
858 Gtk::Container *cont = dynamic_cast<Gtk::Container *>(toplevel);
860 std::cerr << "Toplevel widget is not a container?!?" << std::endl;
864 Gtk::Allocation alloc(0, 0, 50, 50); // Just make it small
865 toplevel->size_allocate(alloc);