mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
next step...
would somebody explain me how inset nesting works in the outside world? git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2941 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
557033beb6
commit
849400adb1
@ -319,6 +319,11 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
|
||||
if (!mathcursor)
|
||||
return UNDISPATCHED;
|
||||
|
||||
if (mathcursor->asHyperActiveInset()) {
|
||||
lyxerr << " uurr.... getting dificult now\n";
|
||||
return mathcursor->asHyperActiveInset()->localDispatch(bv, action, arg);
|
||||
}
|
||||
|
||||
RESULT result = DISPATCHED;
|
||||
bool sel = false;
|
||||
bool was_macro = mathcursor->inMacroMode();
|
||||
|
@ -101,6 +101,8 @@ public:
|
||||
int xo() const { return xo_; }
|
||||
///
|
||||
int yo() const { return yo_; }
|
||||
///
|
||||
BufferView * view() const { return view_; }
|
||||
private:
|
||||
/// unimplemented
|
||||
void operator=(const InsetFormulaBase &);
|
||||
|
@ -38,6 +38,12 @@ MathInset * MathBoxInset::clone() const
|
||||
}
|
||||
|
||||
|
||||
UpdatableInset * MathBoxInset::asHyperActiveInset() const
|
||||
{
|
||||
return text_;
|
||||
}
|
||||
|
||||
|
||||
void MathBoxInset::write(MathWriteInfo & os) const
|
||||
{
|
||||
os << "\\" << name_ << "{" << cell(0) << "}";
|
||||
@ -76,3 +82,10 @@ void MathBoxInset::draw(Painter & pain, int x, int y) const
|
||||
pain.rectangle(x, y - ascent(), xcell(0).width(), height(),
|
||||
LColor::mathframe);
|
||||
}
|
||||
|
||||
|
||||
void MathBoxInset::edit(BufferView * bv, int x, int y, unsigned int button)
|
||||
{
|
||||
if (text_)
|
||||
text_->edit(bv, x, y, button);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#endif
|
||||
|
||||
class InsetText;
|
||||
class UpdatableInset;
|
||||
class BufferView;
|
||||
class Buffer;
|
||||
class LyXFont;
|
||||
@ -38,6 +39,10 @@ public:
|
||||
MathBoxInset * asBoxInset() { return this; }
|
||||
///
|
||||
bool isHyperActive() const { return 1; }
|
||||
///
|
||||
void edit(BufferView * bv, int x, int y, unsigned int button);
|
||||
/// identifies hyperactive insets
|
||||
UpdatableInset * asHyperActiveInset() const;
|
||||
|
||||
private:
|
||||
/// unimplemented
|
||||
|
@ -232,6 +232,12 @@ void MathCursor::dump(char const *) const {}
|
||||
#endif
|
||||
|
||||
|
||||
UpdatableInset * MathCursor::asHyperActiveInset() const
|
||||
{
|
||||
return par()->asHyperActiveInset();
|
||||
}
|
||||
|
||||
|
||||
bool MathCursor::isInside(MathInset const * p) const
|
||||
{
|
||||
for (unsigned i = 0; i < Cursor_.size(); ++i)
|
||||
@ -332,6 +338,9 @@ bool MathCursor::right(bool sel)
|
||||
if (hasNextAtom() && openable(nextAtom(), sel)) {
|
||||
if (nextAtom()->isHyperActive()) {
|
||||
lyxerr << "entering hyperactive inset\n";
|
||||
int x, y;
|
||||
getPos(x, y);
|
||||
nextAtom()->edit(formula()->view(), x, y, 0);
|
||||
}
|
||||
pushLeft(nextAtom());
|
||||
return true;
|
||||
|
@ -197,6 +197,8 @@ public:
|
||||
|
||||
/// Make sure cursor position is valid
|
||||
void normalize() const;
|
||||
///
|
||||
UpdatableInset * asHyperActiveInset() const;
|
||||
|
||||
/// enter a MathInset
|
||||
void push(MathAtom & par);
|
||||
|
@ -50,6 +50,8 @@ class MathMacroTemplate;
|
||||
|
||||
class LaTeXFeatures;
|
||||
class Buffer;
|
||||
class BufferView;
|
||||
class UpdatableInset;
|
||||
|
||||
|
||||
struct MathWriteInfo {
|
||||
@ -217,6 +219,8 @@ public:
|
||||
virtual MathBoxInset * asBoxInset() { return 0; }
|
||||
/// identifies macro templates
|
||||
virtual MathMacroTemplate * asMacroTemplate() { return 0; }
|
||||
/// identifies hyperactive insets
|
||||
virtual UpdatableInset * asHyperActiveInset() const { return 0; }
|
||||
|
||||
/// identifies things that can get scripts
|
||||
virtual bool isScriptable() const { return false; }
|
||||
@ -238,6 +242,8 @@ public:
|
||||
|
||||
///
|
||||
virtual void dump() const;
|
||||
///
|
||||
virtual void edit(BufferView *, int, int, unsigned int) {}
|
||||
|
||||
///
|
||||
virtual void validate(LaTeXFeatures & features) const;
|
||||
|
Loading…
Reference in New Issue
Block a user