diff options
Diffstat (limited to 'linden/indra/llui/llview.cpp')
-rw-r--r-- | linden/indra/llui/llview.cpp | 162 |
1 files changed, 21 insertions, 141 deletions
diff --git a/linden/indra/llui/llview.cpp b/linden/indra/llui/llview.cpp index 034c49b..9cdf481 100644 --- a/linden/indra/llui/llview.cpp +++ b/linden/indra/llui/llview.cpp | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * $LicenseInfo:firstyear=2001&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2001&license=viewergpl$ |
7 | * | 7 | * |
8 | * Copyright (c) 2001-2008, Linden Research, Inc. | 8 | * Copyright (c) 2001-2009, Linden Research, Inc. |
9 | * | 9 | * |
10 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
11 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -43,7 +43,7 @@ | |||
43 | #include "llfocusmgr.h" | 43 | #include "llfocusmgr.h" |
44 | #include "llrect.h" | 44 | #include "llrect.h" |
45 | #include "llstl.h" | 45 | #include "llstl.h" |
46 | #include "llui.h" // colors saved settings | 46 | #include "llui.h" |
47 | #include "lluictrl.h" | 47 | #include "lluictrl.h" |
48 | #include "llwindow.h" | 48 | #include "llwindow.h" |
49 | #include "v3color.h" | 49 | #include "v3color.h" |
@@ -710,25 +710,38 @@ BOOL LLView::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_s | |||
710 | && viewp->getEnabled() | 710 | && viewp->getEnabled() |
711 | && viewp->handleToolTip(local_x, local_y, msg, sticky_rect_screen )) | 711 | && viewp->handleToolTip(local_x, local_y, msg, sticky_rect_screen )) |
712 | { | 712 | { |
713 | // child provided a tooltip, just return | ||
714 | if (!msg.empty()) return TRUE; | ||
715 | |||
716 | // otherwise, one of our children ate the event so don't traverse | ||
717 | // siblings however, our child did not actually provide a tooltip | ||
718 | // so we might want to | ||
713 | handled = TRUE; | 719 | handled = TRUE; |
714 | break; | 720 | break; |
715 | } | 721 | } |
716 | } | 722 | } |
717 | 723 | ||
724 | // get our own tooltip | ||
718 | tool_tip = mToolTipMsg.getString(); | 725 | tool_tip = mToolTipMsg.getString(); |
719 | if ( | 726 | if ( |
720 | LLUI::sShowXUINames && | 727 | LLUI::sShowXUINames |
721 | (tool_tip.find(".xml", 0) == std::string::npos) && | 728 | && (tool_tip.find(".xml", 0) == std::string::npos) |
722 | (mName.find("Drag", 0) == std::string::npos)) | 729 | && (mName.find("Drag", 0) == std::string::npos)) |
723 | { | 730 | { |
724 | tool_tip = getShowNamesToolTip(); | 731 | tool_tip = getShowNamesToolTip(); |
725 | } | 732 | } |
726 | 733 | ||
727 | BOOL show_names_text_box = LLUI::sShowXUINames && dynamic_cast<LLTextBox*>(this) != NULL; | 734 | BOOL show_names_text_box = LLUI::sShowXUINames && dynamic_cast<LLTextBox*>(this) != NULL; |
728 | 735 | ||
729 | if( !handled && (blockMouseEvent(x, y) || show_names_text_box)) | 736 | // don't allow any siblings to handle this event |
737 | // even if we don't have a tooltip | ||
738 | if (getMouseOpaque() || show_names_text_box) | ||
730 | { | 739 | { |
740 | handled = TRUE; | ||
741 | } | ||
731 | 742 | ||
743 | if(!tool_tip.empty()) | ||
744 | { | ||
732 | msg = tool_tip; | 745 | msg = tool_tip; |
733 | 746 | ||
734 | // Convert rect local to screen coordinates | 747 | // Convert rect local to screen coordinates |
@@ -1281,7 +1294,7 @@ void LLView::drawDebugRect() | |||
1281 | LLUI::pushMatrix(); | 1294 | LLUI::pushMatrix(); |
1282 | { | 1295 | { |
1283 | // drawing solids requires texturing be disabled | 1296 | // drawing solids requires texturing be disabled |
1284 | LLGLSNoTexture no_texture; | 1297 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
1285 | 1298 | ||
1286 | if (mUseBoundingRect) | 1299 | if (mUseBoundingRect) |
1287 | { | 1300 | { |
@@ -1303,7 +1316,7 @@ void LLView::drawDebugRect() | |||
1303 | 1316 | ||
1304 | gGL.color4fv( border_color.mV ); | 1317 | gGL.color4fv( border_color.mV ); |
1305 | 1318 | ||
1306 | gGL.begin(LLVertexBuffer::LINES); | 1319 | gGL.begin(LLRender::LINES); |
1307 | gGL.vertex2i(0, debug_rect.getHeight() - 1); | 1320 | gGL.vertex2i(0, debug_rect.getHeight() - 1); |
1308 | gGL.vertex2i(0, 0); | 1321 | gGL.vertex2i(0, 0); |
1309 | 1322 | ||
@@ -2060,139 +2073,6 @@ LLView* LLView::findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, | |||
2060 | 2073 | ||
2061 | new_rect.translate(delta_x, delta_y); | 2074 | new_rect.translate(delta_x, delta_y); |
2062 | return snap_view; | 2075 | return snap_view; |
2063 | |||
2064 | //// If the view is near the edge of its parent, snap it to | ||
2065 | //// the edge. | ||
2066 | //LLRect test_rect = getSnapRect(); | ||
2067 | //LLRect view_rect = getSnapRect(); | ||
2068 | //test_rect.stretch(padding); | ||
2069 | //view_rect.stretch(padding); | ||
2070 | |||
2071 | //S32 x_threshold = threshold; | ||
2072 | //S32 y_threshold = threshold; | ||
2073 | |||
2074 | //LLRect parent_local_snap_rect = mParentView->getLocalSnapRect(); | ||
2075 | |||
2076 | //if (snap_type == SNAP_PARENT || snap_type == SNAP_PARENT_AND_SIBLINGS) | ||
2077 | //{ | ||
2078 | // if (llabs(parent_local_snap_rect.mRight - test_rect.mRight) <= x_threshold && (parent_local_snap_rect.mRight - test_rect.mRight) * mouse_dir.mX >= 0) | ||
2079 | // { | ||
2080 | // view_rect.translate(parent_local_snap_rect.mRight - view_rect.mRight, 0); | ||
2081 | // snap_view = mParentView; | ||
2082 | // x_threshold = llabs(parent_local_snap_rect.mRight - test_rect.mRight); | ||
2083 | // } | ||
2084 | |||
2085 | // if (llabs(test_rect.mLeft - parent_local_snap_rect.mLeft) <= x_threshold && test_rect.mLeft * mouse_dir.mX <= 0) | ||
2086 | // { | ||
2087 | // view_rect.translate(parent_local_snap_rect.mLeft - view_rect.mLeft, 0); | ||
2088 | // snap_view = mParentView; | ||
2089 | // x_threshold = llabs(test_rect.mLeft - parent_local_snap_rect.mLeft); | ||
2090 | // } | ||
2091 | |||
2092 | // if (llabs(test_rect.mBottom - parent_local_snap_rect.mBottom) <= y_threshold && test_rect.mBottom * mouse_dir.mY <= 0) | ||
2093 | // { | ||
2094 | // view_rect.translate(0, parent_local_snap_rect.mBottom - view_rect.mBottom); | ||
2095 | // snap_view = mParentView; | ||
2096 | // y_threshold = llabs(test_rect.mBottom - parent_local_snap_rect.mBottom); | ||
2097 | // } | ||
2098 | |||
2099 | // if (llabs(parent_local_snap_rect.mTop - test_rect.mTop) <= y_threshold && (parent_local_snap_rect.mTop - test_rect.mTop) * mouse_dir.mY >= 0) | ||
2100 | // { | ||
2101 | // view_rect.translate(0, parent_local_snap_rect.mTop - view_rect.mTop); | ||
2102 | // snap_view = mParentView; | ||
2103 | // y_threshold = llabs(parent_local_snap_rect.mTop - test_rect.mTop); | ||
2104 | // } | ||
2105 | //} | ||
2106 | //if (snap_type == SNAP_SIBLINGS || snap_type == SNAP_PARENT_AND_SIBLINGS) | ||
2107 | //{ | ||
2108 | // for ( child_list_const_iter_t child_it = mParentView->getChildList()->begin(); | ||
2109 | // child_it != mParentView->getChildList()->end(); ++child_it) | ||
2110 | // { | ||
2111 | // LLView* siblingp = *child_it; | ||
2112 | |||
2113 | // // skip non-snappable views (self, invisible views, etc) | ||
2114 | // if (!canSnapTo(siblingp)) continue; | ||
2115 | |||
2116 | // LLRect sibling_rect = siblingp->getSnapRect(); | ||
2117 | |||
2118 | // if (llabs(test_rect.mRight - sibling_rect.mLeft) <= x_threshold | ||
2119 | // && (test_rect.mRight - sibling_rect.mLeft) * mouse_dir.mX <= 0) | ||
2120 | // { | ||
2121 | // view_rect.translate(sibling_rect.mLeft - view_rect.mRight, 0); | ||
2122 | // if (llabs(test_rect.mTop - sibling_rect.mTop) <= y_threshold && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0) | ||
2123 | // { | ||
2124 | // view_rect.translate(0, sibling_rect.mTop - test_rect.mTop); | ||
2125 | // y_threshold = llabs(test_rect.mTop - sibling_rect.mTop); | ||
2126 | // } | ||
2127 | // else if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= y_threshold && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0) | ||
2128 | // { | ||
2129 | // view_rect.translate(0, sibling_rect.mBottom - test_rect.mBottom); | ||
2130 | // y_threshold = llabs(test_rect.mBottom - sibling_rect.mBottom); | ||
2131 | // } | ||
2132 | // snap_view = siblingp; | ||
2133 | // x_threshold = llabs(test_rect.mRight - sibling_rect.mLeft); | ||
2134 | // } | ||
2135 | |||
2136 | // if (llabs(test_rect.mLeft - sibling_rect.mRight) <= x_threshold | ||
2137 | // && (test_rect.mLeft - sibling_rect.mRight) * mouse_dir.mX <= 0) | ||
2138 | // { | ||
2139 | // view_rect.translate(sibling_rect.mRight - view_rect.mLeft, 0); | ||
2140 | // if (llabs(test_rect.mTop - sibling_rect.mTop) <= y_threshold && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0) | ||
2141 | // { | ||
2142 | // view_rect.translate(0, sibling_rect.mTop - test_rect.mTop); | ||
2143 | // y_threshold = llabs(test_rect.mTop - sibling_rect.mTop); | ||
2144 | // } | ||
2145 | // else if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= y_threshold && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0) | ||
2146 | // { | ||
2147 | // view_rect.translate(0, sibling_rect.mBottom - test_rect.mBottom); | ||
2148 | // y_threshold = llabs(test_rect.mBottom - sibling_rect.mBottom); | ||
2149 | // } | ||
2150 | // snap_view = siblingp; | ||
2151 | // x_threshold = llabs(test_rect.mLeft - sibling_rect.mRight); | ||
2152 | // } | ||
2153 | |||
2154 | // if (llabs(test_rect.mBottom - sibling_rect.mTop) <= y_threshold | ||
2155 | // && (test_rect.mBottom - sibling_rect.mTop) * mouse_dir.mY <= 0) | ||
2156 | // { | ||
2157 | // view_rect.translate(0, sibling_rect.mTop - view_rect.mBottom); | ||
2158 | // if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= x_threshold && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0) | ||
2159 | // { | ||
2160 | // view_rect.translate(sibling_rect.mLeft - test_rect.mLeft, 0); | ||
2161 | // x_threshold = llabs(test_rect.mLeft - sibling_rect.mLeft); | ||
2162 | // } | ||
2163 | // else if (llabs(test_rect.mRight - sibling_rect.mRight) <= x_threshold && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0) | ||
2164 | // { | ||
2165 | // view_rect.translate(sibling_rect.mRight - test_rect.mRight, 0); | ||
2166 | // x_threshold = llabs(test_rect.mRight - sibling_rect.mRight); | ||
2167 | // } | ||
2168 | // snap_view = siblingp; | ||
2169 | // y_threshold = llabs(test_rect.mBottom - sibling_rect.mTop); | ||
2170 | // } | ||
2171 | |||
2172 | // if (llabs(test_rect.mTop - sibling_rect.mBottom) <= y_threshold | ||
2173 | // && (test_rect.mTop - sibling_rect.mBottom) * mouse_dir.mY <= 0) | ||
2174 | // { | ||
2175 | // view_rect.translate(0, sibling_rect.mBottom - view_rect.mTop); | ||
2176 | // if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= x_threshold && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0) | ||
2177 | // { | ||
2178 | // view_rect.translate(sibling_rect.mLeft - test_rect.mLeft, 0); | ||
2179 | // x_threshold = llabs(test_rect.mLeft - sibling_rect.mLeft); | ||
2180 | // } | ||
2181 | // else if (llabs(test_rect.mRight - sibling_rect.mRight) <= x_threshold && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0) | ||
2182 | // { | ||
2183 | // view_rect.translate(sibling_rect.mRight - test_rect.mRight, 0); | ||
2184 | // x_threshold = llabs(test_rect.mRight - sibling_rect.mRight); | ||
2185 | // } | ||
2186 | // snap_view = siblingp; | ||
2187 | // y_threshold = llabs(test_rect.mTop - sibling_rect.mBottom); | ||
2188 | // } | ||
2189 | // } | ||
2190 | //} | ||
2191 | |||
2192 | //// shrink actual view rect back down | ||
2193 | //view_rect.stretch(-padding); | ||
2194 | //new_rect = view_rect; | ||
2195 | //return snap_view; | ||
2196 | } | 2076 | } |
2197 | 2077 | ||
2198 | LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding) | 2078 | LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding) |