}
-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) {
lastcode_ = LM_TC_VAR;
MathInset * p = prevInset();
- if (openable(p, sel, false)) {
+ if (openable(p, sel)) {
pushRight(p);
return true;
}
lastcode_ = LM_TC_VAR;
MathInset * p = nextInset();
- if (openable(p, sel, false)) {
+ if (openable(p, sel)) {
pushLeft(p);
return true;
}
// << 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;
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_;
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;
}
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") {
}
+bool MathScriptInset::isActive() const
+{
+ return false;
+}
+
+
int MathScriptInset::limits() const
{
return limits_;
if (down())
xcell(1).draw(pain, x + dx1_, y + dy1_);
}
+
///
int limits() const;
///
- bool isActive() const { return false; }
+ bool isActive() const;
/// Identifies ScriptInsets
bool isScriptInset() const { return true; }
///