]> git.lyx.org Git - lyx.git/blobdiff - src/InsetList.C
Enable convertDefault.sh to run even if its executable bit is not set.
[lyx.git] / src / InsetList.C
index 6d98e035908da0666844fd25b6bb12696828bb4e..abe2d6577e1c91344d0b4703803b4cac4eebf6ec 100644 (file)
@@ -1,9 +1,23 @@
+/**
+ * \file InsetList.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ * \author Martin Vermeer
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
 #include <config.h>
 
 #include "InsetList.h"
+#include "BufferView.h"
+#include "buffer.h"
 #include "debug.h"
 
 #include "insets/updatableinset.h"
+#include "insets/insetbranch.h"
 
 #include <algorithm>
 
@@ -75,7 +89,7 @@ InsetList::insetIterator(pos_type pos)
 }
 
 
-void InsetList::insert(Inset * inset, lyx::pos_type pos)
+void InsetList::insert(InsetOld * inset, lyx::pos_type pos)
 {
        InsetTable search_elem(pos, 0);
        List::iterator end = list.end();
@@ -106,7 +120,7 @@ void InsetList::erase(pos_type pos)
 }
 
 
-Inset * InsetList::release(pos_type pos)
+InsetOld * InsetList::release(pos_type pos)
 {
        InsetTable search_elem(pos, 0);
        List::iterator end = list.end();
@@ -115,7 +129,7 @@ Inset * InsetList::release(pos_type pos)
                            end,
                            search_elem, MatchIt());
        if (it != end && it->pos == pos) {
-               Inset * tmp = it->inset;
+               InsetOld * tmp = it->inset;
                it->inset = 0;
                return tmp;
        }
@@ -123,7 +137,7 @@ Inset * InsetList::release(pos_type pos)
 }
 
 
-Inset * InsetList::get(pos_type pos) const
+InsetOld * InsetList::get(pos_type pos) const
 {
        InsetTable search_elem(pos, 0);
        List::const_iterator end = list.end();
@@ -178,16 +192,21 @@ void InsetList::deleteInsetsLyXText(BufferView * bv)
 }
 
 
-void InsetList::resizeInsetsLyXText(BufferView * bv)
+void InsetList::insetsOpenCloseBranch(BufferView * bv)
 {
+       BufferParams bp = bv->buffer()->params;
        List::iterator it = list.begin();
        List::iterator end = list.end();
        for (; it != end; ++it) {
-               if (it->inset) {
-                       if (it->inset->isTextInset()) {
-                               static_cast<UpdatableInset*>
-                                       (it->inset)->resizeLyXText(bv, true);
+               if (it->inset && it->inset->lyxCode() == InsetOld::BRANCH_CODE) {
+                       InsetBranch * inset = static_cast<InsetBranch *>(it->inset);
+                       if (bp.branchlist.selected(inset->params().branch)) {
+                               inset->open(bv);
+                       } else {
+                               inset->close(bv);
                        }
                }
        }
 }
+
+