From 74b29abfd9e0f6dfd98f9d4dda881115eff8cb6c Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 27 Jan 2023 22:01:04 +0100 Subject: [PATCH] Open keyword help when pressing F1 in script editor --- indra/newview/llpreviewscript.h | 2 ++ indra/newview/llscripteditor.cpp | 18 ++++++++++++++++++ indra/newview/llscripteditor.h | 3 +++ 3 files changed, 23 insertions(+) diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 659a603440..3a0689c3d8 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -177,7 +177,9 @@ private: bool enableAction(const std::string& action); // NaCl End void onBtnHelp(); // Keep help links +public: // Show keyword help on F1 void onBtnDynamicHelp(); +private: // Show keyword help on F1 void onBtnUndoChanges(); bool hasChanged(); diff --git a/indra/newview/llscripteditor.cpp b/indra/newview/llscripteditor.cpp index 4b71be92d9..9730c1f7a0 100644 --- a/indra/newview/llscripteditor.cpp +++ b/indra/newview/llscripteditor.cpp @@ -31,6 +31,8 @@ #include "llsyntaxid.h" #include "lllocalcliprect.h" +#include "llpreviewscript.h" + // FIRE-23047: Increase width of line number column //const S32 UI_TEXTEDITOR_LINE_NUMBER_MARGIN = 32; const S32 UI_TEXTEDITOR_LINE_NUMBER_MARGIN = 40; @@ -283,3 +285,19 @@ void LLScriptEditor::startOfLine() } } // + +// Show keyword help on F1 +BOOL LLScriptEditor::handleKeyHere(KEY key, MASK mask) +{ + if (key == KEY_F1 && mask == MASK_NONE) + { + if (LLScriptEdCore* parent = getParentByType(); parent != nullptr) + { + parent->onBtnDynamicHelp(); + return TRUE; + } + } + + return LLTextEditor::handleKeyHere(key, mask); +} +// diff --git a/indra/newview/llscripteditor.h b/indra/newview/llscripteditor.h index 795871ca45..088d9e7f10 100644 --- a/indra/newview/llscripteditor.h +++ b/indra/newview/llscripteditor.h @@ -74,6 +74,9 @@ private: // Doesn't exist //void loadKeywords(const std::string& filename_keywords, // const std::string& filename_colors); + + // Show keyword help on F1 + /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); LLKeywords mKeywords; bool mShowLineNumbers;