diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/llworldmapview.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/newview/llworldmapview.cpp')
-rw-r--r-- | linden/indra/newview/llworldmapview.cpp | 89 |
1 files changed, 42 insertions, 47 deletions
diff --git a/linden/indra/newview/llworldmapview.cpp b/linden/indra/newview/llworldmapview.cpp index a9e1061..92d9588 100644 --- a/linden/indra/newview/llworldmapview.cpp +++ b/linden/indra/newview/llworldmapview.cpp | |||
@@ -61,6 +61,7 @@ | |||
61 | #include "llviewerwindow.h" | 61 | #include "llviewerwindow.h" |
62 | #include "llworldmap.h" | 62 | #include "llworldmap.h" |
63 | #include "llappviewer.h" // Only for constants! | 63 | #include "llappviewer.h" // Only for constants! |
64 | #include "lltrans.h" | ||
64 | 65 | ||
65 | #include "llglheaders.h" | 66 | #include "llglheaders.h" |
66 | 67 | ||
@@ -98,6 +99,7 @@ S32 LLWorldMapView::sTrackingArrowY = 0; | |||
98 | F32 LLWorldMapView::sPixelsPerMeter = 1.f; | 99 | F32 LLWorldMapView::sPixelsPerMeter = 1.f; |
99 | F32 CONE_SIZE = 0.6f; | 100 | F32 CONE_SIZE = 0.6f; |
100 | 101 | ||
102 | std::map<std::string,std::string> LLWorldMapView::sStringsMap; | ||
101 | 103 | ||
102 | #define SIM_NULL_MAP_SCALE 1 // width in pixels, where we start drawing "null" sims | 104 | #define SIM_NULL_MAP_SCALE 1 // width in pixels, where we start drawing "null" sims |
103 | #define SIM_MAP_AGENT_SCALE 2 // width in pixels, where we start drawing agents | 105 | #define SIM_MAP_AGENT_SCALE 2 // width in pixels, where we start drawing agents |
@@ -126,6 +128,9 @@ void LLWorldMapView::initClass() | |||
126 | sTrackArrowImage = LLUI::getUIImage("direction_arrow.tga"); | 128 | sTrackArrowImage = LLUI::getUIImage("direction_arrow.tga"); |
127 | sClassifiedsImage = LLUI::getUIImage("icon_top_pick.tga"); | 129 | sClassifiedsImage = LLUI::getUIImage("icon_top_pick.tga"); |
128 | sForSaleImage = LLUI::getUIImage("icon_for_sale.tga"); | 130 | sForSaleImage = LLUI::getUIImage("icon_for_sale.tga"); |
131 | |||
132 | sStringsMap["loading"] = LLTrans::getString("texture_loading"); | ||
133 | sStringsMap["offline"] = LLTrans::getString("worldmap_offline"); | ||
129 | } | 134 | } |
130 | 135 | ||
131 | // static | 136 | // static |
@@ -167,40 +172,40 @@ LLWorldMapView::LLWorldMapView(const std::string& name, const LLRect& rect ) | |||
167 | const S32 DIR_HEIGHT = 10; | 172 | const S32 DIR_HEIGHT = 10; |
168 | LLRect major_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH, 0 ); | 173 | LLRect major_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH, 0 ); |
169 | 174 | ||
170 | mTextBoxNorth = new LLTextBox( "N", major_dir_rect ); | 175 | mTextBoxNorth = new LLTextBox( std::string("N"), major_dir_rect ); |
171 | addChild( mTextBoxNorth ); | 176 | addChild( mTextBoxNorth ); |
172 | 177 | ||
173 | LLColor4 minor_color( 1.f, 1.f, 1.f, .7f ); | 178 | LLColor4 minor_color( 1.f, 1.f, 1.f, .7f ); |
174 | 179 | ||
175 | mTextBoxEast = new LLTextBox( "E", major_dir_rect ); | 180 | mTextBoxEast = new LLTextBox( std::string("E"), major_dir_rect ); |
176 | mTextBoxEast->setColor( minor_color ); | 181 | mTextBoxEast->setColor( minor_color ); |
177 | addChild( mTextBoxEast ); | 182 | addChild( mTextBoxEast ); |
178 | 183 | ||
179 | major_dir_rect.mRight += 1 ; | 184 | major_dir_rect.mRight += 1 ; |
180 | mTextBoxWest = new LLTextBox( "W", major_dir_rect ); | 185 | mTextBoxWest = new LLTextBox( std::string("W"), major_dir_rect ); |
181 | mTextBoxWest->setColor( minor_color ); | 186 | mTextBoxWest->setColor( minor_color ); |
182 | addChild( mTextBoxWest ); | 187 | addChild( mTextBoxWest ); |
183 | major_dir_rect.mRight -= 1 ; | 188 | major_dir_rect.mRight -= 1 ; |
184 | 189 | ||
185 | mTextBoxSouth = new LLTextBox( "S", major_dir_rect ); | 190 | mTextBoxSouth = new LLTextBox( std::string("S"), major_dir_rect ); |
186 | mTextBoxSouth->setColor( minor_color ); | 191 | mTextBoxSouth->setColor( minor_color ); |
187 | addChild( mTextBoxSouth ); | 192 | addChild( mTextBoxSouth ); |
188 | 193 | ||
189 | LLRect minor_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH * 2, 0 ); | 194 | LLRect minor_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH * 2, 0 ); |
190 | 195 | ||
191 | mTextBoxSouthEast = new LLTextBox( "SE", minor_dir_rect ); | 196 | mTextBoxSouthEast = new LLTextBox( std::string("SE"), minor_dir_rect ); |
192 | mTextBoxSouthEast->setColor( minor_color ); | 197 | mTextBoxSouthEast->setColor( minor_color ); |
193 | addChild( mTextBoxSouthEast ); | 198 | addChild( mTextBoxSouthEast ); |
194 | 199 | ||
195 | mTextBoxNorthEast = new LLTextBox( "NE", minor_dir_rect ); | 200 | mTextBoxNorthEast = new LLTextBox( std::string("NE"), minor_dir_rect ); |
196 | mTextBoxNorthEast->setColor( minor_color ); | 201 | mTextBoxNorthEast->setColor( minor_color ); |
197 | addChild( mTextBoxNorthEast ); | 202 | addChild( mTextBoxNorthEast ); |
198 | 203 | ||
199 | mTextBoxSouthWest = new LLTextBox( "SW", minor_dir_rect ); | 204 | mTextBoxSouthWest = new LLTextBox( std::string("SW"), minor_dir_rect ); |
200 | mTextBoxSouthWest->setColor( minor_color ); | 205 | mTextBoxSouthWest->setColor( minor_color ); |
201 | addChild( mTextBoxSouthWest ); | 206 | addChild( mTextBoxSouthWest ); |
202 | 207 | ||
203 | mTextBoxNorthWest = new LLTextBox( "NW", minor_dir_rect ); | 208 | mTextBoxNorthWest = new LLTextBox( std::string("NW"), minor_dir_rect ); |
204 | mTextBoxNorthWest->setColor( minor_color ); | 209 | mTextBoxNorthWest->setColor( minor_color ); |
205 | addChild( mTextBoxNorthWest ); | 210 | addChild( mTextBoxNorthWest ); |
206 | } | 211 | } |
@@ -620,33 +625,31 @@ void LLWorldMapView::draw() | |||
620 | // Draw the region name in the lower left corner | 625 | // Draw the region name in the lower left corner |
621 | LLFontGL* font = LLFontGL::sSansSerifSmall; | 626 | LLFontGL* font = LLFontGL::sSansSerifSmall; |
622 | 627 | ||
623 | char mesg[MAX_STRING]; /* Flawfinder: ignore */ | 628 | std::string mesg; |
624 | if (gMapScale < sThresholdA) | 629 | if (gMapScale < sThresholdA) |
625 | { | 630 | { |
626 | mesg[0] = '\0'; | ||
627 | } | 631 | } |
628 | else if (gMapScale < sThresholdB) | 632 | else if (gMapScale < sThresholdB) |
629 | { | 633 | { |
630 | //sprintf(mesg, "%d", info->mAgents); | 634 | // mesg = llformat( info->mAgents); |
631 | mesg[0] = '\0'; | ||
632 | } | 635 | } |
633 | else | 636 | else |
634 | { | 637 | { |
635 | //sprintf(mesg, "%d / %s (%s)", | 638 | //mesg = llformat("%d / %s (%s)", |
636 | // info->mAgents, | 639 | // info->mAgents, |
637 | // info->mName.c_str(), | 640 | // info->mName.c_str(), |
638 | // LLViewerRegion::accessToShortString(info->mAccess) ); | 641 | // LLViewerRegion::accessToShortString(info->mAccess).c_str() ); |
639 | if (info->mAccess == SIM_ACCESS_DOWN) | 642 | if (info->mAccess == SIM_ACCESS_DOWN) |
640 | { | 643 | { |
641 | snprintf(mesg, MAX_STRING, "%s (Offline)", info->mName.c_str()); /* Flawfinder: ignore */ | 644 | mesg = llformat( "%s (%s)", info->mName.c_str(), sStringsMap["offline"].c_str()); |
642 | } | 645 | } |
643 | else | 646 | else |
644 | { | 647 | { |
645 | snprintf(mesg, MAX_STRING, "%s", info->mName.c_str()); /* Flawfinder: ignore */ | 648 | mesg = info->mName; |
646 | } | 649 | } |
647 | } | 650 | } |
648 | 651 | ||
649 | if (mesg[0] != '\0') | 652 | if (!mesg.empty()) |
650 | { | 653 | { |
651 | font->renderUTF8( | 654 | font->renderUTF8( |
652 | mesg, 0, | 655 | mesg, 0, |
@@ -656,6 +659,21 @@ void LLWorldMapView::draw() | |||
656 | LLFontGL::LEFT, | 659 | LLFontGL::LEFT, |
657 | LLFontGL::BASELINE, | 660 | LLFontGL::BASELINE, |
658 | LLFontGL::DROP_SHADOW); | 661 | LLFontGL::DROP_SHADOW); |
662 | |||
663 | // If map texture is still loading, | ||
664 | // display "Loading" placeholder text. | ||
665 | if (simimage->getDiscardLevel() != 1 && | ||
666 | simimage->getDiscardLevel() != 0) | ||
667 | { | ||
668 | font->renderUTF8( | ||
669 | sStringsMap["loading"], 0, | ||
670 | llfloor(left + 18), | ||
671 | llfloor(top - 25), | ||
672 | LLColor4::white, | ||
673 | LLFontGL::LEFT, | ||
674 | LLFontGL::BASELINE, | ||
675 | LLFontGL::DROP_SHADOW); | ||
676 | } | ||
659 | } | 677 | } |
660 | } | 678 | } |
661 | #endif | 679 | #endif |
@@ -699,11 +717,6 @@ void LLWorldMapView::draw() | |||
699 | drawGenericItems(LLWorldMap::getInstance()->mLandForSale, sForSaleImage); | 717 | drawGenericItems(LLWorldMap::getInstance()->mLandForSale, sForSaleImage); |
700 | } | 718 | } |
701 | 719 | ||
702 | if (gSavedSettings.getBOOL("MapShowClassifieds")) | ||
703 | { | ||
704 | drawGenericItems(LLWorldMap::getInstance()->mClassifieds, sClassifiedsImage); | ||
705 | } | ||
706 | |||
707 | if (gSavedSettings.getBOOL("MapShowEvents")) | 720 | if (gSavedSettings.getBOOL("MapShowEvents")) |
708 | { | 721 | { |
709 | drawEvents(); | 722 | drawEvents(); |
@@ -997,8 +1010,8 @@ LLVector3 LLWorldMapView::globalPosToView( const LLVector3d& global_pos ) | |||
997 | } | 1010 | } |
998 | 1011 | ||
999 | 1012 | ||
1000 | void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& color, | 1013 | void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& color, BOOL draw_arrow, |
1001 | BOOL draw_arrow, LLString label, LLString tooltip, S32 vert_offset ) | 1014 | const std::string& label, const std::string& tooltip, S32 vert_offset ) |
1002 | { | 1015 | { |
1003 | LLVector3 pos_local = globalPosToView( pos_global ); | 1016 | LLVector3 pos_local = globalPosToView( pos_global ); |
1004 | S32 x = llround( pos_local.mV[VX] ); | 1017 | S32 x = llround( pos_local.mV[VX] ); |
@@ -1088,7 +1101,7 @@ LLVector3d LLWorldMapView::viewPosToGlobal( S32 x, S32 y ) | |||
1088 | } | 1101 | } |
1089 | 1102 | ||
1090 | 1103 | ||
1091 | BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen ) | 1104 | BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ) |
1092 | { | 1105 | { |
1093 | LLVector3d pos_global = viewPosToGlobal(x, y); | 1106 | LLVector3d pos_global = viewPosToGlobal(x, y); |
1094 | 1107 | ||
@@ -1100,7 +1113,7 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_ | |||
1100 | std::string message = | 1113 | std::string message = |
1101 | llformat("%s (%s)", | 1114 | llformat("%s (%s)", |
1102 | info->mName.c_str(), | 1115 | info->mName.c_str(), |
1103 | LLViewerRegion::accessToString(info->mAccess)); | 1116 | LLViewerRegion::accessToString(info->mAccess).c_str()); |
1104 | 1117 | ||
1105 | if (info->mAccess != SIM_ACCESS_DOWN) | 1118 | if (info->mAccess != SIM_ACCESS_DOWN) |
1106 | { | 1119 | { |
@@ -1531,10 +1544,6 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, | |||
1531 | { | 1544 | { |
1532 | (*it).mSelected = FALSE; | 1545 | (*it).mSelected = FALSE; |
1533 | } | 1546 | } |
1534 | for (it = LLWorldMap::getInstance()->mClassifieds.begin(); it != LLWorldMap::getInstance()->mClassifieds.end(); ++it) | ||
1535 | { | ||
1536 | (*it).mSelected = FALSE; | ||
1537 | } | ||
1538 | 1547 | ||
1539 | // Select event you clicked on | 1548 | // Select event you clicked on |
1540 | if (gSavedSettings.getBOOL("MapShowEvents")) | 1549 | if (gSavedSettings.getBOOL("MapShowEvents")) |
@@ -1583,21 +1592,6 @@ void LLWorldMapView::handleClick(S32 x, S32 y, MASK mask, | |||
1583 | } | 1592 | } |
1584 | } | 1593 | } |
1585 | 1594 | ||
1586 | if (gSavedSettings.getBOOL("MapShowClassifieds")) | ||
1587 | { | ||
1588 | for (it = LLWorldMap::getInstance()->mClassifieds.begin(); it != LLWorldMap::getInstance()->mClassifieds.end(); ++it) | ||
1589 | { | ||
1590 | LLItemInfo& classified = *it; | ||
1591 | |||
1592 | if (checkItemHit(x, y, classified, id, true)) | ||
1593 | { | ||
1594 | *hit_type = MAP_ITEM_CLASSIFIED; | ||
1595 | mItemPicked = TRUE; | ||
1596 | return; | ||
1597 | } | ||
1598 | } | ||
1599 | } | ||
1600 | |||
1601 | // If we get here, we haven't clicked on an icon | 1595 | // If we get here, we haven't clicked on an icon |
1602 | 1596 | ||
1603 | gFloaterWorldMap->trackLocation(pos_global); | 1597 | gFloaterWorldMap->trackLocation(pos_global); |
@@ -1764,10 +1758,11 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask ) | |||
1764 | { | 1758 | { |
1765 | gFloaterWorldMap->close(); | 1759 | gFloaterWorldMap->close(); |
1766 | // This is an ungainly hack | 1760 | // This is an ungainly hack |
1767 | char uuid_str[38]; /* Flawfinder: ignore */ | 1761 | std::string uuid_str; |
1768 | S32 event_id; | 1762 | S32 event_id; |
1769 | id.toString(uuid_str); | 1763 | id.toString(uuid_str); |
1770 | sscanf(&uuid_str[28], "%X", &event_id); | 1764 | uuid_str = uuid_str.substr(28); |
1765 | sscanf(uuid_str.c_str(), "%X", &event_id); | ||
1771 | LLFloaterDirectory::showEvents(event_id); | 1766 | LLFloaterDirectory::showEvents(event_id); |
1772 | break; | 1767 | break; |
1773 | } | 1768 | } |