{
BOOST_ASSERT(!empty());
//lyxerr << "Leaving inset to the left" << endl;
- inset().notifyCursorLeaves(idx());
+ inset().notifyCursorLeaves(*this);
if (depth() == 1)
return false;
pop();
{
BOOST_ASSERT(!empty());
//lyxerr << "Leaving inset to the right" << endl;
- inset().notifyCursorLeaves(idx());
+ inset().notifyCursorLeaves(*this);
if (depth() == 1)
return false;
pop();
#include "mathed/math_factory.h"
#include "mathed/math_gridinset.h"
#include "mathed/math_macroarg.h"
-#include "mathed/math_macrotemplate.h"
#include "mathed/math_mathmlstream.h"
#include "mathed/math_scriptinset.h"
#include "mathed/math_support.h"
void LCursor::markInsert()
{
- cell().insert(pos(), MathAtom(new MathCharInset(0)));
+ insert(char(0));
}
void LCursor::insert(string const & str)
{
- lyxerr << "LCursor::insert str '" << str << "'" << endl;
+ //lyxerr << "LCursor::insert str '" << str << "'" << endl;
for (string::const_iterator it = str.begin(); it != str.end(); ++it)
insert(*it);
}
BOOST_ASSERT(!empty());
if (inMathed()) {
selClearOrDel();
- plainInsert(MathAtom(new MathCharInset(c)));
+ insert(new MathCharInset(c));
} else {
text()->insertChar(*this, c);
}
macroModeClose();
selClearOrDel();
plainInsert(t);
+ lyxerr << "LCursor::insert MathAtom: cur:\n" << *this << endl;
}
if (pos() != 0 && prevAtom()->nargs() > 0) {
// let's require two backspaces for 'big stuff' and
// highlight on the first
+ resetAnchor();
selection() = true;
--pos();
} else {
return true;
}
+ // 'clever' UI hack: only erase large items if previously slected
if (pos() != lastpos() && inset().nargs() > 0) {
+ resetAnchor();
selection() = true;
++pos();
} else {
}
-bool LCursor::inMacroArgMode() const
-{
- return pos() > 0 && prevAtom()->getChar() == '#';
-}
-
-
-MathGridInset * LCursor::enclosingGrid(idx_type & idx) const
-{
- for (MathInset::difference_type i = depth() - 1; i >= 0; --i) {
- MathInset * m = operator[](i).inset().asMathInset();
- if (!m)
- return 0;
- MathGridInset * p = m->asGridInset();
- if (p) {
- idx = operator[](i).idx();
- return p;
- }
- }
- return 0;
-}
-
-
void LCursor::pullArg()
{
#ifdef WITH_WARNINGS
}
-char LCursor::valign()
-{
- idx_type idx;
- MathGridInset * p = enclosingGrid(idx);
- return p ? p->valign() : '\0';
-}
-
-
-char LCursor::halign()
-{
- idx_type idx;
- MathGridInset * p = enclosingGrid(idx);
- return p ? p->halign(idx % p->ncols()) : '\0';
-}
-
-
bool LCursor::goUpDown(bool up)
{
// Be warned: The 'logic' implemented in this function is highly
// these should go
class MathUnknownInset;
-class MathGridInset;
class Encoding;
void setScreenPos(int x, int y);
/// in pixels from left of screen
int targetX() const;
- /// return the next enclosing grid inset and the cursor's index in it
- MathGridInset * enclosingGrid(idx_type & idx) const;
/// adjust anchor position after deletions/insertions
void adjust(pos_type from, int diff);
/// current offset in the top cell
bool inMacroMode() const;
/// get access to the macro we are currently typing
MathUnknownInset * activeMacro();
- /// are we currently typing '#1' or '#2' or...?
- bool inMacroArgMode() const;
/// replace selected stuff with at, placing the former
// selection in given cell of atom
void handleNest(MathAtom const & at, int cell = 0);
- /// remove this as soon as LyXFunc::getStatus is "localized"
- //inline std::string getLastCode() { return "mathnormal"; }
///
bool isInside(InsetBase const *);
- ///
- char valign();
- ///
- char halign();
/// make sure cursor position is valid
void normalize();