* GuiDocument.{cpp,h}:

- do not rename branches in the document unless the dialog was applied.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30466 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2009-07-11 09:37:28 +00:00
parent c650dcd540
commit 5c4758357f
2 changed files with 28 additions and 2 deletions

View File

@ -2561,6 +2561,7 @@ bool GuiDocument::initialiseParams(string const &)
//selected, and that we don't have conflicts. If so, we could
//at least pop up a warning.
paramsToDialog();
changedBranches_.clear();
return true;
}
@ -2639,6 +2640,9 @@ void GuiDocument::dispatchParams()
// This must come first so that a language change is correctly noticed
setLanguage();
// rename branches in the document
executeBranchRenaming();
// Apply the BufferParams. Note that this will set the base class
// and then update the buffer's layout.
dispatch_bufferparams(*this, params(), LFUN_BUFFER_PARAMS_APPLY);
@ -2816,8 +2820,26 @@ void GuiDocument::updateUnknownBranches()
void GuiDocument::branchesRename(docstring const & oldname, docstring const & newname)
{
docstring const arg = '"' + oldname + '"' + " " + '"' + newname + '"';
map<docstring, docstring>::iterator it = changedBranches_.begin();
for (; it != changedBranches_.end() ; ++it) {
if (it->second == oldname) {
// branch has already been renamed
it->second = newname;
return;
}
}
// store new name
changedBranches_[oldname] = newname;
}
void GuiDocument::executeBranchRenaming() const
{
map<docstring, docstring>::const_iterator it = changedBranches_.begin();
for (; it != changedBranches_.end() ; ++it) {
docstring const arg = '"' + it->first + '"' + " " + '"' + it->second + '"';
dispatch(FuncRequest(LFUN_BRANCHES_RENAME, arg));
}
}

View File

@ -212,6 +212,8 @@ private:
bool providesSC(std::string const & font) const;
/// does this font provide size adjustment?
bool providesScale(std::string const & font) const;
///
void executeBranchRenaming() const;
private:
///
void loadModuleInfo();
@ -221,6 +223,8 @@ private:
BufferParams bp_;
/// List of names of available modules
std::list<modInfoStruct> moduleNames_;
///
std::map<docstring, docstring> changedBranches_;
};