From 430ba660805c755582c9cfa37966349d19e27b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 22 Aug 2003 16:14:26 +0000 Subject: [PATCH] cursor cosmetics for \underset git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7596 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_nestinset.C | 10 +++++----- src/mathed/math_oversetinset.C | 20 ++++++++++++++++---- src/mathed/math_oversetinset.h | 8 +++++--- src/mathed/math_undersetinset.C | 32 ++++++++++++++++++++++++++++---- src/mathed/math_undersetinset.h | 11 +++++++---- 5 files changed, 61 insertions(+), 20 deletions(-) diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index 9411cc01ad..a1524bbfd3 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -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; } diff --git a/src/mathed/math_oversetinset.C b/src/mathed/math_oversetinset.C index bfb4217402..5356f28452 100644 --- a/src/mathed/math_oversetinset.C +++ b/src/mathed/math_oversetinset.C @@ -19,10 +19,6 @@ using std::max; using std::auto_ptr; -MathOversetInset::MathOversetInset() -{} - - auto_ptr MathOversetInset::clone() const { return auto_ptr(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) << '}'; diff --git a/src/mathed/math_oversetinset.h b/src/mathed/math_oversetinset.h index 5327339cef..a0dea822b6 100644 --- a/src/mathed/math_oversetinset.h +++ b/src/mathed/math_oversetinset.h @@ -19,13 +19,15 @@ class MathOversetInset : public MathFracbaseInset { public: /// - MathOversetInset(); - /// - virtual std::auto_ptr clone() const; + std::auto_ptr 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; diff --git a/src/mathed/math_undersetinset.C b/src/mathed/math_undersetinset.C index a468cc6c30..d647c0d367 100644 --- a/src/mathed/math_undersetinset.C +++ b/src/mathed/math_undersetinset.C @@ -19,10 +19,6 @@ using std::max; using std::auto_ptr; -MathUndersetInset::MathUndersetInset() -{} - - auto_ptr MathUndersetInset::clone() const { return auto_ptr(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) << '}'; diff --git a/src/mathed/math_undersetinset.h b/src/mathed/math_undersetinset.h index c75a83496d..7886a28423 100644 --- a/src/mathed/math_undersetinset.h +++ b/src/mathed/math_undersetinset.h @@ -19,14 +19,17 @@ class MathUndersetInset : public MathFracbaseInset { public: /// - MathUndersetInset(); - /// - virtual std::auto_ptr clone() const; + std::auto_ptr 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; ///