]> git.lyx.org Git - features.git/commitdiff
remove some explicit tests against ERT_CODE; more to come
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 16 Jul 2009 10:08:13 +0000 (10:08 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 16 Jul 2009 10:08:13 +0000 (10:08 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30625 a592a061-630c-0410-9148-cb99ea01b6c8

src/Bidi.cpp
src/BufferView.cpp
src/Paragraph.cpp
src/Text3.cpp
src/frontends/qt4/GuiView.cpp

index 4470e755f116c764cf8b1142deb053459b9bbc90..b9d1222931d83f0459b0fc527fb90bf1270e7a6f 100644 (file)
@@ -61,7 +61,7 @@ void Bidi::computeTables(Paragraph const & par,
                return;
        }
 
-       if (par.ownerCode() == ERT_CODE || par.ownerCode() == LISTINGS_CODE) {
+       if (par.inInset().forceLTR()) {
                start_ = -1;
                return;
        }
index 936dcffc9af6abe4442a3c424506bd7030a23eef..8b720ba6df2aa0be781832831bb2e47f2ecf7142 100644 (file)
@@ -1019,10 +1019,12 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                break;
 
        case LFUN_DIALOG_SHOW_NEW_INSET:
+               // FIXME: this is wrong, but I do not understand the
+               // intent (JMarc)
                if (cur.inset().lyxCode() == CAPTION_CODE)
                        return cur.inset().getStatus(cur, cmd, flag);
-               flag.setEnabled(cur.inset().lyxCode() != ERT_CODE &&
-                       cur.inset().lyxCode() != LISTINGS_CODE);
+               // FIXME we should consider passthru paragraphs too.
+               flag.setEnabled(!cur.inset().getLayout().isPassThru());
                break;
 
        default:
index c24ec27244606aea61b8f7d1f547492cb59c0038..3332c4615d68a144c01aac79cb2b0b4a1edcc1ae 100644 (file)
@@ -772,10 +772,11 @@ void Paragraph::Private::latexInset(
        bool close = false;
        odocstream::pos_type const len = os.tellp();
 
-       if (inset->forceLTR() 
+       if (inset->forceLTR()
            && running_font.isRightToLeft()
-               // ERT is an exception, it should be output with no decorations at all
-               && inset->lyxCode() != ERT_CODE) {
+           // ERT is an exception, it should be output with no
+           // decorations at all
+           && inset->lyxCode() != ERT_CODE) {
                if (running_font.language()->lang() == "farsi")
                        os << "\\beginL{}";
                else
@@ -2194,6 +2195,8 @@ bool Paragraph::emptyTag() const
        for (pos_type i = 0; i < size(); ++i) {
                if (Inset const * inset = getInset(i)) {
                        InsetCode lyx_code = inset->lyxCode();
+                       // FIXME testing like that is wrong. What is
+                       // the intent?
                        if (lyx_code != TOC_CODE &&
                            lyx_code != INCLUDE_CODE &&
                            lyx_code != GRAPHICS_CODE &&
@@ -2492,8 +2495,7 @@ bool Paragraph::isRTL(BufferParams const & bparams) const
 {
        return lyxrc.rtl_support
                && getParLanguage(bparams)->rightToLeft()
-               && ownerCode() != ERT_CODE
-               && ownerCode() != LISTINGS_CODE;
+               && !inInset().getLayout().forceLTR();
 }
 
 
index 3318ff0bda401b256b93d85366684eb9286c26de..743538db40c35644aae0267552b01b088a9ffa71 100644 (file)
@@ -2620,8 +2620,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        }
 
        case LFUN_LANGUAGE:
-               // FIXME: use isPassThru() here?
-               enable = !cur.inset().forceLTR();
+               enable = !cur.inset().getLayout().isPassThru();
 
        case LFUN_BREAK_PARAGRAPH:
                enable = cur.inset().getLayout().isMultiPar();
index 028111545e570f89e7f9a3299baa2a84b9de667d..1efe7d62cf42c5440c94a01cd0e6e33f9641912e 100644 (file)
@@ -1281,16 +1281,20 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                        if (!view())
                                enable = false;
                        else {
-                               InsetCode ic = view()->cursor().inset().lyxCode();
-                               enable = ic != ERT_CODE && ic != LISTINGS_CODE;
+                               // FIXME we should consider passthru
+                               // paragraphs too.
+                               Inset const & in = view()->cursor().inset();
+                               enable = !in.getLayout().isPassThru();
                        }
                }
                else if (name == "symbols") {
                        if (!view() || view()->cursor().inMathed())
                                enable = false;
                        else {
-                               InsetCode ic = view()->cursor().inset().lyxCode();
-                               enable = ic != ERT_CODE && ic != LISTINGS_CODE;
+                               // FIXME we should consider passthru
+                               // paragraphs too.
+                               Inset const & in = view()->cursor().inset();
+                               enable = !in.getLayout().isPassThru();
                        }
                }
                else if (name == "latexlog")