Fixed various bugs + John's form paragraph bug.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3111 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2001-11-29 12:58:59 +00:00
parent 5d38385eb6
commit 08b1fdacad
8 changed files with 38 additions and 10 deletions

View File

@ -390,6 +390,9 @@ void BufferView::replaceWord(string const & replacestring)
bool BufferView::lockInset(UpdatableInset * inset) bool BufferView::lockInset(UpdatableInset * inset)
{ {
// don't relock if we're already locked
if (theLockingInset() == inset)
return true;
if (!theLockingInset() && inset) { if (!theLockingInset() && inset) {
theLockingInset(inset); theLockingInset(inset);
return true; return true;

View File

@ -1,3 +1,13 @@
2001-11-29 Juergen Vigna <jug@sad.it>
* BufferView2.C (lockInset): don't relock if we're already locked!
* text2.C (deleteEmptyParagraphMechanism): don't do anything if it's
the only paragraph.
(removeRow): added Assert::(firstrow)
* debug.C: forgot to add INSETTEXT here.
2001-11-28 Juergen Vigna <jug@sad.it> 2001-11-28 Juergen Vigna <jug@sad.it>
* sp_spell.C (initialize): changed error text to more general * sp_spell.C (initialize): changed error text to more general

View File

@ -54,6 +54,7 @@ error_item errorTags[] = {
{ Debug::INSETS, "insets", N_("LyX Insets")}, { Debug::INSETS, "insets", N_("LyX Insets")},
{ Debug::FILES, "files", N_("Files used by LyX")}, { Debug::FILES, "files", N_("Files used by LyX")},
{ Debug::WORKAREA, "workarea", N_("Workarea events")}, { Debug::WORKAREA, "workarea", N_("Workarea events")},
{ Debug::INSETTEXT, "insettext", N_("Insettext/tabular messanges")},
{ Debug::ANY, "any", N_("All debugging messages")} { Debug::ANY, "any", N_("All debugging messages")}
}; };

View File

@ -1,3 +1,8 @@
2001-11-29 Juergen Vigna <jug@sad.it>
* insettext.C: inserted a reinitLyXText function everywhere I delete
the paragraphs! This should fixe the crashes we had.
2001-11-28 André Pönitz <poenitz@gmx.net> 2001-11-28 André Pönitz <poenitz@gmx.net>
* insetnote.C: add pos initialization that I removed without * insetnote.C: add pos initialization that I removed without
@ -5,6 +10,8 @@
2001-11-28 Juergen Vigna <jug@sad.it> 2001-11-28 Juergen Vigna <jug@sad.it>
* insettabular.C (resetPos): hack to not crash with infinite paints.
* insettabular.h: insert missing function allowSpellcheck()! * insettabular.h: insert missing function allowSpellcheck()!
* insetcollapsable.C (draw): fixed wrong width of collapsed inset! * insetcollapsable.C (draw): fixed wrong width of collapsed inset!

View File

@ -1352,6 +1352,7 @@ void InsetTabular::resetPos(BufferView * bv) const
{ {
if (!locked || nodraw()) if (!locked || nodraw())
return; return;
#warning This should be fixed in the right manner (20011128 Jug)
// fast hack to fix infinite repaintings! // fast hack to fix infinite repaintings!
if (in_reset_pos) if (in_reset_pos)
return; return;

View File

@ -219,6 +219,7 @@ void InsetText::clear()
par = tmp; par = tmp;
} }
par = new Paragraph; par = new Paragraph;
reinitLyXText();
need_update = INIT; need_update = INIT;
} }
@ -545,6 +546,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
in_update = true; in_update = true;
if (reinit || need_update == INIT) { if (reinit || need_update == INIT) {
need_update = FULL; need_update = FULL;
// we should put this call where we set need_update to INIT!
reinitLyXText(); reinitLyXText();
if (owner()) if (owner())
owner()->update(bv, font, true); owner()->update(bv, font, true);
@ -1938,6 +1940,7 @@ void InsetText::setParagraphData(Paragraph * p)
np = np->next(); np = np->next();
np->setInsetOwner(this); np->setInsetOwner(this);
} }
reinitLyXText();
need_update = INIT; need_update = INIT;
} }
@ -2037,8 +2040,11 @@ Row * InsetText::crow(BufferView * bv) const
LyXText * InsetText::getLyXText(BufferView const * lbv, LyXText * InsetText::getLyXText(BufferView const * lbv,
bool const recursive) const bool const recursive) const
{ {
if (!recursive && (cached_bview == lbv)) if (!recursive && (cached_bview == lbv)) {
LyXText * lt = cached_text.get();
lyx::Assert(lt && lt->firstrow->par() == par);
return cached_text.get(); return cached_text.get();
}
// Super UGLY! (Lgb) // Super UGLY! (Lgb)
BufferView * bv = const_cast<BufferView *>(lbv); BufferView * bv = const_cast<BufferView *>(lbv);
@ -2327,13 +2333,7 @@ Paragraph * InsetText::paragraph() const
void InsetText::paragraph(Paragraph * p) void InsetText::paragraph(Paragraph * p)
{ {
par = p; par = p;
#if 0 reinitLyXText();
// we now have to update/redraw all instances
for (Cache::iterator cit = cache.begin(); cit != cache.end(); ++cit) {
delete cit->second;
cit->second = 0;
}
#endif
// redraw myself when asked for // redraw myself when asked for
need_update = INIT; need_update = INIT;
} }

View File

@ -501,9 +501,10 @@ public:
return bidi_start == -1 || return bidi_start == -1 ||
(bidi_start <= pos && pos <= bidi_end); (bidi_start <= pos && pos <= bidi_end);
} }
private: public:
/// ///
mutable Row * firstrow; mutable Row * firstrow;
private:
/// ///
mutable Row * lastrow; mutable Row * lastrow;

View File

@ -391,6 +391,7 @@ void LyXText::removeRow(Row * row) const
row->next()->previous(row->previous()); row->next()->previous(row->previous());
if (!row->previous()) { if (!row->previous()) {
firstrow = row->next(); firstrow = row->next();
lyx::Assert(firstrow);
} else { } else {
row->previous()->next(row->next()); row->previous()->next(row->next());
} }
@ -2366,6 +2367,10 @@ void LyXText::fixCursorAfterDelete(BufferView * bview,
void LyXText::deleteEmptyParagraphMechanism(BufferView * bview, void LyXText::deleteEmptyParagraphMechanism(BufferView * bview,
LyXCursor const & old_cursor) const LyXCursor const & old_cursor) const
{ {
// don't delete anything if this is the ONLY paragraph!
if (!old_cursor.par()->next() && !old_cursor.par()->previous())
return;
// Would be wrong to delete anything if we have a selection. // Would be wrong to delete anything if we have a selection.
if (selection.set()) return; if (selection.set()) return;