]> git.lyx.org Git - features.git/commitdiff
Small fixes + hfill display/draw bug (seen with minipages!).
authorJürgen Vigna <jug@sad.it>
Fri, 10 Aug 2001 14:00:48 +0000 (14:00 +0000)
committerJürgen Vigna <jug@sad.it>
Fri, 10 Aug 2001 14:00:48 +0000 (14:00 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2487 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/insets/ChangeLog
src/insets/inset.C
src/insets/insetcollapsable.C
src/insets/insetminipage.C
src/insets/insettabular.C
src/text.C

index 16dcba7583794e3ac3c58710f7fb7b2bbde1e87e..0b81d6116b8878738c705bc6d1bbec0da2c2e22e 100644 (file)
@@ -1,5 +1,7 @@
 2001-08-10  Juergen Vigna  <jug@sad.it>
 
+       * text.C (prepareToPrint): fixed hfill-width in draw!
+
        * BufferView2.C (selectLastWord): save the selection cursor as this
        now is cleared in the function LyXText::clearSelection!
 
index 99385c50a2629e92ad34acdf5ee7e000761b6a12..a4dbca50ce76e81464da6530bb3f4367bc5889a5 100644 (file)
@@ -1,5 +1,12 @@
 2001-08-10  Juergen Vigna  <jug@sad.it>
 
+       * insettabular.C (selectNextWordInt): use the front using edit call.
+
+       * insetcollapsable.C (getMaxWidth): rename inset to in to not have
+       the parameter overwrite class variable inset.
+
+       * inset.C (getMaxWidth): fix the setting of the minwidth = 10.
+
        * insettext.C (saveLyXTextState): check for invalid cursor-par.
        (reinitLyXText): remove wrong_cursor bool as not needed anymore!
 
index 93e47e311413bc7e83f1a6201b0af077782e7a2a..483d9bea1e369ab67c74f5ff8a4a4b22b92ee826 100644 (file)
@@ -324,15 +324,12 @@ 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) {
-               if ((w - top_x) < 10) {
-                       w = 10; // minimum I require!!!
-               } else {
-                       w -= top_x;
-                       if (owner()) {
-                               w += owner()->x();
-                       }
+               w -= top_x;
+               if (owner()) {
+                       w += owner()->x();
                }
-       } else if (w < 10) {
+       }
+       if (w < 10) {
                w = 10;
        }
        return w;
index 2bbf5d79d92cfb81e83c862c6bdba897fbe5a58e..b5c7cb021230d9764ad86f3b6fd940afbcb49e46 100644 (file)
@@ -377,10 +377,10 @@ int InsetCollapsable::latex(Buffer const * buf, ostream & os,
 
 
 int InsetCollapsable::getMaxWidth(BufferView * bv,
-                                  UpdatableInset const * inset) const
+                                  UpdatableInset const * in) const
 {
 #if 0
-       int const w = UpdatableInset::getMaxWidth(bv, inset);
+       int const w = UpdatableInset::getMaxWidth(bv, in);
 
        if (w < 0) {
                // What does a negative max width signify? (Lgb)
@@ -390,7 +390,7 @@ int InsetCollapsable::getMaxWidth(BufferView * bv,
        // should be at least 30 pixels !!!
        return max(30, w - width_collapsed());
 #else
-       return UpdatableInset::getMaxWidth(bv, inset);
+       return UpdatableInset::getMaxWidth(bv, in);
 #endif
 }
 
index b4085bfc0d49f084bab13c4c09c33bb18ac22376..81523d353c37bc770044d12d488167fc96d2f993 100644 (file)
@@ -341,8 +341,9 @@ int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
        if (!width_.empty()) {
                int ww1 = VSpace(width_).inPixels(bv);
                int ww2 = InsetCollapsable::getMaxWidth(bv, inset);
-               if (ww2 > 0 && ww2 < ww1)
+               if (ww2 > 0 && ww2 < ww1) {
                        return ww2;
+               }
                return ww1;
        }
        // this should not happen!
index b750e139de71b84e91cca9da90b12013b0da14e7..67cee87f16e91a8d46580dbf151e132db1a89d66 100644 (file)
@@ -2524,7 +2524,7 @@ string InsetTabular::selectNextWordInt(BufferView * bv, float & value) const
        // otherwise we have to lock the next inset and ask for it's selecttion
        UpdatableInset * inset =
                static_cast<UpdatableInset*>(tabular->GetCellInset(++actcell));
-       inset->edit(bv, 0,  0, 0);
+       inset->edit(bv);
        return selectNextWordInt(bv, value);
 }
 
index 6a80460c7afbf422c5bd3c9c2a251e4770cc7aa2..ace479038f661b3ced976d0d6e96169e5baed76f 100644 (file)
@@ -138,7 +138,7 @@ int LyXText::singleWidth(BufferView * bview, Paragraph * par,
 
 
 int LyXText::singleWidth(BufferView * bview, Paragraph * par,
-                        Paragraph::size_type pos, char c) const
+                         Paragraph::size_type pos, char c) const
 {
        LyXFont const font = getFont(bview->buffer(), par, pos);
 
@@ -1134,7 +1134,7 @@ int LyXText::numberOfLabelHfills(Buffer const * buf, Row const * row) const
 // returns true, if a expansion is needed.
 // Rules are given by LaTeX
 bool LyXText::hfillExpansion(Buffer const * buf, Row const * row_ptr,
-                            Paragraph::size_type pos) const
+                             Paragraph::size_type pos) const
 {
        // by the way, is it a hfill?
        if (!row_ptr->par()->isHfill(pos))
@@ -1991,11 +1991,11 @@ void LyXText::charInserted()
 
 
 void LyXText::prepareToPrint(BufferView * bview,
-                            Row * row, float & x,
-                            float & fill_separator, 
-                            float & fill_hfill,
-                            float & fill_label_hfill,
-                            bool bidi) const
+                             Row * row, float & x,
+                             float & fill_separator, 
+                             float & fill_hfill,
+                             float & fill_label_hfill,
+                             bool bidi) const
 {
        float nlh;
        float ns;
@@ -2030,45 +2030,49 @@ void LyXText::prepareToPrint(BufferView * bview,
        // are there any hfills in the row?
        float const nh = numberOfHfills(bview->buffer(), row);
 
-       if (nh)
-         fill_hfill = w / nh;
-       else  {
+       if (nh) {
+               if (w > 0)
+                       fill_hfill = w / nh;
+       } else  {
                // is it block, flushleft or flushright? 
                // set x how you need it
-       int align;
-       if (row->par()->params().align() == LYX_ALIGN_LAYOUT)
-         align = textclasslist.Style(bview->buffer()->params.textclass, row->par()->getLayout()).align;
-       else
-         align = row->par()->params().align();
-          
-       // center displayed insets 
-       Inset * inset;
-          if (row->par()->getChar(row->pos()) == Paragraph::META_INSET
-              && (inset=row->par()->getInset(row->pos()))
-              && (inset->display())) // || (inset->scroll() < 0)))
-            align = (inset->lyxCode() == Inset::MATHMACRO_CODE)
-                    ? LYX_ALIGN_BLOCK : LYX_ALIGN_CENTER;
-
-          switch (align) {
+               int align;
+               if (row->par()->params().align() == LYX_ALIGN_LAYOUT) {
+                       align = textclasslist.Style(bview->buffer()->params.textclass, row->par()->getLayout()).align;
+               } else {
+                       align = row->par()->params().align();
+               }
+               
+               // center displayed insets 
+               Inset * inset;
+               if (row->par()->getChar(row->pos()) == Paragraph::META_INSET
+                   && (inset=row->par()->getInset(row->pos()))
+                   && (inset->display())) // || (inset->scroll() < 0)))
+                   align = (inset->lyxCode() == Inset::MATHMACRO_CODE)
+                       ? LYX_ALIGN_BLOCK : LYX_ALIGN_CENTER;
+               
+               switch (align) {
            case LYX_ALIGN_BLOCK:
-             ns = numberOfSeparators(bview->buffer(), row);
-             if (ns && row->next() && row->next()->par() == row->par() &&
-                 !(row->next()->par()->isNewline(row->next()->pos() - 1))
-                 && !(row->next()->par()->getChar(row->next()->pos()) == Paragraph::META_INSET
-                      && row->next()->par()->getInset(row->next()->pos())
-                      && row->next()->par()->getInset(row->next()->pos())->display())
-                 )
-               fill_separator = w / ns;
-             else if (is_rtl)
-               x += w;
-             break;
+                       ns = numberOfSeparators(bview->buffer(), row);
+                       if (ns && row->next() && row->next()->par() == row->par() &&
+                           !(row->next()->par()->isNewline(row->next()->pos() - 1))
+                           && !(row->next()->par()->getChar(row->next()->pos()) == Paragraph::META_INSET
+                                && row->next()->par()->getInset(row->next()->pos())
+                                && row->next()->par()->getInset(row->next()->pos())->display())
+                               )
+                       {
+                               fill_separator = w / ns;
+                       } else if (is_rtl) {
+                               x += w;
+                       }
+                       break;
            case LYX_ALIGN_RIGHT:
-             x += w;
-             break;
+                       x += w;
+                       break;
            case LYX_ALIGN_CENTER:
-             x += w / 2;
-             break;
-          }
+                       x += w / 2;
+                       break;
+               }
        }
        if (!bidi)
                return;