From 13a25be08f0c81a759076907d7950baf4f2c3ef2 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 3 Oct 2019 19:46:12 +0300 Subject: SL-6109 Better menu accelerator support and slight reorganization --- indra/newview/llsetkeybinddialog.h | 88 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 indra/newview/llsetkeybinddialog.h (limited to 'indra/newview/llsetkeybinddialog.h') diff --git a/indra/newview/llsetkeybinddialog.h b/indra/newview/llsetkeybinddialog.h new file mode 100644 index 0000000000..fb3b2a2269 --- /dev/null +++ b/indra/newview/llsetkeybinddialog.h @@ -0,0 +1,88 @@ +/** + * @file llsetkeybinddialog.h + * @brief LLSetKeyBindDialog class definition + * + * $LicenseInfo:firstyear=2019&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2019, 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_LLSETKEYBINDDIALOG_H +#define LL_LLSETKEYBINDDIALOG_H + +#include "llmodaldialog.h" +#include "lldrawfrustum.h" + +class LLCheckBoxCtrl; + +// Filters for LLSetKeyBindDialog +static const U32 ALLOW_MOUSE = 1; +static const U32 ALLOW_MASK_MOUSE = 2; +static const U32 ALLOW_KEYS = 4; //keyboard +static const U32 ALLOW_MASK_KEYS = 8; +static const U32 ALLOW_MASKS = 16; +static const U32 CAN_IGNORE_MASKS = 32; // For example W (aka Forward) should work regardless of SHIFT being pressed +static const U32 DEFAULT_KEY_FILTER = ALLOW_MOUSE | ALLOW_MASK_MOUSE | ALLOW_KEYS | ALLOW_MASK_KEYS | CAN_IGNORE_MASKS; + + +class LLKeyBindResponderInterface +{ +public: + virtual ~LLKeyBindResponderInterface(); + + virtual void onCancelKeyBind(); + virtual void onDefaultKeyBind(); + // returns true if parent failed to set key due to key being in use + virtual bool onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore); +}; + +class LLSetKeyBindDialog : public LLModalDialog, public LLDrawFrustum +{ +public: + LLSetKeyBindDialog(const LLSD& key); + ~LLSetKeyBindDialog(); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onClose(bool app_quiting); + /*virtual*/ void draw(); + + void setParent(LLKeyBindResponderInterface* parent, U32 key_mask = DEFAULT_KEY_FILTER); + + BOOL handleKeyHere(KEY key, MASK mask); + BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down); + static void onCancel(void* user_data); + static void onBlank(void* user_data); + static void onDefault(void* user_data); + static void onClickTimeout(void* user_data, MASK mask); + + class Updater; + +private: + void setKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore); + LLKeyBindResponderInterface* pParent; + LLCheckBoxCtrl* pCheckBox; + + U32 mKeyFilterMask; + Updater *pUpdater; +}; + + +#endif // LL_LLSETKEYBINDDIALOG_H -- 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/newview/llsetkeybinddialog.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'indra/newview/llsetkeybinddialog.h') diff --git a/indra/newview/llsetkeybinddialog.h b/indra/newview/llsetkeybinddialog.h index fb3b2a2269..8faa2cc363 100644 --- a/indra/newview/llsetkeybinddialog.h +++ b/indra/newview/llsetkeybinddialog.h @@ -32,6 +32,7 @@ #include "lldrawfrustum.h" class LLCheckBoxCtrl; +class LLTextBase; // Filters for LLSetKeyBindDialog static const U32 ALLOW_MOUSE = 1; @@ -40,18 +41,18 @@ static const U32 ALLOW_KEYS = 4; //keyboard static const U32 ALLOW_MASK_KEYS = 8; static const U32 ALLOW_MASKS = 16; static const U32 CAN_IGNORE_MASKS = 32; // For example W (aka Forward) should work regardless of SHIFT being pressed -static const U32 DEFAULT_KEY_FILTER = ALLOW_MOUSE | ALLOW_MASK_MOUSE | ALLOW_KEYS | ALLOW_MASK_KEYS | CAN_IGNORE_MASKS; +static const U32 DEFAULT_KEY_FILTER = ALLOW_MOUSE | ALLOW_MASK_MOUSE | ALLOW_KEYS | ALLOW_MASK_KEYS; class LLKeyBindResponderInterface { public: - virtual ~LLKeyBindResponderInterface(); + virtual ~LLKeyBindResponderInterface() {}; - virtual void onCancelKeyBind(); - virtual void onDefaultKeyBind(); + virtual void onCancelKeyBind() = 0; + virtual void onDefaultKeyBind() = 0; // returns true if parent failed to set key due to key being in use - virtual bool onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore); + virtual bool onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore) = 0; }; class LLSetKeyBindDialog : public LLModalDialog, public LLDrawFrustum @@ -64,7 +65,7 @@ public: /*virtual*/ void onClose(bool app_quiting); /*virtual*/ void draw(); - void setParent(LLKeyBindResponderInterface* parent, U32 key_mask = DEFAULT_KEY_FILTER); + void setParent(LLKeyBindResponderInterface* parent, LLView* frustum_origin, U32 key_mask = DEFAULT_KEY_FILTER); BOOL handleKeyHere(KEY key, MASK mask); BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down); @@ -77,8 +78,9 @@ public: private: void setKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore); - LLKeyBindResponderInterface* pParent; - LLCheckBoxCtrl* pCheckBox; + LLKeyBindResponderInterface *pParent; + LLCheckBoxCtrl *pCheckBox; + LLTextBase *pDesription; U32 mKeyFilterMask; Updater *pUpdater; -- cgit v1.2.3 From 62214b53f09c453dc410465ba6e64a772562e6db Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 28 Oct 2019 18:27:13 +0200 Subject: SL-6109 Fixed conflict resolution issue caused by menu accelerators --- indra/newview/llsetkeybinddialog.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/llsetkeybinddialog.h') diff --git a/indra/newview/llsetkeybinddialog.h b/indra/newview/llsetkeybinddialog.h index 8faa2cc363..16a2d768e4 100644 --- a/indra/newview/llsetkeybinddialog.h +++ b/indra/newview/llsetkeybinddialog.h @@ -62,12 +62,16 @@ public: ~LLSetKeyBindDialog(); /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& data); /*virtual*/ void onClose(bool app_quiting); /*virtual*/ void draw(); void setParent(LLKeyBindResponderInterface* parent, LLView* frustum_origin, U32 key_mask = DEFAULT_KEY_FILTER); - BOOL handleKeyHere(KEY key, MASK mask); + // Wrapper around recordAndHandleKey + // It does not record, it handles, but handleKey function is already in use + static bool recordKey(KEY key, MASK mask); + BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down); static void onCancel(void* user_data); static void onBlank(void* user_data); @@ -77,6 +81,7 @@ public: class Updater; private: + bool recordAndHandleKey(KEY key, MASK mask); void setKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore); LLKeyBindResponderInterface *pParent; LLCheckBoxCtrl *pCheckBox; @@ -84,6 +89,8 @@ private: U32 mKeyFilterMask; Updater *pUpdater; + + static bool sRecordKeys; // for convinience and not to check instance each time }; -- cgit v1.2.3 From 73a1877ff0abcba46f66ef55440274119427723b Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 7 Nov 2019 20:09:25 +0200 Subject: SL-6109 - Edit mode appears to be obsolete and is not used, cleaned up - Improved ability to set defaults - Improved some labels - Made buttons bigger to accomodate languages with longer descriptions - Added ability to assign key for all modes simultaneously --- indra/newview/llsetkeybinddialog.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'indra/newview/llsetkeybinddialog.h') diff --git a/indra/newview/llsetkeybinddialog.h b/indra/newview/llsetkeybinddialog.h index 16a2d768e4..c7b4e3c364 100644 --- a/indra/newview/llsetkeybinddialog.h +++ b/indra/newview/llsetkeybinddialog.h @@ -40,7 +40,6 @@ static const U32 ALLOW_MASK_MOUSE = 2; static const U32 ALLOW_KEYS = 4; //keyboard static const U32 ALLOW_MASK_KEYS = 8; static const U32 ALLOW_MASKS = 16; -static const U32 CAN_IGNORE_MASKS = 32; // For example W (aka Forward) should work regardless of SHIFT being pressed static const U32 DEFAULT_KEY_FILTER = ALLOW_MOUSE | ALLOW_MASK_MOUSE | ALLOW_KEYS | ALLOW_MASK_KEYS; @@ -50,9 +49,9 @@ public: virtual ~LLKeyBindResponderInterface() {}; virtual void onCancelKeyBind() = 0; - virtual void onDefaultKeyBind() = 0; + virtual void onDefaultKeyBind(bool all_modes) = 0; // returns true if parent failed to set key due to key being in use - virtual bool onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore) = 0; + virtual bool onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes) = 0; }; class LLSetKeyBindDialog : public LLModalDialog, public LLDrawFrustum @@ -82,7 +81,7 @@ public: private: bool recordAndHandleKey(KEY key, MASK mask); - void setKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore); + void setKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes); LLKeyBindResponderInterface *pParent; LLCheckBoxCtrl *pCheckBox; LLTextBase *pDesription; -- cgit v1.2.3 From 0d78aa31e2bd2cf55c83a4447027a94b0939ae26 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 11 Nov 2019 20:38:52 +0200 Subject: SL-6109 Removed LLDrawFrustum and used changes from EEP to prevent merge conflicts --- indra/newview/llsetkeybinddialog.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'indra/newview/llsetkeybinddialog.h') diff --git a/indra/newview/llsetkeybinddialog.h b/indra/newview/llsetkeybinddialog.h index c7b4e3c364..70190230e4 100644 --- a/indra/newview/llsetkeybinddialog.h +++ b/indra/newview/llsetkeybinddialog.h @@ -29,7 +29,6 @@ #define LL_LLSETKEYBINDDIALOG_H #include "llmodaldialog.h" -#include "lldrawfrustum.h" class LLCheckBoxCtrl; class LLTextBase; @@ -54,7 +53,7 @@ public: virtual bool onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes) = 0; }; -class LLSetKeyBindDialog : public LLModalDialog, public LLDrawFrustum +class LLSetKeyBindDialog : public LLModalDialog { public: LLSetKeyBindDialog(const LLSD& key); @@ -90,6 +89,16 @@ private: Updater *pUpdater; static bool sRecordKeys; // for convinience and not to check instance each time + + // drawFrustum +private: + void drawFrustum(); + + LLHandle mFrustumOrigin; + F32 mContextConeOpacity; + F32 mContextConeInAlpha; + F32 mContextConeOutAlpha; + F32 mContextConeFadeTime; }; -- cgit v1.2.3 From 9abac37e42781aaacfc9331627182c2e83f98fd9 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 2 Dec 2020 13:48:27 +0200 Subject: SL-14438 Fixed Viewer lost ability to assign Masks as keys --- indra/newview/llsetkeybinddialog.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llsetkeybinddialog.h') diff --git a/indra/newview/llsetkeybinddialog.h b/indra/newview/llsetkeybinddialog.h index 70190230e4..ec3c813a66 100644 --- a/indra/newview/llsetkeybinddialog.h +++ b/indra/newview/llsetkeybinddialog.h @@ -39,7 +39,7 @@ static const U32 ALLOW_MASK_MOUSE = 2; static const U32 ALLOW_KEYS = 4; //keyboard static const U32 ALLOW_MASK_KEYS = 8; static const U32 ALLOW_MASKS = 16; -static const U32 DEFAULT_KEY_FILTER = ALLOW_MOUSE | ALLOW_MASK_MOUSE | ALLOW_KEYS | ALLOW_MASK_KEYS; +static const U32 DEFAULT_KEY_FILTER = ALLOW_MOUSE | ALLOW_MASK_MOUSE | ALLOW_KEYS | ALLOW_MASKS | ALLOW_MASK_KEYS; class LLKeyBindResponderInterface @@ -68,7 +68,7 @@ public: // Wrapper around recordAndHandleKey // It does not record, it handles, but handleKey function is already in use - static bool recordKey(KEY key, MASK mask); + static bool recordKey(KEY key, MASK mask, BOOL down); BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down); static void onCancel(void* user_data); @@ -79,7 +79,7 @@ public: class Updater; private: - bool recordAndHandleKey(KEY key, MASK mask); + bool recordAndHandleKey(KEY key, MASK mask, BOOL down); void setKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes); LLKeyBindResponderInterface *pParent; LLCheckBoxCtrl *pCheckBox; -- cgit v1.2.3 From c713b953e831172bf161d011dc7eda600eb5b139 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 4 Dec 2020 21:25:34 +0200 Subject: SL-14438 Adjusted behavior of recording mask keys If 'mask+key' got rejected, don record it as 'mask' --- indra/newview/llsetkeybinddialog.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llsetkeybinddialog.h') diff --git a/indra/newview/llsetkeybinddialog.h b/indra/newview/llsetkeybinddialog.h index ec3c813a66..a34b952233 100644 --- a/indra/newview/llsetkeybinddialog.h +++ b/indra/newview/llsetkeybinddialog.h @@ -87,6 +87,7 @@ private: U32 mKeyFilterMask; Updater *pUpdater; + KEY mLastMaskKey; static bool sRecordKeys; // for convinience and not to check instance each time -- cgit v1.2.3