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
This commit is contained in:
Jürgen Vigna 2001-10-18 16:49:29 +00:00
parent 622e505857
commit da7583ab70
6 changed files with 53 additions and 2 deletions

View File

@ -16,6 +16,7 @@ src/bufferview_funcs.C
src/converter.C src/converter.C
src/debug.C src/debug.C
src/exporter.C src/exporter.C
src/ext_l10n.h
src/figureForm.C src/figureForm.C
src/figure_form.C src/figure_form.C
src/frontends/controllers/ButtonController.h src/frontends/controllers/ButtonController.h

View File

@ -1,3 +1,7 @@
2001-10-18 Juergen Vigna <jug@sad.it>
* text.C (workWidth): new function with added Inset * parameter.
2001-10-16 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 2001-10-16 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* text2.C (setCursorFromCoordinates): use Paragraph::size_type * text2.C (setCursorFromCoordinates): use Paragraph::size_type

View File

@ -1,3 +1,7 @@
2001-10-18 Juergen Vigna <jug@sad.it>
* inset.C (getMaxWidth): use LyXText::workWidth(BufferView, Inset *).
2001-10-15 José Matos <jamatos@fep.up.pt> 2001-10-15 José Matos <jamatos@fep.up.pt>
* insetert.C: allow export for docbook and linuxdoc * insetert.C: allow export for docbook and linuxdoc

View File

@ -315,7 +315,7 @@ int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
w = static_cast<UpdatableInset*> w = static_cast<UpdatableInset*>
(owner())->getMaxWidth(bv, this); (owner())->getMaxWidth(bv, this);
} else { } else {
w = bv->workWidth(); w = bv->text->workWidth(bv, const_cast<UpdatableInset *>(this));
} }
if (w < 0) { if (w < 0) {
return -1; return -1;
@ -324,14 +324,19 @@ int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
if ((w - ((2 * TEXT_TO_INSET_OFFSET) + 5)) >= 0) if ((w - ((2 * TEXT_TO_INSET_OFFSET) + 5)) >= 0)
w -= (2 * TEXT_TO_INSET_OFFSET) + 5; w -= (2 * TEXT_TO_INSET_OFFSET) + 5;
if (topx_set && owner()) { if (topx_set && owner()) {
lyxerr << "topx_set && owner()\n";
w -= top_x; w -= top_x;
w += owner()->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! // give some left margin this should be made better!
// Idea: LyXText::giveLeftMargin(Inset * inset) will search the // Idea: LyXText::giveLeftMargin(Inset * inset) will search the
// inset in the text and return the LeftMargin of that row! // inset in the text and return the LeftMargin of that row!
lyxerr << "w -= 20\n";
w -= 20; w -= 20;
} }
#endif
if (w < 10) { if (w < 10) {
w = 10; w = 10;
} }

View File

@ -466,6 +466,8 @@ public:
/// ///
int workWidth(BufferView *) const; int workWidth(BufferView *) const;
/// ///
int workWidth(BufferView *, Inset * inset) const;
///
void computeBidiTables(Buffer const *, Row * row) const; void computeBidiTables(Buffer const *, Row * row) const;
/// Maps positions in the visual string to positions in logical string. /// Maps positions in the visual string to positions in logical string.

View File

@ -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 LyXText::getRealCursorX(BufferView * bview) const
{ {
int x = cursor.x(); int x = cursor.x();