-
- // FIXME: Switch to the last loaded Buffer. This must not be the first one
- // because the Buffer won't be connected in this case. The correct solution
- // would be to avoid the manual connection of the current Buffer in LyXView.
- if (!pimpl_->buffer_list_.empty())
- view->setBuffer(pimpl_->buffer_list_.last());
-}
-
-
-LyXView * LyX::newLyXView()
-{
- if (!lyx::use_gui)
- return 0;
-
- // determine windows size and position, from lyxrc and/or session
- // initial geometry
- unsigned int width = 690;
- unsigned int height = 510;
- // default icon size, will be overwritten by stored session value
- unsigned int iconSizeXY = 0;
- int maximized = LyXView::NotMaximized;
- // first try lyxrc
- if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) {
- width = lyxrc.geometry_width;
- height = lyxrc.geometry_height;
- }
- // if lyxrc returns (0,0), then use session info
- else {
- string val = session().sessionInfo().load("WindowWidth");
- if (!val.empty())
- width = convert<unsigned int>(val);
- val = session().sessionInfo().load("WindowHeight");
- if (!val.empty())
- height = convert<unsigned int>(val);
- val = session().sessionInfo().load("WindowMaximized");
- if (!val.empty())
- maximized = convert<int>(val);
- val = session().sessionInfo().load("IconSizeXY");
- if (!val.empty())
- iconSizeXY = convert<unsigned int>(val);
- }
-
- // if user wants to restore window position
- int posx = -1;
- int posy = -1;
- if (lyxrc.geometry_xysaved) {
- string val = session().sessionInfo().load("WindowPosX");
- if (!val.empty())
- posx = convert<int>(val);
- val = session().sessionInfo().load("WindowPosY");
- if (!val.empty())
- posy = convert<int>(val);
- }
-
- if (!geometryArg.empty())
- {
- width = 0;
- height = 0;
- }
-
- // create the main window
- LyXView * view = &pimpl_->application_->createView(width, height, posx, posy, maximized, iconSizeXY, geometryArg);
-
- return view;