mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
remove all INHERIT_LANG and INHERIT_LANGUAGE commented code.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5220 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
41ec59fc4f
commit
cf3c73f4e8
@ -1,5 +1,7 @@
|
||||
2002-09-06 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* remove all INHERIT_LANG and INHERIT_LANGUAGE commented code
|
||||
|
||||
* LaTeXFeatures.C (useLayout): let tclass and lyt be a const
|
||||
references, ws changes.
|
||||
|
||||
|
@ -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 * bv)
|
||||
|
||||
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, LyXFont const & font, bool toggleall)
|
||||
{
|
||||
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;
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2002-09-06 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* remove all INHERIT_LANG and INHERIT_LANGUAGE commented code.
|
||||
|
||||
2002-08-29 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insettabular.C (lfunMousePress): Pay attention where you set
|
||||
@ -8,7 +12,7 @@
|
||||
2002-08-29 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* insetfootlike.h: rename include guard to ALL CAPS
|
||||
|
||||
|
||||
* insettext.C: swap object and first parameter for checkInsetHit calls
|
||||
as this functions has moved from BufferView to LyXText
|
||||
|
||||
@ -22,11 +26,11 @@
|
||||
|
||||
* insetfloat.C (wide): add BufferParams parameter
|
||||
|
||||
* insetfloatlist.C (read):
|
||||
(latex):
|
||||
(getScreenLabel):
|
||||
* insetfloat.C (latex):
|
||||
(floatname):
|
||||
* insetfloatlist.C (read):
|
||||
(latex):
|
||||
(getScreenLabel):
|
||||
* insetfloat.C (latex):
|
||||
(floatname):
|
||||
* insetcaption.C (draw): use LyXTextClass::floats()
|
||||
|
||||
2002-08-26 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
@ -155,11 +155,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
|
||||
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, LyXFont const & f,
|
||||
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(BufferView * bv, float &) const
|
||||
|
||||
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);
|
||||
|
@ -30,10 +30,6 @@ Language ignore_lang("ignore", "ignore", "Ignore", false, 0, "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()
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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 & newfont,
|
||||
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 & tmplt)
|
||||
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 const & orgfont,
|
||||
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";
|
||||
|
@ -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
|
||||
|
@ -72,15 +72,9 @@ bool LyXTextClass::do_readStyle(LyXLex & lexrc, LyXLayout & lay)
|
||||
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;
|
||||
@ -266,12 +260,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
|
||||
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;
|
||||
|
||||
|
@ -254,11 +254,7 @@ void Paragraph::write(Buffer const * buf, ostream & os,
|
||||
// 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(BufferParams const & bparams,
|
||||
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(BufferParams const & bparams,
|
||||
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(BufferParams const & bparams)
|
||||
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;
|
||||
|
@ -591,9 +591,6 @@ void Paragraph::Pimpl::validate(LaTeXFeatures & features,
|
||||
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::realizeFont(LyXFont const & font,
|
||||
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;
|
||||
}
|
||||
|
@ -690,13 +690,6 @@ bool LyXText::draw(DrawRowParams & p, pos_type & vpos)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
37
src/text2.C
37
src/text2.C
@ -129,21 +129,12 @@ LyXFont const realizeFont(LyXFont const & font,
|
||||
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;
|
||||
}
|
||||
@ -173,20 +164,12 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par,
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,11 +186,8 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par,
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@ -283,20 +263,11 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par,
|
||||
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);
|
||||
@ -700,12 +671,8 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall)
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user