dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"));
// if the current buffer is not that one, switch to it.
- if (lyx_view_->buffer()->fileName() != tmp.filename) {
+ if (!lyx_view_->buffer() || lyx_view_->buffer()->fileName() != tmp.filename) {
if (!switchToBuffer)
return;
dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file));
//lyxerr << "LyXFunc::getStatus: cmd: " << cmd << endl;
FuncStatus flag;
- Buffer * buf = lyx_view_ ? lyx_view_->buffer() : 0;
+ /* In LyX/Mac, when a dialog is open, the menus of the
+ application can still be accessed without giving focus to
+ the main window. In this case, we want to disable the menu
+ entries that are buffer or view-related.
+
+ If this code is moved somewhere else (like in
+ GuiView::getStatus), then several functions will not be
+ handled correctly.
+ */
+ frontend::LyXView * lv = 0;
+ Buffer * buf = 0;
+ if (lyx_view_
+ && (cmd.origin != FuncRequest::MENU || lyx_view_->hasFocus())) {
+ lv = lyx_view_;
+ buf = lyx_view_->buffer();
+ }
if (cmd.action == LFUN_NOACTION) {
flag.message(from_utf8(N_("Nothing to do")));
switch (cmd.action) {
case LFUN_UNKNOWN_ACTION:
-#if !defined(HAVE_LIBMYTHES) && !defined(HAVE_LIBAIKSAURUS)
- case LFUN_THESAURUS_ENTRY:
-#endif
flag.unknown(true);
flag.setEnabled(false);
break;
case LFUN_VC_CHECK_OUT:
enable = buf->lyxvc().checkOutEnabled();
break;
+ case LFUN_VC_LOCKING_TOGGLE:
+ enable = !buf->isReadonly() && buf->lyxvc().lockingToggleEnabled();
+ flag.setOnOff(enable && !buf->lyxvc().locker().empty());
+ break;
case LFUN_VC_REVERT:
enable = buf->lyxvc().inUse();
break;
flag = getStatus(func);
theTopLevelCmdDef().release(name);
} else {
- // catch recursion or unknown command definiton
- // all operations until the recursion or unknown command
- // definiton occures are performed, so set the state to enabled
+ // catch recursion or unknown command
+ // definition. all operations until the
+ // recursion or unknown command definition
+ // occurs are performed, so set the state to
+ // enabled
enable = true;
}
break;
break;
// Does the view know something?
- if (!lyx_view_) {
+ if (!lv) {
enable = false;
break;
}
- if (lyx_view_->getStatus(cmd, flag))
+ if (lv->getStatus(cmd, flag))
break;
// If we do not have a BufferView, then other functions are disabled
}
break;
+ case LFUN_VC_LOCKING_TOGGLE:
+ LASSERT(lyx_view_ && buffer, /**/);
+ if (!ensureBufferClean(view()) || buffer->isReadonly())
+ break;
+ if (buffer->lyxvc().inUse()) {
+ string res = buffer->lyxvc().lockingToggle();
+ if (res.empty())
+ frontend::Alert::error(_("Revision control error."),
+ _("Error when setting the locking property."));
+ else {
+ setMessage(from_utf8(res));
+ reloadBuffer();
+ }
+ }
+ break;
+
case LFUN_VC_REVERT:
LASSERT(lyx_view_ && buffer, /**/);
buffer->lyxvc().revert();
is >> file_name >> row;
Buffer * buf = 0;
bool loaded = false;
- if (prefixIs(file_name, package().temp_dir().absFilename()))
+ string const abstmp = package().temp_dir().absFilename();
+ string const realtmp = package().temp_dir().realPath();
+ // We have to use os::path_prefix_is() here, instead of
+ // simply prefixIs(), because the file name comes from
+ // an external application and may need case adjustment.
+ if (os::path_prefix_is(file_name, abstmp, os::CASE_ADJUSTED)
+ || os::path_prefix_is(file_name, realtmp, os::CASE_ADJUSTED)) {
// Needed by inverse dvi search. If it is a file
- // in tmpdir, call the apropriated function
+ // in tmpdir, call the apropriated function.
+ // If tmpdir is a symlink, we may have the real
+ // path passed back, so we correct for that.
+ if (!prefixIs(file_name, abstmp))
+ file_name = subst(file_name, realtmp, abstmp);
buf = theBufferList().getBufferFromTmp(file_name);
- else {
+ } else {
// Must replace extension of the file to be .lyx
// and get full path
FileName const s = fileSearch(string(), changeExtension(file_name, ".lyx"), "lyx");
// Either change buffer or load the file
if (theBufferList().exists(s))
buf = theBufferList().getBuffer(s);
- else {
+ else if (s.exists()) {
buf = lyx_view_->loadDocument(s);
loaded = true;
- }
+ } else
+ lyx_view_->message(bformat(
+ _("File does not exist: %1$s"),
+ makeDisplayPath(file_name)));
}
if (!buf) {
case INDEX_CODE:
case LABEL_CODE:
case NOMENCL_CODE:
+ case NOMENCL_PRINT_CODE:
case REF_CODE:
case TOC_CODE:
case HYPERLINK_CODE: {
break;
case LFUN_LYXRC_APPLY: {
+ // reset active key sequences, since the bindings
+ // are updated (bug 6064)
+ keyseq.reset();
LyXRC const lyxrc_orig = lyxrc;
istringstream ss(argument);
// processKeySym to avoid another redraw just for a
// changed inline completion
if (cmd.origin == FuncRequest::KEYBOARD) {
- if (cmd.action == LFUN_SELF_INSERT)
+ if (cmd.action == LFUN_SELF_INSERT
+ || (cmd.action == LFUN_ERT_INSERT && view()->cursor().inMathed()))
lyx_view_->updateCompletion(view()->cursor(), true, true);
else if (cmd.action == LFUN_CHAR_DELETE_BACKWARD)
lyx_view_->updateCompletion(view()->cursor(), false, true);
case LyXRC::RC_AUTOSAVE:
case LyXRC::RC_AUTO_NUMBER:
case LyXRC::RC_BACKUPDIR_PATH:
+ case LyXRC::RC_BIBTEX_ALTERNATIVES:
case LyXRC::RC_BIBTEX_COMMAND:
case LyXRC::RC_BINDFILE:
case LyXRC::RC_CHECKLASTFILES:
case LyXRC::RC_FONT_ENCODING:
case LyXRC::RC_FORMAT:
case LyXRC::RC_GROUP_LAYOUTS:
+ case LyXRC::RC_INDEX_ALTERNATIVES:
case LyXRC::RC_INDEX_COMMAND:
+ case LyXRC::RC_JBIBTEX_COMMAND:
+ case LyXRC::RC_JINDEX_COMMAND:
case LyXRC::RC_NOMENCL_COMMAND:
case LyXRC::RC_INPUT:
case LyXRC::RC_KBMAP:
case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
case LyXRC::RC_SPELL_COMMAND:
case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
+ case LyXRC::RC_SPLITINDEX_COMMAND:
case LyXRC::RC_TEMPDIRPATH:
case LyXRC::RC_TEMPLATEPATH:
case LyXRC::RC_TEX_ALLOWS_SPACES:
case LyXRC::RC_SORT_LAYOUTS:
case LyXRC::RC_FULL_SCREEN_LIMIT:
case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
+ case LyXRC::RC_FULL_SCREEN_MENUBAR:
case LyXRC::RC_FULL_SCREEN_TABBAR:
case LyXRC::RC_FULL_SCREEN_TOOLBARS:
case LyXRC::RC_FULL_SCREEN_WIDTH: