diff --git a/code/nel/src/gui/group_editbox.cpp b/code/nel/src/gui/group_editbox.cpp
index e7ed22583..13979f4aa 100644
--- a/code/nel/src/gui/group_editbox.cpp
+++ b/code/nel/src/gui/group_editbox.cpp
@@ -1005,7 +1005,6 @@ namespace NLGUI
{
case KeyESCAPE:
_CurrentHistoricIndex= -1;
- CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
// stop selection
_CurrSelection = NULL;
_CursorAtPreviousLineEnd = false;
@@ -1014,6 +1013,7 @@ namespace NLGUI
setInputString(ucstring(""));
triggerOnChangeAH();
}
+ CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
break;
case KeyTAB:
makeTopWindow();
diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml b/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml
index 31a1a7099..2a8897555 100644
--- a/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml
+++ b/code/ryzom/client/data/gamedev/interfaces_v3/commands.xml
@@ -122,6 +122,9 @@
+
+
+
diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/map.xml b/code/ryzom/client/data/gamedev/interfaces_v3/map.xml
index 66d948e03..f2e90bbc0 100644
--- a/code/ryzom/client/data/gamedev/interfaces_v3/map.xml
+++ b/code/ryzom/client/data/gamedev/interfaces_v3/map.xml
@@ -25,6 +25,8 @@
+
+
@@ -144,6 +146,7 @@
+
@@ -155,7 +158,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -191,8 +236,10 @@
+
-
+
@@ -317,8 +364,39 @@
compass="ui:interface:compass"
/>
-
-
+
+
+
+
+
+
+
+
+
diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp
index 6160db539..a05a6f9bb 100644
--- a/code/ryzom/client/src/interface_v3/group_map.cpp
+++ b/code/ryzom/client/src/interface_v3/group_map.cpp
@@ -426,6 +426,8 @@ CGroupMap::CGroupMap(const TCtorParam ¶m)
//
_TargetLM = NULL;
_HomeLM = NULL;
+ _LandmarkFilter.clear();
+ _MatchedLandmarkCount = 0;
//
_ScaleMax = 8.f;
_ScaleMaxR2 = 8.f;
@@ -902,9 +904,19 @@ void CGroupMap::updateCoords()
// bool newLandMarkShown = false;
uint i;
for (i = 0; i < _ContinentLM.size(); ++i)
- setupFromZoom(_ContinentLM[i], _ContinentLM[i]->Type, _MeterPerPixel);
+ {
+ if (_ContinentLM[i]->SearchMatch)
+ _ContinentLM[i]->setActive(true);
+ else
+ setupFromZoom(_ContinentLM[i], _ContinentLM[i]->Type, _MeterPerPixel);
+ }
for (i = 0; i < _ContinentText.size(); ++i)
- setupFromZoom(_ContinentText[i], _ContinentText[i]->Type, _MeterPerPixel);
+ {
+ if (_ContinentText[i]->SearchMatch)
+ _ContinentText[i]->setActive(true);
+ else
+ setupFromZoom(_ContinentText[i], _ContinentText[i]->Type, _MeterPerPixel);
+ }
//
updateLandMarkList(_ContinentLM);
updateLandMarkTextList(_ContinentText);
@@ -2316,6 +2328,12 @@ void CGroupMap::createLMWidgets(const std::vector &lms)
worldToMap(mapPos, rCLM.Pos);
const ucstring ucsTmp(CStringManagerClient::getPlaceLocalizedName(rCLM.TitleTextID));
+ const ucstring lcTitle = toLower(ucsTmp);
+
+ bool searchMatch = _LandmarkFilter.size() > 0 && filterLandmark(lcTitle);
+ if (searchMatch)
+ _MatchedLandmarkCount++;
+
// Add button if not a region nor a place
if ((rCLM.Type != CContLandMark::Region) && (rCLM.Type != CContLandMark::Place) &&
(rCLM.Type != CContLandMark::Street))
@@ -2325,6 +2343,7 @@ void CGroupMap::createLMWidgets(const std::vector &lms)
else
addLandMark(_ContinentLM, mapPos, CI18N::get("uiStable"), _ContinentLMOptions);
_ContinentLM.back()->Type = rCLM.Type;
+ _ContinentLM.back()->SearchMatch = searchMatch;
}
else // just add a text
{
@@ -2343,6 +2362,7 @@ void CGroupMap::createLMWidgets(const std::vector &lms)
pNewText->setShadowColor(CRGBA(0,0,0,255));
pNewText->setModulateGlobalColor(false);
pNewText->Type = rCLM.Type;
+ pNewText->SearchMatch = searchMatch;
_ContinentText.push_back(pNewText);
addView(pNewText);
}
@@ -2372,6 +2392,8 @@ void CGroupMap::createContinentLandMarks()
{
uint32 k;
+ _MatchedLandmarkCount = 0;
+
if (_MapMode != MapMode_Normal) return;
if (_CurMap == NULL) return;
@@ -2403,8 +2425,24 @@ void CGroupMap::createContinentLandMarks()
NLMISC::CVector2f mapPos;
worldToMap(mapPos, _CurContinent->UserLandMarks[k].Pos);
- addLandMark(_UserLM, mapPos, _CurContinent->UserLandMarks[k].Title, getUserLandMarkOptions(k));
+ if (filterLandmark(_CurContinent->UserLandMarks[k].Title))
+ {
+ addLandMark(_UserLM, mapPos, _CurContinent->UserLandMarks[k].Title, getUserLandMarkOptions(k));
+ _MatchedLandmarkCount++;
+ }
}
+
+ // update visible landmark count
+ CInterfaceGroup *gc = getParentContainer();
+ if (gc)
+ {
+ CViewText *pVT = dynamic_cast(gc->getView("lm_count"));
+ if (pVT)
+ {
+ pVT->setText(toString(_MatchedLandmarkCount));
+ }
+ }
+
invalidateCoords();
}
@@ -2423,6 +2461,20 @@ static void hideTeleportButtonsInPopupMenuIfNotEnoughPriv()
if(ie) ie->setActive(showTeleport);
}
+//============================================================================================================
+void CGroupMap::setLandmarkFilter(const std::string &s)
+{
+ _LandmarkFilter.clear();
+
+ if (!s.empty()) {
+ ucstring ucs;
+ ucs.fromUtf8(s);
+ splitUCString(toLower(s), ucstring(" "), _LandmarkFilter);
+ }
+
+ // recreate landmarks
+ createContinentLandMarks();
+}
//============================================================================================================
void CGroupMap::updateUserLandMarks()
@@ -2484,6 +2536,22 @@ void CGroupMap::updateLandMarkButton(CLandMarkButton *lmb, const CLandMarkOption
lmb->setColorPushed(options.ColorPushed);
}
+//============================================================================================================
+bool CGroupMap::filterLandmark(const ucstring &title) const
+{
+ if (_LandmarkFilter.size() > 0)
+ {
+ ucstring lcTitle = toLower(title);
+ for(uint i = 0; i< _LandmarkFilter.size(); ++i) {
+ if (lcTitle.find(_LandmarkFilter[i]) == ucstring::npos) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
//============================================================================================================
void CGroupMap::addLandMark(TLandMarkButtonVect &destList, const NLMISC::CVector2f &pos, const ucstring &title, const CLandMarkOptions &options)
{
@@ -3161,6 +3229,32 @@ SMap *CGroupMap::getParentMap(SMap *map)
// ACTION HANDLERS //
/////////////////////
+//=========================================================================================================
+// Set landmark filter
+class CAHLandMarkFilter : public IActionHandler
+{
+ virtual void execute (CCtrlBase * /* pCaller */, const string ¶ms )
+ {
+ string id = getParam(params, "map");
+
+ CGroupMap* map = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id));
+ if (!map) return;
+
+ string text = getParam(params, "text");
+ if (text.empty() && params.find("text=") == std::string::npos)
+ {
+ string group = getParam(params, "group");
+ CGroupEditBox* eb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(group));
+ if (!eb) return;
+
+ text = eb->getInputString().toUtf8();
+ }
+
+ map->setLandmarkFilter(text);
+ }
+};
+REGISTER_ACTION_HANDLER(CAHLandMarkFilter, "land_mark_filter");
+
//=========================================================================================================
// A land mark button has been pushed
class CAHLandMarkSelected : public IActionHandler
diff --git a/code/ryzom/client/src/interface_v3/group_map.h b/code/ryzom/client/src/interface_v3/group_map.h
index a252bae11..bead3d20f 100644
--- a/code/ryzom/client/src/interface_v3/group_map.h
+++ b/code/ryzom/client/src/interface_v3/group_map.h
@@ -175,6 +175,9 @@ public:
//Remove and re-create UserLandMarks
void updateUserLandMarks();
+ // set landmarks visibility based text query
+ void setLandmarkFilter(const std::string &s);
+
// set the selection axis pos & visibility
void setSelectionAxis(bool active, const NLMISC::CVector2f &worldPos = NLMISC::CVector2f::Null);
@@ -262,6 +265,7 @@ private:
NLMISC::CVector2f Pos;
CContLandMark::TContLMType Type;
bool HandleEvents;
+ bool SearchMatch;
public:
virtual bool handleEvent (const NLGUI::CEventDescriptor& event)
{
@@ -279,6 +283,7 @@ private:
Type = CContLandMark::Unknown;
Pos.set(0.f, 0.f);
HandleEvents = true;
+ SearchMatch = false;
}
};
typedef std::vector TLandMarkButtonVect;
@@ -289,12 +294,14 @@ private:
public:
NLMISC::CVector2f Pos;
CContLandMark::TContLMType Type;
+ bool SearchMatch;
CLandMarkText(const TCtorParam ¶m)
: CViewText(param)
{
Type = CContLandMark::Unknown;
Pos.set(0.f, 0.f);
+ SearchMatch = false;
}
};
typedef std::vector TLandMarkTextVect;
@@ -448,6 +455,10 @@ private:
typedef std::set TDecos;
TDecos _Decos;
+ // filter keywords
+ std::vector _LandmarkFilter;
+ uint32 _MatchedLandmarkCount;
+
//////////////////////
// Respawn handling //
// //////////////// //
@@ -501,6 +512,9 @@ private:
// update a landmark button
void updateLandMarkButton(CLandMarkButton *lmb, const CLandMarkOptions &options);
+ // Test title against landmark filter
+ bool filterLandmark(const ucstring &title) const;
+
// update the scale depending on the window size and the user scale
void updateScale();