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
This commit is contained in:
Jean-Marc Lasgouttes 2009-07-16 10:08:13 +00:00
parent 5862b252db
commit 41003ea0eb
5 changed files with 21 additions and 14 deletions

View File

@ -61,7 +61,7 @@ void Bidi::computeTables(Paragraph const & par,
return; return;
} }
if (par.ownerCode() == ERT_CODE || par.ownerCode() == LISTINGS_CODE) { if (par.inInset().forceLTR()) {
start_ = -1; start_ = -1;
return; return;
} }

View File

@ -1019,10 +1019,12 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
break; break;
case LFUN_DIALOG_SHOW_NEW_INSET: case LFUN_DIALOG_SHOW_NEW_INSET:
// FIXME: this is wrong, but I do not understand the
// intent (JMarc)
if (cur.inset().lyxCode() == CAPTION_CODE) if (cur.inset().lyxCode() == CAPTION_CODE)
return cur.inset().getStatus(cur, cmd, flag); return cur.inset().getStatus(cur, cmd, flag);
flag.setEnabled(cur.inset().lyxCode() != ERT_CODE && // FIXME we should consider passthru paragraphs too.
cur.inset().lyxCode() != LISTINGS_CODE); flag.setEnabled(!cur.inset().getLayout().isPassThru());
break; break;
default: default:

View File

@ -772,10 +772,11 @@ void Paragraph::Private::latexInset(
bool close = false; bool close = false;
odocstream::pos_type const len = os.tellp(); odocstream::pos_type const len = os.tellp();
if (inset->forceLTR() if (inset->forceLTR()
&& running_font.isRightToLeft() && running_font.isRightToLeft()
// ERT is an exception, it should be output with no decorations at all // ERT is an exception, it should be output with no
&& inset->lyxCode() != ERT_CODE) { // decorations at all
&& inset->lyxCode() != ERT_CODE) {
if (running_font.language()->lang() == "farsi") if (running_font.language()->lang() == "farsi")
os << "\\beginL{}"; os << "\\beginL{}";
else else
@ -2194,6 +2195,8 @@ bool Paragraph::emptyTag() const
for (pos_type i = 0; i < size(); ++i) { for (pos_type i = 0; i < size(); ++i) {
if (Inset const * inset = getInset(i)) { if (Inset const * inset = getInset(i)) {
InsetCode lyx_code = inset->lyxCode(); InsetCode lyx_code = inset->lyxCode();
// FIXME testing like that is wrong. What is
// the intent?
if (lyx_code != TOC_CODE && if (lyx_code != TOC_CODE &&
lyx_code != INCLUDE_CODE && lyx_code != INCLUDE_CODE &&
lyx_code != GRAPHICS_CODE && lyx_code != GRAPHICS_CODE &&
@ -2492,8 +2495,7 @@ bool Paragraph::isRTL(BufferParams const & bparams) const
{ {
return lyxrc.rtl_support return lyxrc.rtl_support
&& getParLanguage(bparams)->rightToLeft() && getParLanguage(bparams)->rightToLeft()
&& ownerCode() != ERT_CODE && !inInset().getLayout().forceLTR();
&& ownerCode() != LISTINGS_CODE;
} }

View File

@ -2620,8 +2620,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
} }
case LFUN_LANGUAGE: case LFUN_LANGUAGE:
// FIXME: use isPassThru() here? enable = !cur.inset().getLayout().isPassThru();
enable = !cur.inset().forceLTR();
case LFUN_BREAK_PARAGRAPH: case LFUN_BREAK_PARAGRAPH:
enable = cur.inset().getLayout().isMultiPar(); enable = cur.inset().getLayout().isMultiPar();

View File

@ -1281,16 +1281,20 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
if (!view()) if (!view())
enable = false; enable = false;
else { else {
InsetCode ic = view()->cursor().inset().lyxCode(); // FIXME we should consider passthru
enable = ic != ERT_CODE && ic != LISTINGS_CODE; // paragraphs too.
Inset const & in = view()->cursor().inset();
enable = !in.getLayout().isPassThru();
} }
} }
else if (name == "symbols") { else if (name == "symbols") {
if (!view() || view()->cursor().inMathed()) if (!view() || view()->cursor().inMathed())
enable = false; enable = false;
else { else {
InsetCode ic = view()->cursor().inset().lyxCode(); // FIXME we should consider passthru
enable = ic != ERT_CODE && ic != LISTINGS_CODE; // paragraphs too.
Inset const & in = view()->cursor().inset();
enable = !in.getLayout().isPassThru();
} }
} }
else if (name == "latexlog") else if (name == "latexlog")