]> git.lyx.org Git - features.git/commitdiff
Tried to fix the too large InsetText (footnote).
authorJürgen Vigna <jug@sad.it>
Thu, 18 Oct 2001 16:49:29 +0000 (16:49 +0000)
committerJürgen Vigna <jug@sad.it>
Thu, 18 Oct 2001 16:49:29 +0000 (16:49 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2897 a592a061-630c-0410-9148-cb99ea01b6c8

po/POTFILES.in
src/ChangeLog
src/insets/ChangeLog
src/insets/inset.C
src/lyxtext.h
src/text.C

index 57027f766834acb4d05c9b5a26b557d4c621258d..6e89ecf053d11655e838bfe52ee9d3bb1d879260 100644 (file)
@@ -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
index 2fdf6c58ee14a384adaa0e0f78ea93a16423ea47..e0e5449d892d86d9c84f20a7f12bb299d689c589 100644 (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>
 
        * text2.C (setCursorFromCoordinates): use Paragraph::size_type
index 7f38a62ad08d9ba9d51b11e780fe870e155de5d8..7aa423f6082e834850fee2bf52f87e074b7eff88 100644 (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>
 
        * insetert.C: allow export for docbook and linuxdoc
index 94b4eef8c367d555cb31508ab1aecac191dfd33e..1b187425a5434725cbceb589d9a22c7e504a0154 100644 (file)
@@ -315,7 +315,7 @@ int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
                w = static_cast<UpdatableInset*>
                        (owner())->getMaxWidth(bv, this);
        } else {
-               w = bv->workWidth();
+               w = bv->text->workWidth(bv, const_cast<UpdatableInset *>(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;
        }
index bf353d06d775471302e736dd9c28a074709fbc40..32b8a7d344757b4f468ecfa1c2be29168c147b5c 100644 (file)
@@ -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.
index 7e0736daa79624964a3e553e89fe0242a9c65bc1..731ae3282cb29e67733cf90590f69db18336ba95 100644 (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 x = cursor.x();