From cdbcadcbaaeb90ab03a039508849609e7fb1fcef Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Thu, 12 Jul 2012 05:29:33 +0200 Subject: [PATCH] CHANGED: #1471 Moved CProcedure code to it's own files, and also moved the procedure handling code from CInterfaceManager to CWidgetManager. --- code/nel/include/nel/gui/interface_parser.h | 46 +---- code/nel/include/nel/gui/proc.h | 77 ++++++++ code/nel/include/nel/gui/widget_manager.h | 13 +- code/nel/src/gui/interface_parser.cpp | 160 ++--------------- code/nel/src/gui/proc.cpp | 167 ++++++++++++++++++ code/nel/src/gui/widget_manager.cpp | 64 +++++++ code/ryzom/client/src/actions.h | 2 +- code/ryzom/client/src/connection.cpp | 2 +- .../src/interface_v3/action_handler_base.cpp | 5 +- .../src/interface_v3/action_handler_game.cpp | 7 +- .../src/interface_v3/action_handler_misc.cpp | 4 +- .../src/interface_v3/bot_chat_page_trade.cpp | 2 +- .../src/interface_v3/interface_manager.cpp | 75 +------- .../src/interface_v3/interface_manager.h | 11 -- 14 files changed, 349 insertions(+), 286 deletions(-) create mode 100644 code/nel/include/nel/gui/proc.h create mode 100644 code/nel/src/gui/proc.cpp diff --git a/code/nel/include/nel/gui/interface_parser.h b/code/nel/include/nel/gui/interface_parser.h index 0a7e7a9c6..17e4af59a 100644 --- a/code/nel/include/nel/gui/interface_parser.h +++ b/code/nel/include/nel/gui/interface_parser.h @@ -25,6 +25,7 @@ #include "nel/gui/interface_link.h" #include "nel/misc/smart_ptr.h" #include "nel/gui/lua_helper.h" +#include "nel/gui/proc.h" #include "nel/gui/widget_manager.h" namespace NLGUI @@ -230,6 +231,8 @@ namespace NLGUI CInterfaceAnim* getAnim( const std::string &name ) const; + CProcedure* getProc( const std::string &name ); + protected: /** @@ -260,49 +263,6 @@ namespace NLGUI bool validDefineChar(char c) const; - /// Procedure def - class CParamBlock - { - public: - // -1 if not a param id, but a string - sint32 NumParam; - std::string String; - - CParamBlock() - { - NumParam= -1; - } - }; - class CAction - { - public: - // a condition to launch this action handler (is an expression) - std::vector CondBlocks; - - // the action handler (may be proc!!) - std::string Action; - // A list of string/or param number => to build the final params at execution - std::vector ParamBlocks; - - // build a paramBlock from a string - void buildParamBlock (const std::string ¶ms); - // from ParamBlock, and a paramList (skip the 0th), build params. - void buildParams (const std::vector ¶mList, std::string ¶ms) const; - - void buildCondBlock (const std::string ¶ms); - - void buildCond (const std::vector ¶mList, std::string &cond) const; - - static void buildBlocks (const std::string &in, std::vector &out); - static void eval (const std::vector &inArgs, const std::vector &inBlocks, std::string &out); - - }; - class CProcedure - { - public: - // List of the actions - std::vector Actions; - }; class CStyleProperty { public: diff --git a/code/nel/include/nel/gui/proc.h b/code/nel/include/nel/gui/proc.h new file mode 100644 index 000000000..ea3c382ed --- /dev/null +++ b/code/nel/include/nel/gui/proc.h @@ -0,0 +1,77 @@ +// Ryzom - MMORPG Framework +// 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 . + + +#ifndef PROC_H +#define PROC_H + +#include "nel/misc/types_nl.h" +#include +#include + +namespace NLGUI +{ + class CParamBlock + { + public: + // -1 if not a param id, but a string + sint32 NumParam; + std::string String; + + CParamBlock() + { + NumParam = -1; + } + }; + + + class CProcAction + { + public: + // a condition to launch this action handler (is an expression) + std::vector< CParamBlock > CondBlocks; + + // the action handler (may be proc!!) + std::string Action; + // A list of string/or param number => to build the final params at execution + std::vector< CParamBlock > ParamBlocks; + + // build a paramBlock from a string + void buildParamBlock( const std::string ¶ms ); + // from ParamBlock, and a paramList (skip the 0th), build params. + void buildParams( const std::vector< std::string > ¶mList, std::string ¶ms ) const; + + void buildCondBlock( const std::string ¶ms ); + + void buildCond( const std::vector< std::string > ¶mList, std::string &cond ) const; + + static void buildBlocks( const std::string &in, std::vector< CParamBlock > &out ); + + static void eval( const std::vector< std::string > &inArgs, const std::vector< CParamBlock > &inBlocks, std::string &out ); + + }; + + + class CProcedure + { + public: + // List of the actions + std::vector< CProcAction > Actions; + }; +} + +#endif + diff --git a/code/nel/include/nel/gui/widget_manager.h b/code/nel/include/nel/gui/widget_manager.h index 37c628a48..e716816b5 100644 --- a/code/nel/include/nel/gui/widget_manager.h +++ b/code/nel/include/nel/gui/widget_manager.h @@ -44,6 +44,7 @@ namespace NLGUI class CViewPointerBase; class CInterfaceOptions; class CInterfaceAnim; + class CProcedure; class IParser { @@ -59,6 +60,7 @@ namespace NLGUI virtual bool getProcedureAction( const std::string &procName, uint actionIndex, std::string &ah, std::string ¶ms ) const = 0; virtual const std::string& getDefine(const std::string &id) const = 0; virtual CInterfaceAnim* getAnim( const std::string &name ) const = 0; + virtual CProcedure* getProc( const std::string &name ) = 0; }; /// Manages the GUI widgets @@ -332,7 +334,7 @@ namespace NLGUI void drawViews( NL3D::UCamera camera ); - bool handleEvent( const CEventDescriptor &eventDesc ); + bool handleEvent( const CEventDescriptor &evnt ); bool handleMouseMoveEvent( const CEventDescriptor &eventDesc ); @@ -474,6 +476,13 @@ namespace NLGUI void stopAnim( const std::string &animId ); void updateAnims(); void removeFinishedAnims(); + + // execute a procedure. give a list of parameters. NB: the first param is the name of the proc (skipped)... + void runProcedure( const std::string &procName, CCtrlBase *pCaller, const std::vector< std::string > ¶mList ); + // replace an action in a procedure (if possible) + void setProcedureAction( const std::string &procName, uint actionIndex, const std::string &ah, const std::string ¶ms ); + + const CEventDescriptorKey& getLastKeyEvent() const{ return lastKeyEvent; } static IParser *parser; @@ -542,6 +551,8 @@ namespace NLGUI bool _MouseOverWindow; + CEventDescriptorKey lastKeyEvent; + uint32 screenH; uint32 screenW; diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index b8f2935dc..baa4853ca 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -1772,7 +1772,7 @@ namespace NLGUI CXMLAutoPtr name((const char*) xmlGetProp (cur, (xmlChar*)"handler")); CXMLAutoPtr params((const char*) xmlGetProp (cur, (xmlChar*)"params")); CXMLAutoPtr cond((const char*) xmlGetProp (cur, (xmlChar*)"cond")); - CAction action; + CProcAction action; if(!name) { // todo hulud interface syntax error @@ -2086,153 +2086,6 @@ namespace NLGUI return true; } - - // *************************************************************************** - // CInterfaceParser::CAction - // *************************************************************************** - - #define PROC_PARAM_IDENT '@' - - // *************************************************************************** - void CInterfaceParser::CAction::buildParamBlock(const std::string ¶ms) - { - buildBlocks (params, ParamBlocks); - } - - void CInterfaceParser::CAction::buildParams(const std::vector ¶mList, std::string ¶ms) const - { - eval (paramList, ParamBlocks, params); - } - - void CInterfaceParser::CAction::buildCondBlock(const std::string ¶ms) - { - buildBlocks (params, CondBlocks); - } - - void CInterfaceParser::CAction::buildCond(const std::vector ¶mList, std::string ¶ms) const - { - eval (paramList, CondBlocks, params); - } - - // *************************************************************************** - void CInterfaceParser::CAction::buildBlocks (const std::string &in, std::vector &out) - { - out.clear(); - - if(in.empty()) - return; - - string lastString; - string::size_type curPos= 0; - string::size_type lastPos= 0; - - //if it has some @ then solve proc value - while( (curPos=in.find(PROC_PARAM_IDENT, curPos)) != string::npos) - { - // If it is end of line - if(curPos==in.size()-1) - { - // then skip - curPos= in.size(); - } - else - { - // Skip all @ - uint countNbIdent = 0; - while (curPos='0' && in[curPos]<='9') - { - curPos++; - countNbDigit++; - } - - if (curPos == startIdPos) - { - // No digit so it is a normal db entry - lastString+= in.substr (lastPos, curPos-(countNbIdent-1)-lastPos); - // all @ are skipped - } - else - { - // There is some digit it is an argument - - // copy the last not param sub string. - sint nbToCopy = (sint)(curPos-countNbIdent-countNbDigit-lastPos); - if (nbToCopy > 0) - lastString += in.substr(lastPos, nbToCopy); - - // if not empty, add to the param block - if (!lastString.empty()) - { - CParamBlock pb; - pb.String = lastString; - out.push_back(pb); - // clear it - lastString.clear(); - } - - // get the param id - sint paramId; - fromString(in.substr(startIdPos, curPos-startIdPos), paramId); - // Add it to the param block - CParamBlock pb; - pb.NumParam = paramId; - out.push_back(pb); - } - - // valid pos is current pos - lastPos= curPos; - } - } - // concat last part - lastString+= in.substr(lastPos, in.size()-lastPos); - if(!lastString.empty()) - { - CParamBlock pb; - pb.String = lastString; - out.push_back(pb); - } - } - - // *************************************************************************** - //void CInterfaceParser::CAction::buildParams(const std::vector ¶mList, std::string ¶ms) const - void CInterfaceParser::CAction::eval (const std::vector &inArgs, const std::vector &inBlocks, std::string &out) - { - // clear the ret string - out.clear(); - - // for all block - for (uint i=0; i < inBlocks.size(); i++) - { - const CParamBlock &pb = inBlocks[i]; - // if the block is a raw string - if (pb.NumParam < 0) - { - // concat with the block - out += pb.String; - } - // else get from paramList - else - { - // add 1, because paramList[0] is the name of the procedure - sint idInList = pb.NumParam+1; - // if param exist - if (idInList < (sint)inArgs.size()) - // concat with the params - out += inArgs[idInList]; - // else skip (should fail) - } - } - } - // *************************************************************************** bool CInterfaceParser::parseSheetSelection(xmlNodePtr cur) { @@ -2638,7 +2491,7 @@ namespace NLGUI const CProcedure &proc= it->second; if(actionIndexsecond; } + CProcedure* CInterfaceParser::getProc( const std::string &name ) + { + TProcedureMap::iterator itr = _ProcedureMap.find( name ); + if( itr == _ProcedureMap.end() ) + return NULL; + + return &itr->second; + } + // *************************************************************************** bool CInterfaceParser::parseStyle(xmlNodePtr cur) { diff --git a/code/nel/src/gui/proc.cpp b/code/nel/src/gui/proc.cpp new file mode 100644 index 000000000..fda4344c3 --- /dev/null +++ b/code/nel/src/gui/proc.cpp @@ -0,0 +1,167 @@ +// Ryzom - MMORPG Framework +// 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 . + + +#include "nel/gui/proc.h" +#include "nel/misc/algo.h" + +using namespace NLMISC; + +namespace NLGUI +{ + +#define PROC_PARAM_IDENT '@' + + // *************************************************************************** + void CProcAction::buildParamBlock( const std::string ¶ms ) + { + buildBlocks( params, ParamBlocks ); + } + + void CProcAction::buildParams( const std::vector< std::string > ¶mList, std::string ¶ms ) const + { + eval( paramList, ParamBlocks, params ); + } + + void CProcAction::buildCondBlock( const std::string ¶ms ) + { + buildBlocks( params, CondBlocks ); + } + + void CProcAction::buildCond( const std::vector< std::string > ¶mList, std::string ¶ms ) const + { + eval( paramList, CondBlocks, params ); + } + + // *************************************************************************** + void CProcAction::buildBlocks( const std::string &in, std::vector< CParamBlock > &out ) + { + out.clear(); + + if(in.empty()) + return; + + std::string lastString; + std::string::size_type curPos= 0; + std::string::size_type lastPos= 0; + + //if it has some @ then solve proc value + while( (curPos=in.find(PROC_PARAM_IDENT, curPos)) != std::string::npos) + { + // If it is end of line + if(curPos==in.size()-1) + { + // then skip + curPos= in.size(); + } + else + { + // Skip all @ + uint countNbIdent = 0; + while (curPos='0' && in[curPos]<='9') + { + curPos++; + countNbDigit++; + } + + if (curPos == startIdPos) + { + // No digit so it is a normal db entry + lastString+= in.substr (lastPos, curPos-(countNbIdent-1)-lastPos); + // all @ are skipped + } + else + { + // There is some digit it is an argument + + // copy the last not param sub string. + sint nbToCopy = (sint)(curPos-countNbIdent-countNbDigit-lastPos); + if (nbToCopy > 0) + lastString += in.substr(lastPos, nbToCopy); + + // if not empty, add to the param block + if (!lastString.empty()) + { + CParamBlock pb; + pb.String = lastString; + out.push_back(pb); + // clear it + lastString.clear(); + } + + // get the param id + sint paramId; + fromString(in.substr(startIdPos, curPos-startIdPos), paramId); + // Add it to the param block + CParamBlock pb; + pb.NumParam = paramId; + out.push_back(pb); + } + + // valid pos is current pos + lastPos= curPos; + } + } + // concat last part + lastString+= in.substr(lastPos, in.size()-lastPos); + if(!lastString.empty()) + { + CParamBlock pb; + pb.String = lastString; + out.push_back(pb); + } + } + + // *************************************************************************** + void CProcAction::eval( const std::vector &inArgs, const std::vector< CParamBlock > &inBlocks, std::string &out ) + { + // clear the ret string + out.clear(); + + // for all block + for (uint i=0; i < inBlocks.size(); i++) + { + const CParamBlock &pb = inBlocks[i]; + // if the block is a raw string + if (pb.NumParam < 0) + { + // concat with the block + out += pb.String; + } + // else get from paramList + else + { + // add 1, because paramList[0] is the name of the procedure + sint idInList = pb.NumParam+1; + // if param exist + if (idInList < (sint)inArgs.size()) + // concat with the params + out += inArgs[idInList]; + // else skip (should fail) + } + } + } +} + diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index b8e470867..fc399f208 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -28,6 +28,8 @@ #include "nel/gui/view_bitmap.h" #include "nel/gui/group_container.h" #include "nel/gui/interface_anim.h" +#include "nel/gui/proc.h" +#include "nel/gui/interface_expr.h" #include "nel/misc/events.h" namespace NLGUI @@ -2211,6 +2213,8 @@ namespace NLGUI CDBManager::getInstance()->flushObserverCalls(); return result; } + + lastKeyEvent = eventDesc; } //////////////////////////////////////////////// Keyboard handling ends here //////////////////////////////////// @@ -3028,6 +3032,66 @@ namespace NLGUI (*itr)->update(); } + + // ------------------------------------------------------------------------------------------------ + void CWidgetManager::runProcedure( const std::string &procName, CCtrlBase *pCaller, + const std::vector< std::string> ¶mList ) + { + CProcedure *procp = parser->getProc( procName ); + if( procp == NULL ) + return; + + CProcedure &proc = *procp; + + // Run all actions + for( uint i = 0; i < proc.Actions.size(); i++ ) + { + const CProcAction &action = proc.Actions[i]; + // test if the condition for the action is valid + if( action.CondBlocks.size() > 0 ) + { + CInterfaceExprValue result; + result.setBool( false ); + std::string cond; + action.buildCond( paramList, cond ); + CInterfaceExpr::eval( cond, result, NULL ); + + if( result.toBool() ) + if( !result.getBool() ) + continue; + } + // build the params sting + std::string params; + action.buildParams( paramList, params ); + // run + //nlwarning("step %d : %s, %s", (int) i, action.Action.c_str(), params.c_str()); + CAHManager::getInstance()->runActionHandler( action.Action, pCaller, params ); + } + } + + // ------------------------------------------------------------------------------------------------ + void CWidgetManager::setProcedureAction( const std::string &procName, uint actionIndex, + const std::string &ah, const std::string ¶ms ) + { + CProcedure *procp = parser->getProc( procName ); + if( procp == NULL ) + return; + + CProcedure &proc = *procp; + + // set wanted action + if( actionIndex p; p.push_back(sProc); - pIM->runProcedure(sProc, pCaller, p); + CWidgetManager::getInstance()->runProcedure(sProc, pCaller, p); CInterfaceExprValue result; if (CInterfaceExpr::eval(sCond, result)) diff --git a/code/ryzom/client/src/interface_v3/action_handler_base.cpp b/code/ryzom/client/src/interface_v3/action_handler_base.cpp index e66c4e2af..c051f2877 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_base.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_base.cpp @@ -315,11 +315,10 @@ class CAHMilkoMenuDoResetInterface : public IActionHandler // run procedure vector v; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); if (mode == "R2TestMode") - pIM->runProcedure ("proc_reset_r2ed_interface", NULL, v); + CWidgetManager::getInstance()->runProcedure ("proc_reset_r2ed_interface", NULL, v); else - pIM->runProcedure("proc_reset_interface", NULL, v); + CWidgetManager::getInstance()->runProcedure("proc_reset_interface", NULL, v); } }; REGISTER_ACTION_HANDLER(CAHMilkoMenuDoResetInterface, "milko_menu_do_reset_interface"); diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 628bfd0dc..1b245abea 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -1857,7 +1857,7 @@ public: if (ClientCfg.Light) { vector v; - CInterfaceManager::getInstance()->runProcedure ("proc_reset_interface", NULL, v); + CWidgetManager::getInstance()->runProcedure ("proc_reset_interface", NULL, v); //CInterfaceManager::getInstance()->launchContextMenuInGame("ui:interface:game_context_menu"); } @@ -2747,7 +2747,7 @@ public: vector vecStr; vecStr.push_back(procNames[desktop]); vecStr.push_back(sValue); - pIM->runProcedure(procNames[desktop], NULL, vecStr); + CWidgetManager::getInstance()->runProcedure(procNames[desktop], NULL, vecStr); }*/ CInterfaceManager *pIM = CInterfaceManager::getInstance(); @@ -2773,11 +2773,10 @@ public: { _FirstTime = false; - CInterfaceManager *pIM= CInterfaceManager::getInstance(); vector vecStr; vecStr.push_back("tb_setdesktop"); vecStr.push_back(Params); - pIM->runProcedure("tb_setdesktop", NULL, vecStr); + CWidgetManager::getInstance()->runProcedure("tb_setdesktop", NULL, vecStr); } else // Not the first time { diff --git a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp index b95524708..e07f12e74 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -288,8 +288,6 @@ class CActionHandlerProc : public IActionHandler public: virtual void execute (CCtrlBase *pCaller, const std::string ¶ms) { - CInterfaceManager *mngr= CInterfaceManager::getInstance(); - // split the parameters vector paramList; splitString(params, "|", paramList); @@ -297,7 +295,7 @@ public: return; // execute the procedure - mngr->runProcedure(paramList[0], pCaller, paramList); + CWidgetManager::getInstance()->runProcedure(paramList[0], pCaller, paramList); } }; REGISTER_ACTION_HANDLER (CActionHandlerProc, "proc"); diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index cce7b1f84..ac5cc69a8 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -2249,7 +2249,7 @@ class CAHConfirmTrade : public IActionHandler case 1: enableResale = true; break; default: // 2: comes only from Enter of Shift+Enter key from an edit box or in the modal window { - const NLGUI::CEventDescriptorKey& keyEvent = CInterfaceManager::getInstance()->getLastEventKeyDesc(); + const NLGUI::CEventDescriptorKey& keyEvent = CWidgetManager::getInstance()->getLastKeyEvent(); enableResale = ! keyEvent.getKeyShift(); } } diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index b51c968d8..e545993d6 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1422,7 +1422,6 @@ void CInterfaceManager::updateFrameEvents() // Handle anims done in 2 times because some AH can add or remove anims // First ensure we are working on a safe vector and update all anims - sint i; CWidgetManager::getInstance()->updateAnims(); IngameDbMngr.flushObserverCalls(); @@ -1599,11 +1598,11 @@ bool CInterfaceManager::loadConfig (const string &filename) vector v; if (ClientCfg.R2EDEnabled) { - runProcedure ("proc_reset_r2ed_interface", NULL, v); + CWidgetManager::getInstance()->runProcedure ("proc_reset_r2ed_interface", NULL, v); } else { - runProcedure ("proc_reset_interface", NULL, v); + CWidgetManager::getInstance()->runProcedure ("proc_reset_interface", NULL, v); } // By default, consider the reset interface has been set with the current resolution @@ -1754,7 +1753,7 @@ bool CInterfaceManager::loadConfig (const string &filename) vector v; if (!ClientCfg.R2EDEnabled) { - runProcedure ("proc_reset_interface", NULL, v); + CWidgetManager::getInstance()->runProcedure ("proc_reset_interface", NULL, v); } return false; } @@ -2123,68 +2122,6 @@ void CInterfaceManager::processServerIDString() } } -// ------------------------------------------------------------------------------------------------ -void CInterfaceManager::runProcedure (const string &procName, CCtrlBase *pCaller, - const vector ¶mList) -{ - CstItProcedureMap it= _ProcedureMap.find(procName); - if(it!=_ProcedureMap.end()) - { - // TMP TMP - /*std::string params; - for(uint k = 0; k < paramList.size(); ++k) - { - params += paramList[k] + " "; - } - - nlinfo("runProcedure : %s : %s",procName.c_str(), params.c_str());*/ - const CProcedure &proc= it->second; - // Run all actions - for(uint i=0;i 0) - { - CInterfaceExprValue result; - result.setBool(false); - string cond; - action.buildCond(paramList, cond); - CInterfaceExpr::eval(cond, result, NULL); - if (result.toBool()) - { - if (!result.getBool()) continue; - } - } - // build the params sting - string params; - action.buildParams(paramList, params); - // run - //nlwarning("step %d : %s, %s", (int) i, action.Action.c_str(), params.c_str()); - CAHManager::getInstance()->runActionHandler(action.Action, pCaller, params); - } - } -} - -// ------------------------------------------------------------------------------------------------ -void CInterfaceManager::setProcedureAction(const std::string &procName, uint actionIndex, const std::string &ah, const std::string ¶ms) -{ - ItProcedureMap it= _ProcedureMap.find(procName); - if(it!=_ProcedureMap.end()) - { - CProcedure &proc= it->second; - // set wanted action - if(actionIndexsetProcedureAction("proc_message_box_with_help_ok", 1, ahOnOk, paramsOnOk); const char *mbName = "message_box_with_help"; // if no action handler is wanted, then assume that // clicking 'ok' do not have any consequence, so allow exiting the message box by clicking @@ -2242,9 +2179,9 @@ void CInterfaceManager::validMessageBox(TValidMessageIcon icon, const ucstring & if (group && viewText) { // replace the procedure "proc_valid_message_box_ok" action - setProcedureAction("proc_valid_message_box_ok", 1, ahOnOk, paramsOnOk); + CWidgetManager::getInstance()->setProcedureAction("proc_valid_message_box_ok", 1, ahOnOk, paramsOnOk); // replace the procedure "proc_valid_message_box_cancel" action - setProcedureAction("proc_valid_message_box_cancel", 1, ahOnCancel, paramsOnCancel); + CWidgetManager::getInstance()->setProcedureAction("proc_valid_message_box_cancel", 1, ahOnCancel, paramsOnCancel); // set text and icon viewText->setText(text); diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index c7a105d32..38d6d7af9 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -261,11 +261,6 @@ public: /// Handle The Event. return true if the interfaceManager catch it and if must not send to the Game Action Manager bool handleEvent (const NLGUI::CEventDescriptor &eventDesc); - // execute a procedure. give a list of parameters. NB: the first param is the name of the proc (skipped)... - void runProcedure(const std::string &procName, CCtrlBase *pCaller, const std::vector ¶mList); - // replace an action in a procedure (if possible) - void setProcedureAction(const std::string &procName, uint actionIndex, const std::string &ah, const std::string ¶ms); - // InGame ContextMenu void launchContextMenuInGame (const std::string &nameOfCM); @@ -426,9 +421,6 @@ public: return 0; } - // Description of the last key event that called an action handler - const NLGUI::CEventDescriptorKey& getLastEventKeyDesc() const { return _LastEventKeyDesc; } - void notifyMailAvailable(); void notifyForumUpdated(); @@ -657,9 +649,6 @@ private: // Item Carac requirement sint32 _CurrentPlayerCharac[CHARACTERISTICS::NUM_CHARACTERISTICS]; - // Description of the last key event that called an action handler - NLGUI::CEventDescriptorKey _LastEventKeyDesc; - // observers for copying database branch changes CServerToLocalAutoCopy ServerToLocalAutoCopyInventory; CServerToLocalAutoCopy ServerToLocalAutoCopyExchange;