From: Jean-Marc Lasgouttes Date: Thu, 13 Dec 2001 11:35:25 +0000 (+0000) Subject: fix symbol font loading, insetquote latex output, undo leak (but this exposes a crash!) X-Git-Tag: 1.6.10~20177 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=af7109795725294e87e7c2fd29d13eddb837c769;p=features.git fix symbol font loading, insetquote latex output, undo leak (but this exposes a crash!) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3201 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index d57edf7832..3558d8cac6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,34 @@ -2001-12-12 Martin Vermeer +2001-12-12 Jean-Marc Lasgouttes + + * FontLoader.C (getFontinfo): only use symbol fonts with encoding + -adobe-fontspecific. At least Mandrake and Redhat have a symbol + font in urw-fonts package which is marked as -urw-fontspecific and + does not work (incidentally, changing the encoding in the + fonts.dir of this package to -adobe-fontspecific fixes the + problem). + + * undo_funcs.C (textHandleUndo): fix leak in undo, but now there + is a crash when undoing first paragraph (Juergen, please take a + look). THis does not mean the undo fix is wrong, just that it + uncovers problems. + + * text2.C (ownerParagraph): let the (int,Paragraph*) version call + the (Paragraph*) version when needed instead of duplicating the + code. + + * text.C (workWidth): use Inset::parOwner to find out where the + inset has been inserted. This is a huge performance gain for large + documents with lots of insets. If Inset::parOwner is not set, fall + back on the brute force method + + * paragraph_pimpl.C (insertInset): + * paragraph.C (Paragraph): + (cutIntoMinibuffer): set parOwner of insets when + inserting/removing them + + * lyxtext.h: add short comment on deleteEmptyParagraphMechanism + +2001-12-12 Martin Vermeer * commandtags.h: * LyXAction.C: diff --git a/src/FontLoader.C b/src/FontLoader.C index 3557b5ca40..38d20f7775 100644 --- a/src/FontLoader.C +++ b/src/FontLoader.C @@ -108,7 +108,7 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family, { case LyXFont::SYMBOL_FAMILY: fontinfo[family][series][shape] = - new FontInfo("-*-symbol-*-*-*-*-*-*-*-*-*-*-*-*"); + new FontInfo("-*-symbol-*-*-*-*-*-*-*-*-*-*-adobe-fontspecific"); return; case LyXFont::CMR_FAMILY: diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 231682d54f..b783858270 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2001-12-12 Jean-Marc Lasgouttes + + * insetquotes.C (latex): fix to use the local language setting at + the point where the inset is inserted (different macros for + different french packages) + 2001-12-11 Jean-Marc Lasgouttes * inset.h: add par_owner_ member variable and parOwner diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index c0058ea412..d4e1541ad8 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -15,17 +15,19 @@ #endif #include "insetquotes.h" -#include "support/lyxlib.h" -#include "debug.h" -#include "lyxfont.h" -#include "lyxrc.h" -#include "buffer.h" -#include "LaTeXFeatures.h" + +#include "support/LAssert.h" #include "support/lstrings.h" +#include "BufferView.h" +#include "LaTeXFeatures.h" #include "Painter.h" +#include "buffer.h" +#include "debug.h" #include "font.h" #include "language.h" -#include "BufferView.h" +#include "lyxfont.h" +#include "lyxrc.h" +#include "paragraph.h" using std::ostream; using std::endl; @@ -259,22 +261,26 @@ void InsetQuotes::read(Buffer const *, LyXLex & lex) extern bool use_babel; int InsetQuotes::latex(Buffer const * buf, ostream & os, - bool /*fragile*/, bool) const + bool /*fragile*/, bool /* free_spc */) const { // How do we get the local language here?? + lyx::pos_type curr_pos = parOwner()->getPositionOfInset(this); + lyx::Assert(curr_pos != -1); + string const curr_lang = + parOwner()->getFont(buf->params, + curr_pos).language()->babel(); - string const doclang = buf->getLanguage()->babel(); const int quoteind = quote_index[side_][language_]; string qstr; if (language_ == FrenchQ && times_ == DoubleQ - && doclang == "frenchb") { + && curr_lang == "frenchb") { if (side_ == LeftQ) qstr = "\\og "; //the spaces are important here else qstr = " \\fg{}"; //and here } else if (language_ == FrenchQ && times_ == DoubleQ - && doclang == "french") { + && curr_lang == "french") { if (side_ == LeftQ) qstr = "<< "; //the spaces are important here else diff --git a/src/paragraph.C b/src/paragraph.C index 61d2048be7..de831a0d21 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -1219,7 +1219,7 @@ Paragraph::InsetIterator(pos_type pos) // returns -1 if inset not found -int Paragraph::getPositionOfInset(Inset * inset) const +int Paragraph::getPositionOfInset(Inset const * inset) const { // Find the entry. for (InsetList::const_iterator cit = insetlist.begin(); diff --git a/src/paragraph.h b/src/paragraph.h index 1e2563125c..953b3f96ea 100644 --- a/src/paragraph.h +++ b/src/paragraph.h @@ -315,7 +315,7 @@ public: int autoDeleteInsets(); /// returns -1 if inset not found - int getPositionOfInset(Inset * inset) const; + int getPositionOfInset(Inset const * inset) const; /// some good comment here John? Paragraph * getParFromID(int id) const; diff --git a/src/support/types.h b/src/support/types.h index c3c08913eb..f7dfad62fe 100644 --- a/src/support/types.h +++ b/src/support/types.h @@ -2,7 +2,7 @@ #define LYX_TYPES_H // provide a set of typedefs for commonly used things like sizes and -// indices whil trying to stay compatible with typse used by the standard +// indices while trying to stay compatible with types used by the standard // containers. diff --git a/src/text2.C b/src/text2.C index 4ddfcffa2c..3207fcd63d 100644 --- a/src/text2.C +++ b/src/text2.C @@ -2596,11 +2596,7 @@ void LyXText::ownerParagraph(int id, Paragraph * p) const if (op && op->inInset()) { static_cast(op->inInset())->paragraph(p); } else { - if (inset_owner) { - inset_owner->paragraph(p); - } else { - bv_owner->buffer()->paragraph = p; - } + ownerParagraph(p); } } diff --git a/src/undo_funcs.C b/src/undo_funcs.C index 85ad6a1c58..37041317f4 100644 --- a/src/undo_funcs.C +++ b/src/undo_funcs.C @@ -101,13 +101,15 @@ bool textHandleUndo(BufferView * bv, Undo * undo) // replace the paragraphs with the undo informations Paragraph * tmppar3 = undo->par; - undo->par = 0; // otherwise the undo destructor would delete the paragraph - Paragraph * tmppar4 = tmppar3; + undo->par = 0; // otherwise the undo destructor would + // delete the paragraph + // get last undo par + Paragraph * tmppar4 = tmppar3; if (tmppar4) { while (tmppar4->next()) tmppar4 = tmppar4->next(); - } // get last undo par + } // now remove the old text if there is any if (before != behind || (!behind && !before)) { @@ -125,9 +127,9 @@ bool textHandleUndo(BufferView * bv, Undo * undo) // the text informations. if (undo->kind == Undo::EDIT) { tmppar2->setContentsFromPar(tmppar); - tmppar->clearContents(); tmppar2 = tmppar2->next(); } + delete tmppar; } } @@ -136,7 +138,21 @@ bool textHandleUndo(BufferView * bv, Undo * undo) if (before) before->next(tmppar3); else - bv->text->ownerParagraph(tmppar3->id(), tmppar3); +#warning Juergen, why is this needed?? (JMarc) +// since tmppar3 is not yet inserted in the document, I do not see why +// the getParFromID which is done by the function below makes sense. +// OTOH, since you wrote the method just for this instance, I guess you +// have something in mind +#if 1 + bv->text->ownerParagraph(tmppar3->id(), + tmppar3); +#else +// in this case, since getParFromID is not called, the program does +// not crash on trying to access buffer()->paragraph, which does not +// exist anymore if we undid the first par f the document. (JMarc) + bv->text->ownerParagraph(tmppar3); +#endif + tmppar3->previous(before); } else { // Do we really enter here ??? (Jug)