]> git.lyx.org Git - features.git/commitdiff
Add a unique id to math insets
authorGuillaume Munch <gm@lyx.org>
Tue, 13 Oct 2015 23:23:12 +0000 (00:23 +0100)
committerGuillaume Munch <gm@lyx.org>
Mon, 19 Oct 2015 05:55:17 +0000 (06:55 +0100)
The id is just the memory address.

The status bar now spits out the math inset uid information when in a math cell
in DEVEL_VERSION, like it already does when in a paragraph.

This is preliminary work for extending the cursor<->row tracking to math.

src/Cursor.cpp
src/TexRow.h
src/mathed/InsetMath.h

index fe90f98debbb12e1e0abdf05f68a71408c4d1aa7..828b0f56d270e54b768d3093df887b69c76a3d1a 100644 (file)
@@ -1179,8 +1179,6 @@ void Cursor::info(odocstream & os) const
                if (inset)
                        prevInset()->infoize2(os);
        }
-       // overwite old message
-       os << "                    ";
 }
 
 
@@ -2106,6 +2104,13 @@ docstring Cursor::currentState() const
        if (inMathed()) {
                odocstringstream os;
                info(os);
+#ifdef DEVEL_VERSION
+               InsetMath * math = inset().asInsetMath();
+               if (math)
+                       os << _(", Inset: ") << math->id();
+               os << _(", Cell: ") << idx();
+               os << _(", Position: ") << pos();
+#endif
                return os.str();
        }
 
index 254f446774dc5f6f99ae0d335c91cf48f6392d7f..9b21d45a64183941a6b1ec40981233c94c7721c2 100644 (file)
@@ -23,6 +23,8 @@ namespace lyx {
 class LyXErr;
 class DocIterator;
 
+typedef void const * uid_type;
+
 /// Represents the correspondence between paragraphs and the generated
 /// LaTeX file
 
index 917011fbb3aae411f1f2cad2d6b4908e92138650..bd72863c3ab5349e5b0a1cbad9744aab396d9c39 100644 (file)
@@ -17,6 +17,8 @@
 
 #include "insets/Inset.h"
 
+#include "TexRow.h"
+
 
 namespace lyx {
 
@@ -44,7 +46,7 @@ Abstract base class for all math objects.  A math insets is for use of the
 math editor only, it isn't a general LyX inset. It's used to represent all
 the math objects.
 
-Math insets do not know there parents, a cursor position or things
+Math insets do not know their parents, a cursor position or things
 like that. They are dumb objects that are contained in other math insets
 (InsetMathNests, in fact) thus forming a tree. The root of this tree is
 always a InsetMathHull, which provides an interface to the Outer World by
@@ -225,6 +227,8 @@ public:
        bool isInToc() const { return true; }
        ///
        InsetCode lyxCode() const { return MATH_CODE; }
+       ///
+       uid_type id() const { return this; }
 };
 
 ///