+ int const air = 2;
+
+ // Logical layout of the boxes making up the LyX window.
+ shared_ptr<Box> top = window_.children().push_back(Box(0,0));
+ shared_ptr<Box> middle = window_.children().push_back(Box(0,0));
+ middle->set(Box::Horizontal);
+ shared_ptr<Box> bottom = window_.children().push_back(Box(0,0));
+
+ shared_ptr<Box> left = middle->children().push_back(Box(air,0));
+ shared_ptr<Box> center = middle->children().push_back(Box(0,0));
+ center->set(Box::Expand);
+ shared_ptr<Box> right = middle->children().push_back(Box(air,0));
+
+ // Define accessors to the various boxes.
+ box_map_[Top] = top;
+ box_map_[Bottom] = bottom;
+ box_map_[Left] = left;
+ box_map_[Center] = center;
+ box_map_[Right] = right;
+
+ // Define the XForms components making up the window.
+ // Each uses the layout engine defined above to control its
+ // dimensions.
+ form_ = fl_bgn_form(FL_NO_BOX, width, height);
+ form_->u_vdata = this;
+ fl_set_form_atclose(form_, C_XFormsView_atCloseMainFormCB, this);
+
+ FL_OBJECT * obj = fl_add_box(FL_FLAT_BOX, 0, 0, width, height, "");
+ fl_set_object_color(obj, FL_MCOL, FL_MCOL);
+
+ menubar_.reset(new XFormsMenubar(this, menubackend));
+ getToolbars().init();
+ bufferview_.reset(new BufferView(this, width, height));
+ minibuffer_.reset(new XMiniBuffer(*this, *controlcommand_));
+
+ // Assign an icon to the main form.
+ string const iconname = libFileSearch("images", "lyx", "xpm");
+ if (!iconname.empty()) {
+ unsigned int w, h;
+ icon_pixmap_ = fl_read_pixmapfile(fl_root,
+ iconname.c_str(),
+ &w,
+ &h,
+ &icon_mask_,
+ 0,
+ 0,
+ 0);
+ fl_set_form_icon(form_, icon_pixmap_, icon_mask_);
+ }
+
+ fl_end_form();
+
+ // Update the layout so that all widgets fit.
+ window_.show();
+ updateMetrics(true);