mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
the dispatch patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7931 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dab52aa183
commit
87ca6fbbeb
@ -188,6 +188,7 @@ src/mathed/ref_inset.C
|
||||
src/paragraph.C
|
||||
src/paragraph_funcs.C
|
||||
src/rowpainter.C
|
||||
src/support/path_defines.C
|
||||
src/text.C
|
||||
src/text2.C
|
||||
src/text3.C
|
||||
|
@ -1140,7 +1140,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
|
||||
// Note that the localDispatch performs updateInset
|
||||
// also.
|
||||
FuncRequest fr(bv_, LFUN_INSET_MODIFY, ev.argument);
|
||||
inset->localDispatch(fr);
|
||||
inset->dispatch(fr);
|
||||
} else {
|
||||
FuncRequest fr(bv_, LFUN_INSET_INSERT, ev.argument);
|
||||
dispatch(fr);
|
||||
|
@ -1,3 +1,11 @@
|
||||
2003-10-17 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* text3.C (doInsertInset, dispatch, dispatch):
|
||||
* text2.C (cursorUp, cursorDown):
|
||||
* text.C (selectNextWordToSpellcheck):
|
||||
* BufferView_pimpl.C (dispatch):
|
||||
* lyxfunc.C (dispatch): localDispatch -> dispatch
|
||||
|
||||
2003-10-14 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* lyxsocket.C: include <cerrno>
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "lyxfunc.h"
|
||||
#include "LyXAction.h"
|
||||
#include "funcrequest.h"
|
||||
|
||||
#include "frontends/LyXView.h"
|
||||
#include "support/lyxalgo.h"
|
||||
#include "support/lstrings.h"
|
||||
|
@ -45,6 +45,7 @@
|
||||
|
||||
using lyx::support::LibFileSearch;
|
||||
|
||||
using std::endl;
|
||||
using std::min;
|
||||
using std::max;
|
||||
using std::string;
|
||||
@ -316,6 +317,8 @@ void LyXScreen::redraw(BufferView & bv)
|
||||
LColor::bottomarea);
|
||||
}
|
||||
|
||||
lyxerr << "Redraw screen" << endl;
|
||||
|
||||
expose(0, 0, workarea().workWidth(), workarea().workHeight());
|
||||
|
||||
workarea().getPainter().end();
|
||||
|
@ -1,3 +1,10 @@
|
||||
2003-10-17 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* insetbase.C (dispatch): new func
|
||||
(priv_dispatch): new func replaces...
|
||||
(localDispatch): this, deleted.
|
||||
|
||||
* all insets with dispatch modified for new code.
|
||||
|
||||
2003-10-15 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -13,15 +13,23 @@
|
||||
#include "insetbase.h"
|
||||
|
||||
|
||||
dispatch_result InsetBase::dispatch(FuncRequest const &, idx_type &, pos_type &)
|
||||
dispatch_result
|
||||
InsetBase::dispatch(FuncRequest const & f, idx_type & i, pos_type & p)
|
||||
{
|
||||
return priv_dispatch(f, i, p);
|
||||
}
|
||||
|
||||
dispatch_result
|
||||
InsetBase::dispatch(FuncRequest const & f)
|
||||
{
|
||||
idx_type i = 0;
|
||||
pos_type p = 0;
|
||||
return priv_dispatch(f, i, p);
|
||||
}
|
||||
|
||||
|
||||
dispatch_result
|
||||
InsetBase::priv_dispatch(FuncRequest const &, idx_type &, pos_type &)
|
||||
{
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetBase::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
idx_type idx = 0;
|
||||
pos_type pos = 0;
|
||||
return dispatch(cmd, idx, pos);
|
||||
}
|
||||
|
@ -85,11 +85,12 @@ public:
|
||||
virtual std::auto_ptr<InsetBase> clone() const = 0;
|
||||
|
||||
// the real dispatcher
|
||||
virtual dispatch_result dispatch
|
||||
(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
|
||||
dispatch_result
|
||||
dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
|
||||
// the real dispatcher
|
||||
dispatch_result
|
||||
dispatch(FuncRequest const & cmd);
|
||||
|
||||
/// small wrapper for the time being
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
/// compute the size of the object returned in dim
|
||||
virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
|
||||
/// draw inset and update (xo, yo)-cache
|
||||
@ -100,6 +101,10 @@ public:
|
||||
/// Appends \c list with all labels found within this inset.
|
||||
virtual void getLabelList(Buffer const &,
|
||||
std::vector<std::string> & /* list */) const {}
|
||||
protected:
|
||||
// the real dispatcher
|
||||
virtual dispatch_result priv_dispatch
|
||||
(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -57,7 +57,9 @@ auto_ptr<InsetBase> InsetBibitem::clone() const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetBibitem::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
|
||||
@ -77,7 +79,7 @@ dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
default:
|
||||
return InsetCommand::localDispatch(cmd);
|
||||
return InsetCommand::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,6 @@ public:
|
||||
~InsetBibitem();
|
||||
///
|
||||
std::auto_ptr<InsetBase> clone() const;
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
/** Currently \bibitem is used as a LyX2.x command,
|
||||
so we need this method.
|
||||
*/
|
||||
@ -52,7 +50,11 @@ public:
|
||||
int getCounter() const { return counter; }
|
||||
///
|
||||
std::string const getBibLabel() const;
|
||||
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
private:
|
||||
///
|
||||
int counter;
|
||||
|
@ -87,7 +87,9 @@ void InsetBibtex::draw(PainterInfo & pi, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetBibtex::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
|
||||
@ -109,7 +111,7 @@ dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
default:
|
||||
return InsetCommand::localDispatch(cmd);
|
||||
return InsetCommand::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,8 +30,6 @@ public:
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
/// small wrapper for the time being
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
@ -50,6 +48,11 @@ public:
|
||||
bool addDatabase(std::string const &);
|
||||
///
|
||||
bool delDatabase(std::string const &);
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
};
|
||||
|
||||
#endif // INSET_BIBTEX_H
|
||||
|
@ -164,7 +164,9 @@ bool InsetBox::showInsetDialog(BufferView * bv) const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetBox::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetBox::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
BufferView * bv = cmd.view();
|
||||
|
||||
@ -188,7 +190,7 @@ dispatch_result InsetBox::localDispatch(FuncRequest const & cmd)
|
||||
// fallthrough:
|
||||
|
||||
default:
|
||||
return InsetCollapsable::localDispatch(cmd);
|
||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,8 +74,6 @@ public:
|
||||
///
|
||||
void setButtonLabel();
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const &);
|
||||
///
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
/// show the Box dialog
|
||||
bool showInsetDialog(BufferView * bv) const;
|
||||
@ -101,7 +99,11 @@ public:
|
||||
Shadowbox,
|
||||
Doublebox
|
||||
};
|
||||
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
|
||||
private:
|
||||
friend class InsetBoxParams;
|
||||
|
||||
|
@ -116,7 +116,9 @@ bool InsetBranch::showInsetDialog(BufferView * bv) const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetBranch::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetBranch::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
BufferView * bv = cmd.view();
|
||||
switch (cmd.action) {
|
||||
@ -131,7 +133,7 @@ dispatch_result InsetBranch::localDispatch(FuncRequest const & cmd)
|
||||
}
|
||||
case LFUN_INSET_EDIT:
|
||||
if (cmd.button() != mouse_button::button3)
|
||||
return InsetCollapsable::localDispatch(cmd);
|
||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
|
||||
return UNDISPATCHED;
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
@ -144,7 +146,7 @@ dispatch_result InsetBranch::localDispatch(FuncRequest const & cmd)
|
||||
}
|
||||
// fallthrough:
|
||||
default:
|
||||
return InsetCollapsable::localDispatch(cmd);
|
||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,6 @@ public:
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const &);
|
||||
///
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
@ -72,7 +70,11 @@ public:
|
||||
InsetBranchParams const & params() const { return params_; }
|
||||
///
|
||||
void setParams(InsetBranchParams const & params) { params_ = params; }
|
||||
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
|
||||
private:
|
||||
friend class InsetBranchParams;
|
||||
|
||||
|
@ -332,7 +332,9 @@ void InsetCitation::setLoadingBuffer(Buffer const & buffer, bool state) const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetCitation::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetCitation::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
@ -343,7 +345,7 @@ dispatch_result InsetCitation::localDispatch(FuncRequest const & cmd)
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
return InsetCommand::localDispatch(cmd);
|
||||
return InsetCommand::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,11 @@ public:
|
||||
and that the cache of BibTeX keys should be reloaded in the future.
|
||||
*/
|
||||
void setLoadingBuffer(Buffer const & buffer, bool state) const;
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
private:
|
||||
struct Cache {
|
||||
///
|
||||
|
@ -233,7 +233,7 @@ void InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
|
||||
bv->updateInset(this);
|
||||
bv->buffer()->markDirty();
|
||||
} else if (!collapsed_ && cmd.y > button_dim.y2) {
|
||||
ret = inset.localDispatch(adjustCommand(cmd)) == DISPATCHED;
|
||||
ret = inset.dispatch(adjustCommand(cmd)) == DISPATCHED;
|
||||
}
|
||||
if (cmd.button() == mouse_button::button3 && !ret)
|
||||
showInsetDialog(bv);
|
||||
@ -276,12 +276,14 @@ void InsetCollapsable::edit(BufferView * bv, int index)
|
||||
lyxerr << "InsetCollapsable: edit" << endl;
|
||||
if (!bv->lockInset(this))
|
||||
lyxerr << "InsetCollapsable: can't lock index " << index << endl;
|
||||
inset.localDispatch(FuncRequest(bv, LFUN_INSET_EDIT, "left"));
|
||||
inset.dispatch(FuncRequest(bv, LFUN_INSET_EDIT, "left"));
|
||||
first_after_edit = true;
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetCollapsable::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetCollapsable::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
//lyxerr << "InsetCollapsable::localDispatch: "
|
||||
// << cmd.action << " '" << cmd.argument << "'\n";
|
||||
@ -289,20 +291,20 @@ dispatch_result InsetCollapsable::localDispatch(FuncRequest const & cmd)
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT: {
|
||||
if (!cmd.argument.empty()) {
|
||||
UpdatableInset::localDispatch(cmd);
|
||||
UpdatableInset::priv_dispatch(cmd, idx, pos);
|
||||
if (collapsed_) {
|
||||
lyxerr << "branch collapsed_" << endl;
|
||||
collapsed_ = false;
|
||||
if (bv->lockInset(this)) {
|
||||
bv->updateInset(this);
|
||||
bv->buffer()->markDirty();
|
||||
inset.localDispatch(cmd);
|
||||
inset.dispatch(cmd);
|
||||
first_after_edit = true;
|
||||
}
|
||||
} else {
|
||||
lyxerr << "branch not collapsed_" << endl;
|
||||
if (bv->lockInset(this))
|
||||
inset.localDispatch(cmd);
|
||||
inset.dispatch(cmd);
|
||||
}
|
||||
return DISPATCHED;
|
||||
}
|
||||
@ -313,7 +315,7 @@ dispatch_result InsetCollapsable::localDispatch(FuncRequest const & cmd)
|
||||
if (cmd.button() == mouse_button::button3)
|
||||
return DISPATCHED;
|
||||
|
||||
UpdatableInset::localDispatch(cmd);
|
||||
UpdatableInset::priv_dispatch(cmd, idx, pos);
|
||||
|
||||
if (collapsed_) {
|
||||
collapsed_ = false;
|
||||
@ -324,28 +326,28 @@ dispatch_result InsetCollapsable::localDispatch(FuncRequest const & cmd)
|
||||
return DISPATCHED;
|
||||
bv->updateInset(this);
|
||||
bv->buffer()->markDirty();
|
||||
inset.localDispatch(cmd);
|
||||
inset.dispatch(cmd);
|
||||
} else {
|
||||
if (!bv->lockInset(this))
|
||||
return DISPATCHED;
|
||||
if (cmd.y <= button_dim.y2) {
|
||||
FuncRequest cmd1 = cmd;
|
||||
cmd1.y = 0;
|
||||
inset.localDispatch(cmd1);
|
||||
inset.dispatch(cmd1);
|
||||
} else
|
||||
inset.localDispatch(adjustCommand(cmd));
|
||||
inset.dispatch(adjustCommand(cmd));
|
||||
}
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
case LFUN_MOUSE_PRESS:
|
||||
if (!collapsed_ && cmd.y > button_dim.y2)
|
||||
inset.localDispatch(adjustCommand(cmd));
|
||||
inset.dispatch(adjustCommand(cmd));
|
||||
return DISPATCHED;
|
||||
|
||||
case LFUN_MOUSE_MOTION:
|
||||
if (!collapsed_ && cmd.y > button_dim.y2)
|
||||
inset.localDispatch(adjustCommand(cmd));
|
||||
inset.dispatch(adjustCommand(cmd));
|
||||
return DISPATCHED;
|
||||
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
@ -353,7 +355,7 @@ dispatch_result InsetCollapsable::localDispatch(FuncRequest const & cmd)
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
dispatch_result result = inset.localDispatch(cmd);
|
||||
dispatch_result result = inset.dispatch(cmd);
|
||||
if (result >= FINISHED)
|
||||
bv->unlockInset(this);
|
||||
first_after_edit = false;
|
||||
|
@ -68,8 +68,6 @@ public:
|
||||
///
|
||||
int insetInInsetY() const;
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const &);
|
||||
///
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
@ -149,6 +147,10 @@ public:
|
||||
void addPreview(lyx::graphics::PreviewLoader &) const;
|
||||
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
|
||||
///
|
||||
void dimension_collapsed(Dimension &) const;
|
||||
///
|
||||
|
@ -84,7 +84,8 @@ int InsetCommand::docbook(Buffer const &, ostream &, bool) const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetCommand::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
@ -103,7 +104,7 @@ dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd)
|
||||
return DISPATCHED;
|
||||
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
return localDispatch(FuncRequest(cmd.view(), LFUN_INSET_EDIT));
|
||||
return dispatch(FuncRequest(cmd.view(), LFUN_INSET_EDIT));
|
||||
|
||||
default:
|
||||
return UNDISPATCHED;
|
||||
|
@ -59,8 +59,6 @@ public:
|
||||
///
|
||||
InsetCommandParams const & params() const { return p_; }
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
std::string const & getContents() const { return p_.getContents(); }
|
||||
///
|
||||
void setContents(std::string const & c) { p_.setContents(c); }
|
||||
@ -70,6 +68,10 @@ public:
|
||||
RenderButton & button() const { return button_; }
|
||||
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
///
|
||||
std::string const getCommand() const { return p_.getCommand(); }
|
||||
///
|
||||
|
@ -280,9 +280,12 @@ InsetOld::EDITABLE InsetERT::editable() const
|
||||
void InsetERT::lfunMousePress(FuncRequest const & cmd)
|
||||
{
|
||||
if (status_ == Inlined)
|
||||
inset.localDispatch(cmd);
|
||||
else
|
||||
InsetCollapsable::localDispatch(cmd);
|
||||
inset.dispatch(cmd);
|
||||
else {
|
||||
idx_type idx = 0;
|
||||
pos_type pos = 0;
|
||||
InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -304,10 +307,10 @@ bool InsetERT::lfunMouseRelease(FuncRequest const & cmd)
|
||||
|
||||
// inlined is special - the text appears above
|
||||
if (status_ == Inlined)
|
||||
inset.localDispatch(cmd1);
|
||||
inset.dispatch(cmd1);
|
||||
else if (isOpen() && (cmd.y > buttonDim().y2)) {
|
||||
cmd1.y -= height_collapsed();
|
||||
inset.localDispatch(cmd1);
|
||||
inset.dispatch(cmd1);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -317,9 +320,12 @@ bool InsetERT::lfunMouseRelease(FuncRequest const & cmd)
|
||||
void InsetERT::lfunMouseMotion(FuncRequest const & cmd)
|
||||
{
|
||||
if (status_ == Inlined)
|
||||
inset.localDispatch(cmd);
|
||||
else
|
||||
InsetCollapsable::localDispatch(cmd);
|
||||
inset.dispatch(cmd);
|
||||
else {
|
||||
idx_type idx = 0;
|
||||
pos_type pos = 0;
|
||||
InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -415,7 +421,9 @@ int InsetERT::docbook(Buffer const &, ostream & os, bool) const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetERT::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetERT::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
dispatch_result result = UNDISPATCHED;
|
||||
BufferView * bv = cmd.view();
|
||||
@ -432,9 +440,9 @@ dispatch_result InsetERT::localDispatch(FuncRequest const & cmd)
|
||||
if (status_ == Inlined) {
|
||||
if (!bv->lockInset(this))
|
||||
break;
|
||||
result = inset.localDispatch(cmd);
|
||||
result = inset.dispatch(cmd);
|
||||
} else {
|
||||
result = InsetCollapsable::localDispatch(cmd);
|
||||
result = InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
set_latex_font(bv);
|
||||
updateStatus(bv);
|
||||
@ -479,7 +487,7 @@ dispatch_result InsetERT::localDispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
default:
|
||||
result = InsetCollapsable::localDispatch(cmd);
|
||||
result = InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
|
||||
switch (cmd.action) {
|
||||
|
@ -76,8 +76,6 @@ public:
|
||||
///
|
||||
void validate(LaTeXFeatures &) const {}
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const &);
|
||||
///
|
||||
bool checkInsertChar(LyXFont &);
|
||||
///
|
||||
// these are needed here because of the label/inlined functionallity
|
||||
@ -110,7 +108,11 @@ public:
|
||||
bool forceDefaultParagraphs(InsetOld const *) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
|
||||
private:
|
||||
///
|
||||
void lfunMousePress(FuncRequest const &);
|
||||
|
@ -387,7 +387,8 @@ void InsetExternal::statusChanged() const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetExternal::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetExternal::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
|
||||
|
@ -92,9 +92,6 @@ public:
|
||||
virtual ~InsetExternal();
|
||||
///
|
||||
virtual std::auto_ptr<InsetBase> clone() const;
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
|
||||
///
|
||||
virtual InsetOld::Code lyxCode() const { return EXTERNAL_CODE; }
|
||||
///
|
||||
@ -126,7 +123,11 @@ public:
|
||||
///
|
||||
InsetExternalParams const & params() const;
|
||||
void setParams(InsetExternalParams const &, Buffer const &);
|
||||
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
private:
|
||||
/** This method is connected to the graphics loader, so we are
|
||||
* informed when the image has been loaded.
|
||||
|
@ -159,7 +159,9 @@ InsetFloat::~InsetFloat()
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetFloat::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
|
||||
@ -181,7 +183,7 @@ dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
default:
|
||||
return InsetCollapsable::localDispatch(cmd);
|
||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,8 +45,6 @@ public:
|
||||
///
|
||||
~InsetFloat();
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
void write(Buffer const & buf, std::ostream & os) const;
|
||||
///
|
||||
void read(Buffer const & buf, LyXLex & lex);
|
||||
@ -79,7 +77,10 @@ public:
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
InsetFloatParams const & params() const { return params_; }
|
||||
|
||||
protected:
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
private:
|
||||
///
|
||||
InsetFloatParams params_;
|
||||
|
@ -118,7 +118,9 @@ void InsetFloatList::draw(PainterInfo & pi, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetFloatList::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetFloatList::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
@ -131,7 +133,7 @@ dispatch_result InsetFloatList::localDispatch(FuncRequest const & cmd)
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
return InsetCommand::localDispatch(cmd);
|
||||
return InsetCommand::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,6 @@ public:
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
@ -56,6 +54,11 @@ public:
|
||||
int ascii(Buffer const &, std::ostream &, int linelen) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -190,7 +190,8 @@ void InsetGraphics::statusChanged() const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetGraphics::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
|
@ -33,8 +33,6 @@ public:
|
||||
///
|
||||
~InsetGraphics();
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
///
|
||||
EDITABLE editable() const;
|
||||
@ -76,7 +74,11 @@ public:
|
||||
InsetGraphicsParams const & params() const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
private:
|
||||
///
|
||||
friend class InsetGraphicsMailer;
|
||||
|
@ -107,7 +107,8 @@ InsetInclude::~InsetInclude()
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetInclude::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetInclude::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
|
||||
|
@ -34,9 +34,6 @@ public:
|
||||
///
|
||||
virtual std::auto_ptr<InsetBase> clone() const;
|
||||
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
|
||||
/// Override these InsetButton methods if Previewing
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
@ -78,7 +75,11 @@ public:
|
||||
void validate(LaTeXFeatures &) const;
|
||||
///
|
||||
void addPreview(lyx::graphics::PreviewLoader &) const;
|
||||
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
private:
|
||||
/// Slot receiving a signal that the preview is ready to display.
|
||||
void statusChanged() const;
|
||||
|
@ -60,7 +60,9 @@ void InsetPrintIndex::draw(PainterInfo & pi, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetIndex::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetIndex::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
@ -68,7 +70,7 @@ dispatch_result InsetIndex::localDispatch(FuncRequest const & cmd)
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
return InsetCommand::localDispatch(cmd);
|
||||
return InsetCommand::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,6 @@ public:
|
||||
return std::auto_ptr<InsetBase>(new InsetIndex(params()));
|
||||
}
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
@ -39,6 +37,11 @@ public:
|
||||
InsetOld::Code lyxCode() const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
};
|
||||
|
||||
|
||||
@ -52,8 +55,6 @@ public:
|
||||
virtual std::auto_ptr<InsetBase> clone() const {
|
||||
return std::auto_ptr<InsetBase>(new InsetPrintIndex(params()));
|
||||
}
|
||||
///
|
||||
//dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
/// Updates needed features for this inset.
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
|
@ -56,7 +56,9 @@ string const InsetLabel::getScreenLabel(Buffer const &) const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetLabel::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
BOOST_ASSERT(cmd.view());
|
||||
BufferView * const bv = cmd.view();
|
||||
@ -86,7 +88,7 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
default:
|
||||
return InsetCommand::localDispatch(cmd);
|
||||
return InsetCommand::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,6 @@ public:
|
||||
///
|
||||
std::auto_ptr<InsetBase> clone() const;
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
@ -41,6 +39,11 @@ public:
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -95,7 +95,9 @@ InsetMinipage::~InsetMinipage()
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetMinipage::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
@ -117,7 +119,7 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
return InsetCollapsable::localDispatch(cmd);
|
||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,6 @@ public:
|
||||
///
|
||||
~InsetMinipage();
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
void write(Buffer const & buf, std::ostream & os) const;
|
||||
///
|
||||
void read(Buffer const & buf, LyXLex & lex);
|
||||
@ -90,6 +88,11 @@ public:
|
||||
void params(Params const & p) { params_ = p; }
|
||||
///
|
||||
Params const & params() const { return params_; }
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
private:
|
||||
///
|
||||
Params params_;
|
||||
|
@ -129,7 +129,9 @@ bool InsetNote::showInsetDialog(BufferView * bv) const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetNote::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetNote::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
BufferView * bv = cmd.view();
|
||||
|
||||
@ -145,7 +147,7 @@ dispatch_result InsetNote::localDispatch(FuncRequest const & cmd)
|
||||
case LFUN_INSET_EDIT:
|
||||
if (cmd.button() == mouse_button::button3)
|
||||
return UNDISPATCHED;
|
||||
return InsetCollapsable::localDispatch(cmd);
|
||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
InsetNoteMailer("note", *this).updateDialog(bv);
|
||||
@ -159,7 +161,7 @@ dispatch_result InsetNote::localDispatch(FuncRequest const & cmd)
|
||||
// fallthrough:
|
||||
|
||||
default:
|
||||
return InsetCollapsable::localDispatch(cmd);
|
||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,8 +52,6 @@ public:
|
||||
///
|
||||
void setButtonLabel();
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const &);
|
||||
///
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
/// show the note dialog
|
||||
bool showInsetDialog(BufferView * bv) const;
|
||||
@ -70,7 +68,11 @@ public:
|
||||
void validate(LaTeXFeatures &) const;
|
||||
///
|
||||
InsetNoteParams const & params() const { return params_; }
|
||||
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
|
||||
private:
|
||||
friend class InsetNoteParams;
|
||||
|
||||
@ -80,6 +82,7 @@ private:
|
||||
InsetNoteParams params_;
|
||||
};
|
||||
|
||||
|
||||
#include "mailinset.h"
|
||||
|
||||
class InsetNoteMailer : public MailInset {
|
||||
|
@ -45,7 +45,8 @@ InsetRef::~InsetRef()
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetRef::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetRef::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
@ -58,7 +59,7 @@ dispatch_result InsetRef::localDispatch(FuncRequest const & cmd)
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
return InsetCommand::localDispatch(cmd);
|
||||
return InsetCommand::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,6 @@ public:
|
||||
return std::auto_ptr<InsetBase>(new InsetRef(*this));
|
||||
}
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
@ -66,6 +64,11 @@ public:
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
private:
|
||||
///
|
||||
bool isLatex;
|
||||
|
@ -451,7 +451,7 @@ bool InsetTabular::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
|
||||
}
|
||||
if (in->getInsetFromID(id)) {
|
||||
actcell = i;
|
||||
in->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||
in->dispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||
return the_locking_inset->lockInsetInInset(bv, inset);
|
||||
}
|
||||
}
|
||||
@ -567,7 +567,7 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
|
||||
FuncRequest cmd1 = cmd;
|
||||
cmd1.x -= inset_x;
|
||||
cmd1.y -= inset_y;
|
||||
the_locking_inset->localDispatch(cmd1);
|
||||
the_locking_inset->dispatch(cmd1);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -578,7 +578,7 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
if (cmd.button() == mouse_button::button2) {
|
||||
localDispatch(FuncRequest(bv, LFUN_PASTESELECTION, "paragraph"));
|
||||
dispatch(FuncRequest(bv, LFUN_PASTESELECTION, "paragraph"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -590,7 +590,7 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
|
||||
FuncRequest cmd1 = cmd;
|
||||
cmd1.x -= inset_x;
|
||||
cmd1.y -= inset_y;
|
||||
the_locking_inset->localDispatch(cmd1);
|
||||
the_locking_inset->dispatch(cmd1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -602,7 +602,7 @@ bool InsetTabular::lfunMouseRelease(FuncRequest const & cmd)
|
||||
FuncRequest cmd1 = cmd;
|
||||
cmd1.x -= inset_x;
|
||||
cmd1.y -= inset_y;
|
||||
ret = the_locking_inset->localDispatch(cmd1);
|
||||
ret = the_locking_inset->dispatch(cmd1);
|
||||
}
|
||||
if (cmd.button() == mouse_button::button3 && !ret) {
|
||||
InsetTabularMailer(*this).showDialog(cmd.view());
|
||||
@ -618,7 +618,7 @@ void InsetTabular::lfunMouseMotion(FuncRequest const & cmd)
|
||||
FuncRequest cmd1 = cmd;
|
||||
cmd1.x -= inset_x;
|
||||
cmd1.y -= inset_y;
|
||||
the_locking_inset->localDispatch(cmd1);
|
||||
the_locking_inset->dispatch(cmd1);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -654,18 +654,20 @@ void InsetTabular::edit(BufferView * bv, int index)
|
||||
bv->fitCursor();
|
||||
|
||||
UpdatableInset & inset = tabular.getCellInset(actcell);
|
||||
inset.localDispatch(FuncRequest(bv, LFUN_INSET_EDIT, "left"));
|
||||
inset.dispatch(FuncRequest(bv, LFUN_INSET_EDIT, "left"));
|
||||
if (the_locking_inset)
|
||||
updateLocal(bv);
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetTabular::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetTabular::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
// We need to save the value of the_locking_inset as the call to
|
||||
// the_locking_inset->localDispatch might unlock it.
|
||||
old_locking_inset = the_locking_inset;
|
||||
dispatch_result result = UpdatableInset::localDispatch(cmd);
|
||||
dispatch_result result = UpdatableInset::priv_dispatch(cmd, idx, pos);
|
||||
BufferView * bv = cmd.view();
|
||||
|
||||
if (cmd.action == LFUN_INSET_EDIT) {
|
||||
@ -763,7 +765,7 @@ dispatch_result InsetTabular::localDispatch(FuncRequest const & cmd)
|
||||
kb_action action = cmd.action;
|
||||
string arg = cmd.argument;
|
||||
if (the_locking_inset) {
|
||||
result = the_locking_inset->localDispatch(cmd);
|
||||
result = the_locking_inset->dispatch(cmd);
|
||||
if (result == DISPATCHED_NOUPDATE) {
|
||||
int sc = scroll();
|
||||
resetPos(bv);
|
||||
@ -1094,7 +1096,7 @@ dispatch_result InsetTabular::localDispatch(FuncRequest const & cmd)
|
||||
if (result == DISPATCHED || the_locking_inset)
|
||||
break;
|
||||
if (activateCellInset(bv)) {
|
||||
result = the_locking_inset->localDispatch(FuncRequest(bv, action, arg));
|
||||
result = the_locking_inset->dispatch(FuncRequest(bv, action, arg));
|
||||
if (result == UNDISPATCHED || result >= FINISHED) {
|
||||
unlockInsetInInset(bv, the_locking_inset);
|
||||
// we need to update if this was requested before
|
||||
@ -1599,7 +1601,7 @@ void checkLongtableSpecial(LyXTabular::ltType & ltt,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // anon namespace
|
||||
|
||||
|
||||
void InsetTabular::tabularFeatures(BufferView * bv,
|
||||
@ -1983,7 +1985,7 @@ bool InsetTabular::activateCellInset(BufferView * bv, int x, int y,
|
||||
}
|
||||
//inset_x = cursorx_ - top_x + tabular.getBeginningOfTextInCell(actcell);
|
||||
//inset_y = cursory_;
|
||||
inset.localDispatch(FuncRequest(bv, LFUN_INSET_EDIT, x, y, button));
|
||||
inset.dispatch(FuncRequest(bv, LFUN_INSET_EDIT, x, y, button));
|
||||
if (!the_locking_inset)
|
||||
return false;
|
||||
updateLocal(bv);
|
||||
@ -2416,7 +2418,7 @@ WordLangTuple const
|
||||
InsetTabular::selectNextWordToSpellcheck(BufferView * bv, float & value) const
|
||||
{
|
||||
if (the_locking_inset) {
|
||||
WordLangTuple word =
|
||||
WordLangTuple word =
|
||||
the_locking_inset->selectNextWordToSpellcheck(bv, value);
|
||||
if (!word.word().empty())
|
||||
return word;
|
||||
@ -2428,7 +2430,7 @@ InsetTabular::selectNextWordToSpellcheck(BufferView * bv, float & value) const
|
||||
}
|
||||
// otherwise we have to lock the next inset and ask for it's selecttion
|
||||
tabular.getCellInset(actcell)
|
||||
.localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||
.dispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||
WordLangTuple word = selectNextWordInt(bv, value);
|
||||
if (!word.word().empty())
|
||||
resetPos(bv);
|
||||
@ -2454,7 +2456,7 @@ WordLangTuple InsetTabular::selectNextWordInt(BufferView * bv, float & value) co
|
||||
// otherwise we have to lock the next inset and ask for it's selecttion
|
||||
++actcell;
|
||||
tabular.getCellInset(actcell)
|
||||
.localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||
.dispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
||||
return selectNextWordInt(bv, value);
|
||||
}
|
||||
|
||||
@ -2575,7 +2577,7 @@ bool InsetTabular::forceDefaultParagraphs(InsetOld const * in) const
|
||||
|
||||
// this is a workaround for a crash (New, Insert->Tabular,
|
||||
// Insert->FootNote)
|
||||
if (!owner())
|
||||
if (!owner())
|
||||
return false;
|
||||
|
||||
// well we didn't obviously find it so maybe our owner knows more
|
||||
|
@ -105,8 +105,6 @@ public:
|
||||
///
|
||||
bool display() const { return tabular.isLongTabular(); }
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const &);
|
||||
///
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
@ -206,7 +204,11 @@ public:
|
||||
|
||||
/// set the owning buffer
|
||||
void buffer(Buffer * buf);
|
||||
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
|
||||
private:
|
||||
/// lock cell with given index
|
||||
void edit(BufferView * bv, int index);
|
||||
|
@ -477,7 +477,7 @@ void InsetText::lfunMousePress(FuncRequest const & cmd)
|
||||
|
||||
if (the_locking_inset) {
|
||||
if (the_locking_inset == inset) {
|
||||
the_locking_inset->localDispatch(cmd1);
|
||||
the_locking_inset->dispatch(cmd1);
|
||||
return;
|
||||
}
|
||||
// otherwise only unlock the_locking_inset
|
||||
@ -495,7 +495,7 @@ void InsetText::lfunMousePress(FuncRequest const & cmd)
|
||||
if (!bv->lockInset(uinset)) {
|
||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||
}
|
||||
inset->localDispatch(cmd1);
|
||||
inset->dispatch(cmd1);
|
||||
if (the_locking_inset)
|
||||
updateLocal(bv, false);
|
||||
return;
|
||||
@ -504,7 +504,7 @@ void InsetText::lfunMousePress(FuncRequest const & cmd)
|
||||
if (!inset) {
|
||||
bool paste_internally = false;
|
||||
if (cmd.button() == mouse_button::button2 && getLyXText(bv)->selection.set()) {
|
||||
localDispatch(FuncRequest(bv, LFUN_COPY));
|
||||
dispatch(FuncRequest(bv, LFUN_COPY));
|
||||
paste_internally = true;
|
||||
}
|
||||
int old_top_y = bv->top_y();
|
||||
@ -528,9 +528,9 @@ void InsetText::lfunMousePress(FuncRequest const & cmd)
|
||||
// insert this
|
||||
if (cmd.button() == mouse_button::button2) {
|
||||
if (paste_internally)
|
||||
localDispatch(FuncRequest(bv, LFUN_PASTE));
|
||||
dispatch(FuncRequest(bv, LFUN_PASTE));
|
||||
else
|
||||
localDispatch(FuncRequest(bv, LFUN_PASTESELECTION, "paragraph"));
|
||||
dispatch(FuncRequest(bv, LFUN_PASTESELECTION, "paragraph"));
|
||||
}
|
||||
} else {
|
||||
getLyXText(bv)->clearSelection();
|
||||
@ -547,7 +547,7 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
|
||||
|
||||
no_selection = true;
|
||||
if (the_locking_inset)
|
||||
return the_locking_inset->localDispatch(cmd1);
|
||||
return the_locking_inset->dispatch(cmd1);
|
||||
|
||||
int tmp_x = cmd.x;
|
||||
int tmp_y = cmd.y + dim_.asc - bv->top_y();
|
||||
@ -557,7 +557,7 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
|
||||
|
||||
// We still need to deal properly with the whole relative vs.
|
||||
// absolute mouse co-ords thing in a realiable, sensible way
|
||||
bool ret = inset->localDispatch(cmd1);
|
||||
bool ret = inset->dispatch(cmd1);
|
||||
updateLocal(bv, false);
|
||||
return ret;
|
||||
}
|
||||
@ -570,7 +570,7 @@ void InsetText::lfunMouseMotion(FuncRequest const & cmd)
|
||||
cmd1.y -= inset_y;
|
||||
|
||||
if (the_locking_inset) {
|
||||
the_locking_inset->localDispatch(cmd1);
|
||||
the_locking_inset->dispatch(cmd1);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -588,14 +588,16 @@ void InsetText::lfunMouseMotion(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetText::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetText::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
BufferView * bv = cmd.view();
|
||||
setViewCache(bv);
|
||||
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT: {
|
||||
UpdatableInset::localDispatch(cmd);
|
||||
UpdatableInset::priv_dispatch(cmd, idx, pos);
|
||||
|
||||
if (!bv->lockInset(this)) {
|
||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||
@ -668,7 +670,7 @@ dispatch_result InsetText::localDispatch(FuncRequest const & cmd)
|
||||
bool was_empty = paragraphs.begin()->empty() && paragraphs.size() == 1;
|
||||
no_selection = false;
|
||||
|
||||
dispatch_result result = UpdatableInset::localDispatch(cmd);
|
||||
dispatch_result result = UpdatableInset::priv_dispatch(cmd, idx, pos);
|
||||
if (result != UNDISPATCHED)
|
||||
return DISPATCHED;
|
||||
|
||||
@ -677,7 +679,7 @@ dispatch_result InsetText::localDispatch(FuncRequest const & cmd)
|
||||
return FINISHED;
|
||||
|
||||
if (the_locking_inset) {
|
||||
result = the_locking_inset->localDispatch(cmd);
|
||||
result = the_locking_inset->dispatch(cmd);
|
||||
if (result == DISPATCHED_NOUPDATE)
|
||||
return result;
|
||||
if (result == DISPATCHED) {
|
||||
@ -1363,7 +1365,7 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool front)
|
||||
if (!isHighlyEditableInset(inset))
|
||||
return false;
|
||||
FuncRequest cmd(bv, LFUN_INSET_EDIT, front ? "left" : "right");
|
||||
inset->localDispatch(cmd);
|
||||
inset->dispatch(cmd);
|
||||
if (!the_locking_inset)
|
||||
return false;
|
||||
updateLocal(bv, false);
|
||||
@ -1394,7 +1396,7 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
|
||||
inset_x = cx() - top_x;
|
||||
inset_y = cy();
|
||||
FuncRequest cmd(bv, LFUN_INSET_EDIT, x - inset_x, y - inset_y, button);
|
||||
inset->localDispatch(cmd);
|
||||
inset->dispatch(cmd);
|
||||
if (!the_locking_inset)
|
||||
return false;
|
||||
updateLocal(bv, false);
|
||||
|
@ -80,8 +80,6 @@ public:
|
||||
bool unlockInsetInInset(BufferView *,
|
||||
UpdatableInset *, bool lr = false);
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const &);
|
||||
///
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
///
|
||||
@ -202,6 +200,10 @@ public:
|
||||
///
|
||||
mutable ParagraphList paragraphs;
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
|
||||
///
|
||||
void updateLocal(BufferView *, bool mark_dirty);
|
||||
/// set parameters for an initial lock of this inset
|
||||
|
@ -71,7 +71,9 @@ void InsetTOC::draw(PainterInfo & pi, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetTOC::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetTOC::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
@ -84,7 +86,7 @@ dispatch_result InsetTOC::localDispatch(FuncRequest const & cmd)
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
return InsetCommand::localDispatch(cmd);
|
||||
return InsetCommand::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,6 @@ public:
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
@ -48,6 +46,11 @@ public:
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -43,14 +43,16 @@ InsetUrl::~InsetUrl()
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetUrl::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetUrl::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_EDIT:
|
||||
InsetCommandMailer("url", *this).showDialog(cmd.view());
|
||||
return DISPATCHED;
|
||||
default:
|
||||
return InsetCommand::localDispatch(cmd);
|
||||
return InsetCommand::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,6 @@ public:
|
||||
return std::auto_ptr<InsetBase>(new InsetUrl(params()));
|
||||
}
|
||||
///
|
||||
dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
InsetOld::Code lyxCode() const { return InsetOld::URL_CODE; }
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
@ -51,6 +49,11 @@ public:
|
||||
int linuxdoc(Buffer const &, std::ostream &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &, bool mixcont) const;
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -83,7 +83,9 @@ InsetWrap::~InsetWrap()
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetWrap::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetWrap::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
@ -102,7 +104,7 @@ dispatch_result InsetWrap::localDispatch(FuncRequest const & cmd)
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
return InsetCollapsable::localDispatch(cmd);
|
||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,6 @@ public:
|
||||
///
|
||||
~InsetWrap();
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
void write(Buffer const & buf, std::ostream & os) const;
|
||||
///
|
||||
void read(Buffer const & buf, LyXLex & lex);
|
||||
@ -70,6 +68,11 @@ public:
|
||||
int latexTextWidth(BufferView *) const;
|
||||
///
|
||||
InsetWrapParams const & params() const { return params_; }
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
private:
|
||||
///
|
||||
InsetWrapParams params_;
|
||||
|
@ -108,7 +108,8 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const
|
||||
|
||||
|
||||
/// An updatable inset could handle lyx editing commands
|
||||
dispatch_result UpdatableInset::localDispatch(FuncRequest const & ev)
|
||||
dispatch_result
|
||||
UpdatableInset::priv_dispatch(FuncRequest const & ev, idx_type &, pos_type &)
|
||||
{
|
||||
if (ev.action == LFUN_MOUSE_RELEASE)
|
||||
return (editable() == IS_EDITABLE) ? DISPATCHED : UNDISPATCHED;
|
||||
|
@ -81,8 +81,6 @@ public:
|
||||
virtual bool unlockInsetInInset(BufferView *, UpdatableInset *,
|
||||
bool /*lr*/ = false)
|
||||
{ return false; }
|
||||
/// An updatable inset could handle lyx editing commands
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
// We need this method to not clobber the real method in Inset
|
||||
int scroll(bool recursive = true) const
|
||||
{ return InsetOld::scroll(recursive); }
|
||||
@ -113,6 +111,10 @@ public:
|
||||
bool = true, bool = false);
|
||||
|
||||
protected:
|
||||
/// An updatable inset could handle lyx editing commands
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
/// scrolls to absolute position in bufferview-workwidth * sx units
|
||||
void scroll(BufferView *, float sx) const;
|
||||
/// scrolls offset pixels
|
||||
|
@ -317,7 +317,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
|
||||
} else {
|
||||
// no
|
||||
setStatusMessage(N_("Command not allowed with"
|
||||
"out any document open"));
|
||||
"out any document open"));
|
||||
return flag.disabled(true);
|
||||
}
|
||||
}
|
||||
@ -931,7 +931,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
||||
}
|
||||
|
||||
// Hand-over to inset's own dispatch:
|
||||
result = inset->localDispatch(FuncRequest(view(), action, argument));
|
||||
result = inset->dispatch(FuncRequest(view(), action, argument));
|
||||
if (result == DISPATCHED || result == DISPATCHED_NOUPDATE) {
|
||||
goto exit_with_message;
|
||||
}
|
||||
@ -1409,7 +1409,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
||||
view()->unlockInset(view()->theLockingInset());
|
||||
if (par->inInset()) {
|
||||
FuncRequest cmd(view(), LFUN_INSET_EDIT, "left");
|
||||
par->inInset()->localDispatch(cmd);
|
||||
par->inInset()->dispatch(cmd);
|
||||
}
|
||||
// Set the cursor
|
||||
view()->getLyXText()->setCursor(par.pit(), 0);
|
||||
@ -1498,7 +1498,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
||||
InsetOld * inset = lt->getInset();
|
||||
if (inset) {
|
||||
FuncRequest cmd(view(), LFUN_INSET_DIALOG_SHOW);
|
||||
inset->localDispatch(cmd);
|
||||
inset->dispatch(cmd);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1510,7 +1510,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
||||
if (inset) {
|
||||
FuncRequest fr(view(), LFUN_INSET_DIALOG_UPDATE,
|
||||
func.argument);
|
||||
inset->localDispatch(fr);
|
||||
inset->dispatch(fr);
|
||||
} else if (name == "paragraph") {
|
||||
dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
|
||||
}
|
||||
@ -1647,7 +1647,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
||||
break;
|
||||
|
||||
case LFUN_EXTERNAL_EDIT: {
|
||||
InsetExternal().localDispatch(FuncRequest(view(), action, argument));
|
||||
InsetExternal().dispatch(FuncRequest(view(), action, argument));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,16 @@
|
||||
2003-10-17 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* ref_inset.C (priv_dispatch): take the code from localDispatch
|
||||
into this
|
||||
(localDispatch): delete
|
||||
|
||||
* math_nestinset.C (dispatch):
|
||||
* math_hullinset.C (dispatch):
|
||||
* math_gridinset.C (dispatch):
|
||||
* formulabase.C (openNewInset, priv_dispatch, mathDispatch):
|
||||
* command_inset.C (dispatch): adjust for localDispatch -> dispatch and
|
||||
priv_dispatch
|
||||
|
||||
2003-10-14 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetformulabase.[Ch] (view, cache, view_): remove the BufferView cache.
|
||||
@ -11,7 +24,7 @@
|
||||
|
||||
2003-10-13 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* formula.C (editing_inset): pass a pointer rather than a reference.
|
||||
* formula.C (editing_inset): pass a pointer rather than a reference.
|
||||
|
||||
2003-10-13 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
|
@ -57,7 +57,7 @@ CommandInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
default:
|
||||
return MathNestInset::dispatch(cmd, idx, pos);
|
||||
return MathNestInset::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ bool openNewInset(BufferView * bv, UpdatableInset * new_inset)
|
||||
delete new_inset;
|
||||
return false;
|
||||
}
|
||||
new_inset->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT, "left"));
|
||||
new_inset->dispatch(FuncRequest(bv, LFUN_INSET_EDIT, "left"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -316,7 +316,9 @@ dispatch_result InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
||||
dispatch_result
|
||||
InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
|
||||
idx_type &, pos_type &)
|
||||
{
|
||||
//lyxerr << "InsetFormulaBase::localDispatch: act: " << cmd.action
|
||||
// << " arg: '" << cmd.argument
|
||||
@ -359,7 +361,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
||||
return lfunMouseRelease(cmd);
|
||||
case LFUN_MOUSE_DOUBLE:
|
||||
//lyxerr << "Mouse double" << endl;
|
||||
return localDispatch(FuncRequest(LFUN_WORDSEL));
|
||||
return dispatch(FuncRequest(LFUN_WORDSEL));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -710,7 +712,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
||||
|
||||
if (base) {
|
||||
FuncRequest fr(bv, LFUN_INSET_MODIFY, cmd.argument);
|
||||
result = base->localDispatch(fr);
|
||||
result = base->dispatch(fr);
|
||||
} else {
|
||||
MathArray ar;
|
||||
if (createMathInset_fromDialogStr(cmd.argument, ar)) {
|
||||
@ -906,13 +908,13 @@ void mathDispatchCreation(FuncRequest const & cmd, bool display)
|
||||
InsetFormula * f = new InsetFormula(bv);
|
||||
if (openNewInset(bv, f)) {
|
||||
bv->theLockingInset()->
|
||||
localDispatch(FuncRequest(bv, LFUN_MATH_MUTATE, "simple"));
|
||||
dispatch(FuncRequest(bv, LFUN_MATH_MUTATE, "simple"));
|
||||
// don't do that also for LFUN_MATH_MODE unless you want end up with
|
||||
// always changing to mathrm when opening an inlined inset
|
||||
// -- I really hate "LyXfunc overloading"...
|
||||
if (display)
|
||||
f->localDispatch(FuncRequest(bv, LFUN_MATH_DISPLAY));
|
||||
f->localDispatch(FuncRequest(bv, LFUN_INSERT_MATH, cmd.argument));
|
||||
f->dispatch(FuncRequest(bv, LFUN_MATH_DISPLAY));
|
||||
f->dispatch(FuncRequest(bv, LFUN_INSERT_MATH, cmd.argument));
|
||||
}
|
||||
} else {
|
||||
// create a macro if we see "\\newcommand" somewhere, and an ordinary
|
||||
@ -969,8 +971,8 @@ void mathDispatch(FuncRequest const & cmd)
|
||||
InsetFormula * f = new InsetFormula(bv);
|
||||
if (openNewInset(bv, f)) {
|
||||
bv->theLockingInset()->
|
||||
localDispatch(FuncRequest(bv, LFUN_MATH_MUTATE, "simple"));
|
||||
bv->theLockingInset()->localDispatch(cmd);
|
||||
dispatch(FuncRequest(bv, LFUN_MATH_MUTATE, "simple"));
|
||||
bv->theLockingInset()->dispatch(cmd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -55,8 +55,6 @@ public:
|
||||
///
|
||||
virtual void insetUnlock(BufferView *);
|
||||
|
||||
/// To allow transparent use of math editing functions
|
||||
virtual dispatch_result localDispatch(FuncRequest const &);
|
||||
/// To allow transparent use of math editing functions
|
||||
//virtual void status(FuncRequest const &);
|
||||
|
||||
@ -83,7 +81,11 @@ public:
|
||||
bool display() const;
|
||||
// return the selection as std::string
|
||||
std::string selectionAsString() const;
|
||||
|
||||
protected:
|
||||
/// To allow transparent use of math editing functions
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
|
||||
private:
|
||||
/// unimplemented
|
||||
void operator=(const InsetFormulaBase &);
|
||||
|
@ -1187,6 +1187,6 @@ dispatch_result MathGridInset::dispatch
|
||||
}
|
||||
|
||||
default:
|
||||
return MathNestInset::dispatch(cmd, idx, pos);
|
||||
return MathNestInset::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ dispatch_result MathHullInset::dispatch
|
||||
pos = 0;
|
||||
return DISPATCHED_POP;
|
||||
}
|
||||
return MathGridInset::dispatch(cmd, idx, pos);
|
||||
return MathGridInset::priv_dispatch(cmd, idx, pos);
|
||||
|
||||
case LFUN_MATH_NUMBER:
|
||||
//lyxerr << "toggling all numbers" << endl;
|
||||
@ -858,7 +858,7 @@ dispatch_result MathHullInset::dispatch
|
||||
}
|
||||
|
||||
default:
|
||||
return MathGridInset::dispatch(cmd, idx, pos);
|
||||
return MathGridInset::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ dispatch_result MathNestInset::dispatch
|
||||
return UNDISPATCHED;
|
||||
|
||||
default:
|
||||
return MathInset::dispatch(cmd, idx, pos);
|
||||
return MathInset::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,5 +355,3 @@ void MathNestInset::drawMarkers2(PainterInfo & pi, int x, int y) const
|
||||
pi.pain.line(x, a, x + 3, a, LColor::mathframe);
|
||||
pi.pain.line(t - 3, a, t, a, LColor::mathframe);
|
||||
}
|
||||
|
||||
|
||||
|
@ -529,5 +529,5 @@ dispatch_result MathScriptInset::dispatch
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
return MathNestInset::dispatch(cmd, idx, pos);
|
||||
return MathNestInset::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
|
@ -53,30 +53,41 @@ void RefInset::infoize(std::ostream & os) const
|
||||
|
||||
|
||||
dispatch_result
|
||||
RefInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
|
||||
RefInset::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
if (cmd.button() == mouse_button::button3) {
|
||||
lyxerr << "trying to goto ref" << cell(0) << endl;
|
||||
cmd.view()->dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0))));
|
||||
return DISPATCHED;
|
||||
}
|
||||
if (cmd.button() == mouse_button::button1) {
|
||||
// Eventually trigger dialog with button 3
|
||||
// not 1
|
||||
string const data = createDialogStr("ref");
|
||||
cmd.view()->owner()->getDialogs().
|
||||
show("ref", data, this);
|
||||
return DISPATCHED;
|
||||
}
|
||||
break;
|
||||
case LFUN_MOUSE_PRESS:
|
||||
case LFUN_MOUSE_MOTION:
|
||||
// eat other mouse commands
|
||||
case LFUN_INSET_MODIFY:
|
||||
if (cmd.getArg(0) == "ref") {
|
||||
MathArray ar;
|
||||
if (!createMathInset_fromDialogStr(cmd.argument, ar))
|
||||
return UNDISPATCHED;
|
||||
|
||||
*this = *ar[0].nucleus()->asRefInset();
|
||||
|
||||
return DISPATCHED;
|
||||
default:
|
||||
return CommandInset::dispatch(cmd, idx, pos);
|
||||
}
|
||||
break;
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
if (cmd.button() == mouse_button::button3) {
|
||||
lyxerr << "trying to goto ref" << cell(0) << endl;
|
||||
cmd.view()->dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0))));
|
||||
return DISPATCHED;
|
||||
}
|
||||
if (cmd.button() == mouse_button::button1) {
|
||||
// Eventually trigger dialog with button 3
|
||||
// not 1
|
||||
string const data = createDialogStr("ref");
|
||||
cmd.view()->owner()->getDialogs().
|
||||
show("ref", data, this);
|
||||
return DISPATCHED;
|
||||
}
|
||||
break;
|
||||
case LFUN_MOUSE_PRESS:
|
||||
case LFUN_MOUSE_MOTION:
|
||||
// eat other mouse commands
|
||||
return DISPATCHED;
|
||||
default:
|
||||
return CommandInset::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
// not our business
|
||||
return UNDISPATCHED;
|
||||
@ -138,22 +149,6 @@ int RefInset::docbook(std::ostream & os, bool) const
|
||||
}
|
||||
|
||||
|
||||
dispatch_result RefInset::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
if (cmd.action != LFUN_INSET_MODIFY || cmd.getArg(0) != "ref")
|
||||
return UNDISPATCHED;
|
||||
|
||||
MathArray ar;
|
||||
if (!createMathInset_fromDialogStr(cmd.argument, ar))
|
||||
return UNDISPATCHED;
|
||||
|
||||
*this = *ar[0].nucleus()->asRefInset();
|
||||
// if (cmd.view())
|
||||
// // This does not compile because updateInset expects
|
||||
// // an Inset* and 'this' isn't.
|
||||
// cmd.view()->updateInset(this);
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
|
||||
RefInset::ref_type_info RefInset::types[] = {
|
||||
|
@ -29,8 +29,6 @@ public:
|
||||
///
|
||||
void infoize(std::ostream & os) const;
|
||||
///
|
||||
dispatch_result dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
|
||||
///
|
||||
std::string const screenLabel() const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
@ -60,6 +58,11 @@ public:
|
||||
static int getType(std::string const & name);
|
||||
///
|
||||
static std::string const & getName(int type);
|
||||
protected:
|
||||
///
|
||||
virtual
|
||||
dispatch_result
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1639,7 +1639,7 @@ WordLangTuple const LyXText::selectNextWordToSpellcheck(float & value)
|
||||
cursorPar()->isInset(cursor.pos())) {
|
||||
// lock the inset!
|
||||
FuncRequest cmd(bv(), LFUN_INSET_EDIT, "left");
|
||||
cursorPar()->getInset(cursor.pos())->localDispatch(cmd);
|
||||
cursorPar()->getInset(cursor.pos())->dispatch(cmd);
|
||||
// now call us again to do the above trick
|
||||
// but obviously we have to start from down below ;)
|
||||
return bv()->text->selectNextWordToSpellcheck(value);
|
||||
@ -2191,4 +2191,3 @@ void LyXText::metrics(MetricsInfo & mi, Dimension & dim)
|
||||
dim.des = height - dim.asc;
|
||||
dim.wid = std::max(mi.base.textwidth, int(width));
|
||||
}
|
||||
|
||||
|
@ -1624,7 +1624,7 @@ void LyXText::cursorUp(bool selecting)
|
||||
y -= topy;
|
||||
InsetOld * inset_hit = checkInsetHit(x, y1);
|
||||
if (inset_hit && isHighlyEditableInset(inset_hit)) {
|
||||
inset_hit->localDispatch(
|
||||
inset_hit->dispatch(
|
||||
FuncRequest(bv(), LFUN_INSET_EDIT, x, y - (y2 - y1), mouse_button::none));
|
||||
}
|
||||
}
|
||||
@ -1651,7 +1651,7 @@ void LyXText::cursorDown(bool selecting)
|
||||
InsetOld * inset_hit = checkInsetHit(x, y1);
|
||||
if (inset_hit && isHighlyEditableInset(inset_hit)) {
|
||||
FuncRequest cmd(bv(), LFUN_INSET_EDIT, x, y - (y2 - y1), mouse_button::none);
|
||||
inset_hit->localDispatch(cmd);
|
||||
inset_hit->dispatch(cmd);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
16
src/text3.C
16
src/text3.C
@ -380,7 +380,7 @@ void doInsertInset(LyXText * lt, FuncRequest const & cmd,
|
||||
if (bv->insertInset(inset)) {
|
||||
if (edit) {
|
||||
FuncRequest cmd(bv, LFUN_INSET_EDIT, "left");
|
||||
inset->localDispatch(cmd);
|
||||
inset->dispatch(cmd);
|
||||
}
|
||||
if (gotsel && pastesel)
|
||||
bv->owner()->dispatch(FuncRequest(LFUN_PASTE));
|
||||
@ -598,7 +598,7 @@ dispatch_result LyXText::dispatch(FuncRequest const & cmd)
|
||||
InsetOld * tmpinset = cursorPar()->getInset(cursor.pos());
|
||||
cmd.message(tmpinset->editMessage());
|
||||
FuncRequest cmd1(bv, LFUN_INSET_EDIT, is_rtl ? "right" : "left");
|
||||
tmpinset->localDispatch(cmd1);
|
||||
tmpinset->dispatch(cmd1);
|
||||
break;
|
||||
}
|
||||
if (!is_rtl)
|
||||
@ -623,7 +623,7 @@ dispatch_result LyXText::dispatch(FuncRequest const & cmd)
|
||||
InsetOld * tmpinset = cursorPar()->getInset(cursor.pos());
|
||||
cmd.message(tmpinset->editMessage());
|
||||
FuncRequest cmd1(bv, LFUN_INSET_EDIT, is_rtl ? "left" : "right");
|
||||
tmpinset->localDispatch(cmd1);
|
||||
tmpinset->dispatch(cmd1);
|
||||
break;
|
||||
}
|
||||
if (is_rtl)
|
||||
@ -1223,7 +1223,7 @@ dispatch_result LyXText::dispatch(FuncRequest const & cmd)
|
||||
FuncRequest cmd1 = cmd;
|
||||
cmd1.x = cmd.x - start_x;
|
||||
cmd1.y = cmd.y - cursor.y() + bv->top_y();
|
||||
tli->localDispatch(cmd1);
|
||||
tli->dispatch(cmd1);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1302,7 +1302,7 @@ dispatch_result LyXText::dispatch(FuncRequest const & cmd)
|
||||
// otherwise give the event to the inset
|
||||
if (inset_hit == bv->theLockingInset()) {
|
||||
FuncRequest cmd1(bv, LFUN_MOUSE_PRESS, x, y, cmd.button());
|
||||
bv->theLockingInset()->localDispatch(cmd1);
|
||||
bv->theLockingInset()->dispatch(cmd1);
|
||||
break;
|
||||
}
|
||||
bv->unlockInset(bv->theLockingInset());
|
||||
@ -1326,7 +1326,7 @@ dispatch_result LyXText::dispatch(FuncRequest const & cmd)
|
||||
if (!bv->lockInset(inset))
|
||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||
FuncRequest cmd1(bv, LFUN_MOUSE_PRESS, x, y, cmd.button());
|
||||
inset->localDispatch(cmd1);
|
||||
inset->dispatch(cmd1);
|
||||
break;
|
||||
}
|
||||
// I'm not sure we should continue here if we hit an inset (Jug20020403)
|
||||
@ -1383,7 +1383,7 @@ dispatch_result LyXText::dispatch(FuncRequest const & cmd)
|
||||
// Only a ButtonPress FuncRequest outside the inset will
|
||||
// force a insetUnlock.
|
||||
FuncRequest cmd1(bv, LFUN_MOUSE_RELEASE, x, y, cmd.button());
|
||||
bv->theLockingInset()->localDispatch(cmd1);
|
||||
bv->theLockingInset()->dispatch(cmd1);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1440,7 +1440,7 @@ dispatch_result LyXText::dispatch(FuncRequest const & cmd)
|
||||
bv->owner()->message(inset_hit->editMessage());
|
||||
|
||||
FuncRequest cmd1(bv, LFUN_MOUSE_RELEASE, x, y, cmd.button());
|
||||
inset_hit->localDispatch(cmd1);
|
||||
inset_hit->dispatch(cmd1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user