This patch assumes that the current sources is right and that we do not want INHERIT_LANG[UAGE] defined.
Unless I get objections I will apply this patch. (there is a limit on how long stale code is allowed in...) diffstat inheritlang.diff bufferview_funcs.C | 12 ++++-------- insets/insetert.C | 16 ---------------- language.C | 4 ---- language.h | 3 --- lyxfont.C | 42 +----------------------------------------- lyxfont.h | 9 --------- lyxtextclass.C | 11 ----------- paragraph.C | 25 ------------------------- paragraph_pimpl.C | 15 ++------------- text.C | 7 ------- text2.C | 37 ++----------------------------------- 11 files changed, 9 insertions(+), 172 deletions(-)
? build Index: src/bufferview_funcs.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/bufferview_funcs.C,v retrieving revision 1.53 diff -u -p -r1.53 bufferview_funcs.C --- src/bufferview_funcs.C 27 Aug 2002 20:30:18 -0000 1.53 +++ src/bufferview_funcs.C 5 Sep 2002 23:13:29 -0000 @@ -119,11 +119,7 @@ void roman(BufferView * bv) void styleReset(BufferView * bv) { -#ifndef INHERIT_LANG LyXFont font(LyXFont::ALL_INHERIT, ignore_language); -#else - LyXFont font(LyXFont::ALL_INHERIT); -#endif toggleAndShow(bv, font); } @@ -151,7 +147,7 @@ string const currentState(BufferView * b if (!bv->available()) return ""; - + // I think we should only show changes from the default // font. (Asger) LyXText * text = bv->getLyXText(); @@ -209,14 +205,14 @@ void toggleAndShow(BufferView * bv, LyXF { if (!bv->available()) return; - + if (bv->theLockingInset()) { bv->theLockingInset()->setFont(bv, font, toggleall); return; } - + LyXText * text = bv->getLyXText(); - // FIXME: can this happen ?? + // FIXME: can this happen ?? if (!text) return; Index: src/language.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/language.C,v retrieving revision 1.29 diff -u -p -r1.29 language.C --- src/language.C 20 Jul 2002 13:30:55 -0000 1.29 +++ src/language.C 5 Sep 2002 23:13:29 -0000 @@ -30,10 +30,6 @@ Language ignore_lang("ignore", "ignore", Language const * ignore_language = &ignore_lang; Language latex_lang("latex", "latex", "Latex", false, 0, "latex", ""); Language const * latex_language = &latex_lang; -#ifdef INHERIT_LANG -Language inherit_lang("inherit", "inherit", "Inherit", false, 0, "inherit", ""); -Language const * inherit_language = &inherit_lang; -#endif void Languages::setDefaults() { Index: src/language.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/language.h,v retrieving revision 1.20 diff -u -p -r1.20 language.h --- src/language.h 21 Mar 2002 17:25:10 -0000 1.20 +++ src/language.h 5 Sep 2002 23:13:29 -0000 @@ -117,8 +117,5 @@ extern Language const * default_language extern Language const * english_language; extern Language const * ignore_language; extern Language const * latex_language; -#ifdef INHERIT_LANGUAGE -extern Language const * inherit_language; -#endif #endif Index: src/lyxfont.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfont.C,v retrieving revision 1.82 diff -u -p -r1.82 lyxfont.C --- src/lyxfont.C 24 Aug 2002 22:02:26 -0000 1.82 +++ src/lyxfont.C 5 Sep 2002 23:13:30 -0000 @@ -159,11 +159,7 @@ LyXFont::LyXFont() LyXFont::LyXFont(LyXFont::FONT_INIT1) -#ifndef INHERIT_LANGUAGE : bits(inherit), lang(default_language) -#else - : bits(inherit), lang(inherit_language) -#endif {} @@ -434,11 +430,7 @@ void LyXFont::update(LyXFont const & new if (language() == document_language) setLanguage(default_language); else -#ifndef INHERIT_LANGUAGE setLanguage(document_language); -#else - setLanguage(inherit_language); -#endif else if (newfont.language() != ignore_language) setLanguage(newfont.language()); @@ -468,32 +460,12 @@ void LyXFont::reduce(LyXFont const & tmp setNoun(INHERIT); if (color() == tmplt.color()) setColor(LColor::inherit); -#ifdef INHERIT_LANGUAGE - if (language() == tmplt.language()) - setLanguage(inherit_language); -#endif } /// Realize font from a template -#ifndef INHERIT_LANGUAGE LyXFont & LyXFont::realize(LyXFont const & tmplt) -#else -LyXFont & LyXFont::realize(LyXFont const & tmplt, Language const * deflang) -#endif -{ -#ifdef INHERIT_LANGUAGE - if (language() == inherit_language) { - if (tmplt.language() == inherit_language || - tmplt.language() == ignore_language || - tmplt.language() == default_language) - { - setLanguage(deflang); - } else { - setLanguage(tmplt.language()); - } - } -#endif +{ if (bits == inherit) { bits = tmplt.bits; return *this; @@ -534,9 +506,6 @@ bool LyXFont::resolved() const shape() != INHERIT_SHAPE && size() != INHERIT_SIZE && emph() != INHERIT && underbar() != INHERIT && noun() != INHERIT && -#ifdef INHERIT_LANGUAGE - language() != inherit_language && -#endif color() != LColor::inherit); } @@ -732,9 +701,6 @@ LyXFont & LyXFont::lyxRead(LyXLex & lex) /// Writes the changes from this font to orgfont in .lyx format in file void LyXFont::lyxWriteChanges(LyXFont const & orgfont, -#ifdef INHERIT_LANGUAGE - Language const * doclang, -#endif ostream & os) const { os << "\n"; @@ -784,13 +750,7 @@ void LyXFont::lyxWriteChanges(LyXFont co os << "\\color " << col_str << "\n"; } if (orgfont.language() != language()) { -#ifndef INHERIT_LANGUAGE if (language()) -#else - if (language() == inherit_language) - os << "\\lang " << doclang->lang() << "\n"; - else if (language()) -#endif os << "\\lang " << language()->lang() << "\n"; else os << "\\lang unknown\n"; Index: src/lyxfont.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfont.h,v retrieving revision 1.50 diff -u -p -r1.50 lyxfont.h --- src/lyxfont.h 9 Jul 2002 13:38:27 -0000 1.50 +++ src/lyxfont.h 5 Sep 2002 23:13:30 -0000 @@ -282,11 +282,7 @@ public: void reduce(LyXFont const & tmplt); /// Realize font from a template (INHERIT are realized) -#ifndef INHERIT_LANGUAGE LyXFont & realize(LyXFont const & tmplt); -#else - LyXFont & realize(LyXFont const & tmplt, Language const * language); -#endif /// Is a given font fully resolved? bool resolved() const; @@ -294,12 +290,7 @@ public: LyXFont & lyxRead(LyXLex &); /// Writes the changes from this font to orgfont in .lyx format in file -#ifndef INHERIT_LANGUAGE void lyxWriteChanges(LyXFont const & orgfont, std::ostream &) const; -#else - void lyxWriteChanges(LyXFont const & orgfont, Language const * doclang, - std::ostream &) const; -#endif /** Writes the head of the LaTeX needed to change to this font. Writes to string, the head of the LaTeX needed to change Index: src/lyxtextclass.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtextclass.C,v retrieving revision 1.18 diff -u -p -r1.18 lyxtextclass.C --- src/lyxtextclass.C 4 Sep 2002 06:52:26 -0000 1.18 +++ src/lyxtextclass.C 5 Sep 2002 23:13:30 -0000 @@ -71,15 +71,9 @@ bool LyXTextClass::do_readStyle(LyXLex & if (!lay.Read(lexrc, *this)) { // Resolve fonts lay.resfont = lay.font; -#ifndef INHERIT_LANGUAGE lay.resfont.realize(defaultfont()); lay.reslabelfont = lay.labelfont; lay.reslabelfont.realize(defaultfont()); -#else - lay.resfont.realize(defaultfont(), default_language); - lay.reslabelfont = lay.labelfont; - lay.reslabelfont.realize(defaultfont(), default_language); -#endif return false; // no errors } lyxerr << "Error parsing style `" << lay.name() << "'" << endl; @@ -263,12 +257,7 @@ bool LyXTextClass::Read(string const & f if (!defaultfont_.resolved()) { lexrc.printError("Warning: defaultfont should " "be fully instantiated!"); -#ifndef INHERIT_LANGUAGE defaultfont_.realize(LyXFont(LyXFont::ALL_SANE)); -#else - defaultfont_.realize(LyXFont(LyXFont::ALL_SANE), - default_language); -#endif } break; Index: src/paragraph.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v retrieving revision 1.227 diff -u -p -r1.227 paragraph.C --- src/paragraph.C 26 Aug 2002 09:31:07 -0000 1.227 +++ src/paragraph.C 5 Sep 2002 23:13:31 -0000 @@ -254,11 +254,7 @@ void Paragraph::write(Buffer const * buf // Write font changes LyXFont font2 = getFontSettings(bparams, i); if (font2 != font1) { -#ifndef INHERIT_LANGUAGE font2.lyxWriteChanges(font1, os); -#else - font2.lyxWriteChanges(font1, bparams.language, os); -#endif column = 0; font1 = font2; } @@ -476,10 +472,6 @@ LyXFont const Paragraph::getFontSettings retfont = getFontSettings(bparams, pos - 1); } else retfont = LyXFont(LyXFont::ALL_INHERIT, getParLanguage(bparams)); -#ifdef INHERIT_LANGUAGE - if (retfont.language() == inherit_language) - retfont.setLanguage(bparams.language); -#endif return retfont; } @@ -520,11 +512,7 @@ LyXFont const Paragraph::getFont(BufferP layoutfont = lout->font; LyXFont tmpfont = getFontSettings(bparams, pos); -#ifndef INHERIT_LANGUAGE tmpfont.realize(layoutfont); -#else - tmpfont.realize(layoutfont, bparams.language); -#endif return pimpl_->realizeFont(tmpfont, bparams); } @@ -1692,17 +1680,7 @@ Language const * Paragraph::getParLanguage(BufferParams const & bparams) const { if (!empty()) { -#ifndef INHERIT_LANGUAGE return getFirstFontSettings().language(); -#else - Language const * lang = getFirstFontSettings().language(); -#ifdef WITH_WARNINGS -#warning We should make this somewhat better, any ideas? (Jug) -#endif - if (lang == inherit_language || lang == ignore_language) - lang = bparams.language; - return lang; -#endif } else if (previous_) return previous_->getParLanguage(bparams); else @@ -1741,9 +1719,6 @@ bool Paragraph::isMultiLingual(BufferPar for (; cit != end; ++cit) if (cit->font().language() != ignore_language && cit->font().language() != latex_language && -#ifdef INHERIT_LANGUAGE - cit->font().language() != inherit_language && -#endif cit->font().language() != doc_language) return true; return false; Index: src/paragraph_pimpl.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_pimpl.C,v retrieving revision 1.43 diff -u -p -r1.43 paragraph_pimpl.C --- src/paragraph_pimpl.C 20 Aug 2002 21:50:08 -0000 1.43 +++ src/paragraph_pimpl.C 5 Sep 2002 23:13:32 -0000 @@ -591,9 +591,6 @@ void Paragraph::Pimpl::validate(LaTeXFea Language const * language = fcit->font().language(); if (language->babel() != doc_language->babel() && language != ignore_language && -#ifdef INHERIT_LANGUAGE - language != inherit_language && -#endif language != latex_language) { features.useLanguage(language); @@ -656,19 +653,11 @@ LyXFont const Paragraph::Pimpl::realizeF while (par && par->getDepth() && !tmpfont.resolved()) { par = par->outerHook(); if (par) { - tmpfont.realize(par->layout()->font -#ifdef INHERIT_LANGUAGE - , bparams.language -#endif - ); + tmpfont.realize(par->layout()->font); par_depth = par->getDepth(); } } - tmpfont.realize(tclass.defaultfont() -#ifdef INHERIT_LANGUAGE - , bparams.language -#endif - ); + tmpfont.realize(tclass.defaultfont()); return tmpfont; } Index: src/text.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v retrieving revision 1.273 diff -u -p -r1.273 text.C --- src/text.C 21 Aug 2002 17:35:22 -0000 1.273 +++ src/text.C 5 Sep 2002 23:13:34 -0000 @@ -690,13 +690,6 @@ bool LyXText::draw(DrawRowParams & p, po drawForeignMark(p, orig_x, orig_font); -#ifdef INHERIT_LANGUAGE -#ifdef WITH_WARNINGS - if ((font.language() == inherit_language) || - (font.language() == ignore_language)) - lyxerr << "No this shouldn't happen!\n"; -#endif -#endif return true; } Index: src/text2.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v retrieving revision 1.259 diff -u -p -r1.259 text2.C --- src/text2.C 5 Sep 2002 12:58:09 -0000 1.259 +++ src/text2.C 5 Sep 2002 23:13:35 -0000 @@ -127,21 +127,12 @@ LyXFont const realizeFont(LyXFont const while (par && par_depth && !tmpfont.resolved()) { par = par->outerHook(); if (par) { -#ifndef INHERIT_LANGUAGE tmpfont.realize(par->layout()->font); -#else - tmpfont.realize(tclass[par->layout()]->font, - buf->params.language); -#endif par_depth = par->getDepth(); } } -#ifndef INHERIT_LANGUAGE tmpfont.realize(tclass.defaultfont()); -#else - tmpfont.realize(tclass.defaultfont(), buf->params.language); -#endif return tmpfont; } @@ -171,20 +162,12 @@ LyXFont const LyXText::getFont(Buffer co LyXFont f = par->getFontSettings(buf->params, pos); if (par->inInset()) par->inInset()->getDrawFont(f); -#ifndef INHERIT_LANGUAGE return f.realize(layout->reslabelfont); -#else - return f.realize(layout.reslabelfont, buf->params.language); -#endif } else { LyXFont f = par->getFontSettings(buf->params, pos); if (par->inInset()) par->inInset()->getDrawFont(f); -#ifndef INHERIT_LANGUAGE return f.realize(layout->resfont); -#else - return f.realize(layout.resfont, buf->params.language); -#endif } } @@ -201,11 +184,8 @@ LyXFont const LyXText::getFont(Buffer co } LyXFont tmpfont = par->getFontSettings(buf->params, pos); -#ifndef INHERIT_LANGUAGE tmpfont.realize(layoutfont); -#else - tmpfont.realize(layoutfont, buf->params.language); -#endif + if (par->inInset()) par->inInset()->getDrawFont(tmpfont); @@ -281,20 +261,11 @@ void LyXText::setCharFont(Buffer const * while (!layoutfont.resolved() && tp && tp->getDepth()) { tp = tp->outerHook(); if (tp) -#ifndef INHERIT_LANGUAGE layoutfont.realize(tp->layout()->font); -#else - layoutfont.realize(tclass[tp->layout()].font, - buf->params.language); -#endif } } -#ifndef INHERIT_LANGUAGE layoutfont.realize(tclass.defaultfont()); -#else - layoutfont.realize(tclass.defaultfont(), buf->params.language); -#endif // Now, reduce font against full layout font font.reduce(layoutfont); @@ -701,12 +672,8 @@ void LyXText::setFont(BufferView * bview current_font = real_current_font; current_font.reduce(layoutfont); // And resolve it completely -#ifndef INHERIT_LANGUAGE real_current_font.realize(layoutfont); -#else - real_current_font.realize(layoutfont, - bview->buffer()->params.language); -#endif + return; } Index: src/insets/insetert.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.C,v retrieving revision 1.93 diff -u -p -r1.93 insetert.C --- src/insets/insetert.C 19 Aug 2002 10:11:12 -0000 1.93 +++ src/insets/insetert.C 5 Sep 2002 23:13:36 -0000 @@ -155,11 +155,7 @@ void InsetERT::read(Buffer const * buf, inset.read(buf, lex); #ifdef SET_HARD_FONT -#ifndef INHERIT_LANG LyXFont font(LyXFont::ALL_INHERIT, latex_language); -#else - LyXFont font(LyXFont::ALL_INHERIT); -#endif font.setFamily(LyXFont::TYPEWRITER_FAMILY); font.setColor(LColor::latex); Paragraph * par = inset.paragraph(); @@ -526,11 +522,7 @@ void InsetERT::setButtonLabel() const bool InsetERT::checkInsertChar(LyXFont & /* font */) { #ifdef SET_HARD_FONT -#ifndef INHERIT_LANG LyXFont f(LyXFont::ALL_INHERIT, latex_language); -#else - LyXFont f(LyXFont::ALL_INHERIT); -#endif font = f; font.setFamily(LyXFont::TYPEWRITER_FAMILY); font.setColor(LColor::latex); @@ -619,11 +611,7 @@ void InsetERT::draw(BufferView * bv, LyX void InsetERT::set_latex_font(BufferView * /* bv */) { #ifdef SET_HARD_FONT -#ifndef INHERIT_LANG LyXFont font(LyXFont::ALL_INHERIT, latex_language); -#else - LyXFont font(LyXFont::ALL_INHERIT); -#endif font.setFamily(LyXFont::TYPEWRITER_FAMILY); font.setColor(LColor::latex); @@ -695,11 +683,7 @@ InsetERT::selectNextWordToSpellcheck(Buf void InsetERT::getDrawFont(LyXFont & font) const { -#ifndef INHERIT_LANG LyXFont f(LyXFont::ALL_INHERIT, latex_language); -#else - LyXFont f(LyXFont::ALL_INHERIT); -#endif font = f; font.setFamily(LyXFont::TYPEWRITER_FAMILY); font.setColor(LColor::latex);
-- Lgb