diff options
Diffstat (limited to 'linden/indra/llui')
-rw-r--r-- | linden/indra/llui/llbutton.cpp | 1 | ||||
-rw-r--r-- | linden/indra/llui/llui.cpp | 36 | ||||
-rw-r--r-- | linden/indra/llui/llui.h | 19 | ||||
-rw-r--r-- | linden/indra/llui/lluictrlfactory.cpp | 10 | ||||
-rw-r--r-- | linden/indra/llui/llview.cpp | 156 |
5 files changed, 58 insertions, 164 deletions
diff --git a/linden/indra/llui/llbutton.cpp b/linden/indra/llui/llbutton.cpp index 508500a..6402985 100644 --- a/linden/indra/llui/llbutton.cpp +++ b/linden/indra/llui/llbutton.cpp | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "llstring.h" | 38 | #include "llstring.h" |
39 | 39 | ||
40 | // Project includes | 40 | // Project includes |
41 | #include "llhtmlhelp.h" | ||
41 | #include "llkeyboard.h" | 42 | #include "llkeyboard.h" |
42 | #include "llui.h" | 43 | #include "llui.h" |
43 | #include "lluiconstants.h" | 44 | #include "lluiconstants.h" |
diff --git a/linden/indra/llui/llui.cpp b/linden/indra/llui/llui.cpp index 5502246..4817d78 100644 --- a/linden/indra/llui/llui.cpp +++ b/linden/indra/llui/llui.cpp | |||
@@ -30,8 +30,6 @@ | |||
30 | */ | 30 | */ |
31 | 31 | ||
32 | // Utilities functions the user interface needs | 32 | // Utilities functions the user interface needs |
33 | |||
34 | //#include "llviewerprecompiledheaders.h" | ||
35 | #include "linden_common.h" | 33 | #include "linden_common.h" |
36 | 34 | ||
37 | #include <string> | 35 | #include <string> |
@@ -1647,6 +1645,34 @@ void LLUI::setCursorPositionLocal(const LLView* viewp, S32 x, S32 y) | |||
1647 | setCursorPositionScreen(screen_x, screen_y); | 1645 | setCursorPositionScreen(screen_x, screen_y); |
1648 | } | 1646 | } |
1649 | 1647 | ||
1648 | // On Windows, the user typically sets the language when they install the | ||
1649 | // app (by running it with a shortcut that sets InstallLanguage). On Mac, | ||
1650 | // or on Windows if the SecondLife.exe executable is run directly, the | ||
1651 | // language follows the OS language. In all cases the user can override | ||
1652 | // the language manually in preferences. JC | ||
1653 | // static | ||
1654 | std::string LLUI::getLanguage() | ||
1655 | { | ||
1656 | std::string language = "en-us"; | ||
1657 | if (sConfigGroup) | ||
1658 | { | ||
1659 | language = sConfigGroup->getString("Language"); | ||
1660 | if (language.empty() || language == "default") | ||
1661 | { | ||
1662 | language = sConfigGroup->getString("InstallLanguage"); | ||
1663 | } | ||
1664 | if (language.empty() || language == "default") | ||
1665 | { | ||
1666 | language = sConfigGroup->getString("SystemLanguage"); | ||
1667 | } | ||
1668 | if (language.empty() || language == "default") | ||
1669 | { | ||
1670 | language = "en-us"; | ||
1671 | } | ||
1672 | } | ||
1673 | return language; | ||
1674 | } | ||
1675 | |||
1650 | //static | 1676 | //static |
1651 | std::string LLUI::locateSkin(const std::string& filename) | 1677 | std::string LLUI::locateSkin(const std::string& filename) |
1652 | { | 1678 | { |
@@ -1660,11 +1686,7 @@ std::string LLUI::locateSkin(const std::string& filename) | |||
1660 | { | 1686 | { |
1661 | if (!gDirUtilp->fileExists(found_file)) | 1687 | if (!gDirUtilp->fileExists(found_file)) |
1662 | { | 1688 | { |
1663 | std::string localization(sConfigGroup->getString("Language")); | 1689 | std::string localization = getLanguage(); |
1664 | if(localization == "default") | ||
1665 | { | ||
1666 | localization = sConfigGroup->getString("SystemLanguage"); | ||
1667 | } | ||
1668 | std::string local_skin = "xui" + slash + localization + slash + filename; | 1690 | std::string local_skin = "xui" + slash + localization + slash + filename; |
1669 | found_file = gDirUtilp->findSkinnedFilename(local_skin); | 1691 | found_file = gDirUtilp->findSkinnedFilename(local_skin); |
1670 | } | 1692 | } |
diff --git a/linden/indra/llui/llui.h b/linden/indra/llui/llui.h index 4c1bb22..0f498d3 100644 --- a/linden/indra/llui/llui.h +++ b/linden/indra/llui/llui.h | |||
@@ -38,15 +38,17 @@ | |||
38 | #include "llcontrol.h" | 38 | #include "llcontrol.h" |
39 | #include "llrect.h" | 39 | #include "llrect.h" |
40 | #include "llcoord.h" | 40 | #include "llcoord.h" |
41 | #include "llhtmlhelp.h" | 41 | //#include "llhtmlhelp.h" |
42 | #include "llgl.h" | 42 | #include "llgl.h" // *TODO: break this dependency |
43 | #include <stack> | 43 | #include <stack> |
44 | #include "llimagegl.h" | 44 | //#include "llimagegl.h" |
45 | 45 | ||
46 | // LLUIFactory | 46 | // LLUIFactory |
47 | #include "llsd.h" | 47 | #include "llsd.h" |
48 | 48 | ||
49 | class LLColor4; | 49 | class LLColor4; |
50 | class LLHtmlHelp; | ||
51 | class LLImageGL; | ||
50 | class LLVector3; | 52 | class LLVector3; |
51 | class LLVector2; | 53 | class LLVector2; |
52 | class LLUUID; | 54 | class LLUUID; |
@@ -139,13 +141,6 @@ inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL | |||
139 | gl_rect_2d_offset_local( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, pixel_offset, filled ); | 141 | gl_rect_2d_offset_local( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, pixel_offset, filled ); |
140 | } | 142 | } |
141 | 143 | ||
142 | // No longer used | ||
143 | // Initializes translation table | ||
144 | // void init_tr(); | ||
145 | |||
146 | // Returns a string from the string table in the correct language | ||
147 | // std::string tr(const std::string& english_chars); | ||
148 | |||
149 | // Used to hide the flashing text cursor when window doesn't have focus. | 144 | // Used to hide the flashing text cursor when window doesn't have focus. |
150 | extern BOOL gShowTextEditCursor; | 145 | extern BOOL gShowTextEditCursor; |
151 | 146 | ||
@@ -172,6 +167,10 @@ public: | |||
172 | static void loadIdentity(); | 167 | static void loadIdentity(); |
173 | static void translate(F32 x, F32 y, F32 z = 0.0f); | 168 | static void translate(F32 x, F32 y, F32 z = 0.0f); |
174 | 169 | ||
170 | // Return the ISO639 language name ("en", "ko", etc.) for the viewer UI. | ||
171 | // http://www.loc.gov/standards/iso639-2/php/code_list.php | ||
172 | static std::string getLanguage(); | ||
173 | |||
175 | //helper functions (should probably move free standing rendering helper functions here) | 174 | //helper functions (should probably move free standing rendering helper functions here) |
176 | static std::string locateSkin(const std::string& filename); | 175 | static std::string locateSkin(const std::string& filename); |
177 | static void setCursorPositionScreen(S32 x, S32 y); | 176 | static void setCursorPositionScreen(S32 x, S32 y); |
diff --git a/linden/indra/llui/lluictrlfactory.cpp b/linden/indra/llui/lluictrlfactory.cpp index bcd4876..db52261 100644 --- a/linden/indra/llui/lluictrlfactory.cpp +++ b/linden/indra/llui/lluictrlfactory.cpp | |||
@@ -130,15 +130,7 @@ void LLUICtrlFactory::setupPaths() | |||
130 | for (path = root->getFirstChild(); path.notNull(); path = path->getNextSibling()) | 130 | for (path = root->getFirstChild(); path.notNull(); path = path->getNextSibling()) |
131 | { | 131 | { |
132 | LLUIString path_val_ui(path->getValue()); | 132 | LLUIString path_val_ui(path->getValue()); |
133 | std::string language = "en-us"; | 133 | std::string language = LLUI::getLanguage(); |
134 | if (LLUI::sConfigGroup) | ||
135 | { | ||
136 | language = LLUI::sConfigGroup->getString("Language"); | ||
137 | if(language == "default") | ||
138 | { | ||
139 | language = LLUI::sConfigGroup->getString("SystemLanguage"); | ||
140 | } | ||
141 | } | ||
142 | path_val_ui.setArg("[LANGUAGE]", language); | 134 | path_val_ui.setArg("[LANGUAGE]", language); |
143 | 135 | ||
144 | if (std::find(sXUIPaths.begin(), sXUIPaths.end(), path_val_ui.getString()) == sXUIPaths.end()) | 136 | if (std::find(sXUIPaths.begin(), sXUIPaths.end(), path_val_ui.getString()) == sXUIPaths.end()) |
diff --git a/linden/indra/llui/llview.cpp b/linden/indra/llui/llview.cpp index bc6fe7e..910b4f5 100644 --- a/linden/indra/llui/llview.cpp +++ b/linden/indra/llui/llview.cpp | |||
@@ -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 |
@@ -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) |