+2001-07-25 André Pönitz <poenitz@gmx.net>
+
+ * formulabase.C: re-enable 'space enlargement' feature
+
2001-07-22 André Pönitz <poenitz@gmx.net>
* math_cursor.C: fix "pullArg" behaviour
}
break;
+ case LFUN_MATH_SPACE:
+ {
+ bv->lockedInsetStoreUndo(Undo::EDIT);
+ MathSpaceInset * p = mathcursor->prevSpaceInset();
+ if (p)
+ p->incSpace();
+ else
+ mathcursor->insert(new MathSpaceInset(1));
+ updateLocal(bv, true);
+ break;
+ }
+
case LFUN_MATH_DELIM:
{
bv->lockedInsetStoreUndo(Undo::INSERT);
}
+MathSpaceInset * MathCursor::prevSpaceInset() const
+{
+ normalize();
+ MathInset * p = array().prevInset(cursor().pos_);
+ return (p && p->isSpaceInset()) ? static_cast<MathSpaceInset *>(p) : 0;
+}
+
+
MathArray & MathCursor::array() const
{
static MathArray dummy;
class MathInset;
class MathFuncInset;
class MathUpDownInset;
+class MathSpaceInset;
class InsetFormulaBase;
class MathArray;
class MathXArray;
MathInset * prevInset() const;
///
MathUpDownInset * prevUpDownInset() const;
+ ///
+ MathSpaceInset * prevSpaceInset() const;
///
MathFuncInset * imacro;
virtual bool isUpDownInset() const { return false; }
/// Identifies BigopInsets
virtual bool isBigopInset() const { return false; }
+ /// Identifies SpaceInsets
+ virtual bool isSpaceInset() const { return false; }
///
virtual bool isActive() const { return nargs() > 0; }
xp[2] = x + width_ - 2; yp[2] = y;
xp[3] = x + width_ - 2; yp[3] = y - 3;
- pain.lines(xp, yp, 4, (space_) ? LColor::latex : LColor::math);
+ pain.lines(xp, yp, 4, space_ ? LColor::latex : LColor::math);
}
void MathSpaceInset::Write(std::ostream & os, bool /* fragile */) const
{
- if (space_ >= 0 && space_ < 6) {
+ if (space_ >= 0 && space_ < 6)
os << '\\' << latex_mathspace[space_] << ' ';
- }
}
void MathSpaceInset::Metrics(MathStyles st, int, int)
{
- size_ = st;
+ size_ = st;
width_ = space_ ? space_ * 2 : 2;
if (space_ > 3)
width_ *= 2;
if (space_ == 5)
width_ *= 2;
- width_ += 4;
- ascent_ = 4;
+ width_ += 4;
+ ascent_ = 4;
descent_ = 0;
}
-void MathSpaceInset::SetSpace(int sp)
-{
- space_ = sp;
- Metrics(size_);
-}
-
-
-int MathSpaceInset::GetSpace()
+void MathSpaceInset::incSpace()
{
- return space_;
+ space_ = (space_ + 1) % 6;
}
///
void Metrics(MathStyles st, int asc = 0, int des = 0);
///
- void SetSpace(int sp);
+ bool isSpaceInset() const { return true; }
///
- int GetSpace();
+ void incSpace();
private:
///
int space_;