]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetcollapsable.C
Enable convertDefault.sh to run even if its executable bit is not set.
[lyx.git] / src / insets / insetcollapsable.C
index 5cb670318b39cd368fda74b1d3171a039aa1dfe9..2ea0f2f90849f8cb7054bd34af923db364f9cd47 100644 (file)
@@ -7,7 +7,7 @@
  * \author Jürgen Vigna
  * \author Lars Gullik Bjønnes
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
@@ -49,12 +49,12 @@ InsetCollapsable::InsetCollapsable(BufferParams const & bp, bool collapsed)
 #if 0
        autocollapse(false),
 #endif
-         oldWidth(0), in_update(false), first_after_edit(false)
+         in_update(false), first_after_edit(false)
 {
        inset.setOwner(this);
        inset.setAutoBreakRows(true);
-       inset.setDrawFrame(0, InsetText::ALWAYS);
-       inset.setFrameColor(0, LColor::collapsableframe);
+       inset.setDrawFrame(InsetText::ALWAYS);
+       inset.setFrameColor(LColor::collapsableframe);
        setInsetName("Collapsable");
 }
 
@@ -66,7 +66,7 @@ InsetCollapsable::InsetCollapsable(InsetCollapsable const & in)
 #if 0
          autocollapse(in.autocollapse),
 #endif
-         oldWidth(0), in_update(false), first_after_edit(false)
+         in_update(false), first_after_edit(false)
 {
        inset.init(&(in.inset));
        inset.setOwner(this);
@@ -84,14 +84,14 @@ bool InsetCollapsable::insertInset(BufferView * bv, InsetOld * in)
 }
 
 
-void InsetCollapsable::write(Buffer const * buf, ostream & os) const
+void InsetCollapsable::write(Buffer const & buf, ostream & os) const
 {
        os << "collapsed " << (collapsed_ ? "true" : "false") << "\n";
        inset.writeParagraphData(buf, os);
 }
 
 
-void InsetCollapsable::read(Buffer const * buf, LyXLex & lex)
+void InsetCollapsable::read(Buffer const & buf, LyXLex & lex)
 {
        if (lex.isOK()) {
                lex.next();
@@ -126,7 +126,7 @@ int InsetCollapsable::height_collapsed() const
 
 void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       //lyxerr << "InsetCollapsable::metrics:  width: " << mi.base.textwidth << "\n";
+       //lyxerr << "InsetCollapsable::metrics:  width: " << mi.base.textwidth << endl;
        dimension_collapsed(dim);
        if (!collapsed_) {
                Dimension insetdim;
@@ -229,53 +229,49 @@ void InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
 
        if (collapsed_ && cmd.button() != mouse_button::button3) {
                collapsed_ = false;
-               inset.setUpdateStatus(InsetText::FULL);
                bv->updateInset(this);
                bv->buffer()->markDirty();
                return;
        }
 
-       if (cmd.button() != mouse_button::button3 && hitButton(cmd))
-       {
+       if (cmd.button() != mouse_button::button3 && hitButton(cmd)) {
                if (collapsed_) {
                        collapsed_ = false;
-                       inset.setUpdateStatus(InsetText::FULL);
-                       bv->updateInset(this);
-                       bv->buffer()->markDirty();
                } else {
                        collapsed_ = true;
                        bv->unlockInset(this);
-                       bv->updateInset(this);
-                       bv->buffer()->markDirty();
                }
-       } else if (!collapsed_ && (cmd.y > button_dim.y2)) {
-               ret = (inset.localDispatch(adjustCommand(cmd)) == DISPATCHED);
+               bv->updateInset(this);
+               bv->buffer()->markDirty();
+               lyxerr << "InsetCollapsable::lfunMouseRelease\n";
+       } else if (!collapsed_ && cmd.y > button_dim.y2) {
+               ret = inset.localDispatch(adjustCommand(cmd)) == DISPATCHED;
        }
        if (cmd.button() == mouse_button::button3 && !ret)
                showInsetDialog(bv);
 }
 
 
-int InsetCollapsable::latex(Buffer const * buf, ostream & os,
+int InsetCollapsable::latex(Buffer const & buf, ostream & os,
                            LatexRunParams const & runparams) const
 {
        return inset.latex(buf, os, runparams);
 }
 
 
-int InsetCollapsable::ascii(Buffer const * buf, ostream & os, int ll) const
+int InsetCollapsable::ascii(Buffer const & buf, ostream & os, int ll) const
 {
        return inset.ascii(buf, os, ll);
 }
 
 
-int InsetCollapsable::linuxdoc(Buffer const * buf, ostream & os) const
+int InsetCollapsable::linuxdoc(Buffer const & buf, ostream & os) const
 {
        return inset.linuxdoc(buf, os);
 }
 
 
-int InsetCollapsable::docbook(Buffer const * buf, ostream & os, bool mixcont) const
+int InsetCollapsable::docbook(Buffer const & buf, ostream & os, bool mixcont) const
 {
        return inset.docbook(buf, os, mixcont);
 }
@@ -297,17 +293,16 @@ InsetOld::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
                        if (!cmd.argument.empty()) {
                                UpdatableInset::localDispatch(cmd);
                                if (collapsed_) {
-                                       lyxerr << "branch collapsed_\n";
+                                       lyxerr << "branch collapsed_" << endl;
                                        collapsed_ = false;
                                        if (bv->lockInset(this)) {
-                                               inset.setUpdateStatus(InsetText::FULL);
                                                bv->updateInset(this);
                                                bv->buffer()->markDirty();
                                                inset.localDispatch(cmd);
                                                first_after_edit = true;
                                        }
                                } else {
-                                       lyxerr << "branch not collapsed_\n";
+                                       lyxerr << "branch not collapsed_" << endl;
                                        if (bv->lockInset(this))
                                                inset.localDispatch(cmd);
                                }
@@ -389,14 +384,6 @@ bool InsetCollapsable::unlockInsetInInset(BufferView * bv, UpdatableInset * in,
 }
 
 
-bool InsetCollapsable::updateInsetInInset(BufferView * bv, InsetOld *in)
-{
-       if (in == this)
-               return true;
-       return inset.updateInsetInInset(bv, in);
-}
-
-
 int InsetCollapsable::insetInInsetY() const
 {
        return inset.insetInInsetY() - (top_baseline - inset.y());
@@ -458,13 +445,6 @@ void InsetCollapsable::deleteLyXText(BufferView * bv, bool recursive) const
 }
 
 
-void InsetCollapsable::resizeLyXText(BufferView * bv, bool force) const
-{
-       inset.resizeLyXText(bv, force);
-       oldWidth = width();
-}
-
-
 void InsetCollapsable::getLabelList(std::vector<string> & list) const
 {
        inset.getLabelList(list);
@@ -504,7 +484,8 @@ InsetOld * InsetCollapsable::getInsetFromID(int id_arg) const
 
 void InsetCollapsable::open(BufferView * bv)
 {
-       if (!collapsed_) return;
+       if (!collapsed_)
+               return;
 
        collapsed_ = false;
        bv->updateInset(this);
@@ -517,7 +498,7 @@ void InsetCollapsable::close(BufferView * bv) const
                return;
 
        collapsed_ = true;
-       bv->updateInset(const_cast<InsetCollapsable *>(this));
+       bv->updateInset(this);
 }