From 62245de7ae38468f337e4c64bc2c254e13c6fedc Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 1 Aug 2023 20:14:27 +0300 Subject: SL-19982 Adjustable font size in LSL editor --- indra/newview/llpreviewscript.cpp | 48 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index d677a996c1..2add126b2d 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -86,6 +86,9 @@ #include "llexperiencecache.h" #include "llfloaterexperienceprofile.h" #include "llviewerassetupload.h" +#include "lltoggleablemenu.h" +#include "llmenubutton.h" +#include "llinventoryfunctions.h" const std::string HELLO_LSL = "default\n" @@ -459,6 +462,13 @@ BOOL LLScriptEdCore::postBuild() LLSyntaxIdLSL::getInstance()->initialize(); processKeywords(); + mCommitCallbackRegistrar.add("FontSize.Set", boost::bind(&LLScriptEdCore::onChangeFontSize, this, _2)); + mEnableCallbackRegistrar.add("FontSize.Check", boost::bind(&LLScriptEdCore::isFontSizeChecked, this, _2)); + + LLToggleableMenu *context_menu = LLUICtrlFactory::getInstance()->createFromFile( + "menu_lsl_font_size.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + getChild("font_btn")->setMenu(context_menu, LLMenuButton::MP_BOTTOM_LEFT, true); + return TRUE; } @@ -1287,7 +1297,21 @@ LLUUID LLScriptEdCore::getAssociatedExperience()const return mAssociatedExperience; } -void LLLiveLSLEditor::setExperienceIds( const LLSD& experience_ids ) +void LLScriptEdCore::onChangeFontSize(const LLSD &userdata) +{ + const std::string font_name = userdata.asString(); + gSavedSettings.setString("LSLFontSizeName", font_name); +} + +bool LLScriptEdCore::isFontSizeChecked(const LLSD &userdata) +{ + const std::string current_size_name = LLScriptEditor::getScriptFontSize(); + const std::string size_name = userdata.asString(); + + return (size_name == current_size_name); +} + + void LLLiveLSLEditor::setExperienceIds( const LLSD& experience_ids ) { mExperienceIds=experience_ids; updateExperiencePanel(); @@ -1475,7 +1499,21 @@ bool LLScriptEdContainer::onExternalChange(const std::string& filename) return true; } -/// --------------------------------------------------------------------------- +BOOL LLScriptEdContainer::handleKeyHere(KEY key, MASK mask) +{ + if (('A' == key) && (MASK_CONTROL == (mask & MASK_MODIFIERS))) + { + mScriptEd->selectAll(); + return TRUE; + } + + if (!LLPreview::handleKeyHere(key, mask)) + { + return mScriptEd->handleKeyHere(key, mask); + } + return TRUE; +} + /// --------------------------------------------------------------------------- /// LLPreviewLSL /// --------------------------------------------------------------------------- @@ -1527,10 +1565,14 @@ BOOL LLPreviewLSL::postBuild() if (item) { getChild("desc")->setValue(item->getDescription()); + + std::string item_path = get_category_path(item->getParentUUID()); + getChild("path_txt")->setValue(item_path); + getChild("path_txt")->setToolTip(item_path); } childSetCommitCallback("desc", LLPreview::onText, this); getChild("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); - + return LLPreview::postBuild(); } -- cgit v1.2.3 From 97d5063cb1e5474d2d5aa65872c9a608a1207905 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 2 Aug 2023 14:27:25 +0300 Subject: SL-19982 Update font for menu items; show object's name in lsl editor --- indra/newview/llpreviewscript.cpp | 51 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 2add126b2d..62281d58f8 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -324,6 +324,38 @@ void LLFloaterScriptSearch::onSearchBoxCommit() } } +/// --------------------------------------------------------------------------- + +class LLScriptMovedObserver : public LLInventoryObserver +{ + public: + LLScriptMovedObserver(LLPreviewLSL *floater) : mPreview(floater) { gInventory.addObserver(this); } + virtual ~LLScriptMovedObserver() { gInventory.removeObserver(this); } + virtual void changed(U32 mask); + + private: + LLPreviewLSL *mPreview; +}; + +void LLScriptMovedObserver::changed(U32 mask) +{ + const std::set &mChangedItemIDs = gInventory.getChangedIDs(); + std::set::const_iterator it; + + const LLUUID &item_id = mPreview->getScriptID(); + + for (it = mChangedItemIDs.begin(); it != mChangedItemIDs.end(); it++) + { + if (*it == item_id) + { + if ((mask & (LLInventoryObserver::STRUCTURE)) != 0) + { + mPreview->setDirty(); + } + } + } +} + /// --------------------------------------------------------------------------- /// LLScriptEdCore /// --------------------------------------------------------------------------- @@ -1554,6 +1586,14 @@ LLPreviewLSL::LLPreviewLSL(const LLSD& key ) mPendingUploads(0) { mFactoryMap["script panel"] = LLCallbackMap(LLPreviewLSL::createScriptEdPanel, this); + + mItemObserver = new LLScriptMovedObserver(this); +} + +LLPreviewLSL::~LLPreviewLSL() +{ + delete mItemObserver; + mItemObserver = NULL; } // virtual @@ -1584,7 +1624,12 @@ void LLPreviewLSL::draw() setTitle(LLTrans::getString("ScriptWasDeleted")); mScriptEd->setItemRemoved(TRUE); } - + if (mDirty) + { + std::string item_path = get_category_path(item->getParentUUID()); + getChild("path_txt")->setValue(item_path); + getChild("path_txt")->setToolTip(item_path); + } LLPreview::draw(); } // virtual @@ -1870,7 +1915,8 @@ LLLiveLSLEditor::LLLiveLSLEditor(const LLSD& key) : mPendingUploads(0), mIsModifiable(FALSE), mIsNew(false), - mIsSaving(FALSE) + mIsSaving(FALSE), + mObjectName("") { mFactoryMap["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this); } @@ -2007,6 +2053,7 @@ void LLLiveLSLEditor::loadAsset() } refreshFromItem(); + getChild("obj_name")->setValue(mObjectName); // This is commented out, because we don't completely // handle script exports yet. /* -- cgit v1.2.3 From ce0274937f8f5446b38525bdc314259c16f13f3c Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 2 Aug 2023 14:43:41 +0300 Subject: SL-19982 update default help topic --- indra/newview/llpreviewscript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 62281d58f8..1666bfebd4 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -829,7 +829,7 @@ void LLScriptEdCore::setHelpPage(const std::string& help_string) LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); - url_string.setArg("[LSL_STRING]", help_string); + url_string.setArg("[LSL_STRING]", help_string.empty() ? HELP_LSL_PORTAL_TOPIC : help_string); addHelpItemToHistory(help_string); -- cgit v1.2.3 From b6cd14fc47cff62f6a30874d71be86d6639c32da Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 4 Aug 2023 15:36:40 +0300 Subject: SL-19982 make sure 'item' is not null --- indra/newview/llpreviewscript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 1666bfebd4..dc79abcdeb 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1624,7 +1624,7 @@ void LLPreviewLSL::draw() setTitle(LLTrans::getString("ScriptWasDeleted")); mScriptEd->setItemRemoved(TRUE); } - if (mDirty) + else if (mDirty) { std::string item_path = get_category_path(item->getParentUUID()); getChild("path_txt")->setValue(item_path); -- cgit v1.2.3