]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_scriptinset.C
fix cursor positioning using the mouse
[lyx.git] / src / mathed / math_scriptinset.C
index 09e52cccf0e6fbdda0c4543f7526eb30eb316dfe..019c045e37ed8a7129bf452deedce02c237961f8 100644 (file)
@@ -1,43 +1,44 @@
+#include <config.h>
+#include "debug.h"
+#include "support/LOstream.h"
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
 #include "math_scriptinset.h"
-#include "support/LOstream.h"
 
 
-MathScriptInset::MathScriptInset(bool up, bool down)
-       : MathUpDownInset(up, down)
+MathScriptInset::MathScriptInset(bool up)
+       : MathNestInset(1), up_(up)
 {}
 
 
 MathInset * MathScriptInset::clone() const
-{   
+{
        return new MathScriptInset(*this);
 }
 
 
-void MathScriptInset::WriteNormal(std::ostream & os) const
+void MathScriptInset::write(std::ostream & os, bool fragile) const
+{
+       cell(0).write(os, fragile);
+}
+
+
+void MathScriptInset::metrics(MathStyles st) const
 {
-       if (up()) {
-               os << "[superscript ";
-               cell(0).WriteNormal(os);
-               os << "] ";
-       }
-       if (down()) {
-               os << "[subscript ";
-               cell(1).WriteNormal(os);
-               os << "] ";
-       }
+       size_    = st;
+       xcell(0).metrics(st);   
+       width_   = xcell(0).width();
+       ascent_  = xcell(0).ascent();
+       descent_ = xcell(0).descent();
 }
 
 
-void MathScriptInset::idxDelete(int & idx, bool & popit, bool & deleteit)
+void MathScriptInset::draw(Painter & pain, int x, int y) const
 {
-       if (idx == 0) 
-               up(false);
-       else
-               down(false);
-       popit = true;
-       deleteit = !(up() || down());
+       xo(x);
+       yo(y);
+       xcell(0).draw(pain, x, y);
 }