From ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 30 Apr 2009 13:04:20 -0500 Subject: Second Life viewer sources 1.23.0-RC --- linden/indra/llui/llview.cpp | 63 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 14 deletions(-) (limited to 'linden/indra/llui/llview.cpp') diff --git a/linden/indra/llui/llview.cpp b/linden/indra/llui/llview.cpp index 9cdf481..444922a 100644 --- a/linden/indra/llui/llview.cpp +++ b/linden/indra/llui/llview.cpp @@ -18,7 +18,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -85,7 +86,8 @@ LLView::LLView() : mLastVisible(TRUE), mUseBoundingRect(FALSE), mVisible(TRUE), - mNextInsertionOrdinal(0) + mNextInsertionOrdinal(0), + mHoverCursor(UI_CURSOR_ARROW) { } @@ -102,7 +104,8 @@ LLView::LLView(const std::string& name, BOOL mouse_opaque) : mLastVisible(TRUE), mUseBoundingRect(FALSE), mVisible(TRUE), - mNextInsertionOrdinal(0) + mNextInsertionOrdinal(0), + mHoverCursor(UI_CURSOR_ARROW) { } @@ -123,7 +126,8 @@ LLView::LLView( mLastVisible(TRUE), mUseBoundingRect(FALSE), mVisible(TRUE), - mNextInsertionOrdinal(0) + mNextInsertionOrdinal(0), + mHoverCursor(UI_CURSOR_ARROW) { } @@ -657,7 +661,7 @@ BOOL LLView::handleHover(S32 x, S32 y, MASK mask) if( !handled && blockMouseEvent(x, y) ) { - LLUI::sWindow->setCursor(UI_CURSOR_ARROW); + LLUI::sWindow->setCursor(mHoverCursor); lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << llendl; handled = TRUE; } @@ -705,9 +709,11 @@ BOOL LLView::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_s LLView* viewp = *child_it; S32 local_x = x - viewp->mRect.mLeft; S32 local_y = y - viewp->mRect.mBottom; + // Allow tooltips for disabled views so we can explain to the user why + // the view is disabled. JC if( viewp->pointInView(local_x, local_y) && viewp->getVisible() - && viewp->getEnabled() + // && viewp->getEnabled() && viewp->handleToolTip(local_x, local_y, msg, sticky_rect_screen )) { // child provided a tooltip, just return @@ -1257,7 +1263,7 @@ void LLView::draw() { LLView *viewp = *child_iter; - if (viewp->getVisible() && viewp != focus_view) + if (viewp->getVisible() && viewp != focus_view && viewp->getRect().isValid()) { // Only draw views that are within the root view localRectToScreen(viewp->getRect(),&screenRect); @@ -1340,7 +1346,7 @@ void LLView::drawDebugRect() y = debug_rect.getHeight()/2; std::string debug_text = llformat("%s (%d x %d)", getName().c_str(), debug_rect.getWidth(), debug_rect.getHeight()); - LLFontGL::sSansSerifSmall->renderUTF8(debug_text, 0, (F32)x, (F32)y, border_color, + LLFontGL::getFontSansSerifSmall()->renderUTF8(debug_text, 0, (F32)x, (F32)y, border_color, LLFontGL::HCENTER, LLFontGL::BASELINE, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE); } @@ -1354,7 +1360,8 @@ void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_dr { ++sDepth; - if (childp->getVisible() || force_draw) + if ((childp->getVisible() && childp->getRect().isValid()) + || force_draw) { glMatrixMode(GL_MODELVIEW); LLUI::pushMatrix(); @@ -2544,6 +2551,13 @@ void LLView::initFromXML(LLXMLNodePtr node, LLView* parent) node->getAttributeBOOL("visible", visible); setVisible(visible); } + + if (node->hasAttribute("hover_cursor")) + { + std::string cursor_string; + node->getAttributeString("hover_cursor", cursor_string); + mHoverCursor = getCursorFromString(cursor_string); + } node->getAttributeBOOL("use_bounding_rect", mUseBoundingRect); node->getAttributeBOOL("mouse_opaque", mMouseOpaque); @@ -2595,19 +2609,40 @@ void LLView::parseFollowsFlags(LLXMLNodePtr node) } } - // static LLFontGL* LLView::selectFont(LLXMLNodePtr node) { - LLFontGL* gl_font = NULL; - + std::string font_name, font_size, font_style; + U8 style = 0; + if (node->hasAttribute("font")) { - std::string font_name; node->getAttributeString("font", font_name); + } + + if (node->hasAttribute("font_size")) + { + node->getAttributeString("font_size", font_size); + } - gl_font = LLFontGL::fontFromName(font_name); + if (node->hasAttribute("font_style")) + { + node->getAttributeString("font_style", font_style); + style = LLFontGL::getStyleFromString(font_style); + } + + if (node->hasAttribute("font-style")) + { + node->getAttributeString("font-style", font_style); + style = LLFontGL::getStyleFromString(font_style); } + + if (font_name.empty()) + return NULL; + + LLFontDescriptor desc(font_name, font_size, style); + LLFontGL* gl_font = LLFontGL::getFont(desc); + return gl_font; } -- cgit v1.1 From 0517fe4322443bdc317f8185590a63134e3f8394 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 13 Jun 2009 13:17:14 -0500 Subject: Second Life viewer sources 1.23.3-RC --- linden/indra/llui/llview.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'linden/indra/llui/llview.cpp') diff --git a/linden/indra/llui/llview.cpp b/linden/indra/llui/llview.cpp index 444922a..7047afc 100644 --- a/linden/indra/llui/llview.cpp +++ b/linden/indra/llui/llview.cpp @@ -741,23 +741,20 @@ BOOL LLView::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_s // don't allow any siblings to handle this event // even if we don't have a tooltip - if (getMouseOpaque() || show_names_text_box) + if (blockMouseEvent(x, y) || show_names_text_box) { - handled = TRUE; - } - - if(!tool_tip.empty()) - { - msg = tool_tip; + if(!tool_tip.empty()) + { + msg = tool_tip; - // Convert rect local to screen coordinates - localPointToScreen( - 0, 0, - &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); - localPointToScreen( - mRect.getWidth(), mRect.getHeight(), - &(sticky_rect_screen->mRight), &(sticky_rect_screen->mTop) ); - + // Convert rect local to screen coordinates + localPointToScreen( + 0, 0, + &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); + localPointToScreen( + mRect.getWidth(), mRect.getHeight(), + &(sticky_rect_screen->mRight), &(sticky_rect_screen->mTop) ); + } handled = TRUE; } -- cgit v1.1