diff --git a/code/ryzom/client/src/client_sheets/item_sheet.cpp b/code/ryzom/client/src/client_sheets/item_sheet.cpp index b55382660..715fd4df0 100644 --- a/code/ryzom/client/src/client_sheets/item_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/item_sheet.cpp @@ -271,7 +271,6 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item) string IconText; if(!item.getValueByName (IconText, "3d.text overlay")) debug("key '3d.text overlay' not found."); - IconText = toLower(IconText); IdIconText = ClientSheetsStrings.add(IconText); // See if this item can be hiden when equipped diff --git a/code/ryzom/client/src/client_sheets/outpost_building_sheet.cpp b/code/ryzom/client/src/client_sheets/outpost_building_sheet.cpp index 841a57aad..db7e9e55a 100644 --- a/code/ryzom/client/src/client_sheets/outpost_building_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/outpost_building_sheet.cpp @@ -131,7 +131,6 @@ void COutpostBuildingSheet::build(const NLGEORGES::UFormElm &root) string IconText; if(!root.getValueByName (IconText, "text overlay")) debug("key 'text overlay' not found."); - IconText = toLower(IconText); IdIconText = ClientSheetsStrings.add(IconText); } diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 977bda672..4b0368ecd 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -1300,10 +1300,10 @@ void CDBCtrlSheet::setupItem () // special icon text if( _NeedSetup || _ItemSheet->getIconText() != _OptString ) { - // compute from OptString. Allow only 1 line and 4 chars + // compute from OptString. Allow only 1 line (-2 for padding) _OptString= _ItemSheet->getIconText(); // Display Top Left - setupCharBitmaps(40, 1, 6, true); + setupCharBitmaps(40-2, 1, true); } // Special Item requirement @@ -1417,8 +1417,8 @@ void CDBCtrlSheet::setupMacro() { if (!_NeedSetup) return; - // compute from OptString - setupCharBitmaps(26, 4, 5); + // compute from OptString (-2 for padding) + setupCharBitmaps(26-2, 4); _NeedSetup = false; @@ -1720,8 +1720,8 @@ void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector &bri { // recompute text _OptString= iconName; - // compute from OptString. Allow only 1 line and 5 chars - setupCharBitmaps(26, 1, 5); + // compute from OptString. Allow only 1 line (-2 for padding) + setupCharBitmaps(26-2, 1); } } } @@ -1847,10 +1847,10 @@ void CDBCtrlSheet::setupOutpostBuilding() // special icon text if (pOBSheet->getIconText() != _OptString) { - // compute from OptString. Allow only 1 line and 4 chars + // compute from OptString. Allow only 1 line, (-2 for padding) _OptString= pOBSheet->getIconText(); // Display Top Left - setupCharBitmaps(40, 1, 6, true); + setupCharBitmaps(40-2, 1, true); } } else @@ -1893,28 +1893,32 @@ void CDBCtrlSheet::resetCharBitmaps() } // *************************************************************************** -void CDBCtrlSheet::setupCharBitmaps(sint32 maxW, sint32 maxLine, sint32 maxWChar, bool topDown) +void CDBCtrlSheet::setupCharBitmaps(sint32 maxW, sint32 maxLine, bool topDown) { - // Use the optString for the Macro name - _OptString = toLower(_OptString); - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = *CViewRenderer::getInstance(); - _CharBitmaps.clear(); + if(maxLine<=0) return; - if(maxLine<=0) - return; + std::string text(_OptString); + // check for icon text 'uiitLabel' + if (text.size() > 4 && text[0] == 'u' && text[1] == 'i' && text[2] == 'i' && text[3] == 't' && CI18N::hasTranslation(text)) + { + // NOTE: translated text is expected to be us-ascii only + text = CI18N::get(text).toUtf8(); + } + text = toLower(text); + + CViewRenderer &rVR = *CViewRenderer::getInstance(); uint h = rVR.getTypoTextureH('a'); sint lineNb = 0; sint curLineSize = 0; uint i; uint xChar= 0; - for (i = 0; i < _OptString.size(); ++i) + for (i = 0; i < text.size(); ++i) { - char c = _OptString[i]; + char c = text[i]; sint32 w = rVR.getTypoTextureW(c); - if ((curLineSize + w) > maxW || (sint32)xChar>=maxWChar) + if ((curLineSize + w) > maxW) { lineNb ++; if (lineNb == maxLine) break; diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.h b/code/ryzom/client/src/interface_v3/dbctrl_sheet.h index 4abc16f4b..7de3dd03b 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -815,7 +815,7 @@ private: // remove enchant and buff markers from item icon void clearIconBuffs(); - void setupCharBitmaps(sint32 maxW, sint32 maxLine, sint32 maxWChar= 1000, bool topDown= false); + void setupCharBitmaps(sint32 maxW, sint32 maxLine, bool topDown= false); void resetCharBitmaps(); void displayCharBitmaps(sint32 rdrLayer, sint32 x, sint32 y, NLMISC::CRGBA color); diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index ca79111ad..a4773f17d 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -437,6 +437,7 @@ CGroupMap::CGroupMap(const TCtorParam ¶m) _HomeLM = NULL; _LandmarkFilter.clear(); _MatchedLandmarks.clear(); + _UserLandMarkVisible = true; // _ScaleMax = 8.f; _ScaleMaxR2 = 8.f; @@ -2626,7 +2627,11 @@ void CGroupMap::createContinentLandMarks() CLandMarkOptions options = getUserLandMarkOptions(k); addLandMark(_UserLM, mapPos, _CurContinent->UserLandMarks[k].Title, options); - if (_LandmarkFilter.size() > 0) + if (!_UserLandMarkVisible) + { + _UserLM.back()->setActive(false); + } + else if (_LandmarkFilter.size() > 0) { if (filterLandmark(_CurContinent->UserLandMarks[k].Title)) { @@ -2700,7 +2705,7 @@ void CGroupMap::updateUserLandMarks() addLandMark(_UserLM, mapPos, _CurContinent->UserLandMarks[k].Title, getUserLandMarkOptions(k)); // hide landmark if not matching filter - if (!filterLandmark(_CurContinent->UserLandMarks[k].Title)) + if (!_UserLandMarkVisible || !filterLandmark(_CurContinent->UserLandMarks[k].Title)) _UserLM.back()->setActive(false); } invalidateCoords(); @@ -2979,6 +2984,15 @@ CLandMarkOptions CGroupMap::getUserLandMarkOptions(uint32 lmindex) const } +//============================================================================================================ +void CGroupMap::setUserLandMarkVisible(bool state) +{ + if (_UserLandMarkVisible != state) + { + _UserLandMarkVisible = state; + updateUserLandMarks(); + } +} //============================================================================================================ void CGroupMap::updatePlayerPos() @@ -3765,6 +3779,9 @@ void CGroupMap::updateClosestLandMarkMenu(const std::string &menu, const NLMISC: // no continent selected (ie world map view) if (!_CurContinent) return; + // user markers not visible + if (!_UserLandMarkVisible) return; + // sort landmarks, keep indices typedef std::pair TSortedDistPair; std::vector sortedIndices; @@ -4317,6 +4334,33 @@ NLMISC_COMMAND( setMap, "Change the map", "" ) return true; } +//========================================================================================================= +// toggle user landmarks visibility +// no arguments - toggle show/hide +// 0 - hide +// 1 - show (any non "0" value) +NLMISC_COMMAND( showHideUserLandMark, "Show/Hide user landmarks", "0|1") +{ + const std::string mapId("ui:interface:map:content:map_content:actual_map"); + + CInterfaceManager *pIM = CInterfaceManager::getInstance(); + CGroupMap *map = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(mapId)); + if (!map) + { + nlwarning("Unable to find map element '%s'", mapId.c_str()); + return false; + } + + bool state; + if (args.size() == 0) + state = !map->getUserLandMarkVisible(); + else + state = !(args[0] == "0"); + + map->setUserLandMarkVisible(state); + return true; +} + //////////////////// // DEBUG COMMANDS // //////////////////// diff --git a/code/ryzom/client/src/interface_v3/group_map.h b/code/ryzom/client/src/interface_v3/group_map.h index 2bc112c5b..bc0cc2d6a 100644 --- a/code/ryzom/client/src/interface_v3/group_map.h +++ b/code/ryzom/client/src/interface_v3/group_map.h @@ -299,6 +299,10 @@ public: void updateClosestLandMarkMenu(const std::string &menu, const NLMISC::CVector2f &pos) const; + // show/hide all user landmarks + void setUserLandMarkVisible(bool state); + bool getUserLandMarkVisible() const { return _UserLandMarkVisible; }; + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private: // A non rectangular button to click on zone of the map @@ -473,6 +477,9 @@ private: // LANDMARKS // /////////////// + // if false, user landmarks are not drawn + bool _UserLandMarkVisible; + // landmarks of continent TLandMarkButtonVect _ContinentLM; TLandMarkTextVect _ContinentText;