mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
M-m <space> as substitute for the old C-<space> <space> 'enlarge space'
feature git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2339 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0563d2e80b
commit
cd8d582c67
@ -1,3 +1,7 @@
|
||||
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
|
||||
|
@ -617,6 +617,18 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
|
||||
}
|
||||
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);
|
||||
|
@ -1103,6 +1103,14 @@ MathUpDownInset * MathCursor::prevUpDownInset() const
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
@ -26,6 +26,7 @@
|
||||
class MathInset;
|
||||
class MathFuncInset;
|
||||
class MathUpDownInset;
|
||||
class MathSpaceInset;
|
||||
class InsetFormulaBase;
|
||||
class MathArray;
|
||||
class MathXArray;
|
||||
@ -259,6 +260,8 @@ public:
|
||||
MathInset * prevInset() const;
|
||||
///
|
||||
MathUpDownInset * prevUpDownInset() const;
|
||||
///
|
||||
MathSpaceInset * prevSpaceInset() const;
|
||||
|
||||
///
|
||||
MathFuncInset * imacro;
|
||||
|
@ -182,6 +182,8 @@ public:
|
||||
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; }
|
||||
|
||||
|
@ -34,15 +34,14 @@ void MathSpaceInset::draw(Painter & pain, int x, int y)
|
||||
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_] << ' ';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -54,26 +53,19 @@ void MathSpaceInset::WriteNormal(std::ostream & os) const
|
||||
|
||||
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)
|
||||
void MathSpaceInset::incSpace()
|
||||
{
|
||||
space_ = sp;
|
||||
Metrics(size_);
|
||||
}
|
||||
|
||||
|
||||
int MathSpaceInset::GetSpace()
|
||||
{
|
||||
return space_;
|
||||
space_ = (space_ + 1) % 6;
|
||||
}
|
||||
|
@ -25,9 +25,9 @@ public:
|
||||
///
|
||||
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_;
|
||||
|
Loading…
Reference in New Issue
Block a user