mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +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::noaction(LFUN_NOACTION);
|
||||
FuncRequest const FuncRequest::prefix(LFUN_COMMAND_PREFIX);
|
||||
|
||||
FuncRequest::FuncRequest(Origin o)
|
||||
: origin_(o)
|
||||
@ -114,12 +115,19 @@ string FuncRequest::getLongArg(unsigned int i) const
|
||||
return i < args.size() ? args[i] : string();
|
||||
}
|
||||
|
||||
|
||||
bool operator==(FuncRequest const & lhs, FuncRequest const & rhs)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return os
|
||||
|
@ -98,6 +98,9 @@ public:
|
||||
static FuncRequest const unknown;
|
||||
///
|
||||
static FuncRequest const noaction;
|
||||
///
|
||||
static FuncRequest const prefix;
|
||||
|
||||
///
|
||||
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);
|
||||
|
||||
std::ostream & operator<<(std::ostream &, FuncRequest const &);
|
||||
|
||||
LyXErr & operator<<(LyXErr &, FuncRequest const &);
|
||||
|
@ -457,8 +457,7 @@ FuncRequest const & KeyMap::lookup(KeySymbol const &key,
|
||||
if (cit->prefixes) {
|
||||
// this is a prefix key - set new map
|
||||
seq->curmap = cit->prefixes.get();
|
||||
static const FuncRequest prefix(LFUN_COMMAND_PREFIX);
|
||||
return prefix;
|
||||
return FuncRequest::prefix;
|
||||
} else {
|
||||
// final key - reset map
|
||||
seq->reset();
|
||||
|
@ -3359,9 +3359,10 @@ docstring makeCmdString(FuncRequest const & f)
|
||||
FuncRequest PrefShortcuts::currentBinding(KeySequence const & k)
|
||||
{
|
||||
FuncRequest res = user_bind_.getBinding(k);
|
||||
if (res.action() != LFUN_UNKNOWN_ACTION)
|
||||
if (res != FuncRequest::unknown)
|
||||
return res;
|
||||
res = system_bind_.getBinding(k);
|
||||
|
||||
// Check if it is unbound. Note: user_unbind_ can only unbind one
|
||||
// FuncRequest per key sequence.
|
||||
if (user_unbind_.getBinding(k) == res)
|
||||
|
Loading…
Reference in New Issue
Block a user