#include "insets/InsetERT.h"
#include "insets/InsetExternal.h"
#include "insets/InsetFloat.h"
-#include "insets/InsetListings.h"
#include "insets/InsetGraphics.h"
#include "insets/InsetInclude.h"
+#include "insets/InsetListings.h"
#include "insets/InsetNote.h"
#include "insets/InsetSpace.h"
#include "insets/InsetTabular.h"
void LyXFunc::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer)
{
LASSERT(lyx_view_, /**/);
- if (!LyX::ref().session().bookmarks().isValid(idx))
+ if (!theSession().bookmarks().isValid(idx))
return;
- BookmarksSection::Bookmark const & bm = LyX::ref().session().bookmarks().bookmark(idx);
+ BookmarksSection::Bookmark const & bm = theSession().bookmarks().bookmark(idx);
LASSERT(!bm.filename.empty(), /**/);
string const file = bm.filename.absFilename();
// if the file is not opened, open it.
enable = !buf->lyxvc().inUse();
break;
case LFUN_VC_CHECK_IN:
- enable = buf->lyxvc().inUse() && !buf->isReadonly();
+ enable = buf->lyxvc().checkInEnabled();
break;
case LFUN_VC_CHECK_OUT:
- enable = buf->lyxvc().inUse() && buf->isReadonly();
+ enable = buf->lyxvc().checkOutEnabled();
break;
case LFUN_VC_REVERT:
- case LFUN_VC_UNDO_LAST:
enable = buf->lyxvc().inUse();
break;
+ case LFUN_VC_UNDO_LAST:
+ enable = buf->lyxvc().undoLastEnabled();
+ break;
case LFUN_BUFFER_RELOAD:
enable = !buf->isUnnamed() && buf->fileName().exists()
&& (!buf->isClean() || buf->isExternallyModified(Buffer::timestamp_method));
case LFUN_BOOKMARK_GOTO: {
const unsigned int num = convert<unsigned int>(to_utf8(cmd.argument()));
- enable = LyX::ref().session().bookmarks().isValid(num);
+ enable = theSession().bookmarks().isValid(num);
break;
}
case LFUN_BOOKMARK_CLEAR:
- enable = LyX::ref().session().bookmarks().size() > 0;
+ enable = theSession().bookmarks().size() > 0;
break;
// this one is difficult to get right. As a half-baked
case LFUN_CALL: {
FuncRequest func;
string name = to_utf8(cmd.argument());
- if (LyX::ref().topLevelCmdDef().lock(name, func)) {
+ if (theTopLevelCmdDef().lock(name, func)) {
func.origin = cmd.origin;
flag = getStatus(func);
- LyX::ref().topLevelCmdDef().release(name);
+ theTopLevelCmdDef().release(name);
} else {
// catch recursion or unknown command definiton
// all operations until the recursion or unknown command
case LFUN_HELP_OPEN:
case LFUN_DROP_LAYOUTS_CHOICE:
case LFUN_MENU_OPEN:
- case LFUN_SERVER_GET_NAME:
+ case LFUN_SERVER_GET_FILENAME:
case LFUN_SERVER_NOTIFY:
case LFUN_SERVER_GOTO_FILE_ROW:
case LFUN_DIALOG_HIDE:
case LFUN_PREFERENCES_SAVE:
case LFUN_MESSAGE:
case LFUN_INSET_EDIT:
- case LFUN_ALL_INSETS_TOGGLE:
- case LFUN_GRAPHICS_GROUPS_UNIFY:
- case LFUN_NOTES_MUTATE:
case LFUN_BUFFER_LANGUAGE:
case LFUN_TEXTCLASS_APPLY:
case LFUN_TEXTCLASS_LOAD:
LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
if (!ensureBufferClean(view()))
break;
- if (lyx_view_->buffer()->lyxvc().inUse()
- && lyx_view_->buffer()->isReadonly()) {
+ if (lyx_view_->buffer()->lyxvc().inUse()) {
lyx_view_->buffer()->lyxvc().checkOut();
reloadBuffer();
}
break;
// --- lyxserver commands ----------------------------
- case LFUN_SERVER_GET_NAME:
+ case LFUN_SERVER_GET_FILENAME:
LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
setMessage(from_utf8(lyx_view_->buffer()->absFileName()));
LYXERR(Debug::INFO, "FNAME["
case LFUN_CALL: {
FuncRequest func;
- if (LyX::ref().topLevelCmdDef().lock(argument, func)) {
+ if (theTopLevelCmdDef().lock(argument, func)) {
func.origin = cmd.origin;
dispatch(func);
- LyX::ref().topLevelCmdDef().release(argument);
+ theTopLevelCmdDef().release(argument);
} else {
if (func.action == LFUN_UNKNOWN_ACTION) {
// unknown command definition
lyx_view_->message(from_utf8(argument));
break;
-
- case LFUN_ALL_INSETS_TOGGLE: {
- LASSERT(lyx_view_, /**/);
- string action;
- string const name = split(argument, action, ' ');
- InsetCode const inset_code = insetCode(name);
-
- Cursor & cur = view()->cursor();
- FuncRequest fr(LFUN_INSET_TOGGLE, action);
-
- Inset & inset = lyx_view_->buffer()->inset();
- InsetIterator it = inset_iterator_begin(inset);
- InsetIterator const end = inset_iterator_end(inset);
- for (; it != end; ++it) {
- if (!it->asInsetMath()
- && (inset_code == NO_CODE
- || inset_code == it->lyxCode())) {
- Cursor tmpcur = cur;
- tmpcur.pushBackward(*it);
- it->dispatch(tmpcur, fr);
- }
- }
- updateFlags = Update::Force | Update::FitCursor;
- break;
- }
-
- case LFUN_GRAPHICS_GROUPS_UNIFY: {
- LASSERT(lyx_view_, /**/);
- if (argument.empty())
- break;
- //view()->cursor().recordUndoFullDocument(); let inset-apply do that job
- graphics::unifyGraphicsGroups(*lyx_view_->buffer(), argument);
- lyx_view_->buffer()->markDirty();
- updateFlags = Update::Force | Update::FitCursor;
- break;
- }
-
- // BOTH GRAPHICS_GROUPS_UNIFY and NOTES_MUTATE should be in Buffer dispatch once
- // view->cursor() is not needed.
- // Also they could be rewriten using some command like forall <insetname> <command>
- // once the insets refactoring is done.
- case LFUN_NOTES_MUTATE: {
- LASSERT(lyx_view_ && lyx_view_->view(), /**/);
- if (argument.empty())
- break;
- view()->cursor().recordUndoFullDocument();
-
- if (mutateNotes(view(), cmd.getArg(0), cmd.getArg(1))) {
- lyx_view_->buffer()->markDirty();
- updateFlags = Update::Force | Update::FitCursor;
- }
- break;
- }
-
case LFUN_BUFFER_LANGUAGE: {
LASSERT(lyx_view_, /**/);
Buffer & buffer = *lyx_view_->buffer();
break;
case LFUN_BOOKMARK_CLEAR:
- LyX::ref().session().bookmarks().clear();
+ theSession().bookmarks().clear();
break;
default:
case LyXRC::RC_CUSTOM_EXPORT_FORMAT:
case LyXRC::RC_DATE_INSERT_FORMAT:
case LyXRC::RC_DEFAULT_LANGUAGE:
+ case LyXRC::RC_GUI_LANGUAGE:
case LyXRC::RC_DEFAULT_PAPERSIZE:
case LyXRC::RC_DEFFILE:
case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
case LyXRC::RC_LANGUAGE_PACKAGE:
case LyXRC::RC_LANGUAGE_USE_BABEL:
+ case LyXRC::RC_MAC_LIKE_WORD_MOVEMENT:
case LyXRC::RC_MACRO_EDIT_STYLE:
case LyXRC::RC_MAKE_BACKUP:
case LyXRC::RC_MARK_FOREIGN_LANGUAGE: