#include "LyXAction.h"
#include "support/debug.h"
-#include "support/docstring.h"
#include "support/lstrings.h"
#include <climits>
FuncRequest const FuncRequest::unknown(LFUN_UNKNOWN_ACTION);
FuncRequest const FuncRequest::noaction(LFUN_NOACTION);
+FuncRequest const FuncRequest::prefix(LFUN_COMMAND_PREFIX);
FuncRequest::FuncRequest(Origin o)
- : action_(LFUN_NOACTION), origin_(o), view_origin_(nullptr), x_(0), y_(0),
- button_(mouse_button::none), modifier_(NoModifier), allow_async_(true)
+ : origin_(o)
{}
FuncRequest::FuncRequest(FuncCode act, Origin o)
- : action_(act), origin_(o), view_origin_(nullptr), x_(0), y_(0),
- button_(mouse_button::none), modifier_(NoModifier), allow_async_(true)
+ : action_(act), origin_(o)
{}
FuncRequest::FuncRequest(FuncCode act, docstring const & arg, Origin o)
- : action_(act), argument_(arg), origin_(o), view_origin_(nullptr), x_(0), y_(0),
- button_(mouse_button::none), modifier_(NoModifier), allow_async_(true)
+ : action_(act), argument_(arg), origin_(o)
{}
FuncRequest::FuncRequest(FuncCode act, string const & arg, Origin o)
- : action_(act), argument_(from_utf8(arg)),
- origin_(o), view_origin_(nullptr), x_(0), y_(0),
- button_(mouse_button::none), modifier_(NoModifier), allow_async_(true)
+ : FuncRequest(act, from_utf8(arg), o)
{}
FuncRequest::FuncRequest(FuncCode act, int ax, int ay,
- mouse_button::state but, KeyModifier modifier, Origin o)
- : action_(act), origin_(o), view_origin_(nullptr), x_(ax), y_(ay),
- button_(but), modifier_(modifier), allow_async_(true)
+ mouse_button::state button, KeyModifier modifier, Origin o)
+ : action_(act), origin_(o),
+ x_(ax), y_(ay), button_(button), modifier_(modifier)
{}
FuncRequest::FuncRequest(FuncRequest const & cmd, docstring const & arg, Origin o)
- : action_(cmd.action()), argument_(arg),
- origin_(o), view_origin_(nullptr), x_(cmd.x_), y_(cmd.y_),
- button_(cmd.button_), modifier_(NoModifier), allow_async_(true)
+ : action_(cmd.action()), argument_(arg), origin_(o),
+ x_(cmd.x_), y_(cmd.y_), button_(cmd.button_)
{}
return i < args.size() ? args[i] : string();
}
+
bool operator==(FuncRequest const & lhs, FuncRequest const & rhs)
{
return lhs.action() == rhs.action() && lhs.argument() == rhs.argument();
}
+bool operator!=(FuncRequest const & lhs, FuncRequest const & rhs)
+{
+ return !(lhs == rhs);
+}
+
+
ostream & operator<<(ostream & os, FuncRequest const & cmd)
{
return os