diff options
author | Richard Nelson <richard@lindenlab.com> | 2007-04-05 00:59:55 +0000 |
---|---|---|
committer | Richard Nelson <richard@lindenlab.com> | 2007-04-05 00:59:55 +0000 |
commit | 2ce0fc5f185f22be79b9be5406b76c97ed91ee01 (patch) | |
tree | d70ea9faf02e4e1e7aeb14aa524644c23c703d55 /indra/llui | |
parent | fd5608a3e79397d4ebc8819dc9de75863f6fb9b3 (diff) |
svn merge -r 59234:60086 svn+ssh://svn/svn/linden/branches/live_lsl_help2 -> release
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llcombobox.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 37 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 17 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.h | 15 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 25 | ||||
-rw-r--r-- | indra/llui/lltexteditor.h | 4 |
6 files changed, 83 insertions, 20 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index e439cd0acc..f13e0d54b9 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -782,6 +782,7 @@ void LLComboBox::setAllowTextEntry(BOOL allow, S32 max_chars, BOOL set_tentative mTextEntry->setCommitOnFocusLost(FALSE); mTextEntry->setText(cur_label); mTextEntry->setIgnoreTab(TRUE); + mTextEntry->setFollowsAll(); addChild(mTextEntry); mMaxChars = max_chars; } @@ -789,6 +790,8 @@ void LLComboBox::setAllowTextEntry(BOOL allow, S32 max_chars, BOOL set_tentative { mTextEntry->setVisible(TRUE); } + + mButton->setFollows(FOLLOWS_BOTTOM | FOLLOWS_TOP | FOLLOWS_RIGHT); } else if (!allow && mAllowTextEntry) { @@ -799,6 +802,7 @@ void LLComboBox::setAllowTextEntry(BOOL allow, S32 max_chars, BOOL set_tentative { mTextEntry->setVisible(FALSE); } + mButton->setFollowsAll(); } mAllowTextEntry = allow; mTextEntryTentative = set_tentative; @@ -834,6 +838,7 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor, void* user_data) else { line_editor->setTentative(self->mTextEntryTentative); + self->mList->deselectAllItems(); } return; } diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 1f71de1c87..c3364a7a35 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -38,6 +38,8 @@ extern BOOL gNoRender; const S32 MINIMIZED_WIDTH = 160; const S32 CLOSE_BOX_FROM_TOP = 1; +// use this to control "jumping" behavior when Ctrl-Tabbing +const S32 TABBED_FLOATER_OFFSET = 0; LLString LLFloater::sButtonActiveImageNames[BUTTON_COUNT] = { @@ -2169,32 +2171,27 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out void LLFloaterView::draw() { - if( getVisible() ) - { - refresh(); - - // hide focused floater if in cycle mode, so that it can be drawn on top - LLFloater* focused_floater = getFocusedFloater(); - BOOL floater_visible = FALSE; - if (mFocusCycleMode && focused_floater) - { - floater_visible = focused_floater->getVisible(); - focused_floater->setVisible(FALSE); - } + refresh(); - // And actually do the draw - LLView::draw(); + // hide focused floater if in cycle mode, so that it can be drawn on top + LLFloater* focused_floater = getFocusedFloater(); - // manually draw focused floater on top when in cycle mode - if (mFocusCycleMode && focused_floater) + if (mFocusCycleMode && focused_floater) + { + child_list_const_iter_t child_it = getChildList()->begin(); + for (;child_it != getChildList()->end(); ++child_it) { - // draw focused item on top for better feedback - focused_floater->setVisible(floater_visible); - if (floater_visible) + if ((*child_it) != focused_floater) { - drawChild(focused_floater); + drawChild(*child_it); } } + + drawChild(focused_floater, -TABBED_FLOATER_OFFSET, TABBED_FLOATER_OFFSET); + } + else + { + LLView::draw(); } } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 98dddfb542..f442855aca 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -136,6 +136,19 @@ BOOL LLScrollListCheck::handleClick() } // +// LLScrollListSeparator +// +LLScrollListSeparator::LLScrollListSeparator(S32 width) : mWidth(width) +{ +} + +void LLScrollListSeparator::drawToWidth(S32 width, const LLColor4& color, const LLColor4& highlight_color) const +{ + //*FIXME: use dynamic item heights and make separators narrow, and inactive + gl_line_2d(5, 8, llmax(5, width - 5), 8, color); +} + +// // LLScrollListText // U32 LLScrollListText::sCount = 0; @@ -2750,6 +2763,10 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p LLRect(0, 0, width, width), "label"); new_item->setColumn(index, new LLScrollListCheck(ctrl,width)); } + else if (type == "separator") + { + new_item->setColumn(index, new LLScrollListSeparator(width)); + } else { new_item->setColumn(index, new LLScrollListText(value.asString(), font, width, font_style, font_alignment)); diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 99218ab3c4..7a0a32c87e 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -48,6 +48,21 @@ public: virtual void setEnabled(BOOL enable) { } }; +class LLScrollListSeparator : public LLScrollListCell +{ +public: + LLScrollListSeparator(S32 width); + virtual ~LLScrollListSeparator() {}; + virtual void drawToWidth(S32 width, const LLColor4& color, const LLColor4& highlight_color) const; // truncate to given width, if possible + virtual S32 getWidth() const {return mWidth;} + virtual S32 getHeight() const { return 5; }; + virtual void setWidth(S32 width) {mWidth = width; } + virtual BOOL isText() { return FALSE; } + +protected: + S32 mWidth; +}; + class LLScrollListText : public LLScrollListCell { public: diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 366b1956c4..651a421742 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -793,6 +793,31 @@ LLWString LLTextEditor::getWSubString(S32 pos, S32 len) return mWText.substr(pos, len); } +LLTextSegment* LLTextEditor::getCurrentSegment() +{ + return getSegmentAtOffset(mCursorPos); +} + +LLTextSegment* LLTextEditor::getPreviousSegment() +{ + // find segment index at character to left of cursor (or rightmost edge of selection) + S32 idx = llmax(0, getSegmentIdxAtOffset(mCursorPos) - 1); + return idx >= 0 ? mSegments[idx] : NULL; +} + +void LLTextEditor::getSelectedSegments(std::vector<LLTextSegment*>& segments) +{ + S32 left = hasSelection() ? llmin(mSelectionStart, mSelectionEnd) : mCursorPos; + S32 right = hasSelection() ? llmax(mSelectionStart, mSelectionEnd) : mCursorPos; + S32 first_idx = llmax(0, getSegmentIdxAtOffset(left)); + S32 last_idx = llmax(0, first_idx, getSegmentIdxAtOffset(right)); + + for (S32 idx = first_idx; idx <= last_idx; ++idx) + { + segments.push_back(mSegments[idx]); + } +} + S32 LLTextEditor::getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL round ) { // If round is true, if the position is on the right half of a character, the cursor diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 21db32b33f..d95230f0dc 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -221,6 +221,10 @@ public: llwchar getWChar(S32 pos); LLWString getWSubString(S32 pos, S32 len); + LLTextSegment* getCurrentSegment(); + LLTextSegment* getPreviousSegment(); + void getSelectedSegments(std::vector<LLTextSegment*>& segments); + protected: S32 getLength() const; void getSegmentAndOffset( S32 startpos, S32* segidxp, S32* offsetp ); |