]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
Fix bug #3038: wish for lfuns for zoom-in and zoom-out
[lyx.git] / src / Text3.cpp
index 50dcf34f7ca15df2500844654e69a00a5cd69df4..fdd6e9c4061a1e240ec625c70cd38fcf554a464c 100644 (file)
@@ -68,6 +68,7 @@
 #include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/lyxtime.h"
+#include "support/os.h"
 
 #include "mathed/InsetMathHull.h"
 #include "mathed/MathMacroTemplate.h"
@@ -448,7 +449,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        BufferView * bv = &cur.bv();
        TextMetrics & tm = bv->textMetrics(this);
        if (!tm.contains(cur.pit())) {
-               lyx::dispatch(FuncRequest(LFUN_SCREEN_RECENTER));
+               lyx::dispatch(FuncRequest(LFUN_SCREEN_SHOW_CURSOR));
                tm = bv->textMetrics(this);
        }
 
@@ -1209,7 +1210,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                pos_type pos = cur.pos();
                BufferParams const & bufparams = bv->buffer().params();
                Layout const & style = par.layout();
-               if (!style.pass_thru
+               InsetLayout const & ilayout = cur.inset().getLayout(bufparams);
+               if (!style.pass_thru && !ilayout.isPassThru()
                    && par.getFontSettings(bufparams, pos).language()->lang() != "hebrew") {
                        // this avoids a double undo
                        // FIXME: should not be needed, ideally
@@ -2317,6 +2319,13 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                enable = cur.inset().insetAllowed(MATH_CODE);
                break;
 
+       case LFUN_DATE_INSERT: {
+               string const format = cmd.argument().empty()
+                       ? lyxrc.date_insert_format : to_utf8(cmd.argument());
+               enable = support::os::is_valid_strftime(format);
+               break;
+       }
+
        case LFUN_WORD_DELETE_FORWARD:
        case LFUN_WORD_DELETE_BACKWARD:
        case LFUN_LINE_DELETE:
@@ -2362,7 +2371,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_SERVER_SET_XY:
        case LFUN_SERVER_GET_LAYOUT:
        case LFUN_LAYOUT:
-       case LFUN_DATE_INSERT:
        case LFUN_SELF_INSERT:
        case LFUN_LINE_INSERT:
        case LFUN_MATH_DISPLAY: