Merge branch 'DRTVWR-588-maint-W' of https://github.com/secondlife/viewer

# Conflicts:
#	indra/llui/llkeywords.cpp
#	indra/llui/llmenugl.h
#	indra/newview/llpreviewscript.h
master
Ansariel 2023-08-03 12:41:58 +02:00
commit bf55133ea5
11 changed files with 133 additions and 16 deletions

View File

@ -530,7 +530,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
if( *cur == '\n' )
{
// <FS:Ansariel> 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);
// </FS:Ansariel>
text_segment->setToken( 0 );
@ -760,7 +760,7 @@ void LLKeywords::insertSegments(const LLWString& wtext, std::vector<LLTextSegmen
}
// <FS:Ansariel> 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);
// </FS:Ansariel>
text_segment->setToken( cur_token );

View File

@ -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<boost::char_separator<char> > tokenizer;
boost::char_separator<char> 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<LLMenuItemBranchDownGL>(p);
success &= branch->addToAcceleratorList(&mAccelerators);

View File

@ -556,6 +556,8 @@ public:
// add a context menu branch
BOOL appendContextSubMenu(LLMenuGL *menu);
const LLFontGL *getFont() const { return mFont; }
// <FS:Ansariel> 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:

View File

@ -1115,9 +1115,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());
}
}

View File

@ -367,6 +367,38 @@ void LLFloaterScriptSearch::onSearchBoxCommit()
#endif
// </FS>
/// ---------------------------------------------------------------------------
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
/// ---------------------------------------------------------------------------
@ -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<LLUICtrl>("desc")->setValue(item->getDescription());
std::string item_path = get_category_path(item->getParentUUID());
getChild<LLUICtrl>("path_txt")->setValue(item_path);
getChild<LLUICtrl>("path_txt")->setToolTip(item_path);
// <FS:Ansariel> Make ugly location display better
//getChild<LLUICtrl>("path_txt")->setValue(item_path);
//getChild<LLUICtrl>("path_txt")->setToolTip(item_path);
getChild<LLUICtrl>("path_txt")->setTextArg("[PATH]", LLStringExplicit(item_path));
getChild<LLUICtrl>("path_txt")->setToolTipArg(LLStringExplicit("[PATH]"), LLStringExplicit(item_path));
// </FS:Ansariel>
}
// <FS:Ansariel> Make ugly location display better
else
{
getChild<LLUICtrl>("path_txt")->setTextArg("[PATH]", LLStringExplicit("-"));
getChild<LLUICtrl>("path_txt")->setToolTipArg(LLStringExplicit("[PATH]"), LLStringExplicit("-"));
}
// </FS:Ansariel>
childSetCommitCallback("desc", LLPreview::onText, this);
getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
@ -2234,7 +2285,25 @@ void LLPreviewLSL::draw()
setTitle(LLTrans::getString("ScriptWasDeleted"));
mScriptEd->setItemRemoved(TRUE);
}
if (mDirty)
{
// <FS:Ansariel> Make ugly location display better
//std::string item_path = get_category_path(item->getParentUUID());
//getChild<LLUICtrl>("path_txt")->setValue(item_path);
//getChild<LLUICtrl>("path_txt")->setToolTip(item_path);
if (item)
{
std::string item_path = get_category_path(item->getParentUUID());
getChild<LLUICtrl>("path_txt")->setTextArg("[PATH]", LLStringExplicit(item_path));
getChild<LLUICtrl>("path_txt")->setToolTipArg(LLStringExplicit("[PATH]"), LLStringExplicit(item_path));
}
else
{
getChild<LLUICtrl>("path_txt")->setTextArg("[PATH]", LLStringExplicit("-"));
getChild<LLUICtrl>("path_txt")->setToolTipArg(LLStringExplicit("[PATH]"), LLStringExplicit("-"));
}
// </FS:Ansariel>
}
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();
// <FS:Ansariel> Make ugly location display better
//getChild<LLUICtrl>("obj_name")->setValue(mObjectName);
getChild<LLUICtrl>("obj_name")->setTextArg("[SOURCE_OBJECT]", LLStringExplicit(mObjectName) );
// </FS:Ansariel>
// This is commented out, because we don't completely
// handle script exports yet.
/*

View File

@ -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<LLFloater> mExperienceProfile;
std::string mObjectName;
};
#endif // LL_LLPREVIEWSCRIPT_H

View File

@ -24,6 +24,7 @@
<floater.string name="loading">
Laden...
</floater.string>
<text name="obj_name">Ursprungsobjekt: [SOURCE_OBJECT]</text>
<button label="Zurücksetzen" label_selected="Zurücksetzen" name="Reset"/>
<check_box initial_value="true" label="Läuft" name="running"/>
<check_box initial_value="true" label="Mono" name="mono"/>

View File

@ -3,6 +3,7 @@
<floater.string name="Title">
Skript: [NAME]
</floater.string>
<text name="path_txt" tool_tip="Inventar-Ort: [PATH]">Inventar-Ort: [PATH]</text>
<text name="desc txt" width="90">
Beschreibung:
</text>

View File

@ -4,7 +4,7 @@
bevel_style="none"
border_style="line"
can_resize="true"
height="582"
height="602"
layout="topleft"
min_height="271"
min_width="328"
@ -45,6 +45,20 @@
name="loading">
Loading...
</floater.string>
<text
type="string"
length="1"
follows="left|top|right"
width="490"
use_ellipses="true"
font="SansSerif"
height="15"
layout="topleft"
left="13"
name="obj_name"
top="21">
Source object: [SOURCE_OBJECT]
</text>
<panel
bevel_style="none"
@ -54,7 +68,7 @@
layout="topleft"
left="10"
name="script ed panel"
top="16"
top_pad="0"
width="501" />
<button
follows="left|bottom"

View File

@ -2,7 +2,7 @@
<floater
legacy_header_height="18"
can_resize="true"
height="593"
height="590"
layout="topleft"
min_height="271"
min_width="320"
@ -21,7 +21,7 @@
layout="topleft"
left="10"
name="script panel"
top="65"
top="62"
width="497" />
<icon
follows="top|right"
@ -40,12 +40,13 @@
width="490"
use_ellipses="true"
font="SansSerif"
height="19"
height="18"
layout="topleft"
left="13"
name="path_txt"
text_color="white"
tool_tip="Inventory location: [PATH]"
top="21">
Inventory location: [PATH]
</text>
<text
type="string"
@ -56,7 +57,7 @@
layout="topleft"
left="13"
name="desc txt"
top_pad="5"
top_pad="4"
width="80">
Description:
</text>
@ -70,6 +71,6 @@
left_delta="80"
max_length_bytes="127"
name="desc"
top_delta="0"
top_delta="-2"
width="394" />
</floater>

View File

@ -4,5 +4,6 @@
bg_visible="true"
drop_shadow="true"
tear_off="false"
font="SansSerifSmall"
shortcut_pad="15">
</menu>