mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
re-enable spaces and hyphens in labels;
small stuff; git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2559 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
613c9ec5ba
commit
aea21e8cac
@ -210,12 +210,31 @@ bool MathCursor::isInside(MathInset const * p) const
|
||||
}
|
||||
|
||||
|
||||
bool MathCursor::openable(MathInset * p, bool sel, bool useupdown) const
|
||||
bool MathCursor::openable(MathInset * p, bool sel) const
|
||||
{
|
||||
if (!p)
|
||||
return false;
|
||||
|
||||
if (!(p->isActive() || (useupdown && p->isScriptInset())))
|
||||
if (!p->isActive())
|
||||
return false;
|
||||
|
||||
if (sel) {
|
||||
// we can't move into anything new during selection
|
||||
if (Cursor_.size() == Anchor_.size())
|
||||
return false;
|
||||
if (p != Anchor_[Cursor_.size()].par_)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool MathCursor::positionable(MathInset * p, bool sel) const
|
||||
{
|
||||
if (!p)
|
||||
return false;
|
||||
|
||||
if (!p->nargs())
|
||||
return false;
|
||||
|
||||
if (sel) {
|
||||
@ -259,7 +278,7 @@ bool MathCursor::left(bool sel)
|
||||
lastcode_ = LM_TC_VAR;
|
||||
|
||||
MathInset * p = prevInset();
|
||||
if (openable(p, sel, false)) {
|
||||
if (openable(p, sel)) {
|
||||
pushRight(p);
|
||||
return true;
|
||||
}
|
||||
@ -280,7 +299,7 @@ bool MathCursor::right(bool sel)
|
||||
lastcode_ = LM_TC_VAR;
|
||||
|
||||
MathInset * p = nextInset();
|
||||
if (openable(p, sel, false)) {
|
||||
if (openable(p, sel)) {
|
||||
pushLeft(p);
|
||||
return true;
|
||||
}
|
||||
@ -338,9 +357,9 @@ void MathCursor::setPos(int x, int y)
|
||||
// << pos() << "\n";
|
||||
MathInset * n = nextInset();
|
||||
MathInset * p = prevInset();
|
||||
if (openable(n, selection_, true) && n->covers(x, y))
|
||||
if (positionable(n, selection_) && n->covers(x, y))
|
||||
pushLeft(n);
|
||||
else if (openable(p, selection_, true) && p->covers(x, y))
|
||||
else if (positionable(p, selection_) && p->covers(x, y))
|
||||
pushRight(p);
|
||||
else
|
||||
break;
|
||||
|
@ -209,8 +209,6 @@ public:
|
||||
void getSelection(MathCursorPos &, MathCursorPos &) const;
|
||||
/// returns the normalized anchor of the selection
|
||||
MathCursorPos normalAnchor() const;
|
||||
/// returns the normalized anchor of the selection
|
||||
bool openable(MathInset *, bool selection, bool useupdown) const;
|
||||
|
||||
/// path of positions the cursor had to go if it were leving each inset
|
||||
std::vector<MathCursorPos> Cursor_;
|
||||
@ -249,9 +247,13 @@ private:
|
||||
string macroName() const;
|
||||
///
|
||||
void insert(char, MathTextCodes t = LM_TC_MIN);
|
||||
///
|
||||
/// can we enter the inset?
|
||||
bool openable(MathInset *, bool selection) const;
|
||||
/// can the setPos routine enter that inset?
|
||||
bool positionable(MathInset *, bool selection) const;
|
||||
/// write access to cursor cell position
|
||||
int & pos();
|
||||
///
|
||||
/// write access to cursor cell index
|
||||
int & idx();
|
||||
/// x-offset of current cell relative to par xo
|
||||
int cellXOffset() const;
|
||||
|
@ -812,13 +812,13 @@ void Parser::parse_into(MathArray & array, unsigned flags)
|
||||
}
|
||||
|
||||
else if (t.cs() == "label") {
|
||||
MathArray ar;
|
||||
parse_into(ar, FLAG_ITEM);
|
||||
ostringstream os;
|
||||
ar.write(os, true);
|
||||
curr_label_ = os.str();
|
||||
//MathArray ar;
|
||||
//parse_into(ar, FLAG_ITEM);
|
||||
//ostringstream os;
|
||||
//ar.write(os, true);
|
||||
//curr_label_ = os.str();
|
||||
// was:
|
||||
//curr_label_ = getArg('{', '}');
|
||||
curr_label_ = getArg('{', '}');
|
||||
}
|
||||
|
||||
else if (t.cs() == "choose" || t.cs() == "over" || t.cs() == "atop") {
|
||||
|
@ -176,6 +176,12 @@ void MathScriptInset::idxDelete(int & idx, bool & popit, bool & deleteit)
|
||||
}
|
||||
|
||||
|
||||
bool MathScriptInset::isActive() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int MathScriptInset::limits() const
|
||||
{
|
||||
return limits_;
|
||||
@ -274,3 +280,4 @@ void MathScriptInset::draw(Painter & pain, int x, int y) const
|
||||
if (down())
|
||||
xcell(1).draw(pain, x + dx1_, y + dy1_);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
///
|
||||
int limits() const;
|
||||
///
|
||||
bool isActive() const { return false; }
|
||||
bool isActive() const;
|
||||
/// Identifies ScriptInsets
|
||||
bool isScriptInset() const { return true; }
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user