CHANGED: #1474 CInterfaceManager is no longer a subclass of CInterfaceParser, instead CInterfaceParser is a component of CInterfaceManager.

--HG--
branch : gui-refactoring
This commit is contained in:
dfighter1985 2012-07-12 21:39:51 +02:00
parent f9cda42c8d
commit ba6fd68efc
41 changed files with 215 additions and 192 deletions

View file

@ -87,6 +87,12 @@ namespace NLGUI
uint parsingStage;
};
class ISetupOptionCallbackClass
{
public:
virtual void setupOptions() = 0;
};
CInterfaceParser();
virtual ~CInterfaceParser();
@ -136,7 +142,7 @@ namespace NLGUI
bool solveDefine(const std::string &propVal, std::string &newPropVal, std::string &defError);
// Called after template & options parsing
virtual void setupOptions() { }
void setupOptions();
/**
* Initializer
@ -305,6 +311,7 @@ namespace NLGUI
bool cacheUIParsing;
bool luaInitialized;
ISetupOptionCallbackClass *setupCallback;
public:
void initLUA();
@ -316,6 +323,8 @@ namespace NLGUI
/// Reload all LUA scripts inserted through <lua>
void reloadAllLuaFileScripts();
void setSetupOptionsCallback( ISetupOptionCallbackClass *cb ){ setupCallback = cb; }
};
}

View file

@ -200,11 +200,18 @@ namespace NLGUI
{
luaInitialized = false;
cacheUIParsing = false;
setupCallback = NULL;
}
CInterfaceParser::~CInterfaceParser()
{
_ParentPositionsMap.clear();
_ParentSizesMap.clear();
_ParentSizesMaxMap.clear();
_LuaClassAssociation.clear();
_Templates.clear();
removeAllModules();
setupCallback = NULL;
}
/** Convert a string into a memstream
*/
@ -1806,6 +1813,12 @@ namespace NLGUI
return true;
}
void CInterfaceParser::setupOptions()
{
if( setupCallback != NULL )
setupCallback->setupOptions();
}
// ----------------------------------------------------------------------------
bool CInterfaceParser::initCoordsAndLuaScript()
{

View file

@ -5079,7 +5079,7 @@ NLMISC_COMMAND(luaReload, "reload all .lua script files", "")
CInterfaceManager *pIM= CInterfaceManager::getInstance();
if(ClientCfg.AllowDebugLua)
{
pIM->reloadAllLuaFileScripts();
pIM->getParser()->reloadAllLuaFileScripts();
return true;
}
else

View file

@ -967,9 +967,9 @@ TInterfaceState globalMenu()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
sint32 nScreenConnecting, nScreenIntro, nScreenServerCrashed;
fromString(pIM->getDefine("screen_connecting"), nScreenConnecting);
fromString(pIM->getDefine("screen_intro"), nScreenIntro);
fromString(pIM->getDefine("screen_crashing"), nScreenServerCrashed);
fromString(pIM->getParser()->getDefine("screen_connecting"), nScreenConnecting);
fromString(pIM->getParser()->getDefine("screen_intro"), nScreenIntro);
fromString(pIM->getParser()->getDefine("screen_crashing"), nScreenServerCrashed);
// SKIP INTRO : Write to the database if we have to skip the intro and write we want to skip further intro to client cfg
if (ClientCfg.SkipIntro)
@ -1004,7 +1004,7 @@ TInterfaceState globalMenu()
Actions.enable(true);
EditActions.enable(true);
LuaBGDSuccessFlag = true;
pIM->reloadAllLuaFileScripts();
pIM->getParser()->reloadAllLuaFileScripts();
}
#endif
@ -2136,7 +2136,7 @@ public:
if (i>0)
params.push_back(pair<string,string>("posref", "BL TL"));
CInterfaceGroup *pNewLine =pIM->createGroupInstance("t_mainland", GROUP_LIST_MAINLAND, params);
CInterfaceGroup *pNewLine =pIM->getParser()->createGroupInstance("t_mainland", GROUP_LIST_MAINLAND, params);
if (pNewLine != NULL)
{
CViewBase *pVBon = pNewLine->getView("online");
@ -2261,7 +2261,7 @@ public:
}
First = false;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
return pIM->createGroupInstance(templateName, GROUP_LIST_KEYSET, params);
return pIM->getParser()->createGroupInstance(templateName, GROUP_LIST_KEYSET, params);
}
void addGroupInList(CInterfaceGroup *pNewLine)
@ -2722,7 +2722,7 @@ class CAHScenarioControl : public IActionHandler
params.push_back(pair<string,string>("id", toString(Mainlands[i].Id)));
params.push_back(pair<string,string>("w", "1024"));
params.push_back(pair<string,string>("tooltip", "uiRingFilterShard"));
CInterfaceGroup *toggleGr =pIM->createGroupInstance("label_toggle_button", shardList->getId(), params);
CInterfaceGroup *toggleGr =pIM->getParser()->createGroupInstance("label_toggle_button", shardList->getId(), params);
shardList->addChild(toggleGr);
// set unicode name
CViewText *shardName = dynamic_cast<CViewText *>(toggleGr->getView("button_text"));

View file

@ -743,11 +743,11 @@ static void chooseSheath (ITEMFAMILY::EItemFamily eIF, string sAllSkills)
{
// Choose right sheath
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pNLwrite = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLread = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_nb"));
CCDBNodeLeaf *pNLwrite = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getParser()->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLread = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getParser()->getDefine("set_nb"));
sint32 nNbSheath = (sint32)pNLread->getValue64();
if (nNbSheath == 0) return;
pNLread = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_active"));
pNLread = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getParser()->getDefine("set_active"));
sint32 nActiveSheath = (sint32)pNLread->getValue64();
bool bFound = false;
for (sint32 i = 0; i < ((nNbSheath/2)+1); ++i)
@ -763,7 +763,7 @@ static void chooseSheath (ITEMFAMILY::EItemFamily eIF, string sAllSkills)
while (nSheathToTest >= (INVENTORIES::sheath+nNbSheath)) nSheathToTest -= nNbSheath;
string sPath;
sPath = pIM->getDefine("set_base") + ":" + NLMISC::toString(nSheathToTest) + ":" + pIM->getDefine("set_r") + ":SHEET";
sPath = pIM->getParser()->getDefine("set_base") + ":" + NLMISC::toString(nSheathToTest) + ":" + pIM->getParser()->getDefine("set_r") + ":SHEET";
pNLread = NLGUI::CDBManager::getInstance()->getDbProp(sPath);
sint32 sheetid = (sint32)pNLread->getValue64();
CItemSheet *pIS = dynamic_cast<CItemSheet *>(SheetMngr.get(CSheetId(sheetid)));
@ -1305,7 +1305,7 @@ class CSelectItemSheet : public IActionHandler
if (!ctrlSheet) return;
sint selectionGroup = ctrlSheet->getSelectionGroup();
CInterfaceManager *im = CInterfaceManager::getInstance();
const CCtrlSheetSelection &css = im->getCtrlSheetSelection();
const CCtrlSheetSelection &css = im->getParser()->getCtrlSheetSelection();
const CSheetSelectionGroup *csg = css.getGroup(selectionGroup);
if (csg && csg->isActive())
{
@ -2103,7 +2103,7 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler
if ( pE->isPlayer() )
{
// Player => deduce RegionForce & ForceLevel from the database
CCDBNodeLeaf *pDbTargetUid = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("target_uid") );
CCDBNodeLeaf *pDbTargetUid = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getParser()->getDefine("target_uid") );
if ( ! pDbTargetUid )
return;
// Hide the target level if the USER is not in PVP FACTION
@ -2121,7 +2121,7 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler
return;
}
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("target_player_level") );
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getParser()->getDefine("target_player_level") );
if ( ! pDbPlayerLevel )
return;
sint nLevel = pDbPlayerLevel->getValue32();
@ -2158,13 +2158,13 @@ class CActionHandlerSetTargetForceRegionLevel: public IActionHandler
// Set color
if (nForceRegion > 6) nForceRegion = 6;
if (nForceRegion < 1) nForceRegion = 1;
CRGBA col = CInterfaceElement::convertColor(pIM->getDefine("region_force_"+toString(nForceRegion)).c_str());
CRGBA col = CInterfaceElement::convertColor(pIM->getParser()->getDefine("region_force_"+toString(nForceRegion)).c_str());
pVBR->setColor(col);
// Set texture
if (nLevelForce > 8) nLevelForce = 8;
if (nLevelForce < 1) nLevelForce = 1;
string sTexture = pIM->getDefine("force_level_"+toString(nLevelForce));
string sTexture = pIM->getParser()->getDefine("force_level_"+toString(nLevelForce));
pVBL->setTexture(sTexture);
// Set tooltip
@ -2227,12 +2227,12 @@ class CAHUpdateCurrentMode : public IActionHandler
sint32 nNewMode = (sint32)eVal.getInteger();
sint32 nModeMinInf, nModeMaxInf, nModeMinLab, nModeMaxLab, nModeMinKey, nModeMaxKey;
fromString(pIM->getDefine("mode_min_info"), nModeMinInf);
fromString(pIM->getDefine("mode_max_info"), nModeMaxInf);
fromString(pIM->getDefine("mode_min_lab"), nModeMinLab);
fromString(pIM->getDefine("mode_max_lab"), nModeMaxLab);
fromString(pIM->getDefine("mode_min_keys"), nModeMinKey);
fromString(pIM->getDefine("mode_max_keys"), nModeMaxKey);
fromString(pIM->getParser()->getDefine("mode_min_info"), nModeMinInf);
fromString(pIM->getParser()->getDefine("mode_max_info"), nModeMaxInf);
fromString(pIM->getParser()->getDefine("mode_min_lab"), nModeMinLab);
fromString(pIM->getParser()->getDefine("mode_max_lab"), nModeMaxLab);
fromString(pIM->getParser()->getDefine("mode_min_keys"), nModeMinKey);
fromString(pIM->getParser()->getDefine("mode_max_keys"), nModeMaxKey);
sint32 nMode = 0;
if ((nNewMode >= nModeMinInf) && (nNewMode <= nModeMaxInf))
@ -2275,14 +2275,14 @@ class CAHUpdateCurrentMode : public IActionHandler
sint32 tmpMode;
// Is NewMode entry active ?
fromString(pIM->getDefine("mode_magic"), tmpMode);
fromString(pIM->getParser()->getDefine("mode_magic"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::Magic)) != 0)
bFound = true;
if (!bFound)
{
fromString(pIM->getDefine("mode_combat"), tmpMode);
fromString(pIM->getParser()->getDefine("mode_combat"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::Combat)) != 0)
bFound = true;
@ -2290,7 +2290,7 @@ class CAHUpdateCurrentMode : public IActionHandler
if (!bFound)
{
fromString(pIM->getDefine("mode_faber_create"), tmpMode);
fromString(pIM->getParser()->getDefine("mode_faber_create"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::FaberCreate)) != 0)
bFound = true;
@ -2298,7 +2298,7 @@ class CAHUpdateCurrentMode : public IActionHandler
if (!bFound)
{
fromString(pIM->getDefine("mode_faber_repair"), tmpMode);
fromString(pIM->getParser()->getDefine("mode_faber_repair"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::FaberRepair)) != 0)
bFound = true;
@ -2306,7 +2306,7 @@ class CAHUpdateCurrentMode : public IActionHandler
if (!bFound)
{
fromString(pIM->getDefine("mode_faber_refine"), tmpMode);
fromString(pIM->getParser()->getDefine("mode_faber_refine"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::FaberRefine)) != 0)
bFound = true;
@ -2314,7 +2314,7 @@ class CAHUpdateCurrentMode : public IActionHandler
if (!bFound)
{
fromString(pIM->getDefine("mode_commerce"), tmpMode);
fromString(pIM->getParser()->getDefine("mode_commerce"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::Commerce)) != 0)
bFound = true;
@ -2322,14 +2322,14 @@ class CAHUpdateCurrentMode : public IActionHandler
if (!bFound)
{
fromString(pIM->getDefine("mode_macros"), tmpMode);
fromString(pIM->getParser()->getDefine("mode_macros"), tmpMode);
if (nNewMode == tmpMode)
bFound = true; // Not in DB !!!
}
if (!bFound)
{
fromString(pIM->getDefine("mode_special_labo"), tmpMode);
fromString(pIM->getParser()->getDefine("mode_special_labo"), tmpMode);
if (nNewMode == tmpMode)
if ((nIntFlags & (1<<INTERFACE_FLAGS::Special)) != 0)
bFound = true;
@ -3798,8 +3798,8 @@ uint32 getMissionTitle(sint32 nSelected)
CInterfaceManager *pIM = CInterfaceManager::getInstance();
sint32 nNbMission, nNbGroupMission;
fromString(pIM->getDefine("ipj_nb_mission"), nNbMission);
fromString(pIM->getDefine("ipj_nb_group_mission"), nNbGroupMission);
fromString(pIM->getParser()->getDefine("ipj_nb_mission"), nNbMission);
fromString(pIM->getParser()->getDefine("ipj_nb_group_mission"), nNbGroupMission);
if (nSelected < 0)
return 0;
@ -3815,8 +3815,8 @@ void runMissionProc(sint32 nSelected)
CInterfaceManager *pIM = CInterfaceManager::getInstance();
sint32 nNbMission, nNbGroupMission;
fromString(pIM->getDefine("ipj_nb_mission"), nNbMission);
fromString(pIM->getDefine("ipj_nb_group_mission"), nNbGroupMission);
fromString(pIM->getParser()->getDefine("ipj_nb_mission"), nNbMission);
fromString(pIM->getParser()->getDefine("ipj_nb_group_mission"), nNbGroupMission);
if (nSelected < 0)
return;
@ -3845,8 +3845,8 @@ public:
sint32 nSelected = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:MISSION_SELECTED")->getValue32();
sint32 nNbMission, nNbGroupMission;
fromString(pIM->getDefine("ipj_nb_mission"), nNbMission);
fromString(pIM->getDefine("ipj_nb_group_mission"), nNbGroupMission);
fromString(pIM->getParser()->getDefine("ipj_nb_mission"), nNbMission);
fromString(pIM->getParser()->getDefine("ipj_nb_group_mission"), nNbGroupMission);
// If no mission selected or title selected becomes invalid -> search a new title to select
if ((nSelected == -1) || (getMissionTitle(nSelected) == 0))

View file

@ -160,7 +160,7 @@ void CInterfaceHelp::initWindows()
CInterfaceManager *pIM= CInterfaceManager::getInstance();
sint maxHelpWindow;
fromString(pIM->getDefine("MAX_HELP_WINDOW"), maxHelpWindow);
fromString(pIM->getParser()->getDefine("MAX_HELP_WINDOW"), maxHelpWindow);
// Allow Max 256. More may be a script error...
clamp(maxHelpWindow, 0, 256);
@ -1437,7 +1437,7 @@ void getMagicProtection(CDBCtrlSheet *item, ucstring &itemText)
{
// Mul item quality by a constant
uint maxAbsorb= item->getQuality();
CCDBNodeLeaf *nodeFactor= NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("player_protect_absorbfactor"), false);
CCDBNodeLeaf *nodeFactor= NLGUI::CDBManager::getInstance()->getDbProp(pIM->getParser()->getDefine("player_protect_absorbfactor"), false);
if(nodeFactor)
maxAbsorb= maxAbsorb*nodeFactor->getValue32()/100;
@ -3783,7 +3783,7 @@ static void onMpChangeItemPart(CInterfaceGroup *wnd, uint32 itemSheetId, const s
if(viewBmp)
{
// texture name in config.xml
viewBmp->setTexture(pIM->getDefine( RM_FABER_TYPE::toIconDefineString(faberType) ));
viewBmp->setTexture(pIM->getParser()->getDefine( RM_FABER_TYPE::toIconDefineString(faberType) ));
}

View file

@ -109,11 +109,11 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived()
// get the dialog stack
CInterfaceGroup* group = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(WindowName) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_display")) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_display")) );
if (group && editShort && editBoxShort && editLarge && editBoxLarge && display)
{
CClientItemInfo const& itemInfo = getInventory().getItemInfo( ItemSlotId );
@ -199,14 +199,14 @@ void CInterfaceItemEdition::CItemEditionWindow::begin()
// get the dialog stack
CGroupContainer* group = dynamic_cast<CGroupContainer*>( CWidgetManager::getInstance()->getElementFromId(WindowName) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_display")) );
CInterfaceGroup* editButtons = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_buttons")) );
CCtrlBaseButton* closeButton = dynamic_cast<CCtrlBaseButton*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_close_button")) );
CViewBitmap* background = dynamic_cast<CViewBitmap*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_background")) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_display")) );
CInterfaceGroup* editButtons = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_buttons")) );
CCtrlBaseButton* closeButton = dynamic_cast<CCtrlBaseButton*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_close_button")) );
CViewBitmap* background = dynamic_cast<CViewBitmap*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_background")) );
if (group && editShort && editBoxShort && editLarge && editBoxLarge && display && editButtons && closeButton && background)
{
@ -336,14 +336,14 @@ void CInterfaceItemEdition::CItemEditionWindow::end()
// get the dialog stack
CInterfaceGroup* group = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(windowName) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_display")) );
CInterfaceGroup* editButtons = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_buttons")) );
CCtrlBaseButton* closeButton = dynamic_cast<CCtrlBaseButton*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_close_button")) );
CViewBitmap* background = dynamic_cast<CViewBitmap*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_background")) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_display")) );
CInterfaceGroup* editButtons = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_buttons")) );
CCtrlBaseButton* closeButton = dynamic_cast<CCtrlBaseButton*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_close_button")) );
CViewBitmap* background = dynamic_cast<CViewBitmap*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_background")) );
if (group && editShort && editBoxShort && editLarge && editBoxLarge && display && editButtons && closeButton && background)
{
// disable the window
@ -375,14 +375,14 @@ void CInterfaceItemEdition::CItemEditionWindow::validate()
// get the dialog stack
CInterfaceGroup* group = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(windowName) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_display")) );
CInterfaceGroup* editButtons = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_edit_buttons")) );
CCtrlBaseButton* closeButton = dynamic_cast<CCtrlBaseButton*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_close_button")) );
CViewBitmap* background = dynamic_cast<CViewBitmap*>( CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("edit_custom_background")) );
CInterfaceGroup* editShort = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_short")) );
CGroupEditBox* editBoxShort = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_box_short")) );
CInterfaceGroup* editLarge = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_large")) );
CGroupEditBox* editBoxLarge = dynamic_cast<CGroupEditBox*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_box_large")) );
CViewText* display = dynamic_cast<CViewText*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_display")) );
CInterfaceGroup* editButtons = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_edit_buttons")) );
CCtrlBaseButton* closeButton = dynamic_cast<CCtrlBaseButton*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_close_button")) );
CViewBitmap* background = dynamic_cast<CViewBitmap*>( CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("edit_custom_background")) );
if (group && editShort && editBoxShort && editLarge && editBoxLarge && display && editButtons && closeButton && background)
{
bool textValid = editShort->getActive();
@ -1317,7 +1317,7 @@ class CHandlerActiveSheath : public IActionHandler
CInterfaceManager *pIM = CInterfaceManager::getInstance();
// Get the user interface value.
uint8 activeSheath = (uint8)NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("ui_set_active") )->getValue32();
uint8 activeSheath = (uint8)NLGUI::CDBManager::getInstance()->getDbProp( pIM->getParser()->getDefine("ui_set_active") )->getValue32();
// Write to the Local Database.
NLGUI::CDBManager::getInstance()->getDbProp( "LOCAL:INVENTORY:ACTIVE_SHEATH" )->setValue32(activeSheath);
@ -1358,7 +1358,7 @@ class CHandlerReceiveActiveSheath : public IActionHandler
uint8 activeSheath = (uint8)NLGUI::CDBManager::getInstance()->getDbProp( "LOCAL:INVENTORY:ACTIVE_SHEATH" )->getValue32();
// Write to the Local Database.
NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("ui_set_active") )->setValue32(activeSheath);
NLGUI::CDBManager::getInstance()->getDbProp( pIM->getParser()->getDefine("ui_set_active") )->setValue32(activeSheath);
}
};
REGISTER_ACTION_HANDLER( CHandlerReceiveActiveSheath, "receive_active_sheath" );

View file

@ -434,7 +434,7 @@ class CActionHandlerAddLink : public IActionHandler
CInterfaceLink *il = new CInterfaceLink;
il->init(targetsVect, expr, ah, ahparam, ahcond, parentGroup);
CInterfaceManager *im = CInterfaceManager::getInstance();
im->addLink(il, id);
im->getParser()->addLink(il, id);
il->update();
}
};
@ -453,7 +453,7 @@ class CActionHandlerRemoveLink : public IActionHandler
return;
}
CInterfaceManager *im = CInterfaceManager::getInstance();
im->removeLink(id);
im->getParser()->removeLink(id);
}
};
REGISTER_ACTION_HANDLER (CActionHandlerRemoveLink, "remove_link");
@ -489,7 +489,7 @@ CInterfaceGroup *createMenuColorWidget(const string &colDbEntry,
make_pair(string("tooltip"), toolTipTextID),
make_pair(string("ccd_title"), ccdTitle),
};
return im->createGroupInstance("menu_color_widget", "", params, 3);
return im->getParser()->createGroupInstance("menu_color_widget", "", params, 3);
}
// ***************************************************************************

View file

@ -447,9 +447,9 @@ class CAHNextSheath : public IActionHandler
virtual void execute (CCtrlBase *pCaller, const string &Params)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pNLCurSetWrite = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLCurSetRead = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_active"));
CCDBNodeLeaf *pNLNbSet = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_nb"));
CCDBNodeLeaf *pNLCurSetWrite = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getParser()->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLCurSetRead = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getParser()->getDefine("set_active"));
CCDBNodeLeaf *pNLNbSet = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getParser()->getDefine("set_nb"));
sint64 nVal = pNLCurSetRead->getValue64() - INVENTORIES::sheath1;
sint64 nMax = pNLNbSet->getValue64();
nVal++;
@ -471,9 +471,9 @@ class CAHPreviousSheath : public IActionHandler
virtual void execute (CCtrlBase *pCaller, const string &Params)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pNLCurSetWrite = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLCurSetRead = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_active"));
CCDBNodeLeaf *pNLNbSet = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_nb"));
CCDBNodeLeaf *pNLCurSetWrite = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getParser()->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLCurSetRead = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getParser()->getDefine("set_active"));
CCDBNodeLeaf *pNLNbSet = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getParser()->getDefine("set_nb"));
sint64 nVal = pNLCurSetRead->getValue64() - INVENTORIES::sheath1;
sint64 nMax = pNLNbSet->getValue64();
if (nVal == 0) nVal = nMax;
@ -495,8 +495,8 @@ class CAHSetSheath : public IActionHandler
virtual void execute (CCtrlBase *pCaller, const string &Params)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pNLCurSetWrite = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLNbSet = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("set_nb"));
CCDBNodeLeaf *pNLCurSetWrite = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getParser()->getDefine("ui_set_active"));
CCDBNodeLeaf *pNLNbSet = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getParser()->getDefine("set_nb"));
sint64 nVal;
fromString(Params, nVal);
nVal -= INVENTORIES::sheath1;

View file

@ -524,7 +524,7 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick
if(mpBuild.RequirementType==CMPBuild::ItemPartReq)
{
// texture name in config.xml
viewBmp->setTexture(pIM->getDefine( RM_FABER_TYPE::toIconDefineString(mpBuild.FaberTypeRequired) ));
viewBmp->setTexture(pIM->getParser()->getDefine( RM_FABER_TYPE::toIconDefineString(mpBuild.FaberTypeRequired) ));
}
else if(mpBuild.RequirementType==CMPBuild::SpecificItemReq)
{

View file

@ -41,7 +41,7 @@ void CBotChatPagePlayerGift::begin()
NLGUI::CDBManager::getInstance()->getDbProp(BOT_CHAT_BASE_DB_PATH ":PLAYER_GIFT")->setValue32(0);
// clear money proposal value
CCDBNodeLeaf *moneyProposal = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getDefine("money_proposal"));
CCDBNodeLeaf *moneyProposal = NLGUI::CDBManager::getInstance()->getDbProp(pIM->getParser()->getDefine("money_proposal"));
if (moneyProposal) moneyProposal->setValue64(0);
// clear 'accept' button

View file

@ -208,7 +208,7 @@ void CBotChatPageTrade::begin()
if(dbPriceMin) dbPriceMin->setValue32(0);
if(dbPriceMax)
{
fromString(pIM->getDefine("bot_chat_filter_max_price"), value);
fromString(pIM->getParser()->getDefine("bot_chat_filter_max_price"), value);
dbPriceMax->setValue32(value);
}
@ -218,7 +218,7 @@ void CBotChatPageTrade::begin()
if(dbQualityMin) dbQualityMin->setValue32(0);
if(dbQualityMax)
{
fromString(pIM->getDefine("bot_chat_filter_max_quality"), value);
fromString(pIM->getParser()->getDefine("bot_chat_filter_max_quality"), value);
dbQualityMax->setValue32(value);
}
@ -1688,7 +1688,7 @@ void CBotChatPageTrade::setupFactionPointPrice(bool /* sellMode */, uint default
// setup icon according to pvp clan
CInterfaceManager *pIM= CInterfaceManager::getInstance();
factionName = NLMISC::toLower(factionName);
string factionIcon= pIM->getDefine(toString("faction_icon_%s", factionName.c_str()));
string factionIcon= pIM->getParser()->getDefine(toString("faction_icon_%s", factionName.c_str()));
CViewBitmap *vBmp= dynamic_cast<CViewBitmap*>(fpGroup->getView("unit_price:item_price:icone"));
if(vBmp) vBmp->setTexture(factionIcon);
vBmp= dynamic_cast<CViewBitmap*>(fpGroup->getView("total_price:item_price:icone"));
@ -2079,7 +2079,7 @@ std::string CBotChatPageTrade::getItemSheetNameForItemType(ITEM_TYPE::TItemType
itemTypeDef+= ITEM_TYPE::toString(it);
// return empty string if not found
return pIM->getDefine(itemTypeDef);
return pIM->getParser()->getDefine(itemTypeDef);
}

View file

@ -108,7 +108,7 @@ static CInterfaceGroup *parseCommandTag(ucstring &line)
make_pair(string("ah"), params[2]),
make_pair(string("ah_params"), params[3])
};
return CInterfaceManager::getInstance()->createGroupInstance(params[0], "", uiTemplateParams, 4);
return CInterfaceManager::getInstance()->getParser()->createGroupInstance(params[0], "", uiTemplateParams, 4);
}
static CInterfaceGroup *buildLineWithCommand(CInterfaceGroup *commandGroup, CViewText *text)

View file

@ -119,7 +119,7 @@ bool CChatWindow::create(const CChatWindowDesc &desc, const std::string &chatId)
params.insert(params.end(), desc.ChatTemplateParams.begin(), desc.ChatTemplateParams.end());
// create a chat container from the template
CInterfaceGroup *chatGroup = im->createGroupInstance(chatTemplate, "ui:interface", params);
CInterfaceGroup *chatGroup = im->getParser()->createGroupInstance(chatTemplate, "ui:interface", params);
if (chatGroup)
{
_Chat = dynamic_cast<CGroupContainer *>(chatGroup);
@ -554,7 +554,7 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
// on a new message, change the Tab color
CInterfaceManager *pIM= CInterfaceManager::getInstance();
CRGBA newMsgColor= CRGBA::stringToRGBA(pIM->getDefine("chat_group_tab_color_newmsg").c_str());
CRGBA newMsgColor= CRGBA::stringToRGBA(pIM->getParser()->getDefine("chat_group_tab_color_newmsg").c_str());
ucstring newmsg = msg;
ucstring prefix;
@ -754,7 +754,7 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c
std::string templateName = "contact_chat_friend";
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CInterfaceGroup *pIG = pIM->createGroupInstance(templateName, "ui:interface", properties);
CInterfaceGroup *pIG = pIM->getParser()->createGroupInstance(templateName, "ui:interface", properties);
if (!pIG) return NULL;
CGroupContainer *pGC = dynamic_cast<CGroupContainer *>(pIG);
if (!pGC)

View file

@ -389,7 +389,7 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
prop = (char*) xmlGetProp( cur, (xmlChar*)"selection_group" );
if (prop)
{
const CCtrlSheetSelection &css = CInterfaceManager::getInstance()->getCtrlSheetSelection();
const CCtrlSheetSelection &css = CInterfaceManager::getInstance()->getParser()->getCtrlSheetSelection();
_SheetSelectionGroup = css.getGroupIndex((const char *) prop);
if (_SheetSelectionGroup == -1)
{
@ -2518,7 +2518,7 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti
// draw selection border if this sheet is selected
if (_SheetSelectionGroup != -1) // is this sheet selectable ?
{ // yes, check if it is selected
const CCtrlSheetSelection &css = pIM->getCtrlSheetSelection();
const CCtrlSheetSelection &css = pIM->getParser()->getCtrlSheetSelection();
const CSheetSelectionGroup *ssg = css.getGroup(_SheetSelectionGroup);
if (ssg)
{
@ -2985,7 +2985,7 @@ void CDBCtrlSheet::setCurrSelection(CDBCtrlSheet *selected)
const std::string &CDBCtrlSheet::getSelectionGroupAsString() const
{
CInterfaceManager *im = CInterfaceManager::getInstance();
const CCtrlSheetSelection &css = im->getCtrlSheetSelection();
const CCtrlSheetSelection &css = im->getParser()->getCtrlSheetSelection();
const CSheetSelectionGroup *csg = css.getGroup(_SheetSelectionGroup);
static const string emptyStr;
return csg ? csg->getName() : emptyStr;
@ -4176,7 +4176,7 @@ void CDBCtrlSheet::initArmourColors()
{
_ArmourColor[col] = CRGBA::White;
std::string defineName= "armour_color_" + toString(col);
std::string colVal= pIM->getDefine(defineName);
std::string colVal= pIM->getParser()->getDefine(defineName);
if(!colVal.empty())
_ArmourColor[col] = convertColor(colVal.c_str());
}

View file

@ -226,7 +226,7 @@ void CDBGroupBuildPhrase::setupBuildSentence()
if(_GroupValid)
{
sint rootTextMaxw;
fromString(pIM->getDefine("phrase_build_root_info_maxw"), rootTextMaxw);
fromString(pIM->getParser()->getDefine("phrase_build_root_info_maxw"), rootTextMaxw);
_MainWords[0].InfoView->setLineMaxW(rootTextMaxw);
}
@ -1194,8 +1194,8 @@ void CDBGroupBuildPhrase::updateAllDisplay(const CSPhraseCom &phrase)
{
// get define, and verify data
uint numWeaponSkill;
fromString(pIM->getDefine("phrase_max_restrict_combat"), numWeaponSkill);
string strWeaponSkill= pIM->getDefine("phrase_def_skill_restrict_combat");
fromString(pIM->getParser()->getDefine("phrase_max_restrict_combat"), numWeaponSkill);
string strWeaponSkill= pIM->getParser()->getDefine("phrase_def_skill_restrict_combat");
vector<string> weaponSkillList;
splitString(strWeaponSkill, " ", weaponSkillList);
nlassert(weaponSkillList.size()==numWeaponSkill);

View file

@ -110,7 +110,7 @@ CInterfaceGroup *CDBGroupListSheetIconPhrase::createSectionGroup(const std::str
tempVec[0].first="id"; tempVec[0].second= igName;
// make parent to me
CInterfaceGroup *pIG = pIM->createGroupInstance(LSP_SECTION_TEMPLATE, getId(), tempVec);
CInterfaceGroup *pIG = pIM->getParser()->createGroupInstance(LSP_SECTION_TEMPLATE, getId(), tempVec);
pIG->setParent (this);
addGroup (pIG);

View file

@ -142,7 +142,7 @@ CInterfaceGroup *CDBGroupListSheetTextPhrase::createSectionGroup(const std::str
tempVec[0].first="id"; tempVec[0].second= igName;
// make parent to the list, not me
CInterfaceGroup *pIG = pIM->createGroupInstance(LSP_SECTION_TEMPLATE, _List->getId(), tempVec);
CInterfaceGroup *pIG = pIM->getParser()->createGroupInstance(LSP_SECTION_TEMPLATE, _List->getId(), tempVec);
pIG->setParent (_List);
_List->addGroup (pIG);

View file

@ -64,7 +64,7 @@ void CFlyingTextManager::initInGame()
string id = "in_scene_flying_text_"+toString (i);
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *groupInfo = pIM->createGroupInstance ("in_scene_flying_text",
CInterfaceGroup *groupInfo = pIM->getParser()->createGroupInstance ("in_scene_flying_text",
"ui:interface", templateParams);
// if ok
if(groupInfo)
@ -92,7 +92,7 @@ void CFlyingTextManager::initInGame()
}
// misc
fromString(pIM->getDefine("in_scene_flying_char_offsetx"), _CharacterWindowOffsetX);
fromString(pIM->getParser()->getDefine("in_scene_flying_char_offsetx"), _CharacterWindowOffsetX);
}
// ***************************************************************************

View file

@ -56,10 +56,10 @@ void contextHelp (const std::string &name)
{
string defineTarget = name+"_"+toString(index)+"_target";
string defineUrl = name+"_"+toString(index)+"_url";
if (pIM->isDefineExist(defineTarget) && pIM->isDefineExist(defineUrl))
if (pIM->getParser()->isDefineExist(defineTarget) && pIM->getParser()->isDefineExist(defineUrl))
{
string target = pIM->getDefine(defineTarget);
string url = pIM->getDefine(defineUrl);
string target = pIM->getParser()->getDefine(defineTarget);
string url = pIM->getParser()->getDefine(defineUrl);
CInterfaceElement *elementTarget = CWidgetManager::getInstance()->getElementFromId(target);
if (elementTarget && elementTarget->getActive())
@ -176,12 +176,12 @@ void CGroupInSceneBubbleManager::alignMessagePopup (vector<CPopup> &rList, bool
sint32 offsetY;
if (bCenter)
{
fromString(pIM->getDefine("popup_pos_y_center"), offsetY);
fromString(pIM->getParser()->getDefine("popup_pos_y_center"), offsetY);
offsetY = pRoot->getHReal() - offsetY;
offsetY -= rList[i].Group->getH();
}
else
fromString(pIM->getDefine("popup_pos_y"), offsetY);
fromString(pIM->getParser()->getDefine("popup_pos_y"), offsetY);
rList[i].Group->setY(offsetY);
rList[i].Group->invalidateCoords();
@ -228,7 +228,7 @@ void CGroupInSceneBubbleManager::init ()
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *group = pIM->createGroupInstance ("3dbulle_L",
CInterfaceGroup *group = pIM->getParser()->createGroupInstance ("3dbulle_L",
"ui:interface", templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
if (group)
{
@ -508,7 +508,7 @@ void CGroupInSceneBubbleManager::addSkillPopup (uint skillId, sint delta, uint t
templateParams.push_back (std::pair<std::string,std::string>("skillid", toString(skillId)));
templateParams.push_back (std::pair<std::string,std::string>("delta", toString(delta)));
CInterfaceGroup *group = pIM->createGroupInstance ("skill_popup",
CInterfaceGroup *group = pIM->getParser()->createGroupInstance ("skill_popup",
"ui:interface", templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
if (group)
{
@ -574,7 +574,7 @@ void CGroupInSceneBubbleManager::addMessagePopup (const ucstring &message, CRGBA
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *group = pIM->createGroupInstance ("message_popup",
CInterfaceGroup *group = pIM->getParser()->createGroupInstance ("message_popup",
"ui:interface", templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
if (group)
{
@ -623,7 +623,7 @@ void CGroupInSceneBubbleManager::addMessagePopupCenter (const ucstring &message,
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *group = pIM->createGroupInstance ("message_popup_center",
CInterfaceGroup *group = pIM->getParser()->createGroupInstance ("message_popup_center",
"ui:interface", templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
if (group)
{
@ -695,7 +695,7 @@ CGroupInSceneBubbleManager::CPopupContext *CGroupInSceneBubbleManager::buildCont
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *group = pIM->createGroupInstance (templateName+v+h,
CInterfaceGroup *group = pIM->getParser()->createGroupInstance (templateName+v+h,
"ui:interface", templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
if (group)
{
@ -896,7 +896,7 @@ void CGroupInSceneBubbleManager::dynChatOpen (uint32 nBotUID, uint32 nBotName, c
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *group = pIM->createGroupInstance ("dyn_3dbulle_L", "ui:interface", templateParams);
CInterfaceGroup *group = pIM->getParser()->createGroupInstance ("dyn_3dbulle_L", "ui:interface", templateParams);
if (group == NULL)
{
nlwarning("cannot create dyn_3dbulle_L");
@ -1009,7 +1009,7 @@ void CGroupInSceneBubbleManager::webIgChatOpen (uint32 nBotUID, string text, con
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
CInterfaceGroup *group = pIM->createGroupInstance ("webig_3dbulle_L", "ui:interface", templateParams);
CInterfaceGroup *group = pIM->getParser()->createGroupInstance ("webig_3dbulle_L", "ui:interface", templateParams);
if (group == NULL)
{
nlwarning("cannot create webig_3dbulle_L");

View file

@ -282,10 +282,10 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
// Some constants
sint barHeight, barSpace, textH;
fromString(pIM->getDefine("in_scene_user_info_bar_h"), barHeight);
fromString(pIM->getDefine("in_scene_user_info_bar_space"), barSpace);
fromString(pIM->getDefine("in_scene_user_info_text_h"), textH);
fromString(pIM->getDefine("in_scene_user_bar_length"), CGroupInSceneUserInfo::_BatLength);
fromString(pIM->getParser()->getDefine("in_scene_user_info_bar_h"), barHeight);
fromString(pIM->getParser()->getDefine("in_scene_user_info_bar_space"), barSpace);
fromString(pIM->getParser()->getDefine("in_scene_user_info_text_h"), textH);
fromString(pIM->getParser()->getDefine("in_scene_user_bar_length"), CGroupInSceneUserInfo::_BatLength);
// Build the bars
uint barCount = 0;
@ -1175,7 +1175,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::newGroupInScene(const std::string
{
std::vector<std::pair<std::string,std::string> > templateParams;
templateParams.push_back (std::pair<std::string,std::string>("id", id));
groupInfo = CInterfaceManager::getInstance()->createGroupInstance ( templateName,
groupInfo = CInterfaceManager::getInstance()->getParser()->createGroupInstance ( templateName,
"ui:interface", templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
}

View file

@ -426,7 +426,7 @@ class CHandlerRunQuickHelp : public IActionHandler
CInterfaceManager *pIM = CInterfaceManager::getInstance();
// Get the quick help radio buttons base id
string buttonId = pIM->getDefine("quick_help_buttons");
string buttonId = pIM->getParser()->getDefine("quick_help_buttons");
if (!buttonId.empty())
{
// Get the button id

View file

@ -373,7 +373,7 @@ void CGroupSkills::createAllTreeNodes()
// create the template
tempVec[0].first="id"; tempVec[0].second= pNode->Id;
tempVec[1].first="skillid"; tempVec[1].second= NLMISC::toString(i);
CInterfaceGroup *pIG = pIM->createGroupInstance(_TemplateSkill, getId() + ":" + WIN_TREE_LIST, tempVec);
CInterfaceGroup *pIG = pIM->getParser()->createGroupInstance(_TemplateSkill, getId() + ":" + WIN_TREE_LIST, tempVec);
if (pIG == NULL)
nlwarning("error");
// Set Skill Name

View file

@ -817,7 +817,7 @@ class CAHGuildSheetOpen : public IActionHandler
vector< pair<string, string> > vParams;
vParams.push_back(vector< pair<string, string> >::value_type("id", templateId));
CInterfaceGroup *pLine = NULL;
pLine = pIM->createGroupInstance (TEMPLATE_GUILD_MEMBER, LIST_GUILD_MEMBERS, vParams);
pLine = pIM->getParser()->createGroupInstance (TEMPLATE_GUILD_MEMBER, LIST_GUILD_MEMBERS, vParams);
if (pLine == NULL) continue;
// Set name

View file

@ -764,10 +764,10 @@ void CInterfaceConfig::streamToDataBase (NLMISC::IStream &f, uint32 uiDbSaveVers
defVerId[i]='_';
}
// check if exist
if(pIM->isDefineExist(defVerId))
if(pIM->getParser()->isDefineExist(defVerId))
{
uint32 dbVer;
fromString(pIM->getDefine(defVerId), dbVer);
fromString(pIM->getParser()->getDefine(defVerId), dbVer);
// if the version in the file is older than the version this db want, abort read
if(uiDbSaveVersion<dbVer)
wantRead= false;

View file

@ -988,7 +988,7 @@ static DECLARE_INTERFACE_USER_FCT(getBotChatBuyFilterMPIcon)
}
CInterfaceManager *pIM= CInterfaceManager::getInstance();
result.setString(pIM->getDefine( RM_FABER_TYPE::toIconDefineString(RM_FABER_TYPE::TRMFType(args[0].getInteger())) ));
result.setString(pIM->getParser()->getDefine( RM_FABER_TYPE::toIconDefineString(RM_FABER_TYPE::TRMFType(args[0].getInteger())) ));
return true;
}

View file

@ -541,11 +541,11 @@ static DECLARE_INTERFACE_USER_FCT(isRoomLeftFor)
CInterfaceManager *im = CInterfaceManager::getInstance();
// see if there is room in the bags
// get the number of bags
std::string nbBagPath = im->getDefine("bag_nb");
std::string nbBagPath = im->getParser()->getDefine("bag_nb");
CCDBNodeLeaf *prop = NLGUI::CDBManager::getInstance()->getDbProp(nbBagPath);
if (!prop) return false;
uint nbItemInBags = 8 * (uint) prop->getValue32(); // there are 8 item per bag
std::string bagsPath = im->getDefine("bag");
std::string bagsPath = im->getParser()->getDefine("bag");
if (bagsPath.empty()) return false;
uint k = 0;
for(k = 0; k < nbItemInBags; ++k)
@ -581,7 +581,7 @@ static DECLARE_INTERFACE_USER_FCT(isRoomLeftFor)
for(k = 0; k < numArmorSlots; ++k)
{
std::string dbPath = im->getDefine(armourInfos[k].DefineName);
std::string dbPath = im->getParser()->getDefine(armourInfos[k].DefineName);
if (dbPath.empty()) return false;
CCDBNodeLeaf *armorProp = NLGUI::CDBManager::getInstance()->getDbProp(dbPath + ":SHEET");
if (!armorProp) return false;
@ -609,7 +609,7 @@ static DECLARE_INTERFACE_USER_FCT(getSelectionGroupNameFromId)
if (args.size() != 1) return false;
if (!args[0].toInteger()) return false;
CInterfaceManager *im = CInterfaceManager::getInstance();
CCtrlSheetSelection &css = im->getCtrlSheetSelection();
CCtrlSheetSelection &css = im->getParser()->getCtrlSheetSelection();
CSheetSelectionGroup *csg = css.getGroup((uint) args[0].getInteger());
if (csg) result.setString(csg->getName());
else result.setString("");
@ -625,7 +625,7 @@ static DECLARE_INTERFACE_USER_FCT(getSelectionGroupIdFromName)
if (args.size() != 1) return false;
if (!args[0].toString()) return false;
CInterfaceManager *im = CInterfaceManager::getInstance();
CCtrlSheetSelection &css = im->getCtrlSheetSelection();
CCtrlSheetSelection &css = im->getParser()->getCtrlSheetSelection();
result.setInteger(css.getGroupIndex(args[0].getString().c_str()));
return true;
}

View file

@ -436,18 +436,20 @@ namespace
// ------------------------------------------------------------------------------------------------
CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext *textcontext )
{
addModule( "scene3d", new CIF3DSceneParser() );
addModule( "ddx", new CIFDDXParser() );
addModule( "action_category", new CActionCategoryParser() );
addModule( "command", new CCommandParser() );
addModule( "key", new CKeyParser() );
addModule( "macro", new CMacroParser() );
parser = new CInterfaceParser();
parser->setSetupOptionsCallback( this );
parser->addModule( "scene3d", new CIF3DSceneParser() );
parser->addModule( "ddx", new CIFDDXParser() );
parser->addModule( "action_category", new CActionCategoryParser() );
parser->addModule( "command", new CCommandParser() );
parser->addModule( "key", new CKeyParser() );
parser->addModule( "macro", new CMacroParser() );
CWidgetManager::getInstance()->registerNewScreenSizeHandler( new CDesktopUpdater() );
CWidgetManager::getInstance()->registerOnWidgetsDrawnHandler( new CDrawDraggedSheet() );
setCacheUIParsing( ClientCfg.CacheUIParsing );
parser->setCacheUIParsing( ClientCfg.CacheUIParsing );
CWidgetManager::parser = this;
CWidgetManager::parser = parser;
this->driver = driver;
this->textcontext = textcontext;
CViewRenderer::setDriver( driver );
@ -535,13 +537,6 @@ CInterfaceManager::~CInterfaceManager()
CViewTextFormated::setFormatter( NULL );
reset(); // to flush IDStringWaiters
_ParentPositionsMap.clear();
_ParentSizesMap.clear();
_ParentSizesMaxMap.clear();
_LuaClassAssociation.clear();
_Templates.clear();
_Instance = NULL;
// release the local string mapper
delete _UIStringMapper;
_UIStringMapper = NULL;
@ -554,6 +549,9 @@ CInterfaceManager::~CInterfaceManager()
delete interfaceLinkUpdater;
interfaceLinkUpdater = NULL;
*/
_Instance = NULL;
delete parser;
parser = NULL;
}
// ------------------------------------------------------------------------------------------------
@ -622,12 +620,12 @@ void CInterfaceManager::destroy ()
void CInterfaceManager::initLUA()
{
if( isLuaInitialized() )
if( parser->isLuaInitialized() )
return;
CInterfaceParser::initLUA();
parser->initLUA();
if( !isLuaInitialized() )
if( !parser->isLuaInitialized() )
return;
CLuaIHMRyzom::RegisterRyzomFunctions( *( CLuaManager::getInstance().getLuaState() ) );
@ -689,7 +687,7 @@ void CInterfaceManager::uninitLogin()
CWidgetManager::getInstance()->activateMasterGroup ("ui:login", false);
removeAll();
parser->removeAll();
reset();
CWidgetManager::getInstance()->setPointer( NULL );
@ -704,7 +702,7 @@ void CInterfaceManager::uninitLogin()
}
// Close LUA Scripting
uninitLUA();
parser->uninitLUA();
}
// ------------------------------------------------------------------------------------------------
@ -810,7 +808,7 @@ void CInterfaceManager::uninitOutGame()
CWidgetManager::getInstance()->activateMasterGroup ("ui:outgame", false);
//nlinfo ("%d seconds for activateMasterGroup", (uint32)(ryzomGetLocalTime ()-initStart)/1000);
initStart = ryzomGetLocalTime ();
removeAll();
parser->removeAll();
//nlinfo ("%d seconds for removeAll", (uint32)(ryzomGetLocalTime ()-initStart)/1000);
initStart = ryzomGetLocalTime ();
reset();
@ -834,7 +832,7 @@ void CInterfaceManager::uninitOutGame()
}
// Close LUA Scripting
uninitLUA();
parser->uninitLUA();
//NLMEMORY::CheckHeap (true);
}
@ -1087,7 +1085,7 @@ void CInterfaceManager::configureQuitDialogBox()
eltQuit = quitDlg->getElement(quitDialogStr+":ryzom");
eltQuitNow = quitDlg->getElement(quitDialogStr+":ryzom_now");
sint buttonDeltaY;
fromString(getDefine("quit_button_delta_y"), buttonDeltaY);
fromString( parser->getDefine("quit_button_delta_y"), buttonDeltaY);
extern R2::TUserRole UserRoleInSession;
bool sessionOwner = (R2::getEditor().getMode() != R2::CEditor::NotInitialized && R2::getEditor().getDMC().getEditionModule().isSessionOwner());
@ -1344,7 +1342,7 @@ void CInterfaceManager::uninitInGame1 ()
// Remove all interface objects (containers, groups, variables, defines, ...)
CWidgetManager::getInstance()->activateMasterGroup ("ui:interface", false);
removeAll();
parser->removeAll();
reset();
CInterfaceLink::removeAllLinks();
@ -1387,7 +1385,7 @@ void CInterfaceManager::uninitInGame1 ()
CGuildManager::release();
// Close LUA Scripting
uninitLUA();
parser->uninitLUA();
setInGame( false );
_NeutralColor = NULL;
@ -1582,7 +1580,7 @@ bool CInterfaceManager::parseInterface (const std::vector<std::string> &xmlFileN
_DB_UI_DUMMY_PREREQUISIT_VALID->setValueBool(true);
_DB_UI_DUMMY_FACTION_TYPE->setValue64(0);
return CInterfaceParser::parseInterface (xmlFileNames, reload, isFilename);
return parser->parseInterface (xmlFileNames, reload, isFilename);
}
// ------------------------------------------------------------------------------------------------
@ -1902,7 +1900,7 @@ bool CInterfaceManager::saveConfig (const string &filename)
// write UI_DB_SAVE_VERSION
uint32 uiDbSaveVersion;
fromString(getDefine("UI_DB_SAVE_VERSION"), uiDbSaveVersion);
fromString( parser->getDefine("UI_DB_SAVE_VERSION"), uiDbSaveVersion);
f.serial(uiDbSaveVersion);
// write database
@ -2222,7 +2220,7 @@ bool CInterfaceManager::getCurrentValidMessageBoxOnOk(string &ahOnOk, const std:
{
// Ok, get the current procedure OnOk action
string dummyParams;
if(getProcedureAction("proc_valid_message_box_ok", 1, ahOnOk, dummyParams))
if( parser->getProcedureAction("proc_valid_message_box_ok", 1, ahOnOk, dummyParams))
return true;
}

View file

@ -82,7 +82,7 @@ namespace NLGUI
* \author Nevrax France
* \date 2002
*/
class CInterfaceManager : public NLGUI::CInterfaceParser, public NLGUI::IInputEventListener
class CInterfaceManager : public NLGUI::CInterfaceParser::ISetupOptionCallbackClass, public NLGUI::IInputEventListener
{
public:
@ -658,7 +658,10 @@ private:
NL3D::UDriver *driver;
NL3D::UTextContext *textcontext;
CInterfaceLink::CInterfaceLinkUpdater *interfaceLinkUpdater;
NLGUI::CInterfaceParser *parser;
public:
NLGUI::CInterfaceParser* getParser() const{ return parser; }
};
#endif // NL_INTERFACE_MANAGER_H

View file

@ -607,7 +607,7 @@ int CLuaIHMRyzom::formatUI(CLuaState &ls)
// *** format with %
CInterfaceManager *pIM= CInterfaceManager::getInstance();
std::string newPropVal, defError;
if(!pIM->solveDefine(propVal, newPropVal, defError))
if(!pIM->getParser()->solveDefine(propVal, newPropVal, defError))
{
throw ELuaIHMException("formatUI(): Can't find define: '%s'", defError.c_str());
}
@ -1526,7 +1526,7 @@ int CLuaIHMRyzom::createGroupInstance(CLuaState &ls)
templateParams.push_back(std::pair<std::string, std::string>(it.nextKey().toString(), it.nextValue().toString())); // strange compilation bug here when I use std::make_pair ... :(
}
CInterfaceManager *im = CInterfaceManager::getInstance();
CInterfaceGroup *result = im->createGroupInstance(ls.toString(1), ls.toString(2), templateParams);
CInterfaceGroup *result = im->getParser()->createGroupInstance(ls.toString(1), ls.toString(2), templateParams);
if (!result)
{
ls.pushNil();
@ -1565,7 +1565,7 @@ int CLuaIHMRyzom::createRootGroupInstance(CLuaState &ls)
templateParams.push_back(std::pair<std::string, std::string>(it.nextKey().toString(), it.nextValue().toString())); // strange compilation bug here when I use std::make_pair ... :(
}
CInterfaceManager *im = CInterfaceManager::getInstance();
CInterfaceGroup *result = im->createGroupInstance(ls.toString(1), "ui:interface:"+string(ls.toString(2)), templateParams);
CInterfaceGroup *result = im->getParser()->createGroupInstance(ls.toString(1), "ui:interface:"+string(ls.toString(2)), templateParams);
if (!result)
{
ls.pushNil();
@ -1612,7 +1612,7 @@ int CLuaIHMRyzom::createUIElement(CLuaState &ls)
templateParams.push_back(std::pair<std::string, std::string>(it.nextKey().toString(), it.nextValue().toString())); // strange compilation bug here when I use std::make_pair ... :(
}
CInterfaceManager *im = CInterfaceManager::getInstance();
CInterfaceElement *result = im->createUIElement(ls.toString(1), ls.toString(2), templateParams);
CInterfaceElement *result = im->getParser()->createUIElement(ls.toString(1), ls.toString(2), templateParams);
if (!result)
{
ls.pushNil();
@ -1961,9 +1961,9 @@ std::string CLuaIHMRyzom::getDefine(const std::string &def)
{
//H_AUTO(Lua_CLuaIHM_getDefine)
CInterfaceManager *pIM= CInterfaceManager::getInstance();
if(ClientCfg.DisplayLuaDebugInfo && !pIM->isDefineExist(def))
if(ClientCfg.DisplayLuaDebugInfo && !pIM->getParser()->isDefineExist(def))
debugInfo(toString("getDefine(): '%s' not found", def.c_str()));
return pIM->getDefine(def);
return pIM->getParser()->getDefine(def);
}
// ***************************************************************************
@ -2703,7 +2703,7 @@ sint32 CLuaIHMRyzom::getTargetLevel()
if ( target->isPlayer() )
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("target_player_level") );
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getParser()->getDefine("target_player_level") );
return pDbPlayerLevel ? pDbPlayerLevel->getValue32() : -1;
}
else
@ -2768,7 +2768,7 @@ sint32 CLuaIHMRyzom::getTargetForceRegion()
if ( target->isPlayer() )
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("target_player_level") );
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getParser()->getDefine("target_player_level") );
if (!pDbPlayerLevel) return -1;
sint nLevel = pDbPlayerLevel->getValue32();
if ( nLevel < 250 )
@ -2796,7 +2796,7 @@ sint32 CLuaIHMRyzom::getTargetLevelForce()
if ( target->isPlayer() )
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getDefine("target_player_level") );
CCDBNodeLeaf *pDbPlayerLevel = NLGUI::CDBManager::getInstance()->getDbProp( pIM->getParser()->getDefine("target_player_level") );
if (!pDbPlayerLevel) return -1;
sint nLevel = pDbPlayerLevel->getValue32();
if ( nLevel < 250 )

View file

@ -89,7 +89,7 @@ void addKeyLine (CGroupList *pParent, const ucstring &keyName, const ucstring &s
vParams.push_back(make_pair(string("id"), templateId));
vParams.push_back(make_pair(string("lineid"), toString(lineId)));
CInterfaceGroup *pKeysLine = NULL;
pKeysLine = pIM->createGroupInstance (TEMPLATE_KEYS_GROUP, pParent->getId(), vParams);
pKeysLine = pIM->getParser()->createGroupInstance (TEMPLATE_KEYS_GROUP, pParent->getId(), vParams);
if (pKeysLine == NULL) return;
// Put name
@ -424,7 +424,7 @@ void CModalContainerEditCmd::create(const std::string &name, bool bDefKey, bool
vArgs.push_back(pair<string,string>("db_disp_1p",DbComboDisp1P));
vArgs.push_back(pair<string,string>("db_disp_2p",DbComboDisp2P));
Win = dynamic_cast<CGroupContainer*>(pIM->createGroupInstance(TEMPLATE_EDITCMD, "ui:interface", vArgs));
Win = dynamic_cast<CGroupContainer*>(pIM->getParser()->createGroupInstance(TEMPLATE_EDITCMD, "ui:interface", vArgs));
if (Win == NULL)
{
nlwarning ("cannot create %s", name.c_str());

View file

@ -802,7 +802,7 @@ void addCommandLine (CGroupList *pParent, uint cmdNb, const ucstring &cmdName)
vector< pair<string, string> > vParams;
vParams.push_back(pair<string,string>("id", "c"+toString(cmdNb)));
CInterfaceGroup *pNewCmd = pIM->createGroupInstance(TEMPLATE_NEWMACRO_COMMAND, pParent->getId(), vParams);
CInterfaceGroup *pNewCmd = pIM->getParser()->createGroupInstance(TEMPLATE_NEWMACRO_COMMAND, pParent->getId(), vParams);
if (pNewCmd == NULL) return;
CViewText *pVT = dynamic_cast<CViewText*>(pNewCmd->getView(TEMPLATE_NEWMACRO_COMMAND_TEXT));
@ -969,7 +969,7 @@ void addMacroLine (CGroupList *pParent, uint macNb, const CMacroCmd &macro)
vector< pair<string, string> > vParams;
vParams.push_back(pair<string,string>("id", "m"+toString(macNb)));
CInterfaceGroup *pNewMacro = pIM->createGroupInstance(TEMPLATE_MACRO_ELT, pParent->getId(), vParams);
CInterfaceGroup *pNewMacro = pIM->getParser()->createGroupInstance(TEMPLATE_MACRO_ELT, pParent->getId(), vParams);
if (pNewMacro == NULL) return;
CViewText *pVT = dynamic_cast<CViewText*>(pNewMacro->getView(TEMPLATE_MACRO_ELT_TEXT));

View file

@ -674,10 +674,10 @@ void CHugeListObs::updateUIItemPage(uint index)
// If price of current selected item has changed, repercute it
if (sheet == CDBCtrlSheet::getCurrSelection())
{
string ls = im->getDefine("item_price_1");
string ms = im->getDefine("item_price_2");
string bs = im->getDefine("item_price_3");
string vbs = im->getDefine("item_price_4");
string ls = im->getParser()->getDefine("item_price_1");
string ms = im->getParser()->getDefine("item_price_2");
string bs = im->getParser()->getDefine("item_price_3");
string vbs = im->getParser()->getDefine("item_price_4");
setPriceInDB(currItem.Price, ls, ms, bs, vbs);
}
}

View file

@ -1029,7 +1029,7 @@ class CHandlerChatGroupFilter : public IActionHandler
CCtrlTabButton *pTabButton= dynamic_cast<CCtrlTabButton*>(pCaller);
if(pTabButton)
{
CRGBA stdColor= CRGBA::stringToRGBA(pIM->getDefine("chat_group_tab_color_normal").c_str());
CRGBA stdColor= CRGBA::stringToRGBA(pIM->getParser()->getDefine("chat_group_tab_color_normal").c_str());
pTabButton->setTextColorNormal(stdColor);
}
}
@ -2815,7 +2815,7 @@ static CInterfaceGroup *createMenuCheckBox(const std::string &onclickL, const st
params[1].second = paramsL;
CInterfaceManager *im = CInterfaceManager::getInstance();
CInterfaceGroup *ig = im->createGroupInstance("menu_checkbox", "", params, sizeof(params) / sizeof(params[0]));
CInterfaceGroup *ig = im->getParser()->createGroupInstance("menu_checkbox", "", params, sizeof(params) / sizeof(params[0]));
if (!ig) return NULL;
CCtrlBaseButton *cb = dynamic_cast<CCtrlBaseButton *>(ig->getCtrl("b"));
if (!cb) return NULL;

View file

@ -86,7 +86,7 @@ bool CPeopleList::create(const CPeopleListDesc &desc, const CChatWindowDesc *cha
{
baseId = fatherContainer->getId() + ":list";
}
CInterfaceGroup *mainIg = im->createGroupInstance(desc.BaseContainerTemplateName, baseId, baseContainerParams);
CInterfaceGroup *mainIg = im->getParser()->createGroupInstance(desc.BaseContainerTemplateName, baseId, baseContainerParams);
// must attach group to hierarchy before we can use it
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(mainIg);
if (!gc) return false;
@ -361,7 +361,7 @@ sint CPeopleList::addPeople(const ucstring &name, uint teamMateIndex /*= 0*/)
}
CInterfaceManager *im = CInterfaceManager::getInstance();
CInterfaceGroup *group = im->createGroupInstance(templateName, "ui:interface", properties, false);
CInterfaceGroup *group = im->getParser()->createGroupInstance(templateName, "ui:interface", properties, false);
if (!group) return -1;
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(group);
if (!gc)

View file

@ -210,7 +210,7 @@ void createOptionalCatUI()
if (i>0)
params.push_back(pair<string,string>("posref", "BL TL"));
CInterfaceGroup *pNewLine = pIM->createGroupInstance("t_cat", GROUP_LIST_CAT, params);
CInterfaceGroup *pNewLine = pIM->getParser()->createGroupInstance("t_cat", GROUP_LIST_CAT, params);
if (pNewLine != NULL)
{
CViewText *pVT = dynamic_cast<CViewText*>(pNewLine->getView("name"));
@ -1086,7 +1086,7 @@ void initShardDisplay()
if (i>0)
params.push_back(pair<string,string>("posref", "BL TL"));
CInterfaceGroup *pNewLine =pIM->createGroupInstance("t_shard", GROUP_LIST_SHARD, params);
CInterfaceGroup *pNewLine =pIM->getParser()->createGroupInstance("t_shard", GROUP_LIST_SHARD, params);
if (pNewLine != NULL)
{
CViewText *pVT = dynamic_cast<CViewText*>(pNewLine->getView("name"));

View file

@ -808,10 +808,10 @@ void getSeedsFromDB(CSeeds &dest)
CInterfaceManager *im =CInterfaceManager::getInstance();
nlctassert(sizeof(CSeeds::TUInt) == 4); // excpect that the number of each seed type is encoded on 32 bits
// if this assert at compile, change the following code
string ls = im->getDefine("money_1");
string ms = im->getDefine("money_2");
string bs = im->getDefine("money_3");
string vbs = im->getDefine("money_4");
string ls = im->getParser()->getDefine("money_1");
string ms = im->getParser()->getDefine("money_2");
string bs = im->getParser()->getDefine("money_3");
string vbs = im->getParser()->getDefine("money_4");
dest = CSeeds(NLGUI::CDBManager::getInstance()->getDbProp(ls)->getValue32(),
NLGUI::CDBManager::getInstance()->getDbProp(ms)->getValue32(),

View file

@ -3335,7 +3335,7 @@ private:
pGC->setActive(true);
// must set the text by hand
CViewText *vt= dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(pIM->getDefine("server_message_box_content_view_text")));
CViewText *vt= dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(pIM->getParser()->getDefine("server_message_box_content_view_text")));
if(vt)
vt->setTextFormatTaged(contentStr);

View file

@ -428,7 +428,7 @@ void CDisplayerVisual::onPostRender()
CInterfaceManager *pIM = CInterfaceManager::getInstance();
const char *iconTemplateName = "r2ed_bad_pos_icon";
// if the in scene 'stop' window wasn't created, then create it now
CInterfaceGroup *group = pIM->createGroupInstance (iconTemplateName , "ui:interface", NULL, 0);
CInterfaceGroup *group = pIM->getParser()->createGroupInstance (iconTemplateName , "ui:interface", NULL, 0);
if (group)
{
_IconInScene = dynamic_cast<CGroupInScene *>(group);

View file

@ -2733,7 +2733,7 @@ uint CEditor::getMaxNumPlotItems()
{
//H_AUTO(R2_CEditor_getMaxNumPlotItems)
uint ret;
fromString(getUI().getDefine("r2ed_max_num_plot_item_sheets"), ret);
fromString(getUI().getParser()->getDefine("r2ed_max_num_plot_item_sheets"), ret);
return ret;
}

View file

@ -241,7 +241,7 @@ void releaseMainLoopReselect()
ActionsContext.removeAllCombos();
EditActions.releaseAllKeyNoRunning();
Actions.releaseAllKeyNoRunning();
pIM->removeAllTemplates();
pIM->getParser()->removeAllTemplates();
CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
CWidgetManager::getInstance()->setCapturePointerRight(NULL);