mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 13:48:59 +00:00
use the new mouse LFUNs
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5021 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d897bc79b4
commit
11ffa04773
@ -471,17 +471,15 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, mouse_button::state s
|
|||||||
? cursor.ix() - width : cursor.ix();
|
? cursor.ix() - width : cursor.ix();
|
||||||
int start_x = inset_x + bv_->theLockingInset()->scroll();
|
int start_x = inset_x + bv_->theLockingInset()->scroll();
|
||||||
|
|
||||||
bv_->theLockingInset()->
|
FuncRequest cmd(bv_, LFUN_MOUSE_MOTION,
|
||||||
insetMotionNotify(bv_,
|
x - start_x, y - cursor.iy() + bv_->text->first_y, state);
|
||||||
x - start_x,
|
bv_->theLockingInset()->localDispatch(cmd);
|
||||||
y - cursor.iy() + bv_->text->first_y,
|
|
||||||
state);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The test for not selection possible is needed, that only motion
|
// The test for not selection possible is needed, that only motion
|
||||||
events are used, where the bottom press event was on
|
// events are used, where the bottom press event was on
|
||||||
the drawing area too */
|
// the drawing area too
|
||||||
if (!selection_possible)
|
if (!selection_possible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -555,15 +553,14 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
|
|||||||
if (bv_->theLockingInset()) {
|
if (bv_->theLockingInset()) {
|
||||||
// We are in inset locking mode
|
// We are in inset locking mode
|
||||||
|
|
||||||
/* Check whether the inset was hit. If not reset mode,
|
// Check whether the inset was hit. If not reset mode,
|
||||||
otherwise give the event to the inset */
|
// otherwise give the event to the inset
|
||||||
if (inset_hit == bv_->theLockingInset()) {
|
if (inset_hit == bv_->theLockingInset()) {
|
||||||
bv_->theLockingInset()->
|
FuncRequest cmd(bv_, LFUN_MOUSE_PRESS, xpos, ypos, button);
|
||||||
insetButtonPress(bv_, xpos, ypos, button);
|
bv_->theLockingInset()->localDispatch(cmd);
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
bv_->unlockInset(bv_->theLockingInset());
|
|
||||||
}
|
}
|
||||||
|
bv_->unlockInset(bv_->theLockingInset());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inset_hit)
|
if (!inset_hit)
|
||||||
@ -590,7 +587,8 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
|
|||||||
if (!bv_->lockInset(inset)) {
|
if (!bv_->lockInset(inset)) {
|
||||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||||
}
|
}
|
||||||
inset->insetButtonPress(bv_, xpos, ypos, button);
|
FuncRequest cmd(bv_, LFUN_MOUSE_PRESS, xpos, ypos, button);
|
||||||
|
inset->localDispatch(cmd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// I'm not sure we should continue here if we hit an inset (Jug20020403)
|
// I'm not sure we should continue here if we hit an inset (Jug20020403)
|
||||||
@ -736,11 +734,11 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
|
|||||||
if (bv_->theLockingInset()) {
|
if (bv_->theLockingInset()) {
|
||||||
// We are in inset locking mode.
|
// We are in inset locking mode.
|
||||||
|
|
||||||
/* LyX does a kind of work-area grabbing for insets.
|
// LyX does a kind of work-area grabbing for insets.
|
||||||
Only a ButtonPress FuncRequest outside the inset will
|
// Only a ButtonPress FuncRequest outside the inset will
|
||||||
force a insetUnlock. */
|
// force a insetUnlock.
|
||||||
bv_->theLockingInset()->
|
FuncRequest cmd(bv_, LFUN_MOUSE_RELEASE, x, y, button);
|
||||||
insetButtonRelease(bv_, x, y, button);
|
bv_->theLockingInset()->localDispatch(cmd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -801,9 +799,11 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
|
|||||||
if (isHighlyEditableInset(inset_hit)) {
|
if (isHighlyEditableInset(inset_hit)) {
|
||||||
// Highly editable inset, like math
|
// Highly editable inset, like math
|
||||||
UpdatableInset *inset = (UpdatableInset *)inset_hit;
|
UpdatableInset *inset = (UpdatableInset *)inset_hit;
|
||||||
inset->insetButtonRelease(bv_, x, y, button);
|
FuncRequest cmd(bv_, LFUN_MOUSE_RELEASE, x, y, button);
|
||||||
|
inset->localDispatch(cmd);
|
||||||
} else {
|
} else {
|
||||||
inset_hit->insetButtonRelease(bv_, x, y, button);
|
FuncRequest cmd(bv_, LFUN_MOUSE_RELEASE, x, y, button);
|
||||||
|
inset_hit->localDispatch(cmd);
|
||||||
// IMO this is a grosshack! Inset's should be changed so that
|
// IMO this is a grosshack! Inset's should be changed so that
|
||||||
// they call the actions they have to do with the insetButtonRel.
|
// they call the actions they have to do with the insetButtonRel.
|
||||||
// function and not in the edit(). This should be changed
|
// function and not in the edit(). This should be changed
|
||||||
|
@ -291,6 +291,7 @@ enum kb_action {
|
|||||||
LFUN_MOUSE_PRESS, // André 9 Aug 2002
|
LFUN_MOUSE_PRESS, // André 9 Aug 2002
|
||||||
LFUN_MOUSE_MOTION, // André 9 Aug 2002
|
LFUN_MOUSE_MOTION, // André 9 Aug 2002
|
||||||
LFUN_MOUSE_RELEASE, // André 9 Aug 2002
|
LFUN_MOUSE_RELEASE, // André 9 Aug 2002
|
||||||
|
LFUN_EDIT, // André 16 Aug 2002
|
||||||
LFUN_LASTACTION /* this marks the end of the table */
|
LFUN_LASTACTION /* this marks the end of the table */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ FuncRequest::FuncRequest(BufferView * view, kb_action act, string const & arg)
|
|||||||
|
|
||||||
|
|
||||||
FuncRequest::FuncRequest
|
FuncRequest::FuncRequest
|
||||||
(BufferView * view, kb_action act, int ax, int ay, int aextra)
|
(BufferView * view, kb_action act, int ax, int ay, mouse_button::state but)
|
||||||
: view_(view), action(act), argument(), x(ax), y(ay), extra(aextra)
|
: view_(view), action(act), argument(), x(ax), y(ay), button_(but)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -49,3 +49,10 @@ void FuncRequest::setView(BufferView * view)
|
|||||||
{
|
{
|
||||||
view_ = view;
|
view_ = view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mouse_button::state FuncRequest::button() const
|
||||||
|
{
|
||||||
|
return button_;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#define FUNCREQUEST_H
|
#define FUNCREQUEST_H
|
||||||
|
|
||||||
#include "commandtags.h"
|
#include "commandtags.h"
|
||||||
|
#include "frontends/mouse_state.h"
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
|
|
||||||
class BufferView;
|
class BufferView;
|
||||||
@ -31,11 +32,14 @@ public:
|
|||||||
/// actions with extra argument
|
/// actions with extra argument
|
||||||
FuncRequest(BufferView * view, kb_action act, string const & arg);
|
FuncRequest(BufferView * view, kb_action act, string const & arg);
|
||||||
/// for mouse events
|
/// for mouse events
|
||||||
FuncRequest(BufferView * view, kb_action act, int ax, int ay, int aextra);
|
FuncRequest(BufferView * view, kb_action act,
|
||||||
|
int x, int y, mouse_button::state button);
|
||||||
/// access to the view
|
/// access to the view
|
||||||
BufferView * view() const;
|
BufferView * view() const;
|
||||||
/// access to the view
|
/// access to the view
|
||||||
void setView(BufferView * view);
|
void setView(BufferView * view);
|
||||||
|
/// access to button
|
||||||
|
mouse_button::state button() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// the BufferView we are talking to
|
/// the BufferView we are talking to
|
||||||
@ -50,7 +54,7 @@ public: // should be private, too...
|
|||||||
/// the y coordinate of a mouse press
|
/// the y coordinate of a mouse press
|
||||||
int y;
|
int y;
|
||||||
/// some extra information (like button number)
|
/// some extra information (like button number)
|
||||||
int extra;
|
mouse_button::state button_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FUNCREQUEST_H
|
#endif // FUNCREQUEST_H
|
||||||
|
@ -74,6 +74,10 @@ Inset::EDITABLE Inset::editable() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Inset::edit(BufferView *, int, int, mouse_button::state)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
void Inset::validate(LaTeXFeatures &) const
|
void Inset::validate(LaTeXFeatures &) const
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -84,14 +88,16 @@ bool Inset::autoDelete() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Inset::edit(BufferView *, int, int, mouse_button::state)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Inset::edit(BufferView *, bool)
|
void Inset::edit(BufferView *, bool)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Inset::RESULT Inset::localDispatch(FuncRequest const &)
|
||||||
|
{
|
||||||
|
return UNDISPATCHED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
LyXFont const Inset::convertFont(LyXFont const & font) const
|
LyXFont const Inset::convertFont(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
@ -177,28 +183,6 @@ UpdatableInset::UpdatableInset(UpdatableInset const & in, bool same_id)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
void UpdatableInset::insetButtonPress(BufferView *, int x, int y, mouse_button::state button)
|
|
||||||
{
|
|
||||||
lyxerr[Debug::INFO] << "Inset Button Press x=" << x
|
|
||||||
<< ", y=" << y << ", button=" << button << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool UpdatableInset::insetButtonRelease(BufferView *, int x, int y, mouse_button::state button)
|
|
||||||
{
|
|
||||||
lyxerr[Debug::INFO] << "Inset Button Release x=" << x
|
|
||||||
<< ", y=" << y << ", button=" << button << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpdatableInset::insetMotionNotify(BufferView *, int x, int y, mouse_button::state state)
|
|
||||||
{
|
|
||||||
lyxerr[Debug::INFO] << "Inset Motion Notify x=" << x
|
|
||||||
<< ", y=" << y << ", state=" << state << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpdatableInset::insetUnlock(BufferView *)
|
void UpdatableInset::insetUnlock(BufferView *)
|
||||||
{
|
{
|
||||||
lyxerr[Debug::INFO] << "Inset Unlock" << endl;
|
lyxerr[Debug::INFO] << "Inset Unlock" << endl;
|
||||||
@ -304,9 +288,11 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const
|
|||||||
|
|
||||||
|
|
||||||
/// An updatable inset could handle lyx editing commands
|
/// An updatable inset could handle lyx editing commands
|
||||||
UpdatableInset::RESULT
|
Inset::RESULT UpdatableInset::localDispatch(FuncRequest const & ev)
|
||||||
UpdatableInset::localDispatch(FuncRequest const & ev)
|
|
||||||
{
|
{
|
||||||
|
if (ev.action == LFUN_MOUSE_RELEASE)
|
||||||
|
return (editable() == IS_EDITABLE) ? DISPATCHED : UNDISPATCHED;
|
||||||
|
|
||||||
if (!ev.argument.empty() && ev.action == LFUN_SCROLL_INSET) {
|
if (!ev.argument.empty() && ev.action == LFUN_SCROLL_INSET) {
|
||||||
if (ev.argument.find('.') != ev.argument.npos) {
|
if (ev.argument.find('.') != ev.argument.npos) {
|
||||||
float const xx = static_cast<float>(strToDbl(ev.argument));
|
float const xx = static_cast<float>(strToDbl(ev.argument));
|
||||||
|
@ -134,6 +134,40 @@ public:
|
|||||||
HIGHLY_EDITABLE
|
HIGHLY_EDITABLE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Dispatch result codes
|
||||||
|
Now that nested updatable insets are allowed, the local dispatch
|
||||||
|
becomes a bit complex, just two possible results (boolean)
|
||||||
|
are not enough.
|
||||||
|
|
||||||
|
DISPATCHED = the inset catched the action
|
||||||
|
DISPATCHED_NOUPDATE = the inset catched the action and no update
|
||||||
|
is needed here to redraw the inset
|
||||||
|
FINISHED = the inset must be unlocked as a result
|
||||||
|
of the action
|
||||||
|
FINISHED_RIGHT = FINISHED, but put the cursor to the RIGHT of
|
||||||
|
the inset.
|
||||||
|
FINISHED_UP = FINISHED, but put the cursor UP of
|
||||||
|
the inset.
|
||||||
|
FINISHED_DOWN = FINISHED, but put the cursor DOWN of
|
||||||
|
the inset.
|
||||||
|
UNDISPATCHED = the action was not catched, it should be
|
||||||
|
dispatched by lower level insets
|
||||||
|
*/
|
||||||
|
enum RESULT {
|
||||||
|
UNDISPATCHED = 0,
|
||||||
|
DISPATCHED,
|
||||||
|
DISPATCHED_NOUPDATE,
|
||||||
|
FINISHED,
|
||||||
|
FINISHED_RIGHT,
|
||||||
|
FINISHED_UP,
|
||||||
|
FINISHED_DOWN
|
||||||
|
};
|
||||||
|
|
||||||
|
/// To convert old binary dispatch results
|
||||||
|
RESULT DISPATCH_RESULT(bool b) {
|
||||||
|
return b ? DISPATCHED : FINISHED;
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
Inset();
|
Inset();
|
||||||
///
|
///
|
||||||
@ -160,16 +194,8 @@ public:
|
|||||||
virtual void edit(BufferView *, bool front = true);
|
virtual void edit(BufferView *, bool front = true);
|
||||||
///
|
///
|
||||||
virtual EDITABLE editable() const;
|
virtual EDITABLE editable() const;
|
||||||
/// This is called when the user clicks inside an inset
|
///
|
||||||
virtual void insetButtonPress(BufferView *, int, int, mouse_button::state) {}
|
virtual RESULT localDispatch(FuncRequest const & cmd);
|
||||||
/// This is called when the user releases the button inside an inset
|
|
||||||
// the bool return is used to see if we opened a dialog so that we can
|
|
||||||
// check this from an outer inset and open the dialog of the
|
|
||||||
// outer inset if that one has one!
|
|
||||||
virtual bool insetButtonRelease(BufferView *, int, int, mouse_button::state)
|
|
||||||
{ return editable() == IS_EDITABLE; }
|
|
||||||
/// This is called when the user moves the mouse inside an inset
|
|
||||||
virtual void insetMotionNotify(BufferView *, int , int, mouse_button::state) {}
|
|
||||||
///
|
///
|
||||||
virtual bool isTextInset() const { return false; }
|
virtual bool isTextInset() const { return false; }
|
||||||
///
|
///
|
||||||
@ -415,40 +441,6 @@ bool Inset::checkInsertChar(LyXFont &)
|
|||||||
*/
|
*/
|
||||||
class UpdatableInset : public Inset {
|
class UpdatableInset : public Inset {
|
||||||
public:
|
public:
|
||||||
/** Dispatch result codes
|
|
||||||
Now that nested updatable insets are allowed, the local dispatch
|
|
||||||
becomes a bit complex, just two possible results (boolean)
|
|
||||||
are not enough.
|
|
||||||
|
|
||||||
DISPATCHED = the inset catched the action
|
|
||||||
DISPATCHED_NOUPDATE = the inset catched the action and no update
|
|
||||||
is needed here to redraw the inset
|
|
||||||
FINISHED = the inset must be unlocked as a result
|
|
||||||
of the action
|
|
||||||
FINISHED_RIGHT = FINISHED, but put the cursor to the RIGHT of
|
|
||||||
the inset.
|
|
||||||
FINISHED_UP = FINISHED, but put the cursor UP of
|
|
||||||
the inset.
|
|
||||||
FINISHED_DOWN = FINISHED, but put the cursor DOWN of
|
|
||||||
the inset.
|
|
||||||
UNDISPATCHED = the action was not catched, it should be
|
|
||||||
dispatched by lower level insets
|
|
||||||
*/
|
|
||||||
enum RESULT {
|
|
||||||
UNDISPATCHED = 0,
|
|
||||||
DISPATCHED,
|
|
||||||
DISPATCHED_NOUPDATE,
|
|
||||||
FINISHED,
|
|
||||||
FINISHED_RIGHT,
|
|
||||||
FINISHED_UP,
|
|
||||||
FINISHED_DOWN
|
|
||||||
};
|
|
||||||
|
|
||||||
/// To convert old binary dispatch results
|
|
||||||
RESULT DISPATCH_RESULT(bool b) {
|
|
||||||
return b ? DISPATCHED : FINISHED;
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
UpdatableInset();
|
UpdatableInset();
|
||||||
///
|
///
|
||||||
@ -471,17 +463,6 @@ public:
|
|||||||
///
|
///
|
||||||
virtual void getCursorPos(BufferView *, int &, int &) const {}
|
virtual void getCursorPos(BufferView *, int &, int &) const {}
|
||||||
///
|
///
|
||||||
virtual void insetButtonPress(BufferView *, int x, int y, mouse_button::state button);
|
|
||||||
///
|
|
||||||
// the bool return is used to see if we opened a dialog so that we can
|
|
||||||
// check this from an outer inset and open the dialog of the outer inset
|
|
||||||
// if that one has one!
|
|
||||||
///
|
|
||||||
virtual bool insetButtonRelease(BufferView *,
|
|
||||||
int x, int y, mouse_button::state button);
|
|
||||||
///
|
|
||||||
virtual void insetMotionNotify(BufferView *, int x, int y, mouse_button::state state);
|
|
||||||
///
|
|
||||||
virtual void insetUnlock(BufferView *);
|
virtual void insetUnlock(BufferView *);
|
||||||
///
|
///
|
||||||
virtual void edit(BufferView *, int x, int y, mouse_button::state button);
|
virtual void edit(BufferView *, int x, int y, mouse_button::state button);
|
||||||
@ -512,7 +493,7 @@ public:
|
|||||||
bool /*lr*/ = false)
|
bool /*lr*/ = false)
|
||||||
{ return false; }
|
{ return false; }
|
||||||
/// An updatable inset could handle lyx editing commands
|
/// An updatable inset could handle lyx editing commands
|
||||||
virtual RESULT localDispatch(FuncRequest const & ev);
|
virtual RESULT localDispatch(FuncRequest const & cmd);
|
||||||
///
|
///
|
||||||
bool isCursorVisible() const { return cursor_visible_; }
|
bool isCursorVisible() const { return cursor_visible_; }
|
||||||
///
|
///
|
||||||
|
@ -138,7 +138,7 @@ int InsetCollapsable::width_collapsed() const
|
|||||||
int ascent;
|
int ascent;
|
||||||
int descent;
|
int descent;
|
||||||
font_metrics::buttonText(label, labelfont, width, ascent, descent);
|
font_metrics::buttonText(label, labelfont, width, ascent, descent);
|
||||||
return width + (2*TEXT_TO_INSET_OFFSET);
|
return width + 2 * TEXT_TO_INSET_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -321,26 +321,26 @@ void InsetCollapsable::insetUnlock(BufferView * bv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::insetButtonPress(BufferView * bv,
|
void InsetCollapsable::lfunMousePress(FuncRequest const & cmd)
|
||||||
int x, int y, mouse_button::state button)
|
|
||||||
{
|
{
|
||||||
if (!collapsed_ && (y > button_bottom_y)) {
|
if (!collapsed_ && (cmd.y > button_bottom_y)) {
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
int yy = ascent(bv, font) + y -
|
FuncRequest cmd1 = cmd;
|
||||||
|
cmd1.y = ascent(cmd.view(), font) + cmd.y -
|
||||||
(ascent_collapsed() +
|
(ascent_collapsed() +
|
||||||
descent_collapsed() +
|
descent_collapsed() +
|
||||||
inset.ascent(bv, font));
|
inset.ascent(cmd.view(), font));
|
||||||
inset.insetButtonPress(bv, x, yy, button);
|
inset.localDispatch(cmd1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsetCollapsable::insetButtonRelease(BufferView * bv,
|
bool InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
|
||||||
int x, int y, mouse_button::state button)
|
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if ((button != mouse_button::button3) && (x < button_length) &&
|
BufferView * bv = cmd.view();
|
||||||
(y >= button_top_y) && (y <= button_bottom_y))
|
if ((cmd.button() != mouse_button::button3) && (cmd.x < button_length) &&
|
||||||
|
(cmd.y >= button_top_y) && (cmd.y <= button_bottom_y))
|
||||||
{
|
{
|
||||||
if (collapsed_) {
|
if (collapsed_) {
|
||||||
collapsed_ = false;
|
collapsed_ = false;
|
||||||
@ -353,31 +353,31 @@ bool InsetCollapsable::insetButtonRelease(BufferView * bv,
|
|||||||
bv->unlockInset(this);
|
bv->unlockInset(this);
|
||||||
bv->updateInset(this, false);
|
bv->updateInset(this, false);
|
||||||
}
|
}
|
||||||
} else if (!collapsed_ && (y > button_bottom_y)) {
|
} else if (!collapsed_ && (cmd.y > button_bottom_y)) {
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
int yy = ascent(bv, font) + y -
|
FuncRequest cmd1 = cmd;
|
||||||
|
cmd1.y = ascent(cmd.view(), font) + cmd.y -
|
||||||
(ascent_collapsed() +
|
(ascent_collapsed() +
|
||||||
descent_collapsed() +
|
descent_collapsed() +
|
||||||
inset.ascent(bv, font));
|
inset.ascent(cmd.view(), font));
|
||||||
ret = inset.insetButtonRelease(bv, x, yy, button);
|
ret = (inset.localDispatch(cmd1) == DISPATCHED);
|
||||||
}
|
}
|
||||||
if ((button == mouse_button::button3) && !ret) {
|
if (cmd.button() == mouse_button::button3 && !ret)
|
||||||
return showInsetDialog(bv);
|
return showInsetDialog(bv);
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::insetMotionNotify(BufferView * bv,
|
void InsetCollapsable::lfunMouseMotion(FuncRequest const & cmd)
|
||||||
int x, int y, mouse_button::state state)
|
|
||||||
{
|
{
|
||||||
if (y > button_bottom_y) {
|
if (cmd.y > button_bottom_y) {
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
int yy = ascent(bv, font) + y -
|
FuncRequest cmd1 = cmd;
|
||||||
|
cmd1.y = ascent(cmd.view(), font) + cmd.y -
|
||||||
(ascent_collapsed() +
|
(ascent_collapsed() +
|
||||||
descent_collapsed() +
|
descent_collapsed() +
|
||||||
inset.ascent(bv, font));
|
inset.ascent(cmd.view(), font));
|
||||||
inset.insetMotionNotify(bv, x, yy, state);
|
inset.localDispatch(cmd1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,14 +445,30 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT
|
Inset::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
|
||||||
InsetCollapsable::localDispatch(FuncRequest const & ev)
|
|
||||||
{
|
{
|
||||||
UpdatableInset::RESULT result = inset.localDispatch(ev);
|
switch (cmd.action) {
|
||||||
if (result >= FINISHED)
|
|
||||||
ev.view()->unlockInset(this);
|
case LFUN_MOUSE_PRESS:
|
||||||
first_after_edit = false;
|
lfunMousePress(cmd);
|
||||||
return result;
|
return DISPATCHED;
|
||||||
|
|
||||||
|
case LFUN_MOUSE_MOTION:
|
||||||
|
lfunMouseMotion(cmd);
|
||||||
|
return DISPATCHED;
|
||||||
|
|
||||||
|
case LFUN_MOUSE_RELEASE:
|
||||||
|
lfunMouseRelease(cmd);
|
||||||
|
return DISPATCHED;
|
||||||
|
|
||||||
|
default:
|
||||||
|
UpdatableInset::RESULT result = inset.localDispatch(cmd);
|
||||||
|
if (result >= FINISHED)
|
||||||
|
cmd.view()->unlockInset(this);
|
||||||
|
first_after_edit = false;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return UNDISPATCHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,12 +89,6 @@ public:
|
|||||||
///
|
///
|
||||||
int insetInInsetY() const;
|
int insetInInsetY() const;
|
||||||
///
|
///
|
||||||
bool insetButtonRelease(BufferView *, int, int, mouse_button::state);
|
|
||||||
///
|
|
||||||
void insetButtonPress(BufferView *, int, int, mouse_button::state);
|
|
||||||
///
|
|
||||||
void insetMotionNotify(BufferView *, int, int, mouse_button::state);
|
|
||||||
///
|
|
||||||
RESULT localDispatch(FuncRequest const &);
|
RESULT localDispatch(FuncRequest const &);
|
||||||
///
|
///
|
||||||
int latex(Buffer const *, std::ostream &,
|
int latex(Buffer const *, std::ostream &,
|
||||||
@ -229,6 +223,13 @@ protected:
|
|||||||
mutable UpdateCodes need_update;
|
mutable UpdateCodes need_update;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
///
|
||||||
|
void lfunMousePress(FuncRequest const &);
|
||||||
|
///
|
||||||
|
bool lfunMouseRelease(FuncRequest const &);
|
||||||
|
///
|
||||||
|
void lfunMouseMotion(FuncRequest const &);
|
||||||
|
|
||||||
///
|
///
|
||||||
mutable string label;
|
mutable string label;
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -298,55 +298,51 @@ void InsetERT::edit(BufferView * bv, bool front)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void InsetERT::lfunMousePress(FuncRequest const & cmd)
|
||||||
|
|
||||||
void InsetERT::insetButtonPress(BufferView * bv,
|
|
||||||
int x, int y, mouse_button::state button)
|
|
||||||
{
|
{
|
||||||
if (status_ == Inlined) {
|
if (status_ == Inlined)
|
||||||
inset.insetButtonPress(bv, x, y, button);
|
inset.localDispatch(cmd);
|
||||||
} else {
|
else
|
||||||
InsetCollapsable::insetButtonPress(bv, x, y, button);
|
InsetCollapsable::localDispatch(cmd);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsetERT::insetButtonRelease(BufferView * bv, int x, int y,
|
bool InsetERT::lfunMouseRelease(FuncRequest const & cmd)
|
||||||
mouse_button::state button)
|
|
||||||
{
|
{
|
||||||
if (button == mouse_button::button3) {
|
BufferView * bv = cmd.view();
|
||||||
|
|
||||||
|
if (cmd.button() == mouse_button::button3) {
|
||||||
showInsetDialog(bv);
|
showInsetDialog(bv);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status_ != Inlined && (x >= 0) && (x < button_length) &&
|
if (status_ != Inlined && (cmd.x >= 0) && (cmd.x < button_length) &&
|
||||||
(y >= button_top_y) && (y <= button_bottom_y)) {
|
(cmd.y >= button_top_y) && (cmd.y <= button_bottom_y)) {
|
||||||
updateStatus(bv, true);
|
updateStatus(bv, true);
|
||||||
} else {
|
} else {
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
int yy = ascent(bv, font) + y - inset.ascent(bv, font);
|
FuncRequest cmd1 = cmd;
|
||||||
|
cmd1.y = ascent(bv, font) + cmd.y - inset.ascent(bv, font);
|
||||||
|
|
||||||
// inlined is special - the text appears above
|
// inlined is special - the text appears above
|
||||||
// button_bottom_y
|
// button_bottom_y
|
||||||
if (status_ == Inlined) {
|
if (status_ == Inlined)
|
||||||
inset.insetButtonRelease(bv, x, yy, button);
|
inset.localDispatch(cmd1);
|
||||||
} else if (!collapsed_ && (y > button_bottom_y)) {
|
else if (!collapsed_ && (cmd.y > button_bottom_y)) {
|
||||||
yy -= (ascent_collapsed() + descent_collapsed());
|
cmd1.y -= ascent_collapsed() + descent_collapsed();
|
||||||
inset.insetButtonRelease(bv, x, yy, button);
|
inset.localDispatch(cmd1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetERT::insetMotionNotify(BufferView * bv,
|
void InsetERT::lfunMouseMotion(FuncRequest const & cmd)
|
||||||
int x, int y, mouse_button::state state)
|
|
||||||
{
|
{
|
||||||
if (status_ == Inlined) {
|
if (status_ == Inlined)
|
||||||
inset.insetMotionNotify(bv, x, y, state);
|
inset.localDispatch(cmd);
|
||||||
} else {
|
else
|
||||||
InsetCollapsable::insetMotionNotify(bv, x, y, state);
|
InsetCollapsable::localDispatch(cmd);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -380,8 +376,7 @@ int InsetERT::latex(Buffer const *, ostream & os, bool /*fragile*/,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetERT::ascii(Buffer const *,
|
int InsetERT::ascii(Buffer const *, ostream &, int /*linelen*/) const
|
||||||
ostream &, int /*linelen*/) const
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -445,23 +440,37 @@ int InsetERT::docbook(Buffer const *, ostream & os, bool) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT InsetERT::localDispatch(FuncRequest const & ev)
|
Inset::RESULT InsetERT::localDispatch(FuncRequest const & cmd)
|
||||||
{
|
{
|
||||||
UpdatableInset::RESULT result = DISPATCHED_NOUPDATE;
|
Inset::RESULT result = DISPATCHED_NOUPDATE;
|
||||||
BufferView * bv = ev.view();
|
BufferView * bv = cmd.view();
|
||||||
|
|
||||||
if (inset.paragraph()->empty()) {
|
if (inset.paragraph()->empty()) {
|
||||||
set_latex_font(bv);
|
set_latex_font(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ev.action) {
|
switch (cmd.action) {
|
||||||
case LFUN_LAYOUT:
|
case LFUN_MOUSE_PRESS:
|
||||||
bv->owner()->setLayout(inset.paragraph()->layout()->name());
|
lfunMousePress(cmd);
|
||||||
break;
|
return DISPATCHED;
|
||||||
default:
|
|
||||||
result = InsetCollapsable::localDispatch(ev);
|
case LFUN_MOUSE_MOTION:
|
||||||
|
lfunMouseMotion(cmd);
|
||||||
|
return DISPATCHED;
|
||||||
|
|
||||||
|
case LFUN_MOUSE_RELEASE:
|
||||||
|
lfunMouseRelease(cmd);
|
||||||
|
return DISPATCHED;
|
||||||
|
|
||||||
|
case LFUN_LAYOUT:
|
||||||
|
bv->owner()->setLayout(inset.paragraph()->layout()->name());
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
result = InsetCollapsable::localDispatch(cmd);
|
||||||
}
|
}
|
||||||
switch (ev.action) {
|
|
||||||
|
switch (cmd.action) {
|
||||||
case LFUN_BREAKPARAGRAPH:
|
case LFUN_BREAKPARAGRAPH:
|
||||||
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
|
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
|
||||||
case LFUN_BACKSPACE:
|
case LFUN_BACKSPACE:
|
||||||
|
@ -76,12 +76,6 @@ public:
|
|||||||
///
|
///
|
||||||
boost::signal0<void> hideDialog;
|
boost::signal0<void> hideDialog;
|
||||||
///
|
///
|
||||||
void insetButtonPress(BufferView *, int x, int y, mouse_button::state button);
|
|
||||||
///
|
|
||||||
bool insetButtonRelease(BufferView * bv, int x, int y, mouse_button::state button);
|
|
||||||
///
|
|
||||||
void insetMotionNotify(BufferView *, int x, int y, mouse_button::state state);
|
|
||||||
///
|
|
||||||
int latex(Buffer const *, std::ostream &, bool fragile,
|
int latex(Buffer const *, std::ostream &, bool fragile,
|
||||||
bool free_spc) const;
|
bool free_spc) const;
|
||||||
///
|
///
|
||||||
@ -140,6 +134,16 @@ public:
|
|||||||
void update(BufferView *, LyXFont const &, bool =false);
|
void update(BufferView *, LyXFont const &, bool =false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
///
|
||||||
|
void lfunMousePress(FuncRequest const &);
|
||||||
|
///
|
||||||
|
// the bool return is used to see if we opened a dialog so that we can
|
||||||
|
// check this from an outer inset and open the dialog of the outer inset
|
||||||
|
// if that one has one!
|
||||||
|
///
|
||||||
|
bool lfunMouseRelease(FuncRequest const &);
|
||||||
|
///
|
||||||
|
void lfunMouseMotion(FuncRequest const &);
|
||||||
///
|
///
|
||||||
void init();
|
void init();
|
||||||
///
|
///
|
||||||
|
@ -771,18 +771,19 @@ bool InsetTabular::insertInset(BufferView * bv, Inset * inset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, mouse_button::state button)
|
void InsetTabular::lfunMousePress(FuncRequest const & cmd)
|
||||||
{
|
{
|
||||||
if (hasSelection() && (button == mouse_button::button3))
|
if (hasSelection() && cmd.button() == mouse_button::button3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (hasSelection()) {
|
if (hasSelection()) {
|
||||||
clearSelection();
|
clearSelection();
|
||||||
updateLocal(bv, SELECTION, false);
|
updateLocal(cmd.view(), SELECTION, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int const ocell = actcell;
|
int const ocell = actcell;
|
||||||
int const orow = actrow;
|
int const orow = actrow;
|
||||||
|
BufferView * bv = cmd.view();
|
||||||
|
|
||||||
hideInsetCursor(bv);
|
hideInsetCursor(bv);
|
||||||
if (!locked) {
|
if (!locked) {
|
||||||
@ -791,12 +792,12 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, mouse_button:
|
|||||||
inset_x = 0;
|
inset_x = 0;
|
||||||
inset_y = 0;
|
inset_y = 0;
|
||||||
}
|
}
|
||||||
setPos(bv, x, y);
|
setPos(bv, cmd.x, cmd.y);
|
||||||
if (actrow != orow)
|
if (actrow != orow)
|
||||||
updateLocal(bv, NONE, false);
|
updateLocal(bv, NONE, false);
|
||||||
clearSelection();
|
clearSelection();
|
||||||
#if 0
|
#if 0
|
||||||
if (button == 3) {
|
if (cmd.button() == mouse_button::button3) {
|
||||||
if ((ocell != actcell) && the_locking_inset) {
|
if ((ocell != actcell) && the_locking_inset) {
|
||||||
the_locking_inset->insetUnlock(bv);
|
the_locking_inset->insetUnlock(bv);
|
||||||
updateLocal(bv, CELL, false);
|
updateLocal(bv, CELL, false);
|
||||||
@ -807,65 +808,75 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, mouse_button:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool const inset_hit = insetHit(bv, x, y);
|
bool const inset_hit = insetHit(bv, cmd.x, cmd.y);
|
||||||
|
|
||||||
|
FuncRequest cmd1 = cmd;
|
||||||
|
cmd1.x -= inset_x;
|
||||||
|
cmd1.y -= inset_y;
|
||||||
|
|
||||||
if ((ocell == actcell) && the_locking_inset && inset_hit) {
|
if ((ocell == actcell) && the_locking_inset && inset_hit) {
|
||||||
resetPos(bv);
|
resetPos(bv);
|
||||||
the_locking_inset->insetButtonPress(bv,
|
the_locking_inset->localDispatch(cmd1);
|
||||||
x - inset_x, y - inset_y,
|
|
||||||
button);
|
|
||||||
return;
|
return;
|
||||||
} else if (the_locking_inset) {
|
}
|
||||||
|
|
||||||
|
if (the_locking_inset) {
|
||||||
the_locking_inset->insetUnlock(bv);
|
the_locking_inset->insetUnlock(bv);
|
||||||
updateLocal(bv, CELL, false);
|
updateLocal(bv, CELL, false);
|
||||||
the_locking_inset = 0;
|
the_locking_inset = 0;
|
||||||
}
|
}
|
||||||
if (button == mouse_button::button2) {
|
|
||||||
|
if (cmd.button() == mouse_button::button2) {
|
||||||
localDispatch(FuncRequest(bv, LFUN_PASTESELECTION, "paragraph"));
|
localDispatch(FuncRequest(bv, LFUN_PASTESELECTION, "paragraph"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inset_hit && bv->theLockingInset()) {
|
if (inset_hit && bv->theLockingInset()) {
|
||||||
if (!bv->lockInset(static_cast<UpdatableInset*>(tabular->GetCellInset(actcell)))) {
|
if (!bv->lockInset(static_cast<UpdatableInset*>
|
||||||
|
(tabular->GetCellInset(actcell))))
|
||||||
|
{
|
||||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
the_locking_inset->insetButtonPress(
|
the_locking_inset->localDispatch(cmd1);
|
||||||
bv, x - inset_x, y - inset_y, button);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showInsetCursor(bv);
|
showInsetCursor(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsetTabular::insetButtonRelease(BufferView * bv,
|
bool InsetTabular::lfunMouseRelease(FuncRequest const & cmd)
|
||||||
int x, int y, mouse_button::state button)
|
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if (the_locking_inset)
|
if (the_locking_inset) {
|
||||||
ret = the_locking_inset->insetButtonRelease(bv, x - inset_x,
|
FuncRequest cmd1 = cmd;
|
||||||
y - inset_y, button);
|
cmd1.x -= inset_x;
|
||||||
if (button == mouse_button::button3 && !ret) {
|
cmd1.y -= inset_y;
|
||||||
bv->owner()->getDialogs().showTabular(this);
|
ret = the_locking_inset->localDispatch(cmd1);
|
||||||
|
}
|
||||||
|
if (cmd.button() == mouse_button::button3 && !ret) {
|
||||||
|
cmd.view()->owner()->getDialogs().showTabular(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::insetMotionNotify(BufferView * bv, int x, int y, mouse_button::state button)
|
void InsetTabular::lfunMouseMotion(FuncRequest const & cmd)
|
||||||
{
|
{
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
the_locking_inset->insetMotionNotify(bv,
|
FuncRequest cmd1 = cmd;
|
||||||
x - inset_x,
|
cmd1.x -= inset_x;
|
||||||
y - inset_y,
|
cmd1.y -= inset_y;
|
||||||
button);
|
the_locking_inset->localDispatch(cmd1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BufferView * bv = cmd.view();
|
||||||
hideInsetCursor(bv);
|
hideInsetCursor(bv);
|
||||||
int const old_cell = actcell;
|
int const old_cell = actcell;
|
||||||
|
|
||||||
setPos(bv, x, y);
|
setPos(bv, cmd.x, cmd.y);
|
||||||
if (!hasSelection()) {
|
if (!hasSelection()) {
|
||||||
setSelection(actcell, actcell);
|
setSelection(actcell, actcell);
|
||||||
updateLocal(bv, SELECTION, false);
|
updateLocal(bv, SELECTION, false);
|
||||||
@ -877,20 +888,20 @@ void InsetTabular::insetMotionNotify(BufferView * bv, int x, int y, mouse_button
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT InsetTabular::localDispatch(FuncRequest const & ev)
|
Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
|
||||||
{
|
{
|
||||||
// We need to save the value of the_locking_inset as the call to
|
// We need to save the value of the_locking_inset as the call to
|
||||||
// the_locking_inset->LocalDispatch might unlock it.
|
// the_locking_inset->localDispatch might unlock it.
|
||||||
old_locking_inset = the_locking_inset;
|
old_locking_inset = the_locking_inset;
|
||||||
RESULT result = UpdatableInset::localDispatch(ev);
|
RESULT result = UpdatableInset::localDispatch(cmd);
|
||||||
|
|
||||||
BufferView * bv = ev.view();
|
BufferView * bv = cmd.view();
|
||||||
if (result == DISPATCHED || result == DISPATCHED_NOUPDATE) {
|
if (result == DISPATCHED || result == DISPATCHED_NOUPDATE) {
|
||||||
resetPos(bv);
|
resetPos(bv);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ev.action < 0 && ev.argument.empty())
|
if (cmd.action < 0 && cmd.argument.empty())
|
||||||
return FINISHED;
|
return FINISHED;
|
||||||
|
|
||||||
bool hs = hasSelection();
|
bool hs = hasSelection();
|
||||||
@ -899,12 +910,24 @@ UpdatableInset::RESULT InsetTabular::localDispatch(FuncRequest const & ev)
|
|||||||
// this one have priority over the locked InsetText, if we're not already
|
// this one have priority over the locked InsetText, if we're not already
|
||||||
// inside another tabular then that one get's priority!
|
// inside another tabular then that one get's priority!
|
||||||
if (getFirstLockingInsetOfType(Inset::TABULAR_CODE) == this) {
|
if (getFirstLockingInsetOfType(Inset::TABULAR_CODE) == this) {
|
||||||
switch (ev.action) {
|
switch (cmd.action) {
|
||||||
|
case LFUN_MOUSE_PRESS:
|
||||||
|
lfunMousePress(cmd);
|
||||||
|
return DISPATCHED;
|
||||||
|
|
||||||
|
case LFUN_MOUSE_MOTION:
|
||||||
|
lfunMouseMotion(cmd);
|
||||||
|
return DISPATCHED;
|
||||||
|
|
||||||
|
case LFUN_MOUSE_RELEASE:
|
||||||
|
lfunMouseRelease(cmd);
|
||||||
|
return lfunMouseRelease(cmd) ? DISPATCHED : UNDISPATCHED;
|
||||||
|
|
||||||
case LFUN_SHIFT_TAB:
|
case LFUN_SHIFT_TAB:
|
||||||
case LFUN_TAB:
|
case LFUN_TAB:
|
||||||
hideInsetCursor(bv);
|
hideInsetCursor(bv);
|
||||||
unlockInsetInInset(bv, the_locking_inset);
|
unlockInsetInInset(bv, the_locking_inset);
|
||||||
if (ev.action == LFUN_TAB)
|
if (cmd.action == LFUN_TAB)
|
||||||
moveNextCell(bv, old_locking_inset != 0);
|
moveNextCell(bv, old_locking_inset != 0);
|
||||||
else
|
else
|
||||||
movePrevCell(bv, old_locking_inset != 0);
|
movePrevCell(bv, old_locking_inset != 0);
|
||||||
@ -922,10 +945,10 @@ UpdatableInset::RESULT InsetTabular::localDispatch(FuncRequest const & ev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kb_action action = ev.action;
|
kb_action action = cmd.action;
|
||||||
string arg = ev.argument;
|
string arg = cmd.argument;
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
result = the_locking_inset->localDispatch(ev);
|
result = the_locking_inset->localDispatch(cmd);
|
||||||
if (result == DISPATCHED_NOUPDATE) {
|
if (result == DISPATCHED_NOUPDATE) {
|
||||||
int sc = scroll();
|
int sc = scroll();
|
||||||
resetPos(bv);
|
resetPos(bv);
|
||||||
@ -1614,7 +1637,7 @@ void InsetTabular::resetPos(BufferView * bv) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT InsetTabular::moveRight(BufferView * bv, bool lock)
|
Inset::RESULT InsetTabular::moveRight(BufferView * bv, bool lock)
|
||||||
{
|
{
|
||||||
if (lock && !old_locking_inset) {
|
if (lock && !old_locking_inset) {
|
||||||
if (activateCellInset(bv))
|
if (activateCellInset(bv))
|
||||||
@ -1632,7 +1655,7 @@ UpdatableInset::RESULT InsetTabular::moveRight(BufferView * bv, bool lock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT InsetTabular::moveLeft(BufferView * bv, bool lock)
|
Inset::RESULT InsetTabular::moveLeft(BufferView * bv, bool lock)
|
||||||
{
|
{
|
||||||
bool moved = isRightToLeft(bv) ? moveNextCell(bv) : movePrevCell(bv);
|
bool moved = isRightToLeft(bv) ? moveNextCell(bv) : movePrevCell(bv);
|
||||||
if (!moved)
|
if (!moved)
|
||||||
@ -1646,7 +1669,7 @@ UpdatableInset::RESULT InsetTabular::moveLeft(BufferView * bv, bool lock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT InsetTabular::moveUp(BufferView * bv, bool lock)
|
Inset::RESULT InsetTabular::moveUp(BufferView * bv, bool lock)
|
||||||
{
|
{
|
||||||
int const ocell = actcell;
|
int const ocell = actcell;
|
||||||
actcell = tabular->GetCellAbove(actcell);
|
actcell = tabular->GetCellAbove(actcell);
|
||||||
@ -1667,7 +1690,7 @@ UpdatableInset::RESULT InsetTabular::moveUp(BufferView * bv, bool lock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT InsetTabular::moveDown(BufferView * bv, bool lock)
|
Inset::RESULT InsetTabular::moveDown(BufferView * bv, bool lock)
|
||||||
{
|
{
|
||||||
int const ocell = actcell;
|
int const ocell = actcell;
|
||||||
actcell = tabular->GetCellBelow(actcell);
|
actcell = tabular->GetCellBelow(actcell);
|
||||||
|
@ -136,12 +136,6 @@ public:
|
|||||||
///
|
///
|
||||||
bool display() const { return tabular->IsLongTabular(); }
|
bool display() const { return tabular->IsLongTabular(); }
|
||||||
///
|
///
|
||||||
bool insetButtonRelease(BufferView *, int, int, mouse_button::state);
|
|
||||||
///
|
|
||||||
void insetButtonPress(BufferView *, int, int, mouse_button::state);
|
|
||||||
///
|
|
||||||
void insetMotionNotify(BufferView *, int, int, mouse_button::state);
|
|
||||||
///
|
|
||||||
RESULT localDispatch(FuncRequest const &);
|
RESULT localDispatch(FuncRequest const &);
|
||||||
///
|
///
|
||||||
int latex(Buffer const *, std::ostream &, bool, bool) const;
|
int latex(Buffer const *, std::ostream &, bool, bool) const;
|
||||||
@ -243,6 +237,16 @@ public:
|
|||||||
boost::signal0<void> hideDialog;
|
boost::signal0<void> hideDialog;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
///
|
||||||
|
void lfunMousePress(FuncRequest const &);
|
||||||
|
///
|
||||||
|
// the bool return is used to see if we opened a dialog so that we can
|
||||||
|
// check this from an outer inset and open the dialog of the outer inset
|
||||||
|
// if that one has one!
|
||||||
|
///
|
||||||
|
bool lfunMouseRelease(FuncRequest const &);
|
||||||
|
///
|
||||||
|
void lfunMouseMotion(FuncRequest const &);
|
||||||
///
|
///
|
||||||
bool calculate_dimensions_of_cells(BufferView *, LyXFont const &,
|
bool calculate_dimensions_of_cells(BufferView *, LyXFont const &,
|
||||||
bool = false) const;
|
bool = false) const;
|
||||||
@ -261,13 +265,13 @@ private:
|
|||||||
///
|
///
|
||||||
void setPos(BufferView *, int x, int y) const;
|
void setPos(BufferView *, int x, int y) const;
|
||||||
///
|
///
|
||||||
UpdatableInset::RESULT moveRight(BufferView *, bool lock = true);
|
RESULT moveRight(BufferView *, bool lock = true);
|
||||||
///
|
///
|
||||||
UpdatableInset::RESULT moveLeft(BufferView *, bool lock = true);
|
RESULT moveLeft(BufferView *, bool lock = true);
|
||||||
///
|
///
|
||||||
UpdatableInset::RESULT moveUp(BufferView *, bool lock = true);
|
RESULT moveUp(BufferView *, bool lock = true);
|
||||||
///
|
///
|
||||||
UpdatableInset::RESULT moveDown(BufferView *, bool lock = true);
|
RESULT moveDown(BufferView *, bool lock = true);
|
||||||
///
|
///
|
||||||
bool moveNextCell(BufferView *, bool lock = false);
|
bool moveNextCell(BufferView *, bool lock = false);
|
||||||
///
|
///
|
||||||
|
@ -984,29 +984,29 @@ bool InsetText::updateInsetInInset(BufferView * bv, Inset * inset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetText::insetButtonPress(BufferView * bv,
|
void InsetText::lfunMousePress(FuncRequest const & cmd)
|
||||||
int x, int y, mouse_button::state button)
|
|
||||||
{
|
{
|
||||||
no_selection = true;
|
no_selection = true;
|
||||||
|
|
||||||
// use this to check mouse motion for selection!
|
// use this to check mouse motion for selection!
|
||||||
mouse_x = x;
|
mouse_x = cmd.x;
|
||||||
mouse_y = y;
|
mouse_y = cmd.y;
|
||||||
|
|
||||||
|
BufferView * bv = cmd.view();
|
||||||
|
FuncRequest cmd1 = cmd;
|
||||||
|
cmd1.x -= inset_x;
|
||||||
|
cmd1.y -= inset_y;
|
||||||
if (!locked)
|
if (!locked)
|
||||||
lockInset(bv);
|
lockInset(bv);
|
||||||
|
|
||||||
int tmp_x = x - drawTextXOffset;
|
int tmp_x = cmd.x - drawTextXOffset;
|
||||||
int tmp_y = y + insetAscent - getLyXText(bv)->first_y;
|
int tmp_y = cmd.y + insetAscent - getLyXText(bv)->first_y;
|
||||||
Inset * inset = bv->checkInsetHit(getLyXText(bv), tmp_x, tmp_y);
|
Inset * inset = bv->checkInsetHit(getLyXText(bv), tmp_x, tmp_y);
|
||||||
|
|
||||||
hideInsetCursor(bv);
|
hideInsetCursor(bv);
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
if (the_locking_inset == inset) {
|
if (the_locking_inset == inset) {
|
||||||
the_locking_inset->insetButtonPress(bv,
|
the_locking_inset->localDispatch(cmd1);
|
||||||
x - inset_x,
|
|
||||||
y - inset_y,
|
|
||||||
button);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
@ -1016,8 +1016,7 @@ void InsetText::insetButtonPress(BufferView * bv,
|
|||||||
inset_x = cix(bv) - top_x + drawTextXOffset;
|
inset_x = cix(bv) - top_x + drawTextXOffset;
|
||||||
inset_y = ciy(bv) + drawTextYOffset;
|
inset_y = ciy(bv) + drawTextYOffset;
|
||||||
the_locking_inset = 0;
|
the_locking_inset = 0;
|
||||||
inset->insetButtonPress(bv, x - inset_x,
|
inset->localDispatch(cmd1);
|
||||||
y - inset_y, button);
|
|
||||||
// inset->edit(bv, x - inset_x, y - inset_y, button);
|
// inset->edit(bv, x - inset_x, y - inset_y, button);
|
||||||
if (the_locking_inset)
|
if (the_locking_inset)
|
||||||
updateLocal(bv, CURSOR, false);
|
updateLocal(bv, CURSOR, false);
|
||||||
@ -1039,7 +1038,7 @@ void InsetText::insetButtonPress(BufferView * bv,
|
|||||||
if (!bv->lockInset(uinset)) {
|
if (!bv->lockInset(uinset)) {
|
||||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||||
}
|
}
|
||||||
inset->insetButtonPress(bv, x - inset_x, y - inset_y, button);
|
inset->localDispatch(cmd1);
|
||||||
if (the_locking_inset)
|
if (the_locking_inset)
|
||||||
updateLocal(bv, CURSOR, false);
|
updateLocal(bv, CURSOR, false);
|
||||||
return;
|
return;
|
||||||
@ -1047,7 +1046,7 @@ void InsetText::insetButtonPress(BufferView * bv,
|
|||||||
}
|
}
|
||||||
if (!inset) { // && (button == mouse_button::button2)) {
|
if (!inset) { // && (button == mouse_button::button2)) {
|
||||||
bool paste_internally = false;
|
bool paste_internally = false;
|
||||||
if ((button == mouse_button::button2) && getLyXText(bv)->selection.set()) {
|
if (cmd.button() == mouse_button::button2 && getLyXText(bv)->selection.set()) {
|
||||||
localDispatch(FuncRequest(bv, LFUN_COPY));
|
localDispatch(FuncRequest(bv, LFUN_COPY));
|
||||||
paste_internally = true;
|
paste_internally = true;
|
||||||
}
|
}
|
||||||
@ -1058,8 +1057,8 @@ void InsetText::insetButtonPress(BufferView * bv,
|
|||||||
}
|
}
|
||||||
int old_first_y = lt->first_y;
|
int old_first_y = lt->first_y;
|
||||||
|
|
||||||
lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
|
lt->setCursorFromCoordinates(bv, cmd.x - drawTextXOffset,
|
||||||
y + insetAscent);
|
cmd.y + insetAscent);
|
||||||
// set the selection cursor!
|
// set the selection cursor!
|
||||||
lt->selection.cursor = lt->cursor;
|
lt->selection.cursor = lt->cursor;
|
||||||
lt->cursor.x_fix(lt->cursor.x());
|
lt->cursor.x_fix(lt->cursor.x());
|
||||||
@ -1085,7 +1084,7 @@ void InsetText::insetButtonPress(BufferView * bv,
|
|||||||
// Insert primary selection with middle mouse
|
// Insert primary selection with middle mouse
|
||||||
// if there is a local selection in the current buffer,
|
// if there is a local selection in the current buffer,
|
||||||
// insert this
|
// insert this
|
||||||
if (button == mouse_button::button2) {
|
if (cmd.button() == mouse_button::button2) {
|
||||||
if (paste_internally)
|
if (paste_internally)
|
||||||
localDispatch(FuncRequest(bv, LFUN_PASTE));
|
localDispatch(FuncRequest(bv, LFUN_PASTE));
|
||||||
else
|
else
|
||||||
@ -1098,30 +1097,31 @@ void InsetText::insetButtonPress(BufferView * bv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsetText::insetButtonRelease(BufferView * bv,
|
bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
|
||||||
int x, int y, mouse_button::state button)
|
|
||||||
{
|
{
|
||||||
|
BufferView * bv = cmd.view();
|
||||||
|
FuncRequest cmd1 = cmd;
|
||||||
|
cmd1.x -= inset_x;
|
||||||
|
cmd1.y -= inset_y;
|
||||||
|
|
||||||
no_selection = true;
|
no_selection = true;
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset)
|
||||||
return the_locking_inset->insetButtonRelease(bv,
|
return the_locking_inset->localDispatch(cmd1);
|
||||||
x - inset_x, y - inset_y,
|
|
||||||
button);
|
int tmp_x = cmd.x - drawTextXOffset;
|
||||||
}
|
int tmp_y = cmd.y + insetAscent - getLyXText(bv)->first_y;
|
||||||
int tmp_x = x - drawTextXOffset;
|
|
||||||
int tmp_y = y + insetAscent - getLyXText(bv)->first_y;
|
|
||||||
Inset * inset = bv->checkInsetHit(getLyXText(bv), tmp_x, tmp_y);
|
Inset * inset = bv->checkInsetHit(getLyXText(bv), tmp_x, tmp_y);
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if (inset) {
|
if (inset) {
|
||||||
if (isHighlyEditableInset(inset)) {
|
if (isHighlyEditableInset(inset))
|
||||||
ret = inset->insetButtonRelease(bv, x - inset_x,
|
ret = inset->localDispatch(cmd1);
|
||||||
y - inset_y, button);
|
else {
|
||||||
} else {
|
|
||||||
inset_x = cix(bv) - top_x + drawTextXOffset;
|
inset_x = cix(bv) - top_x + drawTextXOffset;
|
||||||
inset_y = ciy(bv) + drawTextYOffset;
|
inset_y = ciy(bv) + drawTextYOffset;
|
||||||
ret = inset->insetButtonRelease(bv, x - inset_x,
|
cmd1.x = cmd.x - inset_x;
|
||||||
y - inset_y, button);
|
cmd1.y = cmd.x - inset_y;
|
||||||
inset->edit(bv, x - inset_x,
|
ret = inset->localDispatch(cmd1);
|
||||||
y - inset_y, button);
|
inset->edit(bv, cmd1.x, cmd1.y, cmd.button());
|
||||||
}
|
}
|
||||||
updateLocal(bv, CURSOR_PAR, false);
|
updateLocal(bv, CURSOR_PAR, false);
|
||||||
}
|
}
|
||||||
@ -1129,17 +1129,21 @@ bool InsetText::insetButtonRelease(BufferView * bv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetText::insetMotionNotify(BufferView * bv, int x, int y, mouse_button::state state)
|
void InsetText::lfunMouseMotion(FuncRequest const & cmd)
|
||||||
{
|
{
|
||||||
|
FuncRequest cmd1 = cmd;
|
||||||
|
cmd1.x -= inset_x;
|
||||||
|
cmd1.y -= inset_y;
|
||||||
|
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
the_locking_inset->insetMotionNotify(bv, x - inset_x,
|
the_locking_inset->localDispatch(cmd1);
|
||||||
y - inset_y,state);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (no_selection || ((mouse_x == x) && (mouse_y == y)))
|
if (no_selection || (mouse_x == cmd.x && mouse_y == cmd.y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
BufferView * bv = cmd.view();
|
||||||
bool clear = false;
|
bool clear = false;
|
||||||
if (!lt) {
|
if (!lt) {
|
||||||
lt = getLyXText(bv);
|
lt = getLyXText(bv);
|
||||||
@ -1147,7 +1151,8 @@ void InsetText::insetMotionNotify(BufferView * bv, int x, int y, mouse_button::s
|
|||||||
}
|
}
|
||||||
hideInsetCursor(bv);
|
hideInsetCursor(bv);
|
||||||
LyXCursor cur = lt->cursor;
|
LyXCursor cur = lt->cursor;
|
||||||
lt->setCursorFromCoordinates(bv, x - drawTextXOffset, y + insetAscent);
|
lt->setCursorFromCoordinates
|
||||||
|
(bv, cmd.x - drawTextXOffset, cmd.y + insetAscent);
|
||||||
lt->cursor.x_fix(lt->cursor.x());
|
lt->cursor.x_fix(lt->cursor.x());
|
||||||
if (cur == lt->cursor) {
|
if (cur == lt->cursor) {
|
||||||
if (clear)
|
if (clear)
|
||||||
@ -1166,13 +1171,12 @@ void InsetText::insetMotionNotify(BufferView * bv, int x, int y, mouse_button::s
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT
|
Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||||
InsetText::localDispatch(FuncRequest const & ev)
|
|
||||||
{
|
{
|
||||||
BufferView * bv = ev.view();
|
BufferView * bv = ev.view();
|
||||||
bool was_empty = (paragraphs.begin()->empty() && !paragraphs.begin()->next());
|
bool was_empty = (paragraphs.begin()->empty() && !paragraphs.begin()->next());
|
||||||
no_selection = false;
|
no_selection = false;
|
||||||
RESULT result= UpdatableInset::localDispatch(ev);
|
RESULT result = UpdatableInset::localDispatch(ev);
|
||||||
if (result != UNDISPATCHED)
|
if (result != UNDISPATCHED)
|
||||||
return DISPATCHED;
|
return DISPATCHED;
|
||||||
|
|
||||||
@ -1825,7 +1829,7 @@ void InsetText::fitInsetCursor(BufferView * bv) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT
|
Inset::RESULT
|
||||||
InsetText::moveRight(BufferView * bv, bool activate_inset, bool selecting)
|
InsetText::moveRight(BufferView * bv, bool activate_inset, bool selecting)
|
||||||
{
|
{
|
||||||
if (getLyXText(bv)->cursor.par()->isRightToLeftPar(bv->buffer()->params))
|
if (getLyXText(bv)->cursor.par()->isRightToLeftPar(bv->buffer()->params))
|
||||||
@ -1835,7 +1839,7 @@ InsetText::moveRight(BufferView * bv, bool activate_inset, bool selecting)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT
|
Inset::RESULT
|
||||||
InsetText::moveLeft(BufferView * bv, bool activate_inset, bool selecting)
|
InsetText::moveLeft(BufferView * bv, bool activate_inset, bool selecting)
|
||||||
{
|
{
|
||||||
if (getLyXText(bv)->cursor.par()->isRightToLeftPar(bv->buffer()->params))
|
if (getLyXText(bv)->cursor.par()->isRightToLeftPar(bv->buffer()->params))
|
||||||
@ -1845,7 +1849,7 @@ InsetText::moveLeft(BufferView * bv, bool activate_inset, bool selecting)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT
|
Inset::RESULT
|
||||||
InsetText::moveRightIntern(BufferView * bv, bool front,
|
InsetText::moveRightIntern(BufferView * bv, bool front,
|
||||||
bool activate_inset, bool selecting)
|
bool activate_inset, bool selecting)
|
||||||
{
|
{
|
||||||
@ -1860,7 +1864,7 @@ InsetText::moveRightIntern(BufferView * bv, bool front,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT
|
Inset::RESULT
|
||||||
InsetText::moveLeftIntern(BufferView * bv, bool front,
|
InsetText::moveLeftIntern(BufferView * bv, bool front,
|
||||||
bool activate_inset, bool selecting)
|
bool activate_inset, bool selecting)
|
||||||
{
|
{
|
||||||
@ -1875,7 +1879,7 @@ InsetText::moveLeftIntern(BufferView * bv, bool front,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT
|
Inset::RESULT
|
||||||
InsetText::moveUp(BufferView * bv)
|
InsetText::moveUp(BufferView * bv)
|
||||||
{
|
{
|
||||||
if (!crow(bv)->previous())
|
if (!crow(bv)->previous())
|
||||||
@ -1885,7 +1889,7 @@ InsetText::moveUp(BufferView * bv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT
|
Inset::RESULT
|
||||||
InsetText::moveDown(BufferView * bv)
|
InsetText::moveDown(BufferView * bv)
|
||||||
{
|
{
|
||||||
if (!crow(bv)->next())
|
if (!crow(bv)->next())
|
||||||
|
@ -125,12 +125,6 @@ public:
|
|||||||
///
|
///
|
||||||
bool updateInsetInInset(BufferView *, Inset *);
|
bool updateInsetInInset(BufferView *, Inset *);
|
||||||
///
|
///
|
||||||
bool insetButtonRelease(BufferView *, int, int, mouse_button::state);
|
|
||||||
///
|
|
||||||
void insetButtonPress(BufferView *, int, int, mouse_button::state);
|
|
||||||
///
|
|
||||||
void insetMotionNotify(BufferView *, int, int, mouse_button::state);
|
|
||||||
///
|
|
||||||
RESULT localDispatch(FuncRequest const &);
|
RESULT localDispatch(FuncRequest const &);
|
||||||
///
|
///
|
||||||
int latex(Buffer const *, std::ostream &,
|
int latex(Buffer const *, std::ostream &,
|
||||||
@ -276,6 +270,13 @@ protected:
|
|||||||
LColor::color frame_color;
|
LColor::color frame_color;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
///
|
||||||
|
void lfunMousePress(FuncRequest const &);
|
||||||
|
///
|
||||||
|
bool lfunMouseRelease(FuncRequest const &);
|
||||||
|
///
|
||||||
|
void lfunMouseMotion(FuncRequest const &);
|
||||||
|
|
||||||
///
|
///
|
||||||
struct InnerCache {
|
struct InnerCache {
|
||||||
///
|
///
|
||||||
@ -292,26 +293,26 @@ private:
|
|||||||
///
|
///
|
||||||
int beginningOfMainBody(Paragraph * par) const;
|
int beginningOfMainBody(Paragraph * par) const;
|
||||||
///
|
///
|
||||||
UpdatableInset::RESULT moveRight(BufferView *,
|
RESULT moveRight(BufferView *,
|
||||||
bool activate_inset = true,
|
bool activate_inset = true,
|
||||||
bool selecting = false);
|
bool selecting = false);
|
||||||
///
|
///
|
||||||
UpdatableInset::RESULT moveLeft(BufferView *,
|
RESULT moveLeft(BufferView *,
|
||||||
bool activate_inset = true,
|
bool activate_inset = true,
|
||||||
bool selecting = false);
|
bool selecting = false);
|
||||||
///
|
///
|
||||||
UpdatableInset::RESULT moveRightIntern(BufferView *, bool front,
|
RESULT moveRightIntern(BufferView *, bool front,
|
||||||
bool activate_inset = true,
|
bool activate_inset = true,
|
||||||
bool selecting = false);
|
bool selecting = false);
|
||||||
///
|
///
|
||||||
UpdatableInset::RESULT moveLeftIntern(BufferView *, bool front,
|
RESULT moveLeftIntern(BufferView *, bool front,
|
||||||
bool activate_inset = true,
|
bool activate_inset = true,
|
||||||
bool selecting = false);
|
bool selecting = false);
|
||||||
|
|
||||||
///
|
///
|
||||||
UpdatableInset::RESULT moveUp(BufferView *);
|
RESULT moveUp(BufferView *);
|
||||||
///
|
///
|
||||||
UpdatableInset::RESULT moveDown(BufferView *);
|
RESULT moveDown(BufferView *);
|
||||||
///
|
///
|
||||||
void setCharFont(Buffer const *, int pos, LyXFont const & font);
|
void setCharFont(Buffer const *, int pos, LyXFont const & font);
|
||||||
///
|
///
|
||||||
|
@ -736,7 +736,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (view()->available() && view()->theLockingInset()) {
|
if (view()->available() && view()->theLockingInset()) {
|
||||||
UpdatableInset::RESULT result;
|
Inset::RESULT result;
|
||||||
if ((action > 1) || ((action == LFUN_UNKNOWN_ACTION) &&
|
if ((action > 1) || ((action == LFUN_UNKNOWN_ACTION) &&
|
||||||
(!keyseq.deleted())))
|
(!keyseq.deleted())))
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
#include "command_inset.h"
|
#include "command_inset.h"
|
||||||
#include "math_mathmlstream.h"
|
#include "math_mathmlstream.h"
|
||||||
|
#include "funcrequest.h"
|
||||||
|
|
||||||
|
|
||||||
CommandInset::CommandInset(string const & data)
|
CommandInset::CommandInset(string const & data)
|
||||||
@ -26,6 +27,17 @@ MathInset * CommandInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MathInset::result_type
|
||||||
|
CommandInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
|
||||||
|
{
|
||||||
|
switch (cmd.action) {
|
||||||
|
default:
|
||||||
|
return ButtonInset::dispatch(cmd, idx, pos);
|
||||||
|
}
|
||||||
|
return UNDISPATCHED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CommandInset::write(WriteStream & os) const
|
void CommandInset::write(WriteStream & os) const
|
||||||
{
|
{
|
||||||
os << "\\" << name_.c_str();
|
os << "\\" << name_.c_str();
|
||||||
|
@ -15,7 +15,7 @@ public:
|
|||||||
///
|
///
|
||||||
//void infoize(std::ostream & os) const;
|
//void infoize(std::ostream & os) const;
|
||||||
///
|
///
|
||||||
//int dispatch(string const & cmd, idx_type idx, pos_type pos);
|
result_type dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
|
||||||
///
|
///
|
||||||
string screenLabel() const;
|
string screenLabel() const;
|
||||||
public:
|
public:
|
||||||
|
@ -213,6 +213,11 @@ void InsetFormulaBase::getCursorPos(BufferView *, int & x, int & y) const
|
|||||||
// calling metrics here destroys the cached xo,yo positions e.g. in
|
// calling metrics here destroys the cached xo,yo positions e.g. in
|
||||||
// MathParboxinset. And it would be too expensive anyway...
|
// MathParboxinset. And it would be too expensive anyway...
|
||||||
//metrics(bv);
|
//metrics(bv);
|
||||||
|
if (!mathcursor) {
|
||||||
|
lyxerr << "getCursorPos - should not happen";
|
||||||
|
x = y = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
mathcursor->getPos(x, y);
|
mathcursor->getPos(x, y);
|
||||||
//x -= xo_;
|
//x -= xo_;
|
||||||
y -= yo_;
|
y -= yo_;
|
||||||
@ -286,124 +291,117 @@ void InsetFormulaBase::updateLocal(BufferView * bv, bool dirty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsetFormulaBase::insetButtonRelease(BufferView * bv,
|
Inset::RESULT InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
|
||||||
int x, int y, mouse_button::state button)
|
|
||||||
{
|
{
|
||||||
if (!mathcursor)
|
if (!mathcursor)
|
||||||
return false;
|
return UNDISPATCHED;
|
||||||
|
|
||||||
//lyxerr << "insetButtonRelease: " << x << " " << y << "\n";
|
BufferView * bv = cmd.view();
|
||||||
hideInsetCursor(bv);
|
hideInsetCursor(bv);
|
||||||
showInsetCursor(bv);
|
showInsetCursor(bv);
|
||||||
bv->updateInset(this, false);
|
bv->updateInset(this, false);
|
||||||
|
|
||||||
if (button == mouse_button::button3) {
|
if (cmd.button() == mouse_button::button3) {
|
||||||
// try to dispatch to enclosed insets first
|
// try to dispatch to enclosed insets first
|
||||||
if (mathcursor->dispatch(FuncRequest(bv, LFUN_MOUSE_RELEASE, x, y, 3)))
|
if (mathcursor->dispatch(cmd) == MathInset::UNDISPATCHED) {
|
||||||
return true;
|
// launch math panel for right mouse button
|
||||||
|
bv->owner()->getDialogs().showMathPanel();
|
||||||
// launch math panel for right mouse button
|
}
|
||||||
bv->owner()->getDialogs().showMathPanel();
|
return DISPATCHED;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button == mouse_button::button1) {
|
if (cmd.button() == mouse_button::button1) {
|
||||||
// try to dispatch to enclosed insets first
|
// try to dispatch to enclosed insets first
|
||||||
if (mathcursor->dispatch(FuncRequest(bv, LFUN_MOUSE_RELEASE, x, y, 1)))
|
mathcursor->dispatch(cmd);
|
||||||
return true;
|
|
||||||
|
|
||||||
// try to set the cursor
|
// try to set the cursor
|
||||||
//delete mathcursor;
|
//delete mathcursor;
|
||||||
//mathcursor = new MathCursor(this, x == 0);
|
//mathcursor = new MathCursor(this, x == 0);
|
||||||
//metrics(bv);
|
//metrics(bv);
|
||||||
//mathcursor->setPos(x + xo_, y + yo_);
|
//mathcursor->setPos(x + xo_, y + yo_);
|
||||||
return true;
|
return DISPATCHED;
|
||||||
}
|
}
|
||||||
return false;
|
return UNDISPATCHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetFormulaBase::insetButtonPress(BufferView * bv,
|
Inset::RESULT InsetFormulaBase::lfunMousePress(FuncRequest const & cmd)
|
||||||
int x, int y, mouse_button::state button)
|
|
||||||
{
|
{
|
||||||
//lyxerr << "insetButtonPress: "
|
BufferView * bv = cmd.view();
|
||||||
// << x << " " << y << " but: " << button << "\n";
|
|
||||||
//lyxerr << "formula: ";
|
|
||||||
//par()->dump();
|
|
||||||
|
|
||||||
releaseMathCursor(bv);
|
releaseMathCursor(bv);
|
||||||
mathcursor = new MathCursor(this, x == 0);
|
mathcursor = new MathCursor(this, cmd.x == 0);
|
||||||
|
|
||||||
if (button == mouse_button::button1) {
|
if (cmd.button() == mouse_button::button1) {
|
||||||
// just set the cursor here
|
// just set the cursor here
|
||||||
//lyxerr << "setting cursor\n";
|
//lyxerr << "setting cursor\n";
|
||||||
metrics(bv);
|
metrics(bv);
|
||||||
first_x = x;
|
first_x = cmd.x;
|
||||||
first_y = y;
|
first_y = cmd.y;
|
||||||
mathcursor->selClear();
|
mathcursor->selClear();
|
||||||
mathcursor->setPos(x + xo_, y + yo_);
|
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
|
||||||
|
mathcursor->dispatch(cmd);
|
||||||
if (mathcursor->dispatch(FuncRequest(bv, LFUN_MOUSE_PRESS, x, y, 1))) {
|
return DISPATCHED;
|
||||||
//delete mathcursor;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (button == mouse_button::button3) {
|
if (cmd.button() == mouse_button::button3) {
|
||||||
if (mathcursor->dispatch(FuncRequest(bv, LFUN_MOUSE_PRESS, x, y, 3))) {
|
mathcursor->dispatch(cmd);
|
||||||
//delete mathcursor;
|
//delete mathcursor;
|
||||||
return;
|
return DISPATCHED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bv->updateInset(this, false);
|
bv->updateInset(this, false);
|
||||||
|
return DISPATCHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetFormulaBase::insetMotionNotify(BufferView * bv,
|
Inset::RESULT InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
|
||||||
int x, int y, mouse_button::state button)
|
|
||||||
{
|
{
|
||||||
if (!mathcursor)
|
if (!mathcursor)
|
||||||
return;
|
return DISPATCHED;
|
||||||
|
|
||||||
if (button == mouse_button::button1)
|
if (mathcursor->dispatch(FuncRequest(cmd)) != MathInset::UNDISPATCHED)
|
||||||
if (mathcursor->dispatch(FuncRequest(bv, LFUN_MOUSE_MOTION, x, y, 1)))
|
return DISPATCHED;
|
||||||
return;
|
|
||||||
|
|
||||||
if (button == mouse_button::button3)
|
if (abs(cmd.x - first_x) < 2 && abs(cmd.y - first_y) < 2) {
|
||||||
if (mathcursor->dispatch(FuncRequest(bv, LFUN_MOUSE_MOTION, x, y, 3)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (abs(x - first_x) < 2 && abs(y - first_y) < 2) {
|
|
||||||
//lyxerr << "insetMotionNotify: ignored\n";
|
//lyxerr << "insetMotionNotify: ignored\n";
|
||||||
return;
|
return DISPATCHED;
|
||||||
}
|
}
|
||||||
first_x = x;
|
first_x = cmd.x;
|
||||||
first_y = y;
|
first_y = cmd.y;
|
||||||
|
|
||||||
if (!mathcursor->selection())
|
if (!mathcursor->selection())
|
||||||
mathcursor->selStart();
|
mathcursor->selStart();
|
||||||
|
|
||||||
//lyxerr << "insetMotionNotify: " << x + xo_ << ' ' << y + yo_
|
BufferView * bv = cmd.view();
|
||||||
// << ' ' << button << "\n";
|
|
||||||
hideInsetCursor(bv);
|
hideInsetCursor(bv);
|
||||||
mathcursor->setPos(x + xo_, y + yo_);
|
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
|
||||||
showInsetCursor(bv);
|
showInsetCursor(bv);
|
||||||
bv->updateInset(this, false);
|
bv->updateInset(this, false);
|
||||||
|
return DISPATCHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT
|
Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
||||||
InsetFormulaBase::localDispatch(FuncRequest const & ev)
|
|
||||||
{
|
{
|
||||||
//lyxerr << "InsetFormulaBase::localDispatch: act: " << action
|
//lyxerr << "InsetFormulaBase::localDispatch: act: " << cmd.action
|
||||||
// << " arg: '" << arg
|
// << " arg: '" << cmd.argument
|
||||||
// << "' cursor: " << mathcursor << "\n";
|
// << " x: '" << cmd.x
|
||||||
|
// << " y: '" << cmd.y
|
||||||
|
// << "' button: " << cmd.button() << "\n";
|
||||||
|
|
||||||
|
switch (cmd.action) {
|
||||||
|
case LFUN_MOUSE_PRESS:
|
||||||
|
return lfunMousePress(cmd);
|
||||||
|
case LFUN_MOUSE_MOTION:
|
||||||
|
return lfunMouseMotion(cmd);
|
||||||
|
case LFUN_MOUSE_RELEASE:
|
||||||
|
return lfunMouseRelease(cmd);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mathcursor)
|
if (!mathcursor)
|
||||||
return UNDISPATCHED;
|
return UNDISPATCHED;
|
||||||
|
|
||||||
BufferView * bv = ev.view();
|
BufferView * bv = cmd.view();
|
||||||
string argument = ev.argument;
|
string argument = cmd.argument;
|
||||||
RESULT result = DISPATCHED;
|
RESULT result = DISPATCHED;
|
||||||
bool sel = false;
|
bool sel = false;
|
||||||
bool was_macro = mathcursor->inMacroMode();
|
bool was_macro = mathcursor->inMacroMode();
|
||||||
@ -414,7 +412,7 @@ InsetFormulaBase::localDispatch(FuncRequest const & ev)
|
|||||||
mathcursor->normalize();
|
mathcursor->normalize();
|
||||||
mathcursor->touch();
|
mathcursor->touch();
|
||||||
|
|
||||||
switch (ev.action) {
|
switch (cmd.action) {
|
||||||
|
|
||||||
case LFUN_MATH_MUTATE:
|
case LFUN_MATH_MUTATE:
|
||||||
case LFUN_MATH_DISPLAY:
|
case LFUN_MATH_DISPLAY:
|
||||||
@ -432,7 +430,7 @@ InsetFormulaBase::localDispatch(FuncRequest const & ev)
|
|||||||
case LFUN_INSERT_LABEL:
|
case LFUN_INSERT_LABEL:
|
||||||
case LFUN_MATH_EXTERN:
|
case LFUN_MATH_EXTERN:
|
||||||
bv->lockedInsetStoreUndo(Undo::EDIT);
|
bv->lockedInsetStoreUndo(Undo::EDIT);
|
||||||
mathcursor->dispatch(ev);
|
mathcursor->dispatch(cmd);
|
||||||
updateLocal(bv, true);
|
updateLocal(bv, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -528,7 +526,7 @@ InsetFormulaBase::localDispatch(FuncRequest const & ev)
|
|||||||
lyxerr << "LFUN_SETXY broken!\n";
|
lyxerr << "LFUN_SETXY broken!\n";
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
istringstream is(ev.argument.c_str());
|
istringstream is(cmd.argument.c_str());
|
||||||
is >> x >> y;
|
is >> x >> y;
|
||||||
mathcursor->setPos(x, y);
|
mathcursor->setPos(x, y);
|
||||||
updateLocal(bv, false);
|
updateLocal(bv, false);
|
||||||
@ -566,7 +564,7 @@ InsetFormulaBase::localDispatch(FuncRequest const & ev)
|
|||||||
// Special casing for superscript in case of LyX handling
|
// Special casing for superscript in case of LyX handling
|
||||||
// dead-keys:
|
// dead-keys:
|
||||||
case LFUN_CIRCUMFLEX:
|
case LFUN_CIRCUMFLEX:
|
||||||
if (ev.argument.empty()) {
|
if (cmd.argument.empty()) {
|
||||||
// do superscript if LyX handles
|
// do superscript if LyX handles
|
||||||
// deadkeys
|
// deadkeys
|
||||||
bv->lockedInsetStoreUndo(Undo::EDIT);
|
bv->lockedInsetStoreUndo(Undo::EDIT);
|
||||||
@ -592,28 +590,28 @@ InsetFormulaBase::localDispatch(FuncRequest const & ev)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// Math fonts
|
// Math fonts
|
||||||
case LFUN_GREEK_TOGGLE: handleFont(bv, ev.argument, "lyxgreek"); break;
|
case LFUN_GREEK_TOGGLE: handleFont(bv, cmd.argument, "lyxgreek"); break;
|
||||||
case LFUN_BOLD: handleFont(bv, ev.argument, "textbf"); break;
|
case LFUN_BOLD: handleFont(bv, cmd.argument, "textbf"); break;
|
||||||
case LFUN_SANS: handleFont(bv, ev.argument, "textsf"); break;
|
case LFUN_SANS: handleFont(bv, cmd.argument, "textsf"); break;
|
||||||
case LFUN_EMPH: handleFont(bv, ev.argument, "mathcal"); break;
|
case LFUN_EMPH: handleFont(bv, cmd.argument, "mathcal"); break;
|
||||||
case LFUN_ROMAN: handleFont(bv, ev.argument, "mathrm"); break;
|
case LFUN_ROMAN: handleFont(bv, cmd.argument, "mathrm"); break;
|
||||||
case LFUN_CODE: handleFont(bv, ev.argument, "texttt"); break;
|
case LFUN_CODE: handleFont(bv, cmd.argument, "texttt"); break;
|
||||||
case LFUN_FRAK: handleFont(bv, ev.argument, "mathfrak"); break;
|
case LFUN_FRAK: handleFont(bv, cmd.argument, "mathfrak"); break;
|
||||||
case LFUN_ITAL: handleFont(bv, ev.argument, "mathit"); break;
|
case LFUN_ITAL: handleFont(bv, cmd.argument, "mathit"); break;
|
||||||
case LFUN_NOUN: handleFont(bv, ev.argument, "mathbb"); break;
|
case LFUN_NOUN: handleFont(bv, cmd.argument, "mathbb"); break;
|
||||||
case LFUN_DEFAULT: handleFont(bv, ev.argument, "textnormal"); break;
|
case LFUN_DEFAULT: handleFont(bv, cmd.argument, "textnormal"); break;
|
||||||
case LFUN_FREE: handleFont(bv, ev.argument, "textrm"); break;
|
case LFUN_FREE: handleFont(bv, cmd.argument, "textrm"); break;
|
||||||
|
|
||||||
case LFUN_GREEK:
|
case LFUN_GREEK:
|
||||||
handleFont(bv, ev.argument, "lyxgreek1");
|
handleFont(bv, cmd.argument, "lyxgreek1");
|
||||||
if (ev.argument.size())
|
if (cmd.argument.size())
|
||||||
mathcursor->interpret(ev.argument);
|
mathcursor->interpret(cmd.argument);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_MATH_MODE:
|
case LFUN_MATH_MODE:
|
||||||
if (mathcursor->currentMode()) {
|
if (mathcursor->currentMode())
|
||||||
handleFont(bv, ev.argument, "textrm");
|
handleFont(bv, cmd.argument, "textrm");
|
||||||
} else {
|
else {
|
||||||
mathcursor->niceInsert(MathAtom(new MathHullInset("simple")));
|
mathcursor->niceInsert(MathAtom(new MathHullInset("simple")));
|
||||||
updateLocal(bv, true);
|
updateLocal(bv, true);
|
||||||
}
|
}
|
||||||
@ -637,9 +635,9 @@ InsetFormulaBase::localDispatch(FuncRequest const & ev)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_INSERT_MATRIX:
|
case LFUN_INSERT_MATRIX:
|
||||||
if (!ev.argument.empty()) {
|
if (!cmd.argument.empty()) {
|
||||||
bv->lockedInsetStoreUndo(Undo::EDIT);
|
bv->lockedInsetStoreUndo(Undo::EDIT);
|
||||||
mathcursor->interpret("matrix " + ev.argument);
|
mathcursor->interpret("matrix " + cmd.argument);
|
||||||
updateLocal(bv, true);
|
updateLocal(bv, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -648,7 +646,7 @@ InsetFormulaBase::localDispatch(FuncRequest const & ev)
|
|||||||
case LFUN_SUBSCRIPT:
|
case LFUN_SUBSCRIPT:
|
||||||
{
|
{
|
||||||
bv->lockedInsetStoreUndo(Undo::EDIT);
|
bv->lockedInsetStoreUndo(Undo::EDIT);
|
||||||
mathcursor->script(ev.action == LFUN_SUPERSCRIPT);
|
mathcursor->script(cmd.action == LFUN_SUPERSCRIPT);
|
||||||
updateLocal(bv, true);
|
updateLocal(bv, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -657,7 +655,7 @@ InsetFormulaBase::localDispatch(FuncRequest const & ev)
|
|||||||
{
|
{
|
||||||
//lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'\n";
|
//lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'\n";
|
||||||
string ls;
|
string ls;
|
||||||
string rs = split(ev.argument, ls, ' ');
|
string rs = split(cmd.argument, ls, ' ');
|
||||||
// Reasonable default values
|
// Reasonable default values
|
||||||
if (ls.empty())
|
if (ls.empty())
|
||||||
ls = '(';
|
ls = '(';
|
||||||
@ -743,13 +741,13 @@ InsetFormulaBase::localDispatch(FuncRequest const & ev)
|
|||||||
// updateInset(inset, true);
|
// updateInset(inset, true);
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
if (ev.argument.empty()) {
|
if (cmd.argument.empty()) {
|
||||||
InsetCommandParams p("ref");
|
InsetCommandParams p("ref");
|
||||||
bv->owner()->getDialogs().createRef(p.getAsString());
|
bv->owner()->getDialogs().createRef(p.getAsString());
|
||||||
} else {
|
} else {
|
||||||
//mathcursor->handleNest(new InsetRef2);
|
//mathcursor->handleNest(new InsetRef2);
|
||||||
//mathcursor->insert(arg);
|
//mathcursor->insert(arg);
|
||||||
mathcursor->insert(MathAtom(new RefInset(ev.argument)));
|
mathcursor->insert(MathAtom(new RefInset(cmd.argument)));
|
||||||
}
|
}
|
||||||
updateLocal(bv, true);
|
updateLocal(bv, true);
|
||||||
break;
|
break;
|
||||||
|
@ -78,12 +78,6 @@ public:
|
|||||||
///
|
///
|
||||||
virtual void toggleInsetSelection(BufferView * bv);
|
virtual void toggleInsetSelection(BufferView * bv);
|
||||||
///
|
///
|
||||||
virtual void insetButtonPress(BufferView *, int x, int y, mouse_button::state button);
|
|
||||||
///
|
|
||||||
virtual bool insetButtonRelease(BufferView *, int x, int y, mouse_button::state button);
|
|
||||||
///
|
|
||||||
virtual void insetMotionNotify(BufferView *, int x, int y, mouse_button::state state);
|
|
||||||
///
|
|
||||||
virtual void insetUnlock(BufferView *);
|
virtual void insetUnlock(BufferView *);
|
||||||
|
|
||||||
/// To allow transparent use of math editing functions
|
/// To allow transparent use of math editing functions
|
||||||
@ -115,7 +109,7 @@ public:
|
|||||||
///
|
///
|
||||||
virtual void revealCodes(BufferView *) const;
|
virtual void revealCodes(BufferView *) const;
|
||||||
///
|
///
|
||||||
virtual Inset::EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
virtual EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
||||||
///
|
///
|
||||||
bool display() const;
|
bool display() const;
|
||||||
|
|
||||||
@ -124,6 +118,12 @@ private:
|
|||||||
void operator=(const InsetFormulaBase &);
|
void operator=(const InsetFormulaBase &);
|
||||||
/// common base for handling accents
|
/// common base for handling accents
|
||||||
void handleAccent(BufferView * bv, string const & arg, string const & name);
|
void handleAccent(BufferView * bv, string const & arg, string const & name);
|
||||||
|
/// lfun handler
|
||||||
|
RESULT lfunMousePress(FuncRequest const &);
|
||||||
|
///
|
||||||
|
RESULT lfunMouseRelease(FuncRequest const &);
|
||||||
|
///
|
||||||
|
RESULT lfunMouseMotion(FuncRequest const &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///
|
///
|
||||||
|
@ -410,6 +410,8 @@ void MathHullInset::addRow(row_type row)
|
|||||||
|
|
||||||
void MathHullInset::delRow(row_type row)
|
void MathHullInset::delRow(row_type row)
|
||||||
{
|
{
|
||||||
|
if (nrows() <= 1)
|
||||||
|
return;
|
||||||
MathGridInset::delRow(row);
|
MathGridInset::delRow(row);
|
||||||
nonum_.erase(nonum_.begin() + row);
|
nonum_.erase(nonum_.begin() + row);
|
||||||
label_.erase(label_.begin() + row);
|
label_.erase(label_.begin() + row);
|
||||||
|
@ -318,9 +318,11 @@ MathInset::result_type MathNestInset::dispatch
|
|||||||
switch (cmd.action) {
|
switch (cmd.action) {
|
||||||
|
|
||||||
case LFUN_PASTE: {
|
case LFUN_PASTE: {
|
||||||
//lyxerr << "pasting '" << cmd.argument << "'\n";
|
lyxerr << "pasting '" << cmd.argument << "'\n";
|
||||||
MathArray ar;
|
MathArray ar;
|
||||||
mathed_parse_cell(ar, cmd.argument);
|
mathed_parse_cell(ar, cmd.argument);
|
||||||
|
lyxerr << "pasting '" << ar << "'\n";
|
||||||
|
lyxerr << "cell(idx) '" << cell(idx) << "'\n";
|
||||||
cell(idx).insert(pos, ar);
|
cell(idx).insert(pos, ar);
|
||||||
pos += ar.size();
|
pos += ar.size();
|
||||||
return DISPATCHED;
|
return DISPATCHED;
|
||||||
|
@ -36,16 +36,16 @@ void RefInset::infoize(std::ostream & os) const
|
|||||||
|
|
||||||
|
|
||||||
MathInset::result_type
|
MathInset::result_type
|
||||||
RefInset::dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
RefInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
|
||||||
{
|
{
|
||||||
switch (cmd.action) {
|
switch (cmd.action) {
|
||||||
case LFUN_MOUSE_RELEASE:
|
case LFUN_MOUSE_RELEASE:
|
||||||
if (cmd.extra == 3) {
|
if (cmd.button() == mouse_button::button3) {
|
||||||
lyxerr << "trying to goto ref" << cell(0) << "\n";
|
lyxerr << "trying to goto ref" << cell(0) << "\n";
|
||||||
cmd.view()->dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0))));
|
cmd.view()->dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0))));
|
||||||
return DISPATCHED;
|
return DISPATCHED;
|
||||||
}
|
}
|
||||||
if (cmd.extra == 1) {
|
if (cmd.button() == mouse_button::button1) {
|
||||||
lyxerr << "trying to open ref" << cell(0) << "\n";
|
lyxerr << "trying to open ref" << cell(0) << "\n";
|
||||||
// Eventually trigger dialog with button 3 not 1
|
// Eventually trigger dialog with button 3 not 1
|
||||||
// cmd.view()->owner()->getDialogs()->showRef(this);
|
// cmd.view()->owner()->getDialogs()->showRef(this);
|
||||||
@ -57,7 +57,7 @@ RefInset::dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
|||||||
// eat other mouse commands
|
// eat other mouse commands
|
||||||
return DISPATCHED;
|
return DISPATCHED;
|
||||||
default:
|
default:
|
||||||
break;
|
return CommandInset::dispatch(cmd, idx, pos);
|
||||||
}
|
}
|
||||||
// not our business
|
// not our business
|
||||||
return UNDISPATCHED;
|
return UNDISPATCHED;
|
||||||
|
Loading…
Reference in New Issue
Block a user