#include "lyxfunc.h" // only for setMessage()
#include "frontends/LyXView.h"
#include "debug.h"
+#include "Lsstream.h"
+
+
+using std::vector;
+using std::getline;
+using std::endl;
FuncRequest::FuncRequest()
- : view_(0), action(LFUN_UNKNOWN_ACTION)
+ : view_(0), action(LFUN_UNKNOWN_ACTION), button_(mouse_button::none)
{}
FuncRequest::FuncRequest(kb_action act)
- : view_(0), action(act)
+ : view_(0), action(act), button_(mouse_button::none)
{}
FuncRequest::FuncRequest(kb_action act, string const & arg)
- : view_(0), action(act), argument(arg)
+ : view_(0), action(act), argument(arg), button_(mouse_button::none)
{}
FuncRequest::FuncRequest(BufferView * view, kb_action act)
- : view_(view), action(act)
+ : view_(view), action(act), button_(mouse_button::none)
{}
FuncRequest::FuncRequest(BufferView * view, kb_action act, string const & arg)
- : view_(view), action(act), argument(arg)
+ : view_(view), action(act), argument(arg), button_(mouse_button::none)
{}
if (view_)
view_->owner()->getLyXFunc().setMessage(msg);
else
- lyxerr << "Dropping message '" << msg << "'\n";
+ lyxerr << "Dropping message '" << msg << "'" << endl;
}
if (view_)
view_->owner()->getLyXFunc().setErrorMessage(msg);
else
- lyxerr << "Dropping error message '" << msg << "'\n";
+ lyxerr << "Dropping error message '" << msg << "'" << endl;
+}
+
+
+void split(vector<string> & args, string str)
+{
+ istringstream is(STRCONV(str));
+ while (is) {
+ char c;
+ string s;
+ is >> c;
+ if (c == '"')
+ getline(is, s, '"');
+ else {
+ is.putback(c);
+ is >> s;
+ }
+ args.push_back(s);
+ }
+}
+
+
+string FuncRequest::getArg(int i) const
+{
+ vector<string> args;
+ split(args, argument);
+ return i < args.size() ? args[i] : string();
}