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;
28 FuncRequest::FuncRequest()
29 : view_(0), action(LFUN_NOACTION), x(0), y(0), button_(mouse_button::none)
33 FuncRequest::FuncRequest(kb_action act)
34 : view_(0), action(act), x(0), y(0), button_(mouse_button::none)
38 FuncRequest::FuncRequest(kb_action act, string const & arg)
39 : view_(0), action(act), argument(arg), x(0), y(0), button_(mouse_button::none)
43 FuncRequest::FuncRequest
44 (kb_action act, int ax, int ay, mouse_button::state button)
45 : view_(0), action(act), x(ax), y(ay), button_(button)
49 FuncRequest::FuncRequest(BufferView * view, kb_action act)
50 : view_(view), action(act), x(0), y(0), button_(mouse_button::none)
54 FuncRequest::FuncRequest(BufferView * view, kb_action act, string const & arg)
55 : view_(view), action(act), argument(arg), x(0), y(0), button_(mouse_button::none)
59 FuncRequest::FuncRequest
60 (BufferView * view, kb_action act, int ax, int ay, mouse_button::state but)
61 : view_(view), action(act), x(ax), y(ay), button_(but)
65 FuncRequest::FuncRequest(FuncRequest const & cmd, string const & arg)
66 : view_(cmd.view_), action(cmd.action), argument(arg),
67 x(cmd.x), y(cmd.y), button_(cmd.button_)
71 FuncRequest::FuncRequest(FuncRequest const & cmd, BufferView * view)
72 : view_(view), action(cmd.action), argument(cmd.argument),
73 x(cmd.x), y(cmd.y), button_(cmd.button_)
77 BufferView * FuncRequest::view() const
83 void FuncRequest::setView(BufferView * view)
89 mouse_button::state FuncRequest::button() const
95 void FuncRequest::message(string const & msg) const
98 view_->owner()->getLyXFunc().setMessage(msg);
100 lyxerr << "Dropping message '" << msg << "'" << endl;
104 void FuncRequest::errorMessage(string const & msg) const
107 view_->owner()->getLyXFunc().setErrorMessage(msg);
109 lyxerr << "Dropping error message '" << msg << "'" << endl;
113 void split(vector<string> & args, string str)
115 istringstream is(str);
131 string FuncRequest::getArg(unsigned int i) const
134 split(args, argument);
135 return i < args.size() ? args[i] : string();