From 97d5063cb1e5474d2d5aa65872c9a608a1207905 Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
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/llui/llkeywords.cpp                          |  4 +-
 indra/llui/llmenugl.cpp                            |  4 +-
 indra/llui/llmenugl.h                              |  7 ++-
 indra/newview/llpanelobjectinventory.cpp           |  6 +++
 indra/newview/llpreviewscript.cpp                  | 51 +++++++++++++++++++++-
 indra/newview/llpreviewscript.h                    | 12 +++++
 .../default/xui/en/floater_live_lsleditor.xml      | 19 +++++++-
 .../default/xui/en/floater_script_preview.xml      |  2 +-
 .../skins/default/xui/en/panel_script_ed.xml       |  3 ++
 .../newview/skins/default/xui/en/widgets/menu.xml  |  1 +
 10 files changed, 100 insertions(+), 9 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index 56e0c4f0f8..341ddb83f3 100644
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -501,7 +501,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
 		{
 			if( *cur == '\n' )
 			{
-				LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(cur-base);
+				LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, cur-base);
 				text_segment->setToken( 0 );
 				insertSegment( *seg_list, text_segment, text_len, style, editor);
 				cur++;
@@ -712,7 +712,7 @@ void LLKeywords::insertSegments(const LLWString& wtext, std::vector<LLTextSegmen
 			insertSegment( seg_list, text_segment, text_len, style, editor);
 		}
 
-		LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(pos);
+		LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, pos);
 		text_segment->setToken( cur_token );
 		insertSegment( seg_list, text_segment, text_len, style, editor);
 
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 33c4b6ec73..99dbdcf775 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -1777,7 +1777,8 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p)
 	mNeedsArrange(FALSE),
 	mAlwaysShowMenu(FALSE),
 	mResetScrollPositionOnShow(true),
-	mShortcutPad(p.shortcut_pad)
+	mShortcutPad(p.shortcut_pad),
+    mFont(p.font)
 {
 	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
 	boost::char_separator<char> sep("_");
@@ -3636,6 +3637,7 @@ BOOL LLMenuBarGL::appendMenu( LLMenuGL* menu )
 	p.disabled_color=LLUIColorTable::instance().getColor("MenuItemDisabledColor");
 	p.highlight_bg_color=LLUIColorTable::instance().getColor("MenuItemHighlightBgColor");
 	p.highlight_fg_color=LLUIColorTable::instance().getColor("MenuItemHighlightFgColor");
+    p.font = menu->getFont();
 
 	LLMenuItemBranchDownGL* branch = LLUICtrlFactory::create<LLMenuItemBranchDownGL>(p);
 	success &= branch->addToAcceleratorList(&mAccelerators);
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index 9d3be8d94f..8194501f79 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -555,7 +555,9 @@ public:
 	// add a context menu branch
 	BOOL appendContextSubMenu(LLMenuGL *menu);
 
-protected:
+    const LLFontGL *getFont() const { return mFont; }
+
+  protected:
 	void createSpilloverBranch();
 	void cleanupSpilloverBranch();
 	// Add the menu item to this menu.
@@ -587,6 +589,9 @@ protected:
 	BOOL			mKeepFixedSize;
 	BOOL			mNeedsArrange;
 
+    // Font for top menu items only
+    const LLFontGL* mFont;
+
 private:
 
 
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 6a82a3b35d..d935c01eb8 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -960,9 +960,15 @@ void LLTaskLSLBridge::openItem()
 		LLSD floater_key;
 		floater_key["taskid"] = mPanel->getTaskUUID();
 		floater_key["itemid"] = mUUID;
+
 		LLLiveLSLEditor* preview = LLFloaterReg::showTypedInstance<LLLiveLSLEditor>("preview_scriptedit", floater_key, TAKE_FOCUS_YES);
 		if (preview)
 		{
+            LLSelectNode *node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(NULL, TRUE);
+            if (node && node->mValid)
+            {
+                preview->setObjectName(node->mName);
+            }
 			preview->setObjectID(mPanel->getTaskUUID());
 		}
 	}
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<LLUUID> &mChangedItemIDs = gInventory.getChangedIDs();
+    std::set<LLUUID>::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<LLUICtrl>("path_txt")->setValue(item_path);
+        getChild<LLUICtrl>("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<LLUICtrl>("obj_name")->setValue(mObjectName);
 			// This is commented out, because we don't completely
 			// handle script exports yet.
 			/*
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index 2e5b8ad9bb..36e5253fb6 100644
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -53,6 +53,7 @@ class LLViewerInventoryItem;
 class LLScriptEdContainer;
 class LLFloaterGotoLine;
 class LLFloaterExperienceProfile;
+class LLScriptMovedObserver;
 
 class LLLiveLSLFile : public LLLiveFile
 {
@@ -227,6 +228,12 @@ class LLPreviewLSL : public LLScriptEdContainer
 {
 public:
 	LLPreviewLSL(const LLSD& key );
+    ~LLPreviewLSL();
+
+    LLUUID getScriptID() { return mItemUUID; }
+
+    void setDirty() { mDirty = true; }
+
 	virtual void callbackLSLCompileSucceeded();
 	virtual void callbackLSLCompileFailed(const LLSD& compile_errors);
 
@@ -257,6 +264,8 @@ protected:
 	// Can safely close only after both text and bytecode are uploaded
 	S32 mPendingUploads;
 
+    LLScriptMovedObserver* mItemObserver;
+
 };
 
 
@@ -289,6 +298,8 @@ public:
 	void requestExperiences();
 	void experienceChanged();
 	void addAssociatedExperience(const LLSD& experience);
+
+    void setObjectName(std::string name) { mObjectName = name; }
 	
 private:
 	virtual BOOL canClose();
@@ -347,6 +358,7 @@ private:
 	LLSD			mExperienceIds;
 
 	LLHandle<LLFloater> mExperienceProfile;
+    std::string mObjectName;
 };
 
 #endif  // LL_LLPREVIEWSCRIPT_H
diff --git a/indra/newview/skins/default/xui/en/floater_live_lsleditor.xml b/indra/newview/skins/default/xui/en/floater_live_lsleditor.xml
index e8826034f6..88173e68fa 100644
--- a/indra/newview/skins/default/xui/en/floater_live_lsleditor.xml
+++ b/indra/newview/skins/default/xui/en/floater_live_lsleditor.xml
@@ -4,7 +4,7 @@
   bevel_style="none"
   border_style="line"
   can_resize="true"
-  height="582"
+  height="607"
   layout="topleft"
   min_height="271"
   min_width="328"
@@ -45,6 +45,21 @@
     name="loading">
     Loading...
   </floater.string>
+  <text
+   type="string"
+   length="1"
+   follows="left|top|right"
+   width="490"
+   use_ellipses="true"
+   font="SansSerif"
+   height="18"
+   layout="topleft"
+   left="13"
+   name="obj_name"
+   text_color="white"
+   top="21">
+    Object name
+  </text>
   <panel
     bevel_style="none"
      
@@ -54,7 +69,7 @@
     layout="topleft"
     left="10"
     name="script ed panel"
-    top="16"
+    top_pad="2"
     width="501" />
   <button
     follows="left|bottom"
diff --git a/indra/newview/skins/default/xui/en/floater_script_preview.xml b/indra/newview/skins/default/xui/en/floater_script_preview.xml
index 5bec45e666..91c18035db 100644
--- a/indra/newview/skins/default/xui/en/floater_script_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_script_preview.xml
@@ -40,7 +40,7 @@
      width="490"
      use_ellipses="true"
      font="SansSerif"
-     height="19"
+     height="18"
      layout="topleft"
      left="13"
      name="path_txt"
diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml
index be20cfd880..4ea4a4f38d 100644
--- a/indra/newview/skins/default/xui/en/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml
@@ -44,6 +44,7 @@
       layout="topleft"
       left="0"
       mouse_opaque="false"
+      font="SansSerif"
       name="File"
       width="138">
       <menu_item_call
@@ -74,6 +75,7 @@
       label="Edit"
       layout="topleft"
       mouse_opaque="false"
+      font="SansSerif"
       name="Edit"
       width="139">
       <menu_item_call
@@ -134,6 +136,7 @@
       label="Help"
       layout="topleft"
       mouse_opaque="false"
+      font="SansSerif"
       name="Help"
       width="112">
       <menu_item_call
diff --git a/indra/newview/skins/default/xui/en/widgets/menu.xml b/indra/newview/skins/default/xui/en/widgets/menu.xml
index 13ac84beb2..0e2b478aa5 100644
--- a/indra/newview/skins/default/xui/en/widgets/menu.xml
+++ b/indra/newview/skins/default/xui/en/widgets/menu.xml
@@ -4,5 +4,6 @@
       bg_visible="true"
       drop_shadow="true"
       tear_off="false"
+      font="SansSerifSmall" 
       shortcut_pad="15">
 </menu>
-- 
cgit v1.2.3