3 * Copyright 2002 the LyX Team
4 * Read the file COPYING
11 #include "funcrequest.h"
12 #include "BufferView.h"
13 #include "lyxfunc.h" // only for setMessage()
14 #include "frontends/LyXView.h"
23 FuncRequest::FuncRequest()
24 : view_(0), action(LFUN_UNKNOWN_ACTION)
28 FuncRequest::FuncRequest(kb_action act)
29 : view_(0), action(act)
33 FuncRequest::FuncRequest(kb_action act, string const & arg)
34 : view_(0), action(act), argument(arg)
38 FuncRequest::FuncRequest
39 (kb_action act, int ax, int ay, mouse_button::state button)
40 : view_(0), action(act), argument(), x(ax), y(ay), button_(button)
44 FuncRequest::FuncRequest(BufferView * view, kb_action act)
45 : view_(view), action(act)
49 FuncRequest::FuncRequest(BufferView * view, kb_action act, string const & arg)
50 : view_(view), action(act), argument(arg)
54 FuncRequest::FuncRequest
55 (BufferView * view, kb_action act, int ax, int ay, mouse_button::state but)
56 : view_(view), action(act), argument(), x(ax), y(ay), button_(but)
60 FuncRequest::FuncRequest(FuncRequest const & cmd, string const & arg)
61 : view_(cmd.view_), action(cmd.action), argument(arg),
62 x(cmd.x), y(cmd.y), button_(cmd.button_)
66 FuncRequest::FuncRequest(FuncRequest const & cmd, BufferView * view)
67 : view_(view), action(cmd.action), argument(cmd.argument),
68 x(cmd.x), y(cmd.y), button_(cmd.button_)
72 BufferView * FuncRequest::view() const
78 void FuncRequest::setView(BufferView * view)
84 mouse_button::state FuncRequest::button() const
90 void FuncRequest::message(string const & msg) const
93 view_->owner()->getLyXFunc().setMessage(msg);
95 lyxerr << "Dropping message '" << msg << "'\n";
99 void FuncRequest::errorMessage(string const & msg) const
102 view_->owner()->getLyXFunc().setErrorMessage(msg);
104 lyxerr << "Dropping error message '" << msg << "'\n";
108 void split(vector<string> & args, string str)
110 istringstream is(str);
126 string FuncRequest::getArg(int i) const
129 split(args, argument);
130 return i < args.size() ? args[i] : string();