From 18f613448fea94b3587d8df2a85c823b87e96d9d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 12 Dec 2001 13:11:28 +0000 Subject: [PATCH] re-enable automatic deletion of empty super/subscripts; remove now unneeded pos() argument from idxUp/idxDown functions; git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3197 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_cursor.C | 16 ++++++---------- src/mathed/math_fracbase.C | 8 ++------ src/mathed/math_fracbase.h | 4 ++-- src/mathed/math_gridinset.C | 4 ++-- src/mathed/math_gridinset.h | 4 ++-- src/mathed/math_inset.C | 4 ++-- src/mathed/math_inset.h | 4 ++-- src/mathed/math_macro.C | 6 ++++-- src/mathed/math_macro.h | 4 ++-- src/mathed/math_rootinset.C | 6 ++---- src/mathed/math_rootinset.h | 4 ++-- 11 files changed, 28 insertions(+), 36 deletions(-) diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index b6f5cc6f85..1593aabe12 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -156,11 +156,9 @@ bool MathCursor::popLeft() //cerr << "Leaving atom "; par()->write(cerr, false); cerr << " left\n"; if (Cursor_.size() <= 1) return false; - //if (nextInset()) - // nextInset()->removeEmptyScripts(); + if (par()->asScriptInset()) + par()->asScriptInset()->removeEmptyScripts(); Cursor_.pop_back(); - //if (nextAtom()) - // nextAtom()->removeEmptyScripts(); return true; } @@ -170,11 +168,9 @@ bool MathCursor::popRight() //cerr << "Leaving atom "; par()->write(cerr, false); cerr << " right\n"; if (Cursor_.size() <= 1) return false; - //if (nextInset()) - // nextInset()->removeEmptyScripts(); + if (par()->asScriptInset()) + par()->asScriptInset()->removeEmptyScripts(); Cursor_.pop_back(); - //if (nextInset()) - // nextInset()->removeEmptyScripts(); posRight(); return true; } @@ -1141,10 +1137,10 @@ bool MathCursor::goUpDown(bool up) while (1) { // we found a cell that think something "below" us. if (up) { - if (par()->idxUp(idx(), pos())) + if (par()->idxUp(idx())) break; } else { - if (par()->idxDown(idx(), pos())) + if (par()->idxDown(idx())) break; } diff --git a/src/mathed/math_fracbase.C b/src/mathed/math_fracbase.C index 01745ff548..b1137ac226 100644 --- a/src/mathed/math_fracbase.C +++ b/src/mathed/math_fracbase.C @@ -57,23 +57,19 @@ bool MathFracbaseInset::idxLastDown(idx_type & idx, pos_type & pos) const } -bool MathFracbaseInset::idxUp(MathInset::idx_type & idx, - MathInset::pos_type & pos) const +bool MathFracbaseInset::idxUp(idx_type & idx) const { if (idx == 0) return false; idx = 0; - pos = std::min(pos, cell(idx).size()); return true; } -bool MathFracbaseInset::idxDown(MathInset::idx_type & idx, - MathInset::pos_type & pos) const +bool MathFracbaseInset::idxDown(idx_type & idx) const { if (idx == 1) return false; idx = 1; - pos = std::min(pos, cell(idx).size()); return true; } diff --git a/src/mathed/math_fracbase.h b/src/mathed/math_fracbase.h index 035d4f7c4d..6fc8e5e1ea 100644 --- a/src/mathed/math_fracbase.h +++ b/src/mathed/math_fracbase.h @@ -13,9 +13,9 @@ public: /// MathFracbaseInset(); /// - bool idxUp(idx_type &, pos_type &) const; + bool idxUp(idx_type &) const; /// - bool idxDown(idx_type &, pos_type &) const; + bool idxDown(idx_type &) const; /// bool idxLeft(idx_type &, pos_type &) const; /// diff --git a/src/mathed/math_gridinset.C b/src/mathed/math_gridinset.C index 6d06cf4a6e..5ff51e3fd9 100644 --- a/src/mathed/math_gridinset.C +++ b/src/mathed/math_gridinset.C @@ -487,7 +487,7 @@ int MathGridInset::cellYOffset(idx_type idx) const } -bool MathGridInset::idxUp(idx_type & idx, pos_type & pos) const +bool MathGridInset::idxUp(idx_type & idx) const { if (idx < ncols()) return false; @@ -496,7 +496,7 @@ bool MathGridInset::idxUp(idx_type & idx, pos_type & pos) const } -bool MathGridInset::idxDown(idx_type & idx, pos_type & pos) const +bool MathGridInset::idxDown(idx_type & idx) const { if (idx >= ncols() * (nrows() - 1)) return false; diff --git a/src/mathed/math_gridinset.h b/src/mathed/math_gridinset.h index c1dfb8e907..d7dd6794ee 100644 --- a/src/mathed/math_gridinset.h +++ b/src/mathed/math_gridinset.h @@ -110,9 +110,9 @@ public: int cellYOffset(idx_type idx) const; /// - bool idxUp(idx_type &, pos_type &) const; + bool idxUp(idx_type &) const; /// - bool idxDown(idx_type &, pos_type &) const; + bool idxDown(idx_type &) const; /// bool idxLeft(idx_type &, pos_type &) const; /// diff --git a/src/mathed/math_inset.C b/src/mathed/math_inset.C index f13b3124b8..05cf176f12 100644 --- a/src/mathed/math_inset.C +++ b/src/mathed/math_inset.C @@ -106,13 +106,13 @@ bool MathInset::idxLeft(idx_type &, pos_type &) const } -bool MathInset::idxUp(idx_type &, pos_type &) const +bool MathInset::idxUp(idx_type &) const { return false; } -bool MathInset::idxDown(idx_type &, pos_type &) const +bool MathInset::idxDown(idx_type &) const { return false; } diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index f80316ecd1..17bb6706e4 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -114,9 +114,9 @@ public: virtual int height() const; /// Where should we go when we press the up cursor key? - virtual bool idxUp(idx_type & idx, pos_type & pos) const; + virtual bool idxUp(idx_type & idx) const; /// The down key - virtual bool idxDown(idx_type & idx, pos_type & pos) const; + virtual bool idxDown(idx_type & idx) const; /// The left key virtual bool idxLeft(idx_type & idx, pos_type & pos) const; /// The right key diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index 7ac130d265..7ab5dc3490 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -162,14 +162,16 @@ void MathMacro::dump() const } -bool MathMacro::idxUp(idx_type & idx, pos_type & pos) const +bool MathMacro::idxUp(idx_type & idx) const { + pos_type pos; return MathNestInset::idxLeft(idx, pos); } -bool MathMacro::idxDown(idx_type & idx, pos_type & pos) const +bool MathMacro::idxDown(idx_type & idx) const { + pos_type pos; return MathNestInset::idxRight(idx, pos); } diff --git a/src/mathed/math_macro.h b/src/mathed/math_macro.h index 4847d358a6..2c3fdcfada 100644 --- a/src/mathed/math_macro.h +++ b/src/mathed/math_macro.h @@ -51,9 +51,9 @@ public: void dump() const; /// - bool idxUp(idx_type &, pos_type &) const; + bool idxUp(idx_type &) const; /// - bool idxDown(idx_type &, pos_type &) const; + bool idxDown(idx_type &) const; /// bool idxLeft(idx_type &, pos_type &) const; /// diff --git a/src/mathed/math_rootinset.C b/src/mathed/math_rootinset.C index 69edc1cc9c..41162470f1 100644 --- a/src/mathed/math_rootinset.C +++ b/src/mathed/math_rootinset.C @@ -70,22 +70,20 @@ void MathRootInset::normalize(NormalStream & os) const } -bool MathRootInset::idxUp(idx_type & idx, pos_type & pos) const +bool MathRootInset::idxUp(idx_type & idx) const { if (idx == 0) return false; idx = 0; - pos = cell(0).size(); return true; } -bool MathRootInset::idxDown(idx_type & idx, pos_type & pos) const +bool MathRootInset::idxDown(idx_type & idx) const { if (idx == 1) return false; idx = 1; - pos = 0; return true; } diff --git a/src/mathed/math_rootinset.h b/src/mathed/math_rootinset.h index 0e3c81287e..e71b4fe23f 100644 --- a/src/mathed/math_rootinset.h +++ b/src/mathed/math_rootinset.h @@ -32,9 +32,9 @@ public: /// MathInset * clone() const; /// - bool idxUp(idx_type & idx, pos_type & pos) const; + bool idxUp(idx_type & idx) const; /// - bool idxDown(idx_type & idx, pos_type & pos) const; + bool idxDown(idx_type & idx) const; /// void metrics(MathMetricsInfo const & st) const; /// -- 2.39.2