#include "InsetIterator.h"
#include "Language.h"
#include "LaTeXFeatures.h"
+#include "Lexer.h"
#include "LyX.h"
#include "lyxfind.h"
#include "LyXFunc.h"
Cursor & cur = d->cursor_;
switch (cmd.action) {
+ case LFUN_BUFFER_PARAMS_APPLY:
+ flag.setEnabled(!buffer_.isReadonly());
+ break;
case LFUN_UNDO:
flag.setEnabled(buffer_.undo().hasUndoStack());
switch (cmd.action) {
+ case LFUN_BUFFER_PARAMS_APPLY: {
+ DocumentClass const * const oldClass = buffer_.params().documentClassPtr();
+ cur.recordUndoFullDocument();
+ istringstream ss(to_utf8(cmd.argument()));
+ Lexer lex;
+ lex.setStream(ss);
+ int const unknown_tokens = buffer_.readHeader(lex);
+ if (unknown_tokens != 0) {
+ LYXERR0("Warning in LFUN_BUFFER_PARAMS_APPLY!\n"
+ << unknown_tokens << " unknown token"
+ << (unknown_tokens == 1 ? "" : "s"));
+ }
+ theLyXFunc().updateLayout(oldClass, &buffer_);
+
+ // We are most certainly here because of a change in the document
+ // It is then better to make sure that all dialogs are in sync with
+ // current document settings.
+ processUpdateFlags(Update::Force | Update::FitCursor);
+ break;
+ }
+
case LFUN_UNDO:
cur.message(_("Undo"));
cur.clearSelection();
case LFUN_TEXTCLASS_APPLY:
case LFUN_TEXTCLASS_LOAD:
case LFUN_BUFFER_SAVE_AS_DEFAULT:
- case LFUN_BUFFER_PARAMS_APPLY:
case LFUN_LAYOUT_MODULES_CLEAR:
case LFUN_LAYOUT_MODULE_ADD:
case LFUN_LAYOUT_RELOAD:
break;
}
- case LFUN_BUFFER_PARAMS_APPLY: {
- LASSERT(lyx_view_, /**/);
-
- DocumentClass const * const oldClass = buffer->params().documentClassPtr();
- Cursor & cur = lyx_view_->documentBufferView()->cursor();
- cur.recordUndoFullDocument();
-
- istringstream ss(argument);
- Lexer lex;
- lex.setStream(ss);
- int const unknown_tokens = buffer->readHeader(lex);
-
- if (unknown_tokens != 0) {
- lyxerr << "Warning in LFUN_BUFFER_PARAMS_APPLY!\n"
- << unknown_tokens << " unknown token"
- << (unknown_tokens == 1 ? "" : "s")
- << endl;
- }
-
- updateLayout(oldClass, buffer);
-
- updateFlags = Update::Force | Update::FitCursor;
- // We are most certainly here because of a change in the document
- // It is then better to make sure that all dialogs are in sync with
- // current document settings. LyXView::restartCursor() achieve this.
- lyx_view_->restartCursor();
- break;
- }
-
case LFUN_LAYOUT_MODULES_CLEAR: {
LASSERT(lyx_view_ && lyx_view_->documentBufferView(), /**/);
DocumentClass const * const oldClass = buffer->params().documentClassPtr();
/// cursor y position before dispatch started
int cursorBeforeDispatchY() const { return cursorPosBeforeDispatchY_; }
+ ///
+ void updateLayout(DocumentClass const * const oldlayout, Buffer * buffer);
+
private:
///
frontend::LyXView * lyx_view_;
/// send a post-dispatch status message
void sendDispatchMessage(docstring const & msg,
FuncRequest const & ev);
- ///
- void updateLayout(DocumentClass const * const oldlayout, Buffer * buffer);
};
/// Implementation is in LyX.cpp