CHANGED: #1471 Renamed the action handler factory manager to CAHManager and moved some global functions into it as instance methods. Also broke up an action handler file to AH and Ryzom related files.

This commit is contained in:
dfighter1985 2012-06-01 00:19:53 +02:00
parent 2e9fe265f2
commit 51a515fded
21 changed files with 590 additions and 564 deletions

View file

@ -44,6 +44,7 @@
#include "client_chat_manager.h" #include "client_chat_manager.h"
#include "bg_downloader_access.h" #include "bg_downloader_access.h"
#include "login_progress_post_thread.h" #include "login_progress_post_thread.h"
#include "interface_v3/action_handler_base.h"
using namespace NLMISC; using namespace NLMISC;
using namespace NLNET; using namespace NLNET;

View file

@ -14,32 +14,18 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "action_handler.h" #include "action_handler.h"
#include "action_handler_misc.h" #include "group_container.h"
#include "nel/gui/interface_expr.h" #include "nel/gui/interface_expr.h"
#include "interface_manager.h" #include "nel/gui/db_manager.h"
#include "interface_link.h"
#include "group_container.h" #include "widget_manager.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"
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
CActionHandlerFactoryManager *CActionHandlerFactoryManager::_GlobalInstance = NULL; CAHManager *CAHManager::_GlobalInstance = NULL;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -119,7 +105,7 @@ void IActionHandler::getAllParams (const string &Params, vector< pair<string,str
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
IActionHandler *getAH(const std::string &name, std::string &params) IActionHandler* CAHManager::getAH(const std::string &name, std::string &params)
{ {
// Special AH form? // Special AH form?
string::size_type i= name.find(':'); string::size_type i= name.find(':');
@ -127,15 +113,15 @@ IActionHandler *getAH(const std::string &name, std::string &params)
{ {
string ahName= name.substr(0, i); string ahName= name.substr(0, i);
params= name.substr(i+1); params= name.substr(i+1);
return CActionHandlerFactoryManager::getInstance()->getActionHandler(ahName); return getActionHandler(ahName);
} }
// standalone form // standalone form
else else
return CActionHandlerFactoryManager::getInstance()->getActionHandler(name); return getActionHandler(name);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
IActionHandler *getAH(const std::string &name, CStringShared &params) IActionHandler* CAHManager::getAH(const std::string &name, CStringShared &params)
{ {
// Special AH form? // Special AH form?
string::size_type i= name.find(':'); string::size_type i= name.find(':');
@ -143,15 +129,15 @@ IActionHandler *getAH(const std::string &name, CStringShared &params)
{ {
string ahName= name.substr(0, i); string ahName= name.substr(0, i);
params= name.substr(i+1); params= name.substr(i+1);
return CActionHandlerFactoryManager::getInstance()->getActionHandler(ahName); return getActionHandler(ahName);
} }
// standalone form // standalone form
else else
return CActionHandlerFactoryManager::getInstance()->getActionHandler(name); return getActionHandler(name);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, std::string &paramRet) void CAHManager::parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, std::string &paramRet)
{ {
CXMLAutoPtr prop; 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 &paramRet) void CAHManager::parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, CStringShared &paramRet)
{ {
CXMLAutoPtr prop; CXMLAutoPtr prop;
@ -221,7 +207,6 @@ class CAHSet : public IActionHandler
public: public:
virtual void execute (CCtrlBase *pCaller, const string &Params) virtual void execute (CCtrlBase *pCaller, const string &Params)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance();
string dblink = getParam (Params, "dblink"); string dblink = getParam (Params, "dblink");
string property = getParam (Params, "target_property"); string property = getParam (Params, "target_property");
string propertyToEval = getParam (Params, "target"); string propertyToEval = getParam (Params, "target");
@ -321,7 +306,6 @@ class CAHCopy : public IActionHandler
public: public:
virtual void execute (CCtrlBase * /* pCaller */, const string &Params) virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance();
string dbdst = getParam (Params, "dbdst"); string dbdst = getParam (Params, "dbdst");
string dbsrc = getParam (Params, "dbsrc"); string dbsrc = getParam (Params, "dbsrc");
CCDBNodeBranch *pNBdst = NLGUI::CDBManager::getInstance()->getDbBranch(dbdst); CCDBNodeBranch *pNBdst = NLGUI::CDBManager::getInstance()->getDbBranch(dbdst);
@ -391,8 +375,6 @@ class CAHResizeW : public IActionHandler
public: public:
virtual void execute (CCtrlBase *pCaller, const string &Params) virtual void execute (CCtrlBase *pCaller, const string &Params)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance();
string elt = getParam (Params, "elt"); string elt = getParam (Params, "elt");
sint32 value; sint32 value;
@ -422,220 +404,6 @@ public:
}; };
REGISTER_ACTION_HANDLER (CAHResizeW, "resize_w"); 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<CGroupEditBox *>(CWidgetManager::getInstance()->getElementFromId (target));
else
geb = dynamic_cast<CGroupEditBox *>(CWidgetManager::getInstance()->getElementFromId (pCaller->getId(), target));
if (geb == NULL)
{
nlwarning("<CAHSetKeyboardFocus::execute> 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<CGroupContainer *>(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<CInterface3DCamera*>(pIE);
if (pCam == NULL) return;
pCam->reset();
}
};
REGISTER_ACTION_HANDLER (CAHResetCamera, "reset_camera");
//////////////////////////////// ////////////////////////////////
// EDITION OF CONTAINER ALPHA // // EDITION OF CONTAINER ALPHA //
//////////////////////////////// ////////////////////////////////
@ -678,7 +446,6 @@ class CAHChooseUIAlpha : public IActionHandler
public: public:
virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */) virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */)
{ {
CInterfaceManager *im = CInterfaceManager::getInstance();
CGroupContainer *gc = NULL; CGroupContainer *gc = NULL;
CCtrlBase *cb = pCaller; CCtrlBase *cb = pCaller;
while (cb) while (cb)
@ -784,7 +551,6 @@ class CAHUseGlobalAlphaSettings : public IActionHandler
if (AlphaChooserTarget) if (AlphaChooserTarget)
{ {
AlphaChooserTarget->setUseGlobalAlpha(!AlphaChooserTarget->isUsingGlobalAlpha()); AlphaChooserTarget->setUseGlobalAlpha(!AlphaChooserTarget->isUsingGlobalAlpha());
CInterfaceManager *im = CInterfaceManager::getInstance();
NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:USER_ALPHA")->setValue64(AlphaChooserTarget->isUsingGlobalAlpha() ? 0 : 1); 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 */) virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */)
{ {
// CInterfaceManager *im = CInterfaceManager::getInstance();
CGroupContainer *gc = NULL; CGroupContainer *gc = NULL;
CCtrlBase *cb = pCaller; CCtrlBase *cb = pCaller;
while (cb) while (cb)
@ -818,7 +583,6 @@ class CAHSetTransparent : public IActionHandler
{ {
virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params) virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId(Params)); CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId(Params));
if (pGC != NULL) if (pGC != NULL)
{ {
@ -837,8 +601,6 @@ class CAHSetAlpha : public IActionHandler
{ {
virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params) virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance();
string ui = getParam (Params, "target"); string ui = getParam (Params, "target");
uint8 alpha; uint8 alpha;
@ -857,141 +619,11 @@ class CAHSetAlpha : public IActionHandler
}; };
REGISTER_ACTION_HANDLER (CAHSetAlpha, "set_alpha"); 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<string> 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<CWidgetManager::SMasterGroup> &rVMG = CWidgetManager::getInstance()->getAllMasterGroup();
for (uint32 nMasterGroup = 0; nMasterGroup < rVMG.size(); nMasterGroup++)
{
const CWidgetManager::SMasterGroup &rMG = rVMG[nMasterGroup];
const vector<CInterfaceGroup*> &rV = rMG.Group->getGroups();
// Active all containers (that can be activated)
for (i = 0; i < rV.size(); ++i)
{
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(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<CGroupContainer*>(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 class CAHUnlockAllContainer : public IActionHandler
{ {
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance();
const vector<CWidgetManager::SMasterGroup> &rVMG = CWidgetManager::getInstance()->getAllMasterGroup(); const vector<CWidgetManager::SMasterGroup> &rVMG = CWidgetManager::getInstance()->getAllMasterGroup();
for (uint32 nMasterGroup = 0; nMasterGroup < rVMG.size(); nMasterGroup++) for (uint32 nMasterGroup = 0; nMasterGroup < rVMG.size(); nMasterGroup++)
{ {
@ -1001,54 +633,3 @@ class CAHUnlockAllContainer : public IActionHandler
} }
}; };
REGISTER_ACTION_HANDLER (CAHUnlockAllContainer, "unlock_all_container"); 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<CGroupContainer*>(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");
*/

View file

@ -14,8 +14,6 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ACTION_HANDLER_H #ifndef NL_ACTION_HANDLER_H
#define NL_ACTION_HANDLER_H #define NL_ACTION_HANDLER_H
@ -26,15 +24,6 @@
#include "nel/misc/xml_auto_ptr.h" #include "nel/misc/xml_auto_ptr.h"
#include <map> #include <map>
extern bool game_exit;
extern bool ryzom_exit;
extern bool game_exit_request;
extern bool ryzom_exit_request;
extern bool paying_account_request;
extern bool paying_account_already_request;
extern bool game_exit_after_paying_account_request;
/** /**
* interface for action handlers * interface for action handlers
* \author Nicolas Brigand * \author Nicolas Brigand
@ -42,7 +31,6 @@ extern bool game_exit_after_paying_account_request;
* \date 2002 * \date 2002
*/ */
class IInputControl;
class CCtrlBase; class CCtrlBase;
class IActionHandler class IActionHandler
@ -61,23 +49,19 @@ public:
/** /**
* interface for action handlers factory interface for action handlers factory
* no release in this factory : a handler must be destroyed by the control that created it no release in this factory : a handler must be destroyed by the control that created it
* \author Nicolas Brigand
* \author Nevrax France
* \date 2002
*/ */
class CAHManager
class CActionHandlerFactoryManager
{ {
public: public:
typedef std::map< std::string, IActionHandler* > TFactoryMap; typedef std::map< std::string, IActionHandler* > TFactoryMap;
typedef std::map< IActionHandler*, std::string > TNameMap; typedef std::map< IActionHandler*, std::string > TNameMap;
static CActionHandlerFactoryManager* getInstance() static CAHManager* getInstance()
{ {
if (_GlobalInstance == NULL) if (_GlobalInstance == NULL)
_GlobalInstance = new CActionHandlerFactoryManager; _GlobalInstance = new CAHManager;
return _GlobalInstance; return _GlobalInstance;
} }
@ -100,12 +84,6 @@ public:
TNameMap NameMap; TNameMap NameMap;
std::string EmptyName; std::string EmptyName;
private:
CActionHandlerFactoryManager(){}
static CActionHandlerFactoryManager *_GlobalInstance;
};
/// return the Action Handler 'name'. if name is of form 'ah:params', then params are filled (NB: else not changed) /// return the Action Handler 'name'. if name is of form 'ah:params', then params are filled (NB: else not changed)
IActionHandler *getAH(const std::string &name, std::string &params); IActionHandler *getAH(const std::string &name, std::string &params);
IActionHandler *getAH(const std::string &name, class CStringShared &params); IActionHandler *getAH(const std::string &name, class CStringShared &params);
@ -122,7 +100,13 @@ void parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandl
void parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, class CStringShared &params); void parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, class CStringShared &params);
/// Get the AH name from ptr /// Get the AH name from ptr
inline const std::string &getAHName(IActionHandler *pAH) { return CActionHandlerFactoryManager::getInstance()->getActionHandlerName(pAH); } const std::string &getAHName(IActionHandler *pAH) { return getActionHandlerName(pAH); }
private:
CAHManager(){}
static CAHManager *_GlobalInstance;
};
/// Ah name must all be lower case /// Ah name must all be lower case
#define REGISTER_ACTION_HANDLER(handler ,name) \ #define REGISTER_ACTION_HANDLER(handler ,name) \
@ -138,9 +122,9 @@ public:\
nlassert(islower(*c) || !isalpha(*c)); \ nlassert(islower(*c) || !isalpha(*c)); \
c++; \ c++; \
} \ } \
CActionHandlerFactoryManager *pAHFM = CActionHandlerFactoryManager::getInstance(); \ CAHManager *pAHFM = CAHManager::getInstance(); \
pAHFM->FactoryMap.insert(CActionHandlerFactoryManager::TFactoryMap::value_type(name,this));\ pAHFM->FactoryMap.insert(CAHManager::TFactoryMap::value_type(name,this)); \
pAHFM->NameMap.insert(CActionHandlerFactoryManager::TNameMap::value_type(this,name));\ pAHFM->NameMap.insert(CAHManager::TNameMap::value_type(this,name)); \
}; \ }; \
}; \ }; \
handler##Factory handler##FactoryInstance ; \ handler##Factory handler##FactoryInstance ; \

View file

@ -0,0 +1,430 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "action_handler_base.h"
#include "action_handler_misc.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"
using namespace std;
using namespace NLMISC;
// ------------------------------------------------------------------------------------------------
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<CGroupContainer *>(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 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<CGroupEditBox *>(CWidgetManager::getInstance()->getElementFromId (target));
else
geb = dynamic_cast<CGroupEditBox *>(CWidgetManager::getInstance()->getElementFromId (pCaller->getId(), target));
if (geb == NULL)
{
nlwarning("<CAHSetKeyboardFocus::execute> 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 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<CInterface3DCamera*>(pIE);
if (pCam == NULL) return;
pCam->reset();
}
};
REGISTER_ACTION_HANDLER (CAHResetCamera, "reset_camera");
///////////////////////////////
// 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<string> 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<CWidgetManager::SMasterGroup> &rVMG = CWidgetManager::getInstance()->getAllMasterGroup();
for (uint32 nMasterGroup = 0; nMasterGroup < rVMG.size(); nMasterGroup++)
{
const CWidgetManager::SMasterGroup &rMG = rVMG[nMasterGroup];
const vector<CInterfaceGroup*> &rV = rMG.Group->getGroups();
// Active all containers (that can be activated)
for (i = 0; i < rV.size(); ++i)
{
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(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<CGroupContainer*>(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 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<CGroupContainer*>(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");
*/

View file

@ -0,0 +1,28 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef ACTION_HANDLER_BASE_H
#define ACTION_HANDLER_BASE_H
extern bool game_exit;
extern bool ryzom_exit;
extern bool game_exit_request;
extern bool ryzom_exit_request;
extern bool paying_account_request;
extern bool paying_account_already_request;
extern bool game_exit_after_paying_account_request;
#endif

View file

@ -22,6 +22,7 @@
// Interface includes // Interface includes
#include "interface_manager.h" #include "interface_manager.h"
#include "action_handler.h" #include "action_handler.h"
#include "action_handler_base.h"
#include "action_handler_misc.h" #include "action_handler_misc.h"
#include "bot_chat_manager.h" #include "bot_chat_manager.h"
#include "bot_chat_page_all.h" #include "bot_chat_page_all.h"

View file

@ -149,12 +149,12 @@ bool CCtrlBaseButton::parse (xmlNodePtr cur,CInterfaceGroup * parentGroup)
// *** Read Action handlers // *** Read Action handlers
parseAH(cur, "onover", "params_over", _AHOnOver, _AHOverParams); CAHManager::getInstance()->parseAH(cur, "onover", "params_over", _AHOnOver, _AHOverParams);
parseAH(cur, "onclick_l", "params_l", _AHOnLeftClick, _AHLeftClickParams); CAHManager::getInstance()->parseAH(cur, "onclick_l", "params_l", _AHOnLeftClick, _AHLeftClickParams);
parseAH(cur, "ondblclick_l", "params_dblclick_l", _AHOnLeftDblClick, _AHLeftDblClickParams); CAHManager::getInstance()->parseAH(cur, "ondblclick_l", "params_dblclick_l", _AHOnLeftDblClick, _AHLeftDblClickParams);
parseAH(cur, "onclick_r", "params_r", _AHOnRightClick, _AHRightClickParams); CAHManager::getInstance()->parseAH(cur, "onclick_r", "params_r", _AHOnRightClick, _AHRightClickParams);
parseAH(cur, "onlongclick_l", "params_longclick_l", _AHOnLeftLongClick, _AHLeftLongClickParams); CAHManager::getInstance()->parseAH(cur, "onlongclick_l", "params_longclick_l", _AHOnLeftLongClick, _AHLeftLongClickParams);
parseAH(cur, "onclock_tick", "params_clock_tick", _AHOnClockTick, _AHClockTickParams); CAHManager::getInstance()->parseAH(cur, "onclock_tick", "params_clock_tick", _AHOnClockTick, _AHClockTickParams);
// Context menu association // Context menu association
prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_l" ); prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_l" );

View file

@ -114,16 +114,16 @@ public:
/// \name Handlers /// \name Handlers
// @{ // @{
// Event part // Event part
void setActionOnLeftClick (const std::string &actionHandlerName) { _AHOnLeftClickString = actionHandlerName; _AHOnLeftClick = getAH(actionHandlerName, _AHLeftClickParams); } void setActionOnLeftClick (const std::string &actionHandlerName) { _AHOnLeftClickString = actionHandlerName; _AHOnLeftClick = CAHManager::getInstance()->getAH(actionHandlerName, _AHLeftClickParams); }
void setActionOnLeftClickParams(const std::string &params) { _AHOnLeftClickStringParams = params; } void setActionOnLeftClickParams(const std::string &params) { _AHOnLeftClickStringParams = params; }
void setActionOnRightClick (const std::string &actionHandlerName) { _AHOnRightClick = getAH(actionHandlerName, _AHRightClickParams); } void setActionOnRightClick (const std::string &actionHandlerName) { _AHOnRightClick = CAHManager::getInstance()->getAH(actionHandlerName, _AHRightClickParams); }
void setActionOnClockTick (const std::string &ahName) { _AHOnClockTick = getAH(ahName, _AHClockTickParams); } void setActionOnClockTick (const std::string &ahName) { _AHOnClockTick = CAHManager::getInstance()->getAH(ahName, _AHClockTickParams); }
void setParamsOnLeftClick (const std::string &paramsHandlerName) { _AHLeftClickParams = paramsHandlerName; } void setParamsOnLeftClick (const std::string &paramsHandlerName) { _AHLeftClickParams = paramsHandlerName; }
void setParamsOnRightClick (const std::string &paramsHandlerName) { _AHRightClickParams = paramsHandlerName; } void setParamsOnRightClick (const std::string &paramsHandlerName) { _AHRightClickParams = paramsHandlerName; }
void setParamsOnClockTick (const std::string &ahParamsName) { _AHClockTickParams = ahParamsName; } void setParamsOnClockTick (const std::string &ahParamsName) { _AHClockTickParams = ahParamsName; }
// get Event part // get Event part
std::string _getActionOnLeftClick() const { return getAHName(_AHOnLeftClick); } std::string _getActionOnLeftClick() const { return CAHManager::getInstance()->getAHName(_AHOnLeftClick); }
IActionHandler *getActionOnLeftClick () const { return _AHOnLeftClick; } IActionHandler *getActionOnLeftClick () const { return _AHOnLeftClick; }
IActionHandler *getActionOnRightClick () const { return _AHOnRightClick; } IActionHandler *getActionOnRightClick () const { return _AHOnRightClick; }
IActionHandler *getActionOnClockTick () const { return _AHOnClockTick; } IActionHandler *getActionOnClockTick () const { return _AHOnClockTick; }

View file

@ -383,13 +383,13 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
if (prop) _Dragable = CInterfaceElement::convertBool(prop); if (prop) _Dragable = CInterfaceElement::convertBool(prop);
// Read Action handlers // Read Action handlers
parseAH(cur, "onclick_l", "params_l", _AHOnLeftClick, _AHLeftClickParams); CAHManager::getInstance()->parseAH(cur, "onclick_l", "params_l", _AHOnLeftClick, _AHLeftClickParams);
parseAH(cur, "onclick_r", "params_r", _AHOnRightClick, _AHRightClickParams); CAHManager::getInstance()->parseAH(cur, "onclick_r", "params_r", _AHOnRightClick, _AHRightClickParams);
parseAH(cur, "oncandrop", "params_candrop", _AHOnCanDrop, _AHCanDropParams); CAHManager::getInstance()->parseAH(cur, "oncandrop", "params_candrop", _AHOnCanDrop, _AHCanDropParams);
parseAH(cur, "ondrop", "params_drop", _AHOnDrop, _AHDropParams); CAHManager::getInstance()->parseAH(cur, "ondrop", "params_drop", _AHOnDrop, _AHDropParams);
parseAH(cur, "oncannotdrop", "params_cannotdrop", _AHOnCannotDrop, _AHCannotDropParams); CAHManager::getInstance()->parseAH(cur, "oncannotdrop", "params_cannotdrop", _AHOnCannotDrop, _AHCannotDropParams);
parseAH(cur, "oncandrag", "params_candrag", _AHOnCanDrag, _AHCanDragParams); CAHManager::getInstance()->parseAH(cur, "oncandrag", "params_candrag", _AHOnCanDrag, _AHCanDragParams);
parseAH(cur, "ondrag", "params_drag", _AHOnDrag, _AHDragParams); CAHManager::getInstance()->parseAH(cur, "ondrag", "params_drag", _AHOnDrag, _AHDragParams);
prop = (char*) xmlGetProp( cur, (xmlChar*)"selection_group" ); prop = (char*) xmlGetProp( cur, (xmlChar*)"selection_group" );
if (prop) if (prop)
@ -1870,7 +1870,7 @@ void CDBCtrlSheet::draw()
string params = string("src=") + pCSSrc->getId(); string params = string("src=") + pCSSrc->getId();
if (!_AHCanDropParams.empty()) if (!_AHCanDropParams.empty())
{ {
if (getAHName(_AHOnCanDrop) == "lua") if ( CAHManager::getInstance()->getAHName(_AHOnCanDrop) == "lua")
{ {
params = _AHCanDropParams; params = _AHCanDropParams;
strFindReplace(params, "%src", pCSSrc->getId()); strFindReplace(params, "%src", pCSSrc->getId());
@ -2687,7 +2687,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
string params = string("src=") + _Id; string params = string("src=") + _Id;
if (!pCSdest->_AHCanDropParams.empty()) if (!pCSdest->_AHCanDropParams.empty())
{ {
if (getAHName(pCSdest->_AHOnCanDrop) == "lua") if (CAHManager::getInstance()->getAHName(pCSdest->_AHOnCanDrop) == "lua")
{ {
params = pCSdest->_AHCanDropParams; params = pCSdest->_AHCanDropParams;
strFindReplace(params, "%src", _Id); strFindReplace(params, "%src", _Id);
@ -2707,7 +2707,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
string params = string("src=") + _Id; string params = string("src=") + _Id;
if (!pCSdest->_AHDropParams.empty()) if (!pCSdest->_AHDropParams.empty())
{ {
if (getAHName(pCSdest->_AHOnDrop) == "lua") if (CAHManager::getInstance()->getAHName(pCSdest->_AHOnDrop) == "lua")
{ {
params = pCSdest->_AHDropParams; params = pCSdest->_AHDropParams;
strFindReplace(params, "%src", _Id); strFindReplace(params, "%src", _Id);
@ -2752,7 +2752,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
string params = string("src=") + _Id; string params = string("src=") + _Id;
if (!pList->getCtrlSheetInfo()._AHCanDropParams.empty()) if (!pList->getCtrlSheetInfo()._AHCanDropParams.empty())
{ {
if (getAHName(pList->getCtrlSheetInfo()._AHOnCanDrop) == "lua") if (CAHManager::getInstance()->getAHName(pList->getCtrlSheetInfo()._AHOnCanDrop) == "lua")
{ {
params = pList->getCtrlSheetInfo()._AHCanDropParams; params = pList->getCtrlSheetInfo()._AHCanDropParams;
strFindReplace(params, "%src", _Id); strFindReplace(params, "%src", _Id);
@ -2772,7 +2772,7 @@ bool CDBCtrlSheet::handleEvent (const NLGUI::CEventDescriptor &event)
string params = string("src=") + _Id; string params = string("src=") + _Id;
if (!pList->getCtrlSheetInfo()._AHDropParams.empty()) if (!pList->getCtrlSheetInfo()._AHDropParams.empty())
{ {
if (getAHName(pList->getCtrlSheetInfo()._AHOnDrop) == "lua") if (CAHManager::getInstance()->getAHName(pList->getCtrlSheetInfo()._AHOnDrop) == "lua")
{ {
params = pList->getCtrlSheetInfo()._AHDropParams; params = pList->getCtrlSheetInfo()._AHDropParams;
strFindReplace(params, "%src", _Id); strFindReplace(params, "%src", _Id);

View file

@ -191,19 +191,19 @@ public:
virtual bool handleEvent (const NLGUI::CEventDescriptor &event); virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
void setActionOnLeftClick (const std::string &ActionHandlerName) { _AHOnLeftClick = getAH(ActionHandlerName, _AHLeftClickParams); } void setActionOnLeftClick (const std::string &ActionHandlerName) { _AHOnLeftClick = CAHManager::getInstance()->getAH(ActionHandlerName, _AHLeftClickParams); }
void setActionOnRightClick (const std::string &ActionHandlerName) { _AHOnRightClick = getAH(ActionHandlerName, _AHRightClickParams); } void setActionOnRightClick (const std::string &ActionHandlerName) { _AHOnRightClick = CAHManager::getInstance()->getAH(ActionHandlerName, _AHRightClickParams); }
void setActionOnDrop (const std::string &ActionHandlerName) { _AHOnDrop = getAH(ActionHandlerName, _AHDropParams); } void setActionOnDrop (const std::string &ActionHandlerName) { _AHOnDrop = CAHManager::getInstance()->getAH(ActionHandlerName, _AHDropParams); }
void setActionOnCanDrop (const std::string &ActionHandlerName) { _AHOnCanDrop = getAH(ActionHandlerName, _AHCanDropParams); } void setActionOnCanDrop (const std::string &ActionHandlerName) { _AHOnCanDrop = CAHManager::getInstance()->getAH(ActionHandlerName, _AHCanDropParams); }
void setParamsOnLeftClick (const std::string &ParamsHandlerName) { _AHLeftClickParams = ParamsHandlerName; } void setParamsOnLeftClick (const std::string &ParamsHandlerName) { _AHLeftClickParams = ParamsHandlerName; }
void setParamsOnRightClick (const std::string &ParamsHandlerName) { _AHRightClickParams = ParamsHandlerName; } void setParamsOnRightClick (const std::string &ParamsHandlerName) { _AHRightClickParams = ParamsHandlerName; }
void setParamsOnDrop (const std::string &ParamsHandlerName) { _AHDropParams = ParamsHandlerName; } void setParamsOnDrop (const std::string &ParamsHandlerName) { _AHDropParams = ParamsHandlerName; }
void setParamsOnCanDrop (const std::string &ParamsHandlerName) { _AHCanDropParams = ParamsHandlerName; } void setParamsOnCanDrop (const std::string &ParamsHandlerName) { _AHCanDropParams = ParamsHandlerName; }
const std::string &getActionOnLeftClick () const { return getAHName(_AHOnLeftClick); } const std::string &getActionOnLeftClick () const { return CAHManager::getInstance()->getAHName(_AHOnLeftClick); }
const std::string &getActionOnRightClick () const { return getAHName(_AHOnRightClick); } const std::string &getActionOnRightClick () const { return CAHManager::getInstance()->getAHName(_AHOnRightClick); }
const std::string &getActionOnDrop () const { return getAHName(_AHOnDrop); } const std::string &getActionOnDrop () const { return CAHManager::getInstance()->getAHName(_AHOnDrop); }
const std::string &getActionOnCanDrop () const { return getAHName(_AHOnCanDrop); } const std::string &getActionOnCanDrop () const { return CAHManager::getInstance()->getAHName(_AHOnCanDrop); }
const std::string &getParamsOnLeftClick () const { return _AHLeftClickParams; } const std::string &getParamsOnLeftClick () const { return _AHLeftClickParams; }
const std::string &getParamsOnRightClick () const { return _AHRightClickParams; } const std::string &getParamsOnRightClick () const { return _AHRightClickParams; }
const std::string &getParamsOnDrop () const { return _AHDropParams; } const std::string &getParamsOnDrop () const { return _AHDropParams; }

View file

@ -1426,14 +1426,14 @@ bool CGroupContainer::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
if (ptr) if (ptr)
fromString((const char*)ptr, _ResizerTopSize); fromString((const char*)ptr, _ResizerTopSize);
parseAH(cur, "on_open", "on_open_params", _AHOnOpen, _AHOnOpenParams); CAHManager::getInstance()->parseAH(cur, "on_open", "on_open_params", _AHOnOpen, _AHOnOpenParams);
parseAH(cur, "on_close", "on_close_params", _AHOnClose, _AHOnCloseParams); CAHManager::getInstance()->parseAH(cur, "on_close", "on_close_params", _AHOnClose, _AHOnCloseParams);
parseAH(cur, "on_close_button", "on_close_button_params", _AHOnCloseButton, _AHOnCloseButtonParams); CAHManager::getInstance()->parseAH(cur, "on_close_button", "on_close_button_params", _AHOnCloseButton, _AHOnCloseButtonParams);
parseAH(cur, "on_move", "on_move_params", _AHOnMove, _AHOnMoveParams); CAHManager::getInstance()->parseAH(cur, "on_move", "on_move_params", _AHOnMove, _AHOnMoveParams);
parseAH(cur, "on_deactive_check", "on_deactive_check_params", _AHOnDeactiveCheck, _AHOnDeactiveCheckParams); CAHManager::getInstance()->parseAH(cur, "on_deactive_check", "on_deactive_check_params", _AHOnDeactiveCheck, _AHOnDeactiveCheckParams);
parseAH(cur, "on_resize", "on_resize_params", _AHOnResize, _AHOnResizeParams); CAHManager::getInstance()->parseAH(cur, "on_resize", "on_resize_params", _AHOnResize, _AHOnResizeParams);
parseAH(cur, "on_alpha_settings_changed", "on_alpha_settings_changed_params", _AHOnAlphaSettingsChanged, _AHOnAlphaSettingsChangedParams); CAHManager::getInstance()->parseAH(cur, "on_alpha_settings_changed", "on_alpha_settings_changed_params", _AHOnAlphaSettingsChanged, _AHOnAlphaSettingsChangedParams);
parseAH(cur, "on_begin_move", "on_begin_move_params", _AHOnBeginMove, _AHOnBeginMoveParams); CAHManager::getInstance()->parseAH(cur, "on_begin_move", "on_begin_move_params", _AHOnBeginMove, _AHOnBeginMoveParams);
ptr = xmlGetProp (cur, (xmlChar*)"max_w"); ptr = xmlGetProp (cur, (xmlChar*)"max_w");

View file

@ -415,33 +415,33 @@ public:
// to be called by the 'deactive check' handler // to be called by the 'deactive check' handler
static void validateCanDeactivate(bool validate) { _ValidateCanDeactivate = validate; } static void validateCanDeactivate(bool validate) { _ValidateCanDeactivate = validate; }
const std::string &getAHOnDeactiveCheck() const { return getAHName(_AHOnDeactiveCheck); } const std::string &getAHOnDeactiveCheck() const { return CAHManager::getInstance()->getAHName(_AHOnDeactiveCheck); }
const std::string &getAHOnDeactiveCheckParams() const { return _AHOnDeactiveCheckParams; } const std::string &getAHOnDeactiveCheckParams() const { return _AHOnDeactiveCheckParams; }
// //
const std::string &getAHOnCloseButton() const { return getAHName(_AHOnCloseButton); } const std::string &getAHOnCloseButton() const { return CAHManager::getInstance()->getAHName(_AHOnCloseButton); }
const std::string &getAHOnCloseButtonParams() const { return _AHOnCloseButtonParams; } const std::string &getAHOnCloseButtonParams() const { return _AHOnCloseButtonParams; }
// //
IActionHandler *getAHOnMovePtr() const { return _AHOnMove; } IActionHandler *getAHOnMovePtr() const { return _AHOnMove; }
const std::string &getAHOnMove() const { return getAHName(_AHOnMove); } const std::string &getAHOnMove() const { return CAHManager::getInstance()->getAHName(_AHOnMove); }
const std::string &getAHOnMoveParams() const { return _AHOnMoveParams; } const std::string &getAHOnMoveParams() const { return _AHOnMoveParams; }
// //
IActionHandler *getAHOnResizePtr() const { return _AHOnResize; } IActionHandler *getAHOnResizePtr() const { return _AHOnResize; }
const std::string &getAHOnResize() const { return getAHName(_AHOnResize); } const std::string &getAHOnResize() const { return CAHManager::getInstance()->getAHName(_AHOnResize); }
const std::string &getAHOnResizeParams() const { return _AHOnResizeParams; } const std::string &getAHOnResizeParams() const { return _AHOnResizeParams; }
// //
IActionHandler *getAHOnBeginMovePtr() const { return _AHOnBeginMove; } IActionHandler *getAHOnBeginMovePtr() const { return _AHOnBeginMove; }
const std::string &getAHOnBeginMove() const { return getAHName(_AHOnBeginMove); } const std::string &getAHOnBeginMove() const { return CAHManager::getInstance()->getAHName(_AHOnBeginMove); }
const std::string &getAHOnBeginMoveParams() const { return _AHOnBeginMoveParams; } const std::string &getAHOnBeginMoveParams() const { return _AHOnBeginMoveParams; }
// //
void setOnCloseButtonHandler(const std::string &h) { _AHOnCloseButton = getAH(h,_AHOnCloseButtonParams); } void setOnCloseButtonHandler(const std::string &h) { _AHOnCloseButton = CAHManager::getInstance()->getAH(h,_AHOnCloseButtonParams); }
void setOnCloseButtonParams(const std::string &p) { _AHOnCloseButtonParams = p; } void setOnCloseButtonParams(const std::string &p) { _AHOnCloseButtonParams = p; }
std::string getAHOnAlphaSettingsChanged() const { return getAHName(_AHOnAlphaSettingsChanged); } std::string getAHOnAlphaSettingsChanged() const { return CAHManager::getInstance()->getAHName(_AHOnAlphaSettingsChanged); }
std::string getAHOnAlphaSettingsChangedParams() const { return _AHOnAlphaSettingsChangedParams; } std::string getAHOnAlphaSettingsChangedParams() const { return _AHOnAlphaSettingsChangedParams; }
void setAHOnAlphaSettingsChanged(const std::string &h) { _AHOnAlphaSettingsChanged = getAH(h, _AHOnAlphaSettingsChangedParams); } void setAHOnAlphaSettingsChanged(const std::string &h) { _AHOnAlphaSettingsChanged = CAHManager::getInstance()->getAH(h, _AHOnAlphaSettingsChangedParams); }
void setAHOnAlphaSettingsChangedParams(const std::string &p) { _AHOnAlphaSettingsChangedParams = p; } void setAHOnAlphaSettingsChangedParams(const std::string &p) { _AHOnAlphaSettingsChangedParams = p; }

View file

@ -119,7 +119,7 @@ bool CGroupEditBox::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
} }
// NB: use InterfaceGroup "OnEnter" data. Different script params for an historic reason // NB: use InterfaceGroup "OnEnter" data. Different script params for an historic reason
parseAH(cur, "onenter", "params", _AHOnEnter, _AHOnEnterParams); CAHManager::getInstance()->parseAH(cur, "onenter", "params", _AHOnEnter, _AHOnEnterParams);
prop = (char*) xmlGetProp( cur, (xmlChar*)"onchange" ); prop = (char*) xmlGetProp( cur, (xmlChar*)"onchange" );
if (prop) _AHOnChange = (const char *) prop; if (prop) _AHOnChange = (const char *) prop;

View file

@ -752,7 +752,7 @@ bool CCtrlTabButton::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
// if left click not setuped, set default // if left click not setuped, set default
_AHOnLeftClick2 = _AHOnLeftClick; _AHOnLeftClick2 = _AHOnLeftClick;
string dummy; string dummy;
_AHOnLeftClick= getAH("tab_select", dummy); _AHOnLeftClick= CAHManager::getInstance()->getAH("tab_select", dummy);
// read the associated group to show/hide // read the associated group to show/hide
CXMLAutoPtr prop; CXMLAutoPtr prop;

View file

@ -37,8 +37,8 @@ CInterfaceGroupWheel::CInterfaceGroupWheel(const TCtorParam &param) : CInterface
bool CInterfaceGroupWheel::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) bool CInterfaceGroupWheel::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
{ {
if (!CInterfaceGroup::parse(cur, parentGroup)) return false; if (!CInterfaceGroup::parse(cur, parentGroup)) return false;
parseAH(cur, "on_wheel_up", "on_wheel_up_params", _AHWheelUp, _AHWheelUpParams); CAHManager::getInstance()->parseAH(cur, "on_wheel_up", "on_wheel_up_params", _AHWheelUp, _AHWheelUpParams);
parseAH(cur, "on_wheel_down", "on_wheel_down_params", _AHWheelDown, _AHWheelDownParams); CAHManager::getInstance()->parseAH(cur, "on_wheel_down", "on_wheel_down_params", _AHWheelDown, _AHWheelDownParams);
return true; return true;
} }

View file

@ -1254,11 +1254,11 @@ void CInterfaceElement::serialAH(NLMISC::IStream &f, IActionHandler *&ah)
if (f.isReading()) if (f.isReading())
{ {
f.serial(ahName); f.serial(ahName);
ah = CActionHandlerFactoryManager::getInstance()->getActionHandler(ahName); ah = CAHManager::getInstance()->getActionHandler(ahName);
} }
else else
{ {
ahName = CActionHandlerFactoryManager::getInstance()->getActionHandlerName(ah); ahName = CAHManager::getInstance()->getActionHandlerName(ah);
f.serial(ahName); f.serial(ahName);
} }
} }

View file

@ -292,8 +292,8 @@ bool CInterfaceGroup::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
{ {
NLMISC::fromString((const char*)ptr, _ResizeFromChildHMargin); NLMISC::fromString((const char*)ptr, _ResizeFromChildHMargin);
} }
parseAH(cur, "on_active", "on_active_params", _AHOnActive, _AHOnActiveParams); CAHManager::getInstance()->parseAH(cur, "on_active", "on_active_params", _AHOnActive, _AHOnActiveParams);
parseAH(cur, "on_deactive", "on_deactive_params", _AHOnDeactive, _AHOnDeactiveParams); CAHManager::getInstance()->parseAH(cur, "on_deactive", "on_deactive_params", _AHOnDeactive, _AHOnDeactiveParams);
// Read user max size // Read user max size
ptr = (char*) xmlGetProp( cur, (xmlChar*)"max_w" ); ptr = (char*) xmlGetProp( cur, (xmlChar*)"max_w" );
@ -327,11 +327,11 @@ bool CInterfaceGroup::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
} }
// left & right clicks // left & right clicks
parseAH(cur, "group_onclick_r", "group_params_r", _AHOnRightClick, _AHOnRightClickParams); CAHManager::getInstance()->parseAH(cur, "group_onclick_r", "group_params_r", _AHOnRightClick, _AHOnRightClickParams);
parseAH(cur, "group_onclick_l", "group_params_l", _AHOnLeftClick, _AHOnLeftClickParams); CAHManager::getInstance()->parseAH(cur, "group_onclick_l", "group_params_l", _AHOnLeftClick, _AHOnLeftClickParams);
// Each window (modal and groupContainer) can be validated by Enter. if "" => no op. // Each window (modal and groupContainer) can be validated by Enter. if "" => no op.
parseAH(cur, "on_enter", "on_enter_params", _AHOnEnter, _AHOnEnterParams); CAHManager::getInstance()->parseAH(cur, "on_enter", "on_enter_params", _AHOnEnter, _AHOnEnterParams);
ptr = (char*) xmlGetProp( cur, (xmlChar*)"win_priority" ); ptr = (char*) xmlGetProp( cur, (xmlChar*)"win_priority" );
if(ptr) NLMISC::fromString((const char*)ptr, _Priority); if(ptr) NLMISC::fromString((const char*)ptr, _Priority);
@ -341,7 +341,7 @@ bool CInterfaceGroup::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
// Each window (modal and groupContainer) can be escaped if "escapable" set // Each window (modal and groupContainer) can be escaped if "escapable" set
// they can add an action handler before the hide // they can add an action handler before the hide
parseAH(cur, "on_escape", "on_escape_params", _AHOnEscape, _AHOnEscapeParams); CAHManager::getInstance()->parseAH(cur, "on_escape", "on_escape_params", _AHOnEscape, _AHOnEscapeParams);
// LuaClass script // LuaClass script
@ -1559,13 +1559,13 @@ void CInterfaceGroup::setAlpha (sint32 a)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceGroup::setLeftClickHandler(const std::string &handler) void CInterfaceGroup::setLeftClickHandler(const std::string &handler)
{ {
_AHOnLeftClick = getAH(handler, _AHOnLeftClickParams); _AHOnLeftClick = CAHManager::getInstance()->getAH(handler, _AHOnLeftClickParams);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceGroup::setRightClickHandler(const std::string &handler) void CInterfaceGroup::setRightClickHandler(const std::string &handler)
{ {
_AHOnRightClick = getAH(handler, _AHOnRightClickParams); _AHOnRightClick = CAHManager::getInstance()->getAH(handler, _AHOnRightClickParams);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View file

@ -134,13 +134,13 @@ public:
// escapable // escapable
void setEscapable(bool b) { _Escapable= b; } void setEscapable(bool b) { _Escapable= b; }
bool getEscapable() const { return _Escapable; } bool getEscapable() const { return _Escapable; }
void setAHOnEscape(const std::string &ah) { _AHOnEscape = getAH(ah, _AHOnEscapeParams); } void setAHOnEscape(const std::string &ah) { _AHOnEscape = CAHManager::getInstance()->getAH(ah, _AHOnEscapeParams); }
const std::string &getAHOnEscape() const { return getAHName(_AHOnEscape); } const std::string &getAHOnEscape() const { return CAHManager::getInstance()->getAHName(_AHOnEscape); }
void setAHOnEscapeParams(const std::string &ah) { _AHOnEscapeParams = ah; } void setAHOnEscapeParams(const std::string &ah) { _AHOnEscapeParams = ah; }
const std::string &getAHOnEscapeParams() const { return _AHOnEscapeParams; } const std::string &getAHOnEscapeParams() const { return _AHOnEscapeParams; }
// enterable // enterable
void setAHOnEnter(const std::string &ah) { _AHOnEnter = getAH(ah, _AHOnEnterParams); } void setAHOnEnter(const std::string &ah) { _AHOnEnter = CAHManager::getInstance()->getAH(ah, _AHOnEnterParams); }
const std::string &getAHOnEnter() const { return getAHName(_AHOnEnter); } const std::string &getAHOnEnter() const { return CAHManager::getInstance()->getAHName(_AHOnEnter); }
void setAHOnEnterParams(const std::string &ah) { _AHOnEnterParams = ah; } void setAHOnEnterParams(const std::string &ah) { _AHOnEnterParams = ah; }
const std::string &getAHOnEnterParams() const { return _AHOnEnterParams; } const std::string &getAHOnEnterParams() const { return _AHOnEnterParams; }
uint8 getPriority() const { return _Priority; } uint8 getPriority() const { return _Priority; }
@ -174,18 +174,18 @@ public:
void setRightClickHandler(const std::string &handler); void setRightClickHandler(const std::string &handler);
void setLeftClickHandlerParams(const std::string &params) { _AHOnLeftClickParams = params; } void setLeftClickHandlerParams(const std::string &params) { _AHOnLeftClickParams = params; }
void setRightClickHandlerParams(const std::string &params) { _AHOnRightClickParams = params; } void setRightClickHandlerParams(const std::string &params) { _AHOnRightClickParams = params; }
void setOnActiveHandler(const std::string &h) { _AHOnActive = getAH(h,_AHOnActiveParams); } void setOnActiveHandler(const std::string &h) { _AHOnActive = CAHManager::getInstance()->getAH(h,_AHOnActiveParams); }
void setOnActiveParams(const std::string &p) { _AHOnActiveParams = p; } void setOnActiveParams(const std::string &p) { _AHOnActiveParams = p; }
void setOnDeactiveHandler(const std::string &h) { _AHOnDeactive = getAH(h,_AHOnDeactiveParams); } void setOnDeactiveHandler(const std::string &h) { _AHOnDeactive = CAHManager::getInstance()->getAH(h,_AHOnDeactiveParams); }
void setOnDeactiveParams(const std::string &p) { _AHOnDeactiveParams = p; } void setOnDeactiveParams(const std::string &p) { _AHOnDeactiveParams = p; }
const std::string &getLeftClickHandler() const { return getAHName(_AHOnLeftClick); } const std::string &getLeftClickHandler() const { return CAHManager::getInstance()->getAHName(_AHOnLeftClick); }
const std::string &getLeftClickHandlerParams() const { return _AHOnLeftClickParams; } const std::string &getLeftClickHandlerParams() const { return _AHOnLeftClickParams; }
const std::string &getRightClickHandler() const { return getAHName(_AHOnRightClick); } const std::string &getRightClickHandler() const { return CAHManager::getInstance()->getAHName(_AHOnRightClick); }
const std::string &getRightClickHandlerParams() const { return _AHOnRightClickParams; } const std::string &getRightClickHandlerParams() const { return _AHOnRightClickParams; }
const std::string &getOnActiveHandler() const { return getAHName(_AHOnActive); } const std::string &getOnActiveHandler() const { return CAHManager::getInstance()->getAHName(_AHOnActive); }
const std::string &getOnActiveParams() const { return _AHOnActiveParams; } const std::string &getOnActiveParams() const { return _AHOnActiveParams; }
const std::string &getOnDeactiveHandler() const { return getAHName(_AHOnDeactive); } const std::string &getOnDeactiveHandler() const { return CAHManager::getInstance()->getAHName(_AHOnDeactive); }
const std::string &getOnDeactiveParams() const { return _AHOnDeactiveParams; } const std::string &getOnDeactiveParams() const { return _AHOnDeactiveParams; }
// find a sub view/ctrl/group in this group from its id // find a sub view/ctrl/group in this group from its id

View file

@ -1410,7 +1410,7 @@ void CInterfaceManager::runActionHandler (const string &ahCmdLine, CCtrlBase *pC
ahParams= ahUserParams; ahParams= ahUserParams;
// Execute the action handler // Execute the action handler
CActionHandlerFactoryManager *pAHFM = CActionHandlerFactoryManager::getInstance(); CAHManager *pAHFM = CAHManager::getInstance();
map<string, IActionHandler*>::iterator it = pAHFM->FactoryMap.find (ahName); map<string, IActionHandler*>::iterator it = pAHFM->FactoryMap.find (ahName);
if (it == pAHFM->FactoryMap.end()) if (it == pAHFM->FactoryMap.end())
{ {
@ -1442,11 +1442,11 @@ void CInterfaceManager::runActionHandler (IActionHandler *pAH, CCtrlBase *pCalle
return; return;
} }
pAH->execute (pCaller, Params); pAH->execute (pCaller, Params);
string AHName = getAHName(pAH); string AHName = CAHManager::getInstance()->getAHName(pAH);
// Quick Help // Quick Help
const string submitQuickHelp = "submit_quick_help"; const string submitQuickHelp = "submit_quick_help";
CActionHandlerFactoryManager *pAHFM = CActionHandlerFactoryManager::getInstance(); CAHManager *pAHFM = CAHManager::getInstance();
map<string, IActionHandler*>::iterator it = pAHFM->FactoryMap.find (AHName); map<string, IActionHandler*>::iterator it = pAHFM->FactoryMap.find (AHName);
it = pAHFM->FactoryMap.find(submitQuickHelp); it = pAHFM->FactoryMap.find(submitQuickHelp);
if(it == pAHFM->FactoryMap.end()) if(it == pAHFM->FactoryMap.end())

View file

@ -3173,11 +3173,11 @@ bool CInterfaceParser::parseActionCategory(xmlNodePtr cur)
else else
{ {
// Remove thoses actions from the manager // Remove thoses actions from the manager
CActionHandlerFactoryManager *pAHFM = CActionHandlerFactoryManager::getInstance(); CAHManager *pAHFM = CAHManager::getInstance();
uint i; uint i;
for (i=0; i<category.BaseActions.size(); i++) for (i=0; i<category.BaseActions.size(); i++)
{ {
CActionHandlerFactoryManager::TFactoryMap::iterator ite = pAHFM->FactoryMap.find (category.BaseActions[i].Name); CAHManager::TFactoryMap::iterator ite = pAHFM->FactoryMap.find (category.BaseActions[i].Name);
if (ite != pAHFM->FactoryMap.end()) if (ite != pAHFM->FactoryMap.end())
{ {
IActionHandler *ah = ite->second; IActionHandler *ah = ite->second;

View file

@ -84,6 +84,7 @@
#include "game_share/r2_share_itf.h" #include "game_share/r2_share_itf.h"
#include "game_share/r2_types.h" #include "game_share/r2_types.h"
#include "npc_icon.h" #include "npc_icon.h"
#include "interface_v3/action_handler_base.h"
// Std. // Std.
#include <vector> #include <vector>