session: rename some functions

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15607 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2006-10-29 20:01:00 +00:00
parent 969f292119
commit b9c604e968
9 changed files with 43 additions and 43 deletions

View File

@ -132,7 +132,7 @@ BufferView::BufferView()
saved_positions.resize(saved_positions_num); saved_positions.resize(saved_positions_num);
// load saved bookmarks // load saved bookmarks
BookmarksSection::BookmarkList & bmList = LyX::ref().session().Bookmarks().load(); BookmarksSection::BookmarkList & bmList = LyX::ref().session().bookmarks().load();
for (BookmarksSection::BookmarkList::iterator bm = bmList.begin(); for (BookmarksSection::BookmarkList::iterator bm = bmList.begin();
bm != bmList.end(); ++bm) bm != bmList.end(); ++bm)
if (bm->get<0>() < saved_positions_num) if (bm->get<0>() < saved_positions_num)
@ -167,7 +167,7 @@ void BufferView::setBuffer(Buffer * b)
buffer_->saveCursor(cursor_.selectionBegin(), buffer_->saveCursor(cursor_.selectionBegin(),
cursor_.selectionEnd()); cursor_.selectionEnd());
// current buffer is going to be switched-off, save cursor pos // current buffer is going to be switched-off, save cursor pos
LyX::ref().session().LastFilePos().save(buffer_->fileName(), LyX::ref().session().lastFilePos().save(buffer_->fileName(),
boost::tie(cursor_.pit(), cursor_.pos()) ); boost::tie(cursor_.pit(), cursor_.pos()) );
} }
@ -280,7 +280,7 @@ bool BufferView::loadLyXFile(string const & filename, bool tolastfiles)
if (lyxrc.use_lastfilepos) { if (lyxrc.use_lastfilepos) {
pit_type pit; pit_type pit;
pos_type pos; pos_type pos;
boost::tie(pit, pos) = LyX::ref().session().LastFilePos().load(s); boost::tie(pit, pos) = LyX::ref().session().lastFilePos().load(s);
// I am not sure how to separate the following part to a function // I am not sure how to separate the following part to a function
// so I will leave this to Lars. // so I will leave this to Lars.
// //
@ -299,7 +299,7 @@ bool BufferView::loadLyXFile(string const & filename, bool tolastfiles)
} }
if (tolastfiles) if (tolastfiles)
LyX::ref().session().LastFiles().add(b->fileName()); LyX::ref().session().lastFiles().add(b->fileName());
return true; return true;
} }
@ -574,7 +574,7 @@ void BufferView::saveSavedPositions()
// par_id and pit. // par_id and pit.
for (unsigned int i=1; i < saved_positions_num; ++i) { for (unsigned int i=1; i < saved_positions_num; ++i) {
if ( isSavedPosition(i) ) if ( isSavedPosition(i) )
LyX::ref().session().Bookmarks().save( boost::tie( LyX::ref().session().bookmarks().save( boost::tie(
i, i,
saved_positions[i].filename, saved_positions[i].filename,
saved_positions[i].par_id, saved_positions[i].par_id,

View File

@ -427,7 +427,7 @@ docstring const limit_string_length(docstring const & str)
void expandLastfiles(Menu & tomenu) void expandLastfiles(Menu & tomenu)
{ {
lyx::LastFilesSection::LastFiles const & lf = LyX::cref().session().LastFiles().lastFiles(); lyx::LastFilesSection::LastFiles const & lf = LyX::cref().session().lastFiles().lastFiles();
lyx::LastFilesSection::LastFiles::const_iterator lfit = lf.begin(); lyx::LastFilesSection::LastFiles::const_iterator lfit = lf.begin();
int ii = 1; int ii = 1;

View File

@ -135,7 +135,7 @@ bool BufferList::quitWriteAll()
// if master/slave are both open, do not save slave since it // if master/slave are both open, do not save slave since it
// will be automatically loaded when the master is loaded // will be automatically loaded when the master is loaded
if ((*it)->getMasterBuffer() == (*it)) if ((*it)->getMasterBuffer() == (*it))
LyX::ref().session().LastOpened().add((*it)->fileName()); LyX::ref().session().lastOpened().add((*it)->fileName());
} }
return true; return true;

View File

@ -138,12 +138,12 @@ void GuiView::saveGeometry()
// save windows size and position // save windows size and position
Session & session = LyX::ref().session(); Session & session = LyX::ref().session();
session.SessionInfo().save("WindowWidth", convert<string>(geometry.width())); session.sessionInfo().save("WindowWidth", convert<string>(geometry.width()));
session.SessionInfo().save("WindowHeight", convert<string>(geometry.height())); session.sessionInfo().save("WindowHeight", convert<string>(geometry.height()));
session.SessionInfo().save("WindowIsMaximized", (isMaximized() ? "yes" : "no")); session.sessionInfo().save("WindowIsMaximized", (isMaximized() ? "yes" : "no"));
if (lyxrc.geometry_xysaved) { if (lyxrc.geometry_xysaved) {
session.SessionInfo().save("WindowPosX", convert<string>(geometry.x())); session.sessionInfo().save("WindowPosX", convert<string>(geometry.x()));
session.SessionInfo().save("WindowPosY", convert<string>(geometry.y())); session.sessionInfo().save("WindowPosY", convert<string>(geometry.y()));
} }
} }

View File

@ -101,7 +101,7 @@ bool quitting; // flag, that we are quitting the program
bool menuWrite(Buffer * buffer) bool menuWrite(Buffer * buffer)
{ {
if (buffer->save()) { if (buffer->save()) {
LyX::ref().session().LastFiles().add(buffer->fileName()); LyX::ref().session().lastFiles().add(buffer->fileName());
return true; return true;
} }

View File

@ -493,7 +493,7 @@ void LyX::restoreGuiSession(vector<string> const & files)
// if a file is specified, I assume that user wants to edit *that* file // if a file is specified, I assume that user wants to edit *that* file
if (files.empty() && lyxrc.load_session) { if (files.empty() && lyxrc.load_session) {
vector<string> const & lastopened = pimpl_->session_->LastOpened().getfiles(); vector<string> const & lastopened = pimpl_->session_->lastOpened().getfiles();
// do not add to the lastfile list since these files are restored from // do not add to the lastfile list since these files are restored from
// last seesion, and should be already there (regular files), or should // last seesion, and should be already there (regular files), or should
// not be added at all (help files). // not be added at all (help files).
@ -501,7 +501,7 @@ void LyX::restoreGuiSession(vector<string> const & files)
bind(&LyXView::loadLyXFile, view, _1, false)); bind(&LyXView::loadLyXFile, view, _1, false));
} }
// clear this list to save a few bytes of RAM // clear this list to save a few bytes of RAM
pimpl_->session_->LastOpened().clear(); pimpl_->session_->lastOpened().clear();
} }
@ -522,13 +522,13 @@ LyXView * LyX::newLyXView()
} }
// if lyxrc returns (0,0), then use session info // if lyxrc returns (0,0), then use session info
else { else {
string val = session().SessionInfo().load("WindowWidth"); string val = session().sessionInfo().load("WindowWidth");
if (!val.empty()) if (!val.empty())
width = convert<unsigned int>(val); width = convert<unsigned int>(val);
val = session().SessionInfo().load("WindowHeight"); val = session().sessionInfo().load("WindowHeight");
if (!val.empty()) if (!val.empty())
height = convert<unsigned int>(val); height = convert<unsigned int>(val);
if (session().SessionInfo().load("WindowIsMaximized") == "yes") if (session().sessionInfo().load("WindowIsMaximized") == "yes")
maximize = true; maximize = true;
} }
@ -536,10 +536,10 @@ LyXView * LyX::newLyXView()
int posx = -1; int posx = -1;
int posy = -1; int posy = -1;
if (lyxrc.geometry_xysaved) { if (lyxrc.geometry_xysaved) {
string val = session().SessionInfo().load("WindowPosX"); string val = session().sessionInfo().load("WindowPosX");
if (!val.empty()) if (!val.empty())
posx = convert<int>(val); posx = convert<int>(val);
val = session().SessionInfo().load("WindowPosY"); val = session().sessionInfo().load("WindowPosY");
if (!val.empty()) if (!val.empty())
posy = convert<int>(val); posy = convert<int>(val);
} }

View File

@ -1033,7 +1033,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
// might be visible in more than one LyXView. // might be visible in more than one LyXView.
if (lyx_view_ && lyx_view_->view()->buffer()) { if (lyx_view_ && lyx_view_->view()->buffer()) {
// save cursor Position for opened files to .lyx/session // save cursor Position for opened files to .lyx/session
LyX::ref().session().LastFilePos().save(lyx_view_->buffer()->fileName(), LyX::ref().session().lastFilePos().save(lyx_view_->buffer()->fileName(),
boost::tie(view()->cursor().pit(), view()->cursor().pos()) ); boost::tie(view()->cursor().pit(), view()->cursor().pos()) );
// save bookmarks to .lyx/session // save bookmarks to .lyx/session
view()->saveSavedPositions(); view()->saveSavedPositions();
@ -1968,7 +1968,7 @@ void LyXFunc::doImport(string const & argument)
void LyXFunc::closeBuffer() void LyXFunc::closeBuffer()
{ {
// save current cursor position // save current cursor position
LyX::ref().session().LastFilePos().save(lyx_view_->buffer()->fileName(), LyX::ref().session().lastFilePos().save(lyx_view_->buffer()->fileName(),
boost::tie(view()->cursor().pit(), view()->cursor().pos()) ); boost::tie(view()->cursor().pit(), view()->cursor().pos()) );
if (theBufferList().close(lyx_view_->buffer(), true) && !quitting) { if (theBufferList().close(lyx_view_->buffer(), true) && !quitting) {
if (theBufferList().empty()) { if (theBufferList().empty()) {

View File

@ -327,15 +327,15 @@ void Session::readFile()
// Determine section id // Determine section id
if (tmp == sec_lastfiles) if (tmp == sec_lastfiles)
LastFiles().read(is); lastFiles().read(is);
else if (tmp == sec_lastopened) else if (tmp == sec_lastopened)
LastOpened().read(is); lastOpened().read(is);
else if (tmp == sec_lastfilepos) else if (tmp == sec_lastfilepos)
LastFilePos().read(is); lastFilePos().read(is);
else if (tmp == sec_bookmarks) else if (tmp == sec_bookmarks)
Bookmarks().read(is); bookmarks().read(is);
else if (tmp == sec_session) else if (tmp == sec_session)
SessionInfo().read(is); sessionInfo().read(is);
else else
lyxerr << "LyX: Warning: unknown Session section: " << tmp << endl; lyxerr << "LyX: Warning: unknown Session section: " << tmp << endl;
} }
@ -349,11 +349,11 @@ void Session::writeFile() const
os << "## Automatically generated lyx session file \n" os << "## Automatically generated lyx session file \n"
<< "## Editing this file manually may cause lyx to crash.\n"; << "## Editing this file manually may cause lyx to crash.\n";
LastFiles().write(os); lastFiles().write(os);
LastOpened().write(os); lastOpened().write(os);
LastFilePos().write(os); lastFilePos().write(os);
Bookmarks().write(os); bookmarks().write(os);
SessionInfo().write(os); sessionInfo().write(os);
} else } else
lyxerr << "LyX: Warning: unable to save Session: " lyxerr << "LyX: Warning: unable to save Session: "
<< session_file << endl; << session_file << endl;

View File

@ -247,34 +247,34 @@ public:
void writeFile() const; void writeFile() const;
/// ///
LastFilesSection & LastFiles() { return last_files; } LastFilesSection & lastFiles() { return last_files; }
/// ///
LastFilesSection const & LastFiles() const { return last_files; } LastFilesSection const & lastFiles() const { return last_files; }
/// ///
LastOpenedSection & LastOpened() { return last_opened; } LastOpenedSection & lastOpened() { return last_opened; }
/// ///
LastOpenedSection const & LastOpened() const { return last_opened; } LastOpenedSection const & lastOpened() const { return last_opened; }
/// ///
LastFilePosSection & LastFilePos() { return last_file_pos; } LastFilePosSection & lastFilePos() { return last_file_pos; }
/// ///
LastFilePosSection const & LastFilePos() const { return last_file_pos; } LastFilePosSection const & lastFilePos() const { return last_file_pos; }
/// ///
BookmarksSection & Bookmarks() { return bookmarks; } BookmarksSection & bookmarks() { return bookmarks_; }
/// ///
BookmarksSection const & Bookmarks() const { return bookmarks; } BookmarksSection const & bookmarks() const { return bookmarks_; }
/// ///
SessionInfoSection & SessionInfo() { return session_info; } SessionInfoSection & sessionInfo() { return session_info; }
/// ///
SessionInfoSection const & SessionInfo() const { return session_info; } SessionInfoSection const & sessionInfo() const { return session_info; }
private: private:
/// file to save session, determined in the constructor. /// file to save session, determined in the constructor.
@ -297,7 +297,7 @@ private:
LastFilePosSection last_file_pos; LastFilePosSection last_file_pos;
/// ///
BookmarksSection bookmarks; BookmarksSection bookmarks_;
/// ///
SessionInfoSection session_info; SessionInfoSection session_info;