mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
mathed uglyfication
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8358 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
70d0ba9001
commit
69bee02a89
@ -58,7 +58,7 @@ extern BufferList bufferlist;
|
||||
|
||||
BufferView::BufferView(LyXView * owner, int xpos, int ypos,
|
||||
int width, int height)
|
||||
: pimpl_(new Pimpl(this, owner, xpos, ypos, width, height)),
|
||||
: pimpl_(new Pimpl(*this, owner, xpos, ypos, width, height)),
|
||||
x_target_(0)
|
||||
{}
|
||||
|
||||
|
@ -111,9 +111,9 @@ boost::signals::connection lostcon;
|
||||
} // anon namespace
|
||||
|
||||
|
||||
BufferView::Pimpl::Pimpl(BufferView * bv, LyXView * owner,
|
||||
BufferView::Pimpl::Pimpl(BufferView & bv, LyXView * owner,
|
||||
int xpos, int ypos, int width, int height)
|
||||
: bv_(bv), owner_(owner), buffer_(0), cursor_timeout(400),
|
||||
: bv_(&bv), owner_(owner), buffer_(0), cursor_timeout(400),
|
||||
using_xterm_cursor(false), cursor_(bv)
|
||||
{
|
||||
xsel_cache_.set = false;
|
||||
@ -160,13 +160,20 @@ void BufferView::Pimpl::connectBuffer(Buffer & buf)
|
||||
if (errorConnection_.connected())
|
||||
disconnectBuffer();
|
||||
|
||||
errorConnection_ = buf.error.connect(boost::bind(&BufferView::Pimpl::addError, this, _1));
|
||||
messageConnection_ = buf.message.connect(boost::bind(&LyXView::message, owner_, _1));
|
||||
busyConnection_ = buf.busy.connect(boost::bind(&LyXView::busy, owner_, _1));
|
||||
titleConnection_ = buf.updateTitles.connect(boost::bind(&LyXView::updateWindowTitle, owner_));
|
||||
timerConnection_ = buf.resetAutosaveTimers.connect(boost::bind(&LyXView::resetAutosaveTimer, owner_));
|
||||
readonlyConnection_ = buf.readonly.connect(boost::bind(&BufferView::Pimpl::showReadonly, this, _1));
|
||||
closingConnection_ = buf.closing.connect(boost::bind(&BufferView::Pimpl::buffer, this, (Buffer *)0));
|
||||
errorConnection_ =
|
||||
buf.error.connect(boost::bind(&BufferView::Pimpl::addError, this, _1));
|
||||
messageConnection_ =
|
||||
buf.message.connect(boost::bind(&LyXView::message, owner_, _1));
|
||||
busyConnection_ =
|
||||
buf.busy.connect(boost::bind(&LyXView::busy, owner_, _1));
|
||||
titleConnection_ =
|
||||
buf.updateTitles.connect(boost::bind(&LyXView::updateWindowTitle, owner_));
|
||||
timerConnection_ =
|
||||
buf.resetAutosaveTimers.connect(boost::bind(&LyXView::resetAutosaveTimer, owner_));
|
||||
readonlyConnection_ =
|
||||
buf.readonly.connect(boost::bind(&BufferView::Pimpl::showReadonly, this, _1));
|
||||
closingConnection_ =
|
||||
buf.closing.connect(boost::bind(&BufferView::Pimpl::buffer, this, (Buffer *)0));
|
||||
}
|
||||
|
||||
|
||||
@ -872,7 +879,7 @@ void BufferView::Pimpl::trackChanges()
|
||||
}
|
||||
|
||||
#warning remove me
|
||||
LCursor theTempCursor(0);
|
||||
LCursor theTempCursor;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -881,7 +888,7 @@ namespace {
|
||||
lyxerr << "insetFromCoords" << endl;
|
||||
LyXText * text = bv->text();
|
||||
InsetOld * inset = 0;
|
||||
theTempCursor = LCursor(bv);
|
||||
theTempCursor = LCursor(*bv);
|
||||
while (true) {
|
||||
InsetOld * const inset_hit = text->checkInsetHit(x, y);
|
||||
if (!inset_hit) {
|
||||
|
@ -45,7 +45,7 @@ class FuncRequest;
|
||||
///
|
||||
struct BufferView::Pimpl : public boost::signals::trackable {
|
||||
///
|
||||
Pimpl(BufferView * bv, LyXView * owner,
|
||||
Pimpl(BufferView & bv, LyXView * owner,
|
||||
int xpos, int ypos, int width, int height);
|
||||
///
|
||||
Painter & painter() const;
|
||||
@ -75,9 +75,7 @@ struct BufferView::Pimpl : public boost::signals::trackable {
|
||||
void updateScrollbar();
|
||||
///
|
||||
void scrollDocView(int value);
|
||||
/**
|
||||
* Wheel mouse scroll, move by multiples of text->defaultRowHeight().
|
||||
*/
|
||||
/// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
|
||||
void scroll(int lines);
|
||||
///
|
||||
typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
|
||||
|
@ -150,18 +150,14 @@ bool string2font(string const & data, LyXFont & font, bool & toggle)
|
||||
|
||||
bool changeDepthAllowed(BufferView * bv, LyXText * text, DEPTH_CHANGE type)
|
||||
{
|
||||
if (!bv->available() || !text)
|
||||
return false;
|
||||
|
||||
return text->changeDepthAllowed(type);
|
||||
return bv->available() && text && text->changeDepthAllowed(type);
|
||||
}
|
||||
|
||||
|
||||
void changeDepth(BufferView * bv, LyXText * text, DEPTH_CHANGE type)
|
||||
{
|
||||
if (!bv->available() || !text)
|
||||
return;
|
||||
text->changeDepth(type);
|
||||
if (bv->available() && text)
|
||||
text->changeDepth(type);
|
||||
}
|
||||
|
||||
|
||||
@ -172,7 +168,7 @@ string const currentState(BufferView * bv)
|
||||
return string();
|
||||
|
||||
if (mathcursor)
|
||||
return mathcursor->info();
|
||||
return mathcursor->info(*bv);
|
||||
|
||||
ostringstream state;
|
||||
|
||||
|
14
src/cursor.C
14
src/cursor.C
@ -41,8 +41,13 @@ std::ostream & operator<<(std::ostream & os, LCursor const & cur)
|
||||
}
|
||||
|
||||
|
||||
LCursor::LCursor(BufferView * bv)
|
||||
: cursor_(1), anchor_(1), bv_(bv)
|
||||
LCursor::LCursor()
|
||||
: cursor_(1), anchor_(1), bv_(0)
|
||||
{}
|
||||
|
||||
|
||||
LCursor::LCursor(BufferView & bv)
|
||||
: cursor_(1), anchor_(1), bv_(&bv)
|
||||
{}
|
||||
|
||||
|
||||
@ -153,7 +158,7 @@ LyXText * LCursor::innerText() const
|
||||
void LCursor::updatePos()
|
||||
{
|
||||
if (cursor_.size() > 1)
|
||||
cached_y_ = bv_->top_y() + innerInset()->y();
|
||||
cached_y_ = bv_->top_y() + cursor_.back().inset()->y();
|
||||
}
|
||||
|
||||
|
||||
@ -165,8 +170,9 @@ void LCursor::getDim(int & asc, int & desc) const
|
||||
Row const & row = *txt->cursorRow();
|
||||
asc = row.baseline();
|
||||
desc = row.height() - asc;
|
||||
} else
|
||||
} else {
|
||||
innerInset()->getCursorDim(asc, desc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
11
src/cursor.h
11
src/cursor.h
@ -38,8 +38,10 @@ public:
|
||||
/// type for cursor positions within a cell
|
||||
typedef CursorSlice::pos_type pos_type;
|
||||
|
||||
/// create 'empty' cursor. REMOVE ME
|
||||
LCursor();
|
||||
/// create 'empty' cursor
|
||||
explicit LCursor(BufferView * bv);
|
||||
explicit LCursor(BufferView & bv);
|
||||
/// dispatch from innermost inset upwards
|
||||
DispatchResult dispatch(FuncRequest const & cmd);
|
||||
///
|
||||
@ -73,6 +75,8 @@ public:
|
||||
void updatePos();
|
||||
/// sets anchor to cursor position
|
||||
void resetAnchor();
|
||||
/// sets anchor to cursor position
|
||||
BufferView & bv() const;
|
||||
///
|
||||
friend std::ostream & operator<<(std::ostream &, LCursor const &);
|
||||
public:
|
||||
@ -87,9 +91,4 @@ private:
|
||||
int cached_y_;
|
||||
};
|
||||
|
||||
|
||||
class LCursorS
|
||||
{
|
||||
};
|
||||
|
||||
#endif // LYXCURSOR_H
|
||||
|
@ -45,6 +45,18 @@ void CursorSlice::idx(idx_type idx)
|
||||
}
|
||||
|
||||
|
||||
size_t CursorSlice::nargs() const
|
||||
{
|
||||
return inset_->nargs();
|
||||
}
|
||||
|
||||
|
||||
size_t CursorSlice::ncols() const
|
||||
{
|
||||
return inset_->ncols();
|
||||
}
|
||||
|
||||
|
||||
CursorSlice::idx_type CursorSlice::idx() const
|
||||
{
|
||||
return idx_;
|
||||
|
@ -55,6 +55,8 @@ public:
|
||||
///
|
||||
explicit CursorSlice(InsetBase *);
|
||||
|
||||
/// the current inset
|
||||
InsetBase * inset() const { return inset_; }
|
||||
/// set the paragraph that contains this cursor
|
||||
void idx(idx_type idx);
|
||||
/// return the paragraph this cursor is in
|
||||
@ -75,6 +77,12 @@ public:
|
||||
pos_type & pos();
|
||||
/// return the last position within the paragraph
|
||||
pos_type lastpos() const;
|
||||
/// return the number of embedded cells
|
||||
size_t nargs() const;
|
||||
/// return the number of embedded cells
|
||||
size_t ncols() const;
|
||||
/// return the number of embedded cells
|
||||
size_t nrows() const;
|
||||
/// return the grid row of the current cell
|
||||
row_type row() const;
|
||||
/// return the grid row of the current cell
|
||||
|
@ -71,6 +71,17 @@ public:
|
||||
/// Appends \c list with all labels found within this inset.
|
||||
virtual void getLabelList(Buffer const &,
|
||||
std::vector<std::string> & /* list */) const {}
|
||||
/// last drawn position for 'important' insets
|
||||
virtual int x() const { return 0; }
|
||||
/// last drawn position for 'important' insets
|
||||
virtual int y() const { return 0; }
|
||||
|
||||
/// number of embedded cells
|
||||
virtual size_t nargs() const { return 0; }
|
||||
/// number of rows in gridlike structures
|
||||
virtual size_t nrows() const { return 0; }
|
||||
/// number of columns in gridlike structures
|
||||
virtual size_t ncols() const { return 0; }
|
||||
protected:
|
||||
// the real dispatcher
|
||||
virtual
|
||||
|
@ -401,9 +401,7 @@ ParIterator::ParIterator(PosIterator const & pos)
|
||||
|
||||
void ParIterator::lockPath(BufferView * bv) const
|
||||
{
|
||||
bv->fullCursor() = LCursor(bv);
|
||||
int last = size() - 1;
|
||||
#warning this seems to create just one entry for InsetTabulars
|
||||
for (int i = 0; i < last; ++i)
|
||||
bv->fullCursor() = LCursor(*bv);
|
||||
for (int i = 0, last = size() - 1; i < last; ++i)
|
||||
(*pimpl_->positions[i].it)->inset->edit(bv, true);
|
||||
}
|
||||
|
@ -50,8 +50,8 @@ using std::string;
|
||||
using std::abs;
|
||||
using std::endl;
|
||||
using std::max;
|
||||
|
||||
using std::istringstream;
|
||||
using std::ostringstream;
|
||||
|
||||
|
||||
MathCursor * mathcursor = 0;
|
||||
@ -117,11 +117,11 @@ void InsetFormulaBase::handleFont
|
||||
// changes...
|
||||
recordUndo(bv, Undo::ATOMIC);
|
||||
|
||||
if (mathcursor->inset()->name() == font)
|
||||
mathcursor->handleFont(font);
|
||||
if (bv.cursor().inset()->asMathInset()->name() == font)
|
||||
mathcursor->handleFont(bv, font);
|
||||
else {
|
||||
mathcursor->handleNest(createMathInset(font));
|
||||
mathcursor->insert(arg);
|
||||
mathcursor->handleNest(bv, createMathInset(font));
|
||||
mathcursor->insert(bv, arg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ void InsetFormulaBase::handleFont2(BufferView & bv, string const & arg)
|
||||
if (font.color() != LColor::inherit) {
|
||||
MathAtom at = createMathInset("color");
|
||||
asArray(lcolor.getGUIName(font.color()), at.nucleus()->cell(0));
|
||||
mathcursor->handleNest(at, 1);
|
||||
mathcursor->handleNest(bv, at, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,30 +151,30 @@ string const InsetFormulaBase::editMessage() const
|
||||
}
|
||||
|
||||
|
||||
void InsetFormulaBase::insetUnlock(BufferView * bv)
|
||||
void InsetFormulaBase::insetUnlock(BufferView & bv)
|
||||
{
|
||||
if (mathcursor) {
|
||||
if (mathcursor->inMacroMode())
|
||||
mathcursor->macroModeClose();
|
||||
releaseMathCursor(*bv);
|
||||
if (mathcursor->inMacroMode(bv))
|
||||
mathcursor->macroModeClose(bv);
|
||||
releaseMathCursor(bv);
|
||||
}
|
||||
if (bv->buffer())
|
||||
generatePreview(*bv->buffer());
|
||||
bv->update();
|
||||
if (bv.buffer())
|
||||
generatePreview(*bv.buffer());
|
||||
bv.update();
|
||||
}
|
||||
|
||||
|
||||
void InsetFormulaBase::getCursor(BufferView &, int & x, int & y) const
|
||||
void InsetFormulaBase::getCursor(BufferView & bv, int & x, int & y) const
|
||||
{
|
||||
mathcursor->getScreenPos(x, y);
|
||||
mathcursor->getScreenPos(bv, x, y);
|
||||
}
|
||||
|
||||
|
||||
void InsetFormulaBase::getCursorPos(int, int & x, int & y) const
|
||||
void InsetFormulaBase::getCursorPos(BufferView & bv, int & x, int & y) const
|
||||
{
|
||||
if (mathcursor) {
|
||||
mathcursor->getScreenPos(x, y);
|
||||
x = mathcursor->targetX();
|
||||
mathcursor->getScreenPos(bv, x, y);
|
||||
x = mathcursor->targetX(bv);
|
||||
x -= xo_;
|
||||
y -= yo_;
|
||||
lyxerr << "InsetFormulaBase::getCursorPos: " << x << ' ' << y << endl;
|
||||
@ -203,8 +203,8 @@ void InsetFormulaBase::toggleInsetSelection(BufferView * bv)
|
||||
}
|
||||
|
||||
|
||||
DispatchResult InsetFormulaBase::lfunMouseRelease(
|
||||
BufferView & bv, FuncRequest const & cmd)
|
||||
DispatchResult
|
||||
InsetFormulaBase::lfunMouseRelease(BufferView & bv, FuncRequest const & cmd)
|
||||
{
|
||||
if (!mathcursor)
|
||||
return DispatchResult(false);
|
||||
@ -213,7 +213,7 @@ DispatchResult InsetFormulaBase::lfunMouseRelease(
|
||||
|
||||
if (cmd.button() == mouse_button::button3) {
|
||||
// try to dispatch to enclosed insets first
|
||||
if (!mathcursor->dispatch(cmd).dispatched()) {
|
||||
if (!mathcursor->dispatch(bv, cmd).dispatched()) {
|
||||
// launch math panel for right mouse button
|
||||
lyxerr << "lfunMouseRelease: undispatched: " << cmd.button() << endl;
|
||||
bv.owner()->getDialogs().show("mathpanel");
|
||||
@ -224,17 +224,17 @@ DispatchResult InsetFormulaBase::lfunMouseRelease(
|
||||
if (cmd.button() == mouse_button::button2) {
|
||||
MathArray ar;
|
||||
asArray(bv.getClipboard(), ar);
|
||||
mathcursor->selClear();
|
||||
mathcursor->setScreenPos(cmd.x + xo_, cmd.y + yo_);
|
||||
mathcursor->insert(ar);
|
||||
mathcursor->selClear(bv);
|
||||
mathcursor->setScreenPos(bv, cmd.x + xo_, cmd.y + yo_);
|
||||
mathcursor->insert(bv, ar);
|
||||
bv.update();
|
||||
return DispatchResult(true, true);
|
||||
}
|
||||
|
||||
if (cmd.button() == mouse_button::button1) {
|
||||
// try to dispatch to enclosed insets first
|
||||
mathcursor->dispatch(cmd);
|
||||
bv.stuffClipboard(mathcursor->grabSelection());
|
||||
mathcursor->dispatch(bv, cmd);
|
||||
bv.stuffClipboard(mathcursor->grabSelection(bv));
|
||||
// try to set the cursor
|
||||
//delete mathcursor;
|
||||
//mathcursor = new MathCursor(bv, this, x == 0);
|
||||
@ -247,8 +247,8 @@ DispatchResult InsetFormulaBase::lfunMouseRelease(
|
||||
}
|
||||
|
||||
|
||||
DispatchResult InsetFormulaBase::lfunMousePress(
|
||||
BufferView & bv, FuncRequest const & cmd)
|
||||
DispatchResult
|
||||
InsetFormulaBase::lfunMousePress(BufferView & bv, FuncRequest const & cmd)
|
||||
{
|
||||
//lyxerr << "lfunMousePress: buttons: " << cmd.button() << endl;
|
||||
|
||||
@ -257,20 +257,20 @@ DispatchResult InsetFormulaBase::lfunMousePress(
|
||||
releaseMathCursor(bv);
|
||||
mathcursor = new MathCursor(&bv, this, cmd.x == 0);
|
||||
//metrics(bv);
|
||||
mathcursor->setScreenPos(cmd.x + xo_, cmd.y + yo_);
|
||||
mathcursor->setScreenPos(bv, cmd.x + xo_, cmd.y + yo_);
|
||||
}
|
||||
|
||||
if (cmd.button() == mouse_button::button3) {
|
||||
mathcursor->dispatch(cmd);
|
||||
mathcursor->dispatch(bv, cmd);
|
||||
return DispatchResult(true, true);
|
||||
}
|
||||
|
||||
if (cmd.button() == mouse_button::button1) {
|
||||
first_x = cmd.x;
|
||||
first_y = cmd.y;
|
||||
mathcursor->selClear();
|
||||
mathcursor->setScreenPos(cmd.x + xo_, cmd.y + yo_);
|
||||
mathcursor->dispatch(cmd);
|
||||
mathcursor->selClear(bv);
|
||||
mathcursor->setScreenPos(bv, cmd.x + xo_, cmd.y + yo_);
|
||||
mathcursor->dispatch(bv, cmd);
|
||||
return DispatchResult(true, true);
|
||||
}
|
||||
|
||||
@ -279,13 +279,13 @@ DispatchResult InsetFormulaBase::lfunMousePress(
|
||||
}
|
||||
|
||||
|
||||
DispatchResult InsetFormulaBase::lfunMouseMotion(
|
||||
BufferView & bv, FuncRequest const & cmd)
|
||||
DispatchResult
|
||||
InsetFormulaBase::lfunMouseMotion(BufferView & bv, FuncRequest const & cmd)
|
||||
{
|
||||
if (!mathcursor)
|
||||
return DispatchResult(true, true);
|
||||
|
||||
if (mathcursor->dispatch(FuncRequest(cmd)).dispatched())
|
||||
if (mathcursor->dispatch(bv, FuncRequest(cmd)).dispatched())
|
||||
return DispatchResult(true, true);
|
||||
|
||||
// only select with button 1
|
||||
@ -299,9 +299,9 @@ DispatchResult InsetFormulaBase::lfunMouseMotion(
|
||||
first_y = cmd.y;
|
||||
|
||||
if (!mathcursor->selection())
|
||||
mathcursor->selStart();
|
||||
mathcursor->selStart(bv);
|
||||
|
||||
mathcursor->setScreenPos(cmd.x + xo_, cmd.y + yo_);
|
||||
mathcursor->setScreenPos(bv, cmd.x + xo_, cmd.y + yo_);
|
||||
bv.update();
|
||||
return DispatchResult(true, true);
|
||||
}
|
||||
@ -325,7 +325,7 @@ void InsetFormulaBase::edit(BufferView * bv, int x, int y)
|
||||
releaseMathCursor(*bv);
|
||||
mathcursor = new MathCursor(bv, this, true);
|
||||
//metrics(bv);
|
||||
mathcursor->setScreenPos(x + xo_, y + yo_);
|
||||
mathcursor->setScreenPos(*bv, x + xo_, y + yo_);
|
||||
bv->fullCursor().push(this);
|
||||
// if that is removed, we won't get the magenta box when entering an
|
||||
// inset for the first time
|
||||
@ -365,13 +365,13 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
if (!mathcursor)
|
||||
return DispatchResult(false);
|
||||
|
||||
string argument = cmd.argument;
|
||||
DispatchResult result(true);
|
||||
string argument = cmd.argument;
|
||||
bool sel = false;
|
||||
bool was_macro = mathcursor->inMacroMode();
|
||||
bool was_macro = mathcursor->inMacroMode(bv);
|
||||
bool was_selection = mathcursor->selection();
|
||||
|
||||
mathcursor->normalize();
|
||||
mathcursor->normalize(bv);
|
||||
mathcursor->touch();
|
||||
|
||||
switch (cmd.action) {
|
||||
@ -389,13 +389,13 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
case LFUN_PASTESELECTION:
|
||||
case LFUN_MATH_LIMITS:
|
||||
recordUndo(bv, Undo::ATOMIC);
|
||||
mathcursor->dispatch(cmd);
|
||||
mathcursor->dispatch(bv, cmd);
|
||||
break;
|
||||
|
||||
case LFUN_RIGHTSEL:
|
||||
sel = true; // fall through...
|
||||
case LFUN_RIGHT:
|
||||
result = mathcursor->right(sel) ?
|
||||
result = mathcursor->right(bv, sel) ?
|
||||
DispatchResult(true, true) : DispatchResult(false, FINISHED_RIGHT);
|
||||
//lyxerr << "calling scroll 20" << endl;
|
||||
//scroll(&bv, 20);
|
||||
@ -406,27 +406,27 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
case LFUN_LEFTSEL:
|
||||
sel = true; // fall through
|
||||
case LFUN_LEFT:
|
||||
result = mathcursor->left(sel) ?
|
||||
result = mathcursor->left(bv, sel) ?
|
||||
DispatchResult(true, true) : DispatchResult(false, FINISHED);
|
||||
break;
|
||||
|
||||
case LFUN_UPSEL:
|
||||
sel = true; // fall through
|
||||
case LFUN_UP:
|
||||
result = mathcursor->up(sel) ?
|
||||
result = mathcursor->up(bv, sel) ?
|
||||
DispatchResult(true, true) : DispatchResult(false, FINISHED_UP);
|
||||
break;
|
||||
|
||||
case LFUN_DOWNSEL:
|
||||
sel = true; // fall through
|
||||
case LFUN_DOWN:
|
||||
result = mathcursor->down(sel) ?
|
||||
result = mathcursor->down(bv, sel) ?
|
||||
DispatchResult(true, true) : DispatchResult(false, FINISHED_DOWN);
|
||||
break;
|
||||
|
||||
case LFUN_WORDSEL:
|
||||
mathcursor->home(false);
|
||||
mathcursor->end(true);
|
||||
mathcursor->home(bv, false);
|
||||
mathcursor->end(bv, true);
|
||||
break;
|
||||
|
||||
case LFUN_UP_PARAGRAPHSEL:
|
||||
@ -441,7 +441,8 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
sel = true; // fall through
|
||||
case LFUN_HOME:
|
||||
case LFUN_WORDLEFT:
|
||||
result = mathcursor->home(sel) ? DispatchResult(true, true) : DispatchResult(true, FINISHED);
|
||||
result = mathcursor->home(bv, sel)
|
||||
? DispatchResult(true, true) : DispatchResult(true, FINISHED);
|
||||
break;
|
||||
|
||||
case LFUN_ENDSEL:
|
||||
@ -449,7 +450,8 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
sel = true; // fall through
|
||||
case LFUN_END:
|
||||
case LFUN_WORDRIGHT:
|
||||
result = mathcursor->end(sel) ? DispatchResult(true, true) : DispatchResult(false, FINISHED_RIGHT);
|
||||
result = mathcursor->end(bv, sel)
|
||||
? DispatchResult(true, true) : DispatchResult(false, FINISHED_RIGHT);
|
||||
break;
|
||||
|
||||
case LFUN_PRIORSEL:
|
||||
@ -467,17 +469,17 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_CELL_FORWARD:
|
||||
mathcursor->idxNext();
|
||||
mathcursor->idxNext(bv);
|
||||
break;
|
||||
|
||||
case LFUN_CELL_BACKWARD:
|
||||
mathcursor->idxPrev();
|
||||
mathcursor->idxPrev(bv);
|
||||
break;
|
||||
|
||||
case LFUN_DELETE_WORD_BACKWARD:
|
||||
case LFUN_BACKSPACE:
|
||||
recordUndo(bv, Undo::ATOMIC);
|
||||
if (!mathcursor->backspace()) {
|
||||
if (!mathcursor->backspace(bv)) {
|
||||
result = DispatchResult(true, FINISHED);
|
||||
remove_inset = true;
|
||||
}
|
||||
@ -486,7 +488,7 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
case LFUN_DELETE_WORD_FORWARD:
|
||||
case LFUN_DELETE:
|
||||
recordUndo(bv, Undo::ATOMIC);
|
||||
if (!mathcursor->erase()) {
|
||||
if (!mathcursor->erase(bv)) {
|
||||
result = DispatchResult(true, FINISHED);
|
||||
remove_inset = true;
|
||||
}
|
||||
@ -502,7 +504,7 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
int y = 0;
|
||||
istringstream is(cmd.argument.c_str());
|
||||
is >> x >> y;
|
||||
mathcursor->setScreenPos(x, y);
|
||||
mathcursor->setScreenPos(bv, x, y);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -511,19 +513,19 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
istringstream is(cmd.argument.c_str());
|
||||
is >> n;
|
||||
if (was_macro)
|
||||
mathcursor->macroModeClose();
|
||||
mathcursor->macroModeClose(bv);
|
||||
recordUndo(bv, Undo::ATOMIC);
|
||||
mathcursor->selPaste(n);
|
||||
mathcursor->selPaste(bv, n);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_CUT:
|
||||
recordUndo(bv, Undo::DELETE);
|
||||
mathcursor->selCut();
|
||||
mathcursor->selCut(bv);
|
||||
break;
|
||||
|
||||
case LFUN_COPY:
|
||||
mathcursor->selCopy();
|
||||
mathcursor->selCopy(bv);
|
||||
break;
|
||||
|
||||
|
||||
@ -534,7 +536,7 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
// do superscript if LyX handles
|
||||
// deadkeys
|
||||
recordUndo(bv, Undo::ATOMIC);
|
||||
mathcursor->script(true);
|
||||
mathcursor->script(bv, true);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -572,8 +574,8 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
case LFUN_DEFAULT: handleFont(bv, cmd.argument, "textnormal"); break;
|
||||
|
||||
case LFUN_MATH_MODE:
|
||||
if (mathcursor->currentMode() == MathInset::TEXT_MODE)
|
||||
mathcursor->niceInsert(MathAtom(new MathHullInset("simple")));
|
||||
if (mathcursor->currentMode(bv) == MathInset::TEXT_MODE)
|
||||
mathcursor->niceInsert(bv, MathAtom(new MathHullInset("simple")));
|
||||
else
|
||||
handleFont(bv, cmd.argument, "textrm");
|
||||
//bv.owner()->message(_("math text mode toggled"));
|
||||
@ -599,7 +601,7 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
m = max(1u, m);
|
||||
n = max(1u, n);
|
||||
v_align += 'c';
|
||||
mathcursor->niceInsert(
|
||||
mathcursor->niceInsert(bv,
|
||||
MathAtom(new MathArrayInset("array", m, n, v_align[0], h_align)));
|
||||
break;
|
||||
}
|
||||
@ -613,16 +615,15 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
ls = '(';
|
||||
if (rs.empty())
|
||||
rs = ')';
|
||||
|
||||
recordUndo(bv, Undo::ATOMIC);
|
||||
mathcursor->handleNest(MathAtom(new MathDelimInset(ls, rs)));
|
||||
mathcursor->handleNest(bv, MathAtom(new MathDelimInset(ls, rs)));
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_SPACE_INSERT:
|
||||
case LFUN_MATH_SPACE:
|
||||
recordUndo(bv, Undo::ATOMIC);
|
||||
mathcursor->insert(MathAtom(new MathSpaceInset(",")));
|
||||
mathcursor->insert(bv, MathAtom(new MathSpaceInset(",")));
|
||||
break;
|
||||
|
||||
case LFUN_UNDO:
|
||||
@ -637,7 +638,7 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
case LFUN_INSET_ERT:
|
||||
// interpret this as if a backslash was typed
|
||||
recordUndo(bv, Undo::ATOMIC);
|
||||
mathcursor->interpret('\\');
|
||||
mathcursor->interpret(bv, '\\');
|
||||
break;
|
||||
|
||||
case LFUN_BREAKPARAGRAPH:
|
||||
@ -651,7 +652,7 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
// math-insert only handles special math things like "matrix".
|
||||
case LFUN_INSERT_MATH:
|
||||
recordUndo(bv, Undo::ATOMIC);
|
||||
mathcursor->niceInsert(argument);
|
||||
mathcursor->niceInsert(bv, argument);
|
||||
break;
|
||||
|
||||
case -1:
|
||||
@ -659,21 +660,22 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
if (!argument.empty()) {
|
||||
recordUndo(bv, Undo::ATOMIC);
|
||||
if (argument.size() == 1)
|
||||
result = mathcursor->interpret(argument[0]) ? DispatchResult(true, true) : DispatchResult(false, FINISHED_RIGHT);
|
||||
result = mathcursor->interpret(bv, argument[0])
|
||||
? DispatchResult(true, true) : DispatchResult(false, FINISHED_RIGHT);
|
||||
else
|
||||
mathcursor->insert(argument);
|
||||
mathcursor->insert(bv, argument);
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_ESCAPE:
|
||||
if (mathcursor->selection())
|
||||
mathcursor->selClear();
|
||||
mathcursor->selClear(bv);
|
||||
else
|
||||
result = DispatchResult(false);
|
||||
break;
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
mathcursor->insetToggle();
|
||||
mathcursor->insetToggle(bv);
|
||||
break;
|
||||
|
||||
case LFUN_DIALOG_SHOW:
|
||||
@ -705,7 +707,7 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
} else {
|
||||
MathArray ar;
|
||||
if (createMathInset_fromDialogStr(cmd.argument, ar)) {
|
||||
mathcursor->insert(ar);
|
||||
mathcursor->insert(bv, ar);
|
||||
result = DispatchResult(true, true);
|
||||
} else {
|
||||
result = DispatchResult(false);
|
||||
@ -729,7 +731,7 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
if (result == DispatchResult(true, true))
|
||||
bv.update();
|
||||
|
||||
mathcursor->normalize();
|
||||
mathcursor->normalize(bv);
|
||||
mathcursor->touch();
|
||||
|
||||
BOOST_ASSERT(mathcursor);
|
||||
@ -739,7 +741,7 @@ InsetFormulaBase::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
|
||||
|
||||
if (result.dispatched()) {
|
||||
revealCodes(bv);
|
||||
bv.stuffClipboard(mathcursor->grabSelection());
|
||||
bv.stuffClipboard(mathcursor->grabSelection(bv));
|
||||
} else {
|
||||
releaseMathCursor(bv);
|
||||
if (remove_inset)
|
||||
@ -754,16 +756,15 @@ void InsetFormulaBase::revealCodes(BufferView & bv) const
|
||||
{
|
||||
if (!mathcursor)
|
||||
return;
|
||||
bv.owner()->message(mathcursor->info());
|
||||
|
||||
#if 0
|
||||
bv.owner()->message(mathcursor->info(bv));
|
||||
/*
|
||||
// write something to the minibuffer
|
||||
// translate to latex
|
||||
mathcursor->markInsert();
|
||||
mathcursor->markInsert(bv);
|
||||
ostringstream os;
|
||||
write(NULL, os);
|
||||
string str = os.str();
|
||||
mathcursor->markErase();
|
||||
mathcursor->markErase(bv);
|
||||
string::size_type pos = 0;
|
||||
string res;
|
||||
for (string::iterator it = str.begin(); it != str.end(); ++it) {
|
||||
@ -781,7 +782,7 @@ void InsetFormulaBase::revealCodes(BufferView & bv) const
|
||||
if (res.size() > 60)
|
||||
res = res.substr(0, 60);
|
||||
bv.owner()->message(res);
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -848,7 +849,7 @@ bool InsetFormulaBase::searchForward(BufferView * bv, string const & str,
|
||||
delete mathcursor;
|
||||
mathcursor = new MathCursor(bv, this, true);
|
||||
//metrics(bv);
|
||||
mathcursor->setSelection(it, ar.size());
|
||||
mathcursor->setSelection(*bv, it, ar.size());
|
||||
current = it;
|
||||
top.pos_ += ar.size();
|
||||
bv->update();
|
||||
@ -876,9 +877,9 @@ bool InsetFormulaBase::display() const
|
||||
}
|
||||
|
||||
|
||||
string InsetFormulaBase::selectionAsString() const
|
||||
string InsetFormulaBase::selectionAsString(BufferView & bv) const
|
||||
{
|
||||
return mathcursor ? mathcursor->grabSelection() : string();
|
||||
return mathcursor ? mathcursor->grabSelection(bv) : string();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
/// what appears in the minibuffer when opening
|
||||
virtual std::string const editMessage() const;
|
||||
///
|
||||
virtual void getCursorPos(int cell, int & x, int & y) const;
|
||||
virtual void getCursorPos(BufferView & bv, int & x, int & y) const;
|
||||
///
|
||||
virtual void getCursorDim(int &, int &) const;
|
||||
/// get the absolute document x,y of the cursor
|
||||
@ -54,7 +54,7 @@ public:
|
||||
///
|
||||
virtual void toggleInsetSelection(BufferView * bv);
|
||||
///
|
||||
virtual void insetUnlock(BufferView *);
|
||||
virtual void insetUnlock(BufferView & bv);
|
||||
|
||||
/// To allow transparent use of math editing functions
|
||||
//virtual void status(FuncRequest const &);
|
||||
@ -81,7 +81,7 @@ public:
|
||||
///
|
||||
bool display() const;
|
||||
// return the selection as std::string
|
||||
std::string selectionAsString() const;
|
||||
std::string selectionAsString(BufferView & bv) const;
|
||||
///
|
||||
void edit(BufferView * bv, bool);
|
||||
///
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -56,228 +56,209 @@ public:
|
||||
///
|
||||
~MathCursor();
|
||||
///
|
||||
void insert(MathAtom const &);
|
||||
void insert(BufferView & bv, MathAtom const &);
|
||||
///
|
||||
void insert(MathArray const &);
|
||||
void insert(BufferView & bv, MathArray const &);
|
||||
///
|
||||
void insert2(std::string const &);
|
||||
void insert2(BufferView & bv, std::string const &);
|
||||
///
|
||||
void paste(std::string const & data);
|
||||
void paste(BufferView & bv, std::string const & data);
|
||||
/// return false for empty math insets
|
||||
bool erase();
|
||||
bool erase(BufferView & bv);
|
||||
/// return false for empty math insets
|
||||
bool backspace();
|
||||
bool backspace(BufferView & bv);
|
||||
/// called for LFUN_HOME etc
|
||||
bool home(bool sel = false);
|
||||
bool home(BufferView & bv, bool sel = false);
|
||||
/// called for LFUN_END etc
|
||||
bool end(bool sel = false);
|
||||
bool end(BufferView & bv, bool sel = false);
|
||||
/// called for LFUN_RIGHT and LFUN_RIGHTSEL
|
||||
bool right(bool sel = false);
|
||||
bool right(BufferView & bv, bool sel = false);
|
||||
/// called for LFUN_LEFT etc
|
||||
bool left(bool sel = false);
|
||||
bool left(BufferView & bv, bool sel = false);
|
||||
/// called for LFUN_UP etc
|
||||
bool up(bool sel = false);
|
||||
bool up(BufferView & bv, bool sel = false);
|
||||
/// called for LFUN_DOWN etc
|
||||
bool down(bool sel = false);
|
||||
bool down(BufferView & bv, bool sel = false);
|
||||
/// Put the cursor in the first position
|
||||
void first();
|
||||
void first(BufferView & bv);
|
||||
/// Put the cursor in the last position
|
||||
void last();
|
||||
void last(BufferView & bv);
|
||||
/// move to next cell in current inset
|
||||
void idxNext();
|
||||
void idxNext(BufferView & bv);
|
||||
/// move to previous cell in current inset
|
||||
void idxPrev();
|
||||
void idxPrev(BufferView & bv);
|
||||
///
|
||||
void plainErase();
|
||||
void plainErase(BufferView & bv);
|
||||
///
|
||||
void plainInsert(MathAtom const &);
|
||||
void plainInsert(BufferView & bv, MathAtom const & at);
|
||||
///
|
||||
void niceInsert(MathAtom const &);
|
||||
void niceInsert(BufferView & bv, MathAtom const & at);
|
||||
///
|
||||
void niceInsert(std::string const &);
|
||||
void niceInsert(BufferView & bv, std::string const & str);
|
||||
|
||||
/// in pixels from top of screen
|
||||
void setScreenPos(int x, int y);
|
||||
void setScreenPos(BufferView & bv, int x, int y);
|
||||
/// in pixels from top of screen
|
||||
void getScreenPos(int & x, int & y) const;
|
||||
void getScreenPos(BufferView & bv, int & x, int & y) const;
|
||||
/// in pixels from left of screen
|
||||
int targetX() const;
|
||||
/// current inset
|
||||
MathInset * inset() const;
|
||||
int targetX(BufferView & bv) const;
|
||||
/// return the next enclosing grid inset and the cursor's index in it
|
||||
MathGridInset * enclosingGrid(idx_type & idx) const;
|
||||
MathGridInset * enclosingGrid(BufferView & bv, idx_type & idx) const;
|
||||
/// go up to enclosing grid
|
||||
void popToEnclosingGrid();
|
||||
void popToEnclosingGrid(BufferView & bv);
|
||||
/// go up to the hull inset
|
||||
void popToEnclosingHull();
|
||||
void popToEnclosingHull(BufferView & bv);
|
||||
/// go up to the hull inset
|
||||
void popToHere(MathInset const * p);
|
||||
void popToHere(BufferView & bv, MathInset const * p);
|
||||
/// adjust anchor position after deletions/insertions
|
||||
void adjust(pos_type from, difference_type diff);
|
||||
void adjust(BufferView & bv, pos_type from, difference_type diff);
|
||||
///
|
||||
InsetFormulaBase * formula() const;
|
||||
/// current offset in the current cell
|
||||
pos_type pos() const;
|
||||
/// current cell
|
||||
idx_type idx() const;
|
||||
/// size of current cell
|
||||
size_type size() const;
|
||||
///
|
||||
bool script(bool);
|
||||
bool script(BufferView & bv, bool);
|
||||
///
|
||||
bool interpret(char);
|
||||
bool interpret(BufferView & bv, char);
|
||||
/// interpret name a name of a macro
|
||||
void macroModeClose();
|
||||
void macroModeClose(BufferView & bv);
|
||||
/// are we currently typing the name of a macro?
|
||||
bool inMacroMode() const;
|
||||
bool inMacroMode(BufferView & bv) const;
|
||||
/// get access to the macro we are currently typing
|
||||
MathUnknownInset * activeMacro();
|
||||
MathUnknownInset * activeMacro(BufferView & bv);
|
||||
/// get access to the macro we are currently typing
|
||||
MathUnknownInset const * activeMacro() const;
|
||||
MathUnknownInset const * activeMacro(BufferView & bv) const;
|
||||
/// are we currently typing '#1' or '#2' or...?
|
||||
bool inMacroArgMode() const;
|
||||
bool inMacroArgMode(BufferView & bv) const;
|
||||
/// are we in math mode (1), text mode (-1) or unsure?
|
||||
MathInset::mode_type currentMode() const;
|
||||
MathInset::mode_type currentMode(BufferView & bv) const;
|
||||
|
||||
// Local selection methods
|
||||
///
|
||||
bool selection() const;
|
||||
///
|
||||
void selCopy();
|
||||
void selCopy(BufferView & bv);
|
||||
///
|
||||
void selCut();
|
||||
void selCut(BufferView & bv);
|
||||
///
|
||||
void selDel();
|
||||
void selDel(BufferView & bv);
|
||||
/// pastes n-th element of cut buffer
|
||||
void selPaste(size_t n);
|
||||
void selPaste(BufferView & bv, size_t n);
|
||||
///
|
||||
void selHandle(bool);
|
||||
void selHandle(BufferView & bv, bool);
|
||||
///
|
||||
void selStart();
|
||||
void selStart(BufferView & bv);
|
||||
///
|
||||
void selClear();
|
||||
void selClear(BufferView & bv);
|
||||
/// clears or deletes selection depending on lyxrc setting
|
||||
void selClearOrDel();
|
||||
void selClearOrDel(BufferView & bv);
|
||||
/// draws light-blue selection background
|
||||
void drawSelection(PainterInfo & pi) const;
|
||||
/// replace selected stuff with at, placing the former
|
||||
// selection in given cell of atom
|
||||
void handleNest(MathAtom const & at, int cell = 0);
|
||||
void handleNest(BufferView & bv, MathAtom const & at, int cell = 0);
|
||||
/// remove this as soon as LyXFunc::getStatus is "localized"
|
||||
std::string getLastCode() const { return "mathnormal"; }
|
||||
///
|
||||
bool isInside(MathInset const *) const;
|
||||
///
|
||||
char valign() const;
|
||||
char valign(BufferView & bv) const;
|
||||
///
|
||||
char halign() const;
|
||||
char halign(BufferView & bv) const;
|
||||
|
||||
/// make sure cursor position is valid
|
||||
void normalize();
|
||||
void normalize(BufferView & bv);
|
||||
/// mark current cursor trace for redraw
|
||||
void touch();
|
||||
///
|
||||
UpdatableInset * asHyperActiveInset() const;
|
||||
|
||||
/// enter a MathInset
|
||||
void push(MathAtom & par);
|
||||
void push(BufferView & bv, MathAtom & par);
|
||||
/// enter a MathInset from the front
|
||||
void pushLeft(MathAtom & par);
|
||||
void pushLeft(BufferView & bv, MathAtom & par);
|
||||
/// enter a MathInset from the back
|
||||
void pushRight(MathAtom & par);
|
||||
void pushRight(BufferView & bv, MathAtom & par);
|
||||
/// leave current MathInset to the left
|
||||
bool popLeft();
|
||||
bool popLeft(BufferView & bv);
|
||||
/// leave current MathInset to the left
|
||||
bool popRight();
|
||||
bool popRight(BufferView & bv);
|
||||
|
||||
///
|
||||
MathArray & array() const;
|
||||
bool hasPrevAtom(BufferView & bv) const;
|
||||
///
|
||||
bool hasPrevAtom() const;
|
||||
bool hasNextAtom(BufferView & bv) const;
|
||||
///
|
||||
bool hasNextAtom() const;
|
||||
MathAtom const & prevAtom(BufferView & bv) const;
|
||||
///
|
||||
MathAtom const & prevAtom() const;
|
||||
MathAtom & prevAtom(BufferView & bv);
|
||||
///
|
||||
MathAtom & prevAtom();
|
||||
MathAtom const & nextAtom(BufferView & bv) const;
|
||||
///
|
||||
MathAtom const & nextAtom() const;
|
||||
///
|
||||
MathAtom & nextAtom();
|
||||
MathAtom & nextAtom(BufferView & bv);
|
||||
|
||||
/// returns the selection
|
||||
void getSelection(CursorSlice &, CursorSlice &) const;
|
||||
void getSelection(BufferView & bv, CursorSlice &, CursorSlice &) const;
|
||||
/// returns the normalized anchor of the selection
|
||||
CursorSlice normalAnchor() const;
|
||||
CursorSlice normalAnchor(BufferView & bv) const;
|
||||
|
||||
/// reference to the last item of the path, i.e. "The Cursor"
|
||||
CursorSlice & cursor();
|
||||
/// reference to the last item of the path, i.e. "The Cursor"
|
||||
CursorSlice const & cursor() const;
|
||||
/// how deep are we nested?
|
||||
unsigned depth() const;
|
||||
unsigned depth(BufferView & bv) const;
|
||||
/// describe the situation
|
||||
std::string info() const;
|
||||
std::string info(BufferView & bv) const;
|
||||
/// dump selection information for debugging
|
||||
void seldump(char const * str) const;
|
||||
/// dump selection information for debugging
|
||||
void dump(char const * str) const;
|
||||
/// moves on
|
||||
void setSelection(CursorBase const & where, size_type n);
|
||||
void setSelection(BufferView & bv, CursorBase const & where, size_type n);
|
||||
/// grab selection marked by anchor and current cursor
|
||||
std::string grabSelection() const;
|
||||
std::string grabSelection(BufferView & bv) const;
|
||||
/// guess what
|
||||
std::string grabAndEraseSelection();
|
||||
std::string grabAndEraseSelection(BufferView & bv);
|
||||
///
|
||||
void insert(char c);
|
||||
void insert(BufferView & bv, char c);
|
||||
///
|
||||
void insert(std::string const & str);
|
||||
void insert(BufferView & bv, std::string const & str);
|
||||
/// lock/unlock inset
|
||||
void insetToggle();
|
||||
void insetToggle(BufferView & bv);
|
||||
|
||||
/// hack for reveal codes
|
||||
void markInsert();
|
||||
void markErase();
|
||||
void markInsert(BufferView & bv);
|
||||
void markErase(BufferView & bv);
|
||||
/// injects content of a cell into parent
|
||||
void pullArg();
|
||||
void pullArg(BufferView & bv);
|
||||
/// split font inset etc
|
||||
void handleFont(std::string const & font);
|
||||
void handleFont(BufferView & bv, std::string const & font);
|
||||
///
|
||||
DispatchResult
|
||||
dispatch(FuncRequest const & cmd);
|
||||
DispatchResult dispatch(BufferView & bv, FuncRequest const & cmd);
|
||||
private:
|
||||
/// moves cursor index one cell to the left
|
||||
bool idxLeft();
|
||||
bool idxLeft(BufferView & bv);
|
||||
/// moves cursor index one cell to the right
|
||||
bool idxRight();
|
||||
bool idxRight(BufferView & bv);
|
||||
/// moves cursor to end of last cell of current line
|
||||
bool idxLineLast();
|
||||
bool idxLineLast(BufferView & bv);
|
||||
/// moves cursor position one cell to the left
|
||||
bool posLeft();
|
||||
bool posLeft(BufferView & bv);
|
||||
/// moves cursor position one cell to the right
|
||||
bool posRight();
|
||||
bool posRight(BufferView & bv);
|
||||
/// moves position somehow up or down
|
||||
bool goUpDown(bool up);
|
||||
bool goUpDown(BufferView & bv, bool up);
|
||||
/// moves position closest to (x, y) in given box
|
||||
bool bruteFind(int x, int y, int xlow, int xhigh, int ylow, int yhigh);
|
||||
bool bruteFind(BufferView & bv,
|
||||
int x, int y, int xlow, int xhigh, int ylow, int yhigh);
|
||||
/// moves position closest to (x, y) in current cell
|
||||
void bruteFind2(int x, int y);
|
||||
void bruteFind2(BufferView & bv, int x, int y);
|
||||
/// are we in a nucleus of a script inset?
|
||||
bool inNucleus() const;
|
||||
bool inNucleus(BufferView & bv) const;
|
||||
|
||||
/// erase the selected part and re-sets the cursor
|
||||
void eraseSelection();
|
||||
void eraseSelection(BufferView & bv);
|
||||
|
||||
/// the name of the macro we are currently inputting
|
||||
std::string macroName() const;
|
||||
std::string macroName(BufferView & bv) const;
|
||||
/// where in the curent cell does the macro name start?
|
||||
difference_type macroNamePos() const;
|
||||
difference_type macroNamePos(BufferView & bv) const;
|
||||
/// can we enter the inset?
|
||||
bool openable(MathAtom const &, bool selection) const;
|
||||
/// write access to cursor cell position
|
||||
pos_type & pos();
|
||||
/// write access to cursor cell index
|
||||
idx_type & idx();
|
||||
|
||||
/// pointer to enclsing LyX inset
|
||||
InsetFormulaBase * formula_;
|
||||
@ -290,8 +271,6 @@ private:
|
||||
bool selection_;
|
||||
/// are we entering a macro name?
|
||||
bool macromode_;
|
||||
///
|
||||
BufferView * bv_;
|
||||
};
|
||||
|
||||
extern MathCursor * mathcursor;
|
||||
|
@ -403,6 +403,7 @@ void MathArray::notifyCursorLeaves()
|
||||
{
|
||||
// do not recurse!
|
||||
|
||||
/*
|
||||
// remove base-only "scripts"
|
||||
for (pos_type i = 0; i + 1 < size(); ++i) {
|
||||
MathScriptInset * p = operator[](i).nucleus()->asScriptInset();
|
||||
@ -424,5 +425,5 @@ void MathArray::notifyCursorLeaves()
|
||||
mathcursor->adjust(i, -1);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
@ -728,7 +728,7 @@ void MathHullInset::doExtern(FuncRequest const & func, BufferView & bv)
|
||||
size_type pos = cur.cell().find_last(eq);
|
||||
MathArray ar;
|
||||
if (mathcursor && mathcursor->selection()) {
|
||||
asArray(mathcursor->grabAndEraseSelection(), ar);
|
||||
asArray(mathcursor->grabAndEraseSelection(bv), ar);
|
||||
} else if (pos == cur.cell().size()) {
|
||||
ar = cur.cell();
|
||||
lyxerr << "use whole cell: " << ar << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user