mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
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:
parent
969f292119
commit
b9c604e968
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -138,12 +138,12 @@ void GuiView::saveGeometry()
|
||||
|
||||
// save windows size and position
|
||||
Session & session = LyX::ref().session();
|
||||
session.SessionInfo().save("WindowWidth", convert<string>(geometry.width()));
|
||||
session.SessionInfo().save("WindowHeight", convert<string>(geometry.height()));
|
||||
session.SessionInfo().save("WindowIsMaximized", (isMaximized() ? "yes" : "no"));
|
||||
session.sessionInfo().save("WindowWidth", convert<string>(geometry.width()));
|
||||
session.sessionInfo().save("WindowHeight", convert<string>(geometry.height()));
|
||||
session.sessionInfo().save("WindowIsMaximized", (isMaximized() ? "yes" : "no"));
|
||||
if (lyxrc.geometry_xysaved) {
|
||||
session.SessionInfo().save("WindowPosX", convert<string>(geometry.x()));
|
||||
session.SessionInfo().save("WindowPosY", convert<string>(geometry.y()));
|
||||
session.sessionInfo().save("WindowPosX", convert<string>(geometry.x()));
|
||||
session.sessionInfo().save("WindowPosY", convert<string>(geometry.y()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 (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
|
||||
// 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<string> 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<unsigned int>(val);
|
||||
val = session().SessionInfo().load("WindowHeight");
|
||||
val = session().sessionInfo().load("WindowHeight");
|
||||
if (!val.empty())
|
||||
height = convert<unsigned int>(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<int>(val);
|
||||
val = session().SessionInfo().load("WindowPosY");
|
||||
val = session().sessionInfo().load("WindowPosY");
|
||||
if (!val.empty())
|
||||
posy = convert<int>(val);
|
||||
}
|
||||
|
@ -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()) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user