Plus some beautification in LyXFunc::getStatus (<cato>which should be
split into insetspecific parts...</cato>)
See attached.
Andre'
Index: cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v
retrieving revision 1.51
diff -u -p -r1.51 cursor.C
--- cursor.C 6 Feb 2004 11:50:13 -0000 1.51
+++ cursor.C 6 Feb 2004 15:51:28 -0000
@@ -251,8 +251,11 @@ void LCursor::updatePos()
void LCursor::getDim(int & asc, int & des) const
{
BOOST_ASSERT(!cursor_.empty());
if (inMathed()) {
+ BOOST_ASSERT(inset());
+ BOOST_ASSERT(inset()->asMathInset());
//inset()->asMathInset()->getCursorDim(asc, des);
asc = 10;
des = 10;
@@ -269,10 +272,14 @@ void LCursor::getPos(int & x, int & y) c
BOOST_ASSERT(!cursor_.empty());
x = 0;
y = 0;
- if (cursor_.size() <= 1) {
+ if (cursor_.size() == 1) {
x = bv_->text()->cursorX(cursor_.front());
y = bv_->text()->cursorY(cursor_.front());
} else {
+ BOOST_ASSERT(inset());
inset()->getCursorPos(cursor_.back(), x, y);
// getCursorPos gives _screen_ coordinates. We need to add
// top_y to get document coordinates. This is hidden in cached_y_.
@@ -467,14 +474,14 @@ LyXText * LCursor::text() const
Paragraph & LCursor::paragraph()
{
- BOOST_ASSERT(!inMathed());
+ BOOST_ASSERT(inTexted());
return current_ ? current().paragraph() : *bv_->text()->getPar(par());
}
Paragraph const & LCursor::paragraph() const
{
- BOOST_ASSERT(!inMathed());
+ BOOST_ASSERT(inTexted());
return current_ ? current().paragraph() : *bv_->text()->getPar(par());
}
@@ -1205,9 +1212,11 @@ int LCursor::targetX() const
MathHullInset * LCursor::formula() const
{
- for (int i = cursor_.size() - 1; i >= 1; --i)
- if (cursor_[i].inset()->lyxCode() == InsetBase::MATH_CODE)
- return static_cast<MathHullInset *>(cursor_[i].inset());
+ for (int i = cursor_.size() - 1; i >= 1; --i) {
+ MathInset * inset = cursor_[i].inset()->asMathInset();
+ if (inset && inset->asHullInset())
+ return static_cast<MathHullInset *>(inset);
+ }
return 0;
}
@@ -1791,6 +1800,12 @@ void LCursor::releaseMathCursor()
bool LCursor::inMathed() const
{
return formula();
+}
+
+
+bool LCursor::inTexted() const
+{
+ return !formula();
}
Index: cursor.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.h,v
retrieving revision 1.30
diff -u -p -r1.30 cursor.h
--- cursor.h 4 Feb 2004 12:24:01 -0000 1.30
+++ cursor.h 6 Feb 2004 15:51:28 -0000
@@ -416,6 +416,8 @@ public:
void releaseMathCursor();
/// are we in mathed?
bool inMathed() const;
+ /// are we in texted?
+ bool inTexted() const;
/// display a message
void message(std::string const & msg) const;
Index: lyxfunc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.569
diff -u -p -r1.569 lyxfunc.C
--- lyxfunc.C 6 Feb 2004 09:34:02 -0000 1.569
+++ lyxfunc.C 6 Feb 2004 15:51:28 -0000
@@ -261,6 +261,7 @@ FuncStatus LyXFunc::getStatus(FuncReques
{
FuncStatus flag;
Buffer * buf = owner->buffer();
+ LCursor & cur = view()->cursor();
if (ev.action == LFUN_NOACTION) {
setStatusMessage(N_("Nothing to do"));
@@ -310,9 +311,8 @@ FuncStatus LyXFunc::getStatus(FuncReques
}
}
- UpdatableInset * tli = view()->cursor().inset()
- ? view()->cursor().inset()->asUpdatableInset() : 0;
- InsetTabular * tab = view()->cursor().innerInsetTabular();
+ UpdatableInset * tli = cur.inset() ? cur.inset()->asUpdatableInset() : 0;
+ InsetTabular * tab = cur.innerInsetTabular();
// I would really like to avoid having this switch and rather try to
// encode this in the function itself.
@@ -333,7 +333,7 @@ FuncStatus LyXFunc::getStatus(FuncReques
if (tab && tab->hasSelection())
disable = false;
else
- disable = !view()->cursor().inMathed() &&
!view()->cursor().selection();
+ disable = cur.inTexted() && !cur.selection();
break;
case LFUN_RUNCHKTEX:
@@ -345,7 +345,7 @@ FuncStatus LyXFunc::getStatus(FuncReques
break;
case LFUN_LAYOUT_TABULAR:
- disable = !view()->cursor().innerInsetTabular();
+ disable = !cur.innerInsetTabular();
break;
case LFUN_DEPTH_MIN:
@@ -357,19 +357,19 @@ FuncStatus LyXFunc::getStatus(FuncReques
break;
case LFUN_LAYOUT:
- case LFUN_LAYOUT_PARAGRAPH: {
- InsetOld * inset = view()->getLyXText()->cursorPar()->inInset();
- disable = inset && inset->forceDefaultParagraphs(inset);
+ case LFUN_LAYOUT_PARAGRAPH:
+ disable = cur.inset()
+ && cur.inset()->forceDefaultParagraphs(cur.inset());
break;
- }
case LFUN_INSET_OPTARG:
- disable = (view()->getLyXText()->cursorPar()->layout()->optionalargs
== 0);
+ disable = cur.inMathed()
+ || cur.paragraph().layout()->optionalargs == 0;
break;
case LFUN_TABULAR_FEATURE:
#if 0
- if (view()->cursor().inMathed()) {
+ if (cur.inMathed()) {
// FIXME: check temporarily disabled
// valign code
char align = mathcursor::valign();
@@ -411,7 +411,7 @@ FuncStatus LyXFunc::getStatus(FuncReques
if (tli) {
FuncStatus ret;
//ret.disabled(true);
- InsetTabular * tab = view()->cursor().innerInsetTabular();
+ InsetTabular * tab = cur.innerInsetTabular();
if (tab) {
ret = tab->getStatus(ev.argument);
flag |= ret;
@@ -460,9 +460,9 @@ FuncStatus LyXFunc::getStatus(FuncReques
case LFUN_INSET_SETTINGS: {
disable = true;
- UpdatableInset * inset = view()->cursor().inset()
- ? view()->cursor().inset()->asUpdatableInset() : 0;
-
+ if (!cur.inset())
+ break;
+ UpdatableInset * inset = cur.inset()->asUpdatableInset();
if (!inset)
break;
@@ -501,7 +501,7 @@ FuncStatus LyXFunc::getStatus(FuncReques
}
case LFUN_MATH_MUTATE:
- if (view()->cursor().inMathed())
+ if (cur.inMathed())
//flag.setOnOff(mathcursor::formula()->hullType() ==
ev.argument);
flag.setOnOff(false);
else
@@ -515,7 +515,7 @@ FuncStatus LyXFunc::getStatus(FuncReques
case LFUN_MATH_NONUMBER:
case LFUN_MATH_NUMBER:
case LFUN_MATH_EXTERN:
- disable = !view()->cursor().inMathed();
+ disable = cur.inTexted();
break;
case LFUN_DIALOG_SHOW: {
@@ -533,7 +533,7 @@ FuncStatus LyXFunc::getStatus(FuncReques
disable = !Exporter::IsExportable(*buf, "dvi") ||
lyxrc.print_command == "none";
} else if (name == "character") {
- InsetBase * inset = view()->cursor().inset();
+ InsetBase * inset = cur.inset();
disable = inset && inset->lyxCode() == InsetOld::ERT_CODE;
} else if (name == "vclog") {
disable = !buf->lyxvc().inUse();
@@ -674,11 +674,11 @@ FuncStatus LyXFunc::getStatus(FuncReques
break;
case LFUN_SPACE_INSERT:
// slight hack: we know this is allowed in math mode
- if (!view()->cursor().inMathed())
+ if (cur.inTexted())
code = InsetOld::SPACE_CODE;
break;
case LFUN_INSET_DIALOG_SHOW: {
- InsetBase * inset = view()->cursor().nextInset();
+ InsetBase * inset = cur.nextInset();
disable = !inset;
if (inset) {
code = inset->lyxCode();
@@ -709,7 +709,8 @@ FuncStatus LyXFunc::getStatus(FuncReques
flag.setOnOff(buf->isReadonly());
break;
case LFUN_APPENDIX:
-
flag.setOnOff(view()->getLyXText()->cursorPar()->params().startOfAppendix());
+ flag.setOnOff(cur.inTexted()
+ && cur.paragraph().params().startOfAppendix());
break;
case LFUN_SWITCHBUFFER:
// toggle on the current buffer, but do not toggle off
@@ -726,8 +727,8 @@ FuncStatus LyXFunc::getStatus(FuncReques
#ifdef LOCK
// the font related toggles
- if (!view()->cursor().inMathed()) {
- LyXFont const & font = view()->getLyXText()->real_current_font;
+ if (cur.inTexted()) {
+ LyXFont const & font = cur.text()->real_current_font;
switch (ev.action) {
case LFUN_EMPH:
flag.setOnOff(font.emph() == LyXFont::ON);
Index: frontends/LyXView.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/LyXView.C,v
retrieving revision 1.42
diff -u -p -r1.42 LyXView.C
--- frontends/LyXView.C 26 Jan 2004 10:13:11 -0000 1.42
+++ frontends/LyXView.C 6 Feb 2004 15:51:29 -0000
@@ -147,8 +147,11 @@ void LyXView::updateLayoutChoice()
current_layout =
buffer()->params().getLyXTextClass().defaultLayoutName();
}
+ if (bufferview_->cursor().inMathed())
+ return;
+
string const & layout =
- bufferview_->getLyXText()->cursorPar()->layout()->name();
+ bufferview_->cursor().paragraph().layout()->name();
if (layout != current_layout) {
toolbar_->setLayout(layout);
Index: insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.576
diff -u -p -r1.576 insettext.C
--- insets/insettext.C 6 Feb 2004 13:59:26 -0000 1.576
+++ insets/insettext.C 6 Feb 2004 15:51:29 -0000
@@ -307,7 +307,7 @@ void InsetText::edit(LCursor & cur, int
text_.edit(cur, x, y);
//sanitizeEmptyText(cur.bv());
//updateLocal(cur);
- //cur.bv().updateParagraphDialog();
+ //dispatch(cur, FuncRequest(LFUN_PARAGRAPH_UPDATE));
}
Index: insets/insettext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.h,v
retrieving revision 1.246
diff -u -p -r1.246 insettext.h
--- insets/insettext.h 6 Feb 2004 13:18:49 -0000 1.246
+++ insets/insettext.h 6 Feb 2004 15:51:29 -0000
@@ -146,9 +146,9 @@ public:
void addPreview(lyx::graphics::PreviewLoader &) const;
///
- void edit(LCursor & cur, bool);
+ void edit(LCursor & cur, bool left);
///
- void edit(LCursor & cur, int, int);
+ void edit(LCursor & cur, int x, int y);
///
int numParagraphs() const { return 1; }
Index: mathed/math_gridinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_gridinset.C,v
retrieving revision 1.139
diff -u -p -r1.139 math_gridinset.C
--- mathed/math_gridinset.C 3 Feb 2004 08:56:27 -0000 1.139
+++ mathed/math_gridinset.C 6 Feb 2004 15:51:29 -0000
@@ -1046,15 +1046,17 @@ void MathGridInset::splitCell(LCursor &
DispatchResult
MathGridInset::priv_dispatch(LCursor & cur, FuncRequest const & cmd)
{
- lyxerr << "*** MathGridInset: request: " << cmd << endl;
+ //lyxerr << "*** MathGridInset: request: " << cmd << endl;
switch (cmd.action) {
+/*
case LFUN_MOUSE_RELEASE:
//if (cmd.button() == mouse_button::button3) {
// GridInsetMailer(*this).showDialog();
// return DispatchResult(true, true);
//}
return DispatchResult(false);
+*/
case LFUN_INSET_DIALOG_UPDATE:
GridInsetMailer(*this).updateDialog(&cur.bv());
@@ -1070,8 +1072,8 @@ MathGridInset::priv_dispatch(LCursor & c
//}
if (nrows() > 1)
delRow(cur.row());
- if (cur.idx() >= nargs())
- cur.idx() = nargs() - 1;
+ if (cur.idx() > cur.lastidx())
+ cur.idx() = cur.lastidx();
if (cur.pos() > cur.lastpos())
cur.pos() = cur.lastpos();
return DispatchResult(true, FINISHED);
Index: mathed/math_hullinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_hullinset.C,v
retrieving revision 1.115
diff -u -p -r1.115 math_hullinset.C
--- mathed/math_hullinset.C 4 Feb 2004 11:23:25 -0000 1.115
+++ mathed/math_hullinset.C 6 Feb 2004 15:51:29 -0000
@@ -907,17 +907,6 @@ string MathHullInset::fileInsetLabel() c
#include "support/lyxlib.h"
-
-namespace {
-
-// local global
-int first_x;
-int first_y;
-
-} // namespace anon
-
-
-
int MathHullInset::ylow() const
{
return yo_ - dim_.asc;
@@ -1019,131 +1008,6 @@ void MathHullInset::getCursorDim(int & a
desc = 2;
//math_font_max_dim(font_, asc, des);
}
-
-
-DispatchResult
-MathHullInset::lfunMouseRelease(LCursor & cur, FuncRequest const & cmd)
-{
- if (!cur.inMathed())
- return DispatchResult(false);
- cur.bv().update();
- //lyxerr << "lfunMouseRelease: buttons: " << cmd.button() << endl;
-
- if (cmd.button() == mouse_button::button3) {
- // try to dispatch to enclosed insets first
- if (!cur.dispatch(cmd).dispatched()) {
- // launch math panel for right mouse button
- lyxerr << "lfunMouseRelease: undispatched: " << cmd.button()
<< endl;
- cur.bv().owner()->getDialogs().show("mathpanel");
- }
- return DispatchResult(true, true);
- }
-
- if (cmd.button() == mouse_button::button2) {
- MathArray ar;
- asArray(cur.bv().getClipboard(), ar);
- cur.selClear();
- cur.setScreenPos(cmd.x, cmd.y);
- cur.insert(ar);
- cur.bv().update();
- return DispatchResult(true, true);
- }
-
- if (cmd.button() == mouse_button::button1) {
- // try to dispatch to enclosed insets first
- cur.dispatch(cmd);
- cur.bv().stuffClipboard(cur.grabSelection());
- return DispatchResult(true, true);
- }
-
- return DispatchResult(false);
-}
-
-
-DispatchResult
-MathHullInset::lfunMousePress(LCursor & cur, FuncRequest const & cmd)
-{
- //lyxerr << "lfunMousePress: buttons: " << cmd.button() << endl;
-
- if (!cur.inMathed() || cur.formula() != this) {
- lyxerr[Debug::MATHED] << "re-create cursor" << endl;
- cur.releaseMathCursor();
- cur.idx() = 0;
- //metrics(bv);
- cur.setScreenPos(cmd.x + xo_, cmd.y + yo_);
- }
-
- if (cmd.button() == mouse_button::button3) {
- cur.dispatch(cmd);
- return DispatchResult(true, true);
- }
-
- if (cmd.button() == mouse_button::button1) {
- first_x = cmd.x;
- first_y = cmd.y;
- cur.selClear();
- cur.setScreenPos(cmd.x + xo_, cmd.y + yo_);
- cur.dispatch(cmd);
- return DispatchResult(true, true);
- }
-
- cur.bv().update();
- return DispatchResult(true, true);
-}
-
-
-DispatchResult
-MathHullInset::lfunMouseMotion(LCursor & cur, FuncRequest const & cmd)
-{
- if (!cur.inMathed())
- return DispatchResult(true, true);
-
- if (cur.dispatch(FuncRequest(cmd)).dispatched())
- return DispatchResult(true, true);
-
- // only select with button 1
- if (cmd.button() != mouse_button::button1)
- return DispatchResult(true, true);
-
- if (abs(cmd.x - first_x) < 2 && abs(cmd.y - first_y) < 2)
- return DispatchResult(true, true);
-
- first_x = cmd.x;
- first_y = cmd.y;
-
- if (!cur.selection())
- cur.selBegin();
-
- cur.setScreenPos(cmd.x + xo_, cmd.y + yo_);
- cur.bv().update();
- return DispatchResult(true, true);
-}
-
-
-void MathHullInset::edit(LCursor & cur, bool left)
-{
- lyxerr << "Called FormulaBase::edit" << endl;
- cur.push(this);
- cur.idx() = left ? 0 : cur.lastidx();
- cur.pos() = left ? 0 : cur.lastpos();
- cur.resetAnchor();
-}
-
-
-/*
-void MathHullInset::edit(LCursor & cur, int x, int y)
-{
- lyxerr << "Called MathHullInset::edit with '" << x << ' ' << y << "'" << endl;
- cur.push(this);
- //cur.idx() = left ? 0 : cur.lastidx();
- cur.idx() = 0;
- cur.pos() = 0;
- cur.setScreenPos(x + xo_, y + yo_);
- // if that is removed, we won't get the magenta box when entering an
- // inset for the first time
- cur.bv().update();
-}
-*/
void MathHullInset::revealCodes(LCursor & cur) const
Index: mathed/math_hullinset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_hullinset.h,v
retrieving revision 1.48
diff -u -p -r1.48 math_hullinset.h
--- mathed/math_hullinset.h 30 Jan 2004 11:41:10 -0000 1.48
+++ mathed/math_hullinset.h 6 Feb 2004 15:51:29 -0000
@@ -191,21 +191,12 @@ public:
///
bool display() const;
///
- void edit(LCursor & cur, bool left);
- ///
Code lyxCode() const;
private:
/// common base for handling accents
void handleAccent(BufferView & bv, std::string const & arg,
std::string const & name);
-
- /// lfun handler
- DispatchResult lfunMousePress(LCursor &, FuncRequest const &);
- ///
- DispatchResult lfunMouseRelease(LCursor &, FuncRequest const &);
- ///
- DispatchResult lfunMouseMotion(LCursor &, FuncRequest const &);
protected:
Index: mathed/math_nestinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v
retrieving revision 1.89
diff -u -p -r1.89 math_nestinset.C
--- mathed/math_nestinset.C 4 Feb 2004 12:24:01 -0000 1.89
+++ mathed/math_nestinset.C 6 Feb 2004 15:51:29 -0000
@@ -46,6 +46,17 @@ using std::string;
using std::istringstream;
+namespace {
+
+// local global
+int first_x;
+int first_y;
+
+} // namespace anon
+
+
+
+
MathNestInset::MathNestInset(idx_type nargs)
: cells_(nargs), lock_(false)
{}
@@ -377,9 +388,17 @@ MathNestInset::priv_dispatch(LCursor & c
return dispatch(cur, FuncRequest(LFUN_PASTE,
cur.bv().getClipboard()));
case LFUN_MOUSE_PRESS:
- if (cmd.button() == mouse_button::button2)
- return priv_dispatch(cur, FuncRequest(LFUN_PASTESELECTION));
- return DispatchResult(false);
+ //lyxerr << "Mouse single press" << endl;
+ return lfunMousePress(cur, cmd);
+ case LFUN_MOUSE_MOTION:
+ //lyxerr << "Mouse motion" << endl;
+ return lfunMouseMotion(cur, cmd);
+ case LFUN_MOUSE_RELEASE:
+ //lyxerr << "Mouse single release" << endl;
+ return lfunMouseRelease(cur, cmd);
+ case LFUN_MOUSE_DOUBLE:
+ //lyxerr << "Mouse double" << endl;
+ return dispatch(cur, FuncRequest(LFUN_WORDSEL));
case LFUN_RIGHTSEL:
cur.selection() = true; // fall through...
@@ -507,18 +526,6 @@ MathNestInset::priv_dispatch(LCursor & c
bool remove_inset = false;
switch (cmd.action) {
- case LFUN_MOUSE_PRESS:
- //lyxerr << "Mouse single press" << endl;
- return lfunMousePress(cur, cmd);
- case LFUN_MOUSE_MOTION:
- //lyxerr << "Mouse motion" << endl;
- return lfunMouseMotion(cur, cmd);
- case LFUN_MOUSE_RELEASE:
- //lyxerr << "Mouse single release" << endl;
- return lfunMouseRelease(cur, cmd);
- case LFUN_MOUSE_DOUBLE:
- //lyxerr << "Mouse double" << endl;
- return dispatch(cur, FuncRequest(LFUN_WORDSEL));
default:
break;
}
@@ -794,10 +801,20 @@ MathNestInset::priv_dispatch(LCursor & c
}
-void MathNestInset::edit(LCursor & cur, int x, int y)
+void MathNestInset::edit(LCursor & cur, bool left)
{
- lyxerr << "Called MathNestInset::edit with '" << x << ' ' << y << "'" << endl;
+ lyxerr << "XXX Called MathNestInset::edit" << endl;
cur.push(this);
+ cur.idx() = left ? 0 : cur.lastidx();
+ cur.pos() = left ? 0 : cur.lastpos();
+ cur.resetAnchor();
+}
+
+
+void MathNestInset::edit(LCursor & cur, int x, int y)
+{
+ lyxerr << "XXX Called MathNestInset::edit with '"
+ << x << ' ' << y << "'" << endl;
int idx_min = 0;
int dist_min = 1000000;
for (idx_type i = 0; i < nargs(); ++i) {
@@ -818,4 +835,83 @@ void MathNestInset::edit(LCursor & cur,
if (ar[i]->covers(x, y))
ar[i].nucleus()->edit(cur, x, y);
}
+}
+
+
+DispatchResult
+MathNestInset::lfunMouseRelease(LCursor & cur, FuncRequest const & cmd)
+{
+ //lyxerr << "lfunMouseRelease: buttons: " << cmd.button() << endl;
+
+ if (cmd.button() == mouse_button::button1) {
+ // try to dispatch to enclosed insets first
+ //cur.bv().stuffClipboard(cur.grabSelection());
+ return DispatchResult(true, true);
+ }
+
+ if (cmd.button() == mouse_button::button2) {
+ MathArray ar;
+ asArray(cur.bv().getClipboard(), ar);
+ cur.selClear();
+ cur.setScreenPos(cmd.x, cmd.y);
+ cur.insert(ar);
+ cur.bv().update();
+ return DispatchResult(true, true);
+ }
+
+ if (cmd.button() == mouse_button::button3) {
+ // try to dispatch to enclosed insets first
+ cur.bv().owner()->getDialogs().show("mathpanel");
+ return DispatchResult(true, true);
+ }
+
+ return DispatchResult(false);
+}
+
+
+DispatchResult
+MathNestInset::lfunMousePress(LCursor & cur, FuncRequest const & cmd)
+{
+ lyxerr << "lfunMousePress: buttons: " << cmd.button() << endl;
+ if (cmd.button() == mouse_button::button1) {
+ first_x = cmd.x;
+ first_y = cmd.y;
+ cur.selClear();
+ //cur.setScreenPos(cmd.x + xo_, cmd.y + yo_);
+ lyxerr << "lfunMousePress: setting cursor to: " << cur << endl;
+ cur.bv().cursor() = cur;
+ return DispatchResult(true, true);
+ }
+
+ if (cmd.button() == mouse_button::button2) {
+ return priv_dispatch(cur, FuncRequest(LFUN_PASTESELECTION));
+ }
+
+ if (cmd.button() == mouse_button::button3) {
+ return DispatchResult(true, true);
+ }
+
+ return DispatchResult(true, true);
+}
+
+
+DispatchResult
+MathNestInset::lfunMouseMotion(LCursor & cur, FuncRequest const & cmd)
+{
+ // only select with button 1
+ if (cmd.button() != mouse_button::button1)
+ return DispatchResult(true, true);
+
+ if (abs(cmd.x - first_x) < 2 && abs(cmd.y - first_y) < 2)
+ return DispatchResult(true, true);
+
+ first_x = cmd.x;
+ first_y = cmd.y;
+
+ if (!cur.selection())
+ cur.selBegin();
+
+ cur.setScreenPos(cmd.x + xo_, cmd.y + yo_);
+ cur.bv().update();
+ return DispatchResult(true, true);
}
Index: mathed/math_nestinset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.h,v
retrieving revision 1.53
diff -u -p -r1.53 math_nestinset.h
--- mathed/math_nestinset.h 2 Feb 2004 17:32:56 -0000 1.53
+++ mathed/math_nestinset.h 6 Feb 2004 15:51:29 -0000
@@ -41,7 +41,9 @@ public:
/// get cursor position
void getCursorPos(CursorSlice const & cur, int & x, int & y) const;
///
- void edit(LCursor & cur, int, int);
+ void edit(LCursor & cur, bool left);
+ ///
+ void edit(LCursor & cur, int x, int y);
/// order of movement through the cells when pressing the left key
bool idxLeft(LCursor &) const;
@@ -96,6 +98,7 @@ public:
void write(WriteStream & os) const;
/// writes [, name(), and args in []
void normalize(NormalStream & os) const;
+
protected:
///
DispatchResult priv_dispatch(LCursor & cur, FuncRequest const & cmd);
@@ -105,6 +108,16 @@ protected:
///
void handleFont2(LCursor & cur, std::string const & arg);
+
+private:
+ /// lfun handler
+ DispatchResult lfunMousePress(LCursor &, FuncRequest const &);
+ ///
+ DispatchResult lfunMouseRelease(LCursor &, FuncRequest const &);
+ ///
+ DispatchResult lfunMouseMotion(LCursor &, FuncRequest const &);
+
+protected:
/// we store the cells in a vector
typedef std::vector<MathArray> cells_type;
/// thusly: