From 62245de7ae38468f337e4c64bc2c254e13c6fedc Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 1 Aug 2023 20:14:27 +0300 Subject: SL-19982 Adjustable font size in LSL editor --- indra/llui/llkeywords.cpp | 47 +++++++++++++++++++++++++++++++++++------------ indra/llui/llkeywords.h | 9 ++++++--- 2 files changed, 41 insertions(+), 15 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 69e338ddb9..56e0c4f0f8 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -479,7 +479,7 @@ LLTrace::BlockTimerStatHandle FTM_SYNTAX_COLORING("Syntax Coloring"); // Walk through a string, applying the rules specified by the keyword token list and // create a list of color segments. -void LLKeywords::findSegments(std::vector* seg_list, const LLWString& wtext, const LLColor4 &defaultColor, LLTextEditor& editor) +void LLKeywords::findSegments(std::vector* seg_list, const LLWString& wtext, LLTextEditor& editor, LLStyleConstSP style) { LL_RECORD_BLOCK_TIME(FTM_SYNTAX_COLORING); seg_list->clear(); @@ -491,7 +491,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW S32 text_len = wtext.size() + 1; - seg_list->push_back( new LLNormalTextSegment( defaultColor, 0, text_len, editor ) ); + seg_list->push_back( new LLNormalTextSegment( style, 0, text_len, editor ) ); const llwchar* base = wtext.c_str(); const llwchar* cur = base; @@ -503,7 +503,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW { LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(cur-base); text_segment->setToken( 0 ); - insertSegment( *seg_list, text_segment, text_len, defaultColor, editor); + insertSegment( *seg_list, text_segment, text_len, style, editor); cur++; if( !*cur || *cur == '\n' ) { @@ -541,7 +541,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW S32 seg_end = cur - base; //create segments from seg_start to seg_end - insertSegments(wtext, *seg_list,cur_token, text_len, seg_start, seg_end, defaultColor, editor); + insertSegments(wtext, *seg_list,cur_token, text_len, seg_start, seg_end, style, editor); line_done = TRUE; // to break out of second loop. break; } @@ -648,7 +648,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW seg_end = seg_start + between_delimiters + cur_delimiter->getLengthHead(); } - insertSegments(wtext, *seg_list,cur_delimiter, text_len, seg_start, seg_end, defaultColor, editor); + insertSegments(wtext, *seg_list,cur_delimiter, text_len, seg_start, seg_end, style, editor); /* LLTextSegmentPtr text_segment = new LLNormalTextSegment( cur_delimiter->getColor(), seg_start, seg_end, editor ); text_segment->setToken( cur_delimiter ); @@ -682,7 +682,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW // LL_INFOS("SyntaxLSL") << "Seg: [" << word.c_str() << "]" << LL_ENDL; - insertSegments(wtext, *seg_list,cur_token, text_len, seg_start, seg_end, defaultColor, editor); + insertSegments(wtext, *seg_list,cur_token, text_len, seg_start, seg_end, style, editor); } cur += seg_len; continue; @@ -697,30 +697,32 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW } } -void LLKeywords::insertSegments(const LLWString& wtext, std::vector& seg_list, LLKeywordToken* cur_token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor ) +void LLKeywords::insertSegments(const LLWString& wtext, std::vector& seg_list, LLKeywordToken* cur_token, S32 text_len, S32 seg_start, S32 seg_end, LLStyleConstSP style, LLTextEditor& editor ) { std::string::size_type pos = wtext.find('\n',seg_start); + + LLStyleConstSP cur_token_style = new LLStyle(LLStyle::Params().font(style->getFont()).color(cur_token->getColor())); while (pos!=-1 && pos < (std::string::size_type)seg_end) { if (pos!=seg_start) { - LLTextSegmentPtr text_segment = new LLNormalTextSegment( cur_token->getColor(), seg_start, pos, editor ); + LLTextSegmentPtr text_segment = new LLNormalTextSegment(cur_token_style, seg_start, pos, editor); text_segment->setToken( cur_token ); - insertSegment( seg_list, text_segment, text_len, defaultColor, editor); + insertSegment( seg_list, text_segment, text_len, style, editor); } LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(pos); text_segment->setToken( cur_token ); - insertSegment( seg_list, text_segment, text_len, defaultColor, editor); + insertSegment( seg_list, text_segment, text_len, style, editor); seg_start = pos+1; pos = wtext.find('\n',seg_start); } - LLTextSegmentPtr text_segment = new LLNormalTextSegment( cur_token->getColor(), seg_start, seg_end, editor ); + LLTextSegmentPtr text_segment = new LLNormalTextSegment(cur_token_style, seg_start, seg_end, editor); text_segment->setToken( cur_token ); - insertSegment( seg_list, text_segment, text_len, defaultColor, editor); + insertSegment( seg_list, text_segment, text_len, style, editor); } void LLKeywords::insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, LLTextEditor& editor ) @@ -744,6 +746,27 @@ void LLKeywords::insertSegment(std::vector& seg_list, LLTextSe } } +void LLKeywords::insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, LLStyleConstSP style, LLTextEditor& editor ) +{ + LLTextSegmentPtr last = seg_list.back(); + S32 new_seg_end = new_segment->getEnd(); + + if( new_segment->getStart() == last->getStart() ) + { + seg_list.pop_back(); + } + else + { + last->setEnd( new_segment->getStart() ); + } + seg_list.push_back( new_segment ); + + if( new_seg_end < text_len ) + { + seg_list.push_back( new LLNormalTextSegment( style, new_seg_end, text_len, editor ) ); + } +} + #ifdef _DEBUG void LLKeywords::dump() { diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 18e2ed06c5..2410fe7d5a 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -29,6 +29,7 @@ #include "lldir.h" +#include "llstyle.h" #include "llstring.h" #include "v3color.h" #include "v4color.h" @@ -115,8 +116,8 @@ public: void findSegments(std::vector *seg_list, const LLWString& text, - const LLColor4 &defaultColor, - class LLTextEditor& editor); + class LLTextEditor& editor, + LLStyleConstSP style); void initialize(LLSD SyntaxXML); void processTokens(); @@ -181,9 +182,11 @@ protected: S32 text_len, S32 seg_start, S32 seg_end, - const LLColor4 &defaultColor, + LLStyleConstSP style, LLTextEditor& editor); + void insertSegment(std::vector& seg_list, LLTextSegmentPtr new_segment, S32 text_len, LLStyleConstSP style, LLTextEditor& editor ); + bool mLoaded; LLSD mSyntax; word_token_map_t mWordTokenMap; -- cgit v1.2.3 From 97d5063cb1e5474d2d5aa65872c9a608a1207905 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine 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 ++++++- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'indra/llui') 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* 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::vectorsetToken( 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 > tokenizer; boost::char_separator 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(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: -- cgit v1.2.3 From 12f18ff4614225093f753b16cfd278880eca0387 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Tue, 15 Aug 2023 16:46:35 +0200 Subject: SL-20146 Statistic bar collapsed/expanded accordions not saving --- indra/llui/llcontainerview.cpp | 2 +- indra/llui/llcontainerview.h | 2 +- indra/llui/llstatview.cpp | 3 --- indra/llui/llstatview.h | 4 ++-- 4 files changed, 4 insertions(+), 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llcontainerview.cpp b/indra/llui/llcontainerview.cpp index 727fbe850e..1c33088e8d 100644 --- a/indra/llui/llcontainerview.cpp +++ b/indra/llui/llcontainerview.cpp @@ -288,7 +288,7 @@ void LLContainerView::setLabel(const std::string& label) mLabel = label; } -void LLContainerView::setDisplayChildren(const BOOL displayChildren) +void LLContainerView::setDisplayChildren(BOOL displayChildren) { mDisplayChildren = displayChildren; for (child_list_const_iter_t child_iter = getChildList()->begin(); diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h index 99267d978a..8e75aaef6e 100644 --- a/indra/llui/llcontainerview.h +++ b/indra/llui/llcontainerview.h @@ -78,7 +78,7 @@ public: void setLabel(const std::string& label); void showLabel(BOOL show) { mShowLabel = show; } - void setDisplayChildren(const BOOL displayChildren); + void setDisplayChildren(BOOL displayChildren); BOOL getDisplayChildren() { return mDisplayChildren; } void setScrollContainer(LLScrollContainer* scroll) {mScrollContainer = scroll;} diff --git a/indra/llui/llstatview.cpp b/indra/llui/llstatview.cpp index bb4969c81f..03f2fb7cc0 100644 --- a/indra/llui/llstatview.cpp +++ b/indra/llui/llstatview.cpp @@ -58,10 +58,7 @@ LLStatView::~LLStatView() } } - static StatViewRegistry::Register r1("stat_bar"); static StatViewRegistry::Register r2("stat_view"); // stat_view can be a child of panels/etc. static LLDefaultChildRegistry::Register r3("stat_view"); - - diff --git a/indra/llui/llstatview.h b/indra/llui/llstatview.h index af4db7d7ea..044f0a8679 100644 --- a/indra/llui/llstatview.h +++ b/indra/llui/llstatview.h @@ -63,7 +63,7 @@ protected: friend class LLUICtrlFactory; protected: - std::string mSetting; - + const std::string mSetting; }; + #endif // LL_STATVIEW_ -- cgit v1.2.3 From 5430efbb31cfc0f57eac7fd130bb43aafa85143a Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Tue, 15 Aug 2023 20:38:02 +0300 Subject: SL-20139 pressing the Tab key should paste tooltip only when hovering functions in LSL editor --- indra/llui/lltextbase.cpp | 2 +- indra/llui/lltexteditor.cpp | 3 ++- indra/llui/lltooltip.cpp | 20 ++++++++++++++++---- indra/llui/lltooltip.h | 8 +++++++- 4 files changed, 26 insertions(+), 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 8732a7ce45..26a38bd541 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -3431,7 +3431,7 @@ BOOL LLNormalTextSegment::handleToolTip(S32 x, S32 y, MASK mask) if (mToken && !mToken->getToolTip().empty()) { const LLWString& wmsg = mToken->getToolTip(); - LLToolTipMgr::instance().show(wstring_to_utf8str(wmsg)); + LLToolTipMgr::instance().show(wstring_to_utf8str(wmsg), (mToken->getType() == LLKeywordToken::TT_FUNCTION)); return TRUE; } // or do we have an explicitly set tooltip (e.g., for Urls) diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 3d2a426913..c83ed4c3e1 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1779,7 +1779,8 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) else { if (mEnableTooltipPaste && - LLToolTipMgr::instance().toolTipVisible() && + LLToolTipMgr::instance().toolTipVisible() && + LLToolTipMgr::instance().isTooltipPastable() && KEY_TAB == key) { // Paste the first line of a tooltip into the editor std::string message; diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 2f56a8b1d0..c4b132317f 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -154,7 +154,8 @@ LLToolTip::Params::Params() text_color("text_color"), time_based_media("time_based_media", false), web_based_media("web_based_media", false), - media_playing("media_playing", false) + media_playing("media_playing", false), + allow_paste_tooltip("allow_paste_tooltip", false) { changeDefault(chrome, true); } @@ -166,7 +167,8 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) mTextBox(NULL), mInfoButton(NULL), mPlayMediaButton(NULL), - mHomePageButton(NULL) + mHomePageButton(NULL), + mIsTooltipPastable(p.allow_paste_tooltip) { LLTextBox::Params params; params.name = params.initial_value().asString(); @@ -308,6 +310,8 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p) mTextBox->reshape(mTextBox->getRect().getWidth(), llmax(mTextBox->getRect().getHeight(), tooltip_rect.getHeight() - 2 * mPadding)); setShape(tooltip_rect); + + mIsTooltipPastable = p.allow_paste_tooltip; } void LLToolTip::setVisible(BOOL visible) @@ -469,9 +473,9 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params) } -void LLToolTipMgr::show(const std::string& msg) +void LLToolTipMgr::show(const std::string& msg, bool allow_paste_tooltip) { - show(LLToolTip::Params().message(msg)); + show(LLToolTip::Params().message(msg).allow_paste_tooltip(allow_paste_tooltip)); } void LLToolTipMgr::show(const LLToolTip::Params& params) @@ -612,5 +616,13 @@ void LLToolTipMgr::getToolTipMessage(std::string & message) } } +bool LLToolTipMgr::isTooltipPastable() +{ + if (toolTipVisible()) + { + return mToolTip->isTooltipPastable(); + } + return false; + } // EOF diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index 0b1fbe5367..6ff7c0671a 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -91,6 +91,8 @@ public: padding; Optional wrap; + Optional allow_paste_tooltip; + Params(); }; /*virtual*/ void draw(); @@ -106,6 +108,7 @@ public: void initFromParams(const LLToolTip::Params& params); void getToolTipMessage(std::string & message); + bool isTooltipPastable() { return mIsTooltipPastable; } private: class LLTextBox* mTextBox; @@ -117,6 +120,8 @@ private: LLFrameTimer mVisibleTimer; bool mHasClickCallback; S32 mPadding; // pixels + + bool mIsTooltipPastable; }; // used for the inspector tooltips which need different background images etc. @@ -134,7 +139,7 @@ class LLToolTipMgr : public LLSingleton public: void show(const LLToolTip::Params& params); - void show(const std::string& message); + void show(const std::string& message, bool allow_paste_tooltip = false); void unblockToolTips(); void blockToolTips(); @@ -146,6 +151,7 @@ public: void updateToolTipVisibility(); void getToolTipMessage(std::string & message); + bool isTooltipPastable(); private: void createToolTip(const LLToolTip::Params& params); -- cgit v1.2.3 From 226a0025e9c8f4cf612e1781fb083e32939a32b4 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 22 Aug 2023 00:39:47 +0300 Subject: SL-20182 dirtyFilter crash while accessing parent --- indra/llui/llfolderviewitem.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index e2b5279aab..16e9034430 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -181,14 +181,18 @@ LLFolderViewItem::~LLFolderViewItem() BOOL LLFolderViewItem::postBuild() { - LLFolderViewModelItem& vmi = *getViewModelItem(); - // getDisplayName() is expensive (due to internal getLabelSuffix() and name building) - // it also sets search strings so it requires a filter reset - mLabel = vmi.getDisplayName(); - setToolTip(vmi.getName()); + LLFolderViewModelItem* vmi = getViewModelItem(); + llassert(vmi); // not supposed to happen, if happens, find out why and fix + if (vmi) + { + // getDisplayName() is expensive (due to internal getLabelSuffix() and name building) + // it also sets search strings so it requires a filter reset + mLabel = vmi->getDisplayName(); + setToolTip(vmi->getName()); - // Dirty the filter flag of the model from the view (CHUI-849) - vmi.dirtyFilter(); + // Dirty the filter flag of the model from the view (CHUI-849) + vmi->dirtyFilter(); + } // Don't do full refresh on constructor if it is possible to avoid // it significantly slows down bulk view creation. -- cgit v1.2.3 From 57d784f80728f9ecd75f8dbc989cd75cf328c353 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Thu, 24 Aug 2023 16:02:08 +0200 Subject: SL-18620 Statistics->Advanced->Memory Usage no longer updating --- indra/llui/llstatbar.cpp | 28 +--------------------------- indra/llui/llstatbar.h | 8 +++----- 2 files changed, 4 insertions(+), 32 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index 2449100952..fc3024c0de 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -181,7 +181,7 @@ LLStatBar::LLStatBar(const Params& p) mTargetMinBar(llmin(p.bar_min, p.bar_max)), mTargetMaxBar(llmax(p.bar_max, p.bar_min)), mCurMaxBar(p.bar_max), - mCurMinBar(0), + mCurMinBar(0), mDecimalDigits(p.decimal_digits), mNumHistoryFrames(p.num_frames), mNumShortHistoryFrames(p.num_frames_short), @@ -222,9 +222,6 @@ BOOL LLStatBar::handleHover(S32 x, S32 y, MASK mask) case STAT_SAMPLE: LLToolTipMgr::instance().show(LLToolTip::Params().message(mStat.sampleStatp->getDescription()).sticky_rect(calcScreenRect())); break; - case STAT_MEM: - LLToolTipMgr::instance().show(LLToolTip::Params().message(mStat.memStatp->getDescription()).sticky_rect(calcScreenRect())); - break; default: break; } @@ -373,18 +370,6 @@ void LLStatBar::draw() } } break; - case STAT_MEM: - { - const LLTrace::StatType& mem_stat = *mStat.memStatp; - - unit_label = mUnitLabel.empty() ? mem_stat.getUnitLabel() : mUnitLabel; - current = last_frame_recording.getLastValue(mem_stat).value(); - min = frame_recording.getPeriodMin(mem_stat, num_frames).value(); - max = frame_recording.getPeriodMax(mem_stat, num_frames).value(); - mean = frame_recording.getPeriodMean(mem_stat, num_frames).value(); - display_value = current; - } - break; default: break; } @@ -500,11 +485,6 @@ void LLStatBar::draw() max_value = recording.getMax(*mStat.sampleStatp); num_samples = recording.getSampleCount(*mStat.sampleStatp); break; - case STAT_MEM: - min_value = recording.getMin(*mStat.memStatp).value(); - max_value = recording.getMax(*mStat.memStatp).value(); - num_samples = 1; - break; default: break; } @@ -583,14 +563,8 @@ void LLStatBar::setStat(const std::string& stat_name) mStat.sampleStatp = sample_stat.get(); mStatType = STAT_SAMPLE; } - else if (auto mem_stat = StatType::getInstance(stat_name)) - { - mStat.memStatp = mem_stat.get(); - mStatType = STAT_MEM; - } } - void LLStatBar::setRange(F32 bar_min, F32 bar_max) { mTargetMinBar = llmin(bar_min, bar_max); diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h index 6b481ca68f..384d0950a6 100644 --- a/indra/llui/llstatbar.h +++ b/indra/llui/llstatbar.h @@ -95,17 +95,15 @@ private: STAT_NONE, STAT_COUNT, STAT_EVENT, - STAT_SAMPLE, - STAT_MEM + STAT_SAMPLE } mStatType; union { - void* valid; + void* valid; const LLTrace::StatType* countStatp; const LLTrace::StatType* eventStatp; - const LLTrace::StatType* sampleStatp; - const LLTrace::StatType* memStatp; + const LLTrace::StatType* sampleStatp; } mStat; LLUIString mLabel; -- cgit v1.2.3 From f059ace6f79cd2866fab7027ca22188c806799f8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 29 Aug 2023 01:57:44 +0300 Subject: SL-20205 Clipping of label "Water" --- indra/llui/lltextbase.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 26a38bd541..b6d27a3211 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1550,7 +1550,13 @@ S32 LLTextBase::getLeftOffset(S32 width) case LLFontGL::HCENTER: return mHPad + llmax(0, (mVisibleTextRect.getWidth() - width - mHPad) / 2); case LLFontGL::RIGHT: - return mVisibleTextRect.getWidth() - width; + { + // Font's rendering rounds string size, if value gets rounded + // down last symbol might not have enough space to render, + // compensate by adding an extra pixel as padding + const S32 right_padding = 1; + return llmax(mHPad, mVisibleTextRect.getWidth() - width - right_padding); + } default: return mHPad; } -- cgit v1.2.3 From e9ffe7ee471a2bbe428ec6a3ad07a7ef998c2e36 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Tue, 10 Oct 2023 23:18:41 +0200 Subject: SL-20288 Lags in Appearance floater (code format in LLAccordionCtrl) --- indra/llui/llaccordionctrl.cpp | 330 ++++++++++++++++----------------- indra/llui/llaccordionctrl.h | 2 +- indra/llui/llaccordionctrltab.cpp | 371 ++++++++++++++++++++------------------ indra/llui/llaccordionctrltab.h | 2 +- indra/llui/llflatlistview.cpp | 52 +++--- 5 files changed, 387 insertions(+), 370 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index 809d72208f..0a82bed896 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -60,7 +60,7 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params) initNoTabsWidget(params.no_matched_tabs_text); mSingleExpansion = params.single_expansion; - if(mFitParent && !mSingleExpansion) + if (mFitParent && !mSingleExpansion) { LL_INFOS() << "fit_parent works best when combined with single_expansion" << LL_ENDL; } @@ -102,14 +102,13 @@ void LLAccordionCtrl::draw() LLPanel::draw(); } - //--------------------------------------------------------------------------------- BOOL LLAccordionCtrl::postBuild() { - static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); + static LLUICachedControl scrollbar_size("UIScrollbarSize", 0); LLRect scroll_rect; - scroll_rect.setOriginAndSize( + scroll_rect.setOriginAndSize( getRect().getWidth() - scrollbar_size, 1, scrollbar_size, @@ -126,39 +125,42 @@ BOOL LLAccordionCtrl::postBuild() sbparams.follows.flags(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM); sbparams.change_callback(boost::bind(&LLAccordionCtrl::onScrollPosChangeCallback, this, _1, _2)); - mScrollbar = LLUICtrlFactory::create (sbparams); - LLView::addChild( mScrollbar ); - mScrollbar->setVisible( false ); + mScrollbar = LLUICtrlFactory::create(sbparams); + LLView::addChild(mScrollbar); + mScrollbar->setVisible(FALSE); mScrollbar->setFollowsRight(); mScrollbar->setFollowsTop(); mScrollbar->setFollowsBottom(); //if it was created from xml... std::vector accordion_tabs; - for(child_list_const_iter_t it = getChildList()->begin(); + for (child_list_const_iter_t it = getChildList()->begin(); getChildList()->end() != it; ++it) { LLAccordionCtrlTab* accordion_tab = dynamic_cast(*it); - if(accordion_tab == NULL) + if (accordion_tab == NULL) continue; - if(std::find(mAccordionTabs.begin(),mAccordionTabs.end(),accordion_tab) == mAccordionTabs.end()) + if (std::find(mAccordionTabs.begin(), mAccordionTabs.end(), accordion_tab) == mAccordionTabs.end()) { accordion_tabs.push_back(accordion_tab); } } - for(std::vector::reverse_iterator it = accordion_tabs.rbegin();it!=accordion_tabs.rend();++it) + for (std::vector::reverse_iterator it = accordion_tabs.rbegin(); + it < accordion_tabs.rend(); ++it) + { addCollapsibleCtrl(*it); + } - arrange (); + arrange(); - if(mSingleExpansion) + if (mSingleExpansion) { - if(!mAccordionTabs[0]->getDisplayChildren()) + if (!mAccordionTabs[0]->getDisplayChildren()) mAccordionTabs[0]->setDisplayChildren(true); - for(size_t i=1;igetDisplayChildren()) + if (mAccordionTabs[i]->getDisplayChildren()) mAccordionTabs[i]->setDisplayChildren(false); } } @@ -205,23 +207,22 @@ BOOL LLAccordionCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) //--------------------------------------------------------------------------------- void LLAccordionCtrl::shiftAccordionTabs(S16 panel_num, S32 delta) { - for(size_t i = panel_num; i < mAccordionTabs.size(); i++ ) + for (size_t i = panel_num; i < mAccordionTabs.size(); ++i) { ctrlShiftVertical(mAccordionTabs[i],delta); } } - //--------------------------------------------------------------------------------- void LLAccordionCtrl::onCollapseCtrlCloseOpen(S16 panel_num) { - if(mSingleExpansion) + if (mSingleExpansion) { - for(size_t i=0;igetDisplayChildren()) + if (mAccordionTabs[i]->getDisplayChildren()) mAccordionTabs[i]->setDisplayChildren(false); } @@ -232,64 +233,63 @@ void LLAccordionCtrl::onCollapseCtrlCloseOpen(S16 panel_num) void LLAccordionCtrl::show_hide_scrollbar(S32 width, S32 height) { calcRecuiredHeight(); - if(getRecuiredHeight() > height ) - showScrollbar(width,height); + if (getRecuiredHeight() > height) + showScrollbar(width, height); else - hideScrollbar(width,height); + hideScrollbar(width, height); } -void LLAccordionCtrl::showScrollbar(S32 width, S32 height) +void LLAccordionCtrl::showScrollbar(S32 width, S32 height) { bool was_visible = mScrollbar->getVisible(); - mScrollbar->setVisible(true); + mScrollbar->setVisible(TRUE); static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); ctrlSetLeftTopAndSize(mScrollbar - ,width-scrollbar_size - PARENT_BORDER_MARGIN/2 - ,height-PARENT_BORDER_MARGIN - ,scrollbar_size - ,height-2*PARENT_BORDER_MARGIN); + , width - scrollbar_size - PARENT_BORDER_MARGIN / 2 + , height - PARENT_BORDER_MARGIN + , scrollbar_size + , height - PARENT_BORDER_MARGIN * 2); mScrollbar->setPageSize(height); - mScrollbar->setDocParams(mInnerRect.getHeight(),mScrollbar->getDocPos()); + mScrollbar->setDocParams(mInnerRect.getHeight(), mScrollbar->getDocPos()); - if(was_visible) + if (was_visible) { S32 scroll_pos = llmin(mScrollbar->getDocPos(), getRecuiredHeight() - height - 1); mScrollbar->setDocPos(scroll_pos); } } -void LLAccordionCtrl::hideScrollbar( S32 width, S32 height ) +void LLAccordionCtrl::hideScrollbar(S32 width, S32 height) { - if(mScrollbar->getVisible() == false) + if (mScrollbar->getVisible() == FALSE) return; - mScrollbar->setVisible(false); + mScrollbar->setVisible(FALSE); static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); S32 panel_width = width - 2*BORDER_MARGIN; - //reshape all accordeons and shift all draggers - for(size_t i=0;igetRect(); - ctrlSetLeftTopAndSize(mAccordionTabs[i],panel_rect.mLeft,panel_rect.mTop,panel_width,panel_rect.getHeight()); + ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_rect.mLeft, panel_rect.mTop, panel_width, panel_rect.getHeight()); } mScrollbar->setDocPos(0); - if(mAccordionTabs.size()>0) + if (!mAccordionTabs.empty()) { - S32 panel_top = height - BORDER_MARGIN; // Top coordinate of the first panel + S32 panel_top = height - BORDER_MARGIN; // Top coordinate of the first panel S32 diff = panel_top - mAccordionTabs[0]->getRect().mTop; - shiftAccordionTabs(0,diff); + shiftAccordionTabs(0, diff); } } - //--------------------------------------------------------------------------------- S32 LLAccordionCtrl::calcRecuiredHeight() { @@ -305,7 +305,7 @@ S32 LLAccordionCtrl::calcRecuiredHeight() } } - mInnerRect.setLeftTopAndSize(0,rec_height + BORDER_MARGIN*2,getRect().getWidth(),rec_height + BORDER_MARGIN); + mInnerRect.setLeftTopAndSize(0, rec_height + BORDER_MARGIN * 2, getRect().getWidth(), rec_height + BORDER_MARGIN); return mInnerRect.getHeight(); } @@ -313,7 +313,7 @@ S32 LLAccordionCtrl::calcRecuiredHeight() //--------------------------------------------------------------------------------- void LLAccordionCtrl::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top, S32 width, S32 height) { - if(!panel) + if (!panel) return; LLRect panel_rect = panel->getRect(); panel_rect.setLeftTopAndSize( left, top, width, height); @@ -321,9 +321,9 @@ void LLAccordionCtrl::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top, S3 panel->setRect(panel_rect); } -void LLAccordionCtrl::ctrlShiftVertical(LLView* panel,S32 delta) +void LLAccordionCtrl::ctrlShiftVertical(LLView* panel, S32 delta) { - if(!panel) + if (!panel) return; panel->translate(0,delta); } @@ -333,9 +333,9 @@ void LLAccordionCtrl::ctrlShiftVertical(LLView* panel,S32 delta) void LLAccordionCtrl::addCollapsibleCtrl(LLView* view) { LLAccordionCtrlTab* accordion_tab = dynamic_cast(view); - if(!accordion_tab) + if (!accordion_tab) return; - if(std::find(beginChild(), endChild(), accordion_tab) == endChild()) + if (std::find(beginChild(), endChild(), accordion_tab) == endChild()) addChild(accordion_tab); mAccordionTabs.push_back(accordion_tab); @@ -369,7 +369,7 @@ void LLAccordionCtrl::removeCollapsibleCtrl(LLView* view) } } -void LLAccordionCtrl::initNoTabsWidget(const LLTextBox::Params& tb_params) +void LLAccordionCtrl::initNoTabsWidget(const LLTextBox::Params& tb_params) { LLTextBox::Params tp = tb_params; tp.rect(getLocalRect()); @@ -377,39 +377,39 @@ void LLAccordionCtrl::initNoTabsWidget(const LLTextBox::Params& tb_params) mNoVisibleTabsHelpText = LLUICtrlFactory::create(tp, this); } -void LLAccordionCtrl::updateNoTabsHelpTextVisibility() +void LLAccordionCtrl::updateNoTabsHelpTextVisibility() { bool visible_exists = false; std::vector::const_iterator it = mAccordionTabs.begin(); const std::vector::const_iterator it_end = mAccordionTabs.end(); - for (; it != it_end; ++it) + while (it < it_end) { - if ((*it)->getVisible()) + if ((*(it++))->getVisible()) { visible_exists = true; break; } } - mNoVisibleTabsHelpText->setVisible(!visible_exists); + mNoVisibleTabsHelpText->setVisible(visible_exists ? FALSE : TRUE); } -void LLAccordionCtrl::arrangeSinge() +void LLAccordionCtrl::arrangeSingle() { - S32 panel_left = BORDER_MARGIN; // Margin from left side of Splitter - S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel - S32 panel_width = getRect().getWidth() - 4; // Top coordinate of the first panel + S32 panel_left = BORDER_MARGIN; // Margin from left side of Splitter + S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel + S32 panel_width = getRect().getWidth() - 4; S32 panel_height; S32 collapsed_height = 0; - for(size_t i=0;i(mAccordionTabs[i]); - if(accordion_tab->getVisible() == false) //skip hidden accordion tabs + if (accordion_tab->getVisible() == FALSE) // Skip hidden accordion tabs continue; - if(!accordion_tab->isExpanded() ) + if (!accordion_tab->isExpanded() ) { collapsed_height+=mAccordionTabs[i]->getRect().getHeight(); } @@ -417,28 +417,28 @@ void LLAccordionCtrl::arrangeSinge() S32 expanded_height = getRect().getHeight() - BORDER_MARGIN - collapsed_height; - for(size_t i=0;i(mAccordionTabs[i]); - if(accordion_tab->getVisible() == false) //skip hidden accordion tabs + if (accordion_tab->getVisible() == FALSE) // Skip hidden accordion tabs continue; - if(!accordion_tab->isExpanded() ) + if (!accordion_tab->isExpanded() ) { panel_height = accordion_tab->getRect().getHeight(); } else { - if(mFitParent) + if (mFitParent) { panel_height = expanded_height; } else { - if(accordion_tab->getAccordionView()) + if (accordion_tab->getAccordionView()) { panel_height = accordion_tab->getAccordionView()->getRect().getHeight() + - accordion_tab->getHeaderHeight() + 2*BORDER_MARGIN; + accordion_tab->getHeaderHeight() + BORDER_MARGIN * 2; } else { @@ -451,67 +451,67 @@ void LLAccordionCtrl::arrangeSinge() panel_height = llmax(panel_height, accordion_tab->getHeaderHeight()); ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height); - panel_top-=mAccordionTabs[i]->getRect().getHeight(); + panel_top -= mAccordionTabs[i]->getRect().getHeight(); } show_hide_scrollbar(getRect().getWidth(), getRect().getHeight()); updateLayout(getRect().getWidth(), getRect().getHeight()); } -void LLAccordionCtrl::arrangeMultiple() +void LLAccordionCtrl::arrangeMultiple() { - S32 panel_left = BORDER_MARGIN; // Margin from left side of Splitter - S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel - S32 panel_width = getRect().getWidth() - 4; // Top coordinate of the first panel + S32 panel_left = BORDER_MARGIN; // Margin from left side of Splitter + S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel + S32 panel_width = getRect().getWidth() - 4; //Calculate params - for(size_t i = 0; i < mAccordionTabs.size(); i++ ) + for (size_t i = 0; i < mAccordionTabs.size(); i++ ) { LLAccordionCtrlTab* accordion_tab = dynamic_cast(mAccordionTabs[i]); - if(accordion_tab->getVisible() == false) //skip hidden accordion tabs + if (accordion_tab->getVisible() == FALSE) // Skip hidden accordion tabs continue; - if(!accordion_tab->isExpanded() ) + if (!accordion_tab->isExpanded() ) { ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, accordion_tab->getRect().getHeight()); - panel_top-=mAccordionTabs[i]->getRect().getHeight(); + panel_top -= mAccordionTabs[i]->getRect().getHeight(); } else { S32 panel_height = accordion_tab->getRect().getHeight(); - if(mFitParent) + if (mFitParent) { - // all expanded tabs will have equal height + // All expanded tabs will have equal height panel_height = calcExpandedTabHeight(i, panel_top); ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, panel_height); - // try to make accordion tab fit accordion view height. + // Try to make accordion tab fit accordion view height. // Accordion View should implement getRequiredRect() and provide valid height S32 optimal_height = accordion_tab->getAccordionView()->getRequiredRect().getHeight(); optimal_height += accordion_tab->getHeaderHeight() + 2 * BORDER_MARGIN; - if(optimal_height < panel_height) + if (optimal_height < panel_height) { panel_height = optimal_height; } // minimum tab height is equal to header height - if(mAccordionTabs[i]->getHeaderHeight() > panel_height) + if (mAccordionTabs[i]->getHeaderHeight() > panel_height) { panel_height = mAccordionTabs[i]->getHeaderHeight(); } } ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height); - panel_top-=panel_height; + panel_top -= panel_height; } } - show_hide_scrollbar(getRect().getWidth(),getRect().getHeight()); + show_hide_scrollbar(getRect().getWidth(), getRect().getHeight()); - updateLayout(getRect().getWidth(),getRect().getHeight()); + updateLayout(getRect().getWidth(), getRect().getHeight()); } @@ -519,70 +519,67 @@ void LLAccordionCtrl::arrange() { updateNoTabsHelpTextVisibility(); - if( mAccordionTabs.size() == 0) + if (mAccordionTabs.empty()) { - //We do not arrange if we do not have what should be arranged + // Nothing to arrange return; } - - if(mAccordionTabs.size() == 1) + if (mAccordionTabs.size() == 1) { - S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel - S32 panel_width = getRect().getWidth() - 4; // Top coordinate of the first panel + S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel + S32 panel_width = getRect().getWidth() - 4; LLAccordionCtrlTab* accordion_tab = dynamic_cast(mAccordionTabs[0]); LLRect panel_rect = accordion_tab->getRect(); - S32 panel_height = getRect().getHeight() - 2*BORDER_MARGIN; - + S32 panel_height = getRect().getHeight() - BORDER_MARGIN * 2; if (accordion_tab->getFitParent()) panel_height = accordion_tab->getRect().getHeight(); - ctrlSetLeftTopAndSize(accordion_tab,panel_rect.mLeft,panel_top,panel_width,panel_height); + + ctrlSetLeftTopAndSize(accordion_tab, panel_rect.mLeft, panel_top, panel_width, panel_height); - show_hide_scrollbar(getRect().getWidth(),getRect().getHeight()); + show_hide_scrollbar(getRect().getWidth(), getRect().getHeight()); return; - } - if(mSingleExpansion) - arrangeSinge (); + if (mSingleExpansion) + arrangeSingle(); else - arrangeMultiple (); + arrangeMultiple(); } //--------------------------------------------------------------------------------- -BOOL LLAccordionCtrl::handleScrollWheel ( S32 x, S32 y, S32 clicks ) +BOOL LLAccordionCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) { - if(LLPanel::handleScrollWheel(x,y,clicks)) + if (LLPanel::handleScrollWheel(x, y, clicks)) return TRUE; - if( mScrollbar->getVisible() && mScrollbar->handleScrollWheel( 0, 0, clicks ) ) + if (mScrollbar->getVisible() && mScrollbar->handleScrollWheel(0, 0, clicks)) return TRUE; - return false; - + return FALSE; } -BOOL LLAccordionCtrl::handleKeyHere (KEY key, MASK mask) +BOOL LLAccordionCtrl::handleKeyHere(KEY key, MASK mask) { - if( mScrollbar->getVisible() && mScrollbar->handleKeyHere( key,mask ) ) + if (mScrollbar->getVisible() && mScrollbar->handleKeyHere(key, mask)) return TRUE; - return LLPanel::handleKeyHere(key,mask); + return LLPanel::handleKeyHere(key, mask); } -BOOL LLAccordionCtrl::handleDragAndDrop (S32 x, S32 y, MASK mask, - BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) +BOOL LLAccordionCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, + BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) { // Scroll folder view if needed. Never accepts a drag or drop. *accept = ACCEPT_NO; BOOL handled = autoScroll(x, y); - if( !handled ) + if (!handled) { handled = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) != NULL; @@ -590,14 +587,14 @@ BOOL LLAccordionCtrl::handleDragAndDrop (S32 x, S32 y, MASK mask, return TRUE; } -BOOL LLAccordionCtrl::autoScroll (S32 x, S32 y) +BOOL LLAccordionCtrl::autoScroll(S32 x, S32 y) { static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); bool scrolling = false; - if( mScrollbar->getVisible() ) + if (mScrollbar->getVisible()) { - LLRect rect_local( 0, getRect().getHeight(), getRect().getWidth() - scrollbar_size, 0 ); + LLRect rect_local(0, getRect().getHeight(), getRect().getWidth() - scrollbar_size, 0); LLRect screen_local_extents; // clip rect against root view @@ -610,51 +607,52 @@ BOOL LLAccordionCtrl::autoScroll (S32 x, S32 y) LLRect bottom_scroll_rect = screen_local_extents; bottom_scroll_rect.mTop = rect_local.mBottom + auto_scroll_region_height; - if( bottom_scroll_rect.pointInRect( x, y ) && (mScrollbar->getDocPos() < mScrollbar->getDocPosMax()) ) + if (bottom_scroll_rect.pointInRect( x, y ) && (mScrollbar->getDocPos() < mScrollbar->getDocPosMax())) { - mScrollbar->setDocPos( mScrollbar->getDocPos() + auto_scroll_speed ); + mScrollbar->setDocPos(mScrollbar->getDocPos() + auto_scroll_speed); mAutoScrolling = true; scrolling = true; } LLRect top_scroll_rect = screen_local_extents; top_scroll_rect.mBottom = rect_local.mTop - auto_scroll_region_height; - if( top_scroll_rect.pointInRect( x, y ) && (mScrollbar->getDocPos() > 0) ) + if (top_scroll_rect.pointInRect(x, y) && (mScrollbar->getDocPos() > 0)) { - mScrollbar->setDocPos( mScrollbar->getDocPos() - auto_scroll_speed ); + mScrollbar->setDocPos(mScrollbar->getDocPos() - auto_scroll_speed); mAutoScrolling = true; scrolling = true; } } - return scrolling; + + return scrolling ? TRUE : FALSE; } -void LLAccordionCtrl::updateLayout (S32 width, S32 height) +void LLAccordionCtrl::updateLayout(S32 width, S32 height) { S32 panel_top = height - BORDER_MARGIN ; - if(mScrollbar->getVisible()) - panel_top+=mScrollbar->getDocPos(); + if (mScrollbar->getVisible()) + panel_top += mScrollbar->getDocPos(); - S32 panel_width = width - 2*BORDER_MARGIN; + S32 panel_width = width - BORDER_MARGIN * 2; static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); - if(mScrollbar->getVisible()) - panel_width-=scrollbar_size; + if (mScrollbar->getVisible()) + panel_width -= scrollbar_size; - //set sizes for first panels and dragbars - for(size_t i=0;igetVisible()) + if (!mAccordionTabs[i]->getVisible()) continue; LLRect panel_rect = mAccordionTabs[i]->getRect(); - ctrlSetLeftTopAndSize(mAccordionTabs[i],panel_rect.mLeft,panel_top,panel_width,panel_rect.getHeight()); - panel_top-=panel_rect.getHeight(); + ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_rect.mLeft, panel_top, panel_width, panel_rect.getHeight()); + panel_top -= panel_rect.getHeight(); } } -void LLAccordionCtrl::onScrollPosChangeCallback(S32, LLScrollbar*) +void LLAccordionCtrl::onScrollPosChangeCallback(S32, LLScrollbar*) { - updateLayout(getRect().getWidth(),getRect().getHeight()); + updateLayout(getRect().getWidth(), getRect().getHeight()); } // virtual @@ -687,42 +685,43 @@ void LLAccordionCtrl::onUpdateScrollToChild(const LLUICtrl *cntrl) LLUICtrl::onUpdateScrollToChild(cntrl); } -void LLAccordionCtrl::onOpen (const LLSD& key) +void LLAccordionCtrl::onOpen(const LLSD& key) { - for(size_t i=0;i(mAccordionTabs[i]); LLPanel* panel = dynamic_cast(accordion_tab->getAccordionView()); - if(panel!=NULL) + if (panel != NULL) { panel->onOpen(key); } } } + S32 LLAccordionCtrl::notifyParent(const LLSD& info) { - if(info.has("action")) + if (info.has("action")) { std::string str_action = info["action"]; - if(str_action == "size_changes") + if (str_action == "size_changes") { // arrange(); return 1; } - else if(str_action == "select_next") + if (str_action == "select_next") { - for(size_t i=0;i(mAccordionTabs[i]); - if(accordion_tab->hasFocus()) + if (accordion_tab->hasFocus()) { - while(++igetVisible()) + if (mAccordionTabs[i]->getVisible()) break; } - if(i(mAccordionTabs[i]); accordion_tab->notify(LLSD().with("action","select_first")); @@ -733,17 +732,17 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) } return 0; } - else if(str_action == "select_prev") + if (str_action == "select_prev") { - for(size_t i=0;i(mAccordionTabs[i]); - if(accordion_tab->hasFocus() && i>0) + if (accordion_tab->hasFocus() && i > 0) { bool prev_visible_tab_found = false; - while(i>0) + while (i > 0) { - if(mAccordionTabs[--i]->getVisible()) + if (mAccordionTabs[--i]->getVisible()) { prev_visible_tab_found = true; break; @@ -761,12 +760,12 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) } return 0; } - else if(str_action == "select_current") + if (str_action == "select_current") { - for(size_t i=0;ihasFocus()) + if (mAccordionTabs[i]->hasFocus()) { if (mAccordionTabs[i] != mSelectedTab) { @@ -783,7 +782,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) } return 0; } - else if(str_action == "deselect_current") + if (str_action == "deselect_current") { // Reset selection to the currently selected tab. if (mSelectedTab) @@ -802,9 +801,9 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) screenRectToLocal(screen_rc, &local_rc); // Translate to parent coordinatess to check if we are in visible rectangle - local_rc.translate( getRect().mLeft, getRect().mBottom ); + local_rc.translate(getRect().mLeft, getRect().mBottom); - if ( !getRect().contains (local_rc) ) + if (!getRect().contains (local_rc)) { // Back to local coords and calculate position for scroller S32 bottom = mScrollbar->getDocPos() - local_rc.mBottom + getRect().mBottom; @@ -814,7 +813,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) bottom, // min vertical scroll top); // max vertical scroll - mScrollbar->setDocPos( scroll_pos ); + mScrollbar->setDocPos(scroll_pos); } return 1; } @@ -834,15 +833,16 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) } return LLPanel::notifyParent(info); } -void LLAccordionCtrl::reset () + +void LLAccordionCtrl::reset() { - if(mScrollbar) + if (mScrollbar) mScrollbar->setDocPos(0); } void LLAccordionCtrl::expandDefaultTab() { - if (mAccordionTabs.size() > 0) + if (!mAccordionTabs.empty()) { LLAccordionCtrlTab* tab = mAccordionTabs.front(); @@ -877,7 +877,7 @@ void LLAccordionCtrl::sort() arrange(); } -void LLAccordionCtrl::setFilterSubString(const std::string& filter_string) +void LLAccordionCtrl::setFilterSubString(const std::string& filter_string) { LLStringUtil::format_map_t args; args["[SEARCH_TERM]"] = LLURI::escape(filter_string); @@ -907,7 +907,7 @@ const LLAccordionCtrlTab* LLAccordionCtrl::getExpandedTab() const S32 LLAccordionCtrl::calcExpandedTabHeight(S32 tab_index /* = 0 */, S32 available_height /* = 0 */) { - if(tab_index < 0) + if (tab_index < 0) { return available_height; } @@ -915,9 +915,9 @@ S32 LLAccordionCtrl::calcExpandedTabHeight(S32 tab_index /* = 0 */, S32 availabl S32 collapsed_tabs_height = 0; S32 num_expanded = 0; - for(size_t n = tab_index; n < mAccordionTabs.size(); ++n) + for (size_t n = tab_index; n < mAccordionTabs.size(); ++n) { - if(!mAccordionTabs[n]->isExpanded()) + if (!mAccordionTabs[n]->isExpanded()) { collapsed_tabs_height += mAccordionTabs[n]->getHeaderHeight(); } @@ -927,7 +927,7 @@ S32 LLAccordionCtrl::calcExpandedTabHeight(S32 tab_index /* = 0 */, S32 availabl } } - if(0 == num_expanded) + if (0 == num_expanded) { return available_height; } diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index 2828254472..6a1989afba 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -144,7 +144,7 @@ private: void initNoTabsWidget(const LLTextBox::Params& tb_params); void updateNoTabsHelpTextVisibility(); - void arrangeSinge(); + void arrangeSingle(); void arrangeMultiple(); // Calc Splitter's height that is necessary to display all child content diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 04485c6262..20da568746 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -69,13 +69,13 @@ public: virtual BOOL postBuild(); std::string getTitle(); - void setTitle(const std::string& title, const std::string& hl); + void setTitle(const std::string& title, const std::string& hl); - void setTitleFontStyle(std::string style); + void setTitleFontStyle(std::string style); - void setTitleColor(LLUIColor); + void setTitleColor(LLUIColor); - void setSelected(bool is_selected) { mIsSelected = is_selected; } + void setSelected(bool is_selected) { mIsSelected = is_selected; } virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); @@ -85,8 +85,8 @@ public: void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); -private: +private: LLTextBox* mHeaderTextbox; // Overlay images (arrows) @@ -102,7 +102,7 @@ private: LLPointer mImageHeaderFocused; // style saved when applying it in setTitleFontStyle - LLStyle::Params mStyleParams; + LLStyle::Params mStyleParams; LLUIColor mHeaderBGColor; @@ -157,19 +157,17 @@ BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::postBuild() std::string LLAccordionCtrlTab::LLAccordionCtrlTabHeader::getTitle() { - if(mHeaderTextbox) + if (mHeaderTextbox) { return mHeaderTextbox->getText(); } - else - { - return LLStringUtil::null; - } + + return LLStringUtil::null; } void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitle(const std::string& title, const std::string& hl) { - if(mHeaderTextbox) + if (mHeaderTextbox) { LLTextUtil::textboxSetHighlightedVal( mHeaderTextbox, @@ -192,7 +190,7 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitleFontStyle(std::string void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitleColor(LLUIColor color) { - if(mHeaderTextbox) + if (mHeaderTextbox) { mHeaderTextbox->setColor(color); } @@ -204,11 +202,11 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw() S32 height = getRect().getHeight(); F32 alpha = getCurrentTransparency(); - gl_rect_2d(0,0,width - 1 ,height - 1,mHeaderBGColor.get() % alpha,true); + gl_rect_2d(0, 0, width - 1, height - 1, mHeaderBGColor.get() % alpha, TRUE); LLAccordionCtrlTab* parent = dynamic_cast(getParent()); - bool collapsible = (parent && parent->getCollapsible()); - bool expanded = (parent && parent->getDisplayChildren()); + bool collapsible = parent && parent->getCollapsible(); + bool expanded = parent && parent->getDisplayChildren(); // Handle overlay images, if needed // Only show green "focus" background image if the accordion is open, @@ -218,23 +216,22 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw() /*&& !(collapsible && !expanded)*/ // WHY?? ) { - mImageHeaderFocused->draw(0,0,width,height); + mImageHeaderFocused->draw(0, 0, width, height); } else { - mImageHeader->draw(0,0,width,height); + mImageHeader->draw(0, 0, width, height); } - if(mNeedsHighlight) + if (mNeedsHighlight) { - mImageHeaderOver->draw(0,0,width,height); + mImageHeaderOver->draw(0, 0, width, height); } - - if(collapsible) + if (collapsible) { LLPointer overlay_image; - if(expanded) + if (expanded) { overlay_image = mImageExpanded; } @@ -242,8 +239,7 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw() { overlay_image = mImageCollapsed; } - overlay_image->draw(HEADER_IMAGE_LEFT_OFFSET, - (height - overlay_image->getHeight()) / 2); + overlay_image->draw(HEADER_IMAGE_LEFT_OFFSET, (height - overlay_image->getHeight()) / 2); } LLUICtrl::draw(); @@ -253,7 +249,7 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::reshape(S32 width, S32 height { S32 header_height = mHeaderTextbox->getTextPixelHeight(); - LLRect textboxRect(HEADER_TEXT_LEFT_OFFSET,(height+header_height)/2 ,width,(height-header_height)/2); + LLRect textboxRect(HEADER_TEXT_LEFT_OFFSET, (height + header_height) / 2, width, (height - header_height) / 2); mHeaderTextbox->reshape(textboxRect.getWidth(), textboxRect.getHeight()); mHeaderTextbox->setRect(textboxRect); @@ -272,20 +268,24 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::onMouseEnter(S32 x, S32 y, MA LLUICtrl::onMouseEnter(x, y, mask); mNeedsHighlight = true; } + void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::onMouseLeave(S32 x, S32 y, MASK mask) { LLUICtrl::onMouseLeave(x, y, mask); mNeedsHighlight = false; mAutoOpenTimer.stop(); } + BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleKey(KEY key, MASK mask, BOOL called_from_parent) { - if ( ( key == KEY_LEFT || key == KEY_RIGHT) && mask == MASK_NONE) + if ((key == KEY_LEFT || key == KEY_RIGHT) && mask == MASK_NONE) { return getParent()->handleKey(key, mask, called_from_parent); } + return LLUICtrl::handleKey(key, mask, called_from_parent); } + BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, @@ -295,7 +295,7 @@ BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleDragAndDrop(S32 x, S32 { LLAccordionCtrlTab* parent = dynamic_cast(getParent()); - if ( parent && !parent->getDisplayChildren() && parent->getCollapsible() && parent->canOpenClose() ) + if (parent && !parent->getDisplayChildren() && parent->getCollapsible() && parent->canOpenClose()) { if (mAutoOpenTimer.getStarted()) { @@ -307,12 +307,15 @@ BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleDragAndDrop(S32 x, S32 } } else + { mAutoOpenTimer.start(); + } } return LLUICtrl::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); } + LLAccordionCtrlTab::Params::Params() : title("title") ,display_children("expanded", true) @@ -384,41 +387,39 @@ LLAccordionCtrlTab::~LLAccordionCtrlTab() { } - void LLAccordionCtrlTab::setDisplayChildren(bool display) { mDisplayChildren = display; LLRect rect = getRect(); - rect.mBottom = rect.mTop - (getDisplayChildren() ? - mExpandedHeight : HEADER_HEIGHT); + rect.mBottom = rect.mTop - (getDisplayChildren() ? mExpandedHeight : HEADER_HEIGHT); setRect(rect); - if(mContainerPanel) + if (mContainerPanel) + { mContainerPanel->setVisible(getDisplayChildren()); + } - if(mDisplayChildren) + if (mDisplayChildren) { adjustContainerPanel(); } else { - if(mScrollbar) - mScrollbar->setVisible(false); + if (mScrollbar) + mScrollbar->setVisible(FALSE); } - } void LLAccordionCtrlTab::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) { LLRect headerRect; - headerRect.setLeftTopAndSize( - 0,height,width,HEADER_HEIGHT); + headerRect.setLeftTopAndSize(0, height, width, HEADER_HEIGHT); mHeader->setRect(headerRect); mHeader->reshape(headerRect.getWidth(), headerRect.getHeight()); - if(!mDisplayChildren) + if (!mDisplayChildren) return; LLRect childRect; @@ -426,7 +427,7 @@ void LLAccordionCtrlTab::reshape(S32 width, S32 height, BOOL called_from_parent childRect.setLeftTopAndSize( getPaddingLeft(), height - getHeaderHeight() - getPaddingTop(), - width - getPaddingLeft() - getPaddingRight(), + width - getPaddingLeft() - getPaddingRight(), height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() ); adjustContainerPanel(childRect); @@ -434,7 +435,7 @@ void LLAccordionCtrlTab::reshape(S32 width, S32 height, BOOL called_from_parent void LLAccordionCtrlTab::changeOpenClose(bool is_open) { - if(is_open) + if (is_open) mExpandedHeight = getRect().getHeight(); setDisplayChildren(!is_open); @@ -483,14 +484,14 @@ void LLAccordionCtrlTab::onUpdateScrollToChild(const LLUICtrl *cntrl) BOOL LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask) { - if(mCollapsible && mHeaderVisible && mCanOpenClose) + if (mCollapsible && mHeaderVisible && mCanOpenClose) { - if(y >= (getRect().getHeight() - HEADER_HEIGHT) ) + if (y >= (getRect().getHeight() - HEADER_HEIGHT)) { mHeader->setFocus(true); changeOpenClose(getDisplayChildren()); - //reset stored state + // Reset stored state mWasStateStored = false; return TRUE; } @@ -510,7 +511,7 @@ boost::signals2::connection LLAccordionCtrlTab::setDropDownStateChangedCallback( bool LLAccordionCtrlTab::addChild(LLView* child, S32 tab_group) { - if(DD_HEADER_NAME != child->getName()) + if (DD_HEADER_NAME != child->getName()) { reshape(child->getRect().getWidth() , child->getRect().getHeight() + HEADER_HEIGHT ); mExpandedHeight = getRect().getHeight(); @@ -518,12 +519,12 @@ bool LLAccordionCtrlTab::addChild(LLView* child, S32 tab_group) bool res = LLUICtrl::addChild(child, tab_group); - if(DD_HEADER_NAME != child->getName()) + if (DD_HEADER_NAME != child->getName()) { - if(!mCollapsible) + if (!mCollapsible) setDisplayChildren(true); else - setDisplayChildren(getDisplayChildren()); + setDisplayChildren(getDisplayChildren()); } if (!mContainerPanel) @@ -534,7 +535,7 @@ bool LLAccordionCtrlTab::addChild(LLView* child, S32 tab_group) void LLAccordionCtrlTab::setAccordionView(LLView* panel) { - addChild(panel,0); + addChild(panel, 0); } std::string LLAccordionCtrlTab::getTitle() const @@ -543,10 +544,8 @@ std::string LLAccordionCtrlTab::getTitle() const { return mHeader->getTitle(); } - else - { - return LLStringUtil::null; - } + + return LLStringUtil::null; } void LLAccordionCtrlTab::setTitle(const std::string& title, const std::string& hl) @@ -579,6 +578,7 @@ boost::signals2::connection LLAccordionCtrlTab::setFocusReceivedCallback(const f { return mHeader->setFocusReceivedCallback(cb); } + return boost::signals2::connection(); } @@ -588,6 +588,7 @@ boost::signals2::connection LLAccordionCtrlTab::setFocusLostCallback(const focus { return mHeader->setFocusLostCallback(cb); } + return boost::signals2::connection(); } @@ -601,59 +602,65 @@ void LLAccordionCtrlTab::setSelected(bool is_selected) LLView* LLAccordionCtrlTab::findContainerView() { - for(child_list_const_iter_t it = getChildList()->begin(); - getChildList()->end() != it; ++it) + child_list_const_iter_t it = getChildList()->begin(), it_end = getChildList()->end(); + while (it != it_end) { - LLView* child = *it; - if(DD_HEADER_NAME == child->getName()) - continue; - if(!child->getVisible()) - continue; - return child; + LLView* child = *(it++); + if (DD_HEADER_NAME != child->getName() && child->getVisible()) + return child; } + return NULL; } void LLAccordionCtrlTab::selectOnFocusReceived() { if (getParent()) // A parent may not be set if tabs are added dynamically. + { getParent()->notifyParent(LLSD().with("action", "select_current")); + } } void LLAccordionCtrlTab::deselectOnFocusLost() { - if(getParent()) // A parent may not be set if tabs are added dynamically. + if (getParent()) // A parent may not be set if tabs are added dynamically. { getParent()->notifyParent(LLSD().with("action", "deselect_current")); } - } S32 LLAccordionCtrlTab::getHeaderHeight() { - return mHeaderVisible?HEADER_HEIGHT:0; + return mHeaderVisible ? HEADER_HEIGHT : 0; } -void LLAccordionCtrlTab::setHeaderVisible(bool value) +void LLAccordionCtrlTab::setHeaderVisible(bool value) { - if(mHeaderVisible == value) + if (mHeaderVisible == value) return; + mHeaderVisible = value; - if(mHeader) - mHeader->setVisible(value); + + if (mHeader) + { + mHeader->setVisible(value ? TRUE : FALSE); + } + reshape(getRect().getWidth(), getRect().getHeight(), FALSE); }; //virtual BOOL LLAccordionCtrlTab::postBuild() { - if(mHeader) + if (mHeader) + { mHeader->setVisible(mHeaderVisible); - - static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); + } + + static LLUICachedControl scrollbar_size("UIScrollbarSize", 0); LLRect scroll_rect; - scroll_rect.setOriginAndSize( + scroll_rect.setOriginAndSize( getRect().getWidth() - scrollbar_size, 1, scrollbar_size, @@ -661,7 +668,7 @@ BOOL LLAccordionCtrlTab::postBuild() mContainerPanel = findContainerView(); - if(!mFitPanel) + if (!mFitPanel) { LLScrollbar::Params sbparams; sbparams.name("scrollable vertical"); @@ -674,9 +681,8 @@ BOOL LLAccordionCtrlTab::postBuild() sbparams.follows.flags(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM); sbparams.change_callback(boost::bind(&LLAccordionCtrlTab::onScrollPosChangeCallback, this, _1, _2)); - - mScrollbar = LLUICtrlFactory::create (sbparams); - LLView::addChild( mScrollbar ); + mScrollbar = LLUICtrlFactory::create(sbparams); + LLView::addChild(mScrollbar); mScrollbar->setFollowsRight(); mScrollbar->setFollowsTop(); mScrollbar->setFollowsBottom(); @@ -684,44 +690,48 @@ BOOL LLAccordionCtrlTab::postBuild() mScrollbar->setVisible(false); } - if(mContainerPanel) + if (mContainerPanel) + { mContainerPanel->setVisible(mDisplayChildren); + } return LLUICtrl::postBuild(); } -bool LLAccordionCtrlTab::notifyChildren (const LLSD& info) + +bool LLAccordionCtrlTab::notifyChildren (const LLSD& info) { - if(info.has("action")) + if (info.has("action")) { std::string str_action = info["action"]; - if(str_action == "store_state") + if (str_action == "store_state") { storeOpenCloseState(); return true; } - if(str_action == "restore_state") + + if (str_action == "restore_state") { restoreOpenCloseState(); return true; } } + return LLUICtrl::notifyChildren(info); } S32 LLAccordionCtrlTab::notifyParent(const LLSD& info) { - if(info.has("action")) + if (info.has("action")) { std::string str_action = info["action"]; - if(str_action == "size_changes") + if (str_action == "size_changes") { - // S32 height = info["height"]; - height = llmax(height,10) + HEADER_HEIGHT + getPaddingTop() + getPaddingBottom(); + height = llmax(height, 10) + HEADER_HEIGHT + getPaddingTop() + getPaddingBottom(); mExpandedHeight = height; - if(isExpanded() && !mSkipChangesOnNotifyParent) + if (isExpanded() && !mSkipChangesOnNotifyParent) { LLRect panel_rect = getRect(); panel_rect.setLeftTopAndSize( panel_rect.mLeft, panel_rect.mTop, panel_rect.getWidth(), height); @@ -729,12 +739,13 @@ S32 LLAccordionCtrlTab::notifyParent(const LLSD& info) setRect(panel_rect); } - //LLAccordionCtrl should rearrange accordion tab if one of accordion change its size + // LLAccordionCtrl should rearrange accordion tab if one of accordions changed its size if (getParent()) // A parent may not be set if tabs are added dynamically. getParent()->notifyParent(info); return 1; } - else if(str_action == "select_prev") + + if (str_action == "select_prev") { showAndFocusHeader(); return 1; @@ -772,78 +783,85 @@ S32 LLAccordionCtrlTab::notifyParent(const LLSD& info) S32 LLAccordionCtrlTab::notify(const LLSD& info) { - if(info.has("action")) + if (info.has("action")) { std::string str_action = info["action"]; - if(str_action == "select_first") + if (str_action == "select_first") { showAndFocusHeader(); return 1; } - else if( str_action == "select_last" ) + + if (str_action == "select_last") { - if(getDisplayChildren() == false) + if (!getDisplayChildren()) { showAndFocusHeader(); } else { LLView* view = getAccordionView(); - if(view) - view->notify(LLSD().with("action","select_last")); + if (view) + { + view->notify(LLSD().with("action", "select_last")); + } } } } + return 0; } BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) { - if( !mHeader->hasFocus() ) + if (!mHeader->hasFocus()) return LLUICtrl::handleKey(key, mask, called_from_parent); - if ( (key == KEY_RETURN )&& mask == MASK_NONE) + if ((key == KEY_RETURN) && mask == MASK_NONE) { changeOpenClose(getDisplayChildren()); return TRUE; } - if ( (key == KEY_ADD || key == KEY_RIGHT)&& mask == MASK_NONE) + if ((key == KEY_ADD || key == KEY_RIGHT) && mask == MASK_NONE) { - if(getDisplayChildren() == false) + if (!getDisplayChildren()) { changeOpenClose(getDisplayChildren()); return TRUE; } } - if ( (key == KEY_SUBTRACT || key == KEY_LEFT)&& mask == MASK_NONE) + + if ((key == KEY_SUBTRACT || key == KEY_LEFT) && mask == MASK_NONE) { - if(getDisplayChildren() == true) + if (getDisplayChildren()) { changeOpenClose(getDisplayChildren()); return TRUE; } } - if ( key == KEY_DOWN && mask == MASK_NONE) + if (key == KEY_DOWN && mask == MASK_NONE) { - //if collapsed go to the next accordion - if(getDisplayChildren() == false) - //we processing notifyParent so let call parent directly - getParent()->notifyParent(LLSD().with("action","select_next")); + // if collapsed go to the next accordion + if (!getDisplayChildren()) + { + // we're processing notifyParent so let call parent directly + getParent()->notifyParent(LLSD().with("action", "select_next")); + } else { - getAccordionView()->notify(LLSD().with("action","select_first")); + getAccordionView()->notify(LLSD().with("action", "select_first")); } return TRUE; } - if ( key == KEY_UP && mask == MASK_NONE) + if (key == KEY_UP && mask == MASK_NONE) { - //go to the previous accordion + // go to the previous accordion - //we processing notifyParent so let call parent directly - getParent()->notifyParent(LLSD().with("action","select_prev")); + // we're processing notifyParent so let call parent directly + getParent()->notifyParent(LLSD().with("action", "select_prev")); return TRUE; } @@ -869,28 +887,29 @@ void LLAccordionCtrlTab::showAndFocusHeader() // accordion tab (assuming that the parent is an LLAccordionCtrl) the calls chain // is shortened and messages from inside the collapsed tabs are avoided. // See STORM-536. - getParent()->notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue())); + getParent()->notifyParent(LLSD().with("scrollToShowRect", screen_rc.getValue())); } -void LLAccordionCtrlTab::storeOpenCloseState() + +void LLAccordionCtrlTab::storeOpenCloseState() { - if(mWasStateStored) + if (mWasStateStored) return; mStoredOpenCloseState = getDisplayChildren(); mWasStateStored = true; } -void LLAccordionCtrlTab::restoreOpenCloseState() +void LLAccordionCtrlTab::restoreOpenCloseState() { - if(!mWasStateStored) + if (!mWasStateStored) return; - if(getDisplayChildren() != mStoredOpenCloseState) + if (getDisplayChildren() != mStoredOpenCloseState) { changeOpenClose(getDisplayChildren()); } mWasStateStored = false; } -void LLAccordionCtrlTab::adjustContainerPanel () +void LLAccordionCtrlTab::adjustContainerPanel() { S32 width = getRect().getWidth(); S32 height = getRect().getHeight(); @@ -907,83 +926,83 @@ void LLAccordionCtrlTab::adjustContainerPanel () void LLAccordionCtrlTab::adjustContainerPanel(const LLRect& child_rect) { - if(!mContainerPanel) + if (!mContainerPanel) return; - if(!mFitPanel) + if (!mFitPanel) { show_hide_scrollbar(child_rect); updateLayout(child_rect); } else { - mContainerPanel->reshape(child_rect.getWidth(),child_rect.getHeight()); + mContainerPanel->reshape(child_rect.getWidth(), child_rect.getHeight()); mContainerPanel->setRect(child_rect); } } S32 LLAccordionCtrlTab::getChildViewHeight() { - if(!mContainerPanel) + if (!mContainerPanel) return 0; return mContainerPanel->getRect().getHeight(); } void LLAccordionCtrlTab::show_hide_scrollbar(const LLRect& child_rect) { - if(getChildViewHeight() > child_rect.getHeight() ) + if (getChildViewHeight() > child_rect.getHeight()) showScrollbar(child_rect); else hideScrollbar(child_rect); } + void LLAccordionCtrlTab::showScrollbar(const LLRect& child_rect) { - if(!mContainerPanel || !mScrollbar) + if (!mContainerPanel || !mScrollbar) return; bool was_visible = mScrollbar->getVisible(); mScrollbar->setVisible(true); static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); - { - ctrlSetLeftTopAndSize(mScrollbar,child_rect.getWidth()-scrollbar_size, - child_rect.getHeight()-PARENT_BORDER_MARGIN, - scrollbar_size, - child_rect.getHeight()-2*PARENT_BORDER_MARGIN); - } + ctrlSetLeftTopAndSize(mScrollbar, + child_rect.getWidth() - scrollbar_size, + child_rect.getHeight() - PARENT_BORDER_MARGIN, + scrollbar_size, + child_rect.getHeight() - PARENT_BORDER_MARGIN * 2); LLRect orig_rect = mContainerPanel->getRect(); mScrollbar->setPageSize(child_rect.getHeight()); - mScrollbar->setDocParams(orig_rect.getHeight(),mScrollbar->getDocPos()); + mScrollbar->setDocParams(orig_rect.getHeight(), mScrollbar->getDocPos()); - if(was_visible) + if (was_visible) { S32 scroll_pos = llmin(mScrollbar->getDocPos(), orig_rect.getHeight() - child_rect.getHeight() - 1); mScrollbar->setDocPos(scroll_pos); } - else//shrink child panel + else // Shrink child panel { updateLayout(child_rect); } - } -void LLAccordionCtrlTab::hideScrollbar( const LLRect& child_rect ) +void LLAccordionCtrlTab::hideScrollbar(const LLRect& child_rect) { - if(!mContainerPanel || !mScrollbar) + if (!mContainerPanel || !mScrollbar) return; - if(mScrollbar->getVisible() == false) + if (mScrollbar->getVisible() == FALSE) return; - mScrollbar->setVisible(false); + + mScrollbar->setVisible(FALSE); mScrollbar->setDocPos(0); //shrink child panel updateLayout(child_rect); } -void LLAccordionCtrlTab::onScrollPosChangeCallback(S32, LLScrollbar*) +void LLAccordionCtrlTab::onScrollPosChangeCallback(S32, LLScrollbar*) { LLRect child_rect; @@ -999,21 +1018,20 @@ void LLAccordionCtrlTab::onScrollPosChangeCallback(S32, LLScrollbar*) updateLayout(child_rect); } -void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child) +void LLAccordionCtrlTab::drawChild(const LLRect& root_rect, LLView* child) { if (child && child->getVisible() && child->getRect().isValid()) { LLRect screen_rect; - localRectToScreen(child->getRect(),&screen_rect); - - if ( root_rect.overlaps(screen_rect) && sDirtyRect.overlaps(screen_rect)) + localRectToScreen(child->getRect(), &screen_rect); + + if (root_rect.overlaps(screen_rect) && sDirtyRect.overlaps(screen_rect)) { gGL.matrixMode(LLRender::MM_MODELVIEW); LLUI::pushMatrix(); { LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom); child->draw(); - } LLUI::popMatrix(); } @@ -1022,64 +1040,67 @@ void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child) void LLAccordionCtrlTab::draw() { - if(mFitPanel) + if (mFitPanel) + { LLUICtrl::draw(); + } else { - LLRect root_rect = getRootView()->getRect(); - drawChild(root_rect,mHeader); - drawChild(root_rect,mScrollbar ); - { - LLRect child_rect; + LLRect root_rect(getRootView()->getRect()); + drawChild(root_rect, mHeader); + drawChild(root_rect, mScrollbar); - S32 width = getRect().getWidth(); - S32 height = getRect().getHeight(); + LLRect child_rect; - child_rect.setLeftTopAndSize( - getPaddingLeft(), - height - getHeaderHeight() - getPaddingTop(), - width - getPaddingLeft() - getPaddingRight(), - height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() ); + S32 width = getRect().getWidth(); + S32 height = getRect().getHeight(); - LLLocalClipRect clip(child_rect); - drawChild(root_rect,mContainerPanel); - } + child_rect.setLeftTopAndSize( + getPaddingLeft(), + height - getHeaderHeight() - getPaddingTop(), + width - getPaddingLeft() - getPaddingRight(), + height - getHeaderHeight() - getPaddingTop() - getPaddingBottom()); + + LLLocalClipRect clip(child_rect); + drawChild(root_rect,mContainerPanel); } } -void LLAccordionCtrlTab::updateLayout ( const LLRect& child_rect ) +void LLAccordionCtrlTab::updateLayout(const LLRect& child_rect) { LLView* child = getAccordionView(); - if(!mContainerPanel) + if (!mContainerPanel) return; S32 panel_top = child_rect.getHeight(); S32 panel_width = child_rect.getWidth(); - static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); - if(mScrollbar && mScrollbar->getVisible() != false) + static LLUICachedControl scrollbar_size("UIScrollbarSize", 0); + if (mScrollbar && mScrollbar->getVisible()) { - panel_top+=mScrollbar->getDocPos(); - panel_width-=scrollbar_size; + panel_top += mScrollbar->getDocPos(); + panel_width -= scrollbar_size; } - //set sizes for first panels and dragbars + // Set sizes for first panels and dragbars LLRect panel_rect = child->getRect(); - ctrlSetLeftTopAndSize(mContainerPanel,child_rect.mLeft,panel_top,panel_width,panel_rect.getHeight()); + ctrlSetLeftTopAndSize(mContainerPanel, child_rect.mLeft, panel_top, panel_width, panel_rect.getHeight()); } + void LLAccordionCtrlTab::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top, S32 width, S32 height) { - if(!panel) + if (!panel) return; LLRect panel_rect = panel->getRect(); - panel_rect.setLeftTopAndSize( left, top, width, height); + panel_rect.setLeftTopAndSize(left, top, width, height); panel->reshape( width, height, 1); panel->setRect(panel_rect); } + BOOL LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) { //header may be not the first child but we need to process it first - if(y >= (getRect().getHeight() - HEADER_HEIGHT - HEADER_HEIGHT/2) ) + if (y >= (getRect().getHeight() - HEADER_HEIGHT - HEADER_HEIGHT / 2)) { //inside tab header //fix for EXT-6619 @@ -1088,16 +1109,18 @@ BOOL LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) } return LLUICtrl::handleToolTip(x, y, mask); } -BOOL LLAccordionCtrlTab::handleScrollWheel ( S32 x, S32 y, S32 clicks ) + +BOOL LLAccordionCtrlTab::handleScrollWheel(S32 x, S32 y, S32 clicks) { - if( LLUICtrl::handleScrollWheel(x,y,clicks)) + if (LLUICtrl::handleScrollWheel(x, y, clicks)) { return TRUE; } - if( mScrollbar && mScrollbar->getVisible() && mScrollbar->handleScrollWheel( 0, 0, clicks ) ) + + if (mScrollbar && mScrollbar->getVisible() && mScrollbar->handleScrollWheel(0, 0, clicks)) { return TRUE; } + return FALSE; } - diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index 2c72e8c036..896a34cac4 100644 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -104,7 +104,7 @@ public: virtual void setDisplayChildren(bool display); // Returns expand/collapse state - virtual bool getDisplayChildren() const {return mDisplayChildren;}; + virtual bool getDisplayChildren() const { return mDisplayChildren; }; //set LLAccordionCtrlTab panel void setAccordionView(LLView* panel); diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index b13e7389cc..460bd0945b 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -1198,7 +1198,7 @@ void LLFlatListView::onFocusReceived() { if (size()) { - mSelectedItemsBorder->setVisible(TRUE); + mSelectedItemsBorder->setVisible(TRUE); } gEditMenuHandler = this; } @@ -1207,7 +1207,7 @@ void LLFlatListView::onFocusLost() { mSelectedItemsBorder->setVisible(FALSE); // Route menu back to the default - if( gEditMenuHandler == this ) + if (gEditMenuHandler == this) { gEditMenuHandler = NULL; } @@ -1216,16 +1216,16 @@ void LLFlatListView::onFocusLost() //virtual S32 LLFlatListView::notify(const LLSD& info) { - if(info.has("action")) + if (info.has("action")) { std::string str_action = info["action"]; - if(str_action == "select_first") + if (str_action == "select_first") { setFocus(true); selectFirstItem(); return 1; } - else if(str_action == "select_last") + else if (str_action == "select_last") { setFocus(true); selectLastItem(); @@ -1238,6 +1238,7 @@ S32 LLFlatListView::notify(const LLSD& info) notifyParentItemsRectChanged(); return 1; } + return 0; } @@ -1249,10 +1250,8 @@ void LLFlatListView::detachItems(std::vector& detached_items) detached_items.clear(); // Go through items and detach valid items, remove them from items panel // and add to detached_items. - for (pairs_iterator_t - iter = mItemPairs.begin(), - iter_end = mItemPairs.end(); - iter != iter_end; ++iter) + pairs_iterator_t iter = mItemPairs.begin(), iter_end = mItemPairs.end(); + while (iter != iter_end) { LLPanel* pItem = (*iter)->first; if (1 == pItem->notify(action)) @@ -1261,6 +1260,7 @@ void LLFlatListView::detachItems(std::vector& detached_items) mItemsPanel->removeChild(pItem); detached_items.push_back(pItem); } + iter++; } if (!detached_items.empty()) { @@ -1268,13 +1268,12 @@ void LLFlatListView::detachItems(std::vector& detached_items) if (detached_items.size() == mItemPairs.size()) { // This way will be faster if all items were disconnected - for (pairs_iterator_t - iter = mItemPairs.begin(), - iter_end = mItemPairs.end(); - iter != iter_end; ++iter) + pairs_iterator_t iter = mItemPairs.begin(), iter_end = mItemPairs.end(); + while (iter != iter_end) { (*iter)->first = NULL; delete *iter; + iter++; } mItemPairs.clear(); // Also set items panel height to zero. @@ -1287,16 +1286,14 @@ void LLFlatListView::detachItems(std::vector& detached_items) } else { - for (std::vector::const_iterator - detached_iter = detached_items.begin(), - detached_iter_end = detached_items.end(); - detached_iter != detached_iter_end; ++detached_iter) + std::vector::const_iterator + detached_iter = detached_items.begin(), + detached_iter_end = detached_items.end(); + while (detached_iter < detached_iter_end) { LLPanel* pDetachedItem = *detached_iter; - for (pairs_iterator_t - iter = mItemPairs.begin(), - iter_end = mItemPairs.end(); - iter != iter_end; ++iter) + pairs_iterator_t iter = mItemPairs.begin(), iter_end = mItemPairs.end(); + while (iter != iter_end) { item_pair_t* item_pair = *iter; if (item_pair->first == pDetachedItem) @@ -1306,7 +1303,9 @@ void LLFlatListView::detachItems(std::vector& detached_items) delete item_pair; break; } + iter++; } + detached_iter++; } rearrangeItems(); } @@ -1322,7 +1321,6 @@ LLFlatListViewEx::Params::Params() : no_items_msg("no_items_msg") , no_filtered_items_msg("no_filtered_items_msg") { - } LLFlatListViewEx::LLFlatListViewEx(const Params& p) @@ -1332,7 +1330,6 @@ LLFlatListViewEx::LLFlatListViewEx(const Params& p) , mForceShowingUnmatchedItems(false) , mHasMatchedItems(false) { - } void LLFlatListViewEx::updateNoItemsMessage(const std::string& filter_string) @@ -1352,7 +1349,6 @@ void LLFlatListViewEx::updateNoItemsMessage(const std::string& filter_string) // list does not contain any items at all setNoItemsCommentText(mNoItemsMsg); } - } bool LLFlatListViewEx::getForceShowingUnmatchedItems() @@ -1411,12 +1407,10 @@ void LLFlatListViewEx::filterItems() getItems(items); mHasMatchedItems = false; - for (item_panel_list_t::iterator - iter = items.begin(), - iter_end = items.end(); - iter != iter_end; ++iter) + item_panel_list_t::iterator iter = items.begin(), iter_end = items.end(); + while (iter < iter_end) { - LLPanel* pItem = (*iter); + LLPanel* pItem = *(iter++); updateItemVisibility(pItem, action); } -- cgit v1.2.3 From 45a1a94a35142da71c507c724ae4d1498217e449 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Tue, 10 Oct 2023 23:21:08 +0200 Subject: SL-20432 Filtering My Outfits with big number of items freezes UI --- indra/llui/llaccordionctrltab.h | 10 ++++----- indra/llui/llflatlistview.cpp | 47 +++++++++++++++++++++++++++-------------- indra/llui/llflatlistview.h | 11 ++++++---- 3 files changed, 43 insertions(+), 25 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index 896a34cac4..496c34c38b 100644 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -126,12 +126,12 @@ public: void setSelected(bool is_selected); - bool getCollapsible() {return mCollapsible;}; + bool getCollapsible() { return mCollapsible; }; - void setCollapsible(bool collapsible) {mCollapsible = collapsible;}; + void setCollapsible(bool collapsible) { mCollapsible = collapsible; }; void changeOpenClose(bool is_open); - void canOpenClose(bool can_open_close) { mCanOpenClose = can_open_close;}; + void canOpenClose(bool can_open_close) { mCanOpenClose = can_open_close; }; bool canOpenClose() const { return mCanOpenClose; }; virtual BOOL postBuild(); @@ -142,8 +142,8 @@ public: void draw(); - void storeOpenCloseState (); - void restoreOpenCloseState (); + void storeOpenCloseState(); + void restoreOpenCloseState(); protected: LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&); diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 460bd0945b..e4f2dd11a4 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -1361,26 +1361,28 @@ void LLFlatListViewEx::setForceShowingUnmatchedItems(bool show) mForceShowingUnmatchedItems = show; } -void LLFlatListViewEx::setFilterSubString(const std::string& filter_str) +void LLFlatListViewEx::setFilterSubString(const std::string& filter_str, bool notify_parent) { if (0 != LLStringUtil::compareInsensitive(filter_str, mFilterSubString)) { mFilterSubString = filter_str; updateNoItemsMessage(mFilterSubString); - filterItems(); + filterItems(false, notify_parent); } } -void LLFlatListViewEx::updateItemVisibility(LLPanel* item, const LLSD &action) +bool LLFlatListViewEx::updateItemVisibility(LLPanel* item, const LLSD &action) { - if (!item) return; + if (!item) + return false; + + BOOL visible = TRUE; // 0 signifies that filter is matched, // i.e. we don't hide items that don't support 'match_filter' action, separators etc. if (0 == item->notify(action)) { mHasMatchedItems = true; - item->setVisible(true); } else { @@ -1388,12 +1390,20 @@ void LLFlatListViewEx::updateItemVisibility(LLPanel* item, const LLSD &action) if (!mForceShowingUnmatchedItems) { selectItem(item, false); + visible = FALSE; } - item->setVisible(mForceShowingUnmatchedItems); } + + if (item->getVisible() != visible) + { + item->setVisible(visible); + return true; + } + + return false; } -void LLFlatListViewEx::filterItems() +void LLFlatListViewEx::filterItems(bool re_sort, bool notify_parent) { typedef std::vector item_panel_list_t; @@ -1403,19 +1413,24 @@ void LLFlatListViewEx::filterItems() LLSD action; action.with("match_filter", cur_filter); - item_panel_list_t items; - getItems(items); - mHasMatchedItems = false; - item_panel_list_t::iterator iter = items.begin(), iter_end = items.end(); - while (iter < iter_end) + bool visibility_changed = false; + pairs_const_iterator_t iter = getItemPairs().begin(), iter_end = getItemPairs().end(); + while (iter != iter_end) { - LLPanel* pItem = *(iter++); - updateItemVisibility(pItem, action); + LLPanel* pItem = (*(iter++))->first; + visibility_changed |= updateItemVisibility(pItem, action); } - sort(); - notifyParentItemsRectChanged(); + if (re_sort) + { + sort(); + } + + if (visibility_changed && notify_parent) + { + notifyParentItemsRectChanged(); + } } bool LLFlatListViewEx::hasMatchedItems() diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index d47c1cf333..adb0e3e553 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -300,6 +300,7 @@ public: virtual S32 notify(const LLSD& info) ; virtual ~LLFlatListView(); + protected: /** Pairs LLpanel representing a single item LLPanel and LLSD associated with it */ @@ -375,7 +376,9 @@ protected: LLRect getLastSelectedItemRect(); - void ensureSelectedVisible(); + void ensureSelectedVisible(); + + const pairs_list_t& getItemPairs() { return mItemPairs; } private: @@ -482,14 +485,14 @@ public: /** * Sets up new filter string and filters the list. */ - void setFilterSubString(const std::string& filter_str); + void setFilterSubString(const std::string& filter_str, bool notify_parent); std::string getFilterSubString() { return mFilterSubString; } /** * Filters the list, rearranges and notifies parent about shape changes. * Derived classes may want to overload rearrangeItems() to exclude repeated separators after filtration. */ - void filterItems(); + void filterItems(bool re_sort, bool notify_parent); /** * Returns true if last call of filterItems() found at least one matching item @@ -513,7 +516,7 @@ protected: * @param item - item we are changing * @param item - action - parameters to determin visibility from */ - void updateItemVisibility(LLPanel* item, const LLSD &action); + bool updateItemVisibility(LLPanel* item, const LLSD &action); private: std::string mNoFilteredItemsMsg; -- cgit v1.2.3 From c6a82a44f8c2efcad535c941bd00567a23f4fe7b Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 11 Oct 2023 14:31:21 +0200 Subject: SL-20432 Buildfix --- indra/llui/llflatlistview.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index e4f2dd11a4..fd4c33df30 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -1405,8 +1405,6 @@ bool LLFlatListViewEx::updateItemVisibility(LLPanel* item, const LLSD &action) void LLFlatListViewEx::filterItems(bool re_sort, bool notify_parent) { - typedef std::vector item_panel_list_t; - std::string cur_filter = mFilterSubString; LLStringUtil::toUpper(cur_filter); -- cgit v1.2.3 From b134e91d2a2e7ff97e6f906d6ef36177e1dddeab Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 11 Oct 2023 20:56:25 +0200 Subject: SL-20419 Receiving new objects or items, etc causes inventory to switch from recent to my inventory tab --- indra/llui/lltabcontainer.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 76b9e448a1..8767c3f916 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1516,25 +1516,23 @@ BOOL LLTabContainer::selectTab(S32 which) LLTabTuple* selected_tuple = getTab(which); if (!selected_tuple) - { return FALSE; - } - + LLSD cbdata; if (selected_tuple->mTabPanel) cbdata = selected_tuple->mTabPanel->getName(); - BOOL res = FALSE; - if( !mValidateSignal || (*mValidateSignal)( this, cbdata ) ) + BOOL result = FALSE; + if (!mValidateSignal || (*mValidateSignal)(this, cbdata)) { - res = setTab(which); - if (res && mCommitSignal) + result = setTab(which); + if (result && mCommitSignal) { (*mCommitSignal)(this, cbdata); } } - - return res; + + return result; } // private -- cgit v1.2.3 From ae7b318e7f21d0d372d48a635ff1e2ea59c4acf6 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 22 Feb 2024 21:48:46 +0200 Subject: viewer#875 Crash at uri normalization Note that crash happened when setting LLProgressView::setMessage --- indra/llui/llurlentry.cpp | 18 ++++++++++++------ indra/llui/llurlregistry.cpp | 6 ++++-- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 77e9edf5e5..05d821f5d8 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -234,14 +234,20 @@ bool LLUrlEntryBase::isWikiLinkCorrect(const std::string &labeled_url) const std::string LLUrlEntryBase::urlToLabelWithGreyQuery(const std::string &url) const { + if (url.empty()) + { + return url; + } LLUriParser up(escapeUrl(url)); - up.normalize(); - - std::string label; - up.extractParts(); - up.glueFirst(label); + if (up.normalize() == 0) + { + std::string label; + up.extractParts(); + up.glueFirst(label); - return unescapeUrl(label); + return unescapeUrl(label); + } + return std::string(); } std::string LLUrlEntryBase::urlToGreyQuery(const std::string &url) const diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 3bd7321777..f1df7699e2 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -221,8 +221,10 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL if (match_entry == mUrlEntryTrusted) { LLUriParser up(url); - up.normalize(); - url = up.normalizedUri(); + if (up.normalize() == 0) + { + url = up.normalizedUri(); + } } match.setValues(match_start, match_end, -- cgit v1.2.3 From 757655d7c342d66711937ff7786a50f1c52d8699 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 22 Mar 2024 22:36:45 +0200 Subject: Revert "SL-20416 Fix Crash Report 1409376 (update)" This reverts commit cc43f42e6b7401c2cdd3204a16f757f5169bd95b. --- indra/llui/llfloater.cpp | 11 +---------- indra/llui/llfloater.h | 1 - 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index de3de53569..fb90cebd39 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -506,7 +506,6 @@ void LLFloater::enableResizeCtrls(bool enable, bool width, bool height) void LLFloater::destroy() { - gFloaterView->onDestroyFloater(this); // LLFloaterReg should be synchronized with "dead" floater to avoid returning dead instance before // it was deleted via LLMortician::updateClass(). See EXT-8458. LLFloaterReg::removeInstance(mInstanceName, mKey); @@ -2573,7 +2572,7 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus, BOOL restore return; } - if (mFrontChild) + if (mFrontChild && !mFrontChild->isDead() && mFrontChild->getVisible()) { mFrontChild->goneFromFront(); } @@ -3235,14 +3234,6 @@ void LLFloaterView::setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LL } } -void LLFloaterView::onDestroyFloater(LLFloater* floater) -{ - if (mFrontChild == floater) - { - mFrontChild = nullptr; - } -} - void LLFloater::setInstanceName(const std::string& name) { if (name != mInstanceName) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 88f9e77777..5f4e1a2cad 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -607,7 +607,6 @@ public: LLFloater* getFrontmostClosableFloater(); void setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LLRect& toolbar_rect); - void onDestroyFloater(LLFloater* floater); private: void hiddenFloaterClosed(LLFloater* floater); -- cgit v1.2.3 From 689ef9442581d7af8ff0e0264be4919fe6cffd73 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 22 Mar 2024 23:04:56 +0200 Subject: viewer#1033 Crash at syncFloaterTabOrder --- indra/llui/llfloater.cpp | 22 ++++++++++++---------- indra/llui/llfloater.h | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index fb90cebd39..cf33d633ad 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2406,8 +2406,7 @@ LLFloaterView::LLFloaterView (const Params& p) mFocusCycleMode(FALSE), mMinimizePositionVOffset(0), mSnapOffsetBottom(0), - mSnapOffsetRight(0), - mFrontChild(NULL) + mSnapOffsetRight(0) { mSnapView = getHandle(); } @@ -2563,7 +2562,8 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus, BOOL restore if (!child) return; - if (mFrontChild == child) + LLFloater* front_child = mFrontChildHandle.get(); + if (front_child == child) { if (give_focus && child->canFocusStealFrontmost() && !gFocusMgr.childHasKeyboardFocus(child)) { @@ -2572,12 +2572,12 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus, BOOL restore return; } - if (mFrontChild && !mFrontChild->isDead() && mFrontChild->getVisible()) + if (front_child && front_child->getVisible()) { - mFrontChild->goneFromFront(); + front_child->goneFromFront(); } - mFrontChild = child; + mFrontChildHandle = child->getHandle(); // *TODO: make this respect floater's mAutoFocus value, instead of // using parameter @@ -3076,7 +3076,8 @@ LLFloater *LLFloaterView::getBackmost() const void LLFloaterView::syncFloaterTabOrder() { - if (mFrontChild && !mFrontChild->isDead() && mFrontChild->getIsChrome()) + LLFloater* front_child = mFrontChildHandle.get(); + if (front_child && front_child->getIsChrome()) return; // look for a visible modal dialog, starting from first @@ -3114,11 +3115,12 @@ void LLFloaterView::syncFloaterTabOrder() LLFloater* floaterp = dynamic_cast(*child_it); if (gFocusMgr.childHasKeyboardFocus(floaterp)) { - if (mFrontChild != floaterp) + LLFloater* front_child = mFrontChildHandle.get(); + if (front_child != floaterp) { // Grab a list of the top floaters that want to stay on top of the focused floater std::list listTop; - if (mFrontChild && !mFrontChild->canFocusStealFrontmost()) + if (front_child && !front_child->canFocusStealFrontmost()) { for (LLView* childp : *getChildList()) { @@ -3138,7 +3140,7 @@ void LLFloaterView::syncFloaterTabOrder() { sendChildToFront(childp); } - mFrontChild = listTop.back(); + mFrontChildHandle = listTop.back()->getHandle(); } } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 5f4e1a2cad..39957386df 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -622,7 +622,7 @@ private: S32 mMinimizePositionVOffset; typedef std::vector, boost::signals2::connection> > hidden_floaters_t; hidden_floaters_t mHiddenFloaters; - LLFloater * mFrontChild; + LLHandle mFrontChildHandle; }; // -- cgit v1.2.3