From b9c604e968bffcd4aacceee87989782f28492f2f Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Sun, 29 Oct 2006 20:01:00 +0000 Subject: [PATCH] session: rename some functions git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15607 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.C | 10 +++++----- src/MenuBackend.C | 2 +- src/bufferlist.C | 2 +- src/frontends/qt4/GuiView.C | 10 +++++----- src/lyx_cb.C | 2 +- src/lyx_main.C | 14 +++++++------- src/lyxfunc.C | 4 ++-- src/session.C | 20 ++++++++++---------- src/session.h | 22 +++++++++++----------- 9 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/BufferView.C b/src/BufferView.C index 605f19b0ff..93fe6d698b 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -132,7 +132,7 @@ BufferView::BufferView() saved_positions.resize(saved_positions_num); // 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(); bm != bmList.end(); ++bm) if (bm->get<0>() < saved_positions_num) @@ -167,7 +167,7 @@ void BufferView::setBuffer(Buffer * b) buffer_->saveCursor(cursor_.selectionBegin(), cursor_.selectionEnd()); // 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()) ); } @@ -280,7 +280,7 @@ bool BufferView::loadLyXFile(string const & filename, bool tolastfiles) if (lyxrc.use_lastfilepos) { pit_type pit; 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 // so I will leave this to Lars. // @@ -299,7 +299,7 @@ bool BufferView::loadLyXFile(string const & filename, bool tolastfiles) } if (tolastfiles) - LyX::ref().session().LastFiles().add(b->fileName()); + LyX::ref().session().lastFiles().add(b->fileName()); return true; } @@ -574,7 +574,7 @@ void BufferView::saveSavedPositions() // par_id and pit. for (unsigned int i=1; i < saved_positions_num; ++i) { if ( isSavedPosition(i) ) - LyX::ref().session().Bookmarks().save( boost::tie( + LyX::ref().session().bookmarks().save( boost::tie( i, saved_positions[i].filename, saved_positions[i].par_id, diff --git a/src/MenuBackend.C b/src/MenuBackend.C index 66c54a2441..362f02d509 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -427,7 +427,7 @@ docstring const limit_string_length(docstring const & str) 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(); int ii = 1; diff --git a/src/bufferlist.C b/src/bufferlist.C index a534ecfc13..fe6516fa4b 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -135,7 +135,7 @@ bool BufferList::quitWriteAll() // if master/slave are both open, do not save slave since it // will be automatically loaded when the master is loaded if ((*it)->getMasterBuffer() == (*it)) - LyX::ref().session().LastOpened().add((*it)->fileName()); + LyX::ref().session().lastOpened().add((*it)->fileName()); } return true; diff --git a/src/frontends/qt4/GuiView.C b/src/frontends/qt4/GuiView.C index d9b65427d5..ed81ade5e0 100644 --- a/src/frontends/qt4/GuiView.C +++ b/src/frontends/qt4/GuiView.C @@ -138,12 +138,12 @@ void GuiView::saveGeometry() // save windows size and position Session & session = LyX::ref().session(); - session.SessionInfo().save("WindowWidth", convert(geometry.width())); - session.SessionInfo().save("WindowHeight", convert(geometry.height())); - session.SessionInfo().save("WindowIsMaximized", (isMaximized() ? "yes" : "no")); + session.sessionInfo().save("WindowWidth", convert(geometry.width())); + session.sessionInfo().save("WindowHeight", convert(geometry.height())); + session.sessionInfo().save("WindowIsMaximized", (isMaximized() ? "yes" : "no")); if (lyxrc.geometry_xysaved) { - session.SessionInfo().save("WindowPosX", convert(geometry.x())); - session.SessionInfo().save("WindowPosY", convert(geometry.y())); + session.sessionInfo().save("WindowPosX", convert(geometry.x())); + session.sessionInfo().save("WindowPosY", convert(geometry.y())); } } diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 861c3e9ff6..4ca5a5a0ff 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -101,7 +101,7 @@ bool quitting; // flag, that we are quitting the program bool menuWrite(Buffer * buffer) { if (buffer->save()) { - LyX::ref().session().LastFiles().add(buffer->fileName()); + LyX::ref().session().lastFiles().add(buffer->fileName()); return true; } diff --git a/src/lyx_main.C b/src/lyx_main.C index 4138b5d095..fce2656ba5 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -493,7 +493,7 @@ void LyX::restoreGuiSession(vector const & files) // if a file is specified, I assume that user wants to edit *that* file if (files.empty() && lyxrc.load_session) { - vector const & lastopened = pimpl_->session_->LastOpened().getfiles(); + vector const & lastopened = pimpl_->session_->lastOpened().getfiles(); // do not add to the lastfile list since these files are restored from // last seesion, and should be already there (regular files), or should // not be added at all (help files). @@ -501,7 +501,7 @@ void LyX::restoreGuiSession(vector const & files) bind(&LyXView::loadLyXFile, view, _1, false)); } // 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 else { - string val = session().SessionInfo().load("WindowWidth"); + string val = session().sessionInfo().load("WindowWidth"); if (!val.empty()) width = convert(val); - val = session().SessionInfo().load("WindowHeight"); + val = session().sessionInfo().load("WindowHeight"); if (!val.empty()) height = convert(val); - if (session().SessionInfo().load("WindowIsMaximized") == "yes") + if (session().sessionInfo().load("WindowIsMaximized") == "yes") maximize = true; } @@ -536,10 +536,10 @@ LyXView * LyX::newLyXView() int posx = -1; int posy = -1; if (lyxrc.geometry_xysaved) { - string val = session().SessionInfo().load("WindowPosX"); + string val = session().sessionInfo().load("WindowPosX"); if (!val.empty()) posx = convert(val); - val = session().SessionInfo().load("WindowPosY"); + val = session().sessionInfo().load("WindowPosY"); if (!val.empty()) posy = convert(val); } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 1f28e643c8..3d249d36ca 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1033,7 +1033,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd) // might be visible in more than one LyXView. if (lyx_view_ && lyx_view_->view()->buffer()) { // 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()) ); // save bookmarks to .lyx/session view()->saveSavedPositions(); @@ -1968,7 +1968,7 @@ void LyXFunc::doImport(string const & argument) void LyXFunc::closeBuffer() { // 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()) ); if (theBufferList().close(lyx_view_->buffer(), true) && !quitting) { if (theBufferList().empty()) { diff --git a/src/session.C b/src/session.C index 21b31d9e3f..02edebd0a8 100644 --- a/src/session.C +++ b/src/session.C @@ -327,15 +327,15 @@ void Session::readFile() // Determine section id if (tmp == sec_lastfiles) - LastFiles().read(is); + lastFiles().read(is); else if (tmp == sec_lastopened) - LastOpened().read(is); + lastOpened().read(is); else if (tmp == sec_lastfilepos) - LastFilePos().read(is); + lastFilePos().read(is); else if (tmp == sec_bookmarks) - Bookmarks().read(is); + bookmarks().read(is); else if (tmp == sec_session) - SessionInfo().read(is); + sessionInfo().read(is); else lyxerr << "LyX: Warning: unknown Session section: " << tmp << endl; } @@ -349,11 +349,11 @@ void Session::writeFile() const os << "## Automatically generated lyx session file \n" << "## Editing this file manually may cause lyx to crash.\n"; - LastFiles().write(os); - LastOpened().write(os); - LastFilePos().write(os); - Bookmarks().write(os); - SessionInfo().write(os); + lastFiles().write(os); + lastOpened().write(os); + lastFilePos().write(os); + bookmarks().write(os); + sessionInfo().write(os); } else lyxerr << "LyX: Warning: unable to save Session: " << session_file << endl; diff --git a/src/session.h b/src/session.h index e3cfed8285..f9016dc40a 100644 --- a/src/session.h +++ b/src/session.h @@ -247,34 +247,34 @@ public: 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: /// file to save session, determined in the constructor. @@ -297,7 +297,7 @@ private: LastFilePosSection last_file_pos; /// - BookmarksSection bookmarks; + BookmarksSection bookmarks_; /// SessionInfoSection session_info; -- 2.39.2