diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index a6b86159b8..46166ca3f7 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -530,7 +530,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW if( *cur == '\n' ) { // Script editor ignoring font selection - //LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(cur-base); + //LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, cur-base); LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(getDefaultStyle(editor), cur-base); // text_segment->setToken( 0 ); @@ -760,7 +760,7 @@ void LLKeywords::insertSegments(const LLWString& wtext, std::vector Script editor ignoring font selection - //LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(pos); + //LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, pos); LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(getDefaultStyle(editor), pos); // text_segment->setToken( cur_token ); diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 7ec9f3028c..c82fdaa451 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -1800,7 +1800,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 > tokenizer; boost::char_separator sep("_"); @@ -3671,6 +3672,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(p); success &= branch->addToAcceleratorList(&mAccelerators); diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 9caf356183..335805d2fe 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -556,6 +556,8 @@ public: // add a context menu branch BOOL appendContextSubMenu(LLMenuGL *menu); + const LLFontGL *getFont() const { return mFont; } + // Items-accessor typedef std::list< LLMenuItemGL* > item_list_t; item_list_t* getItems() { return &mItems; } @@ -592,6 +594,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 22e0b34a6f..ecb6a64f3f 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1115,9 +1115,15 @@ void LLTaskLSLBridge::openItem() LLSD floater_key; floater_key["taskid"] = mPanel->getTaskUUID(); floater_key["itemid"] = mUUID; + LLLiveLSLEditor* preview = LLFloaterReg::showTypedInstance("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 04ce677244..7cc8a775a0 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -367,6 +367,38 @@ void LLFloaterScriptSearch::onSearchBoxCommit() #endif // +/// --------------------------------------------------------------------------- + +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 /// --------------------------------------------------------------------------- @@ -1278,7 +1310,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); @@ -2204,6 +2236,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 @@ -2217,9 +2257,20 @@ BOOL LLPreviewLSL::postBuild() 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); + // Make ugly location display better + //getChild("path_txt")->setValue(item_path); + //getChild("path_txt")->setToolTip(item_path); + getChild("path_txt")->setTextArg("[PATH]", LLStringExplicit(item_path)); + getChild("path_txt")->setToolTipArg(LLStringExplicit("[PATH]"), LLStringExplicit(item_path)); + // } + // Make ugly location display better + else + { + getChild("path_txt")->setTextArg("[PATH]", LLStringExplicit("-")); + getChild("path_txt")->setToolTipArg(LLStringExplicit("[PATH]"), LLStringExplicit("-")); + } + // childSetCommitCallback("desc", LLPreview::onText, this); getChild("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); @@ -2234,7 +2285,25 @@ void LLPreviewLSL::draw() setTitle(LLTrans::getString("ScriptWasDeleted")); mScriptEd->setItemRemoved(TRUE); } - + if (mDirty) + { + // Make ugly location display better + //std::string item_path = get_category_path(item->getParentUUID()); + //getChild("path_txt")->setValue(item_path); + //getChild("path_txt")->setToolTip(item_path); + if (item) + { + std::string item_path = get_category_path(item->getParentUUID()); + getChild("path_txt")->setTextArg("[PATH]", LLStringExplicit(item_path)); + getChild("path_txt")->setToolTipArg(LLStringExplicit("[PATH]"), LLStringExplicit(item_path)); + } + else + { + getChild("path_txt")->setTextArg("[PATH]", LLStringExplicit("-")); + getChild("path_txt")->setToolTipArg(LLStringExplicit("[PATH]"), LLStringExplicit("-")); + } + // + } LLPreview::draw(); } // virtual @@ -2625,7 +2694,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); } @@ -2790,6 +2860,10 @@ void LLLiveLSLEditor::loadAsset() } refreshFromItem(); + // Make ugly location display better + //getChild("obj_name")->setValue(mObjectName); + getChild("obj_name")->setTextArg("[SOURCE_OBJECT]", LLStringExplicit(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 458c91ec7b..77fdb6a8ac 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -54,6 +54,7 @@ class LLViewerInventoryItem; class LLScriptEdContainer; class LLFloaterGotoLine; class LLFloaterExperienceProfile; +class LLScriptMovedObserver; // [SL:KB] - Patch: Build-ScriptRecover | Checked: 2011-11-23 (Catznip-3.2.0) class LLEventTimer; // [/SL:KB] @@ -318,6 +319,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); @@ -355,6 +362,8 @@ protected: // Can safely close only after both text and bytecode are uploaded S32 mPendingUploads; + LLScriptMovedObserver* mItemObserver; + }; @@ -391,6 +400,8 @@ public: void requestExperiences(); void experienceChanged(); void addAssociatedExperience(const LLSD& experience); + + void setObjectName(std::string name) { mObjectName = name; } private: virtual BOOL canClose(); @@ -452,6 +463,7 @@ private: LLSD mExperienceIds; LLHandle mExperienceProfile; + std::string mObjectName; }; #endif // LL_LLPREVIEWSCRIPT_H diff --git a/indra/newview/skins/default/xui/de/floater_live_lsleditor.xml b/indra/newview/skins/default/xui/de/floater_live_lsleditor.xml index 4a9cd4ceb9..afda0a4a27 100644 --- a/indra/newview/skins/default/xui/de/floater_live_lsleditor.xml +++ b/indra/newview/skins/default/xui/de/floater_live_lsleditor.xml @@ -24,6 +24,7 @@ Laden... + Ursprungsobjekt: [SOURCE_OBJECT]