* Licence details can be found in the file COPYING.
*
* \author Alfredo Braunstein
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
* \author Jean-Marc Lasgouttes
* \author Angus Leeming
* \author John Levon
- * \author André Pönitz
+ * \author André Pönitz
* \author Allan Rae
* \author Dekel Tsur
* \author Martin Vermeer
- * \author Jürgen Vigna
+ * \author Jürgen Vigna
*
* Full author contact details are available in file CREDITS.
*/
#include "insets/InsetInclude.h"
#include "insets/InsetListings.h"
#include "insets/InsetNote.h"
+#include "insets/InsetPhantom.h"
#include "insets/InsetSpace.h"
#include "insets/InsetTabular.h"
#include "insets/InsetVSpace.h"
if (!theBufferList().exists(bm.filename))
return;
+ // bm can be changed when saving
+ BookmarksSection::Bookmark tmp = bm;
+
+ // Special case idx == 0 used for back-from-back jump navigation
+ if (idx == 0)
+ dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"));
+
// if the current buffer is not that one, switch to it.
- if (lyx_view_->buffer()->fileName() != bm.filename) {
+ if (lyx_view_->buffer()->fileName() != tmp.filename) {
if (!switchToBuffer)
return;
dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file));
}
+
// moveToPosition try paragraph id first and then paragraph (pit, pos).
- if (!view()->moveToPosition(bm.bottom_pit, bm.bottom_pos,
- bm.top_id, bm.top_pos))
+ if (!view()->moveToPosition(tmp.bottom_pit, tmp.bottom_pos,
+ tmp.top_id, tmp.top_pos))
+ return;
+
+ // bm changed
+ if (idx == 0)
return;
// Cursor jump succeeded!
switch (cmd.action) {
case LFUN_UNKNOWN_ACTION:
-#ifndef HAVE_LIBAIKSAURUS
+#if !defined(HAVE_LIBMYTHES) && !defined(HAVE_LIBAIKSAURUS)
case LFUN_THESAURUS_ENTRY:
#endif
flag.unknown(true);
break;
case LFUN_VC_REGISTER:
- enable = !buf->lyxvc().inUse() && !buf->isUnnamed();
+ enable = !buf->lyxvc().inUse();
break;
case LFUN_VC_CHECK_IN:
enable = buf->lyxvc().checkInEnabled();
}
case LFUN_BOOKMARK_CLEAR:
- enable = theSession().bookmarks().size() > 0;
+ enable = theSession().bookmarks().hasValid();
break;
// this one is difficult to get right. As a half-baked
break;
}
+ case LFUN_VC_COMMAND: {
+ if (cmd.argument().empty())
+ enable = false;
+
+ if (!buf && contains(cmd.getArg(0), 'D'))
+ enable = false;
+ break;
+ }
+
case LFUN_WORD_FIND_FORWARD:
case LFUN_WORD_FIND_BACKWARD:
+ case LFUN_WORD_FINDADV:
case LFUN_COMMAND_PREFIX:
case LFUN_COMMAND_EXECUTE:
case LFUN_CANCEL:
bool LyXFunc::ensureBufferClean(BufferView * bv)
{
Buffer & buf = bv->buffer();
- if (buf.isClean())
+ if (buf.isClean() && !buf.isUnnamed())
return true;
docstring const file = buf.fileName().displayName(30);
- docstring text = bformat(_("The document %1$s has unsaved "
+ docstring title;
+ docstring text;
+ if (!buf.isUnnamed()) {
+ text = bformat(_("The document %1$s has unsaved "
"changes.\n\nDo you want to save "
"the document?"), file);
- int const ret = Alert::prompt(_("Save changed document?"),
- text, 0, 1, _("&Save"),
- _("&Cancel"));
+ title = _("Save changed document?");
+
+ } else {
+ text = bformat(_("The document %1$s has not been "
+ "saved yet.\n\nDo you want to save "
+ "the document?"), file);
+ title = _("Save new document?");
+ }
+ int const ret = Alert::prompt(title, text, 0, 1, _("&Save"), _("&Cancel"));
if (ret == 0)
- dispatch(FuncRequest(LFUN_BUFFER_WRITE));
+ lyx_view_->dispatch(FuncRequest(LFUN_BUFFER_WRITE));
- return buf.isClean();
+ return buf.isClean() && !buf.isUnnamed();
}
<< lyxaction.getActionName(action)
<< " [" << action << "] is disabled at this location");
setErrorMessage(flag.message());
+ if (lyx_view_)
+ lyx_view_->restartCursor();
} else {
+ Buffer * buffer = lyx_view_ ? lyx_view_->buffer() : 0;
switch (action) {
case LFUN_WORD_FIND_FORWARD:
LASSERT(lyx_view_ && lyx_view_->view(), /**/);
keyseq.reset();
meta_fake_bit = NoModifier;
- if (lyx_view_->buffer())
+ if (buffer)
// cancel any selection
dispatch(FuncRequest(LFUN_MARK_OFF));
setMessage(from_ascii(N_("Cancel")));
break;
case LFUN_BUFFER_TOGGLE_READ_ONLY: {
- LASSERT(lyx_view_ && lyx_view_->view() && lyx_view_->buffer(), /**/);
- Buffer * buf = lyx_view_->buffer();
- if (buf->lyxvc().inUse())
- buf->lyxvc().toggleReadOnly();
+ LASSERT(lyx_view_ && lyx_view_->view() && buffer, /**/);
+ if (buffer->lyxvc().inUse())
+ buffer->lyxvc().toggleReadOnly();
else
- buf->setReadonly(!lyx_view_->buffer()->isReadonly());
+ buffer->setReadonly(!buffer->isReadonly());
break;
}
// --- Menus -----------------------------------------------
case LFUN_BUFFER_CLOSE:
lyx_view_->closeBuffer();
+ buffer = 0;
updateFlags = Update::None;
break;
case LFUN_BUFFER_RELOAD: {
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
- docstring const file = makeDisplayPath(lyx_view_->buffer()->absFileName(), 20);
+ LASSERT(lyx_view_ && buffer, /**/);
+ docstring const file = makeDisplayPath(buffer->absFileName(), 20);
docstring text = bformat(_("Any changes will be lost. Are you sure "
"you want to revert to the saved version of the document %1$s?"), file);
int const ret = Alert::prompt(_("Revert to saved document?"),
}
case LFUN_BUFFER_UPDATE:
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
- lyx_view_->buffer()->doExport(argument, true);
+ LASSERT(lyx_view_ && buffer, /**/);
+ buffer->doExport(argument, true);
break;
case LFUN_BUFFER_VIEW:
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
- lyx_view_->buffer()->preview(argument);
+ LASSERT(lyx_view_ && buffer, /**/);
+ buffer->preview(argument);
break;
case LFUN_MASTER_BUFFER_UPDATE:
- LASSERT(lyx_view_ && lyx_view_->buffer() && lyx_view_->buffer()->masterBuffer(), /**/);
- lyx_view_->buffer()->masterBuffer()->doExport(argument, true);
+ LASSERT(lyx_view_ && buffer && buffer->masterBuffer(), /**/);
+ buffer->masterBuffer()->doExport(argument, true);
break;
case LFUN_MASTER_BUFFER_VIEW:
- LASSERT(lyx_view_ && lyx_view_->buffer() && lyx_view_->buffer()->masterBuffer(), /**/);
- lyx_view_->buffer()->masterBuffer()->preview(argument);
+ LASSERT(lyx_view_ && buffer && buffer->masterBuffer(), /**/);
+ buffer->masterBuffer()->preview(argument);
break;
case LFUN_BUILD_PROGRAM:
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
- lyx_view_->buffer()->doExport("program", true);
+ LASSERT(lyx_view_ && buffer, /**/);
+ buffer->doExport("program", true);
break;
case LFUN_BUFFER_CHKTEX:
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
- lyx_view_->buffer()->runChktex();
+ LASSERT(lyx_view_ && buffer, /**/);
+ buffer->runChktex();
break;
case LFUN_BUFFER_EXPORT:
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
+ LASSERT(lyx_view_ && buffer, /**/);
if (argument == "custom")
dispatch(FuncRequest(LFUN_DIALOG_SHOW, "sendto"));
else
- lyx_view_->buffer()->doExport(argument, false);
+ buffer->doExport(argument, false);
break;
case LFUN_BUFFER_EXPORT_CUSTOM: {
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
+ LASSERT(lyx_view_ && buffer, /**/);
string format_name;
string command = split(argument, format_name, ' ');
Format const * format = formats.getFormat(format_name);
break;
}
- Buffer * buffer = lyx_view_->buffer();
-
// The name of the file created by the conversion process
string filename;
}
case LFUN_BUFFER_PRINT: {
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
+ LASSERT(lyx_view_ && buffer, /**/);
// FIXME: cmd.getArg() might fail if one of the arguments
// contains double quotes
string target = cmd.getArg(0);
break;
}
- Buffer * buffer = lyx_view_->buffer();
-
if (!buffer->doExport("dvi", true)) {
showPrintError(buffer->absFileName());
break;
} else {
// case 1: print to a file
FileName const filename(makeAbsPath(target_name,
- lyx_view_->buffer()->filePath()));
+ buffer->filePath()));
FileName const dvifile(makeAbsPath(dviname, path));
if (filename.exists()) {
docstring text = bformat(
*/
case LFUN_BUFFER_AUTO_SAVE:
- lyx_view_->buffer()->autoSave();
+ buffer->autoSave();
break;
case LFUN_RECONFIGURE:
break;
case LFUN_HELP_OPEN: {
- LASSERT(lyx_view_, /**/);
+ if (lyx_view_ == 0)
+ theApp()->dispatch(FuncRequest(LFUN_WINDOW_NEW));
string const arg = argument;
if (arg.empty()) {
- setErrorMessage(from_ascii(N_("Missing argument")));
+ setErrorMessage(from_utf8(N_("Missing argument")));
break;
}
- FileName const fname = i18nLibFileSearch("doc", arg, "lyx");
+ FileName fname = i18nLibFileSearch("doc", arg, "lyx");
+ if (fname.empty())
+ fname = i18nLibFileSearch("examples", arg, "lyx");
+
if (fname.empty()) {
lyxerr << "LyX: unable to find documentation file `"
<< arg << "'. Bad installation?" << endl;
makeDisplayPath(fname.absFilename())));
Buffer * buf = lyx_view_->loadDocument(fname, false);
if (buf) {
- updateLabels(*buf);
+ buf->updateLabels();
lyx_view_->setBuffer(buf);
buf->errors("Parse");
}
// --- version control -------------------------------
case LFUN_VC_REGISTER:
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
- if (!ensureBufferClean(view()) || lyx_view_->buffer()->isUnnamed())
+ LASSERT(lyx_view_ && buffer, /**/);
+ if (!ensureBufferClean(view()))
break;
- if (!lyx_view_->buffer()->lyxvc().inUse()) {
- lyx_view_->buffer()->lyxvc().registrer();
- reloadBuffer();
+ if (!buffer->lyxvc().inUse()) {
+ if (buffer->lyxvc().registrer())
+ reloadBuffer();
}
updateFlags = Update::Force;
break;
case LFUN_VC_CHECK_IN:
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
+ LASSERT(lyx_view_ && buffer, /**/);
if (!ensureBufferClean(view()))
break;
- if (lyx_view_->buffer()->lyxvc().inUse()
- && !lyx_view_->buffer()->isReadonly()) {
- setMessage(from_utf8(lyx_view_->buffer()->lyxvc().checkIn()));
+ if (buffer->lyxvc().inUse()
+ && !buffer->isReadonly()) {
+ setMessage(from_utf8(buffer->lyxvc().checkIn()));
reloadBuffer();
}
break;
case LFUN_VC_CHECK_OUT:
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
+ LASSERT(lyx_view_ && buffer, /**/);
if (!ensureBufferClean(view()))
break;
- if (lyx_view_->buffer()->lyxvc().inUse()) {
- setMessage(from_utf8(lyx_view_->buffer()->lyxvc().checkOut()));
+ if (buffer->lyxvc().inUse()) {
+ setMessage(from_utf8(buffer->lyxvc().checkOut()));
reloadBuffer();
}
break;
case LFUN_VC_REVERT:
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
- lyx_view_->buffer()->lyxvc().revert();
+ LASSERT(lyx_view_ && buffer, /**/);
+ buffer->lyxvc().revert();
reloadBuffer();
break;
case LFUN_VC_UNDO_LAST:
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
- lyx_view_->buffer()->lyxvc().undoLast();
+ LASSERT(lyx_view_ && buffer, /**/);
+ buffer->lyxvc().undoLast();
reloadBuffer();
break;
// --- lyxserver commands ----------------------------
case LFUN_SERVER_GET_FILENAME:
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
- setMessage(from_utf8(lyx_view_->buffer()->absFileName()));
+ LASSERT(lyx_view_ && buffer, /**/);
+ setMessage(from_utf8(buffer->absFileName()));
LYXERR(Debug::INFO, "FNAME["
- << lyx_view_->buffer()->absFileName() << ']');
+ << buffer->absFileName() << ']');
break;
case LFUN_SERVER_NOTIFY:
break;
}
- updateLabels(*buf);
+ buf->updateLabels();
lyx_view_->setBuffer(buf);
view()->setCursorFromRow(row);
if (loaded)
InsetCommandParams p(code);
data = InsetCommand::params2string(name, p);
break;
- }
+ }
case INCLUDE_CODE: {
// data is the include type: one of "include",
// "input", "verbatiminput" or "verbatiminput*"
InsetCommandParams p(INCLUDE_CODE, data);
data = InsetCommand::params2string("include", p);
break;
- }
+ }
case BOX_CODE: {
// \c data == "Boxed" || "Frameless" etc
InsetBoxParams p(data);
data = InsetBox::params2string(p);
break;
- }
+ }
case BRANCH_CODE: {
InsetBranchParams p;
data = InsetBranch::params2string(p);
break;
- }
+ }
case CITE_CODE: {
InsetCommandParams p(CITE_CODE);
data = InsetCommand::params2string(name, p);
break;
- }
+ }
case ERT_CODE: {
data = InsetERT::params2string(InsetCollapsable::Open);
break;
- }
+ }
case EXTERNAL_CODE: {
InsetExternalParams p;
- Buffer const & buffer = *lyx_view_->buffer();
- data = InsetExternal::params2string(p, buffer);
+ data = InsetExternal::params2string(p, *buffer);
break;
- }
+ }
case FLOAT_CODE: {
InsetFloatParams p;
data = InsetFloat::params2string(p);
break;
- }
+ }
case LISTINGS_CODE: {
InsetListingsParams p;
data = InsetListings::params2string(p);
break;
- }
+ }
case GRAPHICS_CODE: {
InsetGraphicsParams p;
- Buffer const & buffer = *lyx_view_->buffer();
- data = InsetGraphics::params2string(p, buffer);
+ data = InsetGraphics::params2string(p, *buffer);
break;
- }
+ }
case NOTE_CODE: {
InsetNoteParams p;
data = InsetNote::params2string(p);
break;
- }
+ }
+ case PHANTOM_CODE: {
+ InsetPhantomParams p;
+ data = InsetPhantom::params2string(p);
+ break;
+ }
case SPACE_CODE: {
InsetSpaceParams p;
data = InsetSpace::params2string(p);
break;
- }
+ }
case VSPACE_CODE: {
VSpace space;
data = InsetVSpace::params2string(space);
break;
- }
+ }
case WRAP_CODE: {
InsetWrapParams p;
data = InsetWrap::params2string(p);
}
case LFUN_BUFFER_CHILD_OPEN: {
- LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
- Buffer * parent = lyx_view_->buffer();
- FileName filename = makeAbsPath(argument, parent->filePath());
+ LASSERT(lyx_view_ && buffer, /**/);
+ FileName filename = makeAbsPath(argument, buffer->filePath());
view()->saveBookmark(false);
Buffer * child = 0;
bool parsed = false;
// Set the parent name of the child document.
// This makes insertion of citations and references in the child work,
// when the target is in the parent or another child document.
- child->setParent(parent);
- updateLabels(*child->masterBuffer());
+ child->setParent(buffer);
+ child->masterBuffer()->updateLabels();
lyx_view_->setBuffer(child);
if (parsed)
child->errors("Parse");
istringstream is(countstr);
int count = 0;
is >> count;
- lyxerr << "repeat: count: " << count << " cmd: " << rest << endl;
+ //lyxerr << "repeat: count: " << count << " cmd: " << rest << endl;
for (int i = 0; i < count; ++i)
dispatch(lyxaction.lookupFunc(rest));
break;
case LFUN_COMMAND_SEQUENCE: {
// argument contains ';'-terminated commands
string arg = argument;
+ if (theBufferList().isLoaded(buffer))
+ buffer->undo().beginUndoGroup();
while (!arg.empty()) {
string first;
arg = split(arg, first, ';');
func.origin = cmd.origin;
dispatch(func);
}
+ if (theBufferList().isLoaded(buffer))
+ buffer->undo().endUndoGroup();
break;
}
case LFUN_BUFFER_LANGUAGE: {
LASSERT(lyx_view_, /**/);
- Buffer & buffer = *lyx_view_->buffer();
- Language const * oldL = buffer.params().language;
+ Language const * oldL = buffer->params().language;
Language const * newL = languages.getLanguage(argument);
if (!newL || oldL == newL)
break;
if (oldL->rightToLeft() == newL->rightToLeft()
- && !buffer.isMultiLingual())
- buffer.changeLanguage(oldL, newL);
+ && !buffer->isMultiLingual())
+ buffer->changeLanguage(oldL, newL);
break;
}
case LFUN_BUFFER_PARAMS_APPLY: {
LASSERT(lyx_view_, /**/);
- Buffer * buffer = lyx_view_->buffer();
DocumentClass const * const oldClass = buffer->params().documentClassPtr();
Cursor & cur = view()->cursor();
cur.recordUndoFullDocument();
case LFUN_LAYOUT_MODULES_CLEAR: {
LASSERT(lyx_view_, /**/);
- Buffer * buffer = lyx_view_->buffer();
DocumentClass const * const oldClass = buffer->params().documentClassPtr();
view()->cursor().recordUndoFullDocument();
buffer->params().clearLayoutModules();
case LFUN_LAYOUT_MODULE_ADD: {
LASSERT(lyx_view_, /**/);
- Buffer * buffer = lyx_view_->buffer();
- DocumentClass const * const oldClass = buffer->params().documentClassPtr();
+ BufferParams const & params = buffer->params();
+ if (!params.moduleCanBeAdded(argument)) {
+ LYXERR0("Module `" << argument <<
+ "' cannot be added due to failed requirements or "
+ "conflicts with installed modules.");
+ break;
+ }
+ DocumentClass const * const oldClass = params.documentClassPtr();
view()->cursor().recordUndoFullDocument();
buffer->params().addLayoutModule(argument);
buffer->params().makeDocumentClass();
case LFUN_TEXTCLASS_APPLY: {
LASSERT(lyx_view_, /**/);
- Buffer * buffer = lyx_view_->buffer();
if (!loadLayoutFile(argument, buffer->temppath()) &&
!loadLayoutFile(argument, buffer->filePath()))
case LFUN_LAYOUT_RELOAD: {
LASSERT(lyx_view_, /**/);
- Buffer * buffer = lyx_view_->buffer();
DocumentClass const * const oldClass = buffer->params().documentClassPtr();
LayoutFileIndex bc = buffer->params().baseClassID();
LayoutFileList::get().reset(bc);
}
case LFUN_TEXTCLASS_LOAD:
- loadLayoutFile(argument, lyx_view_->buffer()->temppath()) ||
- loadLayoutFile(argument, lyx_view_->buffer()->filePath());
+ loadLayoutFile(argument, buffer->temppath()) ||
+ loadLayoutFile(argument, buffer->filePath());
break;
case LFUN_LYXRC_APPLY: {
theSession().bookmarks().clear();
break;
+ case LFUN_VC_COMMAND: {
+ string flag = cmd.getArg(0);
+ if (buffer && contains(flag, 'R') && !ensureBufferClean(view()))
+ break;
+ docstring message;
+ if (contains(flag, 'M'))
+ if (!Alert::askForText(message, _("LyX VC: Log Message")))
+ break;
+
+ string path = cmd.getArg(1);
+ if (contains(path, "$$p") && buffer)
+ path = subst(path, "$$p", buffer->filePath());
+ LYXERR(Debug::LYXVC, "Directory: " << path);
+ FileName pp(path);
+ if (!pp.isReadableDirectory()) {
+ lyxerr << _("Directory is not accessible.") << endl;
+ break;
+ }
+ support::PathChanger p(pp);
+
+ string command = cmd.getArg(2);
+ if (command.empty())
+ break;
+ if (buffer) {
+ command = subst(command, "$$i", buffer->absFileName());
+ command = subst(command, "$$p", buffer->filePath());
+ }
+ command = subst(command, "$$m", to_utf8(message));
+ LYXERR(Debug::LYXVC, "Command: " << command);
+ Systemcall one;
+ one.startscript(Systemcall::Wait, command);
+
+ if (!buffer)
+ break;
+ if (contains(flag, 'I'))
+ buffer->markDirty();
+ if (contains(flag, 'R'))
+ reloadBuffer();
+
+ break;
+ }
+
default:
LASSERT(theApp(), /**/);
// Let the frontend dispatch its own actions.
// Start an undo group. This may be needed for
// some stuff like inset-apply on labels.
- if (lyx_view_->view())
- view()->cursor().beginUndoGroup();
+ if (theBufferList().isLoaded(buffer))
+ buffer->undo().beginUndoGroup();
// Let the current LyXView dispatch its own actions.
if (lyx_view_->dispatch(cmd)) {
if (lyx_view_->view()) {
updateFlags = lyx_view_->view()->cursor().result().update();
- view()->cursor().endUndoGroup();
+ if (theBufferList().isLoaded(buffer))
+ buffer->undo().endUndoGroup();
}
break;
}
if (view()->dispatch(cmd)) {
// The BufferView took care of its own updates if needed.
updateFlags = Update::None;
- view()->cursor().endUndoGroup();
+ if (theBufferList().isLoaded(buffer))
+ buffer->undo().endUndoGroup();
break;
}
// notify insets we just left
if (view()->cursor() != old) {
old.fixIfBroken();
- bool badcursor = notifyCursorLeaves(old, view()->cursor());
+ bool badcursor = notifyCursorLeavesOrEnters(old, view()->cursor());
if (badcursor)
view()->cursor().fixIfBroken();
}
- // we assume here that the buffer view has not
- // changed since the beginUndoGroup.
- view()->cursor().endUndoGroup();
+ if (theBufferList().isLoaded(buffer))
+ buffer->undo().endUndoGroup();
// update completion. We do it here and not in
// processKeySym to avoid another redraw just for a
updateFlags = view()->cursor().result().update();
}
+ // if we executed a mutating lfun, mark the buffer as dirty
+ if (theBufferList().isLoaded(buffer) && flag.enabled()
+ && !lyxaction.funcHasFlag(action, LyXAction::NoBuffer)
+ && !lyxaction.funcHasFlag(action, LyXAction::ReadOnly))
+ buffer->markDirty();
+
if (lyx_view_ && lyx_view_->buffer()) {
// BufferView::update() updates the ViewMetricsInfo and
// also initializes the position cache for all insets in
// We will redraw the screen only if needed.
view()->processUpdateFlags(updateFlags);
- // if we executed a mutating lfun, mark the buffer as dirty
- if (flag.enabled()
- && !lyxaction.funcHasFlag(action, LyXAction::NoBuffer)
- && !lyxaction.funcHasFlag(action, LyXAction::ReadOnly))
- lyx_view_->buffer()->markDirty();
-
// Do we have a selection?
theSelection().haveSelection(view()->cursor().selection());
}
}
- docstring const shortcuts = theTopLevelKeymap().printBindings(cmd);
+ docstring const shortcuts = theTopLevelKeymap().printBindings(cmd, KeySequence::ForGui);
if (!shortcuts.empty())
comname += ": " + shortcuts;
// The user has already confirmed that the changes, if any, should
// be discarded. So we just release the Buffer and don't call closeBuffer();
theBufferList().release(lyx_view_->buffer());
+ // if the lyx_view_ has been destroyed, create a new one
+ if (!lyx_view_)
+ theApp()->dispatch(FuncRequest(LFUN_WINDOW_NEW));
Buffer * buf = lyx_view_->loadDocument(filename);
docstring const disp_fn = makeDisplayPath(filename.absFilename());
docstring str;
if (buf) {
- updateLabels(*buf);
+ buf->updateLabels();
lyx_view_->setBuffer(buf);
buf->errors("Parse");
str = bformat(_("Document %1$s reloaded."), disp_fn);
}
-void LyXFunc::updateLayout(DocumentClass const * const oldlayout, Buffer * buffer)
+void LyXFunc::updateLayout(DocumentClass const * const oldlayout, Buffer * buf)
{
lyx_view_->message(_("Converting document to new document class..."));
StableDocIterator backcur(view()->cursor());
- ErrorList & el = buffer->errorList("Class Switch");
+ ErrorList & el = buf->errorList("Class Switch");
cap::switchBetweenClasses(
- oldlayout, buffer->params().documentClassPtr(),
- static_cast<InsetText &>(buffer->inset()), el);
+ oldlayout, buf->params().documentClassPtr(),
+ static_cast<InsetText &>(buf->inset()), el);
- view()->setCursor(backcur.asDocIterator(&(buffer->inset())));
+ view()->setCursor(backcur.asDocIterator(buf));
- buffer->errors("Class Switch");
- updateLabels(*buffer);
+ buf->errors("Class Switch");
+ buf->updateLabels();
}
switch (tag) {
case LyXRC::RC_ACCEPT_COMPOUND:
case LyXRC::RC_ALT_LANG:
- case LyXRC::RC_PLAINTEXT_ROFF_COMMAND:
case LyXRC::RC_PLAINTEXT_LINELEN:
+ case LyXRC::RC_PLAINTEXT_ROFF_COMMAND:
+ case LyXRC::RC_AUTOCORRECTION_MATH:
case LyXRC::RC_AUTOREGIONDELETE:
case LyXRC::RC_AUTORESET_OPTIONS:
case LyXRC::RC_AUTOSAVE:
if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
}
+ case LyXRC::RC_THESAURUSDIRPATH:
case LyXRC::RC_UIFILE:
case LyXRC::RC_USER_EMAIL:
case LyXRC::RC_USER_NAME:
}
} // namespace anon
-
-
} // namespace lyx