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
This commit is contained in:
Jürgen Vigna 2001-06-07 14:51:20 +00:00
parent 5735d58b27
commit 389fa29ba5
13 changed files with 121 additions and 82 deletions

View File

@ -11,6 +11,10 @@
#include <boost/config.hpp>
// 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 <boost/detail/limits.hpp>
#else

View File

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

View File

@ -1,3 +1,10 @@
2001-06-07 Juergen Vigna <jug@sad.it>
* 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 <Jean-Marc.Lasgouttes@inria.fr>
* gettext.h (gettext_init):

View File

@ -1,3 +1,11 @@
2001-06-07 Juergen Vigna <jug@sad.it>
* 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 <moz@compsoc.man.ac.uk>
* insettheorem.C:

View File

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

View File

@ -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<string> const getLabelList() const;
///

View File

@ -1910,9 +1910,20 @@ int InsetTabular::getMaxWidth(BufferView * bv,
return w;
}
void InsetTabular::resizeLyXText(BufferView *) const
void InsetTabular::deleteLyXText(BufferView * bv, bool recursive) const
{
resizeLyXText(bv, recursive);
}
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;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -2361,7 +2361,7 @@ void LyXParagraph::deleteInsetsLyXText(BufferView * bv)
if ((*cit).inset) {
if ((*cit).inset->IsTextInset()) {
static_cast<UpdatableInset *>
((*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<UpdatableInset *>
((*cit).inset)->resizeLyXText(bv);
((*cit).inset)->resizeLyXText(bv, true);
}
}
}

View File

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