//---------------------------------------------------------
CWKSP_Module_Group * CWKSP_Module_Manager::Get_Group(const wxString &Group)
{
	for(int i=0; i<Get_Count(); i++)
	{
		if( !Group.Cmp(Get_Group(i)->Get_Name()) )
		{
			return( Get_Group(i) );
		}
	}

	return( NULL );
}
//---------------------------------------------------------
bool CWKSP_Module_Manager::_Update(bool bSyncToCtrl)
{
	if( !bSyncToCtrl )
	{
	//	Get_Control()->Freeze();

		for(int i=SG_Get_Module_Library_Manager().Get_Count()-1; i>=0; i--)
		{
			CSG_Module_Library	*pLibrary	= SG_Get_Module_Library_Manager().Get_Library(i);
			CWKSP_Module_Library	*pItem	= Get_Library(pLibrary);

			if( !pItem )
			{
				CWKSP_Module_Group	*pGroup	= Get_Group(pLibrary->Get_Category().c_str());

				if( !pGroup )
				{
					Add_Item(pGroup = new CWKSP_Module_Group(pLibrary->Get_Category().c_str()));
				}

				pGroup->Add_Library(pLibrary);
			}
			else if( pItem->Get_Library()->Get_Type() == MODULE_CHAINS )
			{
				pItem->Update();
			}
		}

	//	Get_Control()->Thaw();
	}

	m_pMenu_Modules->Update();

	return( true );
}
//---------------------------------------------------------
bool CWKSP_Module_Manager::Finalise(void)
{
	CONFIG_Write("/MODULES", &m_Parameters);

	CONFIG_Delete(CFG_LIBS);

	for(int i=0, n=0; i<Get_Count(); i++)
	{
		CWKSP_Module_Group	*pGroup	= Get_Group(i);

		for(int j=0; j<pGroup->Get_Count(); j++)
		{
			CSG_Module_Library	*pLibrary	= pGroup->Get_Library(j)->Get_Library();

			if( pLibrary->Get_Type() == MODULE_CHAINS )
			{
				for(int j=0; j<pLibrary->Get_Count(); j++)
				{
					CONFIG_Write(CFG_LIBS, wxString::Format(CFG_LIBF, n++), GET_LIBPATH(pLibrary->Get_File_Name(j)));
				}
			}
			else
			{
				CONFIG_Write(CFG_LIBS, wxString::Format(CFG_LIBF, n++), GET_LIBPATH(pLibrary->Get_File_Name()));
			}
		}
	}

	return( true );
}
//---------------------------------------------------------
bool CWKSP_Module_Manager::Exists(CWKSP_Module *pModule)
{
	for(int i=0; i<Get_Count(); i++)
	{
		CWKSP_Module_Group	*pGroup	= Get_Group(i);

		for(int j=0; j<pGroup->Get_Count(); j++)
		{
			if( pGroup->Get_Library(j)->Get_Module(pModule) != NULL )
			{
				return( true );
			}
		}
	}

	return( false );
}
//---------------------------------------------------------
CWKSP_Module_Library * CWKSP_Module_Manager::Get_Library(CSG_Module_Library *pLibrary)
{
	for(int i=0; i<Get_Count(); i++)
	{
		CWKSP_Module_Group	*pGroup	= Get_Group(i);

		for(int j=0; j<pGroup->Get_Count(); j++)
		{
			if( pLibrary == pGroup->Get_Library(j)->Get_Library() )
			{
				return( pGroup->Get_Library(j) );
			}
		}
	}

	return( NULL );
}
Esempio n. 6
0
//---------------------------------------------------------
bool CWKSP_Tool_Manager::Exists(CWKSP_Tool *pTool)
{
	for(int i=0; i<Get_Count(); i++)
	{
		CWKSP_Tool_Group	*pGroup	= Get_Group(i);

		for(int j=0; j<pGroup->Get_Count(); j++)
		{
			if( pGroup->Get_Library(j)->Get_Tool(pTool) != NULL )
			{
				return( true );
			}
		}
	}

	return( false );
}
//---------------------------------------------------------
CWKSP_Module * CWKSP_Module_Manager::Get_Module_byID(int CMD_ID)
{
	CWKSP_Module	*pModule;

	for(int i=0; i<Get_Count(); i++)
	{
		CWKSP_Module_Group	*pGroup	= Get_Group(i);

		for(int j=0; j<pGroup->Get_Count(); j++)
		{
			if( (pModule = pGroup->Get_Library(j)->Get_Module_byID(CMD_ID)) != NULL )
			{
				return( pModule );
			}
		}
	}

	return( NULL );
}
Esempio n. 8
0
//---------------------------------------------------------
CWKSP_Tool * CWKSP_Tool_Manager::Get_Tool_byID(int CMD_ID)
{
	CWKSP_Tool	*pTool;

	for(int i=0; i<Get_Count(); i++)
	{
		CWKSP_Tool_Group	*pGroup	= Get_Group(i);

		for(int j=0; j<pGroup->Get_Count(); j++)
		{
			if( (pTool = pGroup->Get_Library(j)->Get_Tool_byID(CMD_ID)) != NULL )
			{
				return( pTool );
			}
		}
	}

	return( NULL );
}