]> git.lyx.org Git - features.git/commitdiff
cursor cosmetics for \underset
authorAndré Pönitz <poenitz@gmx.net>
Fri, 22 Aug 2003 16:14:26 +0000 (16:14 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 22 Aug 2003 16:14:26 +0000 (16:14 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7596 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_nestinset.C
src/mathed/math_oversetinset.C
src/mathed/math_oversetinset.h
src/mathed/math_undersetinset.C
src/mathed/math_undersetinset.h

index 9411cc01ad27da63ad108fbf73d44d68990529a6..a1524bbfd3374fa046e11d3461163f2056f9bf87 100644 (file)
@@ -101,22 +101,22 @@ bool MathNestInset::idxLeft(idx_type & idx, pos_type & pos) const
 }
 
 
-bool MathNestInset::idxFirst(idx_type & i, pos_type & pos) const
+bool MathNestInset::idxFirst(idx_type & idx, pos_type & pos) const
 {
        if (nargs() == 0)
                return false;
-       i = 0;
+       idx = 0;
        pos = 0;
        return true;
 }
 
 
-bool MathNestInset::idxLast(idx_type & i, pos_type & pos) const
+bool MathNestInset::idxLast(idx_type & idx, pos_type & pos) const
 {
        if (nargs() == 0)
                return false;
-       i = nargs() - 1;
-       pos = cell(i).size();
+       idx = nargs() - 1;
+       pos = cell(idx).size();
        return true;
 }
 
index bfb42174020e01511823fb4c50292ee7ff11c25f..5356f28452b7ee67c3022144bed99bc820e779a8 100644 (file)
@@ -19,10 +19,6 @@ using std::max;
 using std::auto_ptr;
 
 
-MathOversetInset::MathOversetInset()
-{}
-
-
 auto_ptr<InsetBase> MathOversetInset::clone() const
 {
        return auto_ptr<InsetBase>(new MathOversetInset(*this));
@@ -51,6 +47,22 @@ void MathOversetInset::draw(PainterInfo & pi, int x, int y) const
 }
 
 
+bool MathOversetInset::idxFirst(idx_type & i, pos_type & pos) const
+{
+       i = 1;
+       pos = 0;
+       return true;
+}
+
+
+bool MathOversetInset::idxLast(idx_type & i, pos_type & pos) const
+{
+       i = 1;
+       pos = cell(i).size();
+       return true;
+}
+
+
 void MathOversetInset::write(WriteStream & os) const
 {
        os << "\\overset{" << cell(0) << "}{" << cell(1) << '}';
index 5327339cef33337438fe4d42284f196f679c69b2..a0dea822b6a6d03505f671f1eac03d28d97c9b4e 100644 (file)
 class MathOversetInset : public MathFracbaseInset {
 public:
        ///
-       MathOversetInset();
-       ///
-       virtual std::auto_ptr<InsetBase> clone() const;
+       std::auto_ptr<InsetBase> clone() const;
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
+       ///
+       bool idxFirst(idx_type & idx, pos_type & pos) const;
+       ///
+       bool idxLast(idx_type & idx, pos_type & pos) const;
 
        ///
        void write(WriteStream & os) const;
index a468cc6c30d7eae2dfc2fc6c5febcca2d6f039a9..d647c0d36709f3bf9099d2a8b5d85fb6c7eba488 100644 (file)
@@ -19,10 +19,6 @@ using std::max;
 using std::auto_ptr;
 
 
-MathUndersetInset::MathUndersetInset()
-{}
-
-
 auto_ptr<InsetBase> MathUndersetInset::clone() const
 {
        return auto_ptr<InsetBase>(new MathUndersetInset(*this));
@@ -51,6 +47,34 @@ void MathUndersetInset::draw(PainterInfo & pi, int x, int y) const
 }
 
 
+bool MathUndersetInset::idxFirst(idx_type & i, pos_type & pos) const
+{
+       i = 1;
+       pos = 0;
+       return true;
+}
+
+
+bool MathUndersetInset::idxLast(idx_type & i, pos_type & pos) const
+{
+       i = 1;
+       pos = cell(i).size();
+       return true;
+}
+
+
+bool MathUndersetInset::idxUpDown(idx_type & idx, pos_type & pos, bool up,
+       int targetx) const
+{
+       idx_type target = up; // up ? 1 : 0, since upper cell has idx 1
+       if (idx == target)
+               return false;
+       idx = target;
+       pos = cell(idx).x2pos(targetx);
+       return true;
+}
+
+
 void MathUndersetInset::write(WriteStream & os) const
 {
        os << "\\underset{" << cell(0) << "}{" << cell(1) << '}';
index c75a83496dd86a2191051253eb431385cf8a5b65..7886a2842320a6307682c9c98ec7b8198b0916f1 100644 (file)
 class MathUndersetInset : public MathFracbaseInset {
 public:
        ///
-       MathUndersetInset();
-       ///
-       virtual std::auto_ptr<InsetBase> clone() const;
+       std::auto_ptr<InsetBase> clone() const;
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
-
+       ///
+       bool idxFirst(idx_type & idx, pos_type & pos) const;
+       ///
+       bool idxLast(idx_type & idx, pos_type & pos) const;
+       ///
+       bool idxUpDown(idx_type & idx, pos_type & pos, bool up, int targetx) const;
        ///
        void write(WriteStream & os) const;
        ///