diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llcombobox.cpp | 14 | ||||
-rw-r--r-- | indra/llui/llcombobox.h | 1 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 56 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 6 |
5 files changed, 69 insertions, 10 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 79dce1c714..ee1700e009 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -875,6 +875,20 @@ bool LLComboBox::handleUnicodeCharHere(llwchar uni_char) return result; } +// virtual +bool LLComboBox::handleScrollWheel(S32 x, S32 y, S32 clicks) +{ + if (mList->getVisible()) return mList->handleScrollWheel(x, y, clicks); + if (mAllowTextEntry) // We might be editable + if (!mList->getFirstSelected()) // We aren't in the list, don't kill their text + return false; + + setCurrentByIndex(llclamp(getCurrentIndex() + clicks, 0, getItemCount() - 1)); + prearrangeList(); + onCommit(); + return true; +} + void LLComboBox::setTextEntry(const LLStringExplicit& text) { if (mTextEntry) diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index cc1c2885fc..9dc6fa9257 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -114,6 +114,7 @@ public: virtual bool handleToolTip(S32 x, S32 y, MASK mask); virtual bool handleKeyHere(KEY key, MASK mask); virtual bool handleUnicodeCharHere(llwchar uni_char); + virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks); // LLUICtrl interface virtual void clear(); // select nothing diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index d0eb9a1873..12d5c41de1 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1205,24 +1205,64 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user) { S32 delta_x = 0; S32 delta_y = 0; + + // take translation of dependee floater into account + delta_x += new_rect.mLeft - old_rect.mLeft; + delta_y += new_rect.mBottom - old_rect.mBottom; + // check to see if it snapped to right or top, and move if dependee floater is resizing LLRect dependent_rect = floaterp->getRect(); - if (dependent_rect.mLeft - getRect().mLeft >= old_rect.getWidth() || // dependent on my right? - dependent_rect.mRight == getRect().mLeft + old_rect.getWidth()) // dependent aligned with my right + if ((dependent_rect.mLeft - getRect().mLeft >= old_rect.getWidth() || // dependent on my right? + dependent_rect.mRight == getRect().mLeft + old_rect.getWidth()) // dependent aligned with my right + && dependent_rect.mBottom <= old_rect.mTop + 1) { // was snapped directly onto right side or aligned with it delta_x += new_rect.getWidth() - old_rect.getWidth(); + + // make sure dependent still touches floater and din't go too high, + // it can go over edge, but should't detach completely + if (delta_y > 0 + && dependent_rect.mBottom + delta_y > new_rect.mTop) + { + delta_y = llmax(new_rect.mTop - dependent_rect.mBottom, 0); + } + } + else if (dependent_rect.mRight == old_rect.mLeft) + { + // make sure dependent still touches floater and don't go too high + if (delta_y > 0 + && dependent_rect.mBottom <= old_rect.mTop + && dependent_rect.mBottom + delta_y > new_rect.mTop) + { + delta_y = llmax(new_rect.mTop - dependent_rect.mBottom, 0); + } } - if (dependent_rect.mBottom - getRect().mBottom >= old_rect.getHeight() || - dependent_rect.mTop == getRect().mBottom + old_rect.getHeight()) + + if ((dependent_rect.mBottom - getRect().mBottom >= old_rect.getHeight() || + dependent_rect.mTop == getRect().mBottom + old_rect.getHeight()) + && dependent_rect.mLeft <= old_rect.mRight + 1) { // was snapped directly onto top side or aligned with it delta_y += new_rect.getHeight() - old_rect.getHeight(); - } - // take translation of dependee floater into account as well - delta_x += new_rect.mLeft - old_rect.mLeft; - delta_y += new_rect.mBottom - old_rect.mBottom; + // make sure dependent still touches floater + // and din't go too far to the right + if (delta_x > 0 + && dependent_rect.mLeft + delta_x > new_rect.mRight) + { + delta_x = llmax(new_rect.mRight - dependent_rect.mLeft, 0); + } + } + else if (dependent_rect.mTop == old_rect.mBottom) + { + // make sure dependent still touches floater and don't go too far to the right + if (delta_x > 0 + && dependent_rect.mLeft <= old_rect.mRight + && dependent_rect.mLeft + delta_x > new_rect.mRight) + { + delta_x = llmax(new_rect.mRight - dependent_rect.mLeft, 0); + } + } dependent_rect.translate(delta_x, delta_y); floaterp->setShape(dependent_rect, by_user); diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 7ee31ebd00..3a3aa7e4df 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -209,7 +209,7 @@ LLLayoutStack::Params::Params() open_time_constant("open_time_constant", 0.02f), close_time_constant("close_time_constant", 0.03f), resize_bar_overlap("resize_bar_overlap", 1), - border_size("border_size", LLCachedControl<S32>(*LLUI::getInstance()->mSettingGroups["config"], "UIResizeBarHeight", 0)), + border_size("border_size", LLUI::getInstance()->mSettingGroups["config"]->getS32("UIResizeBarHeight")), show_drag_handle("show_drag_handle", false), drag_handle_first_indent("drag_handle_first_indent", 0), drag_handle_second_indent("drag_handle_second_indent", 0), diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 74a9641836..1d9564d107 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1479,7 +1479,11 @@ const std::string LLScrollListCtrl::getSelectedItemLabel(S32 column) const item = getFirstSelected(); if (item) { - return item->getColumn(column)->getValue().asString(); + auto col = item->getColumn(column); + if(col) + { + return col->getValue().asString(); + } } return LLStringUtil::null; |