diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llbadge.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llbutton.cpp | 10 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 2 | ||||
-rw-r--r-- | indra/llui/llconsole.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llcontainerview.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llcontainerview.h | 2 | ||||
-rw-r--r-- | indra/llui/lldockcontrol.cpp | 7 | ||||
-rw-r--r-- | indra/llui/lldockcontrol.h | 1 | ||||
-rw-r--r-- | indra/llui/llfolderview.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llfolderviewitem.cpp | 42 | ||||
-rw-r--r-- | indra/llui/llfolderviewitem.h | 6 | ||||
-rw-r--r-- | indra/llui/llmenugl.cpp | 10 | ||||
-rw-r--r-- | indra/llui/llmultisliderctrl.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llscrollbar.cpp | 24 | ||||
-rw-r--r-- | indra/llui/llscrollbar.h | 3 | ||||
-rw-r--r-- | indra/llui/llscrolllistcell.cpp | 24 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 72 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.h | 2 | ||||
-rw-r--r-- | indra/llui/llsliderctrl.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llstatbar.cpp | 10 | ||||
-rw-r--r-- | indra/llui/llstatgraph.cpp | 9 | ||||
-rw-r--r-- | indra/llui/llviewereventrecorder.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llwindowshade.cpp | 46 | ||||
-rw-r--r-- | indra/llui/llwindowshade.h | 7 |
24 files changed, 152 insertions, 151 deletions
diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index 3ff0617554..399f79ad2e 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -231,8 +231,6 @@ void LLBadge::draw() // Calculate badge size based on label text // - LLWString badge_label_wstring = mLabel; - S32 badge_label_begin_offset = 0; S32 badge_char_length = S32_MAX; S32 badge_pixel_length = S32_MAX; @@ -240,7 +238,7 @@ void LLBadge::draw() bool do_not_use_ellipses = false; F32 badge_width = (2.0f * mPaddingHoriz) + - mGLFont->getWidthF32(badge_label_wstring.c_str(), badge_label_begin_offset, badge_char_length); + mGLFont->getWidthF32(mLabel.getWString().c_str(), badge_label_begin_offset, badge_char_length); F32 badge_height = (2.0f * mPaddingVert) + mGLFont->getLineHeight(); @@ -354,7 +352,7 @@ void LLBadge::draw() // Draw the label // - mGLFont->render(badge_label_wstring, + mGLFont->render(mLabel.getWString(), badge_label_begin_offset, badge_center_x + mLabelOffsetHoriz, badge_center_y + mLabelOffsetVert, diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 9e1e3ba120..7b612e445b 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -796,9 +796,6 @@ void LLButton::draw() if( ll::ui::SearchableControl::getHighlighted() ) label_color = ll::ui::SearchableControl::getHighlightColor(); - // Unselected label assignments - LLWString label = getCurrentLabel(); - // overlay with keyboard focus border if (hasFocus()) { @@ -927,8 +924,9 @@ void LLButton::draw() } // Draw label - if( !label.empty() ) + if( !getCurrentLabel().empty() ) // Unselected label assignments { + LLWString label = getCurrentLabel(); LLWStringUtil::trim(label); S32 x; @@ -1082,10 +1080,10 @@ void LLButton::autoResize() resize(getCurrentLabel()); } -void LLButton::resize(LLUIString label) +void LLButton::resize(const LLUIString& label) { // get label length - S32 label_width = mGLFont->getWidth(label.getString()); + S32 label_width = mGLFont->getWidth(label.getWString().c_str()); // get current btn length S32 btn_width =getRect().getWidth(); // check if it need resize diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 80a876393e..a54a5b1a43 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -239,7 +239,7 @@ public: LLFontGL::HAlign getImageOverlayHAlign() const { return mImageOverlayAlignment; } void autoResize(); // resize with label of current btn state - void resize(LLUIString label); // resize with label input + void resize(const LLUIString& label); // resize with label input void setLabel(const std::string& label); void setLabel(const LLUIString& label); void setLabel( const LLStringExplicit& label); diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index fe4f991921..4f52f5936d 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -183,7 +183,7 @@ void LLConsole::draw() static LLCachedControl<F32> console_bg_opacity(*LLUI::getInstance()->mSettingGroups["config"], "ConsoleBackgroundOpacity", 0.7f); F32 console_opacity = llclamp(console_bg_opacity(), 0.f, 1.f); - LLColor4 color = LLUIColorTable::instance().getColor("ConsoleBackground"); + static LLColor4 color = LLUIColorTable::instance().getColor("ConsoleBackground"); color.mV[VALPHA] *= console_opacity; F32 line_height = (F32)mFont->getLineHeight(); diff --git a/indra/llui/llcontainerview.cpp b/indra/llui/llcontainerview.cpp index 4c2912cde6..b414e4354d 100644 --- a/indra/llui/llcontainerview.cpp +++ b/indra/llui/llcontainerview.cpp @@ -46,7 +46,7 @@ static ContainerViewRegistry::Register<LLPanel> r3("panel", &LLPanel::fromXML); LLContainerView::LLContainerView(const LLContainerView::Params& p) : LLView(p), mShowLabel(p.show_label), - mLabel(p.label), + mLabel(utf8str_to_wstring(p.label)), mDisplayChildren(p.display_children) { mScrollContainer = NULL; @@ -120,8 +120,8 @@ void LLContainerView::draw() // Draw the label if (mShowLabel) { - LLFontGL::getFontMonospace()->renderUTF8( - mLabel, 0, 2, getRect().getHeight() - 2, LLColor4(1,1,1,1), LLFontGL::LEFT, LLFontGL::TOP); + LLFontGL::getFontMonospace()->render( + mLabel, 0, 2.f, (F32)(getRect().getHeight() - 2), LLColor4(1,1,1,1), LLFontGL::LEFT, LLFontGL::TOP); } LLView::draw(); @@ -285,7 +285,7 @@ LLRect LLContainerView::getRequiredRect() void LLContainerView::setLabel(const std::string& label) { - mLabel = label; + mLabel = utf8str_to_wstring(label); } void LLContainerView::setDisplayChildren(bool displayChildren) diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h index 319fb7d5e9..c6dd401e85 100644 --- a/indra/llui/llcontainerview.h +++ b/indra/llui/llcontainerview.h @@ -89,6 +89,6 @@ public: protected: bool mDisplayChildren; - std::string mLabel; + LLWString mLabel; }; #endif // LL_CONTAINERVIEW_ diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index bf0862e8a9..11dbad8c09 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -43,6 +43,8 @@ LLDockControl::LLDockControl(LLView* dockWidget, LLFloater* dockableFloater, mDockWidgetHandle = dockWidget->getHandle(); } + mNonToolbarPanelHandle = mDockableFloater->getRootView()->getChild<LLView>("non_toolbar_panel")->getHandle(); + if (dockableFloater->isDocked()) { on(); @@ -97,7 +99,10 @@ void LLDockControl::setDock(LLView* dockWidget) void LLDockControl::getAllowedRect(LLRect& rect) { - rect = mDockableFloater->getRootView()->getChild<LLView>("non_toolbar_panel")->getRect(); + if(!mNonToolbarPanelHandle.isDead()) + { + rect = mNonToolbarPanelHandle.get()->getRect(); + } } void LLDockControl::repositionDockable() diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h index fb0bf7d251..7e31330713 100644 --- a/indra/llui/lldockcontrol.h +++ b/indra/llui/lldockcontrol.h @@ -84,6 +84,7 @@ private: bool mDockWidgetVisible; DocAt mDockAt; LLHandle<LLView> mDockWidgetHandle; + LLHandle<LLView> mNonToolbarPanelHandle; LLRect mPrevDockRect; LLRect mRootRect; LLRect mFloaterRect; diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 1d4ecbe9c9..388dc5b1ac 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -211,7 +211,7 @@ LLFolderView::LLFolderView(const Params& p) //clear label // go ahead and render root folder as usual // just make sure the label ("Inventory Folder") never shows up - mLabel = LLStringUtil::null; + mLabel.clear(); // Escape is handled by reverting the rename, not commiting it (default behavior) LLLineEditor::Params params; diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 4c1733506c..63a600b15f 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -140,7 +140,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mItemHeight(p.item_height), mControlLabelRotation(0.f), mDragAndDropTarget(false), - mLabel(p.name), + mLabel(utf8str_to_wstring(p.name)), mRoot(p.root), mViewModelItem(p.listener), mIsMouseOverTitle(false), @@ -193,7 +193,7 @@ bool LLFolderViewItem::postBuild() { // getDisplayName() is expensive (due to internal getLabelSuffix() and name building) // it also sets search strings so it requires a filter reset - mLabel = vmi->getDisplayName(); + mLabel = utf8str_to_wstring(vmi->getDisplayName()); setToolTip(vmi->getName()); // Dirty the filter flag of the model from the view (CHUI-849) @@ -306,7 +306,7 @@ void LLFolderViewItem::refresh() { LLFolderViewModelItem& vmi = *getViewModelItem(); - mLabel = vmi.getDisplayName(); + mLabel = utf8str_to_wstring(vmi.getDisplayName()); setToolTip(vmi.getName()); // icons are slightly expensive to get, can be optimized // see LLInventoryIcon::getIcon() @@ -319,7 +319,7 @@ void LLFolderViewItem::refresh() // Very Expensive! // Can do a number of expensive checks, like checking active motions, wearables or friend list mLabelStyle = vmi.getLabelStyle(); - mLabelSuffix = vmi.getLabelSuffix(); + mLabelSuffix = utf8str_to_wstring(vmi.getLabelSuffix()); } // Dirty the filter flag of the model from the view (CHUI-849) @@ -344,7 +344,7 @@ void LLFolderViewItem::refreshSuffix() // Very Expensive! // Can do a number of expensive checks, like checking active motions, wearables or friend list mLabelStyle = vmi->getLabelStyle(); - mLabelSuffix = vmi->getLabelSuffix(); + mLabelSuffix = utf8str_to_wstring(vmi->getLabelSuffix()); } mLabelWidthDirty = true; @@ -405,7 +405,7 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height ) // it is purely visual, so it is fine to do at our laisure refreshSuffix(); } - mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(LLFontGL::NORMAL)->getWidth(mLabelSuffix) + mLabelPaddingRight; + mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel.c_str()) + getLabelFontForStyle(LLFontGL::NORMAL)->getWidth(mLabelSuffix.c_str()) + mLabelPaddingRight; mLabelWidthDirty = false; } @@ -890,7 +890,7 @@ void LLFolderViewItem::drawLabel(const LLFontGL * font, const F32 x, const F32 y //--------------------------------------------------------------------------------// // Draw the actual label text // - font->renderUTF8(mLabel, 0, x, y, color, + font->render(mLabel, 0, x, y, color, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, getRect().getWidth() - (S32) x - mLabelPaddingRight, &right_x, /*use_ellipses*/true); } @@ -944,7 +944,7 @@ void LLFolderViewItem::draw() F32 right_x = 0; F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; F32 text_left = (F32)getLabelXPos(); - std::string combined_string = mLabel + mLabelSuffix; + LLWString combined_string = mLabel + mLabelSuffix; const LLFontGL* suffix_font = getLabelFontForStyle(LLFontGL::NORMAL); S32 filter_offset = static_cast<S32>(mViewModelItem->getFilterStringOffset()); @@ -954,8 +954,8 @@ void LLFolderViewItem::draw() S32 top = getRect().getHeight() - TOP_PAD; if(mLabelSuffix.empty() || (font == suffix_font)) { - S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, static_cast<S32>(mViewModelItem->getFilterStringOffset())) - 2; - S32 right = left + font->getWidth(combined_string, static_cast<S32>(mViewModelItem->getFilterStringOffset()), filter_string_length) + 2; + S32 left = ll_round(text_left) + font->getWidth(combined_string.c_str(), 0, static_cast<S32>(mViewModelItem->getFilterStringOffset())) - 2; + S32 right = left + font->getWidth(combined_string.c_str(), static_cast<S32>(mViewModelItem->getFilterStringOffset()), filter_string_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); @@ -966,8 +966,8 @@ void LLFolderViewItem::draw() S32 label_filter_length = llmin((S32)mLabel.size() - filter_offset, (S32)filter_string_length); if(label_filter_length > 0) { - S32 left = (S32)(ll_round(text_left) + font->getWidthF32(mLabel, 0, llmin(filter_offset, (S32)mLabel.size()))) - 2; - S32 right = left + (S32)font->getWidthF32(mLabel, filter_offset, label_filter_length) + 2; + S32 left = (S32)(ll_round(text_left) + font->getWidthF32(mLabel.c_str(), 0, llmin(filter_offset, (S32)mLabel.size()))) - 2; + S32 right = left + (S32)font->getWidthF32(mLabel.c_str(), filter_offset, label_filter_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); box_image->draw(box_rect, sFilterBGColor); @@ -976,8 +976,8 @@ void LLFolderViewItem::draw() if(suffix_filter_length > 0) { S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size()); - S32 left = (S32)(ll_round(text_left) + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset))- 2; - S32 right = left + (S32)suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length) + 2; + S32 left = (S32)(ll_round(text_left) + font->getWidthF32(mLabel.c_str(), 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix.c_str(), 0, suffix_offset)) - 2; + S32 right = left + (S32)suffix_font->getWidthF32(mLabelSuffix.c_str(), suffix_offset, suffix_filter_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); box_image->draw(box_rect, sFilterBGColor); @@ -999,7 +999,7 @@ void LLFolderViewItem::draw() // if (!mLabelSuffix.empty()) { - suffix_font->renderUTF8( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : (LLColor4)sSuffixColor, + suffix_font->render( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : (LLColor4)sSuffixColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x); } @@ -1011,9 +1011,9 @@ void LLFolderViewItem::draw() { if(mLabelSuffix.empty() || (font == suffix_font)) { - F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, filter_offset + filter_string_length) - font->getWidthF32(combined_string, filter_offset, filter_string_length); + F32 match_string_left = text_left + font->getWidthF32(combined_string.c_str(), 0, filter_offset + filter_string_length) - font->getWidthF32(combined_string.c_str(), filter_offset, filter_string_length); F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; - font->renderUTF8(combined_string, filter_offset, match_string_left, yy, + font->render(combined_string, filter_offset, match_string_left, yy, sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, filter_string_length, S32_MAX, &right_x); } @@ -1022,9 +1022,9 @@ void LLFolderViewItem::draw() S32 label_filter_length = llmin((S32)mLabel.size() - filter_offset, (S32)filter_string_length); if(label_filter_length > 0) { - F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, filter_offset + label_filter_length) - font->getWidthF32(mLabel, filter_offset, label_filter_length); + F32 match_string_left = text_left + font->getWidthF32(mLabel.c_str(), 0, filter_offset + label_filter_length) - font->getWidthF32(mLabel.c_str(), filter_offset, label_filter_length); F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; - font->renderUTF8(mLabel, filter_offset, match_string_left, yy, + font->render(mLabel, filter_offset, match_string_left, yy, sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, label_filter_length, S32_MAX, &right_x); } @@ -1033,9 +1033,9 @@ void LLFolderViewItem::draw() if(suffix_filter_length > 0) { S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size()); - F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length); + F32 match_string_left = text_left + font->getWidthF32(mLabel.c_str(), 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix.c_str(), 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix.c_str(), suffix_offset, suffix_filter_length); F32 yy = (F32)getRect().getHeight() - suffix_font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; - suffix_font->renderUTF8(mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor, + suffix_font->render(mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, suffix_filter_length, S32_MAX, &right_x); } diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index f7ced81274..60cdac3ab9 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -89,14 +89,14 @@ protected: LLFolderViewItem(const Params& p); - std::string mLabel; + LLWString mLabel; S32 mLabelWidth; bool mLabelWidthDirty; S32 mLabelPaddingRight; LLFolderViewFolder* mParentFolder; LLPointer<LLFolderViewModelItem> mViewModelItem; LLFontGL::StyleFlags mLabelStyle; - std::string mLabelSuffix; + LLWString mLabelSuffix; bool mSuffixNeedsRefresh; //suffix and icons LLUIImagePtr mIcon, mIconOpen, @@ -242,7 +242,7 @@ public: // This method returns the label displayed on the view. This // method was primarily added to allow sorting on the folder // contents possible before the entire view has been constructed. - const std::string& getLabel() const { return mLabel; } + const LLWString& getLabel() const { return mLabel; } LLFolderViewFolder* getParentFolder( void ) { return mParentFolder; } const LLFolderViewFolder* getParentFolder( void ) const { return mParentFolder; } diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 0038a8ae18..69ffa9a94f 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -545,8 +545,8 @@ void LLMenuItemGL::draw( void ) std::string::size_type offset = upper_case_label.find(mJumpKey); if (offset != std::string::npos) { - S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast<S32>(offset)); - S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast<S32>(offset) + 1); + S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel.getWString().c_str(), 0, static_cast<S32>(offset)); + S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel.getWString().c_str(), 0, static_cast<S32>(offset) + 1); gl_line_2d(x_begin, (MENU_ITEM_PADDING / 2) + 1, x_end, (MENU_ITEM_PADDING / 2) + 1); } } @@ -1648,9 +1648,9 @@ void LLMenuItemBranchDownGL::draw( void ) std::string::size_type offset = upper_case_label.find(getJumpKey()); if (offset != std::string::npos) { - S32 x_offset = ll_round((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f); - S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, static_cast<S32>(offset)); - S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, static_cast<S32>(offset) + 1); + S32 x_offset = ll_round((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getWString().c_str(), 0, S32_MAX) / 2.f); + S32 x_begin = x_offset + getFont()->getWidth(mLabel.getWString().c_str(), 0, static_cast<S32>(offset)); + S32 x_end = x_offset + getFont()->getWidth(mLabel.getWString().c_str(), 0, static_cast<S32>(offset) + 1); gl_line_2d(x_begin, LABEL_BOTTOM_PAD_PIXELS, x_end, LABEL_BOTTOM_PAD_PIXELS); } } diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index 01e2fc6ac9..6b9a1b1c13 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -245,7 +245,7 @@ bool LLMultiSliderCtrl::setLabelArg( const std::string& key, const LLStringExpli res = mLabelBox->setTextArg(key, text); if (res && mLabelWidth == 0) { - S32 label_width = mFont->getWidth(mLabelBox->getText()); + S32 label_width = mFont->getWidth(mLabelBox->getWText().c_str()); LLRect rect = mLabelBox->getRect(); S32 prev_right = rect.mRight; rect.mRight = rect.mLeft + label_width; diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index 9c73b1ba3f..d0eec387bd 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -113,7 +113,8 @@ LLScrollbar::LLScrollbar(const Params & p) up_btn.tab_stop(false); up_btn.follows.flags = (mOrientation == VERTICAL ? (FOLLOWS_RIGHT | FOLLOWS_TOP) : (FOLLOWS_LEFT | FOLLOWS_BOTTOM)); - addChild(LLUICtrlFactory::create<LLButton>(up_btn)); + mLineUpBtn = LLUICtrlFactory::create<LLButton>(up_btn); + addChild(mLineUpBtn); LLButton::Params down_btn(mOrientation == VERTICAL ? p.down_button : p.right_button); down_btn.name(std::string("Line Down")); @@ -123,7 +124,8 @@ LLScrollbar::LLScrollbar(const Params & p) down_btn.mouse_held_callback.function(boost::bind(&LLScrollbar::onLineDownBtnPressed, this, _2)); down_btn.tab_stop(false); - addChild(LLUICtrlFactory::create<LLButton>(down_btn)); + mLineDownBtn = LLUICtrlFactory::create<LLButton>(down_btn); + addChild(mLineDownBtn); } @@ -468,22 +470,20 @@ void LLScrollbar::reshape(S32 width, S32 height, bool called_from_parent) { if (width == getRect().getWidth() && height == getRect().getHeight()) return; LLView::reshape( width, height, called_from_parent ); - LLButton* up_button = getChild<LLButton>("Line Up"); - LLButton* down_button = getChild<LLButton>("Line Down"); if (mOrientation == VERTICAL) { - up_button->reshape(up_button->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); - down_button->reshape(down_button->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); - up_button->setOrigin(0, getRect().getHeight() - up_button->getRect().getHeight()); - down_button->setOrigin(0, 0); + mLineUpBtn->reshape(mLineUpBtn->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); + mLineDownBtn->reshape(mLineDownBtn->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); + mLineUpBtn->setOrigin(0, getRect().getHeight() - mLineUpBtn->getRect().getHeight()); + mLineDownBtn->setOrigin(0, 0); } else { - up_button->reshape(llmin(getRect().getWidth() / 2, mThickness), up_button->getRect().getHeight()); - down_button->reshape(llmin(getRect().getWidth() / 2, mThickness), down_button->getRect().getHeight()); - up_button->setOrigin(0, 0); - down_button->setOrigin(getRect().getWidth() - down_button->getRect().getWidth(), 0); + mLineUpBtn->reshape(llmin(getRect().getWidth() / 2, mThickness), mLineUpBtn->getRect().getHeight()); + mLineDownBtn->reshape(llmin(getRect().getWidth() / 2, mThickness), mLineDownBtn->getRect().getHeight()); + mLineUpBtn->setOrigin(0, 0); + mLineDownBtn->setOrigin(getRect().getWidth() - mLineDownBtn->getRect().getWidth(), 0); } updateThumbRect(); } diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h index 7b935aa51b..9607355a9d 100644 --- a/indra/llui/llscrollbar.h +++ b/indra/llui/llscrollbar.h @@ -161,6 +161,9 @@ private: LLUIImagePtr mTrackImageH; S32 mThickness; + + LLButton* mLineUpBtn = nullptr; + LLButton* mLineDownBtn = nullptr; }; diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 5dccf9a8ba..88ef4eb0c1 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -305,7 +305,7 @@ bool LLScrollListText::needsToolTip() const return LLScrollListCell::needsToolTip(); // ...otherwise, show tooltips for truncated text - return mFont->getWidth(mText.getString()) > getWidth(); + return mFont->getWidth(mText.getWString().c_str()) > getWidth(); } //virtual @@ -328,7 +328,7 @@ LLScrollListText::~LLScrollListText() S32 LLScrollListText::getContentWidth() const { - return mFont->getWidth(mText.getString()); + return mFont->getWidth(mText.getWString().c_str()); } @@ -394,18 +394,18 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col switch(mFontAlignment) { case LLFontGL::LEFT: - left = mFont->getWidth(mText.getString(), 1, mHighlightOffset); + left = mFont->getWidth(mText.getWString().c_str(), 1, mHighlightOffset); break; case LLFontGL::RIGHT: - left = getWidth() - mFont->getWidth(mText.getString(), mHighlightOffset, S32_MAX); + left = getWidth() - mFont->getWidth(mText.getWString().c_str(), mHighlightOffset, S32_MAX); break; case LLFontGL::HCENTER: - left = (getWidth() - mFont->getWidth(mText.getString())) / 2; + left = (getWidth() - mFont->getWidth(mText.getWString().c_str())) / 2; break; } LLRect highlight_rect(left - 2, mFont->getLineHeight() + 1, - left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1, + left + mFont->getWidth(mText.getWString().c_str(), mHighlightOffset, mHighlightCount) + 1, 1); mRoundedRectImage->draw(highlight_rect, highlight_color); } @@ -613,18 +613,18 @@ void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight switch (mFontAlignment) { case LLFontGL::LEFT: - left = mFont->getWidth(mText.getString(), icon_space + 1, mHighlightOffset); + left = mFont->getWidth(mText.getWString().c_str(), icon_space + 1, mHighlightOffset); break; case LLFontGL::RIGHT: - left = getWidth() - mFont->getWidth(mText.getString(), mHighlightOffset, S32_MAX) - icon_space; + left = getWidth() - mFont->getWidth(mText.getWString().c_str(), mHighlightOffset, S32_MAX) - icon_space; break; case LLFontGL::HCENTER: - left = (getWidth() - mFont->getWidth(mText.getString()) - icon_space) / 2; + left = (getWidth() - mFont->getWidth(mText.getWString().c_str()) - icon_space) / 2; break; } LLRect highlight_rect(left - 2, mFont->getLineHeight() + 1, - left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1, + left + mFont->getWidth(mText.getWString().c_str(), mHighlightOffset, mHighlightCount) + 1, 1); mRoundedRectImage->draw(highlight_rect, highlight_color); } @@ -642,12 +642,12 @@ void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight break; case LLFontGL::RIGHT: start_text_x = (F32)getWidth(); - start_icon_x = getWidth() - mFont->getWidth(mText.getString()) - icon_space; + start_icon_x = getWidth() - mFont->getWidth(mText.getWString().c_str()) - icon_space; break; case LLFontGL::HCENTER: F32 center = (F32)getWidth()* 0.5f; start_text_x = center + ((F32)icon_space * 0.5f); - start_icon_x = (S32)(center - (((F32)icon_space + mFont->getWidth(mText.getString())) * 0.5f)); + start_icon_x = (S32)(center - (((F32)icon_space + mFont->getWidth(mText.getWString().c_str())) * 0.5f)); break; } mFont->render(mText.getWString(), 0, diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 1d9564d107..e711a6ed1b 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -196,7 +196,6 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mHighlightedItem(-1), mBorder(NULL), mSortCallback(NULL), - mCommentTextView(NULL), mNumDynamicWidthColumns(0), mTotalStaticColumnWidth(0), mTotalColumnPadding(0), @@ -288,13 +287,6 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) addColumn(*row_it); } - for (LLInitParam::ParamIterator<LLScrollListItem::Params>::const_iterator row_it = p.contents.rows.begin(); - row_it != p.contents.rows.end(); - ++row_it) - { - addRow(*row_it); - } - LLTextBox::Params text_p; text_p.name("comment_text"); text_p.border_visible(false); @@ -302,7 +294,15 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) text_p.follows.flags(FOLLOWS_ALL); // word wrap was added accroding to the EXT-6841 text_p.wrap(true); - addChild(LLUICtrlFactory::create<LLTextBox>(text_p)); + mCommentText = LLUICtrlFactory::create<LLTextBox>(text_p); + addChild(mCommentText); + + for (LLInitParam::ParamIterator<LLScrollListItem::Params>::const_iterator row_it = p.contents.rows.begin(); + row_it != p.contents.rows.end(); + ++row_it) + { + addRow(*row_it); + } } S32 LLScrollListCtrl::getSearchColumn() @@ -541,12 +541,7 @@ void LLScrollListCtrl::updateLayout() getRect().getWidth() - 2 * mBorderThickness, getRect().getHeight() - (2 * mBorderThickness ) - heading_size ); - if (mCommentTextView == NULL) - { - mCommentTextView = getChildView("comment_text"); - } - - mCommentTextView->setShape(mItemListRect); + mCommentText->setShape(mItemListRect); // how many lines of content in a single "page" S32 page_lines = getLinesPerPage(); @@ -664,7 +659,7 @@ S32 LLScrollListCtrl::calcMaxContentWidth() if (mColumnWidthsDirty) { // update max content width for this column, by looking at all items - column->mMaxContentWidth = column->mHeader ? LLFontGL::getFontSansSerifSmall()->getWidth(column->mLabel) + mColumnPadding + HEADING_TEXT_PADDING : 0; + column->mMaxContentWidth = column->mHeader ? LLFontGL::getFontSansSerifSmall()->getWidth(column->mLabel.getWString().c_str()) + mColumnPadding + HEADING_TEXT_PADDING : 0; item_list::iterator iter; for (iter = mItemList.begin(); iter != mItemList.end(); iter++) { @@ -1244,7 +1239,7 @@ void LLScrollListCtrl::deselectAllItems(bool no_commit_on_change) void LLScrollListCtrl::setCommentText(const std::string& comment_text) { - getChild<LLTextBox>("comment_text")->setValue(comment_text); + mCommentText->setValue(comment_text); } LLScrollListItem* LLScrollListCtrl::addSeparator(EAddPosition pos) @@ -1479,10 +1474,9 @@ const std::string LLScrollListCtrl::getSelectedItemLabel(S32 column) const item = getFirstSelected(); if (item) { - auto col = item->getColumn(column); - if(col) + if (LLScrollListCell* cell = item->getColumn(column)) { - return col->getValue().asString(); + return cell->getValue().asString(); } } @@ -1728,7 +1722,7 @@ void LLScrollListCtrl::draw() updateColumns(); - getChildView("comment_text")->setVisible(mItemList.empty()); + mCommentText->setVisible(mItemList.empty()); drawItems(); @@ -2720,7 +2714,8 @@ struct SameSortColumn bool LLScrollListCtrl::setSort(S32 column_idx, bool ascending) { LLScrollListColumn* sort_column = getColumn(column_idx); - if (!sort_column) return false; + if (!sort_column) + return false; sort_column->mSortDirection = ascending ? LLScrollListColumn::ASCENDING : LLScrollListColumn::DESCENDING; @@ -2733,32 +2728,28 @@ bool LLScrollListCtrl::setSort(S32 column_idx, bool ascending) mSortColumns.push_back(new_sort_column); return true; } - else - { - // grab current sort column - sort_column_t cur_sort_column = mSortColumns.back(); - // remove any existing sort criterion referencing this column - // and add the new one - mSortColumns.erase(remove_if(mSortColumns.begin(), mSortColumns.end(), SameSortColumn(column_idx)), mSortColumns.end()); - mSortColumns.push_back(new_sort_column); + // grab current sort column + sort_column_t cur_sort_column = mSortColumns.back(); - // did the sort criteria change? - return (cur_sort_column != new_sort_column); - } + // remove any existing sort criterion referencing this column + // and add the new one + mSortColumns.erase(remove_if(mSortColumns.begin(), mSortColumns.end(), SameSortColumn(column_idx)), mSortColumns.end()); + mSortColumns.push_back(new_sort_column); + + // did the sort criteria change? + return cur_sort_column != new_sort_column; } S32 LLScrollListCtrl::getLinesPerPage() { - //if mPageLines is NOT provided display all item if (mPageLines) { return mPageLines; } - else - { - return mLineHeight ? mItemListRect.getHeight() / mLineHeight : getItemCount(); - } + + // If mPageLines is NOT provided then display all items + return mLineHeight ? mItemListRect.getHeight() / mLineHeight : getItemCount(); } @@ -2774,7 +2765,7 @@ void LLScrollListCtrl::sortByColumn(const std::string& name, bool ascending) column_map_t::iterator itor = mColumns.find(name); if (itor != mColumns.end()) { - sortByColumnIndex((*itor).second->mIndex, ascending); + sortByColumnIndex(itor->second->mIndex, ascending); } } @@ -3093,8 +3084,7 @@ std::string LLScrollListCtrl::getSortColumnName() { LLScrollListColumn* column = mSortColumns.empty() ? NULL : mColumnsIndexed[mSortColumns.back().first]; - if (column) return column->mName; - else return ""; + return column ? column->mName : LLStringUtil::null; } bool LLScrollListCtrl::hasSortOrder() const diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index f25ba61fd4..1f9f26e08b 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -530,7 +530,7 @@ private: class LLViewBorder* mBorder; LLHandle<LLContextMenu> mPopupMenuHandle; - LLView *mCommentTextView; + LLTextBox* mCommentText = nullptr; LLWString mSearchString; LLFrameTimer mSearchTimer; diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 22579205d8..0c3ab6bda0 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -225,7 +225,7 @@ bool LLSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& res = mLabelBox->setTextArg(key, text); if (res && mLabelFont && mLabelWidth == 0) { - S32 label_width = mLabelFont->getWidth(mLabelBox->getText()); + S32 label_width = mLabelFont->getWidth(mLabelBox->getWText().c_str()); LLRect rect = mLabelBox->getRect(); S32 prev_right = rect.mRight; rect.mRight = rect.mLeft + label_width; diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index 4273fae71e..2693243eb1 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -598,7 +598,7 @@ LLRect LLStatBar::getRequiredRect() void LLStatBar::drawLabelAndValue( F32 value, std::string &label, LLRect &bar_rect, S32 decimal_digits ) { - LLFontGL::getFontMonospace()->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f), + LLFontGL::getFontMonospace()->render(mLabel.getWString(), 0, 0.F, (F32)getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f), LLFontGL::LEFT, LLFontGL::TOP); std::string value_str = !llisnan(value) @@ -673,14 +673,14 @@ void LLStatBar::drawTicks( F32 min, F32 max, F32 value_scale, LLRect &bar_rect ) { decimal_digits = 0; } - std::string tick_label = llformat("%.*f", decimal_digits, tick_value); - S32 tick_label_width = LLFontGL::getFontMonospace()->getWidth(tick_label); + LLWString tick_label = utf8str_to_wstring(llformat("%.*f", decimal_digits, tick_value)); + S32 tick_label_width = LLFontGL::getFontMonospace()->getWidth(tick_label.c_str()); if (mOrientation == HORIZONTAL) { if (tick_begin > last_label + MIN_LABEL_SPACING) { gl_rect_2d(bar_rect.mLeft, tick_end, bar_rect.mRight - TICK_LENGTH, tick_begin, LLColor4(1.f, 1.f, 1.f, 0.25f)); - LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, bar_rect.mRight, tick_begin, + LLFontGL::getFontMonospace()->render(tick_label, 0, (F32)bar_rect.mRight, (F32)tick_begin, LLColor4(1.f, 1.f, 1.f, 0.5f), LLFontGL::LEFT, LLFontGL::VCENTER); last_label = tick_begin; @@ -696,7 +696,7 @@ void LLStatBar::drawTicks( F32 min, F32 max, F32 value_scale, LLRect &bar_rect ) { gl_rect_2d(tick_begin, bar_rect.mTop, tick_end, bar_rect.mBottom - TICK_LENGTH, LLColor4(1.f, 1.f, 1.f, 0.25f)); S32 label_pos = tick_begin - ll_round((F32)tick_label_width * ((F32)tick_begin / (F32)bar_rect.getWidth())); - LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, label_pos, bar_rect.mBottom - TICK_LENGTH, + LLFontGL::getFontMonospace()->render(tick_label, 0, (F32)label_pos, (F32)(bar_rect.mBottom - TICK_LENGTH), LLColor4(1.f, 1.f, 1.f, 0.5f), LLFontGL::LEFT, LLFontGL::TOP); last_label = label_pos; diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp index 95a9493323..28b4d387f1 100644 --- a/indra/llui/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp @@ -93,8 +93,6 @@ void LLStatGraph::draw() mUpdateTimer.reset(); } - LLColor4 color; - threshold_vec_t::iterator it = std::lower_bound(mThresholds.begin(), mThresholds.end(), Threshold(mValue / mMax, LLUIColor())); if (it != mThresholds.begin()) @@ -102,15 +100,14 @@ void LLStatGraph::draw() it--; } - color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); - gGL.color4fv(color.mV); + static LLColor4 default_color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); + gGL.color4fv(default_color.mV); gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, true); gGL.color4fv(LLColor4::black.mV); gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, false); - color = it->mColor; - gGL.color4fv(color.mV); + gGL.color4fv(it->mColor().mV); gl_rect_2d(1, ll_round(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, true); } diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp index 1bf3e3c43b..e5e0545dad 100644 --- a/indra/llui/llviewereventrecorder.cpp +++ b/indra/llui/llviewereventrecorder.cpp @@ -98,6 +98,7 @@ void LLViewerEventRecorder::setMouseGlobalCoords(S32 x, S32 y) { } void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 global_x, S32 global_y, std::string mName) { + if (!logEvents) return; LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), xui); if (! target_view) { @@ -126,6 +127,8 @@ void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 g void LLViewerEventRecorder::logVisibilityChange(std::string xui, std::string name, bool visibility, std::string event_subtype) { + if (!logEvents) return; + LLSD event=LLSD::emptyMap(); event.insert("event",LLSD(std::string("visibility"))); @@ -167,6 +170,7 @@ void LLViewerEventRecorder::update_xui(std::string xui) { void LLViewerEventRecorder::logKeyEvent(KEY key, MASK mask) { + if (!logEvents) return; // NOTE: Event recording only logs keydown events - the viewer itself hides keyup events at a fairly low level in the code and does not appear to care about them anywhere LLSD event = LLSD::emptyMap(); diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp index e48bc94b0a..8131a56288 100644 --- a/indra/llui/llwindowshade.cpp +++ b/indra/llui/llwindowshade.cpp @@ -81,8 +81,8 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) panel_p.background_visible = true; panel_p.bg_alpha_image = params.bg_image; panel_p.auto_resize = false; - LLLayoutPanel* notification_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p); - stackp->addChild(notification_panel); + mNotificationsArea = LLUICtrlFactory::create<LLLayoutPanel>(panel_p); + stackp->addChild(mNotificationsArea); panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>(); panel_p.auto_resize = true; @@ -92,15 +92,15 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) panel_p.mouse_opaque = false; panel_p.background_visible = false; panel_p.bg_alpha_color = params.shade_color; - LLLayoutPanel* dummy_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p); - stackp->addChild(dummy_panel); + mBackgroundArea = LLUICtrlFactory::create<LLLayoutPanel>(panel_p); + stackp->addChild(mBackgroundArea); layout_p = LLUICtrlFactory::getDefaultParams<LLLayoutStack>(); layout_p.rect = LLRect(0, 30, 800, 0); layout_p.follows.flags = FOLLOWS_ALL; layout_p.orientation = LLLayoutStack::HORIZONTAL; stackp = LLUICtrlFactory::create<LLLayoutStack>(layout_p); - notification_panel->addChild(stackp); + mNotificationsArea->addChild(stackp); panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>(); panel_p.rect.height = 30; @@ -121,7 +121,8 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) text_p.name = "notification_text"; text_p.use_ellipses = true; text_p.wrap = true; - panel->addChild(LLUICtrlFactory::create<LLTextBox>(text_p)); + mNotificationsText = LLUICtrlFactory::create<LLTextBox>(text_p); + panel->addChild(mNotificationsText); panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>(); panel_p.auto_resize = false; @@ -154,11 +155,9 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) void LLWindowShade::draw() { - LLRect message_rect = getChild<LLTextBox>("notification_text")->getTextBoundingRect(); + LLRect message_rect = mNotificationsText->getTextBoundingRect(); - LLLayoutPanel* notification_area = getChild<LLLayoutPanel>("notification_area"); - - notification_area->reshape(notification_area->getRect().getWidth(), + mNotificationsArea->reshape(mNotificationsArea->getRect().getWidth(), llclamp(message_rect.getHeight() + 15, llmax(mFormHeight, MIN_NOTIFICATION_AREA_HEIGHT), MAX_NOTIFICATION_AREA_HEIGHT)); @@ -176,21 +175,21 @@ void LLWindowShade::draw() { hide(); } - else if (notification_area->getVisibleAmount() < 0.01f) + else if (mNotificationsArea->getVisibleAmount() < 0.01f) { displayLatestNotification(); } - if (!notification_area->getVisible() && (notification_area->getVisibleAmount() < 0.001f)) + if (!mNotificationsArea->getVisible() && (mNotificationsArea->getVisibleAmount() < 0.001f)) { - getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(false); + mBackgroundArea->setBackgroundVisible(false); setMouseOpaque(false); } } void LLWindowShade::hide() { - getChildRef<LLLayoutPanel>("notification_area").setVisible(false); + mNotificationsArea->setVisible(false); } void LLWindowShade::onCloseNotification() @@ -244,13 +243,12 @@ void LLWindowShade::displayLatestNotification() LLSD payload = notification->getPayload(); LLNotificationFormPtr formp = notification->getForm(); - LLLayoutPanel& notification_area = getChildRef<LLLayoutPanel>("notification_area"); - notification_area.getChild<LLUICtrl>("notification_icon")->setValue(notification->getIcon()); - notification_area.getChild<LLUICtrl>("notification_text")->setValue(notification->getMessage()); - notification_area.getChild<LLUICtrl>("notification_text")->setToolTip(notification->getMessage()); + mNotificationsArea->getChild<LLUICtrl>("notification_icon")->setValue(notification->getIcon()); + mNotificationsText->setValue(notification->getMessage()); + mNotificationsText->setToolTip(notification->getMessage()); LLNotificationForm::EIgnoreType ignore_type = formp->getIgnoreType(); - LLLayoutPanel& form_elements = notification_area.getChildRef<LLLayoutPanel>("form_elements"); + LLLayoutPanel& form_elements = mNotificationsArea->getChildRef<LLLayoutPanel>("form_elements"); form_elements.deleteAllChildren(); form_elements.reshape(form_elements.getRect().getWidth(), MIN_NOTIFICATION_AREA_HEIGHT); @@ -355,25 +353,25 @@ void LLWindowShade::displayLatestNotification() (*it)->translate(0, delta_y); } - getChildRef<LLLayoutPanel>("notification_area").setVisible(true); - getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(mModal); + mNotificationsArea->setVisible(true); + mBackgroundArea->setBackgroundVisible(mModal); setMouseOpaque(mModal); } void LLWindowShade::setBackgroundImage(LLUIImage* image) { - getChild<LLLayoutPanel>("notification_area")->setTransparentImage(image); + mNotificationsArea->setTransparentImage(image); } void LLWindowShade::setTextColor(LLColor4 color) { - getChild<LLTextBox>("notification_text")->setColor(color); + mNotificationsText->setColor(color); } bool LLWindowShade::isShown() const { - return getChildRef<LLLayoutPanel>("notification_area").getVisible(); + return mNotificationsArea->getVisible(); } void LLWindowShade::setCanClose(bool can_close) diff --git a/indra/llui/llwindowshade.h b/indra/llui/llwindowshade.h index a401394d78..da29188943 100644 --- a/indra/llui/llwindowshade.h +++ b/indra/llui/llwindowshade.h @@ -31,6 +31,9 @@ #include "llnotifications.h" #include "lluiimage.h" +class LLLayoutPanel; +class LLTextBox; + class LLWindowShade : public LLUICtrl { public: @@ -68,6 +71,10 @@ private: void onEnterNotificationText(LLUICtrl* ctrl, const std::string& name); void onClickIgnore(LLUICtrl* ctrl); + LLLayoutPanel* mBackgroundArea = nullptr; + LLLayoutPanel* mNotificationsArea = nullptr; + LLTextBox* mNotificationsText = nullptr; + std::vector<LLNotificationPtr> mNotifications; LLSD mNotificationResponse; bool mModal; |