From 4e4dd52753523afcedc4af357a280defd1cb9070 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Fri, 16 Apr 2010 13:18:11 +0300 Subject: Fixed low bug EXT-6823 (Implement a possibility to select several residents by "Shift" button) - improved the selection of list items by mouse. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/238/ --HG-- branch : product-engine --- indra/llui/llflatlistview.cpp | 63 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 35f5a6bbb9..82f054c4b7 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -504,7 +504,68 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask) //*TODO find a better place for that enforcing stuff if (mKeepOneItemSelected && numSelected() == 1 && !select_item) return; - + + if ( (mask & MASK_SHIFT) && !(mask & MASK_CONTROL) + && mMultipleSelection && !mSelectedItemPairs.empty() ) + { + item_pair_t* last_selected_pair = mSelectedItemPairs.back(); + + // If item_pair is already selected - do nothing + if (last_selected_pair == item_pair) + return; + + bool grab_items = false; + pairs_list_t pairs_to_select; + + // Pick out items from list between last selected and current clicked item_pair. + for (pairs_iterator_t + iter = mItemPairs.begin(), + iter_end = mItemPairs.end(); + iter != iter_end; ++iter) + { + item_pair_t* cur = *iter; + if (cur == last_selected_pair || cur == item_pair) + { + grab_items = !grab_items; + // Skip last selected and current clicked item pairs. + continue; + } + if (!cur->first->getVisible()) + { + // Skip invisible item pairs. + continue; + } + if (grab_items) + { + pairs_to_select.push_back(cur); + } + } + + if (select_item) + { + pairs_to_select.push_back(item_pair); + } + + for (pairs_iterator_t + iter = pairs_to_select.begin(), + iter_end = pairs_to_select.end(); + iter != iter_end; ++iter) + { + item_pair_t* pair_to_select = *iter; + selectItemPair(pair_to_select, true); + } + + if (!select_item) + { + // Item was already selected but there is a need to update last selected item and its border. + // Do it here to prevent extra mCommitOnSelectionChange in selectItemPair(). + mSelectedItemPairs.remove(item_pair); + mSelectedItemPairs.push_back(item_pair); + mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1)); + } + return; + } + if (!(mask & MASK_CONTROL) || !mMultipleSelection) resetSelection(); selectItemPair(item_pair, select_item); } -- cgit v1.2.3 From 5f49061661a401980aa89195995bfb165b33ff12 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Fri, 16 Apr 2010 13:31:06 +0300 Subject: Fixed normal bug EXT-6806 (Context menu conflict: selected text vs group) - prefer text menu if it has selection. Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/245/. --HG-- branch : product-engine --- indra/llui/lltexteditor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index a1cae4bb98..4fd62045e8 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -713,7 +713,8 @@ BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) { setFocus(TRUE); } - if (!LLTextBase::handleRightMouseDown(x, y, mask)) + // Prefer editor menu if it has selection. See EXT-6806. + if (hasSelection() || !LLTextBase::handleRightMouseDown(x, y, mask)) { if(getShowContextMenu()) { -- cgit v1.2.3 From 9d85f4ebe99ea511b032622de7499e81fd93fbd6 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Fri, 16 Apr 2010 17:24:50 +0300 Subject: Fixed normal EXT-6812 ([TRUNCATION] APARIENCIA window > Forma > Boca > Labios: prominec. \"Labios: prominenc\" should be \"Labios: prominencia\".) - There was two reasons: 1. Uninitialized variable in llsliderctrl.(h/cpp) that contains label size. This variable take part in calculation of TextBox size of label. 2. Font of 'label string' and text box was different. This causes wrong calculation of 'label string' length. Reviwed by Vadim Savchuk and Mike Antipov at https://codereview.productengine.com/secondlife/r/246/ --HG-- branch : product-engine --- indra/llui/llsliderctrl.cpp | 8 +++++--- indra/llui/llsliderctrl.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 80ee5d0984..04958075db 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -63,7 +63,8 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) mCanEditText(p.can_edit_text), mPrecision(p.decimal_digits), mTextEnabledColor(p.text_color()), - mTextDisabledColor(p.text_disabled_color()) + mTextDisabledColor(p.text_disabled_color()), + mLabelWidth(p.label_width) { S32 top = getRect().getHeight(); S32 bottom = 0; @@ -86,6 +87,7 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) params.initial_value(p.label()); mLabelBox = LLUICtrlFactory::create (params); addChild(mLabelBox); + mLabelFont = params.font(); } if (p.show_text && !p.text_width.isProvided()) @@ -186,9 +188,9 @@ BOOL LLSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& if (mLabelBox) { res = mLabelBox->setTextArg(key, text); - if (res && mLabelWidth == 0) + if (res && mLabelFont && mLabelWidth == 0) { - S32 label_width = mFont->getWidth(mLabelBox->getText()); + S32 label_width = mLabelFont->getWidth(mLabelBox->getText()); LLRect rect = mLabelBox->getRect(); S32 prev_right = rect.mRight; rect.mRight = rect.mLeft + label_width; diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index c425849782..482c81a0f4 100644 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h @@ -141,6 +141,7 @@ private: void reportInvalidData(); const LLFontGL* mFont; + const LLFontGL* mLabelFont; BOOL mShowText; BOOL mCanEditText; @@ -158,3 +159,4 @@ private: }; #endif // LL_LLSLIDERCTRL_H + -- cgit v1.2.3