+#ifdef __GNUG__
+#pragma implementation
+#endif
+
#include <config.h>
#include "ref_inset.h"
-#include "math_cursor.h"
#include "funcrequest.h"
#include "formulabase.h"
#include "BufferView.h"
}
-int RefInset::dispatch(FuncRequest const & cmd, idx_type, pos_type)
+MathInset::result_type
+RefInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
{
switch (cmd.action) {
case LFUN_MOUSE_RELEASE:
- if (cmd.extra == 3) {
+ if (cmd.button() == mouse_button::button3) {
lyxerr << "trying to goto ref" << cell(0) << "\n";
- mathcursor->formula()->view()->owner()->getLyXFunc()->
- dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0))));
- return 1; // dispatched
+ cmd.view()->dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0))));
+ return DISPATCHED;
}
- if (cmd.extra == 1) {
+ if (cmd.button() == mouse_button::button1) {
lyxerr << "trying to open ref" << cell(0) << "\n";
// Eventually trigger dialog with button 3 not 1
- // mathcursor->formula()->view()->owner()->getDialogs()
- // ->showRef(this);
- return 1; // dispatched
+ // cmd.view()->owner()->getDialogs()->showRef(this);
+ return DISPATCHED;
}
break;
- case LFUN_MOUSE_PRESS:
+ case LFUN_MOUSE_PRESS:
case LFUN_MOUSE_MOTION:
// eat other mouse commands
- return 1;
+ return DISPATCHED;
default:
- break;
+ return CommandInset::dispatch(cmd, idx, pos);
}
// not our business
- return 0;
+ return UNDISPATCHED;
}
int RefInset::ascii(std::ostream & os, int) const
{
- os << "[" << asString(cell(0)) << "]";
+ os << '[' << asString(cell(0)) << ']';
return 0;
}