3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "funcrequest.h"
14 #include "BufferView.h"
15 #include "lyxfunc.h" // only for setMessage()
16 #include "frontends/LyXView.h"
18 #include "support/std_sstream.h"
25 using std::istringstream;
30 FuncRequest::FuncRequest()
31 : action(LFUN_NOACTION), x(0), y(0), button_(mouse_button::none)
35 FuncRequest::FuncRequest(kb_action act)
36 : action(act), x(0), y(0), button_(mouse_button::none)
40 FuncRequest::FuncRequest(kb_action act, string const & arg)
41 : action(act), argument(arg), x(0), y(0), button_(mouse_button::none)
45 FuncRequest::FuncRequest(kb_action act, int ax, int ay, mouse_button::state but)
46 : action(act), x(ax), y(ay), button_(but)
50 FuncRequest::FuncRequest(FuncRequest const & cmd, string const & arg)
51 : action(cmd.action), argument(arg),
52 x(cmd.x), y(cmd.y), button_(cmd.button_)
56 mouse_button::state FuncRequest::button() const
62 void FuncRequest::message(string const & msg) const
66 // view_->owner()->getLyXFunc().setMessage(msg);
68 lyxerr << "Dropping message '" << msg << "'" << endl;
72 void FuncRequest::errorMessage(string const & msg) const
76 // view_->owner()->getLyXFunc().setErrorMessage(msg);
78 lyxerr << "Dropping error message '" << msg << "'" << endl;
82 void split(vector<string> & args, string str)
84 istringstream is(str);
100 string FuncRequest::getArg(unsigned int i) const
103 split(args, argument);
104 return i < args.size() ? args[i] : string();
108 bool operator==(FuncRequest const & lhs, FuncRequest const & rhs)
110 return lhs.action == rhs.action && lhs.argument == rhs.argument;
114 std::ostream & operator<<(std::ostream & os, FuncRequest const & cmd)
117 << " action: " << cmd.action
118 << " arg: '" << cmd.argument << "'"