diff options
author | James Cook <james@lindenlab.com> | 2008-07-18 17:50:25 +0000 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2008-07-18 17:50:25 +0000 |
commit | ed386ae547c225e352c39e8d14921572ee534b0b (patch) | |
tree | f67ff767edfc07900c0c8c16cd4439eb38d05be0 /indra/llui | |
parent | 292627c09df6085c985a189edd5df06d3ca1eb47 (diff) |
merge support-featurettes-snapshot-merge-2 for QAR-754, includes:
* featurettes-4 89061:89589 (which is all of featurettes-1, -2, and -3, and part of -4)
* gteam-showstoppers-3 91950:91951 (which is all of gteam-showstoppers-1, -2, and -3)
* featurettes-5 92149:92150 (patch for last line of chat text not visible in chat history, DEV-17771)
* snapshot-3 91988:91991 (which is all of snapshot-1, -2, and -3)
Merging revisions 92190-92387 of svn+ssh://svn.lindenlab.com/svn/linden/branches/support-featurettes-snapshot-merge-2 into release, respecting ancestry
* QAR-590 Merge Lock Request for Support Sprint
* QAR-627 Merge snapshot improvements
* QAR-686 Merge Lock request for Featurettes
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llfloater.cpp | 78 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 17 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 12 | ||||
-rw-r--r-- | indra/llui/llspinctrl.cpp | 10 | ||||
-rw-r--r-- | indra/llui/llspinctrl.h | 2 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 35 |
6 files changed, 89 insertions, 65 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 18ffbdfbcd..838f6fa193 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1082,38 +1082,37 @@ void LLFloater::removeDependentFloater(LLFloater* floaterp) floaterp->mDependeeHandle = LLHandle<LLFloater>(); } -// virtual -BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) +BOOL LLFloater::offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButtons index) { - if( mMinimized ) + if( mButtonsEnabled[index] ) { - // Offer the click to the close button. - if( mButtonsEnabled[BUTTON_CLOSE] ) - { - S32 local_x = x - mButtons[BUTTON_CLOSE]->getRect().mLeft; - S32 local_y = y - mButtons[BUTTON_CLOSE]->getRect().mBottom; + LLButton* my_butt = mButtons[index]; + S32 local_x = x - my_butt->getRect().mLeft; + S32 local_y = y - my_butt->getRect().mBottom; - if (mButtons[BUTTON_CLOSE]->pointInView(local_x, local_y) - && mButtons[BUTTON_CLOSE]->handleMouseDown(local_x, local_y, mask)) - { - // close button handled it, return - return TRUE; - } - } - - // Offer the click to the restore button. - if( mButtonsEnabled[BUTTON_RESTORE] ) + if ( + my_butt->pointInView(local_x, local_y) && + my_butt->handleMouseDown(local_x, local_y, mask)) { - S32 local_x = x - mButtons[BUTTON_RESTORE]->getRect().mLeft; - S32 local_y = y - mButtons[BUTTON_RESTORE]->getRect().mBottom; - - if (mButtons[BUTTON_RESTORE]->pointInView(local_x, local_y) - && mButtons[BUTTON_RESTORE]->handleMouseDown(local_x, local_y, mask)) - { - // restore button handled it, return - return TRUE; - } + // the button handled it + return TRUE; } + } + return FALSE; +} + +// virtual +BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) +{ + if( mMinimized ) + { + // Offer the click to titlebar buttons. + // Note: this block and the offerClickToButton helper method can be removed + // because the parent container will handle it for us but we'll keep it here + // for safety until after reworking the panel code to manage hidden children. + if(offerClickToButton(x, y, mask, BUTTON_CLOSE)) return TRUE; + if(offerClickToButton(x, y, mask, BUTTON_RESTORE)) return TRUE; + if(offerClickToButton(x, y, mask, BUTTON_TEAR_OFF)) return TRUE; // Otherwise pass to drag handle for movement return mDragHandle->handleMouseDown(x, y, mask); @@ -1248,6 +1247,7 @@ void LLFloater::onClickTearOff(void *userdata) LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get(); if (new_host) { + self->setMinimized(FALSE); // to reenable minimize button if it was minimized new_host->showFloater(self); // make sure host is visible new_host->open(); @@ -1420,31 +1420,15 @@ void LLFloater::draw() void LLFloater::setCanMinimize(BOOL can_minimize) { - // removing minimize/restore button programmatically, - // go ahead and uniminimize floater + // if removing minimize/restore button programmatically, + // go ahead and unminimize floater if (!can_minimize) { setMinimized(FALSE); } - if (can_minimize) - { - if (isMinimized()) - { - mButtonsEnabled[BUTTON_MINIMIZE] = FALSE; - mButtonsEnabled[BUTTON_RESTORE] = TRUE; - } - else - { - mButtonsEnabled[BUTTON_MINIMIZE] = TRUE; - mButtonsEnabled[BUTTON_RESTORE] = FALSE; - } - } - else - { - mButtonsEnabled[BUTTON_MINIMIZE] = FALSE; - mButtonsEnabled[BUTTON_RESTORE] = FALSE; - } + mButtonsEnabled[BUTTON_MINIMIZE] = can_minimize && !isMinimized(); + mButtonsEnabled[BUTTON_RESTORE] = can_minimize && isMinimized(); updateButtons(); } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index cb21036ef4..e467d6f921 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -151,8 +151,8 @@ public: void moveResizeHandlesToFront(); void addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE); void addDependentFloater(LLHandle<LLFloater> dependent_handle, BOOL reposition = TRUE); - LLFloater* getDependee() { return (LLFloater*)mDependeeHandle.get(); } - void removeDependentFloater(LLFloater* dependent); + LLFloater* getDependee() { return (LLFloater*)mDependeeHandle.get(); } + void removeDependentFloater(LLFloater* dependent); BOOL isMinimized() { return mMinimized; } BOOL isFrontmost(); BOOL isDependent() { return !mDependeeHandle.isDead(); } @@ -221,8 +221,8 @@ protected: virtual void bringToFront(S32 x, S32 y); virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE); - void setExpandedRect(const LLRect& rect) { mExpandedRect = rect; } // size when not minimized - const LLRect& getExpandedRect() const { return mExpandedRect; } + void setExpandedRect(const LLRect& rect) { mExpandedRect = rect; } // size when not minimized + const LLRect& getExpandedRect() const { return mExpandedRect; } void setAutoFocus(BOOL focus) { mAutoFocus = focus; } // whether to automatically take focus when opened LLDragHandle* getDragHandle() const { return mDragHandle; } @@ -236,11 +236,12 @@ private: void createMinimizeButton(); void updateButtons(); void buildButtons(); + BOOL offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButtons index); LLRect mExpandedRect; LLDragHandle* mDragHandle; LLResizeBar* mResizeBar[4]; - LLResizeHandle* mResizeHandle[4]; + LLResizeHandle* mResizeHandle[4]; LLButton *mMinimizeButton; BOOL mCanTearOff; BOOL mMinimized; @@ -259,7 +260,7 @@ private: typedef std::set<LLHandle<LLFloater> > handle_set_t; typedef std::set<LLHandle<LLFloater> >::iterator handle_set_iter_t; handle_set_t mDependents; - bool mDragOnLeft; + bool mDragOnLeft; BOOL mButtonsEnabled[BUTTON_COUNT]; LLButton* mButtons[BUTTON_COUNT]; @@ -387,8 +388,8 @@ public: virtual void selectNextFloater(); virtual void selectPrevFloater(); - virtual LLFloater* getActiveFloater(); - virtual BOOL isFloaterFlashing(LLFloater* floaterp); + virtual LLFloater* getActiveFloater(); + virtual BOOL isFloaterFlashing(LLFloater* floaterp); virtual S32 getFloaterCount(); virtual void setFloaterFlashing(LLFloater* floaterp, BOOL flashing); diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 0bc5bc60de..3c29795cb4 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -3242,11 +3242,19 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p S32 index = columnp->mIndex; S32 width = columnp->mWidth; LLFontGL::HAlign font_alignment = columnp->mFontAlignment; - + LLColor4 fcolor = LLColor4::black; + LLSD value = (*itor)["value"]; std::string fontname = (*itor)["font"].asString(); std::string fontstyle = (*itor)["font-style"].asString(); std::string type = (*itor)["type"].asString(); + + if ((*itor).has("font-color")) + { + LLSD sd_color = (*itor)["font-color"]; + fcolor.setValue(sd_color); + } + BOOL has_color = (*itor).has("color"); LLColor4 color = ((*itor)["color"]); BOOL enabled = !(*itor).has("enabled") || (*itor)["enabled"].asBoolean() == true; @@ -3291,7 +3299,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p } else { - LLScrollListText* cell = new LLScrollListText(value.asString(), font, width, font_style, font_alignment); + LLScrollListText* cell = new LLScrollListText(value.asString(), font, width, font_style, font_alignment, fcolor, TRUE); if (has_color) { cell->setColor(color); diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index e7fc10912e..505202c48e 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -396,6 +396,12 @@ void LLSpinCtrl::setLabel(const LLStringExplicit& label) } } +void LLSpinCtrl::setAllowEdit(BOOL allow_edit) +{ + mEditor->setEnabled(allow_edit); + mAllowEdit = allow_edit; +} + void LLSpinCtrl::onTabInto() { mEditor->onTabInto(); @@ -520,6 +526,9 @@ LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * S32 label_width = llmin(40, rect.getWidth() - 40); node->getAttributeS32("label_width", label_width); + BOOL allow_text_entry = TRUE; + node->getAttributeBOOL("allow_text_entry", allow_text_entry); + LLUICtrlCallback callback = NULL; if(label.empty()) @@ -543,6 +552,7 @@ LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * spinner->setPrecision(precision); spinner->initFromXML(node, parent); + spinner->setAllowEdit(allow_text_entry); return spinner; } diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index 1ed9462f00..a9a9ef5073 100644 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h @@ -93,6 +93,7 @@ public: void setLabel(const LLStringExplicit& label); void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } + void setAllowEdit(BOOL allow_edit); virtual void onTabInto(); @@ -134,6 +135,7 @@ private: class LLButton* mDownBtn; BOOL mbHasBeenSet; + BOOL mAllowEdit; }; #endif // LL_LLSPINCTRL_H diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index a2063358bd..b70ad4c53c 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -257,6 +257,7 @@ LLTextEditor::LLTextEditor( mIsSelecting( FALSE ), mSelectionStart( 0 ), mSelectionEnd( 0 ), + mScrolledToBottom( FALSE ), mOnScrollEndCallback( NULL ), mOnScrollEndData( NULL ), mCursorColor( LLUI::sColorsGroup->getColor( "TextCursorColor" ) ), @@ -3361,20 +3362,26 @@ void LLTextEditor::reshape(S32 width, S32 height, BOOL called_from_parent) { LLView::reshape( width, height, called_from_parent ); - // if scrolled to bottom, stay at bottom - // unless user is editing text - if (mScrolledToBottom && mTrackBottom && !hasFocus()) - { - endOfDoc(); - } - + // do this first after reshape, because other things depend on + // up-to-date mTextRect updateTextRect(); + + updateLineStartList(); + + // propagate shape information to scrollbar + mScrollbar->setDocSize( getLineCount() ); S32 line_height = llround( mGLFont->getLineHeight() ); S32 page_lines = mTextRect.getHeight() / line_height; mScrollbar->setPageSize( page_lines ); - updateLineStartList(); + // if scrolled to bottom, stay at bottom + // unless user is editing text + // do this after updating page size + if (mScrolledToBottom && mTrackBottom && !hasFocus()) + { + endOfDoc(); + } } void LLTextEditor::autoIndent() @@ -3540,6 +3547,10 @@ void LLTextEditor::appendText(const std::string &new_text, bool allow_undo, bool { mSelectionStart = selection_start; mSelectionEnd = selection_end; + + + + mIsSelecting = was_selecting; setCursorPos(cursor_pos); } @@ -3556,6 +3567,14 @@ void LLTextEditor::appendText(const std::string &new_text, bool allow_undo, bool { blockUndo(); } + + // if scrolled to bottom, stay at bottom + // unless user is editing text + // do this after updating page size + if (mScrolledToBottom && mTrackBottom && !hasFocus()) + { + endOfDoc(); + } } void LLTextEditor::removeTextFromEnd(S32 num_chars) |