Merge branch 'ryzom/ui/improvements' into yubo

fix_opengl_on_mac
Ulukyn 5 years ago
commit a3db3c6ba6

@ -271,7 +271,6 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item)
string IconText; string IconText;
if(!item.getValueByName (IconText, "3d.text overlay")) if(!item.getValueByName (IconText, "3d.text overlay"))
debug("key '3d.text overlay' not found."); debug("key '3d.text overlay' not found.");
IconText = toLower(IconText);
IdIconText = ClientSheetsStrings.add(IconText); IdIconText = ClientSheetsStrings.add(IconText);
// See if this item can be hiden when equipped // See if this item can be hiden when equipped

@ -131,7 +131,6 @@ void COutpostBuildingSheet::build(const NLGEORGES::UFormElm &root)
string IconText; string IconText;
if(!root.getValueByName (IconText, "text overlay")) if(!root.getValueByName (IconText, "text overlay"))
debug("key 'text overlay' not found."); debug("key 'text overlay' not found.");
IconText = toLower(IconText);
IdIconText = ClientSheetsStrings.add(IconText); IdIconText = ClientSheetsStrings.add(IconText);
} }

@ -1300,10 +1300,10 @@ void CDBCtrlSheet::setupItem ()
// special icon text // special icon text
if( _NeedSetup || _ItemSheet->getIconText() != _OptString ) 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(); _OptString= _ItemSheet->getIconText();
// Display Top Left // Display Top Left
setupCharBitmaps(40, 1, 6, true); setupCharBitmaps(40-2, 1, true);
} }
// Special Item requirement // Special Item requirement
@ -1417,8 +1417,8 @@ void CDBCtrlSheet::setupMacro()
{ {
if (!_NeedSetup) return; if (!_NeedSetup) return;
// compute from OptString // compute from OptString (-2 for padding)
setupCharBitmaps(26, 4, 5); setupCharBitmaps(26-2, 4);
_NeedSetup = false; _NeedSetup = false;
@ -1720,8 +1720,8 @@ void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector<NLMISC::CSheetId> &bri
{ {
// recompute text // recompute text
_OptString= iconName; _OptString= iconName;
// compute from OptString. Allow only 1 line and 5 chars // compute from OptString. Allow only 1 line (-2 for padding)
setupCharBitmaps(26, 1, 5); setupCharBitmaps(26-2, 1);
} }
} }
} }
@ -1847,10 +1847,10 @@ void CDBCtrlSheet::setupOutpostBuilding()
// special icon text // special icon text
if (pOBSheet->getIconText() != _OptString) 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(); _OptString= pOBSheet->getIconText();
// Display Top Left // Display Top Left
setupCharBitmaps(40, 1, 6, true); setupCharBitmaps(40-2, 1, true);
} }
} }
else 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(); _CharBitmaps.clear();
if(maxLine<=0) return;
if(maxLine<=0) std::string text(_OptString);
return; // 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'); uint h = rVR.getTypoTextureH('a');
sint lineNb = 0; sint lineNb = 0;
sint curLineSize = 0; sint curLineSize = 0;
uint i; uint i;
uint xChar= 0; 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); sint32 w = rVR.getTypoTextureW(c);
if ((curLineSize + w) > maxW || (sint32)xChar>=maxWChar) if ((curLineSize + w) > maxW)
{ {
lineNb ++; lineNb ++;
if (lineNb == maxLine) break; if (lineNb == maxLine) break;

@ -815,7 +815,7 @@ private:
// remove enchant and buff markers from item icon // remove enchant and buff markers from item icon
void clearIconBuffs(); 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 resetCharBitmaps();
void displayCharBitmaps(sint32 rdrLayer, sint32 x, sint32 y, NLMISC::CRGBA color); void displayCharBitmaps(sint32 rdrLayer, sint32 x, sint32 y, NLMISC::CRGBA color);

@ -437,6 +437,7 @@ CGroupMap::CGroupMap(const TCtorParam &param)
_HomeLM = NULL; _HomeLM = NULL;
_LandmarkFilter.clear(); _LandmarkFilter.clear();
_MatchedLandmarks.clear(); _MatchedLandmarks.clear();
_UserLandMarkVisible = true;
// //
_ScaleMax = 8.f; _ScaleMax = 8.f;
_ScaleMaxR2 = 8.f; _ScaleMaxR2 = 8.f;
@ -2626,7 +2627,11 @@ void CGroupMap::createContinentLandMarks()
CLandMarkOptions options = getUserLandMarkOptions(k); CLandMarkOptions options = getUserLandMarkOptions(k);
addLandMark(_UserLM, mapPos, _CurContinent->UserLandMarks[k].Title, options); 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)) if (filterLandmark(_CurContinent->UserLandMarks[k].Title))
{ {
@ -2700,7 +2705,7 @@ void CGroupMap::updateUserLandMarks()
addLandMark(_UserLM, mapPos, _CurContinent->UserLandMarks[k].Title, getUserLandMarkOptions(k)); addLandMark(_UserLM, mapPos, _CurContinent->UserLandMarks[k].Title, getUserLandMarkOptions(k));
// hide landmark if not matching filter // hide landmark if not matching filter
if (!filterLandmark(_CurContinent->UserLandMarks[k].Title)) if (!_UserLandMarkVisible || !filterLandmark(_CurContinent->UserLandMarks[k].Title))
_UserLM.back()->setActive(false); _UserLM.back()->setActive(false);
} }
invalidateCoords(); 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() void CGroupMap::updatePlayerPos()
@ -3765,6 +3779,9 @@ void CGroupMap::updateClosestLandMarkMenu(const std::string &menu, const NLMISC:
// no continent selected (ie world map view) // no continent selected (ie world map view)
if (!_CurContinent) return; if (!_CurContinent) return;
// user markers not visible
if (!_UserLandMarkVisible) return;
// sort landmarks, keep indices // sort landmarks, keep indices
typedef std::pair<uint, float> TSortedDistPair; typedef std::pair<uint, float> TSortedDistPair;
std::vector<TSortedDistPair> sortedIndices; std::vector<TSortedDistPair> sortedIndices;
@ -4317,6 +4334,33 @@ NLMISC_COMMAND( setMap, "Change the map", "" )
return true; 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<CGroupMap*>(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 // // DEBUG COMMANDS //
//////////////////// ////////////////////

@ -299,6 +299,10 @@ public:
void updateClosestLandMarkMenu(const std::string &menu, const NLMISC::CVector2f &pos) const; 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: private:
// A non rectangular button to click on zone of the map // A non rectangular button to click on zone of the map
@ -473,6 +477,9 @@ private:
// LANDMARKS // // LANDMARKS //
/////////////// ///////////////
// if false, user landmarks are not drawn
bool _UserLandMarkVisible;
// landmarks of continent // landmarks of continent
TLandMarkButtonVect _ContinentLM; TLandMarkButtonVect _ContinentLM;
TLandMarkTextVect _ContinentText; TLandMarkTextVect _ContinentText;

Loading…
Cancel
Save