From 41003ea0eb267d8396c33e76daa32b9df033c1e2 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 16 Jul 2009 10:08:13 +0000 Subject: [PATCH] remove some explicit tests against ERT_CODE; more to come git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30625 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Bidi.cpp | 2 +- src/BufferView.cpp | 6 ++++-- src/Paragraph.cpp | 12 +++++++----- src/Text3.cpp | 3 +-- src/frontends/qt4/GuiView.cpp | 12 ++++++++---- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/Bidi.cpp b/src/Bidi.cpp index 4470e755f1..b9d1222931 100644 --- a/src/Bidi.cpp +++ b/src/Bidi.cpp @@ -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; } diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 936dcffc9a..8b720ba6df 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -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: diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index c24ec27244..3332c4615d 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -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(); } diff --git a/src/Text3.cpp b/src/Text3.cpp index 3318ff0bda..743538db40 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -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(); diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 028111545e..1efe7d62cf 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -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") -- 2.39.2