Ejemplo n.º 1
0
	virtual void execute(CCtrlBase * /* pCaller */, const string &/* Params */)
	{
		// Init 'new_macro' container from the global current macro (gCurrentEditMacro)
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CMacroCmdManager *pMCM = CMacroCmdManager::getInstance();
		// Icon
		CDBCtrlSheet *pCS = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_NEWMACRO_ICON));
		if (pCS != NULL) pCS->readFromMacro(pMCM->CurrentEditMacro);
		// Name
		CGroupEditBox *pEB = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_EDIT_NAME));
		if (pEB != NULL) pEB->setInputString(pMCM->CurrentEditMacro.Name);
		// Commands
		CGroupList *pList = dynamic_cast<CGroupList*>(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_COMMANDS));
		if (pList == NULL) return;
		// Key Shortcut
		CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(VIEW_NEWMACRO_KEY));
		if (pVT != NULL)
		{
			if (pMCM->CurrentEditMacro.Combo.Key == KeyCount)
				pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT));
			else
				pVT->setText(pMCM->CurrentEditMacro.Combo.toUCString());
		}

		pList->clearGroups();
		pList->setDynamicDisplaySize(true);

		for (uint i = 0; i < pMCM->CurrentEditMacro.Commands.size(); ++i)
		{
			ucstring commandName;
			for (uint j = 0; j < pMCM->ActionManagers.size(); ++j)
			{
				CAction::CName c(pMCM->CurrentEditMacro.Commands[i].Name.c_str(), pMCM->CurrentEditMacro.Commands[i].Params.c_str());
				if (pMCM->ActionManagers[j]->getBaseAction(c) != NULL)
				{
					commandName = pMCM->ActionManagers[j]->getBaseAction(c)->getActionLocalizedText(c);
					break;
				}
			}

			addCommandLine(pList, i, commandName);
		}
		pMCM->EditCmd->CurAM = pMCM->ActionManagers[0];
	}
Ejemplo n.º 2
0
	virtual void execute(CCtrlBase * /* pCaller */, const string &/* Params */)
	{
		// Init 'macros' container from the macro manager
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CMacroCmdManager *pMCM = CMacroCmdManager::getInstance();

		CGroupList *pList = dynamic_cast<CGroupList*>(CWidgetManager::getInstance()->getElementFromId(WIN_MACRO_CONTENT));
		if (pList == NULL) return;

		pList->clearGroups();
		pList->setDynamicDisplaySize(true);

		// Refresh the shortcut key that can be changed in the keys container
		pMCM->refreshMacroCombo();

		// Add all macros template
		const vector<CMacroCmd> &vM = pMCM->getMacros();
		for (uint i = 0; i < vM.size(); ++i)
		{
			addMacroLine(pList, i, vM[i]);
		}
	}