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"
26 FuncRequest::FuncRequest()
27 : view_(0), action(LFUN_UNKNOWN_ACTION), x(0), y(0), button_(mouse_button::none)
31 FuncRequest::FuncRequest(kb_action act)
32 : view_(0), action(act), x(0), y(0), button_(mouse_button::none)
36 FuncRequest::FuncRequest(kb_action act, string const & arg)
37 : view_(0), action(act), argument(arg), x(0), y(0), button_(mouse_button::none)
41 FuncRequest::FuncRequest
42 (kb_action act, int ax, int ay, mouse_button::state button)
43 : view_(0), action(act), x(ax), y(ay), button_(button)
47 FuncRequest::FuncRequest(BufferView * view, kb_action act)
48 : view_(view), action(act), x(0), y(0), button_(mouse_button::none)
52 FuncRequest::FuncRequest(BufferView * view, kb_action act, string const & arg)
53 : view_(view), action(act), argument(arg), x(0), y(0), button_(mouse_button::none)
57 FuncRequest::FuncRequest
58 (BufferView * view, kb_action act, int ax, int ay, mouse_button::state but)
59 : view_(view), action(act), x(ax), y(ay), button_(but)
63 FuncRequest::FuncRequest(FuncRequest const & cmd, string const & arg)
64 : view_(cmd.view_), action(cmd.action), argument(arg),
65 x(cmd.x), y(cmd.y), button_(cmd.button_)
69 FuncRequest::FuncRequest(FuncRequest const & cmd, BufferView * view)
70 : view_(view), action(cmd.action), argument(cmd.argument),
71 x(cmd.x), y(cmd.y), button_(cmd.button_)
75 BufferView * FuncRequest::view() const
81 void FuncRequest::setView(BufferView * view)
87 mouse_button::state FuncRequest::button() const
93 void FuncRequest::message(string const & msg) const
96 view_->owner()->getLyXFunc().setMessage(msg);
98 lyxerr << "Dropping message '" << msg << "'" << endl;
102 void FuncRequest::errorMessage(string const & msg) const
105 view_->owner()->getLyXFunc().setErrorMessage(msg);
107 lyxerr << "Dropping error message '" << msg << "'" << endl;
111 void split(vector<string> & args, string str)
113 istringstream is(STRCONV(str));
129 string FuncRequest::getArg(int i) const
132 split(args, argument);
133 return i < args.size() ? args[i] : string();