]> git.lyx.org Git - lyx.git/blobdiff - src/dociterator.C
Extend the navigate menu to child docs
[lyx.git] / src / dociterator.C
index 257cf4eabe97ab279033b8c815148f31396b921d..4d93aa7a0177228266c36fc14b7445103b7ba74f 100644 (file)
 #include "lyxrow.h"
 #include "paragraph.h"
 
-#include "mathed/math_data.h"
-#include "mathed/math_inset.h"
+#include "mathed/MathData.h"
+#include "mathed/InsetMath.h"
+
 #include "insets/insettabular.h"
 
 #include <boost/assert.hpp>
 #include <boost/current_function.hpp>
 
+
+namespace lyx {
+
 using std::endl;
 
 
@@ -180,13 +184,13 @@ Row const & DocIterator::textRow() const
 }
 
 
-DocIterator::pit_type DocIterator::lastpit() const
+pit_type DocIterator::lastpit() const
 {
        return inMathed() ? 0 : text()->paragraphs().size() - 1;
 }
 
 
-DocIterator::pos_type DocIterator::lastpos() const
+pos_type DocIterator::lastpos() const
 {
        return inMathed() ? cell().size() : paragraph().size();
 }
@@ -410,10 +414,6 @@ void DocIterator::forwardPar()
 {
        forwardPos();
 
-#if 0
-       DocIterator cmp(*this);
-#endif
-
        while (!empty() && (!inTexted() || pos() != 0)) {
                if (inTexted()) {
                        pos_type const lastp = lastpos();
@@ -424,12 +424,6 @@ void DocIterator::forwardPar()
                }
                forwardPos();
        }
-
-#if 0
-       while (!cmp.empty() && (!cmp.inTexted() || cmp.pos() != 0))
-               cmp.forwardPos();
-       BOOST_ASSERT(cmp == *this);
-#endif
 }
 
 
@@ -444,8 +438,19 @@ void DocIterator::forwardChar()
 void DocIterator::forwardInset()
 {
        forwardPos();
-       while (!empty() && (pos() == lastpos() || nextInset() == 0))
+
+       while (!empty() && !nextInset()) {
+               if (inTexted()) {
+                       pos_type const lastp = lastpos();
+                       Paragraph const & par = paragraph();
+                       pos_type & pos = top().pos();
+                       while (pos < lastp && !par.isInset(pos))
+                               ++pos;
+                       if (pos < lastp)
+                               break;
+               }
                forwardPos();
+       }
 }
 
 
@@ -591,3 +596,6 @@ bool operator==(StableDocIterator const & dit1, StableDocIterator const & dit2)
 {
        return dit1.data_ == dit2.data_;
 }
+
+
+} // namespace lyx