diff options
author | Dave Parks <davep@lindenlab.com> | 2011-04-19 14:55:11 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-04-19 14:55:11 -0500 |
commit | 3b5d6eed12d928e5a7a0bc3a8d827f676b25d060 (patch) | |
tree | 8cf08a165c11acf92742eacc64248c1e50b2420b /indra/llui | |
parent | b8069d1c250c03e9fffda0a9264bfd04a12f8292 (diff) | |
parent | 12b0b52b99e6f6a6538feba8589566d2f73f82c6 (diff) |
merge
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/CMakeLists.txt | 18 | ||||
-rw-r--r-- | indra/llui/llcombobox.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llcombobox.h | 1 | ||||
-rw-r--r-- | indra/llui/llflatlistview.cpp | 3 | ||||
-rw-r--r-- | indra/llui/llflatlistview.h | 3 | ||||
-rw-r--r-- | indra/llui/lllineeditor.cpp | 6 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 41 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 14 | ||||
-rw-r--r-- | indra/llui/llview.h | 8 |
9 files changed, 60 insertions, 38 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 33ab2e93b5..684e393cba 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -244,12 +244,12 @@ target_link_libraries(llui ${LLCOMMON_LIBRARIES} # must be after llimage, llwindow, llrender ) -if(LL_TESTS) - # Add tests - include(LLAddBuildTest) - SET(llui_TEST_SOURCE_FILES - llurlmatch.cpp - llurlentry.cpp - ) - LL_ADD_PROJECT_UNIT_TESTS(llui "${llui_TEST_SOURCE_FILES}") -endif(LL_TESTS) +# Add tests +if (LL_TESTS) + include(LLAddBuildTest) + SET(llui_TEST_SOURCE_FILES + llurlmatch.cpp + llurlentry.cpp + ) + LL_ADD_PROJECT_UNIT_TESTS(llui "${llui_TEST_SOURCE_FILES}") +endif (LL_TESTS)
\ No newline at end of file diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 6f9893b07a..a4d1854bc8 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -231,6 +231,10 @@ void LLComboBox::resetDirty() } } +bool LLComboBox::itemExists(const std::string& name) +{ + return mList->getItemByLabel(name); +} // add item "name" to menu LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, BOOL enabled) diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index e9ef9d07e4..64dbaea306 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -134,6 +134,7 @@ public: LLScrollListItem* addSeparator(EAddPosition pos = ADD_BOTTOM); BOOL remove( S32 index ); // remove item by index, return TRUE if found and removed void removeall() { clearRows(); } + bool itemExists(const std::string& name); void sortByName(BOOL ascending = TRUE); // Sort the entries in the combobox by name diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index c57c02f4b1..97a52fada4 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -87,9 +87,6 @@ bool LLFlatListView::addItem(LLPanel * item, const LLSD& value /*= LLUUID::null* mItemsPanel->addChild(item); break; default: - LL_WARNS("") << "Unsupported position." << LL_ENDL; - delete new_pair; - return false; break; } diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 0515853698..92bf429031 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -450,8 +450,9 @@ private: */ class LLFlatListViewEx : public LLFlatListView { - LOG_CLASS(LLFlatListViewEx); public: + LOG_CLASS(LLFlatListViewEx); + struct Params : public LLInitParam::Block<Params, LLFlatListView::Params> { /** diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index d99ee5a545..0196080d90 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -389,7 +389,11 @@ void LLLineEditor::setText(const LLStringExplicit &new_text) setCursor(llmin((S32)mText.length(), getCursor())); // Set current history line to end of history. - if(mLineHistory.end() != mLineHistory.begin()) + if (mLineHistory.empty()) + { + mCurrentHistoryLine = mLineHistory.end(); + } + else { mCurrentHistoryLine = mLineHistory.end() - 1; } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 82269282ef..2060e5f9cf 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1658,6 +1658,9 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para while ( LLUrlRegistry::instance().findUrl(text, match, boost::bind(&LLTextBase::replaceUrl, this, _1, _2, _3)) ) { + + LLTextUtil::processUrlMatch(&match,this); + start = match.getStart(); end = match.getEnd()+1; @@ -1679,10 +1682,6 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para std::string subtext=text.substr(0,start); appendAndHighlightText(subtext, part, style_params); } - - // inserts an avatar icon preceding the Url if appropriate - LLTextUtil::processUrlMatch(&match,this); - // output the styled Url appendAndHighlightTextImpl(match.getLabel(), part, link_params, match.underlineOnHoverOnly()); @@ -2965,11 +2964,18 @@ bool LLImageTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width S32 LLImageTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const { LLUIImagePtr image = mStyle->getImage(); + + if (image.isNull()) + { + return 1; + } + S32 image_width = image->getWidth(); if(line_offset == 0 || num_pixels>image_width + IMAGE_HPAD) { return 1; } + return 0; } @@ -2979,18 +2985,21 @@ F32 LLImageTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 select { LLColor4 color = LLColor4::white % mEditor.getDrawContext().mAlpha; LLUIImagePtr image = mStyle->getImage(); - S32 style_image_height = image->getHeight(); - S32 style_image_width = image->getWidth(); - // Text is drawn from the top of the draw_rect downward - - S32 text_center = draw_rect.mTop - (draw_rect.getHeight() / 2); - // Align image to center of draw rect - S32 image_bottom = text_center - (style_image_height / 2); - image->draw(draw_rect.mLeft, image_bottom, - style_image_width, style_image_height, color); - - const S32 IMAGE_HPAD = 3; - return draw_rect.mLeft + style_image_width + IMAGE_HPAD; + if (image.notNull()) + { + S32 style_image_height = image->getHeight(); + S32 style_image_width = image->getWidth(); + // Text is drawn from the top of the draw_rect downward + + S32 text_center = draw_rect.mTop - (draw_rect.getHeight() / 2); + // Align image to center of draw rect + S32 image_bottom = text_center - (style_image_height / 2); + image->draw(draw_rect.mLeft, image_bottom, + style_image_width, style_image_height, color); + + const S32 IMAGE_HPAD = 3; + return draw_rect.mLeft + style_image_width + IMAGE_HPAD; + } } return 0.0; } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index d73e87129e..245126d178 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -114,7 +114,8 @@ LLView::Params::Params() } LLView::LLView(const LLView::Params& p) -: mName(p.name), +: mVisible(p.visible), + mName(p.name), mParentView(NULL), mReshapeFlags(FOLLOWS_NONE), mFromXUI(p.from_xui), @@ -123,7 +124,6 @@ LLView::LLView(const LLView::Params& p) mNextInsertionOrdinal(0), mHoverCursor(getCursorFromString(p.hover_cursor)), mEnabled(p.enabled), - mVisible(p.visible), mMouseOpaque(p.mouse_opaque), mSoundFlags(p.sound_flags), mUseBoundingRect(p.use_bounding_rect), @@ -1299,7 +1299,13 @@ void LLView::drawChildren() { if (!mChildList.empty()) { - LLRect rootRect = getRootView()->getRect(); + static const LLRect* rootRect = NULL; + + if (!mParentView) + { + rootRect = &mRect; + } + LLRect screenRect; ++sDepth; @@ -1313,7 +1319,7 @@ void LLView::drawChildren() { // Only draw views that are within the root view localRectToScreen(viewp->getRect(),&screenRect); - if ( rootRect.overlaps(screenRect) && LLUI::sDirtyRect.overlaps(screenRect)) + if ( rootRect->overlaps(screenRect) && LLUI::sDirtyRect.overlaps(screenRect)) { LLUI::pushMatrix(); { diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 61dc4b8030..9ab0797f9e 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -287,7 +287,7 @@ public: void setAllChildrenEnabled(BOOL b); virtual void setVisible(BOOL visible); - BOOL getVisible() const { return mVisible; } + const BOOL& getVisible() const { return mVisible; } virtual void setEnabled(BOOL enabled); BOOL getEnabled() const { return mEnabled; } /// 'available' in this context means 'visible and enabled': in other @@ -543,11 +543,13 @@ private: LLView* mParentView; child_list_t mChildList; - std::string mName; // location in pixels, relative to surrounding structure, bottom,left=0,0 + BOOL mVisible; LLRect mRect; LLRect mBoundingRect; + std::string mLayout; + std::string mName; U32 mReshapeFlags; @@ -569,8 +571,6 @@ private: LLRootHandle<LLView> mHandle; BOOL mLastVisible; - BOOL mVisible; - S32 mNextInsertionOrdinal; static LLWindow* sWindow; // All root views must know about their window. |