From b51515100c75b737c144834d8efd594c3fe9ae69 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 9 Mar 2010 12:16:44 -0800 Subject: rolled back changeset 5fbab7aa32ef to fix EXT-6269 --- indra/llui/llbutton.h | 1 - indra/llui/llcombobox.cpp | 41 +++++++++-------------------------------- indra/llui/llcombobox.h | 34 +--------------------------------- indra/llui/llscrolllistctrl.cpp | 4 +--- 4 files changed, 11 insertions(+), 69 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 59b551a16d..6a0d8ef3d6 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -216,7 +216,6 @@ public: void setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white); void setImageOverlay(const LLUUID& image_id, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white); LLPointer getImageOverlay() { return mImageOverlay; } - LLFontGL::HAlign getImageOverlayHAlign() const { return mImageOverlayAlignment; } void autoResize(); // resize with label of current btn state void resize(LLUIString label); // resize with label input diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index ce25ee32b3..4a6e3c9a13 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -702,13 +702,20 @@ void LLComboBox::onListMouseUp() void LLComboBox::onItemSelected(const LLSD& data) { - setValue(data); + const std::string name = mList->getSelectedItemLabel(); - if (mAllowTextEntry && mLastSelectedIndex != -1) + S32 cur_id = getCurrentIndex(); + mLastSelectedIndex = cur_id; + if (cur_id != -1) + { + setLabel(name); + + if (mAllowTextEntry) { gFocusMgr.setKeyboardFocus(mTextEntry); mTextEntry->selectAll(); } + } // hiding the list reasserts the old value stored in the text editor/dropdown button hideList(); @@ -1061,33 +1068,3 @@ BOOL LLComboBox::selectItemRange( S32 first, S32 last ) { return mList->selectItemRange(first, last); } - - -static LLDefaultChildRegistry::Register register_icons_combo_box("icons_combo_box"); - -LLIconsComboBox::Params::Params() -: icon_column("icon_column", ICON_COLUMN), - label_column("label_column", LABEL_COLUMN) -{} - -LLIconsComboBox::LLIconsComboBox(const LLIconsComboBox::Params& p) -: LLComboBox(p), - mIconColumnIndex(p.icon_column), - mLabelColumnIndex(p.label_column) -{} - -void LLIconsComboBox::setValue(const LLSD& value) -{ - BOOL found = mList->selectByValue(value); - if (found) - { - LLScrollListItem* item = mList->getFirstSelected(); - if (item) - { - mButton->setImageOverlay(mList->getSelectedItemLabel(mIconColumnIndex), mButton->getImageOverlayHAlign()); - - setLabel(mList->getSelectedItemLabel(mLabelColumnIndex)); - } - mLastSelectedIndex = mList->getFirstSelectedIndex(); - } -} diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index c694724248..4f27588467 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -221,7 +221,6 @@ protected: LLPointer mArrowImage; LLUIString mLabel; BOOL mHasAutocompletedText; - S32 mLastSelectedIndex; private: BOOL mAllowTextEntry; @@ -231,37 +230,6 @@ private: commit_callback_t mPrearrangeCallback; commit_callback_t mTextEntryCallback; commit_callback_t mSelectionCallback; - boost::signals2::connection mTopLostSignalConnection; -}; - -// A combo box with icons for the list of items. -class LLIconsComboBox -: public LLComboBox -{ -public: - struct Params - : public LLInitParam::Block - { - Optional icon_column, - label_column; - Params(); - }; - - /*virtual*/ void setValue(const LLSD& value); - -private: - enum EColumnIndex - { - ICON_COLUMN = 0, - LABEL_COLUMN - }; - - friend class LLUICtrlFactory; - LLIconsComboBox(const Params&); - virtual ~LLIconsComboBox() {}; - - S32 mIconColumnIndex; - S32 mLabelColumnIndex; + S32 mLastSelectedIndex; }; - #endif diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 18ec5b51dd..77caaaa425 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -630,9 +630,7 @@ void LLScrollListCtrl::calcColumnWidths() LLScrollListCell* cellp = (*iter)->getColumn(column->mIndex); if (!cellp) continue; - // get text value width only for text cells - column->mMaxContentWidth = cellp->isText() ? - llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth) : column->mMaxContentWidth; + column->mMaxContentWidth = llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth); } max_item_width += column->mMaxContentWidth; -- cgit v1.2.3 From 76f6dba9e4a34a34c5100807f685790ad6f5129b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 9 Mar 2010 12:27:41 -0800 Subject: fixed bad merge --- indra/llui/llcombobox.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui') diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 4f27588467..82134c4ffe 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -230,6 +230,7 @@ private: commit_callback_t mPrearrangeCallback; commit_callback_t mTextEntryCallback; commit_callback_t mSelectionCallback; + boost::signals2::connection mTopLostSignalConnection; S32 mLastSelectedIndex; }; #endif -- cgit v1.2.3 From dcf279d663e701700cd1227825f3cff39554f82a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 5 Mar 2010 18:34:36 -0800 Subject: EXT-2418 added open/sit/buy mouse cursors --- indra/llui/llui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 5121ef5351..e6967921d3 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1919,7 +1919,7 @@ void LLUI::clearPopups() // spawn_x and spawn_y are top left corner of view in screen GL coordinates void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y) { - const S32 CURSOR_HEIGHT = 16; // Approximate "normal" cursor size + const S32 CURSOR_HEIGHT = 32; // Approximate "normal" cursor size const S32 CURSOR_WIDTH = 8; LLView* parent = view->getParent(); -- cgit v1.2.3 From 2240ece438880d6d3b72e9fbd3e7dc06295eea79 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 9 Mar 2010 16:21:52 -0800 Subject: EXT-2418 - improved cursors for sit/open/buy --- indra/llui/llui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index e6967921d3..5121ef5351 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1919,7 +1919,7 @@ void LLUI::clearPopups() // spawn_x and spawn_y are top left corner of view in screen GL coordinates void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y) { - const S32 CURSOR_HEIGHT = 32; // Approximate "normal" cursor size + const S32 CURSOR_HEIGHT = 16; // Approximate "normal" cursor size const S32 CURSOR_WIDTH = 8; LLView* parent = view->getParent(); -- cgit v1.2.3 From 347585cf975afac59ec6b9960e093acd015627f5 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Wed, 10 Mar 2010 14:32:40 -0800 Subject: Fix for EXT-6276. Added a check in LLTextBase::drawSelectionBackground() to keep it from sending degenerate rectangles to gl_rect_2d(). This seems to be what was causing the GL state to go bad. Reviewed by Richard at http://codereview.lindenlab.com/534001 --- indra/llui/lltextbase.cpp | 9 +++++++-- indra/llui/llui.cpp | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 851fb966ec..48aa406901 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -396,8 +396,13 @@ void LLTextBase::drawSelectionBackground() ++rect_it) { LLRect selection_rect = *rect_it; - selection_rect.translate(mVisibleTextRect.mLeft - content_display_rect.mLeft, mVisibleTextRect.mBottom - content_display_rect.mBottom); - gl_rect_2d(selection_rect, selection_color); + // Don't send empty rects to gl_rect_2d. + // Drawing degenerate rectangles seems to cause https://jira.secondlife.com/browse/EXT-6276 . + if(selection_rect.notEmpty()) + { + selection_rect.translate(mVisibleTextRect.mLeft - content_display_rect.mLeft, mVisibleTextRect.mBottom - content_display_rect.mBottom); + gl_rect_2d(selection_rect, selection_color); + } } } } diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 5121ef5351..9134adc6d1 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -202,6 +202,11 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixe void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) { + // FIXME: Drawing degenerate rectangles (specifically, zero-width rectangles) was causing + // https://jira.secondlife.com/browse/EXT-6276 on the Mac (presumably it was doing something bad to the GL state). + // That was fixed by checking for this case in LLTextBase::drawSelectionBackground(). + // It's possible we should check for degenerate rectangles here and not draw, but I wanted to do the minimal change for the moment. + stop_glerror(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); -- cgit v1.2.3 From 1e5fe95b1d2d4912a3c9d84e2c32ff141f0dc4d9 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 10 Mar 2010 18:20:18 -0800 Subject: EXT-6295 - Cannot log in with new account, TOS dialog does not load reviewed by Mani --- indra/llui/llfloater.cpp | 1 - indra/llui/llmenugl.cpp | 5 ++--- indra/llui/lltextbase.cpp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 4cb336f7ea..ab14c08948 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1354,7 +1354,6 @@ void LLFloater::bringToFront( S32 x, S32 y ) // virtual void LLFloater::setVisibleAndFrontmost(BOOL take_focus) { - LLUI::clearPopups(); setVisible(TRUE); setFrontmost(take_focus); } diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 0d56c5ed31..fb4a9d032d 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3455,7 +3455,7 @@ LLView* const LLMenuHolderGL::getVisibleMenu() const for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { LLView* viewp = *child_it; - if (viewp->getVisible() && dynamic_cast(viewp) == NULL) + if (viewp->getVisible() && dynamic_cast(viewp) != NULL) { return viewp; } @@ -3478,8 +3478,7 @@ BOOL LLMenuHolderGL::hideMenus() for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { LLView* viewp = *child_it; - // clicks off of menu do not hide menu bar - if (dynamic_cast(viewp) == NULL && viewp->getVisible()) + if (dynamic_cast(viewp) != NULL && viewp->getVisible()) { viewp->setVisible(FALSE); } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 851fb966ec..633135382e 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -246,7 +246,7 @@ LLTextBase::~LLTextBase() { // Menu, like any other LLUICtrl, is deleted by its parent - gMenuHolder - clearSegments(); + mSegments.clear(); } void LLTextBase::initFromParams(const LLTextBase::Params& p) -- cgit v1.2.3 From 58afe469f9d29aea0d3d974ac112725ddbaa3a19 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 12 Mar 2010 13:01:50 -0600 Subject: Bizarrely hacky fix for EXT-6276 (#if LL_DARWIN out copyFromPrimarySubstring) General gl state cleanup in llui. Make llrender more gGL.begin/end friendly. --- indra/llui/llaccordionctrltab.cpp | 3 --- indra/llui/llclipboard.cpp | 2 ++ indra/llui/llui.cpp | 8 ++++---- indra/llui/llview.cpp | 3 --- 4 files changed, 6 insertions(+), 10 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 1067c3f1d5..e12776f83a 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -826,9 +826,6 @@ void LLAccordionCtrlTab::draw() LLLocalClipRect clip(child_rect); drawChild(root_rect,mContainerPanel); } - - - gGL.getTexUnit(0)->disable(); } } diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index cbd4cb380f..400b899ef2 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -103,9 +103,11 @@ BOOL LLClipboard::canPasteString() const void LLClipboard::copyFromPrimarySubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id ) { +#if !LL_DARWIN mSourceID = source_id; mString = src.substr(pos, len); LLView::getWindow()->copyTextToPrimary( mString ); +#endif } diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 9134adc6d1..28ca83ad48 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -212,7 +212,7 @@ void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) // Counterclockwise quad will face the viewer if( filled ) - { + { gGL.begin( LLRender::QUADS ); gGL.vertex2i(left, top); gGL.vertex2i(left, bottom); @@ -513,8 +513,8 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex if (solid_color) { - gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); - gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA); + //gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); + //gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA); } gGL.pushUIMatrix(); @@ -650,7 +650,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex if (solid_color) { - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); + //gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index d34083a384..d0dbc99bc7 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1325,7 +1325,6 @@ void LLView::drawChildren() localRectToScreen(viewp->getRect(),&screenRect); if ( rootRect.overlaps(screenRect) && LLUI::sDirtyRect.overlaps(screenRect)) { - glMatrixMode(GL_MODELVIEW); LLUI::pushMatrix(); { LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f); @@ -1349,8 +1348,6 @@ void LLView::drawChildren() } --sDepth; } - - gGL.getTexUnit(0)->disable(); } void LLView::dirtyRect() -- cgit v1.2.3 From d2996b685972e2b066e6821d0bc258073d8ceb1d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 12 Mar 2010 13:17:30 -0600 Subject: EXT-6276 Fix for UI going all wonky. --- indra/llui/llclipboard.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 400b899ef2..cbd4cb380f 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -103,11 +103,9 @@ BOOL LLClipboard::canPasteString() const void LLClipboard::copyFromPrimarySubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id ) { -#if !LL_DARWIN mSourceID = source_id; mString = src.substr(pos, len); LLView::getWindow()->copyTextToPrimary( mString ); -#endif } -- cgit v1.2.3 From 4c8ae214b3f9745102ee90c25d9f67183aea0903 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 12 Mar 2010 14:11:08 -0600 Subject: Didn't mean to check in with these lines commented out. --- indra/llui/llui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 28ca83ad48..2cd3bac7dd 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -513,8 +513,8 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex if (solid_color) { - //gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); - //gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA); + gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); + gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA); } gGL.pushUIMatrix(); @@ -650,7 +650,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex if (solid_color) { - //gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } } -- cgit v1.2.3 From 7ac2427b57c2d8e325b5e9c7fa87076bcaf2f6ef Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Fri, 12 Mar 2010 12:14:35 -0800 Subject: Backed out changeset 6fdd352b80d6 We thought this was a fix for EXT-6276, but it turned out it was just moving the problem. --- indra/llui/lltextbase.cpp | 9 ++------- indra/llui/llui.cpp | 5 ----- 2 files changed, 2 insertions(+), 12 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 48aa406901..851fb966ec 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -396,13 +396,8 @@ void LLTextBase::drawSelectionBackground() ++rect_it) { LLRect selection_rect = *rect_it; - // Don't send empty rects to gl_rect_2d. - // Drawing degenerate rectangles seems to cause https://jira.secondlife.com/browse/EXT-6276 . - if(selection_rect.notEmpty()) - { - selection_rect.translate(mVisibleTextRect.mLeft - content_display_rect.mLeft, mVisibleTextRect.mBottom - content_display_rect.mBottom); - gl_rect_2d(selection_rect, selection_color); - } + selection_rect.translate(mVisibleTextRect.mLeft - content_display_rect.mLeft, mVisibleTextRect.mBottom - content_display_rect.mBottom); + gl_rect_2d(selection_rect, selection_color); } } } diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 9134adc6d1..5121ef5351 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -202,11 +202,6 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixe void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) { - // FIXME: Drawing degenerate rectangles (specifically, zero-width rectangles) was causing - // https://jira.secondlife.com/browse/EXT-6276 on the Mac (presumably it was doing something bad to the GL state). - // That was fixed by checking for this case in LLTextBase::drawSelectionBackground(). - // It's possible we should check for degenerate rectangles here and not draw, but I wanted to do the minimal change for the moment. - stop_glerror(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); -- cgit v1.2.3 From fee3752311907c774b595246f1dbb93ef5b8cd53 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Mon, 15 Mar 2010 18:06:04 +0200 Subject: Implemented normal task EXT-5905 - Resolving offers. Added functionality to make Toasts accept multiple user inputs(clicks on option buttons). --HG-- branch : product-engine --- indra/llui/llnotifications.cpp | 25 ++++++++++++++++++++++--- indra/llui/llnotifications.h | 10 ++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 5816cef6af..7b8970a153 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -402,7 +402,8 @@ LLNotification::LLNotification(const LLNotification::Params& p) : mRespondedTo(false), mPriority(p.priority), mCancelled(false), - mIgnored(false) + mIgnored(false), + mResponderObj(NULL) { if (p.functor.name.isChosen()) { @@ -416,6 +417,11 @@ LLNotification::LLNotification(const LLNotification::Params& p) : mTemporaryResponder = true; } + if(p.responder.isProvided()) + { + mResponderObj = p.responder; + } + mId.generate(); init(p.name, p.form_elements); } @@ -425,7 +431,8 @@ LLNotification::LLNotification(const LLSD& sd) : mTemporaryResponder(false), mRespondedTo(false), mCancelled(false), - mIgnored(false) + mIgnored(false), + mResponderObj(NULL) { mId.generate(); mSubstitutions = sd["substitutions"]; @@ -563,7 +570,9 @@ void LLNotification::respond(const LLSD& response) // and then call it functor(asLLSD(), response); - if (mTemporaryResponder) + bool is_resusable = getPayload()["reusable"].asBoolean(); + + if (mTemporaryResponder && !is_resusable) { LLNotificationFunctorRegistry::instance().unregisterFunctor(mResponseFunctorName); mResponseFunctorName = ""; @@ -597,6 +606,16 @@ void LLNotification::setResponseFunctor(std::string const &responseFunctorName) mTemporaryResponder = false; } +void LLNotification::setResponseFunctor(const LLNotificationFunctorRegistry::ResponseFunctor& cb) +{ + if(mTemporaryResponder) + { + LLNotificationFunctorRegistry::instance().unregisterFunctor(mResponseFunctorName); + } + + LLNotificationFunctorRegistry::instance().registerFunctor(mResponseFunctorName, cb); +} + bool LLNotification::payloadContainsAll(const std::vector& required_fields) const { for(std::vector::const_iterator required_fields_it = required_fields.begin(); diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 8d993b71d7..262633206b 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -296,6 +296,7 @@ public: Optional form_elements; Optional time_stamp; Optional context; + Optional responder; struct Functor : public LLInitParam::Choice { @@ -317,6 +318,7 @@ public: form_elements("form_elements") { time_stamp = LLDate::now(); + responder = NULL; } Params(const std::string& _name) @@ -329,6 +331,7 @@ public: functor.name = _name; name = _name; time_stamp = LLDate::now(); + responder = NULL; } }; @@ -344,6 +347,7 @@ private: bool mIgnored; ENotificationPriority mPriority; LLNotificationFormPtr mForm; + void* mResponderObj; // a reference to the template LLNotificationTemplatePtr mTemplatep; @@ -384,6 +388,8 @@ public: void setResponseFunctor(std::string const &responseFunctorName); + void setResponseFunctor(const LLNotificationFunctorRegistry::ResponseFunctor& cb); + typedef enum e_response_template_type { WITHOUT_DEFAULT_BUTTON, @@ -423,6 +429,10 @@ public: void respond(const LLSD& sd); + void* getResponder() { return mResponderObj; } + + void setResponder(void* responder) { mResponderObj = responder; } + void setIgnored(bool ignore); bool isCancelled() const -- cgit v1.2.3 From 97dea26dfca2ebd3d571f80c6e418d7c64779277 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 16 Mar 2010 15:30:01 +0200 Subject: Updated normal task EXT-5905 - Resolving offers. Implemented requested feature - "Resolving offer in the notification toast shouldn't remove offer panel form IM log until IM session is restarted" --HG-- branch : product-engine --- indra/llui/llnotifications.cpp | 9 ++++++++- indra/llui/llnotifications.h | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 7b8970a153..56ec8c4262 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -486,6 +486,7 @@ void LLNotification::updateFrom(LLNotificationPtr other) mForm = other->mForm; mResponseFunctorName = other->mResponseFunctorName; mRespondedTo = other->mRespondedTo; + mResponse = other->mResponse; mTemporaryResponder = other->mTemporaryResponder; update(); @@ -563,7 +564,9 @@ std::string LLNotification::getSelectedOptionName(const LLSD& response) void LLNotification::respond(const LLSD& response) { + // *TODO may remove mRespondedTo and use mResponce.isDefined() in isRespondedTo() mRespondedTo = true; + mResponse = response; // look up the functor LLNotificationFunctorRegistry::ResponseFunctor functor = LLNotificationFunctorRegistry::instance().getFunctor(mResponseFunctorName); @@ -875,7 +878,11 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPt if (wasFound) { abortProcessing = mChanged(payload); - mItems.erase(pNotification); + // do not delete the notification to make LLChatHistory::appendMessage add notification panel to IM window + if( ! pNotification->getPayload()["reusable"].asBoolean() ) + { + mItems.erase(pNotification); + } onDelete(pNotification); } } diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 262633206b..a516a6723e 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -344,6 +344,7 @@ private: LLDate mExpiresAt; bool mCancelled; bool mRespondedTo; // once the notification has been responded to, this becomes true + LLSD mResponse; bool mIgnored; ENotificationPriority mPriority; LLNotificationFormPtr mForm; @@ -445,6 +446,8 @@ public: return mRespondedTo; } + const LLSD& getResponse() { return mResponse; } + bool isIgnored() const { return mIgnored; -- cgit v1.2.3 From b37a1a54fa6a78ac171871344cf4e8c47ad689b5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 16 Mar 2010 17:48:29 -0700 Subject: turning view deletion spam into a lldebugs --- indra/llui/llview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index d34083a384..57beb71a01 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -152,7 +152,7 @@ LLView::~LLView() //llinfos << "Deleting view " << mName << ":" << (void*) this << llendl; if (LLView::sIsDrawing) { - llwarns << "Deleting view " << mName << " during UI draw() phase" << llendl; + lldebugs << "Deleting view " << mName << " during UI draw() phase" << llendl; } // llassert(LLView::sIsDrawing == FALSE); -- cgit v1.2.3 From 509457b8ef7bfb8e5b6dcb1a25996ae8fe329007 Mon Sep 17 00:00:00 2001 From: Lynx Linden Date: Wed, 17 Mar 2010 15:13:08 +0000 Subject: EXT-6335: Add custom labels for specific agent SLapp commands. We now display custom labels and tooltips for the various secondlife:///app/agent SLapp suffixes that we support. These include: /mute, /unmute, /pay, /im, /offerteleport, and /requestfriend. For example, entering: secondlife:///app/agent/3e2d81e8-6269-8100-860e-c64e5cee3c2c/mute Now displays the SLapp in text chat as "Mute ", rather than simply "". --- indra/llui/llurlentry.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++- indra/llui/llurlentry.h | 1 + 2 files changed, 58 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 35428e4227..e8e3459673 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -310,7 +310,6 @@ LLUrlEntryAgent::LLUrlEntryAgent() boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_agent.xml"; mIcon = "Generic_Person"; - mTooltip = LLTrans::getString("TooltipAgentUrl"); mColor = LLUIColorTable::instance().getColor("AgentLinkColor"); } @@ -323,6 +322,38 @@ void LLUrlEntryAgent::onAgentNameReceived(const LLUUID& id, callObservers(id.asString(), first + " " + last); } +std::string LLUrlEntryAgent::getTooltip(const std::string &string) const +{ + // return a tooltip corresponding to the URL type instead of the generic one + std::string url = getUrl(string); + + if (LLStringUtil::endsWith(url, "/mute")) + { + return LLTrans::getString("TooltipAgentMute"); + } + if (LLStringUtil::endsWith(url, "/unmute")) + { + return LLTrans::getString("TooltipAgentUnmute"); + } + if (LLStringUtil::endsWith(url, "/im")) + { + return LLTrans::getString("TooltipAgentIM"); + } + if (LLStringUtil::endsWith(url, "/pay")) + { + return LLTrans::getString("TooltipAgentPay"); + } + if (LLStringUtil::endsWith(url, "/offerteleport")) + { + return LLTrans::getString("TooltipAgentOfferTeleport"); + } + if (LLStringUtil::endsWith(url, "/requestfriend")) + { + return LLTrans::getString("TooltipAgentRequestFriend"); + } + return LLTrans::getString("TooltipAgentUrl"); +} + std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { if (!gCacheName) @@ -346,6 +377,31 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa } else if (gCacheName->getFullName(agent_id, full_name)) { + // customize label string based on agent SLapp suffix + if (LLStringUtil::endsWith(url, "/mute")) + { + return LLTrans::getString("SLappAgentMute") + " " + full_name; + } + if (LLStringUtil::endsWith(url, "/unmute")) + { + return LLTrans::getString("SLappAgentUnmute") + " " + full_name; + } + if (LLStringUtil::endsWith(url, "/im")) + { + return LLTrans::getString("SLappAgentIM") + " " + full_name; + } + if (LLStringUtil::endsWith(url, "/pay")) + { + return LLTrans::getString("SLappAgentPay") + " " + full_name; + } + if (LLStringUtil::endsWith(url, "/offerteleport")) + { + return LLTrans::getString("SLappAgentOfferTeleport") + " " + full_name; + } + if (LLStringUtil::endsWith(url, "/requestfriend")) + { + return LLTrans::getString("SLappAgentRequestFriend") + " " + full_name; + } return full_name; } else diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index c947ef7259..84d0968779 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -169,6 +169,7 @@ class LLUrlEntryAgent : public LLUrlEntryBase public: LLUrlEntryAgent(); /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); + /*virtual*/ std::string getTooltip(const std::string &string) const; private: void onAgentNameReceived(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); -- cgit v1.2.3 From 729f880f78e26459d37ff0d120d9537791ccaf8d Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Thu, 18 Mar 2010 00:53:32 +0200 Subject: [SHOWSTOPPER] Fix for (EXT-4704) Add maturity icons to Prefs -> General and (EXT-4705) Show maturity icon on Region/Estate tab. - Made changes to combobox onItemSelected() to fix (EXT-6269) typing a location into the nav bar always sends you to the first location you typed in. - Replaced LLIconsComboBox pointers with base class pointers LLComboBox. Reviewed by Richard Nelson https://codereview.productengine.com/secondlife/r/29/ --HG-- branch : product-engine --- indra/llui/llcombobox.cpp | 33 +++++++++------------------------ indra/llui/llcombobox.h | 3 +-- 2 files changed, 10 insertions(+), 26 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index c1d512e148..3a8efadaa4 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -706,14 +706,17 @@ void LLComboBox::onListMouseUp() void LLComboBox::onItemSelected(const LLSD& data) { - setValue(data); - - if (mAllowTextEntry && mLastSelectedIndex != -1) + mLastSelectedIndex = getCurrentIndex(); + if (mLastSelectedIndex != -1) { - gFocusMgr.setKeyboardFocus(mTextEntry); - mTextEntry->selectAll(); - } + setLabel(getSelectedItemLabel()); + if (mAllowTextEntry) + { + gFocusMgr.setKeyboardFocus(mTextEntry); + mTextEntry->selectAll(); + } + } // hiding the list reasserts the old value stored in the text editor/dropdown button hideList(); @@ -1080,24 +1083,6 @@ LLIconsComboBox::LLIconsComboBox(const LLIconsComboBox::Params& p) mLabelColumnIndex(p.label_column) {} -void LLIconsComboBox::setValue(const LLSD& value) -{ - BOOL found = mList->selectByValue(value); - if (found) - { - LLScrollListItem* item = mList->getFirstSelected(); - if (item) - { - setLabel(getSelectedItemLabel()); - } - mLastSelectedIndex = mList->getFirstSelectedIndex(); - } - else - { - mLastSelectedIndex = -1; - } -} - const std::string LLIconsComboBox::getSelectedItemLabel(S32 column) const { mButton->setImageOverlay(LLComboBox::getSelectedItemLabel(mIconColumnIndex), mButton->getImageOverlayHAlign()); diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 965061ead2..f0bd432f3a 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -221,7 +221,6 @@ protected: LLPointer mArrowImage; LLUIString mLabel; BOOL mHasAutocompletedText; - S32 mLastSelectedIndex; private: BOOL mAllowTextEntry; @@ -232,6 +231,7 @@ private: commit_callback_t mTextEntryCallback; commit_callback_t mSelectionCallback; boost::signals2::connection mTopLostSignalConnection; + S32 mLastSelectedIndex; }; // A combo box with icons for the list of items. @@ -247,7 +247,6 @@ public: Params(); }; - /*virtual*/ void setValue(const LLSD& value); /*virtual*/ const std::string getSelectedItemLabel(S32 column = 0) const; private: -- cgit v1.2.3 From 121114f934a485f4e225b377cc4337b9b349ff5e Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 17 Mar 2010 17:46:15 -0700 Subject: EXT-6402 - Add support for enable/disable of Plugins (Flash) within WebKit to Viewer Prefs had to fix how radio groups bind to saved settings to support changing radio item order tested all existing radio groups bound to a saved setting reviewed by Callum --- indra/llui/llradiogroup.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index 4087b484aa..e27792dc1d 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -106,7 +106,6 @@ LLRadioGroup::LLRadioGroup(const LLRadioGroup::Params& p) void LLRadioGroup::initFromParams(const Params& p) { - LLUICtrl::initFromParams(p); for (LLInitParam::ParamIterator::const_iterator it = p.items().begin(); it != p.items().end(); ++it) @@ -124,6 +123,9 @@ void LLRadioGroup::initFromParams(const Params& p) LLRadioCtrl* item = LLUICtrlFactory::create(item_params, this); mRadioButtons.push_back(item); } + + // call this *after* setting up mRadioButtons so we can handle setValue() calls + LLUICtrl::initFromParams(p); } @@ -138,10 +140,6 @@ BOOL LLRadioGroup::postBuild() { mRadioButtons[0]->setTabStop(true); } - if (mControlVariable) - { - setSelectedIndex(mControlVariable->getValue().asInteger()); - } return TRUE; } -- cgit v1.2.3 From 095cd1b639a969686ff5b9fadfce6b90f038590e Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Thu, 18 Mar 2010 17:45:35 +0200 Subject: fixed EXT-6092 [crashhunters] Crash in LLFlatListView::selectItemPair turned off commit on focus lost for the filter editor (Panel Places) in the code Reviewed by Mike at https://codereview.productengine.com/secondlife/r/63/ --HG-- branch : product-engine --- indra/llui/llsearcheditor.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h index 714aca9337..785d0633dc 100644 --- a/indra/llui/llsearcheditor.h +++ b/indra/llui/llsearcheditor.h @@ -66,6 +66,8 @@ public: } }; + void setCommitOnFocusLost(BOOL b) { if (mSearchEditor) mSearchEditor->setCommitOnFocusLost(b); } + protected: LLSearchEditor(const Params&); friend class LLUICtrlFactory; -- cgit v1.2.3 From 7b769065957c0f0d2cc998905136792ebe7c8efc Mon Sep 17 00:00:00 2001 From: Kent Quirk Date: Thu, 18 Mar 2010 19:47:09 -0400 Subject: Restore function lost in bad merge. --- indra/llui/llbutton.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 6a0d8ef3d6..6a1e3a9425 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -216,7 +216,8 @@ public: void setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white); void setImageOverlay(const LLUUID& image_id, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white); LLPointer getImageOverlay() { return mImageOverlay; } - + LLFontGL::HAlign getImageOverlayHAlign() const { return mImageOverlayAlignment; } + void autoResize(); // resize with label of current btn state void resize(LLUIString label); // resize with label input void setLabel( const LLStringExplicit& label); -- cgit v1.2.3 From a2150863f97bf4fc49ecc17a2405177abe9d8f73 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Fri, 19 Mar 2010 17:18:53 +0200 Subject: Updated normal task EXT-5905 - Resolving offers. Reusable notifications are deleted when user closes IM floater(old - when user closes Viewer). --HG-- branch : product-engine --- indra/llui/llnotifications.cpp | 16 +++++++++------- indra/llui/llnotifications.h | 5 +++++ 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 56ec8c4262..d7424cf05a 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -403,7 +403,8 @@ LLNotification::LLNotification(const LLNotification::Params& p) : mPriority(p.priority), mCancelled(false), mIgnored(false), - mResponderObj(NULL) + mResponderObj(NULL), + mIsReusable(false) { if (p.functor.name.isChosen()) { @@ -432,7 +433,8 @@ LLNotification::LLNotification(const LLSD& sd) : mRespondedTo(false), mCancelled(false), mIgnored(false), - mResponderObj(NULL) + mResponderObj(NULL), + mIsReusable(false) { mId.generate(); mSubstitutions = sd["substitutions"]; @@ -459,6 +461,7 @@ LLSD LLNotification::asLLSD() output["expiry"] = mExpiresAt; output["priority"] = (S32)mPriority; output["responseFunctor"] = mResponseFunctorName; + output["reusable"] = mIsReusable; return output; } @@ -488,6 +491,7 @@ void LLNotification::updateFrom(LLNotificationPtr other) mRespondedTo = other->mRespondedTo; mResponse = other->mResponse; mTemporaryResponder = other->mTemporaryResponder; + mIsReusable = other->isReusable(); update(); } @@ -573,9 +577,7 @@ void LLNotification::respond(const LLSD& response) // and then call it functor(asLLSD(), response); - bool is_resusable = getPayload()["reusable"].asBoolean(); - - if (mTemporaryResponder && !is_resusable) + if (mTemporaryResponder && !isReusable()) { LLNotificationFunctorRegistry::instance().unregisterFunctor(mResponseFunctorName); mResponseFunctorName = ""; @@ -879,11 +881,11 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPt { abortProcessing = mChanged(payload); // do not delete the notification to make LLChatHistory::appendMessage add notification panel to IM window - if( ! pNotification->getPayload()["reusable"].asBoolean() ) + if( ! pNotification->isReusable() ) { mItems.erase(pNotification); + onDelete(pNotification); } - onDelete(pNotification); } } return abortProcessing; diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index a516a6723e..400491a154 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -349,6 +349,7 @@ private: ENotificationPriority mPriority; LLNotificationFormPtr mForm; void* mResponderObj; + bool mIsReusable; // a reference to the template LLNotificationTemplatePtr mTemplatep; @@ -517,6 +518,10 @@ public: { return mId; } + + bool isReusable() { return mIsReusable; } + + void setReusable(bool reusable) { mIsReusable = reusable; } // comparing two notifications normally means comparing them by UUID (so we can look them // up quickly this way) -- cgit v1.2.3 From 0f620c10013ccac37986bf8583e4a18c41749a92 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Fri, 19 Mar 2010 20:53:38 +0200 Subject: Fixed bug EXT-5695 (Tabbed IM window loses focus if close any tab by Ctrl+W) Submitting on behalf of Paul Guslisty. Reviewed by Mike: https://codereview.productengine.com/secondlife/r/66/ --HG-- branch : product-engine --- indra/llui/llmultifloater.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index 33d47a3f0e..4af9108329 100644 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -352,6 +352,13 @@ BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask) if (floater && floater->canClose() && floater->isCloseable()) { floater->closeFloater(); + + // EXT-5695 (Tabbed IM window loses focus if close any tabs by Ctrl+W) + // bring back focus on tab container if there are any tab left + if(mTabContainer->getTabCount() > 0) + { + mTabContainer->setFocus(TRUE); + } } return TRUE; } -- cgit v1.2.3 From 91b90b0a1749471a9016c4935b58c08a3dd66523 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Tue, 23 Mar 2010 11:18:01 -0700 Subject: EXT-5549 Can't select last character in chat window --- indra/llui/lltextbase.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 633135382e..13201719f4 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -350,6 +350,8 @@ void LLTextBase::drawSelectionBackground() S32 segment_line_start = segmentp->getStart() + segment_offset; S32 segment_line_end = llmin(segmentp->getEnd(), line_iter->mDocIndexEnd); + if (segment_line_start > segment_line_end) break; + S32 segment_width = 0; S32 segment_height = 0; @@ -362,7 +364,7 @@ void LLTextBase::drawSelectionBackground() } // if selection spans end of current segment... - if (selection_right > segment_line_end) + if (selection_right >= segment_line_end) { // extend selection slightly beyond end of line // to indicate selection of newline character (use "n" character to determine width) @@ -1813,11 +1815,18 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, const LLTextSegmentPtr segmentp = *line_seg_iter; S32 segment_line_start = segmentp->getStart() + line_seg_offset; - S32 segment_line_length = llmin(segmentp->getEnd(), line_iter->mDocIndexEnd - 1) - segment_line_start; + S32 segment_line_length = llmin(segmentp->getEnd(), line_iter->mDocIndexEnd) - segment_line_start; S32 text_width, text_height; - segmentp->getDimensions(line_seg_offset, segment_line_length, text_width, text_height); - if (local_x < start_x + text_width // cursor to left of right edge of text - || (hit_past_end_of_line && (segmentp->getEnd() >= line_iter->mDocIndexEnd - 1))) // or this segment wraps to next line + bool newline = segmentp->getDimensions(line_seg_offset, segment_line_length, text_width, text_height); + + // if we've reached a line of text *below* the mouse cursor, doc index is first character on that line + if (hit_past_end_of_line && local_y - mVisibleTextRect.mBottom + visible_region.mBottom > line_iter->mRect.mTop) + { + pos = segment_line_start; + break; + } + if (local_x < start_x + text_width // cursor to left of right edge of text + || newline) // or this line ends with a newline, set doc pos to newline char { // Figure out which character we're nearest to. S32 offset; @@ -1841,6 +1850,13 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, pos = segment_line_start + offset; break; } + else if (hit_past_end_of_line && segmentp->getEnd() >= line_iter->mDocIndexEnd - 1) + { + // segment wraps to next line, so just set doc pos to start of next line + pos = llmin(getLength(), line_iter->mDocIndexEnd); + break; + } + start_x += text_width; } -- cgit v1.2.3 From 07bc1f0ba52cfcd107f6cf12ab4e5372640b2143 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Tue, 23 Mar 2010 11:22:46 -0700 Subject: fixed line ending style where I copied from araxis merge window --- indra/llui/lltextbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 13201719f4..f0b3a1a56c 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1825,7 +1825,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, pos = segment_line_start; break; } - if (local_x < start_x + text_width // cursor to left of right edge of text + if (local_x < start_x + text_width // cursor to left of right edge of text || newline) // or this line ends with a newline, set doc pos to newline char { // Figure out which character we're nearest to. -- cgit v1.2.3 From e3e50bf7ed48c6ee0a199d27fce7ba888793429d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 23 Mar 2010 12:47:11 -0700 Subject: added some comments for fix to EXT-5549 --- indra/llui/lltextbase.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index f0b3a1a56c..5f4b16ec9e 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -363,7 +363,10 @@ void LLTextBase::drawSelectionBackground() selection_rect.mLeft += segment_width; } - // if selection spans end of current segment... + // if selection_right == segment_line_end then that means we are the first character of the next segment + // or first character of the next line, in either case we want to add the length of the current segment + // to the selection rectangle and continue. + // if selection right > segment_line_end then selection spans end of current segment... if (selection_right >= segment_line_end) { // extend selection slightly beyond end of line @@ -1852,7 +1855,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, } else if (hit_past_end_of_line && segmentp->getEnd() >= line_iter->mDocIndexEnd - 1) { - // segment wraps to next line, so just set doc pos to start of next line + // segment wraps to next line, so just set doc pos to start of next line (represented by mDocIndexEnd) pos = llmin(getLength(), line_iter->mDocIndexEnd); break; } -- cgit v1.2.3 From 9ff6b6ecd123d3fcd71e189094cc9cb99eca9724 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Thu, 25 Mar 2010 15:48:08 +0200 Subject: Fixed low bug EXT-6444 - Long notecard titles continue under Locked and Help icons on title bar. Changed the way floater title is reshaped. Calculations takes title buttons into account instead of using hardcoded values. --HG-- branch : product-engine --- indra/llui/lldraghandle.cpp | 7 +++---- indra/llui/lldraghandle.h | 3 +++ indra/llui/llfloater.cpp | 40 ++++++++++++++++++++++++++-------------- indra/llui/llfloater.h | 3 ++- 4 files changed, 34 insertions(+), 19 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index 832f148902..9d4e2fa495 100644 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -248,15 +248,14 @@ void LLDragHandleTop::reshapeTitleBox() return; } const LLFontGL* font = LLFontGL::getFontSansSerif(); - S32 title_width = font->getWidth( mTitleBox->getText() ) + TITLE_HPAD; - if (getMaxTitleWidth() > 0) - title_width = llmin(title_width, getMaxTitleWidth()); + S32 title_width = getRect().getWidth(); + title_width -= 2 * LEFT_PAD + 2 * BORDER_PAD + getButtonsRect().getWidth(); S32 title_height = llround(font->getLineHeight()); LLRect title_rect; title_rect.setLeftTopAndSize( LEFT_PAD, getRect().getHeight() - title_vpad, - getRect().getWidth() - LEFT_PAD - RIGHT_PAD, + title_width, title_height); // calls reshape on mTitleBox diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h index dc5410787b..825bc9303e 100644 --- a/indra/llui/lldraghandle.h +++ b/indra/llui/lldraghandle.h @@ -71,6 +71,8 @@ public: BOOL getForeground() const { return mForeground; } void setMaxTitleWidth(S32 max_width) {mMaxTitleWidth = llmin(max_width, mMaxTitleWidth); } S32 getMaxTitleWidth() const { return mMaxTitleWidth; } + void setButtonsRect(const LLRect& rect){ mButtonsRect = rect; } + LLRect getButtonsRect() { return mButtonsRect; } void setTitleVisible(BOOL visible); virtual void setTitle( const std::string& title ) = 0; @@ -88,6 +90,7 @@ protected: LLTextBox* mTitleBox; private: + LLRect mButtonsRect; S32 mDragLastScreenX; S32 mDragLastScreenY; S32 mLastMouseScreenX; diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 104ae19eda..e672252a50 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -346,7 +346,7 @@ void LLFloater::layoutDragHandle() rect = getLocalRect(); } mDragHandle->setRect(rect); - updateButtons(); + updateTitleButtons(); applyTitle(); } @@ -1061,11 +1061,10 @@ void LLFloater::setMinimized(BOOL minimize) // Reshape *after* setting mMinimized reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); } - - applyTitle (); make_ui_sound("UISndWindowClose"); - updateButtons(); + updateTitleButtons(); + applyTitle (); } void LLFloater::setFocus( BOOL b ) @@ -1191,7 +1190,7 @@ void LLFloater::setHost(LLMultiFloater* host) mButtonScale = 1.f; //mButtonsEnabled[BUTTON_TEAR_OFF] = FALSE; } - updateButtons(); + updateTitleButtons(); if (host) { mHostHandle = host->getHandle(); @@ -1390,7 +1389,7 @@ void LLFloater::setCanDock(bool b) mButtonsEnabled[BUTTON_DOCK] = FALSE; } } - updateButtons(); + updateTitleButtons(); } void LLFloater::setDocked(bool docked, bool pop_on_undock) @@ -1399,7 +1398,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock) { mDocked = docked; mButtonsEnabled[BUTTON_DOCK] = !mDocked; - updateButtons(); + updateTitleButtons(); storeDockStateControl(); } @@ -1452,7 +1451,7 @@ void LLFloater::onClickTearOff(LLFloater* self) } self->setTornOff(false); } - self->updateButtons(); + self->updateTitleButtons(); } // static @@ -1692,7 +1691,7 @@ void LLFloater::setCanMinimize(BOOL can_minimize) mButtonsEnabled[BUTTON_MINIMIZE] = can_minimize && !isMinimized(); mButtonsEnabled[BUTTON_RESTORE] = can_minimize && isMinimized(); - updateButtons(); + updateTitleButtons(); } void LLFloater::setCanClose(BOOL can_close) @@ -1700,7 +1699,7 @@ void LLFloater::setCanClose(BOOL can_close) mCanClose = can_close; mButtonsEnabled[BUTTON_CLOSE] = can_close; - updateButtons(); + updateTitleButtons(); } void LLFloater::setCanTearOff(BOOL can_tear_off) @@ -1708,7 +1707,7 @@ void LLFloater::setCanTearOff(BOOL can_tear_off) mCanTearOff = can_tear_off; mButtonsEnabled[BUTTON_TEAR_OFF] = mCanTearOff && !mHostHandle.isDead(); - updateButtons(); + updateTitleButtons(); } @@ -1732,10 +1731,11 @@ void LLFloater::setCanDrag(BOOL can_drag) } } -void LLFloater::updateButtons() +void LLFloater::updateTitleButtons() { static LLUICachedControl floater_close_box_size ("UIFloaterCloseBoxSize", 0); static LLUICachedControl close_box_from_top ("UICloseBoxFromTop", 0); + LLRect buttons_rect; S32 button_count = 0; for (S32 i = 0; i < BUTTON_COUNT; i++) { @@ -1786,6 +1786,15 @@ void LLFloater::updateButtons() llround((F32)floater_close_box_size * mButtonScale)); } + if(!buttons_rect.isValid()) + { + buttons_rect = btn_rect; + } + else + { + mDragOnLeft ? buttons_rect.mRight + btn_rect.mRight : + buttons_rect.mLeft = btn_rect.mLeft; + } mButtons[i]->setRect(btn_rect); mButtons[i]->setVisible(TRUE); // the restore button should have a tab stop so that it takes action when you Ctrl-Tab to a minimized floater @@ -1797,7 +1806,10 @@ void LLFloater::updateButtons() } } if (mDragHandle) - mDragHandle->setMaxTitleWidth(getRect().getWidth() - (button_count * (floater_close_box_size + 1))); + { + localRectToOtherView(buttons_rect, &buttons_rect, mDragHandle); + mDragHandle->setButtonsRect(buttons_rect); + } } void LLFloater::buildButtons(const Params& floater_params) @@ -1854,7 +1866,7 @@ void LLFloater::buildButtons(const Params& floater_params) mButtons[i] = buttonp; } - updateButtons(); + updateTitleButtons(); } // static diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index d8c77370f6..403723d9d8 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -311,11 +311,12 @@ protected: virtual void onClickCloseBtn(); + virtual void updateTitleButtons(); + private: void setForeground(BOOL b); // called only by floaterview void cleanupHandles(); // remove handles to dead floaters void createMinimizeButton(); - void updateButtons(); void buildButtons(const Params& p); // Images and tooltips are named in the XML, but we want to look them -- cgit v1.2.3