]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetcollapsable.C
updates to minipage inset
[lyx.git] / src / insets / insetcollapsable.C
index 8698182c10301675dea3a30a0320643d87c332a0..ea7757dc01fc3ca09b5ce9bb443d58daac5818a2 100644 (file)
@@ -3,7 +3,7 @@
  * 
  *           LyX, The Document Processor
  *      
- *          Copyright (C) 1998 The LyX Team.
+ *          Copyright 1998-2001 The LyX Team.
  *
  * ======================================================
  */
@@ -32,9 +32,9 @@ using std::endl;
 using std::max;
 
 InsetCollapsable::InsetCollapsable()
-       : UpdatableInset()
+       : UpdatableInset(), inset(new InsetText)
 {
-    inset = new InsetText;
+       //inset = new InsetText;
     inset->setOwner(this);
     collapsed = true;
     label = "Label";
@@ -84,7 +84,7 @@ void InsetCollapsable::Read(Buffer const * buf, LyXLex & lex)
 {
     if (lex.IsOK()) {
        lex.next();
-        string token = lex.GetString();
+        string const token = lex.GetString();
        if (token == "collapsed") {
            lex.next();
            collapsed = lex.GetBool();
@@ -99,7 +99,9 @@ void InsetCollapsable::Read(Buffer const * buf, LyXLex & lex)
 
 int InsetCollapsable::ascent_collapsed(Painter & pain, LyXFont const &) const
 {
-    int width = 0, ascent = 0, descent = 0;
+    int width = 0;
+    int ascent = 0;
+    int descent = 0;
     pain.buttonText(0, 0, label, labelfont, false, 
                    width, ascent, descent);
     return ascent;
@@ -108,7 +110,9 @@ int InsetCollapsable::ascent_collapsed(Painter & pain, LyXFont const &) const
 
 int InsetCollapsable::descent_collapsed(Painter & pain, LyXFont const &) const
 {
-    int width = 0, ascent = 0, descent = 0;
+    int width = 0;
+    int ascent = 0;
+    int descent = 0;
     pain.buttonText(0, 0, label, labelfont, false, 
                    width, ascent, descent);
     return descent;
@@ -117,7 +121,9 @@ int InsetCollapsable::descent_collapsed(Painter & pain, LyXFont const &) const
 
 int InsetCollapsable::width_collapsed(Painter & pain, LyXFont const &) const
 {
-    int width, ascent, descent;
+    int width;
+    int ascent;
+    int descent;
     pain.buttonText(TEXT_TO_INSET_OFFSET, 0, label, labelfont, false,
                    width, ascent, descent);
     return width + (2*TEXT_TO_INSET_OFFSET);
@@ -216,7 +222,7 @@ void InsetCollapsable::Edit(BufferView * bv, int x, int y, unsigned int button)
     } else if (!collapsed) {
        if (!bv->lockInset(this))
            return;
-       inset->Edit(bv, x-widthCollapsed, y, button);
+       inset->Edit(bv, x - widthCollapsed, y, button);
     }
 }
 
@@ -242,7 +248,7 @@ void InsetCollapsable::InsetUnlock(BufferView * bv)
 void InsetCollapsable::InsetButtonPress(BufferView * bv,int x,int y,int button)
 {
     if (!collapsed && (x >= button_length)) {
-       inset->InsetButtonPress(bv, x-widthCollapsed, y, button);
+       inset->InsetButtonPress(bv, x - widthCollapsed, y, button);
     }
 }
 
@@ -262,7 +268,7 @@ void InsetCollapsable::InsetButtonRelease(BufferView * bv,
            bv->updateInset(this, false);
        }
     } else if (!collapsed && (x >= button_length) && (y >= button_top_y)) {
-       inset->InsetButtonRelease(bv, x-widthCollapsed, y, button);
+       inset->InsetButtonRelease(bv, x - widthCollapsed, y, button);
     }
 }
 
@@ -292,7 +298,7 @@ int InsetCollapsable::Latex(Buffer const * buf, ostream & os,
 int InsetCollapsable::getMaxWidth(Painter & pain,
                                  UpdatableInset const * inset) const
 {
-    int w = UpdatableInset::getMaxWidth(pain,inset);
+    int const w = UpdatableInset::getMaxWidth(pain, inset);
 
     if (w < 0) {
        // What does a negative max width signify? (Lgb)
@@ -344,7 +350,7 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
 
 
 UpdatableInset::RESULT
-InsetCollapsable::LocalDispatch(BufferView * bv, int action,
+InsetCollapsable::LocalDispatch(BufferView * bv, kb_action action,
                                string const & arg)
 {
     UpdatableInset::RESULT result = inset->LocalDispatch(bv, action, arg);
@@ -435,9 +441,10 @@ bool InsetCollapsable::doClearArea() const
 }
 
 
-LyXText * InsetCollapsable::getLyXText(BufferView const * bv) const
+LyXText * InsetCollapsable::getLyXText(BufferView const * bv,
+                                      bool const recursive) const
 {
-    return inset->getLyXText(bv);
+    return inset->getLyXText(bv, recursive);
 }