2 * \file FuncRequest.cpp
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 "LyXAction.h"
24 FuncRequest
const FuncRequest::unknown(LFUN_UNKNOWN_ACTION
);
25 FuncRequest
const FuncRequest::noaction(LFUN_NOACTION
);
27 FuncRequest::FuncRequest(Origin o
)
28 : action(LFUN_NOACTION
), origin(o
), x(0), y(0),
29 button_(mouse_button::none
)
33 FuncRequest::FuncRequest(FuncCode act
, Origin o
)
34 : action(act
), origin(o
), x(0), y(0), button_(mouse_button::none
)
38 FuncRequest::FuncRequest(FuncCode act
, docstring
const & arg
, Origin o
)
39 : action(act
), argument_(arg
), origin(o
), x(0), y(0),
40 button_(mouse_button::none
)
44 FuncRequest::FuncRequest(FuncCode act
, string
const & arg
, Origin o
)
45 : action(act
), argument_(from_utf8(arg
)), origin(o
), x(0), y(0),
46 button_(mouse_button::none
)
50 FuncRequest::FuncRequest(FuncCode act
, int ax
, int ay
,
51 mouse_button::state but
, Origin o
)
52 : action(act
), origin(o
), x(ax
), y(ay
), button_(but
)
56 FuncRequest::FuncRequest(FuncRequest
const & cmd
, docstring
const & arg
, Origin o
)
57 : action(cmd
.action
), argument_(arg
), origin(o
),
58 x(cmd
.x
), y(cmd
.y
), button_(cmd
.button_
)
62 FuncRequest::FuncRequest(FuncRequest
const & cmd
, string
const & arg
, Origin o
)
63 : action(cmd
.action
), argument_(from_utf8(arg
)), origin(o
),
64 x(cmd
.x
), y(cmd
.y
), button_(cmd
.button_
)
68 mouse_button::state
FuncRequest::button() const
74 void splitArg(vector
<string
> & args
, string
const & str
)
76 istringstream
is(str
);
94 string
FuncRequest::getArg(unsigned int i
) const
97 splitArg(args
, to_utf8(argument_
));
98 return i
< args
.size() ? args
[i
] : string();
102 bool operator==(FuncRequest
const & lhs
, FuncRequest
const & rhs
)
104 return lhs
.action
== rhs
.action
&& lhs
.argument() == rhs
.argument();
108 ostream
& operator<<(ostream
& os
, FuncRequest
const & cmd
)
111 << " action: " << cmd
.action
112 << " [" << lyxaction
.getActionName(cmd
.action
) << "] "
113 << " arg: '" << to_utf8(cmd
.argument()) << "'"