mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 02:49:46 +00:00
Add != operator to FuncRequest and special value FuncRequest::prefix
Use this value (and `unknown' where relevant)
This commit is contained in:
parent
fff02aca1a
commit
46992201b7
@ -28,6 +28,7 @@ namespace lyx {
|
|||||||
|
|
||||||
FuncRequest const FuncRequest::unknown(LFUN_UNKNOWN_ACTION);
|
FuncRequest const FuncRequest::unknown(LFUN_UNKNOWN_ACTION);
|
||||||
FuncRequest const FuncRequest::noaction(LFUN_NOACTION);
|
FuncRequest const FuncRequest::noaction(LFUN_NOACTION);
|
||||||
|
FuncRequest const FuncRequest::prefix(LFUN_COMMAND_PREFIX);
|
||||||
|
|
||||||
FuncRequest::FuncRequest(Origin o)
|
FuncRequest::FuncRequest(Origin o)
|
||||||
: origin_(o)
|
: origin_(o)
|
||||||
@ -114,12 +115,19 @@ string FuncRequest::getLongArg(unsigned int i) const
|
|||||||
return i < args.size() ? args[i] : string();
|
return i < args.size() ? args[i] : string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool operator==(FuncRequest const & lhs, FuncRequest const & rhs)
|
bool operator==(FuncRequest const & lhs, FuncRequest const & rhs)
|
||||||
{
|
{
|
||||||
return lhs.action() == rhs.action() && lhs.argument() == rhs.argument();
|
return lhs.action() == rhs.action() && lhs.argument() == rhs.argument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool operator!=(FuncRequest const & lhs, FuncRequest const & rhs)
|
||||||
|
{
|
||||||
|
return !(lhs == rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ostream & operator<<(ostream & os, FuncRequest const & cmd)
|
ostream & operator<<(ostream & os, FuncRequest const & cmd)
|
||||||
{
|
{
|
||||||
return os
|
return os
|
||||||
|
@ -98,6 +98,9 @@ public:
|
|||||||
static FuncRequest const unknown;
|
static FuncRequest const unknown;
|
||||||
///
|
///
|
||||||
static FuncRequest const noaction;
|
static FuncRequest const noaction;
|
||||||
|
///
|
||||||
|
static FuncRequest const prefix;
|
||||||
|
|
||||||
///
|
///
|
||||||
bool allowAsync() const { return allow_async_; }
|
bool allowAsync() const { return allow_async_; }
|
||||||
///
|
///
|
||||||
@ -129,6 +132,8 @@ private:
|
|||||||
|
|
||||||
bool operator==(FuncRequest const & lhs, FuncRequest const & rhs);
|
bool operator==(FuncRequest const & lhs, FuncRequest const & rhs);
|
||||||
|
|
||||||
|
bool operator!=(FuncRequest const & lhs, FuncRequest const & rhs);
|
||||||
|
|
||||||
std::ostream & operator<<(std::ostream &, FuncRequest const &);
|
std::ostream & operator<<(std::ostream &, FuncRequest const &);
|
||||||
|
|
||||||
LyXErr & operator<<(LyXErr &, FuncRequest const &);
|
LyXErr & operator<<(LyXErr &, FuncRequest const &);
|
||||||
|
@ -457,8 +457,7 @@ FuncRequest const & KeyMap::lookup(KeySymbol const &key,
|
|||||||
if (cit->prefixes) {
|
if (cit->prefixes) {
|
||||||
// this is a prefix key - set new map
|
// this is a prefix key - set new map
|
||||||
seq->curmap = cit->prefixes.get();
|
seq->curmap = cit->prefixes.get();
|
||||||
static const FuncRequest prefix(LFUN_COMMAND_PREFIX);
|
return FuncRequest::prefix;
|
||||||
return prefix;
|
|
||||||
} else {
|
} else {
|
||||||
// final key - reset map
|
// final key - reset map
|
||||||
seq->reset();
|
seq->reset();
|
||||||
|
@ -3359,9 +3359,10 @@ docstring makeCmdString(FuncRequest const & f)
|
|||||||
FuncRequest PrefShortcuts::currentBinding(KeySequence const & k)
|
FuncRequest PrefShortcuts::currentBinding(KeySequence const & k)
|
||||||
{
|
{
|
||||||
FuncRequest res = user_bind_.getBinding(k);
|
FuncRequest res = user_bind_.getBinding(k);
|
||||||
if (res.action() != LFUN_UNKNOWN_ACTION)
|
if (res != FuncRequest::unknown)
|
||||||
return res;
|
return res;
|
||||||
res = system_bind_.getBinding(k);
|
res = system_bind_.getBinding(k);
|
||||||
|
|
||||||
// Check if it is unbound. Note: user_unbind_ can only unbind one
|
// Check if it is unbound. Note: user_unbind_ can only unbind one
|
||||||
// FuncRequest per key sequence.
|
// FuncRequest per key sequence.
|
||||||
if (user_unbind_.getBinding(k) == res)
|
if (user_unbind_.getBinding(k) == res)
|
||||||
|
Loading…
Reference in New Issue
Block a user