From 389fa29ba55badfafd7b4b5765182f5963d47f35 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Vigna?= Date: Thu, 7 Jun 2001 14:51:20 +0000 Subject: [PATCH] Fixed one more "missing feature" for InsetText/Tabular. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2098 a592a061-630c-0410-9148-cb99ea01b6c8 --- boost/boost/limits.hpp | 4 ++ po/POTFILES.in | 60 +++++++++++++-------------- src/ChangeLog | 7 ++++ src/insets/ChangeLog | 8 ++++ src/insets/insetcollapsable.C | 4 +- src/insets/insetcollapsable.h | 2 +- src/insets/insettabular.C | 13 +++++- src/insets/insettabular.h | 4 +- src/insets/insettext.C | 13 ++++-- src/insets/insettext.h | 2 +- src/insets/lyxinset.h | 2 +- src/paragraph.C | 4 +- src/text.C | 78 +++++++++++++++++------------------ 13 files changed, 120 insertions(+), 81 deletions(-) diff --git a/boost/boost/limits.hpp b/boost/boost/limits.hpp index 1d2ca13895..132c772898 100644 --- a/boost/boost/limits.hpp +++ b/boost/boost/limits.hpp @@ -11,6 +11,10 @@ #include +// for now just deactivate the following as otherwise we cannot compile +// using LString.h and our own string implementation (Jug) +#define BOOST_NO_LIMITS 1 + #ifdef BOOST_NO_LIMITS #include #else diff --git a/po/POTFILES.in b/po/POTFILES.in index ce1833e689..04b1702eba 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -10,8 +10,8 @@ src/CutAndPaste.C src/debug.C src/exporter.C src/ext_l10n.h -src/figureForm.C src/figure_form.C +src/figureForm.C src/FontLoader.C src/frontends/controllers/ButtonController.h src/frontends/controllers/character.C @@ -90,67 +90,67 @@ src/frontends/qt2/paragraphdlgimpl.C src/frontends/qt2/tabularcreatedlgimpl.C src/frontends/xforms/combox.C src/frontends/xforms/FileDialog.C -src/frontends/xforms/FormBibitem.C src/frontends/xforms/form_bibitem.C -src/frontends/xforms/FormBibtex.C +src/frontends/xforms/FormBibitem.C src/frontends/xforms/form_bibtex.C +src/frontends/xforms/FormBibtex.C src/frontends/xforms/form_browser.C -src/frontends/xforms/FormCharacter.C src/frontends/xforms/form_character.C -src/frontends/xforms/FormCitation.C +src/frontends/xforms/FormCharacter.C src/frontends/xforms/form_citation.C -src/frontends/xforms/FormCopyright.C +src/frontends/xforms/FormCitation.C src/frontends/xforms/form_copyright.C -src/frontends/xforms/FormCredits.C +src/frontends/xforms/FormCopyright.C src/frontends/xforms/form_credits.C -src/frontends/xforms/FormDocument.C +src/frontends/xforms/FormCredits.C src/frontends/xforms/form_document.C -src/frontends/xforms/FormError.C +src/frontends/xforms/FormDocument.C src/frontends/xforms/form_error.C -src/frontends/xforms/FormExternal.C +src/frontends/xforms/FormError.C src/frontends/xforms/form_external.C -src/frontends/xforms/FormFiledialog.C +src/frontends/xforms/FormExternal.C src/frontends/xforms/form_filedialog.C -src/frontends/xforms/FormGraphics.C +src/frontends/xforms/FormFiledialog.C src/frontends/xforms/form_graphics.C -src/frontends/xforms/FormInclude.C +src/frontends/xforms/FormGraphics.C src/frontends/xforms/form_include.C -src/frontends/xforms/FormIndex.C +src/frontends/xforms/FormInclude.C src/frontends/xforms/form_index.C +src/frontends/xforms/FormIndex.C src/frontends/xforms/FormLog.C src/frontends/xforms/FormMathsBitmap.C -src/frontends/xforms/FormMathsDeco.C src/frontends/xforms/form_maths_deco.C -src/frontends/xforms/FormMathsDelim.C +src/frontends/xforms/FormMathsDeco.C src/frontends/xforms/form_maths_delim.C -src/frontends/xforms/FormMathsMatrix.C +src/frontends/xforms/FormMathsDelim.C src/frontends/xforms/form_maths_matrix.C -src/frontends/xforms/FormMathsPanel.C +src/frontends/xforms/FormMathsMatrix.C src/frontends/xforms/form_maths_panel.C -src/frontends/xforms/FormMathsSpace.C +src/frontends/xforms/FormMathsPanel.C src/frontends/xforms/form_maths_space.C -src/frontends/xforms/FormMinipage.C +src/frontends/xforms/FormMathsSpace.C src/frontends/xforms/form_minipage.C -src/frontends/xforms/FormParagraph.C +src/frontends/xforms/FormMinipage.C src/frontends/xforms/form_paragraph.C -src/frontends/xforms/FormPreamble.C +src/frontends/xforms/FormParagraph.C src/frontends/xforms/form_preamble.C -src/frontends/xforms/FormPreferences.C +src/frontends/xforms/FormPreamble.C src/frontends/xforms/form_preferences.C -src/frontends/xforms/FormPrint.C +src/frontends/xforms/FormPreferences.C src/frontends/xforms/form_print.C -src/frontends/xforms/FormRef.C +src/frontends/xforms/FormPrint.C src/frontends/xforms/form_ref.C -src/frontends/xforms/FormSearch.C +src/frontends/xforms/FormRef.C src/frontends/xforms/form_search.C -src/frontends/xforms/FormTabular.C +src/frontends/xforms/FormSearch.C src/frontends/xforms/form_tabular.C -src/frontends/xforms/FormTabularCreate.C +src/frontends/xforms/FormTabular.C src/frontends/xforms/form_tabular_create.C -src/frontends/xforms/FormToc.C +src/frontends/xforms/FormTabularCreate.C src/frontends/xforms/form_toc.C -src/frontends/xforms/FormUrl.C +src/frontends/xforms/FormToc.C src/frontends/xforms/form_url.C +src/frontends/xforms/FormUrl.C src/frontends/xforms/FormVCLog.C src/frontends/xforms/input_validators.C src/frontends/xforms/Menubar_pimpl.C diff --git a/src/ChangeLog b/src/ChangeLog index 6c1e53d73d..116c3b65b8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2001-06-07 Juergen Vigna + + * text.C (BreakAgain): subst spaces with tabs. + + * paragraph.C (deleteInsetsLyXText): set recursive on deleteLyXText. + (resizeInsetsLyXText): set force on resizeLyXText. + 2001-06-05 Jean-Marc Lasgouttes * gettext.h (gettext_init): diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 945d21e937..5888856338 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,11 @@ +2001-06-07 Juergen Vigna + + * insettext.C (resizeLyXText): honor the new force flag. + + * lyxinset.h: add 'bool force' parameter to resizeLyXText(...) + + * insettabular.C (deleteLyXText): new function + 2001-06-02 John Levon * insettheorem.C: diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 2e9aff3cef..66abb44326 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -468,9 +468,9 @@ void InsetCollapsable::deleteLyXText(BufferView * bv, bool recursive) const } -void InsetCollapsable::resizeLyXText(BufferView * bv) const +void InsetCollapsable::resizeLyXText(BufferView * bv, bool force) const { - inset.resizeLyXText(bv); + inset.resizeLyXText(bv, force); LyXFont font(LyXFont::ALL_SANE); oldWidth = width(bv, font); } diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index 15d7b091cb..9b0e65425d 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -124,7 +124,7 @@ public: /// void deleteLyXText(BufferView *, bool recursive=true) const; /// - void resizeLyXText(BufferView *) const; + void resizeLyXText(BufferView *, bool force = false) const; /// std::vector const getLabelList() const; /// diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 39650ad2b6..e2b8088fa1 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -1910,9 +1910,20 @@ int InsetTabular::getMaxWidth(BufferView * bv, return w; } +void InsetTabular::deleteLyXText(BufferView * bv, bool recursive) const +{ + resizeLyXText(bv, recursive); +} -void InsetTabular::resizeLyXText(BufferView *) const +void InsetTabular::resizeLyXText(BufferView * bv, bool force) const { + if (force) { + for(int i=0; i < tabular->rows(); ++i) { + for(int j=0; j < tabular->columns(); ++j) { + tabular->GetCellInset(i, j)->resizeLyXText(bv, true); + } + } + } need_update = FULL; } diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index 0670ec7616..1b2ed5ab4f 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -170,7 +170,9 @@ public: LyXText * getLyXText(BufferView const *, bool const recursive = false) const; /// - void resizeLyXText(BufferView *) const; + void deleteLyXText(BufferView *, bool recursive = true) const; + /// + void resizeLyXText(BufferView *, bool force = false) const; /// void OpenLayoutDialog(BufferView *) const; /// diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 9367aa62ee..da65680a78 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -422,6 +422,12 @@ void InsetText::clearFrame(Painter & pain, bool cleared) const void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit) { +#if 0 + int ww = TEXT(bv)->width; + TEXT(bv)->BreakParagraph(bv); + if (ww != TEXT(bv)->width) + reinit = true; +#endif if (reinit) { need_update |= INIT; resizeLyXText(bv); @@ -1629,11 +1635,12 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const } -void InsetText::resizeLyXText(BufferView * bv) const +void InsetText::resizeLyXText(BufferView * bv, bool force) const { if (!par->next() && !par->size()) // no data, resize not neccessary! return; - if (getMaxWidth(bv, this) < 0) // one endless line, no resize necessary + // one endless line, resize normally not necessary + if (!force && getMaxWidth(bv, this) < 0) return; if ((cache.find(bv) == cache.end()) || !cache[bv]) return; @@ -1665,7 +1672,7 @@ void InsetText::resizeLyXText(BufferView * bv) const selection = TEXT(bv)->selection.set(); mark_set = TEXT(bv)->selection.mark(); } - deleteLyXText(bv, (the_locking_inset == 0)); + deleteLyXText(bv, (the_locking_inset == 0) || force); if (lpar) { TEXT(bv)->selection.set(true); diff --git a/src/insets/insettext.h b/src/insets/insettext.h index faa5cef34f..abc0cf3aac 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -175,7 +175,7 @@ public: /// void deleteLyXText(BufferView *, bool recursive=true) const; /// - void resizeLyXText(BufferView *) const; + void resizeLyXText(BufferView *, bool force=false) const; /// bool ShowInsetDialog(BufferView *) const; /// diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index ebe6c1cd7d..2b39b83c65 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -228,7 +228,7 @@ public: /// virtual void deleteLyXText(BufferView *, bool = true) const {} /// - virtual void resizeLyXText(BufferView *) const {} + virtual void resizeLyXText(BufferView *, bool force = false) const {} /// returns the actuall scroll-value virtual int scroll(bool recursive=true) const { if (!recursive || !owner_) diff --git a/src/paragraph.C b/src/paragraph.C index 1f05276cde..3af82b6910 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -2361,7 +2361,7 @@ void LyXParagraph::deleteInsetsLyXText(BufferView * bv) if ((*cit).inset) { if ((*cit).inset->IsTextInset()) { static_cast - ((*cit).inset)->deleteLyXText(bv); + ((*cit).inset)->deleteLyXText(bv, true); } } } @@ -2376,7 +2376,7 @@ void LyXParagraph::resizeInsetsLyXText(BufferView * bv) if ((*cit).inset) { if ((*cit).inset->IsTextInset()) { static_cast - ((*cit).inset)->resizeLyXText(bv); + ((*cit).inset)->resizeLyXText(bv, true); } } } diff --git a/src/text.C b/src/text.C index 09a410947b..579304c719 100644 --- a/src/text.C +++ b/src/text.C @@ -1501,47 +1501,47 @@ void LyXText::AppendParagraph(BufferView * bview, Row * row) const void LyXText::BreakAgain(BufferView * bview, Row * row) const { - bool not_ready = true; + bool not_ready = true; - do { - // get the next breakpoint - LyXParagraph::size_type z = NextBreakPoint(bview, row, workWidth(bview)); - Row * tmprow = row; + do { + // get the next breakpoint + LyXParagraph::size_type z = NextBreakPoint(bview, row, workWidth(bview)); + Row * tmprow = row; - if (z < row->par()->size()) { - if (!row->next() || (row->next() && row->next()->par() != row->par())) { - // insert a new row - ++z; - InsertRow(row, row->par(), z); - row = row->next(); - row->height(0); - } else { - row = row->next(); - ++z; - if (row->pos() == z) - not_ready = false; // the rest will not change - else { - row->pos(z); - } - } - } else { - /* if there are some rows too much, delete them */ - /* only if you broke the whole paragraph! */ - Row * tmprow2 = row; - while (tmprow2->next() && tmprow2->next()->par() == row->par()) { - tmprow2 = tmprow2->next(); - } - while (tmprow2 != row) { - tmprow2 = tmprow2->previous(); - RemoveRow(tmprow2->next()); - } - not_ready = false; - } - - /* set the dimensions of the row */ - tmprow->fill(Fill(bview, tmprow, workWidth(bview))); - SetHeightOfRow(bview, tmprow); - } while (not_ready); + if (z < row->par()->size()) { + if (!row->next() || (row->next() && row->next()->par() != row->par())) { + // insert a new row + ++z; + InsertRow(row, row->par(), z); + row = row->next(); + row->height(0); + } else { + row = row->next(); + ++z; + if (row->pos() == z) + not_ready = false; // the rest will not change + else { + row->pos(z); + } + } + } else { + /* if there are some rows too much, delete them */ + /* only if you broke the whole paragraph! */ + Row * tmprow2 = row; + while (tmprow2->next() && tmprow2->next()->par() == row->par()) { + tmprow2 = tmprow2->next(); + } + while (tmprow2 != row) { + tmprow2 = tmprow2->previous(); + RemoveRow(tmprow2->next()); + } + not_ready = false; + } + + /* set the dimensions of the row */ + tmprow->fill(Fill(bview, tmprow, workWidth(bview))); + SetHeightOfRow(bview, tmprow); + } while (not_ready); } -- 2.39.2