From: Jürgen Vigna Date: Thu, 18 Oct 2001 16:49:29 +0000 (+0000) Subject: Tried to fix the too large InsetText (footnote). X-Git-Tag: 1.6.10~20465 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=da7583ab70f95422e8b0b8232fc3af39aedfab10;p=features.git Tried to fix the too large InsetText (footnote). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2897 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/po/POTFILES.in b/po/POTFILES.in index 57027f7668..6e89ecf053 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -16,6 +16,7 @@ src/bufferview_funcs.C src/converter.C src/debug.C src/exporter.C +src/ext_l10n.h src/figureForm.C src/figure_form.C src/frontends/controllers/ButtonController.h diff --git a/src/ChangeLog b/src/ChangeLog index 2fdf6c58ee..e0e5449d89 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2001-10-18 Juergen Vigna + + * text.C (workWidth): new function with added Inset * parameter. + 2001-10-16 Jean-Marc Lasgouttes * text2.C (setCursorFromCoordinates): use Paragraph::size_type diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 7f38a62ad0..7aa423f608 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2001-10-18 Juergen Vigna + + * inset.C (getMaxWidth): use LyXText::workWidth(BufferView, Inset *). + 2001-10-15 José Matos * insetert.C: allow export for docbook and linuxdoc diff --git a/src/insets/inset.C b/src/insets/inset.C index 94b4eef8c3..1b187425a5 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -315,7 +315,7 @@ int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const w = static_cast (owner())->getMaxWidth(bv, this); } else { - w = bv->workWidth(); + w = bv->text->workWidth(bv, const_cast(this)); } if (w < 0) { return -1; @@ -324,14 +324,19 @@ int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const if ((w - ((2 * TEXT_TO_INSET_OFFSET) + 5)) >= 0) w -= (2 * TEXT_TO_INSET_OFFSET) + 5; if (topx_set && owner()) { + lyxerr << "topx_set && owner()\n"; w -= top_x; w += owner()->x(); - } else if (!owner()) { + } +#if 0 // already handled above now!!! + else if (!owner()) { // give some left margin this should be made better! // Idea: LyXText::giveLeftMargin(Inset * inset) will search the // inset in the text and return the LeftMargin of that row! + lyxerr << "w -= 20\n"; w -= 20; } +#endif if (w < 10) { w = 10; } diff --git a/src/lyxtext.h b/src/lyxtext.h index bf353d06d7..32b8a7d344 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -466,6 +466,8 @@ public: /// int workWidth(BufferView *) const; /// + int workWidth(BufferView *, Inset * inset) const; + /// void computeBidiTables(Buffer const *, Row * row) const; /// Maps positions in the visual string to positions in logical string. diff --git a/src/text.C b/src/text.C index 7e0736daa7..731ae3282c 100644 --- a/src/text.C +++ b/src/text.C @@ -64,6 +64,41 @@ int LyXText::workWidth(BufferView * bview) const } +int LyXText::workWidth(BufferView * bview, Inset * inset) const +{ + Buffer::inset_iterator it; + Paragraph * par = 0; + Paragraph::size_type pos; + + for(it=bview->buffer()->inset_iterator_begin(); + it != bview->buffer()->inset_iterator_end(); + ++it) + { + if (*it == inset) { + par = it.getPar(); + pos = it.getPos(); + break; + } + } + if (par) { + Row * row = firstrow; + for(; row; row = row->next()) { + if ((row->par() == par && row->pos() >= pos)) { + if (!row->next()) + break; + else if ((row->next()->par() == par) && + (row->next()->pos() >= pos)) + continue; + } + } + if (row) { + return workWidth(bview) - leftMargin(bview, row); + } + } + return workWidth(bview); +} + + int LyXText::getRealCursorX(BufferView * bview) const { int x = cursor.x();