diff --git a/code/nel/include/nel/gui/group_paragraph.h b/code/nel/include/nel/gui/group_paragraph.h index b8792ece1..0004850fa 100644 --- a/code/nel/include/nel/gui/group_paragraph.h +++ b/code/nel/include/nel/gui/group_paragraph.h @@ -206,12 +206,6 @@ namespace NLGUI invalidateContent(); } - // Set the HTML group used for links - void setBrowseGroup (CInterfaceElement *group) - { - _BrowseGroup = group; - } - /// \from CInterfaceElement void onInvalidateContent(); sint32 getMaxUsedW() const; @@ -293,9 +287,6 @@ namespace NLGUI // The links std::vector _Links; - // The HTML group used - CInterfaceElement *_BrowseGroup; - private: std::string _HardText; uint32 _TextId; diff --git a/code/nel/include/nel/gui/view_link.h b/code/nel/include/nel/gui/view_link.h index 1cc40a883..0fbca1065 100644 --- a/code/nel/include/nel/gui/view_link.h +++ b/code/nel/include/nel/gui/view_link.h @@ -50,10 +50,21 @@ namespace NLGUI void setHTMLView( CGroupHTML *html); bool getMouseOverShape(std::string &texName, uint8 &rot, NLMISC::CRGBA &col); + void setActionOnLeftClick(const std::string &actionHandler) { _AHOnLeftClick = actionHandler; }; + void setParamsOnLeftClick(const std::string &actionParams) { _AHOnLeftClickParams = actionParams; }; + + const std::string &getActionOnLeftClick() const { return _AHOnLeftClick; } + const std::string &getParamsOnLeftClick() const { return _AHOnLeftClickParams; } protected: // The main HTML group CGroupHTML *HTML; + + // Left mouse click action + // Don't use CStringShared as URLs change past values would be permanently remembered. + std::string _AHOnLeftClick; + std::string _AHOnLeftClickParams; + }; } diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 8ec1a6651..a3cfd514f 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -3773,7 +3773,6 @@ namespace NLGUI CGroupParagraph *newParagraph = new CGroupParagraph(CViewBase::TCtorParam()); newParagraph->setResizeFromChildH(true); - newParagraph->setBrowseGroup (this); newParagraph->setIndent(_Indent); // Add to the group @@ -4127,6 +4126,9 @@ namespace NLGUI if (!newLink->Link.empty()) { newLink->setHTMLView (this); + + newLink->setActionOnLeftClick("browse"); + newLink->setParamsOnLeftClick("name=" + getId() + "|url=" + newLink->Link); } } newLink->setText(tmpStr); diff --git a/code/nel/src/gui/group_paragraph.cpp b/code/nel/src/gui/group_paragraph.cpp index b0c8a8167..b2635b52e 100644 --- a/code/nel/src/gui/group_paragraph.cpp +++ b/code/nel/src/gui/group_paragraph.cpp @@ -59,7 +59,6 @@ namespace NLGUI _TopSpace = 0; _Indent = 0; _FirstViewIndentView = false; - _BrowseGroup = NULL; _TextId = 0; } @@ -868,11 +867,8 @@ namespace NLGUI ctrl->setParentPosRef (Hotspot_TL); ctrl->setPosRef (Hotspot_TL); ctrl->setActive(true); - if (_BrowseGroup) - { - ctrl->setActionOnLeftClick("browse"); - ctrl->setParamsOnLeftClick("name="+_BrowseGroup->getId()+"|url="+link.Link->Link); - } + ctrl->setActionOnLeftClick(link.Link->getActionOnLeftClick()); + ctrl->setParamsOnLeftClick(link.Link->getParamsOnLeftClick()); ctrl->setScale(true); addCtrl(ctrl); }