parlist-11-a.diff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6807 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-04-15 00:11:03 +00:00
parent f96545b498
commit 6519ce1be5
11 changed files with 96 additions and 32 deletions

View File

@ -27,6 +27,7 @@
#include "lyxtext.h"
#include "undo_funcs.h"
#include "changes.h"
#include "paragraph_funcs.h"
#include "frontends/Alert.h"
#include "frontends/Dialogs.h"
@ -966,8 +967,9 @@ Encoding const * BufferView::getEncoding() const
if (!t)
return 0;
LyXCursor const & c= t->cursor;
LyXFont const font = c.par()->getFont(buffer()->params, c.pos());
LyXCursor const & c = t->cursor;
LyXFont const font = c.par()->getFont(buffer()->params, c.pos(),
outerFont(c.par()));
return font.language()->encoding();
}

View File

@ -1,3 +1,24 @@
2003-04-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* text2.C (getFont): adjust
(getLayoutFont): adjust
(getLabelFont): adjust
* paragraph_funcs.C (TeXOnePar): adjust
(outerFont): new func...
(realizeFont): ...moved out from here, changed this to facilitate
transition
* paragraph.C (getFont): take outerfont as arg, adjust
(simpleTeXOnePar): add outerfont arg, adjust
* buffer.C (simpleLinuxDocOnePar): adjust
(simpleDocBookOnePar): adjust
* CutAndPaste.C (pasteSelection): adjust
* BufferView.C (getEncoding): adjust
2003-04-14 Lars Gullik Bjønnes <larsbj@gullik.net>
* text2.C (setCharFont): adjust

View File

@ -282,7 +282,7 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar,
tmpbuf->erase(i--);
}
} else {
LyXFont f1 = tmpbuf->getFont(current_view->buffer()->params,i);
LyXFont f1 = tmpbuf->getFont(current_view->buffer()->params, i, outerFont(tmpbuf));
LyXFont f2 = f1;
if (!(*par)->checkInsertChar(f1)) {
tmpbuf->erase(i--);

View File

@ -1433,7 +1433,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
PAR_TAG tag_close = NONE;
list < PAR_TAG > tag_open;
LyXFont const font = par->getFont(params, i);
LyXFont const font = par->getFont(params, i, outerFont(par));
if (font_old.family() != font.family()) {
switch (family_type) {
@ -1922,7 +1922,7 @@ void Buffer::simpleDocBookOnePar(ostream & os,
// parsing main loop
for (pos_type i = 0; i < par->size(); ++i) {
LyXFont font = par->getFont(params, i);
LyXFont font = par->getFont(params, i, outerFont(par));
// handle <emphasis> tag
if (font_old.emph() != font.emph()) {

View File

@ -1,3 +1,7 @@
2003-04-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* insetquotes.C (latex): comment some code and add warnings.
2003-04-14 Alfredo Braunstein <abraunst@libero.it>
* insetexternal.C (localDispatch): added a missing DISPATCHED

View File

@ -261,10 +261,17 @@ int InsetQuotes::latex(Buffer const * buf, ostream & os,
// How do we get the local language here??
lyx::pos_type curr_pos = parOwner()->getPositionOfInset(this);
lyx::Assert(curr_pos != -1);
#warning FIXME. We _must_ find another way to get the language. (Lgb)
#if 0
// This cannot be used. (Lgb)
string const curr_lang =
parOwner()->getFont(buf->params,
curr_pos).language()->babel();
#else
// And this is not the way... (Lgb)
string const curr_lang = buf->params.language->lang();
#endif
const int quoteind = quote_index[side_][language_];
string qstr;

View File

@ -434,8 +434,8 @@ LyXFont const Paragraph::getFirstFontSettings() const
// The difference is that this one is used for generating the LaTeX file,
// and thus cosmetic "improvements" are disallowed: This has to deliver
// the true picture of the buffer. (Asger)
LyXFont const Paragraph::getFont(BufferParams const & bparams,
pos_type pos) const
LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
LyXFont const & outerfont) const
{
lyx::Assert(pos >= 0);
@ -451,8 +451,9 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams,
LyXFont tmpfont = getFontSettings(bparams, pos);
tmpfont.realize(layoutfont);
tmpfont.realize(outerfont);
return pimpl_->realizeFont(tmpfont, bparams);
return realizeFont(tmpfont, bparams, 0, false);
}
@ -919,6 +920,7 @@ int Paragraph::endTeXParParams(BufferParams const & bparams,
// This one spits out the text of the paragraph
bool Paragraph::simpleTeXOnePar(Buffer const * buf,
BufferParams const & bparams,
LyXFont const & outerfont,
ostream & os, TexRow & texrow,
bool moving_arg)
{
@ -1013,7 +1015,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
value_type c = getChar(i);
// Fully instantiated font
LyXFont font = getFont(bparams, i);
LyXFont font = getFont(bparams, i, outerfont);
LyXFont const last_font = running_font;
@ -1021,7 +1023,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
// outside font change, i.e. we write "\textXX{text} "
// rather than "\textXX{text }". (Asger)
if (open_font && c == ' ' && i <= size() - 2) {
LyXFont const & next_font = getFont(bparams, i + 1);
LyXFont const & next_font = getFont(bparams, i + 1, outerfont);
if (next_font != running_font
&& next_font != font) {
font = next_font;
@ -1083,7 +1085,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
running_font
.latexWriteEndChanges(os, basefont,
next_->getFont(bparams,
0));
0, outerfont));
} else {
running_font.latexWriteEndChanges(os, basefont,
basefont);

View File

@ -104,7 +104,8 @@ public:
///
bool simpleTeXOnePar(Buffer const *, BufferParams const &,
std::ostream &, TexRow & texrow, bool moving_arg);
LyXFont const & outerfont, std::ostream &,
TexRow & texrow, bool moving_arg);
///
bool hasSameLayout(Paragraph const * par) const;
@ -239,7 +240,8 @@ public:
attributes with values LyXFont::INHERIT, LyXFont::IGNORE or
LyXFont::TOGGLE.
*/
LyXFont const getFont(BufferParams const &, lyx::pos_type pos) const;
LyXFont const getFont(BufferParams const &, lyx::pos_type pos,
LyXFont const & outerfont) const;
LyXFont const getLayoutFont(BufferParams const &) const;
LyXFont const getLabelFont(BufferParams const &) const;
///

View File

@ -471,7 +471,7 @@ TeXOnePar(Buffer const * buf,
}
if (pit->params().lineTop()) {
os << "\\lyxline{\\" << pit->getFont(bparams, 0).latexSize() << '}'
os << "\\lyxline{\\" << pit->getFont(bparams, 0, outerFont(pit)).latexSize() << '}'
<< "\\vspace{-1\\parskip}";
further_blank_line = true;
}
@ -550,7 +550,8 @@ TeXOnePar(Buffer const * buf,
break;
}
bool need_par = pit->simpleTeXOnePar(buf, bparams, os, texrow, moving_arg);
bool need_par = pit->simpleTeXOnePar(buf, bparams, outerFont(pit),
os, texrow, moving_arg);
// Make sure that \\par is done with the font of the last
// character if this has another size as the default.
@ -563,7 +564,7 @@ TeXOnePar(Buffer const * buf,
// or for a command.
LyXFont const font =
(pit->empty()
? pit->getLayoutFont(bparams) : pit->getFont(bparams, pit->size() - 1));
? pit->getLayoutFont(bparams) : pit->getFont(bparams, pit->size() - 1, outerFont(pit)));
bool is_command = style->isCommand();
@ -1025,18 +1026,13 @@ int readParagraph(Buffer & buf, Paragraph & par, LyXLex & lex)
}
LyXFont const realizeFont(LyXFont const & font,
Buffer const * buf,
ParagraphList & /*plist*/,
ParagraphList::iterator pit)
LyXFont const outerFont(ParagraphList::iterator pit)
{
LyXTextClass const & tclass = buf->params.getLyXTextClass();
LyXFont tmpfont(font);
Paragraph::depth_type par_depth = pit->getDepth();
Paragraph * par = &*pit;
LyXFont tmpfont(LyXFont::ALL_INHERIT);
// Resolve against environment font information
Paragraph * par = &*pit;
while (par && par_depth && !tmpfont.resolved()) {
par = outerHook(par);
if (par) {
@ -1045,6 +1041,23 @@ LyXFont const realizeFont(LyXFont const & font,
}
}
return tmpfont;
}
LyXFont const realizeFont(LyXFont const & font,
BufferParams const & params,
ParagraphList::iterator pit,
bool outerhook)
{
LyXTextClass const & tclass = params.getLyXTextClass();
LyXFont tmpfont(font);
if (outerhook) {
LyXFont of = outerFont(pit);
tmpfont.realize(of);
}
tmpfont.realize(tclass.defaultfont());
return tmpfont;

View File

@ -67,8 +67,10 @@ void latexParagraphs(Buffer const * buf,
int readParagraph(Buffer & buf, Paragraph & par, LyXLex & lex);
LyXFont const realizeFont(LyXFont const & font,
Buffer const * buf,
ParagraphList & /*plist*/,
ParagraphList::iterator pit);
BufferParams const & params,
ParagraphList::iterator pit,
bool outerhook = true);
LyXFont const outerFont(ParagraphList::iterator pit);
#endif // PARAGRAPH_FUNCS_H

View File

@ -149,7 +149,10 @@ LyXFont const LyXText::getFont(Buffer const * buf, ParagraphList::iterator pit,
if (pit->inInset())
pit->inInset()->getDrawFont(tmpfont);
return realizeFont(tmpfont, buf, ownerParagraphs(), pit);
// Realize with the fonts of lesser depth.
tmpfont.realize(outerFont(pit));
return realizeFont(tmpfont, buf->params, pit, false);
}
@ -162,7 +165,11 @@ LyXFont const LyXText::getLayoutFont(Buffer const * buf,
return layout->resfont;
}
return realizeFont(layout->font, buf, ownerParagraphs(), pit);
LyXFont font(layout->font);
// Realize with the fonts of lesser depth.
font.realize(outerFont(pit));
return realizeFont(font, buf->params, pit, false);
}
@ -175,7 +182,11 @@ LyXFont const LyXText::getLabelFont(Buffer const * buf,
return layout->reslabelfont;
}
return realizeFont(layout->labelfont, buf, ownerParagraphs(), pit);
LyXFont font(layout->labelfont);
// Realize with the fonts of lesser depth.
font.realize(outerFont(pit));
return realizeFont(layout->labelfont, buf->params, pit, false);
}