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"
23 using std::istringstream;
27 FuncRequest::FuncRequest()
28 : view_(0), action(LFUN_NOACTION), x(0), y(0), button_(mouse_button::none)
32 FuncRequest::FuncRequest(kb_action act)
33 : view_(0), action(act), x(0), y(0), button_(mouse_button::none)
37 FuncRequest::FuncRequest(kb_action act, string const & arg)
38 : view_(0), action(act), argument(arg), x(0), y(0), button_(mouse_button::none)
42 FuncRequest::FuncRequest
43 (kb_action act, int ax, int ay, mouse_button::state button)
44 : view_(0), action(act), x(ax), y(ay), button_(button)
48 FuncRequest::FuncRequest(BufferView * view, kb_action act)
49 : view_(view), action(act), x(0), y(0), button_(mouse_button::none)
53 FuncRequest::FuncRequest(BufferView * view, kb_action act, string const & arg)
54 : view_(view), action(act), argument(arg), x(0), y(0), button_(mouse_button::none)
58 FuncRequest::FuncRequest
59 (BufferView * view, kb_action act, int ax, int ay, mouse_button::state but)
60 : view_(view), action(act), x(ax), y(ay), button_(but)
64 FuncRequest::FuncRequest(FuncRequest const & cmd, string const & arg)
65 : view_(cmd.view_), action(cmd.action), argument(arg),
66 x(cmd.x), y(cmd.y), button_(cmd.button_)
70 FuncRequest::FuncRequest(FuncRequest const & cmd, BufferView * view)
71 : view_(view), action(cmd.action), argument(cmd.argument),
72 x(cmd.x), y(cmd.y), button_(cmd.button_)
76 BufferView * FuncRequest::view() const
82 void FuncRequest::setView(BufferView * view)
88 mouse_button::state FuncRequest::button() const
94 void FuncRequest::message(string const & msg) const
97 view_->owner()->getLyXFunc().setMessage(msg);
99 lyxerr << "Dropping message '" << msg << "'" << endl;
103 void FuncRequest::errorMessage(string const & msg) const
106 view_->owner()->getLyXFunc().setErrorMessage(msg);
108 lyxerr << "Dropping error message '" << msg << "'" << endl;
112 void split(vector<string> & args, string str)
114 istringstream is(str);
130 string FuncRequest::getArg(unsigned int i) const
133 split(args, argument);
134 return i < args.size() ? args[i] : string();