]> git.lyx.org Git - features.git/commitdiff
fix 'double =' glitch
authorAndré Pönitz <poenitz@gmx.net>
Wed, 7 Nov 2001 11:14:59 +0000 (11:14 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 7 Nov 2001 11:14:59 +0000 (11:14 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2972 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/formula.C
src/mathed/math_cursor.C
src/mathed/math_cursor.h
src/mathed/math_funcinset.C
src/mathed/math_funcinset.h

index 3eb2424bc231c59a9fa679b62c599eaee631f418..fcd4fec9924a53e4b887659a3467b6fa8e051d7e 100644 (file)
@@ -51,19 +51,6 @@ using std::vector;
 
 namespace {
 
-       void stripFromLastEqualSign(MathArray & ar)
-       {
-               // find position of last '=' in the array
-               MathArray::size_type pos = ar.size();
-               for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
-                       if ((*it)->getChar() == '=')
-                               pos = it - ar.begin();
-
-               // delete everything behind this position
-               ar.erase(pos, ar.size());
-       }
-
-
        string captureOutput(string const & cmd, string const & data)
        {
                string outfile = lyx::tempName(string(), "mathextern");
@@ -438,9 +425,8 @@ void InsetFormula::handleExtern(const string & arg)
                mathcursor->selGet(ar);
                lyxerr << "use selection: " << ar << "\n";
        } else {
-               mathcursor->end();
+               mathcursor->stripFromLastEqualSign();
                ar = mathcursor->cursor().cell();
-               stripFromLastEqualSign(ar);
                mathcursor->insert(MathAtom(new MathCharInset('=', LM_TC_VAR)));
                //lyxerr << "use whole cell: " << ar << "\n";
        }
index ac755a854357b3f21b0a53b87ec6657a3d97a00e..beeb60793eb66647ad01f5516497878b9f98c0f0 100644 (file)
@@ -1499,3 +1499,18 @@ MathCursorPos MathCursor::normalAnchor() const
 }
 
 
+void MathCursor::stripFromLastEqualSign()
+{
+       // find position of last '=' in the array
+       MathArray & ar = cursor().cell();
+       MathArray::const_iterator et = ar.end();
+       for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
+               if ((*it)->getChar() == '=')
+                       et = it;
+
+       // delete everything behind this position
+       ar.erase(et - ar.begin(), ar.size());
+       pos() = ar.size(); 
+}
+
+
index 23ba663556011673f395d4dd318bf882c7dccfe7..7b533306c66a6bb56f5a0245f21a4df21efe751d 100644 (file)
@@ -247,6 +247,8 @@ public:
        void seldump(char const * str) const;
        ///
        void dump(char const * str) const;
+       ///
+       void stripFromLastEqualSign();
 
        ///
        friend class Selection;
index f53f513eddefccadcd9376433bed7b4b6287aa66..383b82eed3ba4960755f70f4fc13b92412067972 100644 (file)
@@ -52,11 +52,17 @@ void MathFuncInset::writeNormal(std::ostream & os) const
 void MathFuncInset::metrics(MathMetricsInfo const & mi) const 
 {
        mi_ = mi;
-       mathed_string_dim(LM_TC_TEX, mi_, name_, ascent_, descent_, width_);
+       mathed_string_dim(LM_TC_TEXTRM, mi_, name_, ascent_, descent_, width_);
 }
 
 
 void MathFuncInset::draw(Painter & pain, int x, int y) const
 { 
-       drawStr(pain, LM_TC_TEX, mi_, x, y, name_);
+       drawStr(pain, LM_TC_TEXTRM, mi_, x, y, name_);
+}
+
+
+string MathFuncInset::octavize() const
+{
+       return name_;
 }
index 4ec3b0c32a58ca8bb89ee59144701be5e78e2124..6faca169d4f8bc739bbb76c475422da312b2b0cf 100644 (file)
@@ -4,7 +4,6 @@
 
 #include "math_diminset.h"
 #include "math_defs.h"
-#include "LString.h"
 
 #ifdef __GNUG__
 #pragma interface
@@ -31,6 +30,8 @@ public:
        string const & name() const;
        ///
        void setName(string const & n);
+       ///
+       string octavize() const;
 private:
        ///
        string name_;