]> git.lyx.org Git - features.git/commitdiff
parlist-11-a.diff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 15 Apr 2003 00:11:03 +0000 (00:11 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 15 Apr 2003 00:11:03 +0000 (00:11 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6807 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.C
src/ChangeLog
src/CutAndPaste.C
src/buffer.C
src/insets/ChangeLog
src/insets/insetquotes.C
src/paragraph.C
src/paragraph.h
src/paragraph_funcs.C
src/paragraph_funcs.h
src/text2.C

index c8f93b18aeb8955c0851ee4ce9e7419845c5f416..0f8c66f02e5911cd03e142987d8ad55567c7e44d 100644 (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();
 }
 
index 076290d7b96ddabad9f26ce3a5b8cf9de0b64c34..87255f9dc0637e0d8241f93f0a374c303956a846 100644 (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
index 4593486a11cfc50845b69af081bc872cd1225ba0..d34da31303e8f6bd537d1c2e3b8432ff775b6ffb 100644 (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--);
index e658afd73a7982e07cb51671bd71caa884fc7a56..acfb00f15d16de8cd816f97b2d276a387b978603 100644 (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()) {
index 8c0fe9a17d191bdf5b021bf6a5da2e24b77387f6..68cd136508fea57f840a7333d19ba4baf67a7929 100644 (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
index a8616be0cdb050dcc01393f4ce1029c6c6d07b84..a1d05e0567eaf706c38cd712c0d6041885d633bc 100644 (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;
 
index 9d733a73b59f020351e98852acea81cb89d7ede7..4ecbf5f9db23ef8afd6e00724674bac8694cb1c7 100644 (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);
@@ -1198,7 +1200,7 @@ bool Paragraph::isRightToLeftPar(BufferParams const & bparams) const
 
 
 void Paragraph::changeLanguage(BufferParams const & bparams,
-                                 Language const * from, Language const * to)
+                              Language const * from, Language const * to)
 {
        for (pos_type i = 0; i < size(); ++i) {
                LyXFont font = getFontSettings(bparams, i);
index d26fccac2e0b8d50716b726018f63d76f7c09eba..9cb5543eb9fdb490ff3aa2b3577949852008561e 100644 (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;
        ///
index d53501d18b9bbcf3442e624133b86d26dd99e97a..056724b924d31ca7a89401f3d30ba7bfc2251343 100644 (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;
index fc92fac3cee37fa3dc3e5bcded827d2efa380158..ca8c312b10395fef7028bdb98cd4717fb825e9e4 100644 (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
index e52abd1dbd34776b216e19b89806d63475ae7c5f..8186029897a7175f3bac2a343468ef8f881a0a02 100644 (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);
 }