]> git.lyx.org Git - features.git/commitdiff
fix symbol font loading, insetquote latex output, undo leak (but this exposes a crash!)
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 13 Dec 2001 11:35:25 +0000 (11:35 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 13 Dec 2001 11:35:25 +0000 (11:35 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3201 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/FontLoader.C
src/insets/ChangeLog
src/insets/insetquotes.C
src/paragraph.C
src/paragraph.h
src/support/types.h
src/text2.C
src/undo_funcs.C

index d57edf78322cdabda823d2029cac68f59ded8954..3558d8cac6abe7f6b4ba1bbc52715417317f5f81 100644 (file)
@@ -1,4 +1,34 @@
-2001-12-12     Martin Vermeer <martin.vermeer@hut.fi>
+2001-12-12  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
+
+       * 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  <martin.vermeer@hut.fi>
 
        * commandtags.h:
        * LyXAction.C:
index 3557b5ca40b3b42b14114813e1cef9a192f417c5..38d20f7775d1292fd7c741853bc7e6f700a93e11 100644 (file)
@@ -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:
index 231682d54fafa5fae3803cd3b0999b7c97cae0e5..b783858270005ad0d82d9886d3b43252a52393e5 100644 (file)
@@ -1,3 +1,9 @@
+2001-12-12  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
+
+       * 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  <lasgouttes@freesurf.fr>
 
        * inset.h: add par_owner_ member variable and parOwner
index c0058ea41255201df76a9bfc67b6bde50c7da9ba..d4e1541ad8721a8bf7ee7bd98c4189d8c000f664 100644 (file)
 #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 
index 61d2048be7ffba51d0f680940f991fac8dbe8cc7..de831a0d210f461e9f038c4f6cf20cbc890b60f1 100644 (file)
@@ -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();
index 1e2563125cdf49ceb9617ea7df7c8c87156be041..953b3f96ea124b83be6da3773283057bbe525855 100644 (file)
@@ -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;
index c3c08913eb1e6395eb58488adb41fd0625d9cb8c..f7dfad62feb78675b802b4a8dbb7fffcfbd16645 100644 (file)
@@ -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.
 
 
index 4ddfcffa2c8338d78cc66421514e8675b604b019..3207fcd63d7e6120f2cc814da22de5402860c87a 100644 (file)
@@ -2596,11 +2596,7 @@ void LyXText::ownerParagraph(int id, Paragraph * p) const
        if (op && op->inInset()) {
                static_cast<InsetText *>(op->inInset())->paragraph(p);
        } else {
-               if (inset_owner) {
-                       inset_owner->paragraph(p);
-               } else {
-                       bv_owner->buffer()->paragraph = p;
-               }
+               ownerParagraph(p);
        }
 }
 
index 85ad6a1c581ee1f25cd548a7779928da776bd544..37041317f4474efa292857e7ff326349d7773f41 100644 (file)
@@ -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)