diff --git a/code/ryzom/client/src/far_tp.cpp b/code/ryzom/client/src/far_tp.cpp
index dec9aed6f..cb3387873 100644
--- a/code/ryzom/client/src/far_tp.cpp
+++ b/code/ryzom/client/src/far_tp.cpp
@@ -44,6 +44,7 @@
#include "client_chat_manager.h"
#include "bg_downloader_access.h"
#include "login_progress_post_thread.h"
+#include "interface_v3/action_handler_base.h"
using namespace NLMISC;
using namespace NLNET;
diff --git a/code/ryzom/client/src/interface_v3/action_handler.cpp b/code/ryzom/client/src/interface_v3/action_handler.cpp
index 7cc097492..b1aa1fa79 100644
--- a/code/ryzom/client/src/interface_v3/action_handler.cpp
+++ b/code/ryzom/client/src/interface_v3/action_handler.cpp
@@ -14,32 +14,18 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
-
-
-#include "stdpch.h"
-
#include "action_handler.h"
-#include "action_handler_misc.h"
-
+#include "group_container.h"
#include "nel/gui/interface_expr.h"
-#include "interface_manager.h"
-
-#include "group_container.h"
-#include "group_editbox.h"
-#include "dbctrl_sheet.h"
-#include "interface_3d_scene.h"
-#include "character_3d.h"
-#include "group_container.h"
-#include "people_interraction.h"
-
-#include "../r2/editor.h"
-
+#include "nel/gui/db_manager.h"
+#include "interface_link.h"
+#include "widget_manager.h"
using namespace std;
using namespace NLMISC;
// ------------------------------------------------------------------------------------------------
-CActionHandlerFactoryManager *CActionHandlerFactoryManager::_GlobalInstance = NULL;
+CAHManager *CAHManager::_GlobalInstance = NULL;
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
@@ -119,7 +105,7 @@ void IActionHandler::getAllParams (const string &Params, vector< pairgetActionHandler(ahName);
+ return getActionHandler(ahName);
}
// standalone form
else
- return CActionHandlerFactoryManager::getInstance()->getActionHandler(name);
+ return getActionHandler(name);
}
// ------------------------------------------------------------------------------------------------
-IActionHandler *getAH(const std::string &name, CStringShared ¶ms)
+IActionHandler* CAHManager::getAH(const std::string &name, CStringShared ¶ms)
{
// Special AH form?
string::size_type i= name.find(':');
@@ -143,15 +129,15 @@ IActionHandler *getAH(const std::string &name, CStringShared ¶ms)
{
string ahName= name.substr(0, i);
params= name.substr(i+1);
- return CActionHandlerFactoryManager::getInstance()->getActionHandler(ahName);
+ return getActionHandler(ahName);
}
// standalone form
else
- return CActionHandlerFactoryManager::getInstance()->getActionHandler(name);
+ return getActionHandler(name);
}
// ------------------------------------------------------------------------------------------------
-void parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, std::string ¶mRet)
+void CAHManager::parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, std::string ¶mRet)
{
CXMLAutoPtr prop;
@@ -183,7 +169,7 @@ void parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandl
}
}
-void parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, CStringShared ¶mRet)
+void CAHManager::parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, CStringShared ¶mRet)
{
CXMLAutoPtr prop;
@@ -221,7 +207,6 @@ class CAHSet : public IActionHandler
public:
virtual void execute (CCtrlBase *pCaller, const string &Params)
{
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
string dblink = getParam (Params, "dblink");
string property = getParam (Params, "target_property");
string propertyToEval = getParam (Params, "target");
@@ -321,7 +306,6 @@ class CAHCopy : public IActionHandler
public:
virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
{
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
string dbdst = getParam (Params, "dbdst");
string dbsrc = getParam (Params, "dbsrc");
CCDBNodeBranch *pNBdst = NLGUI::CDBManager::getInstance()->getDbBranch(dbdst);
@@ -391,8 +375,6 @@ class CAHResizeW : public IActionHandler
public:
virtual void execute (CCtrlBase *pCaller, const string &Params)
{
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
-
string elt = getParam (Params, "elt");
sint32 value;
@@ -422,220 +404,6 @@ public:
};
REGISTER_ACTION_HANDLER (CAHResizeW, "resize_w");
-// ------------------------------------------------------------------------------------------------
-class CAHSetKeyboardFocus : public IActionHandler
-{
-public:
- virtual void execute (CCtrlBase *pCaller, const string &Params)
- {
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
- string target = getParam (Params, "target");
- CGroupEditBox *geb;
- if (pCaller == NULL)
- geb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId (target));
- else
- geb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId (pCaller->getId(), target));
- if (geb == NULL)
- {
- nlwarning(" Can't get target edit box %s, or bad type", target.c_str());
- return;
- }
- pIM->setCaptureKeyboard(geb);
- string selectAllStr = getParam (Params, "select_all");
- bool selectAll = CInterfaceElement::convertBool(selectAllStr.c_str());
- if (selectAll)
- {
- geb->setSelectionAll();
- }
- }
-};
-REGISTER_ACTION_HANDLER (CAHSetKeyboardFocus, "set_keyboard_focus");
-
-// ------------------------------------------------------------------------------------------------
-class CAHResetKeyboardFocus : public IActionHandler
-{
-public:
- virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
- {
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
- pIM->resetCaptureKeyboard();
- }
-};
-REGISTER_ACTION_HANDLER (CAHResetKeyboardFocus, "reset_keyboard_focus");
-
-// ------------------------------------------------------------------------------------------------
-class CAHSetEditBoxCommand : public IActionHandler
-{
- virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
- {
- CGroupEditBox *menuEB = CGroupEditBox::getMenuFather();
- if (menuEB) menuEB->setCommand(getParam(Params, "value"), nlstricmp(getParam(Params, "execute"), "true") ? true : false);
- }
-};
-REGISTER_ACTION_HANDLER (CAHSetEditBoxCommand, "set_edit_box_command");
-
-// ------------------------------------------------------------------------------------------------
-class CAHActiveMenu : public IActionHandler
-{
- virtual void execute (CCtrlBase *pCaller, const string &Params)
- {
- CInterfaceManager *im = CInterfaceManager::getInstance();
-
- // get the parent container
- CGroupContainer *gc = NULL;
- CCtrlBase *cb = pCaller;
- while (cb)
- {
- gc = dynamic_cast(cb);
- if (gc) break;
- cb = cb->getParent();
- }
-
- // update GC_POPUP flag
- if (gc)
- {
- NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:GC_POPUP")->setValue64((gc->isPopuped() || gc->getLayerSetup() == 0) ? 1 : 0);
- }
- else
- {
- NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:GC_POPUP")->setValue64(0);
- }
-
- // update GC_HAS_HELP flag
- if(gc && !gc->getHelpPage().empty())
- {
- NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:GC_HAS_HELP")->setValue64(1);
- }
- else
- {
- NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:GC_HAS_HELP")->setValue64(0);
- }
-
- // open the menu
- if (CDBCtrlSheet::getDraggedSheet() == NULL)
- {
- CWidgetManager::getInstance()->enableModalWindow (pCaller, getParam(Params, "menu"));
- }
- }
-};
-REGISTER_ACTION_HANDLER (CAHActiveMenu, "active_menu");
-
-// ------------------------------------------------------------------------------------------------
-class CAHSetServerString : public IActionHandler
-{
- virtual void execute (CCtrlBase *pCaller, const string &Params)
- {
- string sValue = getParam(Params,"value");
- string sTarget = getParam(Params,"target");
-
- if (sTarget.empty()) return;
-
- if (sTarget.rfind(':') == string::npos)
- {
- if (pCaller == NULL) return;
- sTarget = pCaller->getId() + ":" + sTarget;
- }
- else
- {
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
- string elt = sTarget.substr(0,sTarget.rfind(':'));
- CInterfaceElement *pIE;
- if (pCaller != NULL)
- pIE = CWidgetManager::getInstance()->getElementFromId(pCaller->getId(), elt);
- else
- pIE = CWidgetManager::getInstance()->getElementFromId(elt);
- if (pIE == NULL) return;
- sTarget = pIE->getId() + ":" + sTarget.substr(sTarget.rfind(':')+1,sTarget.size());
- }
-
- CInterfaceExprValue evValue;
- if (CInterfaceExpr::eval(sValue, evValue, NULL))
- {
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
- if (evValue.toInteger())
- pIM->addServerString (sTarget, (uint32)evValue.getInteger());
- }
- }
-};
-REGISTER_ACTION_HANDLER (CAHSetServerString, "set_server_string");
-
-// ------------------------------------------------------------------------------------------------
-class CAHSetServerID : public IActionHandler
-{
- virtual void execute (CCtrlBase *pCaller, const string &Params)
- {
- string sValue = getParam(Params,"value");
- string sTarget = getParam(Params,"target");
- string sRemoveTitle = getParam(Params,"remove_title");
-
- if (sTarget.empty()) return;
-
- if (sTarget.rfind(':') == string::npos)
- {
- if (pCaller == NULL) return;
- sTarget = pCaller->getId() + ":" + sTarget;
- }
- else
- {
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
- string elt = sTarget.substr(0,sTarget.rfind(':'));
- CInterfaceElement *pIE;
- if (pCaller != NULL)
- pIE = CWidgetManager::getInstance()->getElementFromId(pCaller->getId(), elt);
- else
- pIE = CWidgetManager::getInstance()->getElementFromId(elt);
- if (pIE == NULL) return;
- sTarget = pIE->getId() + ":" + sTarget.substr(sTarget.rfind(':')+1,sTarget.size());
- }
-
- CInterfaceExprValue evValue;
- if (CInterfaceExpr::eval(sValue, evValue, NULL))
- {
- bool bRemoveTitle = false;
- if (!sRemoveTitle.empty())
- fromString(sRemoveTitle, bRemoveTitle);
-
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
-
- if (bRemoveTitle)
- {
- CStringPostProcessRemoveTitle *pSPPRT = new CStringPostProcessRemoveTitle;
-
- if (evValue.toInteger())
- pIM->addServerID (sTarget, (uint32)evValue.getInteger(), pSPPRT);
- }
- else
- {
- if (evValue.toInteger())
- pIM->addServerID (sTarget, (uint32)evValue.getInteger(), NULL);
- }
- }
- }
-};
-REGISTER_ACTION_HANDLER (CAHSetServerID, "set_server_id");
-
-// ------------------------------------------------------------------------------------------------
-class CAHResetCamera : public IActionHandler
-{
- virtual void execute (CCtrlBase *pCaller, const string &Params)
- {
- string sTarget = getParam(Params,"target");
-
- if (sTarget.empty()) return;
-
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
- CInterfaceElement *pIE;
- if (pCaller != NULL)
- pIE = CWidgetManager::getInstance()->getElementFromId(pCaller->getId(), sTarget);
- else
- pIE = CWidgetManager::getInstance()->getElementFromId(sTarget);
- CInterface3DCamera *pCam = dynamic_cast(pIE);
- if (pCam == NULL) return;
- pCam->reset();
- }
-};
-REGISTER_ACTION_HANDLER (CAHResetCamera, "reset_camera");
-
////////////////////////////////
// EDITION OF CONTAINER ALPHA //
////////////////////////////////
@@ -678,7 +446,6 @@ class CAHChooseUIAlpha : public IActionHandler
public:
virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */)
{
- CInterfaceManager *im = CInterfaceManager::getInstance();
CGroupContainer *gc = NULL;
CCtrlBase *cb = pCaller;
while (cb)
@@ -784,7 +551,6 @@ class CAHUseGlobalAlphaSettings : public IActionHandler
if (AlphaChooserTarget)
{
AlphaChooserTarget->setUseGlobalAlpha(!AlphaChooserTarget->isUsingGlobalAlpha());
- CInterfaceManager *im = CInterfaceManager::getInstance();
NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:USER_ALPHA")->setValue64(AlphaChooserTarget->isUsingGlobalAlpha() ? 0 : 1);
}
}
@@ -797,7 +563,6 @@ class CAHLockUnlock : public IActionHandler
{
virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */)
{
-// CInterfaceManager *im = CInterfaceManager::getInstance();
CGroupContainer *gc = NULL;
CCtrlBase *cb = pCaller;
while (cb)
@@ -818,7 +583,6 @@ class CAHSetTransparent : public IActionHandler
{
virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params)
{
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(Params));
if (pGC != NULL)
{
@@ -837,8 +601,6 @@ class CAHSetAlpha : public IActionHandler
{
virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params)
{
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
-
string ui = getParam (Params, "target");
uint8 alpha;
@@ -857,141 +619,11 @@ class CAHSetAlpha : public IActionHandler
};
REGISTER_ACTION_HANDLER (CAHSetAlpha, "set_alpha");
-///////////////////////////////
-// VIRTUAL DESKTOP MANAGMENT //
-///////////////////////////////
-
-
-// ------------------------------------------------------------------------------------------------
-class CAHSetVirtualDesktop : public IActionHandler
-{
- virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
- {
- string sVDesk = getParam(Params,"vdesk");
-
- if (sVDesk.empty()) return;
- sint32 nVDesk;
- fromString(sVDesk, nVDesk);
-
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
- pIM->setMode((uint8)nVDesk);
-
- PeopleInterraction.refreshActiveUserChats();
- }
-};
-REGISTER_ACTION_HANDLER (CAHSetVirtualDesktop, "set_virtual_desktop");
-
-// ------------------------------------------------------------------------------------------------
-class CAHResetVirtualDesktop : public IActionHandler
-{
- virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
- {
- string sVDesk = getParam(Params,"vdesk");
-
- if (sVDesk.empty()) return;
- sint32 nVDesk;
- fromString(sVDesk, nVDesk);
-
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
- pIM->resetMode((uint8)nVDesk);
-
- PeopleInterraction.refreshActiveUserChats();
- }
-};
-REGISTER_ACTION_HANDLER (CAHResetVirtualDesktop, "reset_virtual_desktop");
-
-// ------------------------------------------------------------------------------------------------
-class CAHMilkoMenuResetInterface : public IActionHandler
-{
- virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
- {
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
- string sParam("mode=");
- if(R2::getEditor().getMode() == R2::CEditor::TestMode)
- sParam = "R2TestMode";
-
- pIM->validMessageBox(CInterfaceManager::QuestionIconMsg, CI18N::get("uiQResetUI"), "milko_menu_do_reset_interface", sParam);
- }
-};
-REGISTER_ACTION_HANDLER (CAHMilkoMenuResetInterface, "milko_menu_reset_interface");
-
-// ------------------------------------------------------------------------------------------------
-class CAHMilkoMenuDoResetInterface : public IActionHandler
-{
- virtual void execute (CCtrlBase * /* pCaller */, const string& Params)
- {
- // get param
- string mode;
- fromString(getParam(Params, "mode"), mode);
-
- // run procedure
- vector v;
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
- if (mode == "R2TestMode")
- pIM->runProcedure ("proc_reset_r2ed_interface", NULL, v);
- else
- pIM->runProcedure("proc_reset_interface", NULL, v);
- }
-};
-REGISTER_ACTION_HANDLER(CAHMilkoMenuDoResetInterface, "milko_menu_do_reset_interface");
-
-// ------------------------------------------------------------------------------------------------
-class CAHResetInterface : public IActionHandler
-{
- virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
- {
- uint32 i;
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
- const vector &rVMG = CWidgetManager::getInstance()->getAllMasterGroup();
- for (uint32 nMasterGroup = 0; nMasterGroup < rVMG.size(); nMasterGroup++)
- {
- const CWidgetManager::SMasterGroup &rMG = rVMG[nMasterGroup];
- const vector &rV = rMG.Group->getGroups();
- // Active all containers (that can be activated)
- for (i = 0; i < rV.size(); ++i)
- {
- CGroupContainer *pGC = dynamic_cast(rV[i]);
- if (pGC == NULL) continue;
- if (pGC->isSavable())
- {
- // Yoyo: DO NOT force activation of containers who don't want to save their Active state.
- // Usually driven by server.
- if(pGC->isActiveSavable())
- pGC->setActive(true);
- }
- }
-
- pIM->checkCoords();
- CWidgetManager::getInstance()->getMasterGroup((uint8)nMasterGroup).centerAllContainers();
-
- // Pop in and close all containers
- for (i = 0; i < rV.size(); ++i)
- {
- CGroupContainer *pGC = dynamic_cast(rV[i]);
- if (pGC == NULL) continue;
- if (pGC->isSavable())
- {
- if (pGC->isPopable()&&pGC->isPopuped())
- pGC->popin();
-
- // Can close ?
- if (pGC->isOpenable()&&pGC->isOpen())
- pGC->close();
- }
- }
-
- CWidgetManager::getInstance()->getMasterGroup((uint8)nMasterGroup).deactiveAllContainers();
- }
- }
-};
-REGISTER_ACTION_HANDLER (CAHResetInterface, "reset_interface");
-
// ------------------------------------------------------------------------------------------------
class CAHUnlockAllContainer : public IActionHandler
{
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
const vector &rVMG = CWidgetManager::getInstance()->getAllMasterGroup();
for (uint32 nMasterGroup = 0; nMasterGroup < rVMG.size(); nMasterGroup++)
{
@@ -1001,54 +633,3 @@ class CAHUnlockAllContainer : public IActionHandler
}
};
REGISTER_ACTION_HANDLER (CAHUnlockAllContainer, "unlock_all_container");
-
-// ------------------------------------------------------------------------------------------------
-class CAHConvertServerEntities : public IActionHandler
-{
- virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
- {
- string sDstPath = getParam(Params, "dest");
- if (sDstPath.empty()) return;
- string sEntityNb = getParam(Params, "entity");
- uint32 nEntityNb = 0;
- if (!sEntityNb.empty())
- fromString(sEntityNb, nEntityNb);
-
- CCharacterSummary cs;
- SCharacter3DSetup::setupCharacterSummaryFromSERVERDB(cs, (uint8)nEntityNb);
- SCharacter3DSetup::setupDBFromCharacterSummary(sDstPath, cs);
-
- }
-};
-REGISTER_ACTION_HANDLER (CAHConvertServerEntities, "convert_server_entities");
-
-/*// ------------------------------------------------------------------------------------------------
-class CAHPopup : public IActionHandler
-{
- virtual void execute (CCtrlBase *pCaller, const string &Params)
- {
- string sCont = getParam(Params,"cont");
- CInterfaceExprValue eVal;
- if (!CInterfaceExpr::eval(sCont, eVal, NULL)) return;
- sCont = eVal.getString();
- if (sCont.empty()) return;
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
- CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sCont));
- if (pGC == NULL) return;
- if (pGC->isPopuped()) return;
- pGC->setHighLighted(false);
- // pop the window
- pGC->popupCurrentPos();
- if (pGC->getPopupW() != -1)
- {
- pGC->setX(pGC->getPopupX());
- pGC->setY(pGC->getPopupY());
- pGC->setW(pGC->getPopupW());
- // must resize the children to get correct height
- pGC->setChildrenH(pGC->getPopupChildrenH());
- }
- pGC->invalidateCoords(2);
- }
-};
-REGISTER_ACTION_HANDLER (CAHPopup, "popup");
-*/
diff --git a/code/ryzom/client/src/interface_v3/action_handler.h b/code/ryzom/client/src/interface_v3/action_handler.h
index e578c4959..e86471a58 100644
--- a/code/ryzom/client/src/interface_v3/action_handler.h
+++ b/code/ryzom/client/src/interface_v3/action_handler.h
@@ -14,8 +14,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
-
-
#ifndef NL_ACTION_HANDLER_H
#define NL_ACTION_HANDLER_H
@@ -26,15 +24,6 @@
#include "nel/misc/xml_auto_ptr.h"
#include