]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetcollapsable.C
fix compilation pb ; update eu.po
[lyx.git] / src / insets / insetcollapsable.C
index 6a3643c4f3bcc0b2c932119a4e336d6d0d676586..e73455ce2a3cb27b3d3d173e14f1eb6ae4fd0d2b 100644 (file)
@@ -172,6 +172,9 @@ void InsetCollapsable::draw_collapsed(Painter & pain, LyXFont const &,
 void InsetCollapsable::draw(BufferView * bv, LyXFont const & f, 
                            int baseline, float & x, bool cleared) const
 {
+       if (nodraw())
+               return;
+
        Painter & pain = bv->painter();
 
        button_length = widthCollapsed;
@@ -185,15 +188,31 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
                return;
        }
 
+       float old_x = x;
+
+#if 0
+       UpdatableInset::draw(bv, f, baseline, x, cleared);
+#else
+       if (!owner())
+               x += static_cast<float>(scroll());
+#endif
        if (!cleared && (inset.need_update == InsetText::FULL ||
                         inset.need_update == InsetText::INIT ||
                         top_x != int(x) ||
-                        top_baseline != baseline)) {
+                        top_baseline != baseline))
+       {
+#if 1
+               // we don't need anymore to clear here we just have to tell
+               // the underlying LyXText that it should do the RowClear!
+               inset.SetUpdateStatus(bv, InsetText::FULL);
+               bv->text->status = LyXText::CHANGED_IN_DRAW;
+               return;
+#else
                int w =  owner() ? width(bv, f) : pain.paperWidth();
                int h = ascent(bv, f) + descent(bv, f);
                int const tx = (needFullRow() && !owner()) ? 0 : int(x);
                int const ty = max(0, baseline - ascent(bv, f));
-               
+
                if ((ty + h) > pain.paperHeight())
                        h = pain.paperHeight();
                if ((top_x + w) > pain.paperWidth())
@@ -202,15 +221,15 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
                        h += (baseline - ascent(bv, f));
                pain.fillRectangle(tx, ty - 1, w, h + 2);
                cleared = true;
+#endif
        }
 
        top_x = int(x);
        top_baseline = baseline;
 
-       float dummy = x;
        int const bl = baseline - ascent(bv, f) + ascent_collapsed(pain, f);
 
-       draw_collapsed(pain, f, bl, dummy);
+       draw_collapsed(pain, f, bl, old_x);
        inset.draw(bv, f, 
                   bl + descent_collapsed(pain, f) + inset.ascent(bv, f),
                   x, cleared);
@@ -232,7 +251,7 @@ void InsetCollapsable::Edit(BufferView * bv, int xp, int yp,
        } else if (!collapsed) {
                if (!bv->lockInset(this))
                        return;
-               inset.Edit(bv, xp, yp+(top_baseline - inset.y()), button);
+               inset.Edit(bv, xp, yp + (top_baseline - inset.y()), button);
        }
 }
 
@@ -251,6 +270,8 @@ void InsetCollapsable::InsetUnlock(BufferView * bv)
                collapsed = true;
        }
        inset.InsetUnlock(bv);
+       if (scroll())
+               scroll(bv, 0.0F);
        bv->updateInset(this, false);
 }
 
@@ -472,3 +493,18 @@ std::vector<string> const InsetCollapsable::getLabelList() const
 {
        return inset.getLabelList();
 }
+
+bool InsetCollapsable::nodraw() const
+{
+       return inset.nodraw();
+}
+
+int InsetCollapsable::scroll(bool recursive) const
+{
+       int sx = UpdatableInset::scroll(false);
+
+       if (recursive)
+               sx += inset.scroll(recursive);
+
+       return sx;
+}