fix cursor when loading/creating document ; implement LFUN_SAVE_AS_DEFAULT

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8874 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2004-08-08 22:36:34 +00:00
parent 117df9d694
commit 6ce3792cd7
3 changed files with 34 additions and 0 deletions

View File

@ -329,6 +329,7 @@ void BufferView::Pimpl::setBuffer(Buffer * b)
cursor_.push(buffer_->inset());
cursor_.resetAnchor();
buffer_->text().init(bv_);
buffer_->text().setCurrentFont(cursor_);
// If we don't have a text object for this, we make one
//if (bv_->text() == 0)

View File

@ -1,3 +1,10 @@
2004-08-08 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* lyxfunc.C (dispatch): implement LFUN_SAVE_AS_DEFAULT
* BufferView_pimpl.C (setBuffer): initialize the current font of
the underlying LyXText
2004-08-05 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* kbsequence.C (print): use UI native formatting for menu

View File

@ -1317,6 +1317,32 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
break;
}
case LFUN_SAVE_AS_DEFAULT: {
string const fname =
AddName(AddPath(user_lyxdir(), "templates/"),
"defaults.lyx");
Buffer defaults(fname);
istringstream ss(argument);
LyXLex lex(0,0);
lex.setStream(ss);
int const unknown_tokens = defaults.readHeader(lex);
if (unknown_tokens != 0) {
lyxerr << "Warning in LFUN_SAVE_AS_DEFAULT!\n"
<< unknown_tokens << " unknown token"
<< (unknown_tokens == 1 ? "" : "s")
<< endl;
}
if (defaults.writeFile(defaults.fileName()))
setMessage(_("Document defaults saved in ")
+ MakeDisplayPath(fname));
else
setErrorMessage(_("Unable to save document defaults"));
break;
}
case LFUN_BUFFERPARAMS_APPLY: {
biblio::CiteEngine const engine =
owner->buffer()->params().cite_engine;