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"
24 FuncRequest::FuncRequest()
25 : view_(0), action(LFUN_UNKNOWN_ACTION)
29 FuncRequest::FuncRequest(kb_action act)
30 : view_(0), action(act)
34 FuncRequest::FuncRequest(kb_action act, string const & arg)
35 : view_(0), action(act), argument(arg)
39 FuncRequest::FuncRequest
40 (kb_action act, int ax, int ay, mouse_button::state button)
41 : view_(0), action(act), argument(), x(ax), y(ay), button_(button)
45 FuncRequest::FuncRequest(BufferView * view, kb_action act)
46 : view_(view), action(act)
50 FuncRequest::FuncRequest(BufferView * view, kb_action act, string const & arg)
51 : view_(view), action(act), argument(arg)
55 FuncRequest::FuncRequest
56 (BufferView * view, kb_action act, int ax, int ay, mouse_button::state but)
57 : view_(view), action(act), argument(), x(ax), y(ay), button_(but)
61 FuncRequest::FuncRequest(FuncRequest const & cmd, string const & arg)
62 : view_(cmd.view_), action(cmd.action), argument(arg),
63 x(cmd.x), y(cmd.y), button_(cmd.button_)
67 FuncRequest::FuncRequest(FuncRequest const & cmd, BufferView * view)
68 : view_(view), action(cmd.action), argument(cmd.argument),
69 x(cmd.x), y(cmd.y), button_(cmd.button_)
73 BufferView * FuncRequest::view() const
79 void FuncRequest::setView(BufferView * view)
85 mouse_button::state FuncRequest::button() const
91 void FuncRequest::message(string const & msg) const
94 view_->owner()->getLyXFunc().setMessage(msg);
96 lyxerr << "Dropping message '" << msg << "'" << endl;
100 void FuncRequest::errorMessage(string const & msg) const
103 view_->owner()->getLyXFunc().setErrorMessage(msg);
105 lyxerr << "Dropping error message '" << msg << "'" << endl;
109 void split(vector<string> & args, string str)
111 istringstream is(STRCONV(str));
127 string FuncRequest::getArg(int i) const
130 split(args, argument);
131 return i < args.size() ? args[i] : string();