- pimpl_->session_->lastOpened().clear();
-
- } else if (lyxrc.load_session) {
- vector<FileName> const & lastopened = pimpl_->session_->lastOpened().getfiles();
- // do not add to the lastfile list since these files are restored from
- // last session, and should be already there (regular files), or should
- // not be added at all (help files).
- for_each(lastopened.begin(), lastopened.end(),
- bind(&LyXView::loadLyXFile, view, _1, false));
-
- // clear this list to save a few bytes of RAM
- pimpl_->session_->lastOpened().clear();
- }
-
- BufferList::iterator I = pimpl_->buffer_list_.begin();
- BufferList::iterator end = pimpl_->buffer_list_.end();
- for (; I != end; ++I) {
- Buffer * buf = *I;
- if (buf != buf->masterBuffer())
- continue;
- updateLabels(*buf);
- }
-
- // 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;
-
- // FIXME: transfer all this geometry stuff to the frontend.
-
- // 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;
- // FIXME: 0 means GuiView::NotMaximized by default!
- int maximized = 0;
- // 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);