Skip to content

Commit 97d5063

Browse files
SL-19982 Update font for menu items; show object's name in lsl editor
1 parent c71da80 commit 97d5063

File tree

10 files changed

+100
-9
lines changed

10 files changed

+100
-9
lines changed

indra/llui/llkeywords.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
501501
{
502502
if( *cur == '\n' )
503503
{
504-
LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(cur-base);
504+
LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, cur-base);
505505
text_segment->setToken( 0 );
506506
insertSegment( *seg_list, text_segment, text_len, style, editor);
507507
cur++;
@@ -712,7 +712,7 @@ void LLKeywords::insertSegments(const LLWString& wtext, std::vector<LLTextSegmen
712712
insertSegment( seg_list, text_segment, text_len, style, editor);
713713
}
714714

715-
LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(pos);
715+
LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, pos);
716716
text_segment->setToken( cur_token );
717717
insertSegment( seg_list, text_segment, text_len, style, editor);
718718

indra/llui/llmenugl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,8 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p)
17771777
mNeedsArrange(FALSE),
17781778
mAlwaysShowMenu(FALSE),
17791779
mResetScrollPositionOnShow(true),
1780-
mShortcutPad(p.shortcut_pad)
1780+
mShortcutPad(p.shortcut_pad),
1781+
mFont(p.font)
17811782
{
17821783
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
17831784
boost::char_separator<char> sep("_");
@@ -3636,6 +3637,7 @@ BOOL LLMenuBarGL::appendMenu( LLMenuGL* menu )
36363637
p.disabled_color=LLUIColorTable::instance().getColor("MenuItemDisabledColor");
36373638
p.highlight_bg_color=LLUIColorTable::instance().getColor("MenuItemHighlightBgColor");
36383639
p.highlight_fg_color=LLUIColorTable::instance().getColor("MenuItemHighlightFgColor");
3640+
p.font = menu->getFont();
36393641

36403642
LLMenuItemBranchDownGL* branch = LLUICtrlFactory::create<LLMenuItemBranchDownGL>(p);
36413643
success &= branch->addToAcceleratorList(&mAccelerators);

indra/llui/llmenugl.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,9 @@ class LLMenuGL
555555
// add a context menu branch
556556
BOOL appendContextSubMenu(LLMenuGL *menu);
557557

558-
protected:
558+
const LLFontGL *getFont() const { return mFont; }
559+
560+
protected:
559561
void createSpilloverBranch();
560562
void cleanupSpilloverBranch();
561563
// Add the menu item to this menu.
@@ -587,6 +589,9 @@ class LLMenuGL
587589
BOOL mKeepFixedSize;
588590
BOOL mNeedsArrange;
589591

592+
// Font for top menu items only
593+
const LLFontGL* mFont;
594+
590595
private:
591596

592597

indra/newview/llpanelobjectinventory.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,9 +960,15 @@ void LLTaskLSLBridge::openItem()
960960
LLSD floater_key;
961961
floater_key["taskid"] = mPanel->getTaskUUID();
962962
floater_key["itemid"] = mUUID;
963+
963964
LLLiveLSLEditor* preview = LLFloaterReg::showTypedInstance<LLLiveLSLEditor>("preview_scriptedit", floater_key, TAKE_FOCUS_YES);
964965
if (preview)
965966
{
967+
LLSelectNode *node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(NULL, TRUE);
968+
if (node && node->mValid)
969+
{
970+
preview->setObjectName(node->mName);
971+
}
966972
preview->setObjectID(mPanel->getTaskUUID());
967973
}
968974
}

indra/newview/llpreviewscript.cpp

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,38 @@ void LLFloaterScriptSearch::onSearchBoxCommit()
324324
}
325325
}
326326

327+
/// ---------------------------------------------------------------------------
328+
329+
class LLScriptMovedObserver : public LLInventoryObserver
330+
{
331+
public:
332+
LLScriptMovedObserver(LLPreviewLSL *floater) : mPreview(floater) { gInventory.addObserver(this); }
333+
virtual ~LLScriptMovedObserver() { gInventory.removeObserver(this); }
334+
virtual void changed(U32 mask);
335+
336+
private:
337+
LLPreviewLSL *mPreview;
338+
};
339+
340+
void LLScriptMovedObserver::changed(U32 mask)
341+
{
342+
const std::set<LLUUID> &mChangedItemIDs = gInventory.getChangedIDs();
343+
std::set<LLUUID>::const_iterator it;
344+
345+
const LLUUID &item_id = mPreview->getScriptID();
346+
347+
for (it = mChangedItemIDs.begin(); it != mChangedItemIDs.end(); it++)
348+
{
349+
if (*it == item_id)
350+
{
351+
if ((mask & (LLInventoryObserver::STRUCTURE)) != 0)
352+
{
353+
mPreview->setDirty();
354+
}
355+
}
356+
}
357+
}
358+
327359
/// ---------------------------------------------------------------------------
328360
/// LLScriptEdCore
329361
/// ---------------------------------------------------------------------------
@@ -1554,6 +1586,14 @@ LLPreviewLSL::LLPreviewLSL(const LLSD& key )
15541586
mPendingUploads(0)
15551587
{
15561588
mFactoryMap["script panel"] = LLCallbackMap(LLPreviewLSL::createScriptEdPanel, this);
1589+
1590+
mItemObserver = new LLScriptMovedObserver(this);
1591+
}
1592+
1593+
LLPreviewLSL::~LLPreviewLSL()
1594+
{
1595+
delete mItemObserver;
1596+
mItemObserver = NULL;
15571597
}
15581598

15591599
// virtual
@@ -1584,7 +1624,12 @@ void LLPreviewLSL::draw()
15841624
setTitle(LLTrans::getString("ScriptWasDeleted"));
15851625
mScriptEd->setItemRemoved(TRUE);
15861626
}
1587-
1627+
if (mDirty)
1628+
{
1629+
std::string item_path = get_category_path(item->getParentUUID());
1630+
getChild<LLUICtrl>("path_txt")->setValue(item_path);
1631+
getChild<LLUICtrl>("path_txt")->setToolTip(item_path);
1632+
}
15881633
LLPreview::draw();
15891634
}
15901635
// virtual
@@ -1870,7 +1915,8 @@ LLLiveLSLEditor::LLLiveLSLEditor(const LLSD& key) :
18701915
mPendingUploads(0),
18711916
mIsModifiable(FALSE),
18721917
mIsNew(false),
1873-
mIsSaving(FALSE)
1918+
mIsSaving(FALSE),
1919+
mObjectName("")
18741920
{
18751921
mFactoryMap["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this);
18761922
}
@@ -2007,6 +2053,7 @@ void LLLiveLSLEditor::loadAsset()
20072053
}
20082054

20092055
refreshFromItem();
2056+
getChild<LLUICtrl>("obj_name")->setValue(mObjectName);
20102057
// This is commented out, because we don't completely
20112058
// handle script exports yet.
20122059
/*

indra/newview/llpreviewscript.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class LLViewerInventoryItem;
5353
class LLScriptEdContainer;
5454
class LLFloaterGotoLine;
5555
class LLFloaterExperienceProfile;
56+
class LLScriptMovedObserver;
5657

5758
class LLLiveLSLFile : public LLLiveFile
5859
{
@@ -227,6 +228,12 @@ class LLPreviewLSL : public LLScriptEdContainer
227228
{
228229
public:
229230
LLPreviewLSL(const LLSD& key );
231+
~LLPreviewLSL();
232+
233+
LLUUID getScriptID() { return mItemUUID; }
234+
235+
void setDirty() { mDirty = true; }
236+
230237
virtual void callbackLSLCompileSucceeded();
231238
virtual void callbackLSLCompileFailed(const LLSD& compile_errors);
232239

@@ -257,6 +264,8 @@ class LLPreviewLSL : public LLScriptEdContainer
257264
// Can safely close only after both text and bytecode are uploaded
258265
S32 mPendingUploads;
259266

267+
LLScriptMovedObserver* mItemObserver;
268+
260269
};
261270

262271

@@ -289,6 +298,8 @@ class LLLiveLSLEditor : public LLScriptEdContainer
289298
void requestExperiences();
290299
void experienceChanged();
291300
void addAssociatedExperience(const LLSD& experience);
301+
302+
void setObjectName(std::string name) { mObjectName = name; }
292303

293304
private:
294305
virtual BOOL canClose();
@@ -347,6 +358,7 @@ class LLLiveLSLEditor : public LLScriptEdContainer
347358
LLSD mExperienceIds;
348359

349360
LLHandle<LLFloater> mExperienceProfile;
361+
std::string mObjectName;
350362
};
351363

352364
#endif // LL_LLPREVIEWSCRIPT_H

indra/newview/skins/default/xui/en/floater_live_lsleditor.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
bevel_style="none"
55
border_style="line"
66
can_resize="true"
7-
height="582"
7+
height="607"
88
layout="topleft"
99
min_height="271"
1010
min_width="328"
@@ -45,6 +45,21 @@
4545
name="loading">
4646
Loading...
4747
</floater.string>
48+
<text
49+
type="string"
50+
length="1"
51+
follows="left|top|right"
52+
width="490"
53+
use_ellipses="true"
54+
font="SansSerif"
55+
height="18"
56+
layout="topleft"
57+
left="13"
58+
name="obj_name"
59+
text_color="white"
60+
top="21">
61+
Object name
62+
</text>
4863
<panel
4964
bevel_style="none"
5065

@@ -54,7 +69,7 @@
5469
layout="topleft"
5570
left="10"
5671
name="script ed panel"
57-
top="16"
72+
top_pad="2"
5873
width="501" />
5974
<button
6075
follows="left|bottom"

indra/newview/skins/default/xui/en/floater_script_preview.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
width="490"
4141
use_ellipses="true"
4242
font="SansSerif"
43-
height="19"
43+
height="18"
4444
layout="topleft"
4545
left="13"
4646
name="path_txt"

indra/newview/skins/default/xui/en/panel_script_ed.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
layout="topleft"
4545
left="0"
4646
mouse_opaque="false"
47+
font="SansSerif"
4748
name="File"
4849
width="138">
4950
<menu_item_call
@@ -74,6 +75,7 @@
7475
label="Edit"
7576
layout="topleft"
7677
mouse_opaque="false"
78+
font="SansSerif"
7779
name="Edit"
7880
width="139">
7981
<menu_item_call
@@ -134,6 +136,7 @@
134136
label="Help"
135137
layout="topleft"
136138
mouse_opaque="false"
139+
font="SansSerif"
137140
name="Help"
138141
width="112">
139142
<menu_item_call

indra/newview/skins/default/xui/en/widgets/menu.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
bg_visible="true"
55
drop_shadow="true"
66
tear_off="false"
7+
font="SansSerifSmall"
78
shortcut_pad="15">
89
</menu>

0 commit comments

Comments
 (0)