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
This commit is contained in:
Jean-Marc Lasgouttes 2001-12-13 11:35:25 +00:00
parent 192625aa3a
commit af71097957
9 changed files with 80 additions and 26 deletions

View 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:

View 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:

View 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

View File

@ -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

View 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();

View 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;

View 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.

View 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);
}
}

View 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)