From b9294516fc65f7a172ae119e20865b70c43c19c0 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 19 Sep 2019 16:55:28 +0300 Subject: SL-6109 Implement keybindings --- indra/llcommon/llkeybind.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 indra/llcommon/llkeybind.h (limited to 'indra/llcommon/llkeybind.h') diff --git a/indra/llcommon/llkeybind.h b/indra/llcommon/llkeybind.h new file mode 100644 index 0000000000..4fe622fb79 --- /dev/null +++ b/indra/llcommon/llkeybind.h @@ -0,0 +1,70 @@ +/** + * @file llkeybind.h + * @brief Information about key combinations. + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_KEYBIND_H +#define LL_KEYBIND_H + +#include "indra_constants.h" + +// KeyData - single key combination (mouse/mask/keyboard) +class LL_COMMON_API LLKeyData +{ +public: + LLKeyData(); + LLKeyData(const LLSD &key_data); + + LLSD asLLSD() const; + bool isEmpty() const; + void reset(); + LLKeyData& operator=(const LLKeyData& rhs); + + EMouseClickType mMouse; + KEY mKey; + MASK mMask; +}; + +// One function can bind to multiple Key options +class LLKeyBind +{ +public: + LLKeyBind() {} + LLKeyBind(const LLSD &key_bind); + + bool operator==(const LLKeyBind& rhs); + bool empty(); + + LLSD asLLSD() const; + + bool canHandle(EMouseClickType mouse, KEY key, MASK mask) const; + bool canHandleKey(KEY key, MASK mask) const; + bool canHandleMouse(EMouseClickType mouse, MASK mask) const; + + LLKeyData mDataPrimary; + LLKeyData mDataSecondary; +}; + + +#endif // LL_KEYBIND_H -- cgit v1.2.3 From 4df05c5a8995158922c7b7aacfef442ac8ae6fdd Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 17 Sep 2019 21:36:59 +0300 Subject: SL-6109 Keyaboard support ready --- indra/llcommon/llkeybind.h | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'indra/llcommon/llkeybind.h') diff --git a/indra/llcommon/llkeybind.h b/indra/llcommon/llkeybind.h index 4fe622fb79..481949f275 100644 --- a/indra/llcommon/llkeybind.h +++ b/indra/llcommon/llkeybind.h @@ -34,12 +34,16 @@ class LL_COMMON_API LLKeyData { public: LLKeyData(); + LLKeyData(EMouseClickType mouse, KEY key, MASK mask); LLKeyData(const LLSD &key_data); LLSD asLLSD() const; bool isEmpty() const; + bool empty() const { return isEmpty(); }; void reset(); LLKeyData& operator=(const LLKeyData& rhs); + bool operator==(const LLKeyData& rhs); + bool operator!=(const LLKeyData& rhs); EMouseClickType mMouse; KEY mKey; @@ -54,7 +58,9 @@ public: LLKeyBind(const LLSD &key_bind); bool operator==(const LLKeyBind& rhs); - bool empty(); + bool operator!=(const LLKeyBind& rhs); + bool isEmpty() const; + bool empty() const { return isEmpty(); }; LLSD asLLSD() const; @@ -62,8 +68,19 @@ public: bool canHandleKey(KEY key, MASK mask) const; bool canHandleMouse(EMouseClickType mouse, MASK mask) const; - LLKeyData mDataPrimary; - LLKeyData mDataSecondary; + // these methods enshure there will be no repeats + bool addKeyData(EMouseClickType mouse, KEY key, MASK mask); + bool addKeyData(const LLKeyData& data); + void replaceKeyData(EMouseClickType mouse, KEY key, MASK mask, U32 index); + void replaceKeyData(const LLKeyData& data, U32 index); + bool hasKeyData(U32 index) const; + void clear() { mData.clear(); }; + LLKeyData getKeyData(U32 index) const; + U32 getDataCount(); + +private: + typedef std::vector data_vector_t; + data_vector_t mData; }; -- cgit v1.2.3 From c60b929fbb615f8d73f7bf42849b5628bf0f8f7a Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 25 Sep 2019 17:54:36 +0300 Subject: SL-6109 Mouse support ready --- indra/llcommon/llkeybind.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/llkeybind.h') diff --git a/indra/llcommon/llkeybind.h b/indra/llcommon/llkeybind.h index 481949f275..25179a57f3 100644 --- a/indra/llcommon/llkeybind.h +++ b/indra/llcommon/llkeybind.h @@ -35,6 +35,8 @@ class LL_COMMON_API LLKeyData public: LLKeyData(); LLKeyData(EMouseClickType mouse, KEY key, MASK mask); + LLKeyData(EMouseClickType mouse, KEY key, bool ignore_mask); + LLKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignore_mask); LLKeyData(const LLSD &key_data); LLSD asLLSD() const; @@ -45,9 +47,13 @@ public: bool operator==(const LLKeyData& rhs); bool operator!=(const LLKeyData& rhs); + bool canHandle(const LLKeyData& data) const; + bool canHandle(EMouseClickType mouse, KEY key, MASK mask) const; + EMouseClickType mMouse; KEY mKey; MASK mMask; + bool mIgnoreMasks; }; // One function can bind to multiple Key options @@ -68,10 +74,13 @@ public: bool canHandleKey(KEY key, MASK mask) const; bool canHandleMouse(EMouseClickType mouse, MASK mask) const; + bool LLKeyBind::hasKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignore) const; + bool LLKeyBind::hasKeyData(const LLKeyData& data) const; + // these methods enshure there will be no repeats - bool addKeyData(EMouseClickType mouse, KEY key, MASK mask); + bool addKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignore); bool addKeyData(const LLKeyData& data); - void replaceKeyData(EMouseClickType mouse, KEY key, MASK mask, U32 index); + void replaceKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignore, U32 index); void replaceKeyData(const LLKeyData& data, U32 index); bool hasKeyData(U32 index) const; void clear() { mData.clear(); }; -- cgit v1.2.3 From 2532a2ee9ee9003e2c6b72f8da19979a9e3dd2f6 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 26 Sep 2019 22:28:18 +0300 Subject: SL-6109 Conflict resolution --- indra/llcommon/llkeybind.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'indra/llcommon/llkeybind.h') diff --git a/indra/llcommon/llkeybind.h b/indra/llcommon/llkeybind.h index 25179a57f3..39cb668aac 100644 --- a/indra/llcommon/llkeybind.h +++ b/indra/llcommon/llkeybind.h @@ -74,17 +74,26 @@ public: bool canHandleKey(KEY key, MASK mask) const; bool canHandleMouse(EMouseClickType mouse, MASK mask) const; - bool LLKeyBind::hasKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignore) const; - bool LLKeyBind::hasKeyData(const LLKeyData& data) const; + // contains specified combination + bool hasKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignore) const; + bool hasKeyData(const LLKeyData& data) const; + bool hasKeyData(U32 index) const; + + // index of contained LLKeyData + S32 findKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignore) const; + S32 findKeyData(const LLKeyData& data) const; + + LLKeyData getKeyData(U32 index) const; // these methods enshure there will be no repeats bool addKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignore); bool addKeyData(const LLKeyData& data); void replaceKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignore, U32 index); void replaceKeyData(const LLKeyData& data, U32 index); - bool hasKeyData(U32 index) const; - void clear() { mData.clear(); }; - LLKeyData getKeyData(U32 index) const; + void resetKeyData(S32 index); + void clear() { mData.clear(); } + // if there any empty LLKeyData in the end of the array, remove them + void trimEmpty(); U32 getDataCount(); private: -- cgit v1.2.3 From e211372923bed31e632bc9825913d3d57cdc2d52 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 3 Oct 2019 22:45:29 +0300 Subject: SL-6109 Remade 'ignore' list processing, renamed and reformed keybindings --- indra/llcommon/llkeybind.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llcommon/llkeybind.h') diff --git a/indra/llcommon/llkeybind.h b/indra/llcommon/llkeybind.h index 39cb668aac..ad0ebec67c 100644 --- a/indra/llcommon/llkeybind.h +++ b/indra/llcommon/llkeybind.h @@ -53,7 +53,8 @@ public: EMouseClickType mMouse; KEY mKey; MASK mMask; - bool mIgnoreMasks; + // Either to expect exact match or ignore not expected masks + bool mIgnoreMasks; }; // One function can bind to multiple Key options -- cgit v1.2.3 From 6092e2ffab9ec76bdd8821e188db9cb785456eee Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 15 Jun 2020 18:13:46 +0300 Subject: SL-13418 Added converter from old mouse binding settings to new ones --- indra/llcommon/llkeybind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/llkeybind.h') diff --git a/indra/llcommon/llkeybind.h b/indra/llcommon/llkeybind.h index ad0ebec67c..c6b4bd970f 100644 --- a/indra/llcommon/llkeybind.h +++ b/indra/llcommon/llkeybind.h @@ -53,7 +53,7 @@ public: EMouseClickType mMouse; KEY mKey; MASK mMask; - // Either to expect exact match or ignore not expected masks + // Either to expect exact match or ignore not expected masks as long as expected mask-bit is present bool mIgnoreMasks; }; -- cgit v1.2.3