]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
add config.h
[lyx.git] / src / lyxfunc.C
index 776b220ff20ba0b7a1d4259bd4e6d9a948c97277..ff526d5968dab7ef08868c7e5c70bf392af54565 100644 (file)
@@ -232,7 +232,7 @@ void LyXFunc::handleKeyFunc(kb_action action)
                c = 0;
 
        lyx_view_->view()->getIntl().getTransManager().deadkey(
-               c, get_accent(action).accent, view()->getLyXText(), view()->cursor());
+               c, get_accent(action).accent, view()->cursor().innerText(), view()->cursor());
        // Need to clear, in case the minibuffer calls these
        // actions
        keyseq->clear();
@@ -576,8 +576,12 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        }
 
        case LFUN_DIALOG_SHOW_NEW_INSET:
-               enable = cur.inset().lyxCode() != InsetBase::ERT_CODE 
-                       && cur.inset().lyxCode() != InsetBase::CAPTION_CODE;
+               enable = cur.inset().lyxCode() != InsetBase::ERT_CODE;
+               if (cur.inset().lyxCode() == InsetBase::CAPTION_CODE) {
+                       FuncStatus flag;
+                       if (cur.inset().getStatus(cur, cmd, flag))
+                               return flag;
+               }
                break;
 
        case LFUN_DIALOG_UPDATE: {
@@ -842,7 +846,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        if (view()->buffer())
                                // cancel any selection
                                dispatch(FuncRequest(LFUN_MARK_OFF));
-                       setMessage(_("Cancel"));
+                       setMessage(from_ascii(N_("Cancel")));
                        break;
 
                case LFUN_META_PREFIX:
@@ -1063,10 +1067,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                                  "Do you want to over-write that file?"),
                                                makeDisplayPath(filename.absFilename()));
                                        if (Alert::prompt(_("Over-write file?"),
-                                           text, 0, 1, _("&Over-write"), _("&Cancel")) != 0) {
-                                               showPrintError(buffer->fileName());
+                                           text, 0, 1, _("&Over-write"), _("&Cancel")) != 0)
                                                break;
-                                       }
                                }
                                command += lyxrc.print_to_file
                                        + quoteName(filename.toFilesystemEncoding())
@@ -1114,7 +1116,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        BOOST_ASSERT(lyx_view_);
                        string const arg = argument;
                        if (arg.empty()) {
-                               setErrorMessage(_("Missing argument"));
+                               setErrorMessage(from_ascii(N_("Missing argument")));
                                break;
                        }
                        FileName const fname = i18nLibFileSearch("doc", arg, "lyx");
@@ -1397,9 +1399,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        BOOST_ASSERT(lyx_view_);
                        FileName const filename =
                                makeAbsPath(argument, lyx_view_->buffer()->filePath());
-                       // FIXME Should use bformat
-                       setMessage(_("Opening child document ") +
-                                        makeDisplayPath(filename.absFilename()) + "...");
+                       setMessage(bformat(_("Opening child document %1$s..."),
+                                          makeDisplayPath(filename.absFilename())));
                        view()->saveBookmark(false);
                        string const parentfilename = lyx_view_->buffer()->fileName();
                        if (theBufferList().exists(filename.absFilename()))
@@ -1485,8 +1486,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        string lyx_name;
                        string const x11_name = split(argument, lyx_name, ' ');
                        if (lyx_name.empty() || x11_name.empty()) {
-                               setErrorMessage(_("Syntax: set-color <lyx_name>"
-                                                       " <x11_name>"));
+                               setErrorMessage(from_ascii(N_(
+                                               "Syntax: set-color <lyx_name>"
+                                               " <x11_name>")));
                                break;
                        }
 
@@ -1611,11 +1613,10 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        }
 
                        if (defaults.writeFile(FileName(defaults.fileName())))
-                               // FIXME Should use bformat
-                               setMessage(_("Document defaults saved in ")
-                                          + makeDisplayPath(fname));
+                               setMessage(bformat(_("Document defaults saved in %1$s"),
+                                                  makeDisplayPath(fname)));
                        else
-                               setErrorMessage(_("Unable to save document defaults"));
+                               setErrorMessage(from_ascii(N_("Unable to save document defaults")));
                        break;
                }
 
@@ -1782,7 +1783,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
        if (!quitting) {
                lyx_view_->updateMenubar();
                lyx_view_->updateToolbars();
-               sendDispatchMessage(getMessage(), cmd);
+               // Some messages may already be translated, so we cannot use _()
+               sendDispatchMessage(translateIfPossible(getMessage()), cmd);
        }
 }