]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.cpp
SCons: msvc does not need this /TP option any more after we rename .C => .cpp. Also...
[lyx.git] / src / Paragraph.cpp
index 778e92ded6b75d4c7ac0824b61b45367f777e69e..80409eafd704342f41d94268127d14f1f1ecbbf8 100644 (file)
@@ -726,6 +726,11 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
                        break;
                }
 
+               if (lookupChange(i).type == Change::DELETED) {
+                       if( ++runparams.inDeletedInset == 1)
+                               runparams.changeOfDeletedInset = lookupChange(i);
+               }
+
                if (inset->canTrackChanges()) {
                        column += Changes::latexMarkChange(os, bparams, running_change,
                                Change(Change::UNCHANGED));
@@ -746,12 +751,10 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
                        close = true;
                }
 
-#ifdef WITH_WARNINGS
-#warning Bug: we can have an empty font change here!
+// FIXME: Bug: we can have an empty font change here!
 // if there has just been a font change, we are going to close it
 // right now, which means stupid latex code like \textsf{}. AFAIK,
 // this does not harm dvi output. A minor bug, thus (JMarc)
-#endif
                // Some insets cannot be inside a font change command.
                // However, even such insets *can* be placed in \L or \R
                // or their equivalents (for RTL language switches), so we don't
@@ -801,6 +804,10 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf,
                } else {
                        column += os.tellp() - len;
                }
+
+               if (lookupChange(i).type == Change::DELETED) {
+                       --runparams.inDeletedInset;
+               }
        }
        break;
 
@@ -1371,18 +1378,14 @@ Font const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
 {
        BOOST_ASSERT(pos >= 0);
 
-       Layout_ptr const & lout = layout();
+       Font font = getFontSettings(bparams, pos);
 
        pos_type const body_pos = beginOfBody();
-
-       Font layoutfont;
        if (pos < body_pos)
-               layoutfont = lout->labelfont;
+               font.realize(layout_->labelfont);
        else
-               layoutfont = lout->font;
+               font.realize(layout_->font);
 
-       Font font = getFontSettings(bparams, pos);
-       font.realize(layoutfont);
        font.realize(outerfont);
        font.realize(bparams.getFont());
 
@@ -1656,6 +1659,10 @@ docstring Paragraph::expandLabel(Layout_ptr const & layout,
        else
                fmt = translateIfPossible(layout->labelstring(), bparams);
 
+       if (fmt.empty() && layout->labeltype == LABEL_COUNTER 
+           && !layout->counter.empty())
+               fmt = "\\the" + layout->counter;
+
        // handle 'inherited level parts' in 'fmt',
        // i.e. the stuff between '@' in   '@Section@.\arabic{subsection}'
        size_t const i = fmt.find('@', 0);
@@ -1663,8 +1670,10 @@ docstring Paragraph::expandLabel(Layout_ptr const & layout,
                size_t const j = fmt.find('@', i + 1);
                if (j != docstring::npos) {
                        docstring parent(fmt, i + 1, j - i - 1);
-                       docstring label = expandLabel(tclass[parent], bparams);
-                       fmt = docstring(fmt, 0, i) + label + docstring(fmt, j + 1, docstring::npos);
+                       docstring label = expandLabel(tclass[parent], bparams,
+                                                     process_appendix);
+                       fmt = docstring(fmt, 0, i) + label 
+                               + docstring(fmt, j + 1, docstring::npos);
                }
        }
 
@@ -1676,10 +1685,8 @@ void Paragraph::applyLayout(Layout_ptr const & new_layout)
 {
        layout(new_layout);
        LyXAlignment const oldAlign = params().align();
-       // FIXME The first check is due to the fact that LYX_ALIGN_LAYOUT
-       // is not required to be possible. A fix is on the way.
-       if ((oldAlign != LYX_ALIGN_LAYOUT) && 
-           !(oldAlign & layout()->alignpossible)) {
+       
+       if (!(oldAlign & layout()->alignpossible)) {
                frontend::Alert::warning(_("Alignment not permitted"), 
                        _("The new layout does not permit the alignment previously used.\nSetting to default."));
                params().align(LYX_ALIGN_LAYOUT);
@@ -2039,7 +2046,8 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
                                                            runparams.moving_arg);
                }
 
-               Change const & change = pimpl_->lookupChange(i);
+               Change const & change = runparams.inDeletedInset ? runparams.changeOfDeletedInset
+                                                                : pimpl_->lookupChange(i);
 
                if (bparams.outputChanges && runningChange != change) {
                        if (open_font) {
@@ -2160,11 +2168,9 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
                                        runparams, basefont, basefont);
                }
 #else
-#ifdef WITH_WARNINGS
-//#warning For now we ALWAYS have to close the foreign font settings if they are
-//#warning there as we start another \selectlanguage with the next paragraph if
-//#warning we are in need of this. This should be fixed sometime (Jug)
-#endif
+//FIXME: For now we ALWAYS have to close the foreign font settings if they are
+//FIXME: there as we start another \selectlanguage with the next paragraph if
+//FIXME: we are in need of this. This should be fixed sometime (Jug)
                running_font.latexWriteEndChanges(os, bparams, runparams,
                                basefont, basefont);
 #endif
@@ -2396,9 +2402,7 @@ Paragraph::getParLanguage(BufferParams const & bparams) const
 {
        if (!empty())
                return getFirstFontSettings(bparams).language();
-#ifdef WITH_WARNINGS
-#warning FIXME we should check the prev par as well (Lgb)
-#endif
+       // FIXME: we should check the prev par as well (Lgb)
        return bparams.language;
 }