Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,826 @@
/******************************************************************************
* CFast_1.cpp : passage de l'ia en C, 1<>re passe
* auteur : Fred "Bart" Compagnon
******************************************************************************/
#include "stdafx.h"
#include <malloc.h>
#include "ai.h"
#include "CFast_1.hpp"
extern char CFast_IsAReference(tdstNodeInterpret *_pst_Node, int *pi_Indice);
bool bGoToFatherNode ( tdstNodeInterpret** p_p_stNode ) ;
CFast_tdstComportTree g_stFastTree;
CFast_tdstNode* g_p_stPseudoNode;
unsigned short g_uwNbMetaAction; // Nb de MetaAction
unsigned short g_uwNbStopEngine; // Nb de BloquantMoteur
tdstNodeInterpret* g_p_stIf2Node = NULL;
// init, desinit
#if defined (CFAST_DEBUG_FIRST_PASS)
long g_lNbTotalDeNoeud;
long g_lNbTotalDeNoeudToTest;
FILE *g_fdCru = NULL ;
void CFast_FirstPassOpening() {
g_lNbTotalDeNoeud = 0;
g_lNbTotalDeNoeudToTest = 0;
g_fdCru = fopen ( "CFastRul.log", "w" );
}
long lCFast_FirstPassClosing() {
if ( g_fdCru != NULL ) {
if (g_lNbTotalDeNoeudToTest == g_lNbTotalDeNoeud)
fprintf ( g_fdCru, "\nTaille de l'IA : Nb Noeuds = %d / Taille de l'arbre = %d\n", g_lNbTotalDeNoeud, g_lNbTotalDeNoeud*sizeof(struct tdstNodeInterpret_) );
else
fprintf ( g_fdCru, "\nERREUR : Nb Noeuds dans l'IA (%d) diff<66>rent du Nb de Noeuds g<>n<EFBFBD>r<EFBFBD>s (%d)\n" , g_lNbTotalDeNoeudToTest, g_lNbTotalDeNoeud);
fclose ( g_fdCru ) ;
}
return (g_lNbTotalDeNoeudToTest == g_lNbTotalDeNoeud)?g_lNbTotalDeNoeud:-1;
}
void OriginalNodeDescription(tdstNodeInterpret* p_stOriginalNode)
{
tdeTypeInterpret eType=M_GetTypeInterpret(p_stOriginalNode);
//char sz128Temp[128];
if ( g_fdCru != NULL )
{
if (eType == E_ti_KeyWord)
fprintf ( g_fdCru, "KeyWord : %s", szFindKeyWordEditorNameFromId(M_eKeyWordIdInterpret(p_stOriginalNode)));
else if (eType == E_ti_Condition)
fprintf ( g_fdCru, "Condition : %s", szFindConditionEditorNameFromId(M_eCondIdInterpret(p_stOriginalNode)));
else if (eType == E_ti_Operator)
fprintf ( g_fdCru, "Operator : %s", szFindOperatorEditorNameFromId(M_eOperatorIdInterpret(p_stOriginalNode)));
else if (eType == E_ti_Function)
fprintf ( g_fdCru, "Function : %s", szFindFunctionEditorNameFromId(M_eFuncIdInterpret(p_stOriginalNode)));
else if (eType == E_ti_Procedure)
fprintf ( g_fdCru, "Procedure : %s", szFindProcedureEditorNameFromId(M_eProcedureIdInterpret(p_stOriginalNode)));
else if (eType == E_ti_MetaAction)
fprintf ( g_fdCru, "MetaAction : %s", szFindMetaActionEditorNameFromId(M_eMetaActionIdInterpret(p_stOriginalNode)));
else if (eType == E_ti_Field)
fprintf ( g_fdCru, "Field : %s", szFindFieldEditorNameFromId(M_eFieldIdInterpret(p_stOriginalNode)));
else
switch (eType)
{
case E_ti_DsgVar : fprintf ( g_fdCru, "DsgVar : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_DsgVarRef : fprintf ( g_fdCru, "DsgVarRef : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_PersoRef : fprintf ( g_fdCru, "PersoRef : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_ActionRef : fprintf ( g_fdCru, "ActionRef : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_SuperObjectRef : fprintf ( g_fdCru, "SuperObjectRef : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_WayPointRef : fprintf ( g_fdCru, "WayPointRef : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_ComportRef : fprintf ( g_fdCru, "ComportRef : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_ModuleRef : fprintf ( g_fdCru, "ModuleRef : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_ObjectTableRef : fprintf ( g_fdCru, "ObjectTableRef : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_GameMaterialRef : fprintf ( g_fdCru, "GameMaterialRef : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_ModelRef : fprintf ( g_fdCru, "ModelRef : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_MacroRef : fprintf ( g_fdCru, "MacroRef : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_EndTree : fprintf ( g_fdCru, "EndTree : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_Constant : fprintf ( g_fdCru, "Constant : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_Real : fprintf ( g_fdCru, "Real : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_Vector : fprintf ( g_fdCru, "Vector : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_Mask : fprintf ( g_fdCru, "Mask : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_Module : fprintf ( g_fdCru, "Module : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_Caps : fprintf ( g_fdCru, "Caps : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_Graph : fprintf ( g_fdCru, "Graph : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
case E_ti_BeginMacro :
//strncpy(sz128Temp, M_GetSetParam_szString(p_stOriginalNode), 100);
//sz128Temp[100] = 0;
//fprintf ( g_fdCru, "BeginMacro : \"%s...\"", sz128Temp);
fprintf ( g_fdCru, "BeginMacro : %d", M_GetSetParam_ulValue(p_stOriginalNode));
break;
case E_ti_EndMacro : fprintf ( g_fdCru, "EndMacro : %d", M_GetSetParam_ulValue(p_stOriginalNode)); break;
default : fprintf ( g_fdCru, "%d : %d", eType, M_GetSetParam_ulValue(p_stOriginalNode)); break;
}
}
}
void AddTabsForDepth(tdstNodeInterpret* p_stOriginalNode)
{
for (int n=0 ; n<p_stOriginalNode->ucDepth ; n++)
fprintf ( g_fdCru, " ");
}
void PseudoNodeDescription(CFast_tdstNode* _p_stPseudoNode)
{
if ( g_fdCru != NULL )
{
AddTabsForDepth(&(_p_stPseudoNode->stNode));
OriginalNodeDescription(&(_p_stPseudoNode->stNode));
if (_p_stPseudoNode->lIndexOfRef == -1)
fprintf ( g_fdCru, " (%d)", _p_stPseudoNode->ucNumberOfParamNeeded);
else
fprintf ( g_fdCru, " [Ref:%d] (%d)", _p_stPseudoNode->lIndexOfRef, _p_stPseudoNode->ucNumberOfParamNeeded);
if (_p_stPseudoNode->ucIndexOfEvalParam != 0)
fprintf ( g_fdCru, " -> %d", _p_stPseudoNode->ucIndexOfEvalParam);
if (_p_stPseudoNode->bAffectWithGetVector )
fprintf ( g_fdCru, " *", _p_stPseudoNode->ucIndexOfEvalParam);
if (_p_stPseudoNode->bIsABooleanDsgVarRef)
fprintf ( g_fdCru, " bool", _p_stPseudoNode->ucIndexOfEvalParam);
if (M_GetTypeInterpret(&(g_p_stPseudoNode->stMiscellaneousNode)) != E_ti_Unknown){
fprintf ( g_fdCru, " => { ");
OriginalNodeDescription(&(_p_stPseudoNode->stMiscellaneousNode));
fprintf ( g_fdCru, " }");
}
if ( _p_stPseudoNode->bIsACondition ) {
fprintf ( g_fdCru, " [condition]" ) ;
}
if ( _p_stPseudoNode->bIsATernOpParam ) {
fprintf ( g_fdCru, "[ternop]" ) ;
}
fprintf ( g_fdCru, "\n");
fflush(g_fdCru);
}
}
#endif //defined (CFAST_DEBUG_FIRST_PASS)
bool bIsTheUltraOperator( tdstNodeInterpret* p_stNode ) {
if ( (M_GetTypeInterpret(p_stNode) == E_ti_Operator) && (M_eOperatorIdInterpret(p_stNode) == eOperator_Ultra) )
return TRUE;
return FALSE;
}
bool bIsTheDotOperator( tdstNodeInterpret* p_stNode ) {
if ( (M_GetTypeInterpret(p_stNode) == E_ti_Operator) &&
(M_eOperatorIdInterpret(p_stNode) == eOperator_Dot) )
return TRUE;
return FALSE;
}
bool bIsTheAffectOperator( tdstNodeInterpret* p_stNode ) {
if ( (M_GetTypeInterpret(p_stNode) == E_ti_Operator) && (M_eOperatorIdInterpret(p_stNode) == eOperator_Affect) )
return TRUE;
return FALSE;
}
bool bIsAnAffectOperator( tdstNodeInterpret* p_stNode ) {
if ( (M_GetTypeInterpret(p_stNode) == E_ti_Operator)
&& ( (M_eOperatorIdInterpret(p_stNode) == eOperator_Affect)
|| (M_eOperatorIdInterpret(p_stNode) == eOperator_PlusAffect)
|| (M_eOperatorIdInterpret(p_stNode) == eOperator_MinusAffect)
|| (M_eOperatorIdInterpret(p_stNode) == eOperator_MulAffect)
|| (M_eOperatorIdInterpret(p_stNode) == eOperator_DivAffect)
|| (M_eOperatorIdInterpret(p_stNode) == eOperator_PlusPlusAffect)
|| (M_eOperatorIdInterpret(p_stNode) == eOperator_MinusMinusAffect)
)
)
return TRUE;
return FALSE;
}
bool bIsAGetVectorOperator( tdstNodeInterpret* p_stNode ) {
if ( (M_GetTypeInterpret(p_stNode) == E_ti_Operator)
&& ( (M_eOperatorIdInterpret(p_stNode) == eOperator_GetVectorX)
|| (M_eOperatorIdInterpret(p_stNode) == eOperator_GetVectorY)
|| (M_eOperatorIdInterpret(p_stNode) == eOperator_GetVectorZ)
)
)
return TRUE;
return FALSE;
}
bool bIsAnIfKeyWord( tdstNodeInterpret* p_stNode ) {
if (M_GetTypeInterpret(p_stNode) != E_ti_KeyWord)
return FALSE;
if ( (M_eKeyWordIdInterpret(p_stNode) == eKeyWord_If)
|| (M_eKeyWordIdInterpret(p_stNode) == eKeyWord_IfNot)
|| (M_eKeyWordIdInterpret(p_stNode) == eKeyWord_If2)
|| (M_eKeyWordIdInterpret(p_stNode) == eKeyWord_If4)
|| (M_eKeyWordIdInterpret(p_stNode) == eKeyWord_If8)
|| (M_eKeyWordIdInterpret(p_stNode) == eKeyWord_If16)
)
return TRUE;
return FALSE;
}
bool bIsTheElseKeyWord( tdstNodeInterpret* p_stNode ) {
if ( (M_GetTypeInterpret(p_stNode) == E_ti_KeyWord) && (M_eKeyWordIdInterpret(p_stNode) == eKeyWord_Else) )
return TRUE;
//jawaka : new keyword sidebug
if ( (M_GetTypeInterpret(p_stNode) == E_ti_KeyWord) && (M_eKeyWordIdInterpret(p_stNode) == eKeyWord_IfDebug) )
return TRUE;
if ( (M_GetTypeInterpret(p_stNode) == E_ti_KeyWord) && (M_eKeyWordIdInterpret(p_stNode) == eKeyWord_IfNotU64) )
return TRUE;
return FALSE;
}
bool bIsTheThenKeyWord( tdstNodeInterpret* p_stNode ) {
if ( (M_GetTypeInterpret(p_stNode) == E_ti_KeyWord) && (M_eKeyWordIdInterpret(p_stNode) == eKeyWord_Then) )
return TRUE;
return FALSE;
}
bool bIsTheEndifKeyWord( tdstNodeInterpret* p_stNode ) {
if ( (M_GetTypeInterpret(p_stNode) == E_ti_KeyWord) && (M_eKeyWordIdInterpret(p_stNode) == eKeyWord_Endif) )
return TRUE;
return FALSE;
}
bool bIsABooleanCondition( tdstNodeInterpret* p_stNode ) {
if (M_GetTypeInterpret(p_stNode) != E_ti_Condition)
return FALSE;
if ( (M_eCondIdInterpret(p_stNode) == eCond_Et)
|| (M_eCondIdInterpret(p_stNode) == eCond_Ou)
|| (M_eCondIdInterpret(p_stNode) == eCond_Not)
|| (M_eCondIdInterpret(p_stNode) == eCond_XOr)
)
return TRUE;
return FALSE;
}
bool bNeedBooleanParam( tdstNodeInterpret* p_stNode ) {
if (bIsAnIfKeyWord(p_stNode))
return TRUE;
if (bIsABooleanCondition(p_stNode))
return TRUE;
/* if ( M_GetTypeInterpret(p_stNode) == E_ti_Function &&
M_eFuncIdInterpret(p_stNode) == eFunc_TernOp )
return TRUE ;*/
return FALSE;
}
bool bIsATernOpFunction (tdstNodeInterpret* p_stNode) {
if ( (M_GetTypeInterpret(p_stNode) == E_ti_Function) &&
( (M_eFuncIdInterpret(p_stNode) == eFunc_TernOp) ||
(M_eFuncIdInterpret(p_stNode) == eFunc_TernSup) ||
(M_eFuncIdInterpret(p_stNode) == eFunc_TernEq) ||
(M_eFuncIdInterpret(p_stNode) == eFunc_TernInfEq) ||
(M_eFuncIdInterpret(p_stNode) == eFunc_TernSupEq) ) )
return TRUE;
return FALSE;
}
bool bCheckForTernOp ( tdstNodeInterpret* p_stNode ) {
tdstNodeInterpret* p_stFatherNode ;
if ( bIsATernOpFunction(p_stNode) )
return (TRUE) ;
p_stFatherNode = p_stNode;
while ( bGoToFatherNode(&p_stFatherNode) ) {
if ( bIsATernOpFunction(p_stFatherNode) )
return ( TRUE ) ;
}
return (FALSE) ;
}
bool bCheckForCondition (tdstNodeInterpret* p_stNode ) {
tdstNodeInterpret* p_stFatherNode ;
if ( M_GetTypeInterpret(p_stNode) == E_ti_Condition ){
p_stFatherNode = p_stNode;
bGoToFatherNode(&p_stFatherNode) ;
if ( bIsTheUltraOperator(p_stFatherNode) )
bGoToFatherNode(&p_stFatherNode) ;
if ( M_GetTypeInterpret(p_stFatherNode) != E_ti_Condition &&
(!bIsAnIfKeyWord(p_stFatherNode) ) )
return ( TRUE ) ;
}
return (FALSE) ;
}
CFast_tdstComportTree* CFast_FirstPassInitComport ( tdstComport* p_stComport ) {
unsigned short uwNbTotalNode, uwNodesCount;
unsigned char ucRulesCount;
tdstTreeInterpret* p_stCurrentRule;
tdstNodeInterpret* p_stCurrentNode;
if (p_stComport->p_stSchedule != NULL) {
p_stCurrentRule = p_stComport->p_stSchedule;
uwNbTotalNode = p_stCurrentRule->uwNbNode;
for (uwNodesCount = 0, p_stCurrentNode = p_stCurrentRule->p_stNodeInterpret ; uwNodesCount<p_stCurrentRule->uwNbNode ; uwNodesCount++, p_stCurrentNode++)
if (bIsTheElseKeyWord(p_stCurrentNode))
uwNbTotalNode++;
}
else {
uwNbTotalNode = 0;
for (ucRulesCount = 0, p_stCurrentRule = p_stComport->p_stRules ; ucRulesCount<p_stComport->ucNbRules ; ucRulesCount++, p_stCurrentRule++) {
uwNbTotalNode += p_stCurrentRule->uwNbNode;
// to count the number of "Else"
for (uwNodesCount = 0, p_stCurrentNode = p_stCurrentRule->p_stNodeInterpret ; uwNodesCount<p_stCurrentRule->uwNbNode ; uwNodesCount++, p_stCurrentNode++)
if (bIsTheElseKeyWord(p_stCurrentNode))
uwNbTotalNode++;
}
}
g_stFastTree.p_stCFastNode = NULL ;
g_stFastTree.p_stCFastNode = (CFast_tdstNode*)malloc ( uwNbTotalNode * sizeof(struct CFast_tdstNode_) ) ;
g_stFastTree.uwNbNode = uwNbTotalNode;
g_stFastTree.d_cDeclarations = NULL;
#if defined (CFAST_DEBUG_FIRST_PASS)
g_lNbTotalDeNoeudToTest += uwNbTotalNode;
if ( g_fdCru != NULL )
fprintf ( g_fdCru, "\n***** %s *****\n\n", M_GetNameComport(p_stComport));
#endif //defined (CFAST_DEBUG_FIRST_PASS)
return (&g_stFastTree) ;
}
CFast_tdstComportTree* CFast_FirstPassInitSubr ( tdstMacro* p_stMacro )
{
unsigned short uwNbTotalNode , uwNodesCount ;
tdstTreeInterpret *p_stCurrentRule = p_stMacro->p_stInitTree ;
tdstNodeInterpret* p_stCurrentNode;
uwNbTotalNode = p_stCurrentRule->uwNbNode ;
for
(
uwNodesCount = 0, p_stCurrentNode = p_stCurrentRule->p_stNodeInterpret ;
uwNodesCount < p_stCurrentRule->uwNbNode ;
uwNodesCount ++ , p_stCurrentNode ++
)
if ( bIsTheElseKeyWord ( p_stCurrentNode ) )
uwNbTotalNode ++ ;
g_stFastTree.p_stCFastNode = NULL ;
g_stFastTree.p_stCFastNode = ( CFast_tdstNode * ) malloc ( uwNbTotalNode * sizeof(struct CFast_tdstNode_) ) ;
g_stFastTree.uwNbNode = uwNbTotalNode;
g_stFastTree.d_cDeclarations = NULL;
#if defined (CFAST_DEBUG_FIRST_PASS)
g_lNbTotalDeNoeudToTest += uwNbTotalNode;
if ( g_fdCru != NULL )
fprintf ( g_fdCru, "\n***** %s *****\n\n", "Subroutine");
#endif //defined (CFAST_DEBUG_FIRST_PASS)
return (&g_stFastTree) ;
}
void CFast_FirstPassDesinit () {
if (g_stFastTree.p_stCFastNode != NULL) {
CFast_tdstNode* p_stCurrentPseudoNode;
unsigned short uwPseudoNodesCount;
for (uwPseudoNodesCount = 0, p_stCurrentPseudoNode = g_stFastTree.p_stCFastNode ; uwPseudoNodesCount<g_stFastTree.uwNbNode ; uwPseudoNodesCount++, p_stCurrentPseudoNode++) {
if (p_stCurrentPseudoNode->d_cOptimisedNode != NULL)
free(p_stCurrentPseudoNode->d_cOptimisedNode);
}
free (g_stFastTree.p_stCFastNode) ;
}
g_stFastTree.p_stCFastNode = NULL ;
if (g_stFastTree.d_cDeclarations != NULL) {
free(g_stFastTree.d_cDeclarations);
}
#if defined (CFAST_DEBUG_FIRST_PASS)
if ( g_fdCru != NULL )
fprintf ( g_fdCru, "\n############################################################\n\n" );
#endif //defined (CFAST_DEBUG_FIRST_PASS)
}
// nodes manipulation
tdstNodeInterpret* NextNode (tdstNodeInterpret* p_stNode ) {
return (p_stNode + 1);
}
tdstNodeInterpret* PrevNode (tdstNodeInterpret* p_stNode ) {
return (p_stNode - 1);
}
bool bGoToNextParam ( tdstNodeInterpret** p_p_stNode ) {
tdstNodeInterpret* p_stCurrentNode = *p_p_stNode;
unsigned char ucNodeDepth = p_stCurrentNode->ucDepth;
do {
p_stCurrentNode = NextNode(p_stCurrentNode) ; //p_stCurrentNode++;
}
while (p_stCurrentNode->ucDepth > ucNodeDepth);
*p_p_stNode = p_stCurrentNode;
return (p_stCurrentNode->ucDepth == ucNodeDepth) ;
}
bool bGoToPrevParam ( tdstNodeInterpret** p_p_stNode ) {
tdstNodeInterpret* p_stCurrentNode = *p_p_stNode;
unsigned char ucNodeDepth = p_stCurrentNode->ucDepth;
// careful : you must be sure not to be the first node of a tree (no test possible !)
do {
p_stCurrentNode = PrevNode(p_stCurrentNode) ; //p_stCurrentNode--;
}
while (p_stCurrentNode->ucDepth > ucNodeDepth);
*p_p_stNode = p_stCurrentNode;
return (p_stCurrentNode->ucDepth == ucNodeDepth) ;
}
bool bGoToFatherNode ( tdstNodeInterpret** p_p_stNode ) {
tdstNodeInterpret* p_stCurrentNode = *p_p_stNode;
unsigned char ucNodeDepth = p_stCurrentNode->ucDepth;
if (ucNodeDepth == 0)
return FALSE; // no father !
do {
p_stCurrentNode = PrevNode(p_stCurrentNode) ; //p_stCurrentNode--;
}
while (p_stCurrentNode->ucDepth >= ucNodeDepth);
*p_p_stNode = p_stCurrentNode;
return (p_stCurrentNode->ucDepth == ucNodeDepth-1) ;
}
tdstNodeInterpret* p_stNeedInfoWithThisNode(tdstNodeInterpret* p_stFakeOrOriginalNode, tdstNodeInterpret* p_stOriginalNode)
{
tdstNodeInterpret* p_stNodeForInfo;
// case 1 : 1st param of If2
if (g_p_stIf2Node != NULL) {
p_stNodeForInfo = g_p_stIf2Node;
g_p_stIf2Node = NULL;
return p_stNodeForInfo;
}
if (bIsTheEndifKeyWord(p_stFakeOrOriginalNode)) {
// case 2 : Then of If2, without Else
if (bIsTheThenKeyWord(p_stOriginalNode))
{
p_stNodeForInfo = p_stOriginalNode;
if (bGoToNextParam(&p_stNodeForInfo))
{
if (bIsTheElseKeyWord(p_stNodeForInfo))
return NULL; // Then is followed by Else => no info !
}
p_stNodeForInfo = p_stOriginalNode;
if (bGoToPrevParam(&p_stNodeForInfo)) // If
{
if (bIsAnIfKeyWord(p_stNodeForInfo))
return p_stNodeForInfo;
}
}
// case 3 : Else of If2
if (bIsTheElseKeyWord(p_stOriginalNode))
{
p_stNodeForInfo = p_stOriginalNode;
if (bGoToPrevParam(&p_stNodeForInfo)) // Then
{
if (bGoToPrevParam(&p_stNodeForInfo)) // If
{
if (bIsAnIfKeyWord(p_stNodeForInfo))
return p_stNodeForInfo;
}
}
}
}
// default : No info !
return NULL;
}
// node
BOOL fn_bIsABooleanDsgVarRef(tdstNodeInterpret* p_stOriginalNode) {
if ( M_GetTypeInterpret(p_stOriginalNode) == E_ti_Constant ||
M_GetTypeInterpret(p_stOriginalNode) == E_ti_Real ||
M_GetTypeInterpret(p_stOriginalNode) == E_ti_DsgVarRef ||
M_GetTypeInterpret(p_stOriginalNode) == E_ti_Field ||
( M_GetTypeInterpret(p_stOriginalNode) == E_ti_Operator &&
M_eOperatorIdInterpret(p_stOriginalNode) == eOperator_Dot ) ||
M_GetTypeInterpret(p_stOriginalNode) == E_ti_Function )
{
tdstNodeInterpret* p_stTempNode = p_stOriginalNode;
if (bGoToFatherNode(&p_stTempNode)) {
if ( bNeedBooleanParam(p_stTempNode) ) {
return TRUE;
}
}
}
return FALSE;
}
void CFast_FillOneNode( tdstNodeInterpret* p_stFakeOrOriginalNode, tdstNodeInterpret* p_stOriginalNode, unsigned char _ucIndexOfEvalParam, unsigned char _ucNumberOfParamNeeded, BOOL _bAffectWithGetVector) {
// <20> revoir car certainement plusieurs nodes <20> copier ...
int iIndice;
memcpy(&g_p_stPseudoNode->stNode, p_stFakeOrOriginalNode, sizeof(struct tdstNodeInterpret_) );
tdstNodeInterpret* p_stNodeForInfo = p_stNeedInfoWithThisNode(p_stFakeOrOriginalNode, p_stOriginalNode);
if (p_stNodeForInfo == NULL) {
memset(&g_p_stPseudoNode->stMiscellaneousNode, 0, sizeof(struct tdstNodeInterpret_) );
M_SetTypeInterpret(&(g_p_stPseudoNode->stMiscellaneousNode), E_ti_Unknown);
}
else
memcpy(&g_p_stPseudoNode->stMiscellaneousNode, p_stNodeForInfo, sizeof(struct tdstNodeInterpret_) );
g_p_stPseudoNode->ucIndexOfEvalParam = _ucIndexOfEvalParam;
g_p_stPseudoNode->ucNumberOfParamNeeded = _ucNumberOfParamNeeded;
g_p_stPseudoNode->bAffectWithGetVector = _bAffectWithGetVector;
g_p_stPseudoNode->bIsABooleanDsgVarRef = fn_bIsABooleanDsgVarRef(p_stOriginalNode); // FROM two past two TO two to two
g_p_stPseudoNode->bIsACondition = bCheckForCondition(p_stOriginalNode) ;
g_p_stPseudoNode->bIsATernOpParam = bCheckForTernOp(p_stOriginalNode) ;
g_p_stPseudoNode->d_cOptimisedNode = NULL;
g_p_stPseudoNode->ucNumberOfNodeToSkipAfterOptimisation = 0;
if (CFast_IsAReference(p_stFakeOrOriginalNode, &iIndice)) {
g_p_stPseudoNode->lIndexOfRef = (long)iIndice;
} else {
g_p_stPseudoNode->lIndexOfRef = -1L;
}
#if defined (CFAST_DEBUG_FIRST_PASS)
PseudoNodeDescription(g_p_stPseudoNode);
g_lNbTotalDeNoeud++;
#endif //defined (CFAST_DEBUG_FIRST_PASS)
g_p_stPseudoNode++;
}
// misc tests on nodes
bool bToBeMemorised ( tdstNodeInterpret* p_stNode ) {
if (bIsTheUltraOperator(p_stNode)) // bicose on teste plutot le retour de la fonction ultraable
p_stNode = NextNode(NextNode(p_stNode)); //p_stNode += 2;
switch (M_GetTypeInterpret(p_stNode))
{
case E_ti_DsgVarRef:
if (fn_bIsABooleanDsgVarRef(p_stNode))
return TRUE;
else
return FALSE;
break;
case E_ti_KeyWord:
if (szGetKeyWordTypeOutParamFromId(M_eKeyWordIdInterpret(p_stNode))[0] == 0) // USE_NO_PARAM
return FALSE;
else
return TRUE;
break;
case E_ti_Operator:
if (M_eOperatorIdInterpret(p_stNode) == eOperator_ModelCast)
return FALSE; // a la demande de JMD !
if (szGetOperatorTypeOutParamFromId(M_eOperatorIdInterpret(p_stNode))[0] == 0) // USE_NO_PARAM
return FALSE;
else
return TRUE;
break;
case E_ti_Function:
case E_ti_Condition:
case E_ti_Vector:
return TRUE;
break;
default:
return FALSE;
}
}
bool bToBeEvalued ( tdstNodeInterpret* p_stNode ) {
if (NextNode(p_stNode)->ucDepth > p_stNode->ucDepth) // at least one param (because next node has deeper depth)
return TRUE;
else
return FALSE;
}
bool bIsTheEndingNode( tdstNodeInterpret* p_stNode ) {
if (M_GetTypeInterpret(p_stNode) == E_ti_EndTree)
return TRUE;
return FALSE;
}
// special nodes
tdstNodeInterpret* p_stNode_TreatSpecialNodes(tdstNodeInterpret* p_stOriginalNode, BOOL* p_bSkipFirstParam, BOOL* p_bAffectWithGetVector) {
tdstNodeInterpret* p_stFirstParamNode;
tdstNodeInterpret* p_stFakeNode=NULL;
*p_bSkipFirstParam = FALSE;
*p_bAffectWithGetVector = FALSE;
//MAJ des compteurs
if (M_GetTypeInterpret(p_stOriginalNode) == E_ti_MetaAction)
g_uwNbMetaAction++;
else if ( (M_GetTypeInterpret(p_stOriginalNode) == E_ti_Procedure) && (M_eProcedureIdInterpret(p_stOriginalNode) == eProc_SetActionReturn) )
g_uwNbStopEngine++;
/* special nodes */
if (bIsAnIfKeyWord(p_stOriginalNode))
g_p_stIf2Node = p_stOriginalNode;
// ELSE
if (bIsTheElseKeyWord(p_stOriginalNode)) //eKeyWord_Else
CFast_FillOneNode(p_stOriginalNode, p_stOriginalNode, 0, 0, FALSE);
// ELSE or THEN
if (bIsTheElseKeyWord(p_stOriginalNode) || bIsTheThenKeyWord(p_stOriginalNode))
{
p_stFakeNode = (tdstNodeInterpret*)malloc ( sizeof(struct tdstNodeInterpret_) ) ;
memcpy(p_stFakeNode, p_stOriginalNode, sizeof(struct tdstNodeInterpret_) );
M_eKeyWordIdInterpret(p_stFakeNode) = eKeyWord_Endif; // because "Endif" is the end of an "If" (or an "Else")
}
// AFFECT with .X .Y or .Z
else if ( bIsAnAffectOperator(p_stOriginalNode) )
{
p_stFirstParamNode = NextNode(p_stOriginalNode); // the param to be changed
if ( bIsAGetVectorOperator(p_stFirstParamNode) )
{
if ( bIsTheAffectOperator(p_stOriginalNode) ) // for the real AFFECT operator (:=) it is better to change the node !
{
p_stFakeNode = (tdstNodeInterpret*)malloc ( sizeof(struct tdstNodeInterpret_) ) ;
memcpy(p_stFakeNode, p_stOriginalNode, sizeof(struct tdstNodeInterpret_) );
//M_SetTypeInterpret(p_stFakeNode, E_ti_Operator);
switch (M_eOperatorIdInterpret(p_stFirstParamNode))
{
case eOperator_GetVectorX:
M_eOperatorIdInterpret(p_stFakeNode) = eOperator_SetVectorX;
break;
case eOperator_GetVectorY:
M_eOperatorIdInterpret(p_stFakeNode) = eOperator_SetVectorY;
break;
case eOperator_GetVectorZ:
M_eOperatorIdInterpret(p_stFakeNode) = eOperator_SetVectorZ;
break;
}
*p_bSkipFirstParam = TRUE;
}
else
{
*p_bAffectWithGetVector = TRUE;
}
}
}
if (*p_bSkipFirstParam)
{
g_stFastTree.uwNbNode--;
#if defined (CFAST_DEBUG_FIRST_PASS)
g_lNbTotalDeNoeudToTest--;
#endif //defined (CFAST_DEBUG_FIRST_PASS)
}
if (p_stFakeNode!=NULL)
return p_stFakeNode;
else
return p_stOriginalNode;
}
// main fct (recursive)
void CFast_TreatOneDepthRecursively(tdstNodeInterpret* p_stOriginalNode, unsigned char _ucParamIndex, BOOL _bEvaluatingUltra, BOOL _bGetVectorVariableForAffect) ;
void CFast_TreatOneDepthRecursively(tdstNodeInterpret* p_stOriginalNode, unsigned char _ucParamIndex, BOOL _bEvaluatingUltra, BOOL _bGetVectorVariableForAffect) {
unsigned char ucNumberOfParamNeeded;
tdstNodeInterpret* p_stFakeOrOriginalNode;
tdstNodeInterpret* p_stCurrentParamNode;
tdstNodeInterpret* p_stParamNodeToTreat;
unsigned char ucIndexOfParam;
BOOL bStillOneParamToTreat;
BOOL bShiftNodeForFirstParam=FALSE;
BOOL bAffectWithGetVector=FALSE;
tdstNodeInterpret* p_stUltraNode=NULL; // != NULL if fct w/ Ultra
if ( (!_bEvaluatingUltra) && (bIsTheUltraOperator(p_stOriginalNode)) ) {
p_stUltraNode = p_stOriginalNode;
p_stOriginalNode = NextNode(NextNode(p_stOriginalNode));
}
p_stFakeOrOriginalNode = p_stNode_TreatSpecialNodes(p_stOriginalNode, &bShiftNodeForFirstParam, &bAffectWithGetVector);
ucNumberOfParamNeeded = 0;
//ucIndexOfParam = (_ucParamIndex==0)? 1:_ucParamIndex;
ucIndexOfParam = _ucParamIndex;
if (bToBeEvalued(p_stOriginalNode)) { // it has some params ?
p_stCurrentParamNode = NextNode(p_stOriginalNode) ; // the first param in the list
do {
ucNumberOfParamNeeded++;
if (bShiftNodeForFirstParam) {
p_stParamNodeToTreat = NextNode(p_stCurrentParamNode);
bShiftNodeForFirstParam = FALSE;
}
else
p_stParamNodeToTreat = p_stCurrentParamNode;
if ((!bAffectWithGetVector) && (bToBeMemorised(p_stParamNodeToTreat))) {
CFast_TreatOneDepthRecursively( p_stParamNodeToTreat, ucIndexOfParam+1, FALSE, FALSE);
ucIndexOfParam++;
}
else
CFast_TreatOneDepthRecursively( p_stParamNodeToTreat, 0, FALSE, bAffectWithGetVector);
bAffectWithGetVector = FALSE;
bStillOneParamToTreat = bGoToNextParam(&p_stCurrentParamNode);
} while ( (!_bEvaluatingUltra) && (bStillOneParamToTreat) );
}
if (p_stUltraNode) { // has ULTRA (we add the ULTRA as a new param of the fct)
ucNumberOfParamNeeded++;
CFast_TreatOneDepthRecursively( p_stUltraNode, ucIndexOfParam, TRUE, FALSE); // EvaluatingUltra
}
if ( _bEvaluatingUltra )
CFast_FillOneNode(p_stFakeOrOriginalNode, p_stOriginalNode, 0, ucNumberOfParamNeeded, FALSE);
else
CFast_FillOneNode(p_stFakeOrOriginalNode, p_stOriginalNode, _ucParamIndex, ucNumberOfParamNeeded, _bGetVectorVariableForAffect);
// desallocation <20>ventuelle :
if (p_stFakeOrOriginalNode != p_stOriginalNode)
free (p_stFakeOrOriginalNode);
}
CFast_tdstNode* CFast_FillTreeWithOneRule(CFast_tdstNode* p_stPseudoNode, tdstNodeInterpret* p_stOriginalNode) {
tdstNodeInterpret* p_stCurrentNode = p_stOriginalNode;
g_p_stPseudoNode = p_stPseudoNode;
BOOL bOk = TRUE;
while ( (!bIsTheEndingNode(p_stCurrentNode)) && bOk )
{
CFast_TreatOneDepthRecursively(p_stCurrentNode, bToBeMemorised(p_stCurrentNode)? 1:0, FALSE, FALSE);
bOk = bGoToNextParam(&p_stCurrentNode);
}
if (bIsTheEndingNode(p_stCurrentNode))
CFast_FillOneNode(p_stCurrentNode, p_stCurrentNode, 0 ,0, FALSE);
return (g_p_stPseudoNode);
}
void CFast_FirstPassFillTreeComport ( CFast_tdstComportTree* p_stFastTree, tdstComport* p_stComport ) {
unsigned char ucRulesCount;
tdstTreeInterpret* p_stCurrentRule;
CFast_tdstNode* p_stCurrentPseudoNode;
// init special nodes
g_uwNbMetaAction = 0;
g_uwNbStopEngine = 0;
p_stCurrentPseudoNode = p_stFastTree->p_stCFastNode;
if (p_stComport->p_stSchedule != NULL)
p_stCurrentPseudoNode = CFast_FillTreeWithOneRule(p_stCurrentPseudoNode, (p_stComport->p_stSchedule)->p_stNodeInterpret);
else {
for (ucRulesCount = 0, p_stCurrentRule = p_stComport->p_stRules ; ucRulesCount<p_stComport->ucNbRules ; ucRulesCount++, p_stCurrentRule++) {
#if defined (CFAST_DEBUG_FIRST_PASS)
if ( g_fdCru != NULL ) fprintf ( g_fdCru, "\n* Rule No %d *\n", ucRulesCount);
#endif //defined (CFAST_DEBUG_FIRST_PASS)
p_stCurrentPseudoNode = CFast_FillTreeWithOneRule(p_stCurrentPseudoNode, p_stCurrentRule->p_stNodeInterpret);
}
}
// report special nodes
p_stFastTree->uwNbMetaAction = g_uwNbMetaAction;
p_stFastTree->uwNbStopEngine = g_uwNbStopEngine;
}
void CFast_FirstPassFillTreeSubr ( CFast_tdstComportTree* p_stFastTree, tdstMacro* p_stMacro ) {
CFast_tdstNode* p_stCurrentPseudoNode;
// init special nodes
g_uwNbMetaAction = 0;
g_uwNbStopEngine = 0;
p_stCurrentPseudoNode = p_stFastTree->p_stCFastNode;
p_stCurrentPseudoNode = CFast_FillTreeWithOneRule(p_stCurrentPseudoNode, p_stMacro->p_stInitTree->p_stNodeInterpret ) ;
// report special nodes
p_stFastTree->uwNbMetaAction = g_uwNbMetaAction;
p_stFastTree->uwNbStopEngine = g_uwNbStopEngine;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,488 @@
// EdIRBELs.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRBELs.hpp"
#include "EdIRBeEn.hpp"
#include "EdIRBeha.hpp"
#include "EdIR2Eng.hpp"
#include "EdIRBis.hpp"
#include "EdIRDVLs.hpp"
#include "EdIRDvVw.hpp"
#include "EdIRFrm.hpp"
#include "EdIRIRD.hpp"
#include "EdIRStrg.hpp"
#include "ACP_Base.h"
#include "ITF.h"
#include "IncMEC.h"
#include "incAI.h"
// Shaitan => optimisation lists in the level
#include "TFA.h"
// End Shaitan => optimisation lists in the level
#include "_Actors.hpp"
#include "EDACModl.hpp"
/*#include "ai_intf.hpp"
#include "EDACInst.hpp"
#include "EDACDoc.hpp"*/
#include "x:\cpa\main\inc\_EditID.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_MainBehaviourList
//////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_MainBehaviourList::CPA_EdIR_MainBehaviourList()
{
m_pclOldActiveMainBehaviour =NULL;
m_bHasBeenModified =FALSE;
}
/****************************************************************************/
CPA_EdIR_MainBehaviourList::CPA_EdIR_MainBehaviourList(CPA_Actor *pclModel,CPA_EdIR_MainBehaviourList *p_clMainBehaviourList)
{
m_pclOldActiveMainBehaviour =p_clMainBehaviourList->m_pclOldActiveMainBehaviour;
m_bHasBeenModified =FALSE;
POSITION pos=p_clMainBehaviourList->GetHeadPosition();
while(pos!=NULL)
{
CPA_EdIR_MainBehaviour *pclMainBehaviour=p_clMainBehaviourList->GetNext(pos);
AddTail(new CPA_EdIR_MainBehaviour(pclModel,*(pclMainBehaviour)));
}
}
/****************************************************************************/
CPA_EdIR_MainBehaviourList::~CPA_EdIR_MainBehaviourList()
{
}
/****************************************************************************/
void CPA_EdIR_MainBehaviourList::m_fn_vDeleteAllMainBehaviours()
{
POSITION pos=GetHeadPosition();
while(pos!=NULL)
delete GetNext(pos);
}
/****************************************************************************/
long CPA_EdIR_MainBehaviourList::m_fn_lGetNbPages(long lLineHeight,
long lPageHeight,
BOOL bOneBehaviourOnAPage)
{
long lNbPages=0;
if(bOneBehaviourOnAPage)
{
POSITION pos=GetHeadPosition();
while(pos!=NULL)
{
CPA_EdIR_MainBehaviour *pclMainBehaviour=GetNext(pos);
//Gets nb pages for this behaviour and adds to the total nb pages
lNbPages+=pclMainBehaviour->m_fn_lGetNbPages(lLineHeight,lPageHeight);
}
}
else
{
//Computes nb lines required for printing all behaviours
POSITION pos=GetHeadPosition();
long lNbLines=0;
while(pos!=NULL)
{
CPA_EdIR_MainBehaviour *pclMainBehaviour=GetNext(pos);
lNbLines+=pclMainBehaviour->m_fn_lGetNbLines();
}
//Computes nb pages for printing lNbLines
long lNbLinesInAPage=lPageHeight/lLineHeight;
while(lNbLines>=0)
{
lNbLines-=lNbLinesInAPage;
lNbPages++;
}
}
return lNbPages;
}
/****************************************************************************/
void CPA_EdIR_MainBehaviourList::m_fn_vPrint(long lLineHeight,
long lPageHeight,
BOOL bOneBehaviourOnAPage,
long lCurrentPage,
CDC *pDC,CPrintInfo *pInfo)
{
if(bOneBehaviourOnAPage)
{
POSITION pos=GetHeadPosition();
long lCurStartPage=0;
long lCurEndPage=0;
BOOL bEnd=FALSE;
while(pos!=NULL && !bEnd)
{
CPA_EdIR_MainBehaviour *pclMainBehaviour=GetNext(pos);
lCurEndPage=lCurStartPage+pclMainBehaviour->m_fn_lGetNbPages(lLineHeight,lPageHeight);
//Checks if this behaviour must be printed on this page
if(lCurrentPage>=lCurStartPage &&
lCurrentPage<=lCurEndPage)
{
//Prints this behaviour
//Substracts 5 mm to increase printer's margins
long lDPI=pDC->GetDeviceCaps(LOGPIXELSY);
long lFiveMmInDPI=long(double(5*lDPI)/25.4);
CString csText=pclMainBehaviour->m_fn_csGetTextToPrint(lLineHeight,pDC->GetDeviceCaps(VERTRES)-lFiveMmInDPI,lCurrentPage-lCurStartPage);
pDC->DrawText(csText,pInfo->m_rectDraw,DT_LEFT);
bEnd=TRUE;
}
lCurStartPage=lCurEndPage;
}
}
else
{
//Computes start line number and end line number for the current page (lCurrentPage)
long lNbLinesInAPage=lPageHeight/lLineHeight;
long lStartLineNumber=(lCurrentPage-1)*lNbLinesInAPage;
long lEndLineNumber=lStartLineNumber+lNbLinesInAPage-1;
POSITION pos=GetHeadPosition();
long lCurStartLine=0;
long lCurEndLine=0;
while(pos!=NULL)
{
CPA_EdIR_MainBehaviour *pclMainBehaviour=GetNext(pos);
lCurEndLine=lCurStartLine+pclMainBehaviour->m_fn_lGetNbLines();
//Checks if this behaviour must be printed on this page
long lCurStartPrintLine=lCurStartLine;
long lCurEndPrintLine=lCurEndLine;
if(lCurStartLine<=lStartLineNumber &&
lCurEndLine>=lStartLineNumber)
lCurStartPrintLine=lStartLineNumber;
if(lCurEndLine>=lEndLineNumber &&
lCurStartLine<=lEndLineNumber)
lCurEndPrintLine=lEndLineNumber;
if(lCurStartPrintLine>=lStartLineNumber &&
lCurEndPrintLine<=lEndLineNumber)
{
//Prints this behaviour
CString csText;
csText=pclMainBehaviour->m_fn_csGetTextBetweenLines(lCurStartPrintLine-lCurStartLine,
lCurEndPrintLine-lCurStartLine);
//Computes printable rect
CRect crRect(0,0,pDC->GetDeviceCaps(HORZRES),0);
crRect.top=(lCurStartPrintLine-lStartLineNumber)*lLineHeight;
crRect.bottom=(lCurEndPrintLine-lStartLineNumber+1)*lLineHeight;
pDC->DrawText(csText,crRect,DT_LEFT);
}
lCurStartLine=lCurEndLine;
}
}
}
/****************************************************************************/
BOOL CPA_EdIR_MainBehaviourList::m_fn_bIsInList(CString csBehaviourName)
{
POSITION pos=GetHeadPosition();
BOOL bFound=FALSE;
while(pos!=NULL && !bFound)
{
bFound=(GetNext(pos)->GetName().CompareNoCase(csBehaviourName)==0);
}
return bFound;
}
/****************************************************************************/
long CPA_EdIR_MainBehaviourList::m_fn_lGetIndexOfABehaviour(CString csBehaviourName)
{
POSITION pos=GetHeadPosition();
long lIndex=0;
BOOL bFound=FALSE;
while(pos!=NULL && !bFound)
{
bFound=(GetNext(pos)->GetName().CompareNoCase(csBehaviourName)==0);
lIndex++;
}
return lIndex-1;
}
/****************************************************************************/
CPA_EdIR_MainBehaviour *CPA_EdIR_MainBehaviourList::m_fn_pclGetMainBehaviour(CString csBehaviourName)
{
POSITION pos=GetHeadPosition();
CPA_EdIR_MainBehaviour *pclMainBehaviour=NULL;
while(pos!=NULL && pclMainBehaviour==NULL)
{
if(GetAt(pos)->GetName().CompareNoCase(csBehaviourName)==0)
pclMainBehaviour=GetAt(pos);
GetNext(pos);
}
return pclMainBehaviour;
}
/****************************************************************************/
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CPA_EdIR_MainBehaviourList::m_fn_csGetRules
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
CString CPA_EdIR_MainBehaviourList::m_fn_csGetRules(CString csBehaviourName)
{
CPA_EdIR_MainBehaviour *pclMainBehaviour = m_fn_pclGetMainBehaviour (csBehaviourName);
return pclMainBehaviour -> m_pclBehaviour -> m_fn_csGetRules ();
}
/****************************************************************************/
BOOL CPA_EdIR_MainBehaviourList::m_fn_bCheckIA(tdeTypeText eTypeText, BOOL ForProcess)
{
POSITION pos=GetHeadPosition();
BOOL bNoError=TRUE;
while(pos!=NULL && bNoError)
{
CPA_EdIR_MainBehaviour *pclMainBehaviour=GetNext(pos);
CPA_EdIR_Behaviour *pclBehaviour=pclMainBehaviour->m_pclBehaviour;
bNoError= (pclBehaviour ? pclBehaviour->m_fn_bCheckIA(eTypeText) : TRUE);
}
return bNoError;
}
/****************************************************************************/
BOOL CPA_EdIR_MainBehaviourList::m_fn_bProcessIA(BOOL bProcessAll,BOOL bCreateControl,
AI_tdstMind *pstMind,tdstComport *pstComport,
tdeTypeText eTypeText,CPA_EdIR_DebugInfoList *pclDebugInfoList)
{
POSITION pos=GetHeadPosition();
BOOL bNoError=TRUE;
long lCurrentBehaviour=0;
if(eTypeText == CRRGeneration)
{
while(pos!=NULL)
{
CPA_EdIR_MainBehaviour *pclMainBehaviour=GetNext(pos);
CPA_EdIR_Behaviour *pclBehaviour=pclMainBehaviour->m_pclBehaviour;
pclBehaviour->m_fn_bProcessIA(TRUE,FALSE,NULL,NULL,NULL,CRRGeneration, pclDebugInfoList);
}
}
//BEGIN ROMTEAM Cristi Petrescu 98-04-
struct tdstMacro_ *pstSubr;
if (eTypeText == SubrText)
{
pstSubr = ((tdstListOfMacro *) pstComport) -> p_stMacro;
}
//END ROMTEAM Cristi Petrescu 98-04-
while(pos!=NULL && bNoError)
{
CPA_EdIR_MainBehaviour *pclMainBehaviour=GetNext(pos);
// Shaitan => optimisation lists in the level
CList<CPA_BaseObject *,CPA_BaseObject *> clListOfOldDependencies;
clListOfOldDependencies.RemoveAll();
BOOL bMustCheckDependancies = pclMainBehaviour->m_fn_bHasBeenModified();
// End Shaitan => optimisation lists in the level
//Remove old dependences
POSITION p=pclMainBehaviour->m_clListOfDependencies.GetHeadPosition();
while(p!=NULL)
{
CPA_BaseObject *pclChild=pclMainBehaviour->m_clListOfDependencies.GetNext(p);
g_oCoherenceManager.m_fn_vRemoveALink(pclMainBehaviour,pclChild);
// Shaitan => optimisation lists in the level
clListOfOldDependencies.AddTail(pclChild);
// End Shaitan => optimisation lists in the level
}
pclMainBehaviour->m_clListOfDependencies.RemoveAll();
//BEGIN ROMTEAM Cristi Petrescu 98-05-
CPA_EdIR_DebugInfoList *pclGlobalDebugInfoList = pclDebugInfoList;
pclDebugInfoList = & pclMainBehaviour -> m_clDebugInfoList;
// do not destroy because this is just a duplicate list.
// destroyng is done for the whole Brain list
pclDebugInfoList -> RemoveAll ();
//END ROMTEAM Cristi Petrescu 98-05-
//Applies IA
CPA_EdIR_Behaviour *pclBehaviour=pclMainBehaviour->m_pclBehaviour;
//BEGIN ROMTEAM Cristi Petrescu 98-04-
if (eTypeText == SubrText)
{
CPA_Actor *pclModel=(CPA_Actor *)pclMainBehaviour->GetOwner();
CString csFamilyName=pclModel->m_fn_csGetFamilyName();
CString csModelName=pclModel->GetName();
CString csBehaviourName=pclMainBehaviour->GetName();
CString csBehaviourRefName=csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIRulFileExtension+"^"+
g_c_csRulSectionName+"^"+g_c_csBehavSectionName+":"+csBehaviourName;
strcpy(M_GetNameMacro(pstSubr),M_MAKECHAR(csBehaviourRefName));
// perhaps some debug integration here... do it later.
bNoError=pclBehaviour->m_fn_bProcessIA(bProcessAll,bCreateControl,pstMind,pstComport,(tdstTreeInterpret *) pstSubr,eTypeText,pclDebugInfoList);
pstSubr ++;
}
else if(!pclBehaviour->m_bDeclaration && eTypeText != Macro_2_Text)
//END ROMTEAM Cristi Petrescu 98-04-
{
long lNbRules=fn_lGetNbRules(pclBehaviour->m_fn_csGetRules());
tdstTreeInterpret *pstRule;
pstRule=fn_p_stAllocRule((unsigned char)lNbRules);
M_GetComportRules(pstComport)=pstRule;
M_GetComportNbRules(pstComport)=(unsigned char)lNbRules;
//Sets behaviour name (debug information for engine)
CPA_Actor *pclModel=(CPA_Actor *)pclMainBehaviour->GetOwner();
CString csFamilyName=pclModel->m_fn_csGetFamilyName();
CString csModelName=pclModel->GetName();
CString csBehaviourName=pclMainBehaviour->GetName();
CString csBehaviourRefName=csFamilyName+"\\"+csModelName+"\\"+csModelName+g_c_csAIRulFileExtension+"^"+
g_c_csRulSectionName+"^"+g_c_csBehavSectionName+":"+csBehaviourName;
strcpy(M_GetNameComport(pstComport),M_MAKECHAR(csBehaviourRefName));
bNoError=pclBehaviour->m_fn_bProcessIA(bProcessAll,bCreateControl,pstMind,pstComport,pstRule,eTypeText,pclDebugInfoList);
pstComport++;
}
else
{
bNoError=pclBehaviour->m_fn_bProcessIA(bProcessAll,bCreateControl,pstMind,NULL,NULL,eTypeText,pclDebugInfoList);
}
//BEGIN ROMTEAM Cristi Petrescu 98-05-
//Update the global debug list
POSITION pos = pclDebugInfoList -> GetHeadPosition ();
CPA_EdIR_DebugInfo *pclDebugInfo;
while (pos)
{
pclDebugInfo = pclDebugInfoList -> GetNext (pos);
pclGlobalDebugInfoList -> AddTail (pclDebugInfo);
}
pclDebugInfoList = pclGlobalDebugInfoList;
//END ROMTEAM Cristi Petrescu 98-05-
// Shaitan => optimisation lists in the level
if (bMustCheckDependancies)
{
// first check if there are new dependancies in the behaviour
POSITION pos1 = pclMainBehaviour->m_clListOfDependencies.GetHeadPosition();
while (pos1)
{
CPA_BaseObject *pclChild = pclMainBehaviour->m_clListOfDependencies.GetNext(pos1);
if (pclChild->GetType() == C_szActionTypeName)
{
if (!clListOfOldDependencies.Find(pclChild))
((CPA_Family *) pclChild->GetOwner())->mfn_vSetModifiedStateList();
}
else if (pclChild->GetType() == C_szObjectTableTypeName)
{
if (!clListOfOldDependencies.Find(pclChild))
((CPA_Family *) pclChild->GetOwner())->mfn_vSetModifiedPOList();
}
}
// then check if the old dependancies are still valid
pos1 = clListOfOldDependencies.GetHeadPosition();
while (pos1)
{
CPA_BaseObject *pclChild = clListOfOldDependencies.GetNext(pos1);
if (pclChild->GetType() == C_szActionTypeName)
{
if (!pclMainBehaviour->m_clListOfDependencies.Find(pclChild))
((CPA_Family *) pclChild->GetOwner())->mfn_vSetModifiedStateList();
}
else if (pclChild->GetType() == C_szObjectTableTypeName)
{
if (!pclMainBehaviour->m_clListOfDependencies.Find(pclChild))
((CPA_Family *) pclChild->GetOwner())->mfn_vSetModifiedPOList();
}
}
}
// End Shaitan => optimisation lists in the level
lCurrentBehaviour++;
}
if (bCreateControl)
{
// update control list
CPA_DLLBase *pclActorDLL =(CPA_DLLBase*)(g_pclAIInterface->GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName));
CPA_EdIR_DesignerVariablesView *pclDsgVarView =(CPA_EdIR_DesignerVariablesView *)pclActorDLL->OnQueryAction(g_pclAIInterface,C_uiActor_GetDesignerVariablesView,0);
CPA_EdIR_Frame *pclIRMainFrame =g_pclAIInterface->m_pclIRMainFrame;
CPA_Actor *pclModel =pclIRMainFrame->m_fn_pclGetModel();
CTL_Editor_ControlList *pclListOfDesignerVariableControl =&(((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_clListOfDesignerVariableControl);
pclDsgVarView->m_fn_vUpdateControls(pclListOfDesignerVariableControl);
}
return bNoError;
}
/****************************************************************************/
BOOL CPA_EdIR_MainBehaviourList::m_fn_bHasBeenModified()
{
POSITION pos=GetHeadPosition();
BOOL bHasBeenModified=FALSE;
while(pos!=NULL && !bHasBeenModified)
bHasBeenModified=bHasBeenModified || GetNext(pos)->m_fn_bHasBeenModified();
return (m_bHasBeenModified||bHasBeenModified);
}
/****************************************************************************/
void CPA_EdIR_MainBehaviourList::m_fn_vSetModified(BOOL bIsModified)
{
POSITION pos=GetHeadPosition();
while(pos!=NULL)
GetNext(pos)->m_fn_vSetModified(bIsModified);
m_bHasBeenModified=bIsModified;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,178 @@
// EdIRBLB.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRBLB.hpp"
#include "EdIRBVw.hpp"
#include "EdIRBtVw.hpp"
#include "EdIRFrm.hpp"
#include "EdIRBeha.hpp"
#include "EdIRIRD.hpp"
#include "EdIRBeEn.hpp"
#include "incTUT.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CBehaviourListBox
/////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CPA_EdIR_BehaviourListBox, CListBox)
//{{AFX_MSG_MAP(CPA_EdIR_BehaviourListBox)
ON_WM_KEYUP()
ON_WM_RBUTTONUP()
ON_WM_KEYDOWN()
//}}AFX_MSG_MAP
ON_COMMAND(ID_IR_BEHAVIOURLIST_DELETE_BEHAVIOUR,m_fn_vOnDeleteBehaviour)
ON_COMMAND(ID_IR_BEHAVIOURLIST_RENAME_BEHAVIOUR,m_fn_vOnRenameBehaviour)
ON_COMMAND(ID_IR_BEHAVIOURLIST_ADD_BEHAVIOUR,m_fn_vOnAddBehaviour)
ON_COMMAND(ID_IR_BEHAVIOURLIST_DEL_ALL_BEHAVIOUR,m_fn_vOnDeleteAllBehaviours)
END_MESSAGE_MAP()
/**********************************************************************************/
CPA_EdIR_BehaviourListBox::CPA_EdIR_BehaviourListBox()
{
}
/**********************************************************************************/
CPA_EdIR_BehaviourListBox::~CPA_EdIR_BehaviourListBox()
{
}
/////////////////////////////////////////////////////////////////////////////
// CBehaviourListBox message handlers
/**********************************************************************************/
void CPA_EdIR_BehaviourListBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
((CPA_EdIR_DiagView *)GetParent())->OnKeyDown(nChar, nRepCnt, nFlags);
CListBox::OnKeyDown(nChar, nRepCnt, nFlags);
}
/**********************************************************************************/
void CPA_EdIR_BehaviourListBox::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
((CPA_EdIR_DiagView *)GetParent())->OnKeyUp(nChar, nRepCnt, nFlags);
CListBox::OnKeyUp(nChar, nRepCnt, nFlags);
}
/**********************************************************************************/
void CPA_EdIR_BehaviourListBox::OnRButtonUp(UINT nFlags, CPoint point)
{
CPA_EdIR_ButtonView *p_clBtView=((CPA_EdIR_Frame *)GetParentFrame())->m_fn_pclGetButtonView();
if(p_clBtView->m_fn_tdeGetEditState()!=EditDecl)
{
CPA_EdIR_Behaviour *pclBehaviour=NULL;
//Selects behaviour under the mouse
if(GetCount()!=0)
{
BOOL bOutside;
long lSelectedIndex=ItemFromPoint(point,bOutside);
SetCurSel(lSelectedIndex);
pclBehaviour=(CPA_EdIR_Behaviour *)GetItemDataPtr(lSelectedIndex);
}
//Displays context menu
CMenu Menu;
Menu.LoadMenu(IDR_IR_MENU_POPUP_DIAGVIEW);
CMenu *SousMenu=Menu.GetSubMenu(2);
if(pclBehaviour==NULL || !pclBehaviour->m_clListOfDependentBehaviours.IsEmpty())
{
SousMenu->EnableMenuItem(ID_IR_BEHAVIOURLIST_RENAME_BEHAVIOUR,MF_GRAYED|MF_BYCOMMAND);
SousMenu->EnableMenuItem(ID_IR_BEHAVIOURLIST_DELETE_BEHAVIOUR,MF_GRAYED|MF_BYCOMMAND);
SousMenu->EnableMenuItem(ID_IR_BEHAVIOURLIST_DEL_ALL_BEHAVIOUR,MF_GRAYED|MF_BYCOMMAND);
}
CRect cr;
GetWindowRect(cr);
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterMenu(m_hWnd,SousMenu->m_hMenu,cr.left+point.x,cr.top+point.y);
//End of Register for TUT Module
//////////////
SousMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,cr.left+point.x,cr.top+point.y,this);
SousMenu->DestroyMenu();
Menu.DestroyMenu();
}
}
/****************************************************************************/
int CPA_EdIR_BehaviourListBox::SetCurSel(int nSelect,BOOL bDeselect)
{
if(bDeselect)
{
//Unselect old selected items
LPINT piIndex=new int[GetCount()];
int iNbItems=GetSelItems(GetCount(),piIndex);
for(int iIndex=0;iIndex<iNbItems;iIndex++)
{
SetSel(piIndex[iIndex],FALSE);
}
}
//Select the good item
return SetSel(nSelect);
}
/****************************************************************************/
int CPA_EdIR_BehaviourListBox::GetCurSel() const
{
//Returns the first selected item
LPINT piIndex=new int[GetCount()];
GetSelItems(GetCount(),piIndex);
return piIndex[0];
}
/****************************************************************************/
void CPA_EdIR_BehaviourListBox::m_fn_vOnDeleteBehaviour()
{
((CPA_EdIR_DiagView *)GetParent())->m_fn_vDeleteBehaviour((CPA_EdIR_Behaviour *)GetItemDataPtr(GetCurSel()));
}
/****************************************************************************/
void CPA_EdIR_BehaviourListBox::m_fn_vOnRenameBehaviour()
{
//Changes behaviour name
long lSelectedIndex=GetCurSel();
CPA_EdIR_Behaviour *pclBehaviour=(CPA_EdIR_Behaviour *)GetItemDataPtr(lSelectedIndex);
pclBehaviour->m_fn_vRenameBehaviour();
}
/****************************************************************************/
void CPA_EdIR_BehaviourListBox::m_fn_vOnAddBehaviour()
{
((CPA_EdIR_DiagView *)GetParent())->m_fn_vCreateNewBehaviour(ListView);
}
/****************************************************************************/
void CPA_EdIR_BehaviourListBox::m_fn_vOnDeleteAllBehaviours()
{
((CPA_EdIR_DiagView *)GetParent())->m_fn_vDeleteAllBehaviours();
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,133 @@
// EdIRBNam.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRRes.h"
#include "EdIRBNam.hpp"
#include "ai_intf.hpp"
#include "incTUT.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CDlgNewBehaviourName
/////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CPA_EdIR_DlgNewBehaviourName, CDialog)
//{{AFX_MSG_MAP(CPA_EdIR_DlgNewBehaviourName)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/**********************************************************************************/
CPA_EdIR_DlgNewBehaviourName::CPA_EdIR_DlgNewBehaviourName(CString csNewName,CWnd* pParent)
: CDialog(CPA_EdIR_DlgNewBehaviourName::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(CPA_EdIR_DlgNewBehaviourName)
m_csNewName = csNewName;
//}}AFX_DATA_INIT
m_hOldInstance=AfxGetResourceHandle();
AfxSetResourceHandle(g_stAIIdentity.hModule);
}
/**********************************************************************************/
CPA_EdIR_DlgNewBehaviourName::~CPA_EdIR_DlgNewBehaviourName()
{
AfxSetResourceHandle(m_hOldInstance);
}
/**********************************************************************************/
void CPA_EdIR_DlgNewBehaviourName::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPA_EdIR_DlgNewBehaviourName)
DDX_Text(pDX, IDC_EDIT_BEHAVIOUR_NAME, m_csNewName);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_DlgNewBehaviourName message handlers
/////////////////////////////////////////////////////////////////////////////
/**********************************************************************************/
BOOL CPA_EdIR_DlgNewBehaviourName::OnInitDialog()
{
CDialog::OnInitDialog();
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControl(m_hWnd,"EdIR_GetBehaviourName_Window",TUT_e_Window);
TUT_M_vRegisterControlID(IDC_EDIT_BEHAVIOUR_NAME,"EdIR_GetBehaviourName_Name",TUT_e_TextEdit);
TUT_M_vRegisterControlID(IDOK,"EdIR_GetBehaviourName_IDOK",TUT_e_Button);
//End of Register for TUT Module
//////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
/**********************************************************************************/
void CPA_EdIR_DlgNewBehaviourName::OnDestroy()
{
//////////////
//////////////
//UnRegisters for TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControl(m_hWnd);
TUT_M_vUnregisterControlID(IDC_EDIT_BEHAVIOUR_NAME);
TUT_M_vUnregisterControlID(IDOK);
//End of UnRegister for TUT Module
//////////////
CDialog::OnDestroy();
}
/**********************************************************************************/
BOOL CPA_EdIR_DlgNewBehaviourName::m_fn_bCheckName(CString csName)
{
BOOL bNameIsGood=!(m_csNewName.IsEmpty());
for(int i=0;i<csName.GetLength() && bNameIsGood;i++)
bNameIsGood=(
(csName[i]>='0' && csName[i]<='9')
||
(csName[i]>='A' && csName[i]<='Z')
||
(csName[i]>='a' && csName[i]<='z')
||
(csName[i]=='_')
);
return bNameIsGood;
}
/**********************************************************************************/
void CPA_EdIR_DlgNewBehaviourName::OnOK()
{
GetDlgItem(IDC_EDIT_BEHAVIOUR_NAME)->GetWindowText(m_csNewName);
if(m_fn_bCheckName(m_csNewName))
CDialog::OnOK();
else
CDialog::OnCancel();
}
#endif //D_ED_IR_ACTIVE

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,60 @@
// EdIRBVwA.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRBVwA.hpp"
#include "EdIRBVw.hpp"
#include "EdIRBeEn.hpp"
#include "EdIRBELs.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_UndoCreateBehaviour
/////////////////////////////////////////////////////////////////////////////
/**********************************************************************************/
CPA_EdIR_UndoCreateBehaviour::CPA_EdIR_UndoCreateBehaviour(CPA_EdIR_DiagView *pclDiagView,
CPA_EdIR_MainBehaviour *pclMainBehaviour,
CPA_EdIR_MainBehaviourList *pclMainBehaviourList,
BOOL bBlock)
:CPA_Modif(1,"Create Behaviour",bBlock)
{
m_pclDiagView =pclDiagView;
m_pclMainBehaviour =pclMainBehaviour;
m_pclMainBehaviourList=pclMainBehaviourList;
}
/**********************************************************************************/
CPA_EdIR_UndoCreateBehaviour::~CPA_EdIR_UndoCreateBehaviour()
{
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoCreateBehaviour::Do()
{
m_pclDiagView->m_fn_vAddOneBehaviourInList(m_pclMainBehaviour);
m_pclMainBehaviourList->m_fn_vSetModified(TRUE);
return TRUE;
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoCreateBehaviour::Undo()
{
m_pclMainBehaviourList->m_fn_vSetModified(TRUE);
return m_pclDiagView->m_fn_bDeleteBehaviourFromList(m_pclMainBehaviour);
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,62 @@
// EdIRBVwX.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRBVwD.hpp"
#include "EdIRBVw.hpp"
#include "EdIRBeEn.hpp"
#include "EdIRBELs.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_UndoDeleteBehaviour
/////////////////////////////////////////////////////////////////////////////
/**********************************************************************************/
CPA_EdIR_UndoDeleteBehaviour::CPA_EdIR_UndoDeleteBehaviour(CPA_EdIR_DiagView *pclDiagView,
CPA_EdIR_MainBehaviour *pclMainBehaviour,
CPA_EdIR_MainBehaviourList *pclMainBehaviourList,
BOOL bBlock)
:CPA_Modif(2,"Delete Behaviour",bBlock)
{
m_pclDiagView=pclDiagView;
m_pclMainBehaviour=pclMainBehaviour;
m_pclMainBehaviourList=pclMainBehaviourList;
}
/**********************************************************************************/
CPA_EdIR_UndoDeleteBehaviour::~CPA_EdIR_UndoDeleteBehaviour()
{
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoDeleteBehaviour::Do()
{
BOOL bDeleted = m_pclDiagView->m_fn_bDeleteBehaviourFromList(m_pclMainBehaviour);
m_pclMainBehaviourList->m_fn_vSetModified(bDeleted);
return bDeleted;
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoDeleteBehaviour::Undo()
{
m_pclDiagView->m_fn_vAddOneBehaviourInList(m_pclMainBehaviour);
m_pclMainBehaviourList->m_fn_vSetModified(TRUE);
return TRUE;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,63 @@
// EdIRBVwR.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRBVwR.hpp"
#include "EdIRBVw.hpp"
#include "EdIRBeEn.hpp"
#include "EdIRBELs.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_UndoRenameBehaviour
/////////////////////////////////////////////////////////////////////////////
/**********************************************************************************/
CPA_EdIR_UndoRenameBehaviour::CPA_EdIR_UndoRenameBehaviour(CPA_EdIR_DiagView *pclDiagView,
CPA_EdIR_MainBehaviour *pclMainBehaviour,
CPA_EdIR_MainBehaviourList *pclMainBehaviourList,
CString csOldName,
CString csNewName,
BOOL bBlock)
:CPA_Modif(1,"Rename Behaviour",bBlock)
{
m_pclDiagView=pclDiagView;
m_pclMainBehaviour=pclMainBehaviour;
m_pclMainBehaviourList=pclMainBehaviourList;
m_csOldName=csOldName;
m_csNewName=csNewName;
}
/**********************************************************************************/
CPA_EdIR_UndoRenameBehaviour::~CPA_EdIR_UndoRenameBehaviour()
{
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoRenameBehaviour::Do()
{
m_pclMainBehaviourList->m_fn_vSetModified(TRUE);
return m_pclDiagView->m_fn_bRenameBehaviour(m_pclMainBehaviour,m_csNewName);
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoRenameBehaviour::Undo()
{
m_pclMainBehaviourList->m_fn_vSetModified(TRUE);
return m_pclDiagView->m_fn_bRenameBehaviour(m_pclMainBehaviour,m_csOldName);
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,65 @@
// EdIRBVwD.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRBVwX.hpp"
#include "EdIRBVw.hpp"
#include "EdIRBeEn.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_UndoDeleteAllBehaviours
/////////////////////////////////////////////////////////////////////////////
/**********************************************************************************/
CPA_EdIR_UndoDeleteAllBehaviours::CPA_EdIR_UndoDeleteAllBehaviours(CPA_EdIR_DiagView *pclDiagView,
CPA_EdIR_MainBehaviourList *pclMainBehaviourList,
BOOL bBlock)
:CPA_Modif(3,"Delete All Behaviours",bBlock)
{
m_pclDiagView=pclDiagView;
m_pclMainBehaviourList=pclMainBehaviourList;
POSITION pos=pclMainBehaviourList->GetHeadPosition();
while(pos!=NULL)
{
CPA_EdIR_MainBehaviour *pclMainBehaviour=pclMainBehaviourList->GetNext(pos);
m_clMainBehaviourList.AddTail(pclMainBehaviour);
}
}
/**********************************************************************************/
CPA_EdIR_UndoDeleteAllBehaviours::~CPA_EdIR_UndoDeleteAllBehaviours()
{
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoDeleteAllBehaviours::Do()
{
m_pclMainBehaviourList->m_fn_vSetModified(TRUE);
return m_pclDiagView->m_fn_bDeleteAllBehavioursFromList();
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoDeleteAllBehaviours::Undo()
{
m_pclDiagView->m_fn_vAddAllBehavioursInList(&m_clMainBehaviourList);
m_pclMainBehaviourList->m_fn_vSetModified(TRUE);
return TRUE;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,303 @@
// EdIRBeEn.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRBeEn.hpp"
#include "EdIRBvw.hpp"
#include "EdIRBeha.hpp"
#include "EdIRFrm.hpp"
#include "EdIRIRD.hpp"
#include "EdIRStrg.hpp"
#include "x:\cpa\main\inc\_EditID.h"
#include "ai_intf.hpp" //for g_pclAIInterface
#define C_BEHAVIOUR_TITLE_LINE "/************************************************************/\n"
#define C_BEHAVIOUR_TITLE_TEMPLATE "/* */\n"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_MainBehaviour
//////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_MainBehaviour::CPA_EdIR_MainBehaviour(CPA_Actor *pclActor)
:CPA_BaseObject(g_pclAIInterface,C_szIABehaviourTypeName,(CPA_BaseObject *)pclActor)
{
//m_csName ="";
m_crPosition =CRect(0,0,0,0);
m_csText ="";
m_pclBehaviour =NULL;
m_bHasBeenModified =FALSE;
//BEGIN ROMTEAM Cristi Petrescu 98-05-
m_clDebugInfoList . RemoveAll ();
//END ROMTEAM Cristi Petrescu 98-05-
}
/****************************************************************************/
CPA_EdIR_MainBehaviour::CPA_EdIR_MainBehaviour(CPA_Actor *pclActor,CString csName,CRect crPosition,CString csText,CPA_EdIR_Behaviour *pclBehaviour)
:CPA_BaseObject(g_pclAIInterface,C_szIABehaviourTypeName,(CPA_BaseObject *)pclActor)
{
//m_csName=csName;
if(fn_eRename(csName)!=E_mc_None)
SetDefaultUniqueName();
m_crPosition=crPosition;
m_csText=csText;
m_pclBehaviour=pclBehaviour;
//BEGIN ROMTEAM Cristi Petrescu 98-05-
m_clDebugInfoList .RemoveAll ();
//END ROMTEAM Cristi Petrescu 98-05-
}
/****************************************************************************/
CPA_EdIR_MainBehaviour::CPA_EdIR_MainBehaviour(CPA_Actor *pclActor,CPA_EdIR_MainBehaviour &clMainBehaviour)
:CPA_BaseObject(g_pclAIInterface,C_szIABehaviourTypeName,(CPA_BaseObject *)pclActor)
{
if(clMainBehaviour.m_pclBehaviour!=NULL)
{
//In order to skip prefix checking
BOOL bIsLoadingWorld=g_pclAIInterface->GetInterface()->fn_bIsLoadingWorld();
g_pclAIInterface->GetInterface()->SetLoadingWorld(TRUE);
//m_csName=clMainBehaviour.m_pclBehaviour->m_fn_csGetName();
if(fn_eRename(clMainBehaviour.m_pclBehaviour->m_fn_csGetName())!=E_mc_None)
SetDefaultUniqueName();
g_pclAIInterface->GetInterface()->SetLoadingWorld(bIsLoadingWorld);
m_crPosition=clMainBehaviour.m_pclBehaviour->m_fn_crGetBoundingBox();
m_csText=clMainBehaviour.m_pclBehaviour->m_fn_csGetRules();
m_pclBehaviour=NULL;
}
else
{
//In order to skip prefix checking
BOOL bIsLoadingWorld=g_pclAIInterface->GetInterface()->fn_bIsLoadingWorld();
g_pclAIInterface->GetInterface()->SetLoadingWorld(TRUE);
if(fn_eRename(clMainBehaviour.GetName())!=E_mc_None)
SetDefaultUniqueName();
g_pclAIInterface->GetInterface()->SetLoadingWorld(bIsLoadingWorld);
m_crPosition=clMainBehaviour.m_crPosition;
m_csText=clMainBehaviour.m_csText;
m_pclBehaviour=NULL;
}
//BEGIN ROMTEAM Cristi Petrescu 98-05-
m_clDebugInfoList . RemoveAll ();
//END ROMTEAM Cristi Petrescu 98-05-
}
/****************************************************************************/
CPA_EdIR_MainBehaviour::~CPA_EdIR_MainBehaviour()
{
delete m_pclBehaviour;
//BEGIN ROMTEAM Cristi Petrescu 98-05-
m_clDebugInfoList . RemoveAll ();
//END ROMTEAM Cristi Petrescu 98-05-
}
/****************************************************************************/
long CPA_EdIR_MainBehaviour::GetDataType(void)
{
return 0;
}
/****************************************************************************/
void *CPA_EdIR_MainBehaviour::GetData(void)
{
return NULL;
}
/****************************************************************************/
tdeMissingCriteria CPA_EdIR_MainBehaviour::fn_eCheckUnicity(const CString csName)
{
if(csName==g_c_csDsgVarName ||
csName==g_c_csMacroName)
{
return E_mc_None;
}
else
{
return fn_eCheckUnicityWithOwner(csName);
}
}
/****************************************************************************/
void CPA_EdIR_MainBehaviour::m_fn_vUpdateBehaviour(CPA_EdIR_DiagView *pclDiagView,BOOL bDeclarationMode)
{
if(m_pclBehaviour==NULL)
{
m_pclBehaviour=pclDiagView->m_fn_pclAddOneBehaviour(GetName(),m_crPosition,m_csText,bDeclarationMode,0);
m_pclBehaviour->m_fn_vSetMainBehaviour(this);
}
}
/****************************************************************************/
CString CPA_EdIR_MainBehaviour::m_fn_csGetBehaviourTitle()
{
CString csTitle;
CString csName;
csTitle+=C_BEHAVIOUR_TITLE_LINE;
csTitle+=C_BEHAVIOUR_TITLE_TEMPLATE;
csTitle+=C_BEHAVIOUR_TITLE_LINE;
csName=GetName();
int iStart=strlen(C_BEHAVIOUR_TITLE_LINE)+
(strlen(C_BEHAVIOUR_TITLE_TEMPLATE)-csName.GetLength())/2;
for(int iCpt=0;iCpt<csName.GetLength();iCpt++)
{
csTitle.SetAt(iStart+iCpt,csName[iCpt]);
}
return csTitle;
}
/****************************************************************************/
long CPA_EdIR_MainBehaviour::m_fn_lGetNbLines()
{
CString csText;
csText+=m_fn_csGetBehaviourTitle();
csText+=m_csText;
long lNbLines=0;
long lIndex;
while((lIndex=csText.Find('\n'))!=-1)
{
csText=csText.Right(csText.GetLength()-lIndex-1);
lNbLines++;
}
return lNbLines+1;
}
/****************************************************************************/
long CPA_EdIR_MainBehaviour::m_fn_lGetNbPages(long lLineHeight,
long lPageHeight)
{
long lNbLines=m_fn_lGetNbLines();
long lNbPages=0;
long lNbLinesInAPage=lPageHeight/lLineHeight;
while(lNbLines>=0)
{
lNbLines-=lNbLinesInAPage;
lNbPages++;
}
return lNbPages;
}
/****************************************************************************/
CString CPA_EdIR_MainBehaviour::m_fn_csGetTextToPrint(long lLineHeight,
long lPageHeight,
long lCurrentPage)
{
long lNbLines=m_fn_lGetNbLines();
long lNbLinesInAPage=lPageHeight/lLineHeight;
long lCurPage=1;
long lCurLine=0;
while(lCurPage!=lCurrentPage)
{
lCurLine+=lNbLinesInAPage;
lCurPage++;
}
return m_fn_csGetTextBetweenLines(lCurLine,lCurLine+lNbLinesInAPage-1);
}
/****************************************************************************/
CString CPA_EdIR_MainBehaviour::m_fn_csGetTextBetweenLines(long lLine1,long lLine2)
{
CString csText;
csText+=m_fn_csGetBehaviourTitle();
csText+=m_csText;
CString csTemp=csText;
long lCurLine=0;
long lIndex;
long lOldIndex=0;
long lStartIndex=-1;
long lEndIndex=-1;
while((lIndex=csTemp.Find('\n'))!=-1)
{
csTemp=csTemp.Right(csTemp.GetLength()-lIndex-1);
if(lCurLine==lLine1)
lStartIndex=lOldIndex;
if(lCurLine==lLine2)
lEndIndex=lOldIndex+lIndex+1;
lCurLine++;
//Adds lIndex+1 because '\n' is two character
lOldIndex+=lIndex+1;
}
if(lStartIndex==-1)
return "";
if(lEndIndex==-1)
lEndIndex=csText.GetLength();
else
lEndIndex--;
return csText.Mid(lStartIndex,lEndIndex-lStartIndex+1);
}
/****************************************************************************/
BOOL CPA_EdIR_MainBehaviour::m_fn_bHasBeenModified()
{
if(m_pclBehaviour)
return (m_bHasBeenModified||m_pclBehaviour->m_fn_bHasBeenModified());
else
return m_bHasBeenModified;
}
/****************************************************************************/
void CPA_EdIR_MainBehaviour::m_fn_vSetModified(BOOL bIsModified)
{
if(m_pclBehaviour)
m_pclBehaviour->m_fn_vSetModified(bIsModified);
m_bHasBeenModified=bIsModified;
}
//BEGIN ROMTEAM Cristi Petrescu 98-05-
//****************************************************************************
void CPA_EdIR_MainBehaviour::m_fn_vClearExecutedNodes (void)
{
POSITION pos = m_clDebugInfoList . GetHeadPosition ();
CPA_EdIR_DebugInfo *pclDebugInfo;
while (pos)
{
pclDebugInfo = m_clDebugInfoList . GetNext (pos);
pclDebugInfo -> m_fn_vSetExecuted (FALSE);
}
}
//END ROMTEAM Cristi Petrescu 98-05-
#endif //D_ED_IR_ACTIVE

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,60 @@
// EdIRBk.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRBk.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_BreakPoint
/////////////////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_BreakPoint::CPA_EdIR_BreakPoint(long lIndex,CString csBehaviourName)
{
m_pstNode =NULL;
m_lIndex =lIndex;
m_csBehaviourName =csBehaviourName;
}
/****************************************************************************/
struct tdstNodeInterpret_ *CPA_EdIR_BreakPoint::m_fn_pstGetNode()
{
return m_pstNode;
}
/****************************************************************************/
long CPA_EdIR_BreakPoint::m_fn_lGetIndex()
{
return m_lIndex;
}
/****************************************************************************/
CString CPA_EdIR_BreakPoint::m_fn_csGetBehaviourName()
{
return m_csBehaviourName;
}
/****************************************************************************/
void CPA_EdIR_BreakPoint::m_fn_vSetNode(struct tdstNodeInterpret_ *pstNode)
{
m_pstNode=pstNode;
}
/****************************************************************************/
void CPA_EdIR_BreakPoint::m_fn_vSetIndex(long lIndex)
{
m_lIndex=lIndex;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,109 @@
// EdIRDbg.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRBkLs.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_BreakPointList
/////////////////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_BreakPointList::CPA_EdIR_BreakPointList()
{
}
/****************************************************************************/
CPA_EdIR_BreakPointList::~CPA_EdIR_BreakPointList()
{
m_fn_vDestroyAndRemoveAllEntries();
}
/****************************************************************************/
void CPA_EdIR_BreakPointList::m_fn_vDestroyAndRemoveAllEntries()
{
POSITION pos=GetHeadPosition();
while(pos!=NULL)
delete GetNext(pos);
RemoveAll();
}
/****************************************************************************/
POSITION CPA_EdIR_BreakPointList::m_fn_posGetPositionBreakPoint(long lIndex,CString csBehaviourName)
{
POSITION pos=GetHeadPosition();
BOOL bFound=FALSE;
while(pos!=NULL && !bFound)
{
CPA_EdIR_BreakPoint *pclBreakPoint=GetAt(pos);
if((pclBreakPoint->m_fn_csGetBehaviourName()==csBehaviourName) &&
(pclBreakPoint->m_fn_lGetIndex()==lIndex))
bFound=TRUE;
else
GetNext(pos);
}
return pos;
}
/****************************************************************************/
BOOL CPA_EdIR_BreakPointList::m_fn_bIsInList(long lIndex,CString csBehaviourName)
{
return (m_fn_posGetPositionBreakPoint(lIndex,csBehaviourName)!=NULL);
}
/****************************************************************************/
void CPA_EdIR_BreakPointList::m_fn_vSetOneBreakPoint(long lIndex,CString csBehaviourName)
{
AddTail(new CPA_EdIR_BreakPoint(lIndex,csBehaviourName));
}
/****************************************************************************/
void CPA_EdIR_BreakPointList::m_fn_vRemoveOneBreakPoint(long lIndex,CString csBehaviourName)
{
POSITION pos=m_fn_posGetPositionBreakPoint(lIndex,csBehaviourName);
if(pos!=NULL)
{
CPA_EdIR_BreakPoint *pclBreakPoint=GetAt(pos);
RemoveAt(pos);
delete pclBreakPoint;
}
}
/****************************************************************************/
BOOL CPA_EdIR_BreakPointList::m_fn_bExistMoreThanOnce(CPA_EdIR_BreakPoint *pclBreakPoint)
{
POSITION pos=GetHeadPosition();
BOOL bFound=FALSE;
while(pos!=NULL && !bFound)
{
CPA_EdIR_BreakPoint *pclCurrentBreakPoint=GetNext(pos);
if((pclCurrentBreakPoint!=pclBreakPoint) &&
(pclCurrentBreakPoint->m_fn_lGetIndex()==pclBreakPoint->m_fn_lGetIndex()) &&
(pclCurrentBreakPoint->m_fn_csGetBehaviourName()==pclBreakPoint->m_fn_csGetBehaviourName()))
{
bFound=TRUE;
}
}
return bFound;
}
#endif //D_ED_IR_ACTIVE

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,114 @@
// EdIRMacL.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRCsLs.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_ConstantList
//////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_ConstantList::CPA_EdIR_ConstantList()
{
map = new CMapStringToPtr(500);
map->InitHashTable(500, TRUE);
}
/****************************************************************************/
CPA_EdIR_ConstantList::~CPA_EdIR_ConstantList()
{
m_fn_vDestroyAndRemoveAllEntries();
}
/****************************************************************************/
void CPA_EdIR_ConstantList::m_fn_vDestroyAndRemoveAllEntries()
{
POSITION pos=GetHeadPosition();
while(pos!=NULL)
delete GetNext(pos);
RemoveAll();
map->RemoveAll();
}
/****************************************************************************/
void CPA_EdIR_ConstantList::m_fn_vAdd(CString csType,CString csName,CString csValue)
{
CPA_EdIR_Constant *pclConstant=new CPA_EdIR_Constant(csType,csName,csValue);
AddTail(pclConstant);
csName.MakeLower();
map->SetAt(csName, (void *) pclConstant);
}
/****************************************************************************/
CPA_EdIR_Constant * CPA_EdIR_ConstantList::m_fn_pAdd(CString csType,CString csName,CString csValue)
{
CPA_EdIR_Constant *pclConstant=new CPA_EdIR_Constant(csType,csName,csValue);
AddTail(pclConstant);
csName.MakeLower();
map->SetAt(csName, (void *) pclConstant);
return pclConstant;
}
/****************************************************************************/
void CPA_EdIR_ConstantList::m_fn_vRemove(CString csName)
{
POSITION pos=GetHeadPosition();
BOOL bFound=FALSE;
while(pos!=NULL && !bFound)
{
bFound=(GetAt(pos)->m_fn_csGetConstantName().CompareNoCase(csName)==0);
if(!bFound)
GetNext(pos);
}
if(pos!=NULL)
{
csName.MakeLower();
if(map->RemoveKey(csName))
delete GetAt(pos);
RemoveAt(pos);
}
}
/****************************************************************************/
BOOL CPA_EdIR_ConstantList::m_fn_bIsAConstant(CString &csConstant)
{
void *p;
return map->Lookup(csConstant, p);
}
/****************************************************************************/
CString CPA_EdIR_ConstantList::m_fn_csGetValueOfAConstant(CString &csConstant)
{
void *p;
map->Lookup(csConstant, p);
return ((CPA_EdIR_Constant *) p)->m_csValue;
}
/****************************************************************************/
CString CPA_EdIR_ConstantList::m_fn_csGetTypeOfAConstant(CString &csConstant)
{
void *p;
map->Lookup(csConstant, p);
return ((CPA_EdIR_Constant *) p)->m_csType;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,124 @@
// EdIRCsNB.hpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRCsNB.hpp"
#include "EdIRStrg.hpp"
#include "ITF/FrmGest.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_NewConstantDialog dialog
/////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CPA_EdIR_NewConstantDialog, CDialog)
//{{AFX_MSG_MAP(CPA_EdIR_NewConstantDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/**********************************************************************************/
CPA_EdIR_NewConstantDialog::CPA_EdIR_NewConstantDialog(CString csType,CString csName,CString csValue,CWnd* pParent /*=NULL*/)
: CDialog(CPA_EdIR_NewConstantDialog::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(CPA_EdIR_NewConstantDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_csType=csType;
m_csName=csName;
m_csValue=csValue;
}
/**********************************************************************************/
void CPA_EdIR_NewConstantDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPA_EdIR_NewConstantDialog)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_NewConstantDialog message handlers
/**********************************************************************************/
BOOL CPA_EdIR_NewConstantDialog::OnInitDialog()
{
CDialog::OnInitDialog();
((CComboBox *)GetDlgItem(IDC_COMBO_TYPE))->AddString(g_c_csInteger);
((CComboBox *)GetDlgItem(IDC_COMBO_TYPE))->AddString(g_c_csDecimal);
if(m_csType!="")
{
int iCurSel=((CComboBox *)GetDlgItem(IDC_COMBO_TYPE))->FindStringExact(0,m_csType);
if(iCurSel!=CB_ERR)
{
((CComboBox *)GetDlgItem(IDC_COMBO_TYPE))->SetCurSel(iCurSel);
GetDlgItem(IDC_COMBO_TYPE)->EnableWindow(FALSE);
}
else
{
AfxMessageBox("CPA_EdIR_NewConstantDialog::OnInitDialog : Unkonwn type "+m_csType);
ASSERT(FALSE);
}
}
if(m_csName!="")
{
GetDlgItem(IDC_EDIT_CONSTNAME)->SetWindowText(m_csName);
GetDlgItem(IDC_EDIT_CONSTNAME)->EnableWindow(FALSE);
}
if(m_csValue!="")
GetDlgItem(IDC_EDIT_VALUE)->SetWindowText(m_csValue);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
/**********************************************************************************/
void CPA_EdIR_NewConstantDialog::OnOK()
{
BOOL bError=FALSE;
GetDlgItem(IDC_COMBO_TYPE)->GetWindowText(m_csType);
if(m_csType=="")
{
AfxMessageBox("You must enter a type");
bError=TRUE;
}
GetDlgItem(IDC_EDIT_CONSTNAME)->GetWindowText(m_csName);
if(m_csName=="")
{
AfxMessageBox("You must enter a name");
bError=TRUE;
}
GetDlgItem(IDC_EDIT_VALUE)->GetWindowText(m_csValue);
if(m_csValue=="")
{
AfxMessageBox("You must enter a valid value");
bError=TRUE;
}
if(bError==FALSE)
CDialog::OnOK();
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,61 @@
// EdIRMac.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRCst.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_Constant
//////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_Constant::CPA_EdIR_Constant()
{
m_csType="";
m_csName="";
m_csValue="";
}
/****************************************************************************/
CPA_EdIR_Constant::CPA_EdIR_Constant(CString csType,CString csName,CString csValue)
{
m_csType=csType;
m_csName=csName;
m_csValue=csValue;
}
/****************************************************************************/
CPA_EdIR_Constant::~CPA_EdIR_Constant()
{
}
/****************************************************************************/
CString CPA_EdIR_Constant::m_fn_csGetConstantType()
{
return m_csType;
}
/****************************************************************************/
CString CPA_EdIR_Constant::m_fn_csGetConstantName()
{
return m_csName;
}
/****************************************************************************/
CString CPA_EdIR_Constant::m_fn_csGetConstantValue()
{
return m_csValue;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,302 @@
// EdIRCstB.hpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRCstB.hpp"
#include "EdIRIRD.hpp"
#include "EdIRBeEn.hpp"
#include "EdIRStrg.hpp"
#include "EdIRCsNB.hpp"
#include "EdIRCsLs.hpp"
#include "incDPT.h"
#include "incTUT.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//Stefan Dumitrean 17-06-98
#define C_SETTINGS_FILE_NAME "\\cpa\\exe\\main\\edt_data\\ctcoldim.dat"
//End Stefan Dumitrean 17-06-98
#define C_TYPE_COLUMN_NUMBER 0
#define C_NAME_COLUMN_NUMBER 1
#define C_VALUE_COLUMN_NUMBER 2
int CALLBACK fn_vCompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
CPA_EdIR_Constant *pCts1 = (CPA_EdIR_Constant *) lParam1;
CPA_EdIR_Constant *pCts2 = (CPA_EdIR_Constant *) lParam2;
switch (lParamSort)
{
case C_TYPE_COLUMN_NUMBER:
return pCts1->m_fn_csGetConstantType().Compare(pCts2->m_fn_csGetConstantType());
case C_NAME_COLUMN_NUMBER:
return pCts1->m_fn_csGetConstantName().Compare(pCts2->m_fn_csGetConstantName());
case C_VALUE_COLUMN_NUMBER:
return pCts1->m_fn_csGetConstantValue().Compare(pCts2->m_fn_csGetConstantValue());
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_ConstantDialog dialog
/////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CPA_EdIR_ConstantDialog, CDialog)
//{{AFX_MSG_MAP(CPA_EdIR_ConstantDialog)
ON_BN_CLICKED(IDC_BUTTON_NEW_CONSTANT,OnButtonNewConstant)
ON_BN_CLICKED(IDC_BUTTON_CHANGE_CONSTANT,OnButtonChangeConstant)
ON_BN_CLICKED(IDC_BUTTON_DELETE_CONSTANT,OnButtonDeleteConstant)
ON_NOTIFY(LVN_COLUMNCLICK, IDC_CONSTANT_LIST, OnColumnClicked)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/**********************************************************************************/
CPA_EdIR_ConstantDialog::CPA_EdIR_ConstantDialog(CPA_EdIR_ConstantList *pclConstantList,CWnd* pParent /*=NULL*/)
: CDialog(CPA_EdIR_ConstantDialog::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(CPA_EdIR_ConstantDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pclConstantList=pclConstantList;
}
/**********************************************************************************/
void CPA_EdIR_ConstantDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPA_EdIR_ConstantDialog)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_ConstantDialog message handlers
/**********************************************************************************/
BOOL CPA_EdIR_ConstantDialog::OnInitDialog()
{
CDialog::OnInitDialog();
//Stefan Dumitrean 17-06-98
int nTest, vColDim[3] = { 50, 200, 50 };
char lpszTest[50], vColNames[3][50] = { "Type", "Name", "Value" };
FILE * p_stFile = fopen( C_SETTINGS_FILE_NAME, "r" );
if( p_stFile )
{
for( int i = 0; i < 3; i++ )
if( fscanf( p_stFile, "%s = %d\n", lpszTest, &nTest ) != 2 )
break;
if( i == 3 )
{
rewind( p_stFile );
for( i = 0; i < 3; i++ )
fscanf( p_stFile, "%s = %d\n", vColNames[i], &vColDim[i] );
}
fclose( p_stFile );
}
//End Stefan Dumitrean 17-06-98
CListCtrl *pclListControl=(CListCtrl *)GetDlgItem(IDC_CONSTANT_LIST);
//Stefan Dumitrean 17-06-98
pclListControl->InsertColumn(C_TYPE_COLUMN_NUMBER,vColNames[0],LVCFMT_LEFT,vColDim[0],C_TYPE_COLUMN_NUMBER);
pclListControl->InsertColumn(C_NAME_COLUMN_NUMBER,vColNames[1],LVCFMT_LEFT,vColDim[1],C_NAME_COLUMN_NUMBER);
pclListControl->InsertColumn(C_VALUE_COLUMN_NUMBER,vColNames[2],LVCFMT_LEFT,vColDim[2],C_VALUE_COLUMN_NUMBER);
//End Stefan Dumitrean 17-06-98
POSITION pos=m_pclConstantList->GetHeadPosition();
while(pos!=NULL)
{
CPA_EdIR_Constant *pclConstant=m_pclConstantList->GetNext(pos);
CString csType=pclConstant->m_fn_csGetConstantType();
CString csName=pclConstant->m_fn_csGetConstantName();
CString csValue=pclConstant->m_fn_csGetConstantValue();
m_fn_vAddItem(csType,csName,csValue,(LPARAM)pclConstant);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
/**********************************************************************************/
void CPA_EdIR_ConstantDialog::OnButtonNewConstant()
{
CPA_EdIR_NewConstantDialog clConstantPresetDlg;
if(clConstantPresetDlg.DoModal()==IDOK)
{
CPA_EdIR_Constant *pclConstant = m_pclConstantList->m_fn_pAdd(clConstantPresetDlg.m_csType,clConstantPresetDlg.m_csName,clConstantPresetDlg.m_csValue);
m_fn_vAddItem(clConstantPresetDlg.m_csType,clConstantPresetDlg.m_csName,clConstantPresetDlg.m_csValue, (LPARAM)pclConstant);
m_fn_vNotifySave();
}
}
/**********************************************************************************/
void CPA_EdIR_ConstantDialog::OnButtonChangeConstant()
{
int iCurSel=m_fn_iGetCurSel();
if(iCurSel!=-1)
{
CListCtrl *pclListControl=(CListCtrl *)GetDlgItem(IDC_CONSTANT_LIST);
CString csType=pclListControl->GetItemText(iCurSel,C_TYPE_COLUMN_NUMBER);
CString csName=pclListControl->GetItemText(iCurSel,C_NAME_COLUMN_NUMBER);
CString csValue=pclListControl->GetItemText(iCurSel,C_VALUE_COLUMN_NUMBER);
CPA_EdIR_NewConstantDialog clConstantPresetDlg(csType,csName,csValue);
if(clConstantPresetDlg.DoModal()==IDOK)
{
m_pclConstantList->m_fn_vRemove(csName);
CPA_EdIR_Constant *pclConstant = m_pclConstantList->m_fn_pAdd(clConstantPresetDlg.m_csType,clConstantPresetDlg.m_csName,clConstantPresetDlg.m_csValue);
m_fn_vSetItem(iCurSel,clConstantPresetDlg.m_csType,clConstantPresetDlg.m_csName,clConstantPresetDlg.m_csValue, (LPARAM) pclConstant);
m_fn_vNotifySave();
}
}
}
/**********************************************************************************/
void CPA_EdIR_ConstantDialog::OnButtonDeleteConstant()
{
int iCurSel=m_fn_iGetCurSel();
if(iCurSel!=-1)
{
CListCtrl *pclListControl=(CListCtrl *)GetDlgItem(IDC_CONSTANT_LIST);
CString csName=pclListControl->GetItemText(iCurSel,C_NAME_COLUMN_NUMBER);
m_pclConstantList->m_fn_vRemove(csName);
pclListControl->DeleteItem(iCurSel);
m_fn_vNotifySave();
}
}
/**********************************************************************************/
void CPA_EdIR_ConstantDialog::m_fn_vNotifySave()
{
CString csDefineSectionName=CString(fn_szGetFamiliesDataPath())+"\\"+g_c_csAIDefineFileName;
SCR_fn_v_SvL1_RegisterNotify(M_MAKECHAR(csDefineSectionName),
CPA_EdIR_Brain::m_fn_vSaveEngineAIDefines,
m_pclConstantList,
SCR_EA_Ntfy_RebuildSection);
}
/**********************************************************************************/
int CPA_EdIR_ConstantDialog::m_fn_iGetCurSel()
{
CListCtrl *pclListControl=(CListCtrl *)GetDlgItem(IDC_CONSTANT_LIST);
for(int iIndex=0;iIndex<pclListControl->GetItemCount();iIndex++)
{
if(pclListControl->GetItemState(iIndex,LVIS_SELECTED)==LVIS_SELECTED)
return iIndex;
}
return -1;
}
/**********************************************************************************/
void CPA_EdIR_ConstantDialog::m_fn_vAddItem(CString csType,CString csName,CString csValue,LPARAM lParam)
{
CListCtrl *pclListControl=(CListCtrl *)GetDlgItem(IDC_CONSTANT_LIST);
LV_ITEM stLvItem;
stLvItem.mask=LVIF_TEXT;
stLvItem.iItem=pclListControl->GetItemCount();
stLvItem.iSubItem=C_TYPE_COLUMN_NUMBER;
stLvItem.pszText=(char *)LPCTSTR(csType);
pclListControl->InsertItem(&stLvItem);
stLvItem.iSubItem=C_NAME_COLUMN_NUMBER;
stLvItem.pszText=(char *)LPCTSTR(csName);
pclListControl->SetItem(&stLvItem);
stLvItem.iSubItem=C_VALUE_COLUMN_NUMBER;
stLvItem.pszText=(char *)LPCTSTR(csValue);
pclListControl->SetItem(&stLvItem);
pclListControl->SetItemData(stLvItem.iItem,lParam);
}
/**********************************************************************************/
void CPA_EdIR_ConstantDialog::m_fn_vSetItem(int nItem,CString csType,CString csName,CString csValue,LPARAM lParam)
{
CListCtrl *pclListControl=(CListCtrl *)GetDlgItem(IDC_CONSTANT_LIST);
pclListControl->SetItemText(nItem,C_TYPE_COLUMN_NUMBER,csType);
pclListControl->SetItemText(nItem,C_NAME_COLUMN_NUMBER,csName);
pclListControl->SetItemText(nItem,C_VALUE_COLUMN_NUMBER,csValue);
pclListControl->SetItemData(nItem,lParam);
}
//Stefan Dumitrean 17-06-98
void CPA_EdIR_ConstantDialog::OnClose()
{
m_fn_vSaveSettings();
CDialog::OnClose();
}
void CPA_EdIR_ConstantDialog::OnOK()
{
m_fn_vSaveSettings();
CDialog::OnOK();
}
void CPA_EdIR_ConstantDialog::m_fn_vSaveSettings()
{
CListCtrl *pclListControl=(CListCtrl *)GetDlgItem(IDC_CONSTANT_LIST);
FILE * p_stFile = fopen( C_SETTINGS_FILE_NAME, "w" );
LV_COLUMN stColumn;
char pszColumnName[50];
stColumn.mask = LVCF_TEXT | LVCF_WIDTH;
stColumn.pszText = pszColumnName;
stColumn.cchTextMax = 50;
if( p_stFile )
{ for( int i = 0; i < 3; i++ )
{
pclListControl->GetColumn( i, &stColumn );
fprintf( p_stFile, "%s = %d\n", stColumn.pszText, stColumn.cx );
}
fclose( p_stFile );
}
}
void CPA_EdIR_ConstantDialog::OnColumnClicked (NMHDR* pNMHDR, LRESULT* pResult)
{
LPNM_LISTVIEW pNMListView = (LPNM_LISTVIEW) pNMHDR;
CListCtrl *pclListControl = (CListCtrl *) GetDlgItem(IDC_CONSTANT_LIST);
int iNumColumn = pNMListView->iSubItem;
pclListControl->SortItems(&fn_vCompareItems, iNumColumn);
}
//End Stefan Dumitrean 17-06-98
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,384 @@
// EdIRCtl.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
//BEGIN ROMTEAM Cristi Petrescu 98-06-
#include "EDACCust.hpp"
#include "EdIRird.hpp"
#include "edirfrm.hpp"
#include "edirbeen.hpp"
//END ROMTEAM Cristi Petrescu 98-06-
#include "EdIRCtl.hpp"
#include "EdIRDat.hpp"
#include "EdIRQuer.hpp"
#include "EdIRWaW.hpp"
#include "EDACDoc.hpp"
#include "EDACActr.hpp"
#include "_Actors.hpp"
#include "Ctl.h"
//ANNECY CB
#include "x:\cpa\main\inc\_EditID.h"
#include "ai_intf.hpp"
#include "EDIRDvVw.hpp"
//END
#define C_OWNER_DATA_DATA_LEVEL "Data Level"
#define C_OWNER_DATA_VISIBILITY "Visibility"
//BEGIN ROMTEAM Cristi Petrescu 98-06-
#define C_OWNER_DATA_QUALIFIER "Data Qualifier"
//END ROMTEAM Cristi Petrescu 98-06-
#include "EdIRStrg.hpp"
/**********************************************************************************/
void fn_vDeleteControl(CTL_Editor_Control *pclControl)
{
delete pclControl;
}
/**********************************************************************************/
//BEGIN ROMTEAM Cristi Petrescu 98-06-
void fn_vAddOwnerData(CTL_Editor_Control *pclControl,OAC_tdeDataLevel eDataLevel,OAC_tdeControlVisibility eVisibility, enum OAC_eDataQualifier eDataQualifier/*= OAC_DATA_PUBLIC*/)
//END ROMTEAM Cristi Petrescu 98-06-
{
pclControl->m_pub_fn_pclAddOwnerData((long)eDataLevel,C_OWNER_DATA_DATA_LEVEL);
pclControl->m_pub_fn_pclAddOwnerData((long)eVisibility,C_OWNER_DATA_VISIBILITY);
//BEGIN ROMTEAM Cristi Petrescu 98-06-
pclControl->m_pub_fn_pclAddOwnerData((long)eDataQualifier,C_OWNER_DATA_QUALIFIER);
//END ROMTEAM Cristi Petrescu 98-06-
}
//BEGIN ROMTEAM Cristi Petrescu 98-06-
/**********************************************************************************/
OAC_tdeDataQualifier fn_eGetDataQualifier(CTL_Editor_Control *pclControl)
{
CTL_OwnerData *pclOwnerData=pclControl->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_QUALIFIER);
if(pclOwnerData!=NULL)
return (OAC_tdeDataQualifier)(pclOwnerData->m_pub_fn_lGetData());
else
{
ASSERT(FALSE);
return OAC_DATA_PUBLIC;
}
}
//END ROMTEAM Cristi Petrescu 98-06-
/**********************************************************************************/
OAC_tdeDataLevel fn_eGetDataLevel(CTL_Editor_Control *pclControl)
{
CTL_OwnerData *pclOwnerData=pclControl->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_DATA_LEVEL);
if(pclOwnerData!=NULL)
return (OAC_tdeDataLevel)(pclOwnerData->m_pub_fn_lGetData());
else
{
ASSERT(FALSE);
return OAC_DATA_LEVEL_1;
}
}
/**********************************************************************************/
OAC_tdeControlVisibility fn_eGetVisibility(CTL_Editor_Control *pclControl)
{
CTL_OwnerData *pclOwnerData=pclControl->m_pub_fn_pclGetOwnerDataWithName(C_OWNER_DATA_VISIBILITY);
if(pclOwnerData!=NULL)
return (OAC_tdeControlVisibility)(pclOwnerData->m_pub_fn_lGetData());
else
{
ASSERT(FALSE);
return EDCAR_DATA_VISI_DUAL;
}
}
/**********************************************************************************/
BOOL fn_bMustDisplay(CTL_Editor_Control *pclControl)
{
//BEGIN ROMTEAM Cristi Petrescu 98-06-
CPA_EdIR_Frame *pclIRMainFrame = g_pclAIInterface->m_pclIRMainFrame;
if (pclIRMainFrame)
{
CPA_EdIR_Brain *pclBrain = pclIRMainFrame -> m_pclBrain;
if (pclBrain)
{
OAC_tdeDataQualifier eDataQualifier = fn_eGetDataQualifier (pclControl);
if (eDataQualifier == OAC_DATA_PRIVATE && ! pclBrain -> m_bShowPrivateVariable)
return FALSE;
}
}
//END ROMTEAM Cristi Petrescu 98-06-
EdActors_MyDocument *pclDocument=fn_pclGetEdActorsDocument();
OAC_eDataLevel eDataLevel=fn_eGetDataLevel(pclControl);
OAC_tdeControlVisibility eVisibility=fn_eGetVisibility(pclControl);
//ANNECY CB
CPA_DLLBase *pclActorDLL=(CPA_DLLBase*)(g_pclAIInterface->GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName));
CPA_EdIR_DesignerVariablesView *pclDsgVarView=(CPA_EdIR_DesignerVariablesView *)pclActorDLL->OnQueryAction(g_pclAIInterface,C_uiActor_GetDesignerVariablesView,0);
//CPA2 Stegaru Cristian 98-06
if((pclDsgVarView->mfn_bHideVariables ())||(g_pclAIInterface->m_bIsOpened == FALSE))
//End CPA2 Stegaru Cristian 98-06
return FALSE;
//END
//Stefan Dumitrean 14-07-98 ( OAC Buttons )
BOOL bMustDisplayBecauseRightLevel = TRUE;
/*
switch( eDataLevel )
{
case OAC_DATA_LEVEL_1:
if( bMustDisplayBecauseRightLevel = pclDocument->m_aCurrentOACButtonsPressed[0] )
switch( pclControl->m_ucInitialCurrentPair )
{
case 1: //is initial
bMustDisplayBecauseRightLevel = !pclDocument->m_aCurrentOACButtonsPressed[2];
break;
case 2: //is current
bMustDisplayBecauseRightLevel = pclDocument->m_aCurrentOACButtonsPressed[2];
}
break;
case OAC_DATA_LEVEL_2:
bMustDisplayBecauseRightLevel =
pclDocument->m_aCurrentOACButtonsPressed[1] && !pclDocument->m_aCurrentOACButtonsPressed[2];
break;
case OAC_DATA_LEVEL_3:
bMustDisplayBecauseRightLevel =
pclDocument->m_aCurrentOACButtonsPressed[1] && pclDocument->m_aCurrentOACButtonsPressed[2];
}
*/
switch( eDataLevel )
{
case OAC_DATA_LEVEL_1:
switch( pclControl->m_ucInitialCurrentPair )
{
case 1: //is initial
bMustDisplayBecauseRightLevel = pclDocument->m_bDisplayInitialValue;
break;
case 2: //is current
bMustDisplayBecauseRightLevel = pclDocument->m_bDisplayCurrentValue;
}
break;
case OAC_DATA_LEVEL_2:
bMustDisplayBecauseRightLevel = pclDocument->m_bDisplayInitialValue;
break;
case OAC_DATA_LEVEL_3:
bMustDisplayBecauseRightLevel = pclDocument->m_bDisplayCurrentValue;
}
return (
/* (
(pclDocument->m_tdeCurrentDataLevel>=eDataLevel)
&&
(!pclDocument->m_bExclusiveLevel)
)
||
(
(pclDocument->m_tdeCurrentDataLevel==eDataLevel)
&&
(pclDocument->m_bExclusiveLevel)
)
*/
bMustDisplayBecauseRightLevel
//End Stefan Dumitrean 14-07-98 ( OAC Buttons )
)
&&
(
(
(
(eVisibility==EDCAR_DATA_VISI_ONLY_INSTANCES)
||
(eVisibility==EDCAR_DATA_VISI_DUAL)
)
&&
(pclDocument->m_eCurrentDisplayMode==ED_ACTORS_eDisplayMode_Instance)
)
||
(
(
(eVisibility==EDCAR_DATA_VISI_ONLY_MODELS)
||
(eVisibility==EDCAR_DATA_VISI_DUAL)
)
&&
(
(pclDocument->m_eCurrentDisplayMode==ED_ACTORS_eDisplayMode_Model)
||
(pclDocument->m_eCurrentDisplayMode==ED_ACTORS_eDisplayMode_AlwaysModel)
)
)
);
}
/**********************************************************************************/
void fn_vOnButtonClick(CTL_Editor_Static *pclStatic,enum CTL_eClickType eClickType)
{
if(pclStatic!=NULL)
{
if(pclStatic->m_pub_fn_tdeGetType()==CTL_STATIC_TYPE__FIELD_NAME)
{
CTL_Editor_Control *pclControl=pclStatic->m_pub_fn_pclGetParentControl();
if(pclControl!=NULL)
{
CTL_Editor_Data *pclData=pclControl->m_fn_pclGetEditedData();
if(pclData!=NULL && fn_pclGetAssociatedControl(pclData)==NULL)
{
switch(eClickType)
{
case CTL_CLICK_TYPE__LEFT_CLICK:
break;
case CTL_CLICK_TYPE__RIGHT_CLICK:
{
EdActors_EditorActor *pclActor=fn_pclGetParentActor(pclData);
if(pclActor->m_pclActor->m_fn_bIsAnInstance())
{
if(fn_bIsInWatch(pclData))
{
fn_vRemoveValueFromWatch(pclData);
fn_vSetInWatch(pclData,FALSE);
pclStatic->InvalidateRect(NULL);
}
else
{
fn_vAddValueInWatch(pclData);
fn_vSetInWatch(pclData,TRUE);
pclStatic->InvalidateRect(NULL);
}
}
}
break;
case CTL_CLICK_TYPE__LEFT_DOUBLE_CLICK:
break;
case CTL_CLICK_TYPE__RIGHT_DOUBLE_CLICK:
break;
default:
break;
}
}
}
else
{
ASSERT(FALSE);
}
}
}
else
{
ASSERT(FALSE);
}
}
/**********************************************************************************/
void fn_vGetStaticColor(CTL_Editor_Static *pclStatic,COLORREF &r_ColRefBackGround,COLORREF &r_ColRefText)
{
if(pclStatic!=NULL)
{
if(pclStatic->m_pub_fn_tdeGetType()==CTL_STATIC_TYPE__FIELD_NAME)
{
CTL_Editor_Control *pclControl=pclStatic->m_pub_fn_pclGetParentControl();
if(pclControl!=NULL)
{
CTL_Editor_Data *pclData=pclControl->m_fn_pclGetEditedData();
if(pclData!=NULL)
{
if(fn_bIsInWatch(pclData))
{
r_ColRefBackGround=RGB(192,50,50);
r_ColRefText=RGB(0,0,0);
}
else
{
EdActors_EditorActor *pclActor=fn_pclGetParentActor(pclData);
if(pclActor->m_pclActor->m_fn_bIsAnInstance())
{
switch (fn_eGetDataLevel(pclControl))
{
case OAC_DATA_LEVEL_1:
switch (pclControl->m_ucInitialCurrentPair)
{
case 2:
r_ColRefBackGround=RGB(0,192,192);
r_ColRefText=RGB(0,0,0);
break;
case 1:
r_ColRefBackGround=RGB(192,192,0);
r_ColRefText=RGB(0,0,0);
break;
case 0:
default:
r_ColRefBackGround=RGB(0,192,0);
r_ColRefText=RGB(0,0,0);
break;
}
break;
case OAC_DATA_LEVEL_2:
r_ColRefBackGround=RGB(192,192,0);
r_ColRefText=RGB(0,0,0);
break;
case OAC_DATA_LEVEL_3:
r_ColRefBackGround=RGB(0,192,192);
r_ColRefText= RGB(0,0,0);
break;
}
}
else
{
// Shaitan => Check Save type
if (pclData->m_pub_fn_csGetDataName().Find(g_c_csDsgVarSaveTypeText) != -1)
{
r_ColRefBackGround=((CTL_Editor_EnumData *)pclData)->m_pclCurrentValue->m_pub_fn_lGetValue() ? RGB(255,100,200) : RGB(0,255,255);
r_ColRefText= RGB(0,0,0);
}
else if (pclData->m_pub_fn_csGetDataName().Find(g_c_csDsgVarInitTypeText)!= -1)
{
r_ColRefBackGround=(((CTL_Editor_EnumData *)pclData)->m_pclCurrentValue->m_pub_fn_lGetValue() != OTI_PlayerDead) ? RGB(255,100,0) : RGB(255,255,0);
r_ColRefText = RGB(0,0,0);
}
else
{
r_ColRefBackGround=RGB(192,192,0);
r_ColRefText= RGB(0,0,0);
}
// End Shaitan => Check Save type
}
}
}
else
{
ASSERT(FALSE);
}
}
else
{
ASSERT(FALSE);
}
}
}
else
{
ASSERT(FALSE);
}
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,88 @@
// EdIRDV.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRDV.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_DesignerVariable
//////////////////////////////////////////////////////////////////
/****************************************************************************/
//BEGIN ROMTEAM Cristi Petrescu 98-06-
CPA_EdIR_DesignerVariable::CPA_EdIR_DesignerVariable(CString csName,
CString csType,
CStringList *pcslListOfValues,
BOOL bIsPrivate /* = FALSE */)
//END ROMTEAM Cristi Petrescu 98-06-
{
m_csName=csName;
m_csType=csType;
POSITION pos=pcslListOfValues->GetHeadPosition();
while(pos!=NULL)
m_cslListOfValues.AddTail(pcslListOfValues->GetNext(pos));
m_bIsInWatchWindow=FALSE;
//BEGIN ROMTEAM Cristi Petrescu 98-05-
m_bIsPrivate = bIsPrivate;
//END ROMTEAM Cristi Petrescu 98-05-
}
/****************************************************************************/
CPA_EdIR_DesignerVariable::~CPA_EdIR_DesignerVariable()
{
}
/****************************************************************************/
CString CPA_EdIR_DesignerVariable::m_fn_csGetDesignerVariableName()
{
return m_csName;
}
/****************************************************************************/
CString CPA_EdIR_DesignerVariable::m_fn_csGetDesignerVariableType()
{
return m_csType;
}
/****************************************************************************/
CString CPA_EdIR_DesignerVariable::m_fn_csGetFirstDesignerVariableValue()
{
if(!m_cslListOfValues.IsEmpty())
return m_cslListOfValues.GetHead();
else
return "";
}
/****************************************************************************/
CStringList *CPA_EdIR_DesignerVariable::m_fn_pcslGetDesignerVariableValues()
{
return &(m_cslListOfValues);
}
/****************************************************************************/
BOOL CPA_EdIR_DesignerVariable::m_fn_bIsInWatchWindow()
{
return m_bIsInWatchWindow;
}
/****************************************************************************/
void CPA_EdIR_DesignerVariable::m_fn_vSetInWatchWindow(BOOL bIsInWatchWindow)
{
m_bIsInWatchWindow=bIsInWatchWindow;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,247 @@
// EdIRDVLs.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRDVLs.hpp"
#include "EdIRIAWd.hpp"
#include "acp_base.h"
#include "ITF.h"
#include "IncMEC.h"
#include "incAI.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_DesignerVariableList
//////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_DesignerVariableList::CPA_EdIR_DesignerVariableList()
{
map = new CMapStringToPtr(500);
map1 = new CMapPtrToPtr(500);
map->InitHashTable(500, TRUE);
map1->InitHashTable(500, TRUE);
}
/****************************************************************************/
CPA_EdIR_DesignerVariableList::CPA_EdIR_DesignerVariableList(CPA_EdIR_DesignerVariableList &clDsgVarList)
{
POSITION pos=clDsgVarList.GetHeadPosition();
while(pos!=NULL)
AddTail(clDsgVarList.GetNext(pos));
map = new CMapStringToPtr(500);
map1 = new CMapPtrToPtr(500);
map->InitHashTable(500, TRUE);
map1->InitHashTable(500, TRUE);
}
/****************************************************************************/
CPA_EdIR_DesignerVariableList::~CPA_EdIR_DesignerVariableList()
{
m_fn_vDestroyAndRemoveAllEntries();
}
/****************************************************************************/
void CPA_EdIR_DesignerVariableList::AddTail(CPA_EdIR_DesignerVariable *p)
{
InsertAfter(GetTailPosition(), p);
p->m_csName.MakeLower();
map->SetAt(p->m_csName, (void *) GetCount());
map1->SetAt((void *) (GetCount()-1), GetTailPosition());
}
/****************************************************************************/
CPA_EdIR_DesignerVariableList CPA_EdIR_DesignerVariableList::operator =(CPA_EdIR_DesignerVariableList &clDsgVarList)
{
POSITION pos=clDsgVarList.GetHeadPosition();
while(pos!=NULL)
AddTail(clDsgVarList.GetNext(pos));
return *this;
}
/****************************************************************************/
void CPA_EdIR_DesignerVariableList::m_fn_vDestroyAndRemoveAllEntries()
{
POSITION pos=GetHeadPosition();
while(pos!=NULL)
delete GetNext(pos);
RemoveAll();
map->RemoveAll();
map1->RemoveAll();
}
/****************************************************************************/
POSITION CPA_EdIR_DesignerVariableList::m_fn_posGetPosition(long lIndex)
{
void *p;
if(map1->Lookup((void *) lIndex, p))
return (POSITION) p;
return NULL;
}
/****************************************************************************/
POSITION CPA_EdIR_DesignerVariableList::m_fn_posGetPosition(CString &csDesignerVariable)
{
void *p, *p1;
csDesignerVariable.MakeLower();
if(map->Lookup(csDesignerVariable, p))
if(map1->Lookup((void *) ((long) p - 1), p1))
return (POSITION) p1;
return NULL;
}
/****************************************************************************/
long CPA_EdIR_DesignerVariableList::m_fn_bIsADesignerVariable(CString &csDesignerVariable)
{
void *p;
csDesignerVariable.MakeLower();
if(map->Lookup(csDesignerVariable, p))
return (long) p;
return 0;
}
/****************************************************************************/
long CPA_EdIR_DesignerVariableList::m_fn_lGetIndexOfADesignerVariable(CString &csDesignerVariable)
{
POSITION pos=GetHeadPosition();
long lIndex=0;
BOOL bFound=FALSE;
while(pos!=NULL && !bFound)
{
bFound=(GetNext(pos)->m_fn_csGetDesignerVariableName().CompareNoCase(csDesignerVariable)==0);
lIndex++;
}
return lIndex-1;
}
/****************************************************************************/
CString CPA_EdIR_DesignerVariableList::m_fn_csGetTypeOfADesignerVariable(CString csDesignerVariable)
{
POSITION pos=m_fn_posGetPosition(csDesignerVariable);
if(pos!=NULL)
return GetAt(pos)->m_fn_csGetDesignerVariableType();
else
return "";
}
/****************************************************************************/
CString CPA_EdIR_DesignerVariableList::m_fn_csGetTypeOfADesignerVariable(long lIndex)
{
POSITION pos=m_fn_posGetPosition(lIndex);
if(pos!=NULL)
return GetAt(pos)->m_fn_csGetDesignerVariableType();
else
return "";
}
/****************************************************************************/
CString CPA_EdIR_DesignerVariableList::m_fn_csGetFirstValueOfADesignerVariable(CString csDesignerVariable)
{
POSITION pos=m_fn_posGetPosition(csDesignerVariable);
if(pos!=NULL)
return GetAt(pos)->m_fn_csGetFirstDesignerVariableValue();
else
return "";
}
// BEGIN ROMTEAM Cristi Petrescu 99-01- debug
/****************************************************************************/
CString CPA_EdIR_DesignerVariableList::m_fn_csGetFirstValueOfADesignerVariable(long lIndex)
{
POSITION pos=m_fn_posGetPosition(lIndex);
if(pos!=NULL)
return GetAt(pos)->m_fn_csGetFirstDesignerVariableValue();
else
return "";
}
// END ROMTEAM Cristi Petrescu 99-01- debug
/****************************************************************************/
CStringList *CPA_EdIR_DesignerVariableList::m_fn_pcslGetValuesOfADesignerVariable(CString csDesignerVariable)
{
POSITION pos=m_fn_posGetPosition(csDesignerVariable);
if(pos!=NULL)
return GetAt(pos)->m_fn_pcslGetDesignerVariableValues();
else
return NULL;
}
/****************************************************************************/
long CPA_EdIR_DesignerVariableList::m_fn_lGetSizeOfAllDesignerVariables()
{
long lSizeOfAllDesignerVariables=0;
POSITION pos=GetHeadPosition();
while(pos!=NULL)
{
CPA_EdIR_DesignerVariable *pclDesignerVariable=GetNext(pos);
tdeDsgVarTypeId tdeVarType;
long lNbEltInList=0;
tdeVarType=(tdeDsgVarTypeId)fn_lGetDsgVarTypeIdFromEditorName(pclDesignerVariable->m_fn_csGetDesignerVariableType());
if((tdeVarType==eDsgVarType_List) ||
(fn_GetDsgVarType(tdeVarType)==E_vt_Array))
lNbEltInList=atol(pclDesignerVariable->m_fn_csGetFirstDesignerVariableValue());
lSizeOfAllDesignerVariables+=fn_ulSizeOfDsgVar(tdeVarType,(unsigned char)lNbEltInList);
}
return lSizeOfAllDesignerVariables;
}
/****************************************************************************/
BOOL CPA_EdIR_DesignerVariableList::m_fn_bDesignerVariableIsInWatchWindow(CString csDesignerVariable)
{
POSITION pos=m_fn_posGetPosition(csDesignerVariable);
if(pos!=NULL)
return GetAt(pos)->m_fn_bIsInWatchWindow();
else
return FALSE;
}
/****************************************************************************/
void CPA_EdIR_DesignerVariableList::m_fn_vDesignerVariableSetInWatchWindow(CString csDesignerVariable,BOOL bIsInWatchWindow)
{
POSITION pos=m_fn_posGetPosition(csDesignerVariable);
if(pos!=NULL)
GetAt(pos)->m_fn_vSetInWatchWindow(bIsInWatchWindow);
}
//BEGIN ROMTEAM Cristi Petrescu 98-06-
//****************************************************************************
BOOL CPA_EdIR_DesignerVariableList::m_fn_bIsPrivateDesignerVariable(CString csDesignerVariable)
{
POSITION pos=m_fn_posGetPosition(csDesignerVariable);
if(pos!=NULL)
return GetAt(pos)->m_fn_bIsPrivate ();
else
return FALSE;
}
//END ROMTEAM Cristi Petrescu 98-06-
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,519 @@
// EdIRDVVw.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRDVVw.hpp"
#include "EdIRDV.hpp"
#include "EdIRIRD.hpp"
#include "EdIRBeEn.hpp"
//BEGIN ROMTEAM Cristi Petrescu 98-06-
#include "edirfrm.hpp"
//END ROMTEAM Cristi Petrescu 98-06-
#include "EdIRCtl.hpp"
#include "EdIRQuer.hpp"
#include "ai_intf.hpp"
#include "Ctl.h"
#include "EDACDoc.hpp"
#include "EDACModl.hpp"
#include "incAI.h"
//ANNECY CB
#include "x:\cpa\main\inc\_EditID.h"
#include "_Ainterf.hpp"
#include "_Actors.hpp"
#include "EDIRGlob.hpp"
//END
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//BEGIN ROMTEAM Cristi Petrescu 98-06-
#define UP_SPACING 70
//END ROMTEAM Cristi Petrescu 98-06-
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_DesignerVariablesView
/////////////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNCREATE(CPA_EdIR_DesignerVariablesView, CFormView)
BEGIN_MESSAGE_MAP(CPA_EdIR_DesignerVariablesView, CTL_Editor_BaseFormView)
//{{AFX_MSG_MAP(CPA_EdIR_DesignerVariablesView)
ON_WM_SIZE()
// ON_BN_CLICKED(IDC_CHECK1, OnCheckClicked)
ON_BN_CLICKED(IDC_CHECK_SHOW_PRIVATE, OnCheckShowPrivate)
//}}AFX_MSG_MAP
//CPA2 Stegaru Cristian 98-06
ON_BN_CLICKED (IDC_CHECK_HIDE_VAR_FOR_MODEL, OnCheckHideVariableForModel)
//End CPA2 Stegaru Cristian 98-06
END_MESSAGE_MAP()
/*
//ANNECY CB
void CPA_EdIR_DesignerVariablesView::OnCheckClicked(void)
{
CButton *pbut = (CButton *) GetDlgItem(IDC_CHECK1);
AfxGetApp()->DoWaitCursor(1);
SetCapture();
if(pbut->GetCheck())
{
m_bHideVars = TRUE;
m_fn_vUpdateDisplay();
}
else
{
m_bHideVars = FALSE;
m_fn_vUpdateControls(m_pclListOfDesignerVariableControl);
CPA_Actor *pclSelectedActor;
CPA_DLLBase *pclActorDLL=(CPA_DLLBase*)(g_pclAIInterface->GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName));
CTL_Editor_DataList *pclListOfDesignerVariableType;
pclSelectedActor=(CPA_Actor *)pclActorDLL->OnQueryAction(g_pclAIInterface,C_uiActor_GetSelectedActor,0);
if(pclSelectedActor)
{
pclListOfDesignerVariableType=pclSelectedActor->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType;
m_fn_vUpdateDisplayWithValues(pclListOfDesignerVariableType);
}
}
AfxGetApp()->DoWaitCursor(-1);
ReleaseCapture();
}
//END
*/
//BEGIN ROMTEAM Cristi Petrescu 98-06-
//**********************************************************************************
void CPA_EdIR_DesignerVariablesView::OnCheckShowPrivate()
{
CButton *pbut = (CButton *) GetDlgItem(IDC_CHECK_SHOW_PRIVATE);
AfxGetApp()->DoWaitCursor(1);
SetCapture();
CPA_EdIR_Frame *pclIRMainFrame = g_pclAIInterface->m_pclIRMainFrame;
if (pclIRMainFrame)
{
CPA_EdIR_Brain *pclBrain = pclIRMainFrame -> m_pclBrain;
if (pclBrain)
{
pclBrain -> m_bShowPrivateVariable = ! pclBrain -> m_bShowPrivateVariable;
pbut -> SetCheck (pclBrain -> m_bShowPrivateVariable);
// for saving... should notify the model actor somehow
pclBrain -> m_fn_pclGetModel () -> fn_vNotifySave ();
m_fn_vUpdateDisplay();
}
}
AfxGetApp()->DoWaitCursor(-1);
ReleaseCapture();
}
//END ROMTEAM Cristi Petrescu 98-06-
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : OnCheckHideVariableForModel
// Date : 98-06
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CPA_EdIR_DesignerVariablesView::OnCheckHideVariableForModel ()
{
CButton *pbut = (CButton *) GetDlgItem(IDC_CHECK_HIDE_VAR_FOR_MODEL);
AfxGetApp()->DoWaitCursor(1);
SetCapture();
CPA_Actor *pclSelectedActor;
CPA_DLLBase *pclActorDLL=(CPA_DLLBase*)(g_pclAIInterface->GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName));
CTL_Editor_DataList *pclListOfDesignerVariableType;
pclSelectedActor=(CPA_Actor *)pclActorDLL->OnQueryAction(g_pclAIInterface,C_uiActor_GetSelectedActor,0);
if(pclSelectedActor)
{
if(pbut->GetCheck())
{
pclSelectedActor->mfn_vCheckHideVar (TRUE);
m_fn_vUpdateDisplay();
}
else
{
pclSelectedActor->mfn_vCheckHideVar (FALSE);
m_fn_vUpdateControls(m_pclListOfDesignerVariableControl);
pclListOfDesignerVariableType=pclSelectedActor->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType;
m_fn_vUpdateDisplayWithValues(pclListOfDesignerVariableType);
}
}
AfxGetApp()->DoWaitCursor(-1);
ReleaseCapture();
}
/**********************************************************************************/
CPA_EdIR_DesignerVariablesView::CPA_EdIR_DesignerVariablesView()
:CTL_Editor_BaseFormView(IDD, TRUE)
{
//{{AFX_DATA_INIT(CPA_EdIR_DesignerVariablesView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pclListOfDesignerVariableControl=NULL;
m_ulOldHeight=0;
//ANNECY CB
m_bCanUpdateControls = TRUE;
//ANNECY Shaitan Correction (16/04/98) {
m_bHideVars = TRUE;
//ENDANNECY Shaitan Correction }
//END
}
/**********************************************************************************/
CPA_EdIR_DesignerVariablesView::~CPA_EdIR_DesignerVariablesView()
{
}
/**********************************************************************************/
void CPA_EdIR_DesignerVariablesView::DoDataExchange(CDataExchange* pDX)
{
CTL_Editor_BaseFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPA_EdIR_DesignerVariablesView)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_DesignerVariablesView diagnostics
#ifdef _DEBUG
/**********************************************************************************/
void CPA_EdIR_DesignerVariablesView::AssertValid() const
{
CTL_Editor_BaseFormView::AssertValid();
}
/**********************************************************************************/
void CPA_EdIR_DesignerVariablesView::Dump(CDumpContext& dc) const
{
CTL_Editor_BaseFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_DesignerVariablesView message handlers
/**********************************************************************************/
void CPA_EdIR_DesignerVariablesView::OnInitialUpdate()
{
HINSTANCE hOldInstance=AfxGetResourceHandle();
AfxSetResourceHandle(g_stAIIdentity.hModule);
CTL_Editor_BaseFormView::OnInitialUpdate();
//ANNECY Shaitan Correction (16/04/98) {
// ((CButton *)GetDlgItem(IDC_CHECK1))->SetCheck(m_bHideVars);
//ENDANNECY Shaitan Correction }
fn_pclGetEdActorsDocument()->m_pclDesignerVariablesView=this;
//CPA2 Stegaru Cristian 98-06
if (FALSE == g_pclAIInterface->m_bIsOpened)
EnableWindow (FALSE);
else //opened
EnableWindow ();
//End CPA2 Stegaru Cristian 98-06
AfxSetResourceHandle(hOldInstance);
}
//*******************************************************************************
void CPA_EdIR_DesignerVariablesView::OnSize(UINT nType, int cx, int cy)
{
CTL_Editor_BaseFormView::OnSize(nType, cx, cy);
//ANNECY CB
if(m_pclListOfDesignerVariableControl!=NULL)
{
CRect cr;
GetClientRect(cr);
CPoint cpOffset=GetScrollPosition();
//BEGIN ROMTEAM Cristi Petrescu 98-06-
cpOffset.y -= UP_SPACING;
//END ROMTEAM Cristi Petrescu 98-06-
CPoint cpTopLeft(0,-cpOffset.y);
CPoint cpTopRight(cr.Width(),-cpOffset.y);
m_pclListOfDesignerVariableControl->m_pub_fn_vDisplayControlsInZone(cpTopLeft,cpTopRight);
}
// m_fn_vUpdateDisplay();
//END
}
/**********************************************************************************/
void CPA_EdIR_DesignerVariablesView::m_fn_vUpdateControls(CTL_Editor_ControlList *pclListOfDesignerVariableControl)
{
//ANNECY CB
if(m_bCanUpdateControls == FALSE)
return;
// m_fn_vSetViewHeight(0);
//END
//ANNECY CB
//CPA2 Stegaru Cristian 98-06
if (m_pclListOfDesignerVariableControl != pclListOfDesignerVariableControl)
//End CPA2 Stegaru Cristian 98-06
//END
if(m_pclListOfDesignerVariableControl!=NULL)
{
POSITION pos=m_pclListOfDesignerVariableControl->GetHeadPosition();
while(pos!=NULL)
m_pclListOfDesignerVariableControl->GetNext(pos)->m_fn_vHide();
}
m_pclListOfDesignerVariableControl=pclListOfDesignerVariableControl;
//ANNECY CB
//CPA2 Stegaru Cristian 98-06
if((mfn_bHideVariables ())||(m_pclListOfDesignerVariableControl==NULL))
//End CPA2 Stegaru Cristian 98-06
return;
CString csMsgBase="Updating vars controls ... ";
fn_vDisplayInfoInStatusBar(csMsgBase,C_STATUS_NORMAL);
//END
CTL_fn_vSetDefaultCallBackFunctionWhenStaticIsClicked(fn_vOnButtonClick);
CTL_fn_vSetDefaultCallBackFunctionToGetStaticColor(fn_vGetStaticColor);
// BEGIN ROMTEAM Cristi Petrescu 98-11-
CTL_fn_vSetModuleInfo("TIA","Designer Variables");
POSITION pos=m_pclListOfDesignerVariableControl->GetHeadPosition();
while(pos!=NULL)
{
CTL_Editor_Control *pclEditor_Control=m_pclListOfDesignerVariableControl->GetNext(pos);
if(!pclEditor_Control->m_pub_fn_bHasBeenCreated())
{
// CTL_fn_vSetModuleInfo("TIA","Designer Variables");
pclEditor_Control->m_fn_bCreateControl(this);
}
}
CTL_fn_vResetModuleInfo();
// END ROMTEAM Cristi Petrescu 98-11-
CTL_fn_vSetDefaultCallBackFunctionWhenStaticIsClicked(NULL);
CTL_fn_vSetDefaultCallBackFunctionToGetStaticColor(NULL);
//ANNECY CB
CString csMsg=csMsgBase+"OK";
fn_vDisplayInfoInStatusBar(csMsg,C_STATUS_NORMAL);
//END
}
/**********************************************************************************/
void CPA_EdIR_DesignerVariablesView::m_fn_vUpdateValues(CTL_Editor_DataList *pclListOfDesignerVariableType)
{
if(m_pclListOfDesignerVariableControl == NULL)
return;
if(pclListOfDesignerVariableType->GetCount()!=m_pclListOfDesignerVariableControl->GetCount())
{
MessageBox("Pb with designer variable");
return;
}
POSITION posCtl=m_pclListOfDesignerVariableControl->GetHeadPosition();
POSITION posVal=pclListOfDesignerVariableType->GetHeadPosition();
while(posCtl!=NULL)
{
CTL_Editor_Control *pclEditor_Control=m_pclListOfDesignerVariableControl->GetNext(posCtl);
CTL_Editor_Data *pclEditor_BaseData=pclListOfDesignerVariableType->GetNext(posVal);
pclEditor_Control->m_fn_vSetEditedData(pclEditor_BaseData);
pclEditor_BaseData->m_fn_vGetMotorData();
}
}
/**********************************************************************************/
void CPA_EdIR_DesignerVariablesView::m_fn_vUpdateDisplayWithValues(CTL_Editor_DataList *pclListOfDesignerVariableType)
{
m_fn_vUpdateValues(pclListOfDesignerVariableType);
//ANNECY CB
//CPA2 Stegaru Cristian 98-06
if(!mfn_bHideVariables ())
//End CPA2 Stegaru Cristian 98-06
//END
m_fn_vUpdateDisplay();
}
/**********************************************************************************/
void CPA_EdIR_DesignerVariablesView::m_fn_vUpdateDisplay()
{
//CPA2 Stegaru Cristian 98-06
if (FALSE == g_pclAIInterface->m_bIsOpened)
EnableWindow (FALSE);
else //opened
EnableWindow ();
//End CPA2 Stegaru Cristian 98-06
if(m_pclListOfDesignerVariableControl!=NULL)
{
CRect cr;
GetClientRect(cr);
CPoint cpOffset=GetScrollPosition();
//ANNECY CB
//BEGIN ROMTEAM Cristi Petrescu 98-06-
cpOffset.y -= UP_SPACING;
//END ROMTEAM Cristi Petrescu 98-06-
//END
CPoint cpTopLeft(0,-cpOffset.y);
CPoint cpTopRight(cr.Width(),-cpOffset.y);
//ANNECY CB
ShowWindow(FALSE);
//END
m_pclListOfDesignerVariableControl->m_pub_fn_vDisplayControlsInZone(cpTopLeft,cpTopRight);
POSITION posCtl=m_pclListOfDesignerVariableControl->GetHeadPosition();
while(posCtl!=NULL)
{
CTL_Editor_Control *pclEditor_Control=m_pclListOfDesignerVariableControl->GetNext(posCtl);
pclEditor_Control->m_fn_vUpdate();
}
m_fn_vSetViewHeight((unsigned short)(cpTopLeft.y+GetScrollPosition().y));
//ANNECY CB
ShowWindow(TRUE);
//END
}
}
/**********************************************************************************/
void CPA_EdIR_DesignerVariablesView::m_fn_vAModelHasBeenRemoved(CTL_Editor_ControlList *pclListOfDesignerVariableControl)
{
if(m_pclListOfDesignerVariableControl==pclListOfDesignerVariableControl)
m_pclListOfDesignerVariableControl=NULL;
}
/**********************************************************************************/
void CPA_EdIR_DesignerVariablesView::m_fn_vSetOldHeight(unsigned long ulHeight)
{
m_ulOldHeight=ulHeight;
}
/**********************************************************************************/
unsigned long CPA_EdIR_DesignerVariablesView::m_fn_ulGetOldHeight()
{
return m_ulOldHeight;
}
//BEGIN ROMTEAM Cristi Petrescu 98-05-
//**********************************************************************************
CTL_Editor_Data *CPA_EdIR_DesignerVariablesView::m_fn_pclGetVariable (CString csVariableName)
{
POSITION pos = m_pclListOfDesignerVariableControl -> GetHeadPosition ();
CTL_Editor_Data *pclEditor_Data;
csVariableName . MakeLower ();
while (pos)
{
pclEditor_Data = m_pclListOfDesignerVariableControl -> GetNext (pos) -> m_fn_pclGetEditedData ();
if (pclEditor_Data -> m_pub_fn_csGetDataName () == csVariableName )
return pclEditor_Data;
}
return NULL;
}
//END ROMTEAM Cristi Petrescu 98-05-
//BEGIN ROMTEAM Cristi Petrescu 98-06-
void CPA_EdIR_DesignerVariablesView::m_fn_vSynchronizeWithBrain (CPA_EdIR_Brain *pclBrain)
{
//CPA2 Stegaru Cristian 98-06
if (!pclBrain)
return;
//End CPA2 Stegaru Cristian 98-06
((CButton *) GetDlgItem (IDC_CHECK_SHOW_PRIVATE)) -> SetCheck (pclBrain -> m_bShowPrivateVariable);
//CPA2 Stegaru Cristian 98-06
CPA_Actor *pModel = pclBrain->m_fn_pclGetModel();
if (pModel)
((CButton *)GetDlgItem (IDC_CHECK_HIDE_VAR_FOR_MODEL))->SetCheck (pModel->mfn_bIsHideVarChecked ());
//End CPA2 Stegaru Cristian 98-06
}
//END ROMTEAM Cristi Petrescu 98-06-
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : mfn_bHideVariables
// Date : 98-06
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Stegaru Cristian - CPA
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL CPA_EdIR_DesignerVariablesView::mfn_bHideVariables ()
{
if (m_bHideVars)
return m_bHideVars;
CPA_EdIR_Frame *pclIRMainFrame = g_pclAIInterface->m_pclIRMainFrame;
if (pclIRMainFrame)
{
CPA_EdIR_Brain *pclBrain = pclIRMainFrame -> m_pclBrain;
CPA_Actor *pModel = NULL;
if (pclBrain)
pModel = pclBrain->m_fn_pclGetModel();
if (pModel)
return pModel->mfn_bIsHideVarChecked ();
}
return m_bHideVars;
}
void CPA_EdIR_DesignerVariablesView::mfn_vHideVariables (BOOL bHide)
{
if (bHide)
{
m_bHideVars = TRUE;
m_fn_vUpdateDisplay();
}
else
{
m_bHideVars = FALSE;
m_fn_vUpdateControls(m_pclListOfDesignerVariableControl);
CPA_Actor *pclSelectedActor;
CPA_DLLBase *pclActorDLL=(CPA_DLLBase*)(g_pclAIInterface->GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName));
CTL_Editor_DataList *pclListOfDesignerVariableType;
pclSelectedActor=(CPA_Actor *)pclActorDLL->OnQueryAction(g_pclAIInterface,C_uiActor_GetSelectedActor,0);
if(pclSelectedActor)
{
pclListOfDesignerVariableType=pclSelectedActor->m_fn_pclGetEditorActor()->m_pclListOfDesignerVariableType;
m_fn_vUpdateDisplayWithValues(pclListOfDesignerVariableType);
}
}
}
#endif //D_ED_IR_ACTIVE

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,157 @@
// EdIRDbg.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRDbLs.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_DebugInfoList
/////////////////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_DebugInfoList::CPA_EdIR_DebugInfoList()
{
}
/****************************************************************************/
CPA_EdIR_DebugInfoList::~CPA_EdIR_DebugInfoList()
{
m_fn_vDestroyAndRemoveAllEntries();
}
/****************************************************************************/
void CPA_EdIR_DebugInfoList::m_fn_vDestroyAndRemoveAllEntries()
{
POSITION pos=GetHeadPosition();
while(pos!=NULL)
delete GetNext(pos);
RemoveAll();
}
/****************************************************************************/
CPA_EdIR_DebugInfo *CPA_EdIR_DebugInfoList::m_fn_pclGetDebugInfo(struct tdstNodeInterpret_ *pstNode)
{
POSITION pos=GetHeadPosition();
BOOL bFound=FALSE;
while(pos!=NULL && !bFound)
{
CPA_EdIR_DebugInfo *pclDebugInfo=GetAt(pos);
if(pclDebugInfo->m_fn_pstGetNode()==pstNode)
bFound=TRUE;
else
GetNext(pos);
}
if(pos!=NULL)
return GetAt(pos);
else
return NULL;
}
/****************************************************************************/
long CPA_EdIR_DebugInfoList::m_fn_lGetLineNumber(struct tdstNodeInterpret_ *pstNode)
{
CPA_EdIR_DebugInfo *pclDebugInfo=m_fn_pclGetDebugInfo(pstNode);
if(pclDebugInfo!=NULL)
return pclDebugInfo->m_fn_lGetLineNumber();
else
return -1;
}
/****************************************************************************/
long CPA_EdIR_DebugInfoList::m_fn_lGetColumnNumber(struct tdstNodeInterpret_ *pstNode)
{
CPA_EdIR_DebugInfo *pclDebugInfo=m_fn_pclGetDebugInfo(pstNode);
if(pclDebugInfo!=NULL)
return pclDebugInfo->m_fn_lGetColumnNumber();
else
return -1;
}
/****************************************************************************/
long CPA_EdIR_DebugInfoList::m_fn_lGetIndex(struct tdstNodeInterpret_ *pstNode)
{
CPA_EdIR_DebugInfo *pclDebugInfo=m_fn_pclGetDebugInfo(pstNode);
if(pclDebugInfo!=NULL)
return pclDebugInfo->m_fn_lGetIndex();
else
return -1;
}
/****************************************************************************/
CString CPA_EdIR_DebugInfoList::m_fn_csGetBehaviourName(struct tdstNodeInterpret_ *pstNode)
{
CPA_EdIR_DebugInfo *pclDebugInfo=m_fn_pclGetDebugInfo(pstNode);
if(pclDebugInfo!=NULL)
return pclDebugInfo->m_fn_csGetBehaviourName();
else
return "";
}
/****************************************************************************/
struct tdstNodeInterpret_ *CPA_EdIR_DebugInfoList::m_fn_pstGetNode(long lIndex,CString csBehaviourName)
{
POSITION pos=GetHeadPosition();
BOOL bFound=FALSE;
while(pos!=NULL && !bFound)
{
CPA_EdIR_DebugInfo *pclDebugInfo=GetAt(pos);
if((pclDebugInfo->m_fn_csGetBehaviourName()==csBehaviourName) &&
(pclDebugInfo->m_fn_lGetIndex()>lIndex))
bFound=TRUE;
else
GetNext(pos);
}
if(pos!=NULL)
return GetAt(pos)->m_fn_pstGetNode();
else
return NULL;
}
//BEGIN ROMTEAM Cristi Petrescu 98-05-
/****************************************************************************/
BOOL CPA_EdIR_DebugInfoList::m_fn_bExecuted (long lIndex)
{
POSITION pos = GetHeadPosition ();
BOOL bExecuted = FALSE;
while (pos)
{
CPA_EdIR_DebugInfo *pclDebugInfo = GetNext (pos);
if (pclDebugInfo -> m_fn_lGetIndex () > lIndex)
{
break;
}
if (pclDebugInfo -> m_fn_lGetIndex () == lIndex)
{
bExecuted = TRUE;
break;
}
}
return bExecuted;
}
//END ROMTEAM Cristi Petrescu 98-05-
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,75 @@
// EdIRDbg.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRDbg.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_DebugInfo
/////////////////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_DebugInfo::CPA_EdIR_DebugInfo(struct tdstNodeInterpret_ *pstNode,
long lLineNumber,
long lColumnNumber,
long lIndex,
//ANNECY CB
CString &csBehaviourName)
// CString csBehaviourName)
//END
{
m_pstNode =pstNode;
m_lLineNumber =lLineNumber;
m_lColumnNumber =lColumnNumber;
m_lIndex =lIndex;
m_csBehaviourName =csBehaviourName;
m_bExecuted = FALSE;
// BEGIN ROMTEAM Cristi Petrescu 98-08-
m_lMacroIndex = -1;
m_csMacroName = "";
// END ROMTEAM Cristi Petrescu 98-08-
}
/****************************************************************************/
struct tdstNodeInterpret_ *CPA_EdIR_DebugInfo::m_fn_pstGetNode()
{
return m_pstNode;
}
/****************************************************************************/
long CPA_EdIR_DebugInfo::m_fn_lGetLineNumber()
{
return m_lLineNumber;
}
/****************************************************************************/
long CPA_EdIR_DebugInfo::m_fn_lGetColumnNumber()
{
return m_lColumnNumber;
}
/****************************************************************************/
long CPA_EdIR_DebugInfo::m_fn_lGetIndex()
{
return m_lIndex;
}
/****************************************************************************/
CString CPA_EdIR_DebugInfo::m_fn_csGetBehaviourName()
{
return m_csBehaviourName;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,414 @@
// EdIRDict.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRDict.hpp"
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_WordEntry
//////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_WordEntry::CPA_EdIR_WordEntry()
{
m_csLanguage=C_INVALID_WORD;
m_csWord=C_INVALID_LANGUAGE;
}
/****************************************************************************/
CPA_EdIR_WordEntry::CPA_EdIR_WordEntry(CString csWord,CString csLanguage)
{
m_csWord=csWord;
m_csLanguage=csLanguage;
}
/****************************************************************************/
CString CPA_EdIR_WordEntry::m_fn_csGetLanguage()
{
ASSERT(M_LANGUAGE_IS_VALID(m_csLanguage));
return m_csLanguage;
}
/****************************************************************************/
CString CPA_EdIR_WordEntry::m_fn_csGetWord()
{
ASSERT(M_WORD_IS_VALID(m_csWord));
return m_csWord;
}
/****************************************************************************/
void CPA_EdIR_WordEntry::m_fn_vSetLanguage(CString csLanguage)
{
ASSERT(M_LANGUAGE_IS_VALID(csLanguage));
ASSERT(M_LANGUAGE_IS_INVALID(m_csLanguage));
m_csLanguage=csLanguage;
}
/****************************************************************************/
void CPA_EdIR_WordEntry::m_fn_vSetWord(CString csWord)
{
ASSERT(M_WORD_IS_VALID(csWord));
ASSERT(M_WORD_IS_INVALID(m_csWord));
m_csWord=csWord;
}
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_DictionnaryEntry
//////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_DictionnaryEntry::CPA_EdIR_DictionnaryEntry(long lNbEntries)
{
m_pclWordEntries=new CPA_EdIR_WordEntry[lNbEntries];
m_csScriptName=C_INVALID_SCRIPTNAME;
m_lId=C_INVALID_ID;
m_lNbEntries=lNbEntries;
m_lCurrentEntry=0;
//ANNECY CB
memset(m_acFirstLetter, 0, 256 * sizeof(char));
memset(m_acSecondLetter, 0, 256 * sizeof(char));
//END ANNECY
}
/****************************************************************************/
CPA_EdIR_DictionnaryEntry::~CPA_EdIR_DictionnaryEntry()
{
delete[] m_pclWordEntries;
}
/****************************************************************************/
void CPA_EdIR_DictionnaryEntry::m_fn_vAddEntry(CString csWord,CString csLanguage)
{
ASSERT(m_lCurrentEntry<m_lNbEntries);
//ANNECY CB
m_acFirstLetter[toupper(((LPCSTR) csWord)[0])] = 1;
m_acFirstLetter[tolower(((LPCSTR) csWord)[0])] = 1;
m_acSecondLetter[toupper(((LPCSTR) csWord)[1])] = 1;
m_acSecondLetter[tolower(((LPCSTR) csWord)[1])] = 1;
//END
m_pclWordEntries[m_lCurrentEntry].m_fn_vSetWord(csWord);
m_pclWordEntries[m_lCurrentEntry].m_fn_vSetLanguage(csLanguage);
m_lCurrentEntry++;
}
/****************************************************************************/
CString CPA_EdIR_DictionnaryEntry::m_fn_csGetScriptName()
{
ASSERT(M_SCRIPTNAME_IS_VALID(m_csScriptName));
return m_csScriptName;
}
/****************************************************************************/
long CPA_EdIR_DictionnaryEntry::m_fn_lGetId()
{
ASSERT(M_ID_IS_VALID(m_lId));
return m_lId;
}
/****************************************************************************/
void CPA_EdIR_DictionnaryEntry::m_fn_vSetScriptName(CString csScriptName)
{
ASSERT(M_SCRIPTNAME_IS_VALID(csScriptName));
ASSERT(M_SCRIPTNAME_IS_INVALID(m_csScriptName));
m_csScriptName=csScriptName;
}
/****************************************************************************/
void CPA_EdIR_DictionnaryEntry::m_fn_vSetId(long lId)
{
ASSERT(M_ID_IS_VALID(lId));
ASSERT(M_ID_IS_INVALID(m_lId));
m_lId=lId;
}
/****************************************************************************/
CString CPA_EdIR_DictionnaryEntry::m_fn_csGetName(CString csLanguage)
{
long lIndex=0;
BOOL bFound=FALSE;
while(lIndex<m_lCurrentEntry && !bFound)
{
bFound=(csLanguage.CompareNoCase(m_pclWordEntries[lIndex].m_fn_csGetLanguage())==0);
lIndex++;
}
if(bFound)
return m_pclWordEntries[lIndex-1].m_fn_csGetWord();
else
return C_INVALID_WORD;
}
/****************************************************************************/
CString CPA_EdIR_DictionnaryEntry::m_fn_csTranslate(CString csWord,CString csLanguage)
{
//Looks for this word in this dictionnary entry
BOOL bWordFound=(csWord==C_INVALID_WORD);
long lIndex=0;
while(lIndex<m_lCurrentEntry && !bWordFound)
{
bWordFound=(csWord.CompareNoCase(m_pclWordEntries[lIndex].m_fn_csGetWord())==0);
lIndex++;
}
//Gets the corresponding word in the "csLanguage"
if(bWordFound)
{
long lIndex=0;
BOOL bFound=FALSE;
while(lIndex<m_lCurrentEntry && !bFound)
{
bFound=(csLanguage.CompareNoCase(m_pclWordEntries[lIndex].m_fn_csGetLanguage())==0);
lIndex++;
}
if(bFound)
return m_pclWordEntries[lIndex-1].m_fn_csGetWord();
else
return C_INVALID_WORD;
}
else
return C_INVALID_WORD;
}
/****************************************************************************/
//ANNECY CB
BOOL CPA_EdIR_DictionnaryEntry::m_fn_bEntryExists(CString &csWord,CString &csLanguage)
//BOOL CPA_EdIR_DictionnaryEntry::m_fn_bEntryExists(CString csWord,CString csLanguage)
//END
{
//ANNECY CB
LPCSTR pszWord = (LPCSTR) csWord, pszLanguage = (LPCSTR) csLanguage;
//END
//Looks for this (word,language) in this dictionnary entry
BOOL bFound=(csWord=="");
long lIndex=0;
//ANNECY CB
while(lIndex<m_lCurrentEntry && !bFound)
{
if(!strcmpi(pszWord, (LPCSTR) m_pclWordEntries[lIndex].m_csWord))
if(!strcmpi(pszLanguage, (LPCSTR) m_pclWordEntries[lIndex].m_csLanguage))
return TRUE;
// bFound=(csWord.CompareNoCase(m_pclWordEntries[lIndex].m_fn_csGetWord())==0) &&
// (csLanguage.CompareNoCase(m_pclWordEntries[lIndex].m_fn_csGetLanguage())==0);
lIndex++;
}
//END
return bFound;
}
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_Dictionary
//////////////////////////////////////////////////////////////////
typedef CPA_EdIR_DictionnaryEntry *CPA_EdIR_DictionnaryEntryPointer;
/****************************************************************************/
CPA_EdIR_Dictionary::CPA_EdIR_Dictionary(long lNbDictionnaryEntries,long lNbLanguages)
{
m_ppclDictionnaryEntry=new CPA_EdIR_DictionnaryEntryPointer[lNbDictionnaryEntries];
for(long lIndex=0;lIndex<lNbDictionnaryEntries;lIndex++)
m_ppclDictionnaryEntry[lIndex]=new CPA_EdIR_DictionnaryEntry(lNbLanguages);
m_lNbEntries=lNbDictionnaryEntries;
m_lCurrentEntry=0;
m_pstCouple=NULL;
m_csOldLanguage1="";
m_csOldLanguage2="";
//ANNECY CB
memset(m_acFirstLetter, 0, 256 * sizeof(char));
memset(m_acSecondLetter, 0, 256 * sizeof(char));
//END ANNECY
}
/****************************************************************************/
CPA_EdIR_Dictionary::~CPA_EdIR_Dictionary()
{
for(long lIndex=0;lIndex<m_lNbEntries;lIndex++)
delete[] m_ppclDictionnaryEntry[lIndex];
delete[] m_ppclDictionnaryEntry;
if(m_pstCouple)
delete[] m_pstCouple;
}
/****************************************************************************/
long CPA_EdIR_Dictionary::m_fn_lGetNbEntries()
{
return m_lNbEntries;
}
/****************************************************************************/
void CPA_EdIR_Dictionary::m_fn_vAddEntry(CString csScriptName,long lId,CString csWord,CString csLanguage)
{
//Looks for this word (with this lId) in the dictionnary
long lIndex=0;
BOOL bFound=FALSE;
//ANNECY CB
m_acFirstLetter[toupper(((LPCSTR) csWord)[0])] = 1;
m_acFirstLetter[tolower(((LPCSTR) csWord)[0])] = 1;
m_acSecondLetter[toupper(((LPCSTR) csWord)[1])] = 1;
m_acSecondLetter[tolower(((LPCSTR) csWord)[1])] = 1;
//END
while(lIndex<m_lCurrentEntry && !bFound)
{
bFound=(lId==m_ppclDictionnaryEntry[lIndex]->m_fn_lGetId());
lIndex++;
}
//Adds the entry
if(bFound)
{
m_ppclDictionnaryEntry[lIndex-1]->m_fn_vAddEntry(csWord,csLanguage);
}
else
{
ASSERT(m_lCurrentEntry<m_lNbEntries);
m_ppclDictionnaryEntry[m_lCurrentEntry]->m_fn_vAddEntry(csWord,csLanguage);
m_ppclDictionnaryEntry[m_lCurrentEntry]->m_fn_vSetId(lId);
m_ppclDictionnaryEntry[m_lCurrentEntry]->m_fn_vSetScriptName(csScriptName);
m_lCurrentEntry++;
}
}
/****************************************************************************/
//ANNECY CB
long CPA_EdIR_Dictionary::m_fn_lGetId(CString &csWord,CString &csLanguage)
//long CPA_EdIR_Dictionary::m_fn_lGetId(CString csWord,CString csLanguage)
//END
{
//Looks for this (word,language) in the dictionnary
long lIndex=0;
BOOL bFound=FALSE;
//ANNECY CB
LPCSTR pcsWord = (LPCSTR) csWord;
if(m_acFirstLetter[pcsWord[0]] == 0)
return C_INVALID_ID;
if(m_acSecondLetter[pcsWord[1]] == 0)
return C_INVALID_ID;
//END
while(lIndex<m_lCurrentEntry && !bFound)
{
//ANNECY CB
if((m_ppclDictionnaryEntry[lIndex]->m_acFirstLetter[pcsWord[0]])
&& (m_ppclDictionnaryEntry[lIndex]->m_acSecondLetter[pcsWord[1]]))
//END
bFound=m_ppclDictionnaryEntry[lIndex]->m_fn_bEntryExists(csWord,csLanguage);
lIndex++;
}
if(bFound)
return m_ppclDictionnaryEntry[lIndex-1]->m_fn_lGetId();
else
return C_INVALID_ID;
}
/****************************************************************************/
//ANNECY CB
CString CPA_EdIR_Dictionary::m_fn_csGetWord(long lId,CString &csLanguage)
//CString CPA_EdIR_Dictionary::m_fn_csGetWord(long lId,CString csLanguage)
//END
{
//Looks for this "lId" in the dictionnary
long lIndex=0;
BOOL bFound=FALSE;
while(lIndex<m_lCurrentEntry && !bFound)
{
bFound=(lId==m_ppclDictionnaryEntry[lIndex]->m_fn_lGetId());
lIndex++;
}
if(bFound)
return m_ppclDictionnaryEntry[lIndex-1]->m_fn_csGetName(csLanguage);
else
return C_INVALID_WORD;
}
/****************************************************************************/
CString CPA_EdIR_Dictionary::m_fn_csTranslate(CString csWord,CString csLanguage)
{
CString csTranslation=C_INVALID_WORD;
long lIndex=0;
while((lIndex<m_lCurrentEntry) && M_WORD_IS_INVALID(csTranslation))
{
csTranslation=m_ppclDictionnaryEntry[lIndex]->m_fn_csTranslate(csWord,csLanguage);
lIndex++;
}
return csTranslation;
}
/****************************************************************************/
int CPA_EdIR_Dictionary::m_fn_iCompareNoCase(const void *pcsWord1,const void *pcsWord2)
{
return ((CString *)pcsWord1)->CompareNoCase(*((CString *)pcsWord2));
}
/****************************************************************************/
void CPA_EdIR_Dictionary::m_fn_vInitFastTranslation(CString csLanguage1,CString csLanguage2)
{
if((m_csOldLanguage1.CompareNoCase(csLanguage1)!=0) ||
(m_csOldLanguage2.CompareNoCase(csLanguage2)!=0))
{
m_csOldLanguage1=csLanguage1;
m_csOldLanguage2=csLanguage2;
if(m_pstCouple)
delete[] m_pstCouple;
m_pstCouple=new CPA_EdIR_stCouple[m_lNbEntries];
for(long lIndex=0;lIndex<m_lNbEntries;lIndex++)
{
m_pstCouple[lIndex].csWord=m_ppclDictionnaryEntry[lIndex]->m_fn_csGetName(csLanguage1);
m_pstCouple[lIndex].csTranslatedWord=m_ppclDictionnaryEntry[lIndex]->m_fn_csGetName(csLanguage2);
}
qsort(m_pstCouple,m_lNbEntries,sizeof(CPA_EdIR_stCouple),m_fn_iCompareNoCase);
}
}
/****************************************************************************/
CString CPA_EdIR_Dictionary::m_fn_csFastTranslate(CString csWord)
{
CPA_EdIR_stCouple *pstCouple;
pstCouple=(CPA_EdIR_stCouple *)bsearch((void *)(&csWord),m_pstCouple,m_lNbEntries,sizeof(CPA_EdIR_stCouple),m_fn_iCompareNoCase);
if(pstCouple!=NULL)
return pstCouple->csTranslatedWord;
else
return C_INVALID_WORD;
}
#endif //D_ED_IR_ACTIVE

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,274 @@
// EdIRGlob.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRGlob.hpp"
#include "EdIRStrg.hpp"
#include "acp_base.h"
#include "ITF.h"
//ANNECY CB
#include "EDIRBis.hpp"
#include "EDIRFlx.hpp"
BOOL gbFirstShowBrain = FALSE;
//END ANNECY
#define M_ISALNUM(c) (isalnum(c) || (c)=='_' || (c)=='-' || (c)=='.')
/**********************************************************************************/
long fn_lSkipRightAlphaNumChar(CString &csString,long lIndex)
{
long lResultIndex=lIndex;
long lStringLen=csString.GetLength();
if(lIndex<lStringLen)
{
while(lResultIndex<=lStringLen-1 && M_ISALNUM(csString[int(lResultIndex)]))
lResultIndex++;
}
return lResultIndex;
}
/**********************************************************************************/
long fn_lSkipRightNonAlphaNumChar(CString &csString,long lIndex)
{
long lResultIndex=lIndex;
long lStringLen=csString.GetLength();
if(lIndex<lStringLen)
{
while(lResultIndex<=lStringLen-1 && !M_ISALNUM(csString[int(lResultIndex)]))
lResultIndex++;
}
return lResultIndex;
}
/*************************************************************************/
CString fn_csGetNextWord(CString &csString,long &lIndex)
{
#if 0
long lWordStartIndex=fn_lSkipRightNonAlphaNumChar(csString,lIndex);
long lWordEndIndex=fn_lSkipRightAlphaNumChar(csString,lWordStartIndex);
lIndex=lWordEndIndex;
return csString.Mid(lWordStartIndex,lWordEndIndex-lWordStartIndex);
#endif
char mot[4096];
long lmot = 0;
LPCSTR pin = (LPCSTR) csString;
while(pin[lIndex] && !M_ISALNUM(pin[lIndex])) lIndex++;
while(M_ISALNUM(pin[lIndex])) mot[lmot++] = pin[lIndex++];
mot[lmot] = '\0';
return mot;
}
/*************************************************************************/
//ANNECY CB
CString fn_csGetNextNonWord(CString &csString,long &lIndex)
//CString fn_csGetNextNonWord(CString csString,long &lIndex)
//END
{
long lWordStartIndex=lIndex;
long lWordEndIndex=fn_lSkipRightNonAlphaNumChar(csString,lIndex);
lIndex=lWordEndIndex;
return csString.Mid(lWordStartIndex,lWordEndIndex-lWordStartIndex);
}
/**********************************************************************************/
BOOL fn_bGetNextLine(CString csText,long &lIndex,CString &csLine)
{
CString csTemp=csText.Right(csText.GetLength()-lIndex);
BOOL bRes=FALSE;
long lTempIndex=csTemp.Find('\n');
if(lTempIndex!=-1)
{
csLine=csTemp.Left(lTempIndex-1);
lIndex+=lTempIndex+1;
bRes=TRUE;
}
else
if(!csTemp.IsEmpty())
{
csLine=csTemp;
lIndex=csText.GetLength();
bRes=TRUE;
}
else
bRes=FALSE;
return bRes;
}
/**********************************************************************************/
BOOL fn_bGetLine(CString csText,long lLineNumber,CString &csLine)
{
CString csTemp=csText;
long lCurLine=0;
long lIndex;
long lOldIndex=0;
long lStartIndex=-1;
long lEndIndex=-1;
while((lIndex=csTemp.Find('\n'))!=-1 && lStartIndex==-1)
{
csTemp=csTemp.Right(csTemp.GetLength()-lIndex-1);
if(lCurLine==lLineNumber)
{
lStartIndex=lOldIndex;
//Subbs 2 because '\n' is two character
lEndIndex=lOldIndex+lIndex-2;
}
lCurLine++;
//Adds lIndex+1 because '\n' is two character
lOldIndex+=lIndex+1;
}
if(lStartIndex==-1)
{
if(lCurLine==lLineNumber)
{
lStartIndex=lOldIndex;
lEndIndex=csText.GetLength();
}
else
return FALSE;
}
csLine=csText.Mid(lStartIndex,lEndIndex-lStartIndex+1);
return TRUE;
}
/**********************************************************************************/
CString fn_csReplaceChar(CString csText,char cOldChar,char cNewChar)
{
CString csNewText=csText;
long lIndex;
long lNewIndex=0;
while((lIndex=csText.Find(cOldChar))!=-1)
{
csText=csText.Right(csText.GetLength()-lIndex-1);
lNewIndex+=lIndex+1;
csNewText.SetAt(lNewIndex-1,cNewChar);
}
return csNewText;
}
/**********************************************************************************/
char *fn_pc_StrStrWordOnly(char *pcStart,char *pcString)
{
long lTextLen=strlen(pcStart);
long lStringLen=strlen(pcString);
char *pcIndex=pcStart;
BOOL bFound=FALSE;
while(pcIndex!=NULL && !bFound)
{
bFound= (pcIndex>pcStart) &&
(M_ISALNUM(pcIndex[-1])==FALSE) &&
(pcIndex+lStringLen<=pcStart+lTextLen) &&
(M_ISALNUM(pcIndex[lStringLen])==FALSE);
if(!bFound)
pcIndex++;
}
return pcIndex;
}
/**********************************************************************************/
char *fn_pc_StrStrNoCase(char *pcStart,char *pcString)
{
long lTextLen=strlen(pcStart);
long lStringLen=strlen(pcString);
long lIndex=0;
char *pcIndex=pcStart;
while(lIndex<lTextLen)
{
if(strnicmp(pcIndex,pcString,lStringLen)==0)
return pcIndex;
lIndex++;
pcIndex++;
}
return NULL;
}
/**********************************************************************************/
CString fn_csReplaceString(CString csText,CString csOldString,CString csNewString)
{
CString csNewText;
long lTextLen=csText.GetLength();
long lOldStringLen=csOldString.GetLength();
if(lTextLen!=0)
{
char *pcText=new char[lTextLen+1];
strcpy(pcText,LPCTSTR(csText));
/* Processes replacement */
char *pcIndex;
char *pcOldIndex=pcText;
pcIndex=fn_pc_StrStrNoCase(pcOldIndex,M_MAKECHAR(csOldString));
while(pcIndex!=NULL)
{
//Adds old text
char cOldChar=*pcIndex;
*pcIndex=0;
csNewText+=pcOldIndex;
*pcIndex=cOldChar;
//Replaces old text with the new one
csNewText+=csNewString;
pcIndex+=csOldString.GetLength();
pcOldIndex=pcIndex;
pcIndex=fn_pc_StrStrNoCase(pcOldIndex,M_MAKECHAR(csOldString));
}
csNewText+=pcOldIndex;
}
return csNewText;
}
/**********************************************************************************/
void fn_vDisplayInfoInStatusBar(CString csMsg,int iInfoType)
{
if((iInfoType == C_STATUS_ERROR) && (g_clParse.m_bNoError==FALSE))
{
csMsg = "ERROR: "+g_clParse.m_csMsgError+" ("+g_clLex.yytext+")";
M_GetMainWnd()->UpdateStatus(M_MAKECHAR(csMsg),C_STATUSPANE_INFOS,iInfoType);
g_clParse.m_bNoError=TRUE;
}
else
M_GetMainWnd()->UpdateStatus(M_MAKECHAR(csMsg),C_STATUSPANE_INFOS,iInfoType);
}
#endif //D_ED_IR_ACTIVE

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,242 @@
// EdIRIC.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRIC.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_IntermediateCode
//////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_IntermediateCode::CPA_EdIR_IntermediateCode()
{
m_lOffset=0;
m_eNodeType=eInvalidNode;
m_ucDepth=0;
m_eType=eInvalidType;
m_lIndex=0;
m_pclModel=NULL;
m_dfValue=0.0;
MTH3D_M_vNullVector(&(m_tdstVector));
m_csString="";
}
/****************************************************************************/
CPA_EdIR_IntermediateCode::CPA_EdIR_IntermediateCode(CPA_EdIR_IntermediateCode *pclIntermediateCode)
{
m_lOffset=pclIntermediateCode->m_lOffset;
m_eNodeType=pclIntermediateCode->m_eNodeType;
m_ucDepth=pclIntermediateCode->m_ucDepth;
m_eType=pclIntermediateCode->m_eType;
m_lIndex=pclIntermediateCode->m_lIndex;
m_pclModel=pclIntermediateCode->m_pclModel;
m_dfValue=pclIntermediateCode->m_dfValue;
MTH3D_M_vCopyVector(&(m_tdstVector),&(pclIntermediateCode->m_tdstVector));
m_csString=pclIntermediateCode->m_csString;
}
/****************************************************************************/
CPA_EdIR_IntermediateCode::CPA_EdIR_IntermediateCode(long lOffset,tdeNodeType eNodeType,long lIndex,CPA_Actor *pclModel)
{
m_lOffset=lOffset;
m_eNodeType=eNodeType;
m_ucDepth=0;
m_eType=eUseLong;
m_lIndex=lIndex;
m_pclModel=pclModel;
m_dfValue=0.0;
MTH3D_M_vNullVector(&(m_tdstVector));
m_csString="";
}
/****************************************************************************/
CPA_EdIR_IntermediateCode::CPA_EdIR_IntermediateCode(long lOffset,tdeNodeType eNodeType,double dfValue)
{
m_lOffset=lOffset;
m_eNodeType=eNodeType;
m_ucDepth=0;
m_eType=eUseReal;
m_lIndex=0;
m_pclModel=NULL;
m_dfValue=dfValue;
MTH3D_M_vNullVector(&(m_tdstVector));
m_csString="";
}
/****************************************************************************/
CPA_EdIR_IntermediateCode::CPA_EdIR_IntermediateCode(long lOffset,tdeNodeType eNodeType,
double dfX,double dfY,double dfZ)
{
m_lOffset=lOffset;
m_eNodeType=eNodeType;
m_ucDepth=0;
m_eType=eUseVector;
m_lIndex=0;
m_pclModel=NULL;
m_dfValue=0.0;
MTH3D_M_vSetVectorElements(&(m_tdstVector),MTH_M_xDoubleToReal(dfX),MTH_M_xDoubleToReal(dfY),MTH_M_xDoubleToReal(dfZ));
m_csString="";
}
/****************************************************************************/
CPA_EdIR_IntermediateCode::CPA_EdIR_IntermediateCode(long lOffset,tdeNodeType eNodeType,CString csString)
{
m_lOffset=lOffset;
m_eNodeType=eNodeType;
m_ucDepth=0;
m_eType=eUseString;
m_lIndex=0;
m_pclModel=NULL;
m_dfValue=0.0;
MTH3D_M_vNullVector(&(m_tdstVector));
m_csString=csString;
}
/****************************************************************************/
CString CPA_EdIR_IntermediateCode::m_fn_csGetValue()
{
CString csValue;
switch(m_eType)
{
case eUseLong:
csValue.Format("%ld",m_lIndex);
break;
case eUseReal:
csValue.Format("%f",m_dfValue);
break;
case eUseVector:
csValue.Format("%f,%f,%f",
MTH3D_M_xGetXofVector(&(m_tdstVector)),
MTH3D_M_xGetYofVector(&(m_tdstVector)),
MTH3D_M_xGetZofVector(&(m_tdstVector)));
break;
case eUseString:
csValue=m_csString;
break;
default:
AfxMessageBox("[DEV : CPA_EdIR_IntermediateCode::m_fn_csGetValue] Unknown type !!!");
}
return csValue;
}
/****************************************************************************/
long CPA_EdIR_IntermediateCode::m_fn_lGetIndex()
{
ASSERT(m_eType==eUseLong);
return m_lIndex;
}
/****************************************************************************/
CPA_Actor *CPA_EdIR_IntermediateCode::m_fn_pclGetModel()
{
ASSERT(m_eType==eUseLong);
return m_pclModel;
}
/****************************************************************************/
double CPA_EdIR_IntermediateCode::m_fn_dfGetValue()
{
ASSERT(m_eType==eUseReal);
return m_dfValue;
}
/****************************************************************************/
MTH3D_tdstVector CPA_EdIR_IntermediateCode::m_fn_tdstGetVector()
{
ASSERT(m_eType==eUseVector);
return m_tdstVector;
}
/****************************************************************************/
CString CPA_EdIR_IntermediateCode::m_fn_csGetString()
{
/////////////////////////////////////////////////////////////////////////////////
//TEMPORAIRE
// ASSERT(m_eType==eUseString);
ASSERT(m_eType!=eInvalidType);
return m_csString;
}
/****************************************************************************/
long CPA_EdIR_IntermediateCode::m_fn_lGetOffset()
{
return m_lOffset;
}
/****************************************************************************/
tdeNodeType CPA_EdIR_IntermediateCode::m_fn_tdeGetNodeType()
{
return m_eNodeType;
}
/****************************************************************************/
unsigned char CPA_EdIR_IntermediateCode::m_fn_ucGetDepth()
{
return m_ucDepth;
}
/****************************************************************************/
void CPA_EdIR_IntermediateCode::m_fn_vSetIndex(long lIndex)
{
m_eType=eUseLong;
m_lIndex=lIndex;
}
/****************************************************************************/
void CPA_EdIR_IntermediateCode::m_fn_vSetValue(double dfValue)
{
m_eType=eUseReal;
m_dfValue=dfValue;
}
/****************************************************************************/
void CPA_EdIR_IntermediateCode::m_fn_vSetNodeType(tdeNodeType eNodeType)
{
m_eNodeType=eNodeType;
}
/****************************************************************************/
void CPA_EdIR_IntermediateCode::m_fn_vSetDepth(unsigned char ucDepth)
{
m_ucDepth=ucDepth;
}
/****************************************************************************/
void CPA_EdIR_IntermediateCode::m_fn_vSetModel(CPA_Actor *pclModel)
{
m_pclModel=pclModel;
}
/////////////////////////////////////////////////////////////////////////////////
//TEMPORAIRE
/****************************************************************************/
void CPA_EdIR_IntermediateCode::m_fn_vSetString(CString csString)
{
m_csString=csString;
}
/////////////////////////////////////////////////////////////////////////////////
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,348 @@
// EdIRICLs.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRICLs.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_IntermediateCodeNode
//////////////////////////////////////////////////////////////////
CPA_EdIR_IntermediateCodeList::CPA_EdIR_IntermediateCodeNode::CPA_EdIR_IntermediateCodeNode(CPA_EdIR_IntermediateCode *pclData)
{
m_pclData=pclData;
m_pclNextNode=NULL;
}
CPA_EdIR_IntermediateCodeList::CPA_EdIR_IntermediateCodeNode::~CPA_EdIR_IntermediateCodeNode()
{
delete m_pclData;
}
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_IntermediateCodeList
//////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_IntermediateCodeList::CPA_EdIR_IntermediateCodeList()
{
m_pclIntermediateCodeHead=NULL;
m_pclIntermediateCodeTail=NULL;
m_lNbEntries=0;
}
/****************************************************************************/
CPA_EdIR_IntermediateCodeList::CPA_EdIR_IntermediateCodeList(CPA_EdIR_IntermediateCodeList &clIntermediateCodeList)
{
m_pclIntermediateCodeHead=clIntermediateCodeList.m_pclIntermediateCodeHead;
m_pclIntermediateCodeTail=clIntermediateCodeList.m_pclIntermediateCodeTail;
m_lNbEntries=clIntermediateCodeList.m_lNbEntries;
}
/****************************************************************************/
CPA_EdIR_IntermediateCodeList::~CPA_EdIR_IntermediateCodeList()
{
}
/****************************************************************************/
void CPA_EdIR_IntermediateCodeList::m_fn_vDestroyAndRemoveAllEntries()
{
CPA_EdIR_IntermediateCodeNode *pclCurrentNode=m_pclIntermediateCodeHead;
CPA_EdIR_IntermediateCodeNode *pclTmpNode;
while(pclCurrentNode!=NULL)
{
pclTmpNode=pclCurrentNode->m_pclNextNode;
delete pclCurrentNode;
pclCurrentNode=pclTmpNode;
}
m_pclIntermediateCodeHead=NULL;
m_pclIntermediateCodeTail=NULL;
m_lNbEntries=0;
}
/****************************************************************************/
void CPA_EdIR_IntermediateCodeList::m_fn_vMakeEmpty()
{
m_pclIntermediateCodeHead=NULL;
m_pclIntermediateCodeTail=NULL;
m_lNbEntries=0;
}
/****************************************************************************/
BOOL CPA_EdIR_IntermediateCodeList::IsEmpty()
{
return m_lNbEntries==0;
}
/****************************************************************************/
long CPA_EdIR_IntermediateCodeList::GetCount()
{
return m_lNbEntries;
}
/****************************************************************************/
void CPA_EdIR_IntermediateCodeList::AddTail(CPA_EdIR_IntermediateCode *pclIntermediateCode)
{
m_fn_vAdd(pclIntermediateCode);
}
/****************************************************************************/
POSITION CPA_EdIR_IntermediateCodeList::FindIndex(long lIndex)
{
CPA_EdIR_IntermediateCodeNode *pclCurrentNode=m_pclIntermediateCodeHead;
long lCurrentIndex=0;
while(pclCurrentNode!=NULL && lCurrentIndex<lIndex)
{
pclCurrentNode=pclCurrentNode->m_pclNextNode;
lCurrentIndex++;
}
return (POSITION)pclCurrentNode;
}
/****************************************************************************/
POSITION CPA_EdIR_IntermediateCodeList::GetHeadPosition()
{
return (POSITION)m_pclIntermediateCodeHead;
}
/****************************************************************************/
CPA_EdIR_IntermediateCode *CPA_EdIR_IntermediateCodeList::GetAt(POSITION pos)
{
ASSERT(pos!=NULL);
return ((CPA_EdIR_IntermediateCodeNode *)pos)->m_pclData;
}
/****************************************************************************/
CPA_EdIR_IntermediateCode *CPA_EdIR_IntermediateCodeList::GetNext(POSITION &pos)
{
ASSERT(pos!=NULL);
CPA_EdIR_IntermediateCodeNode *pclNode=(CPA_EdIR_IntermediateCodeNode *)pos;
pos=(POSITION)pclNode->m_pclNextNode;
return pclNode->m_pclData;
}
/****************************************************************************/
CPA_EdIR_IntermediateCode *CPA_EdIR_IntermediateCodeList::GetHead()
{
if(m_pclIntermediateCodeHead!=NULL)
return m_pclIntermediateCodeHead->m_pclData;
else
return NULL;
}
/****************************************************************************/
CPA_EdIR_IntermediateCode *CPA_EdIR_IntermediateCodeList::GetTail()
{
if(m_pclIntermediateCodeTail!=NULL)
return m_pclIntermediateCodeTail->m_pclData;
else
return NULL;
}
/****************************************************************************/
void CPA_EdIR_IntermediateCodeList::m_fn_vAdd(long lOffset,tdeNodeType eNodeType,long lIndex,CPA_Actor *pclModel)
{
CPA_EdIR_IntermediateCode *pclIntermediateCode=new CPA_EdIR_IntermediateCode(lOffset,eNodeType,lIndex,pclModel);
m_fn_vAdd(pclIntermediateCode);
}
/****************************************************************************/
void CPA_EdIR_IntermediateCodeList::m_fn_vAdd(long lOffset,tdeNodeType eNodeType,double dfValue)
{
CPA_EdIR_IntermediateCode *pclIntermediateCode=new CPA_EdIR_IntermediateCode(lOffset,eNodeType,dfValue);
m_fn_vAdd(pclIntermediateCode);
}
/****************************************************************************/
void CPA_EdIR_IntermediateCodeList::m_fn_vAdd(long lOffset,tdeNodeType eNodeType,CString csString)
{
CPA_EdIR_IntermediateCode *pclIntermediateCode=new CPA_EdIR_IntermediateCode(lOffset,eNodeType,csString);
m_fn_vAdd(pclIntermediateCode);
}
/****************************************************************************/
void CPA_EdIR_IntermediateCodeList::m_fn_vAdd(CPA_EdIR_IntermediateCode *pclIntermediateCode)
{
if(m_lNbEntries==0)
{
m_pclIntermediateCodeHead=new CPA_EdIR_IntermediateCodeNode(pclIntermediateCode);
m_pclIntermediateCodeTail=m_pclIntermediateCodeHead;
}
else
{
m_pclIntermediateCodeTail->m_pclNextNode=new CPA_EdIR_IntermediateCodeNode(pclIntermediateCode);
m_pclIntermediateCodeTail=m_pclIntermediateCodeTail->m_pclNextNode;
}
m_lNbEntries++;
}
/****************************************************************************/
void CPA_EdIR_IntermediateCodeList::m_fn_vConcat(CPA_EdIR_IntermediateCodeList &clIntermediateCodeList)
{
if(clIntermediateCodeList.m_lNbEntries!=0)
{
if(m_lNbEntries==0)
{
m_pclIntermediateCodeHead=clIntermediateCodeList.m_pclIntermediateCodeHead;
m_pclIntermediateCodeTail=clIntermediateCodeList.m_pclIntermediateCodeTail;
}
else
{
m_pclIntermediateCodeTail->m_pclNextNode=clIntermediateCodeList.m_pclIntermediateCodeHead;
m_pclIntermediateCodeTail=clIntermediateCodeList.m_pclIntermediateCodeTail;
}
m_lNbEntries+=clIntermediateCodeList.m_lNbEntries;
}
}
/****************************************************************************/
CPA_EdIR_IntermediateCodeList CPA_EdIR_IntermediateCodeList::operator =(CPA_EdIR_IntermediateCodeList &clIntermediateCodeList)
{
m_pclIntermediateCodeHead=clIntermediateCodeList.m_pclIntermediateCodeHead;
m_pclIntermediateCodeTail=clIntermediateCodeList.m_pclIntermediateCodeTail;
m_lNbEntries=clIntermediateCodeList.m_lNbEntries;
return *this;
}
/****************************************************************************/
CPA_EdIR_IntermediateCodeList CPA_EdIR_IntermediateCodeList::operator =(CPA_EdIR_IntermediateCode *pclIntermediateCode)
{
m_pclIntermediateCodeHead=new CPA_EdIR_IntermediateCodeNode(pclIntermediateCode);
m_pclIntermediateCodeTail=m_pclIntermediateCodeHead;
m_lNbEntries=1;
return *this;
}
/****************************************************************************/
CString CPA_EdIR_IntermediateCodeList::m_fn_csGetValue(long lIndex)
{
CString csValue;
POSITION pos=FindIndex(lIndex);
if(pos!=NULL)
{
csValue=GetAt(pos)->m_fn_csGetValue();
}
else
{
AfxMessageBox("[DEV CPA_EdIR_IntermediateCodeList::m_fn_csGetValue] pos==NULL !!");
}
return csValue;
}
/****************************************************************************/
long CPA_EdIR_IntermediateCodeList::m_fn_lGetIndex(long lIndex)
{
long lIndexRes=-1;
POSITION pos=FindIndex(lIndex);
if(pos!=NULL)
{
lIndexRes=GetAt(pos)->m_fn_lGetIndex();
}
else
{
AfxMessageBox("[DEV CPA_EdIR_IntermediateCodeList::m_fn_lGetIndex] pos==NULL !!");
}
return lIndexRes;
}
/****************************************************************************/
double CPA_EdIR_IntermediateCodeList::m_fn_dfGetValue(long lIndex)
{
double dfValue=0.0;
POSITION pos=FindIndex(lIndex);
if(pos!=NULL)
{
dfValue=GetAt(pos)->m_fn_dfGetValue();
}
else
{
AfxMessageBox("[DEV CPA_EdIR_IntermediateCodeList::m_fn_dfGetValue] pos==NULL !!");
}
return dfValue;
}
/****************************************************************************/
MTH3D_tdstVector CPA_EdIR_IntermediateCodeList::m_fn_tdstGetVector(long lIndex)
{
MTH3D_tdstVector tdstVector;
POSITION pos=FindIndex(lIndex);
MTH3D_M_vNullVector(&(tdstVector));
if(pos!=NULL)
{
tdstVector=GetAt(pos)->m_fn_tdstGetVector();
}
else
{
AfxMessageBox("[DEV CPA_EdIR_IntermediateCodeList::m_fn_tdstGetVector] pos==NULL !!");
}
return tdstVector;
}
/****************************************************************************/
void CPA_EdIR_IntermediateCodeList::m_fn_vSetIndex(long lIndex,long lValue)
{
long lIndexRes=-1;
POSITION pos=FindIndex(lIndex);
if(pos!=NULL)
{
GetAt(pos)->m_fn_vSetIndex(lValue);
}
else
{
AfxMessageBox("[DEV CPA_EdIR_IntermediateCodeList::m_fn_vSetIndex] pos==NULL !!");
}
}
/****************************************************************************/
void CPA_EdIR_IntermediateCodeList::m_fn_vSetModel(long lIndex,CPA_Actor *pclModel)
{
long lIndexRes=-1;
POSITION pos=FindIndex(lIndex);
if(pos!=NULL)
{
GetAt(pos)->m_fn_vSetModel(pclModel);
}
else
{
AfxMessageBox("[DEV CPA_EdIR_IntermediateCodeList::m_fn_vSetModel] pos==NULL !!");
}
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,582 @@
// EdIRLoad.cpp : implementation of the CEdIAFrame class
//
#include "stdafx.h"
#include "Defines.hpp"
//#ifdef D_ED_IR_ACTIVE
#include "EdIRFrm.hpp"
#include "EdIRStrg.hpp"
#include "EdIRIRD.hpp"
#include "EdIRBeEn.hpp"
#include "EdIRGlob.hpp"
#include "EdIRIAWd.hpp"
#include "EDACModl.hpp"
#include "ai_intf.hpp"
#include "TFA.h"
#include "incAI.h"
#include "x:\cpa\main\inc\_EditID.h"
#include "_Actors.hpp"
#include "ITF.h"
#include "GAM.h"
#include "GMT.h"
#include "DPT.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_Frame load script
/**********************************************************************************/
/* CHRISTOPHE QUICK SAVE MODIFICATIONS { */
#include "EdIRRes.h"
class CQuickSave : public CDialog
{
public:
CString msg;
CQuickSave(int);
virtual BOOL OnInitDialog()
{
CDialog::OnInitDialog();
CStatic *pstat = (CStatic *) GetDlgItem(IDC_STATIC);
pstat->SetWindowText(msg);
return TRUE;
}
afx_msg void OnYes() { EndDialog(IDYES); }
afx_msg void OnNo() { EndDialog(IDNO); }
afx_msg void OnNoAll() { EndDialog(IDNOALL); }
afx_msg void OnDelete() { EndDialog(IDDELETE); }
afx_msg void OnDeleteAll() { EndDialog(IDDELETEALL); }
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CQuickSave, CDialog)
ON_COMMAND(IDYES,OnYes)
ON_COMMAND(IDNO,OnNo)
ON_COMMAND(IDNOALL,OnNoAll)
ON_COMMAND(IDDELETE,OnDelete)
ON_COMMAND(IDDELETEALL,OnDeleteAll)
END_MESSAGE_MAP()
BOOL QuickSaveDeleteAll = FALSE;
BOOL QuickSaveNoAll = FALSE;
CQuickSave::CQuickSave(int n) : CDialog(n) {}
int QuickSaveDialog(CString text)
{
CQuickSave Dial(IDD_QUICKSAVE);
Dial.msg = text;
return Dial.DoModal();
}
/**********************************************************************************/
void CPA_EdIR_Frame::m_fn_vLoadBrain(CPA_Actor *pclModel,CString csModelName)
{
//Loads Intelligence
CString csFileName=csModelName+g_c_csIntelligenceFileExtension;
CString csFileNameQS=csModelName+g_c_csIntelligenceFileExtensionQS;
CString csSectionName=csFileName+'^'+g_c_csIntelligenceSectionName;
CString csSectionNameQS=csFileNameQS+'^'+g_c_csIntelligenceSectionName;
BOOL bQuickSaveFileExists=FALSE;
BOOL bLoadQuickSaveFile=FALSE;
BOOL bAsksQuestion=TRUE;
BOOL bDeleteQuick = FALSE;
SCR_tdst_Cxt_Values *p_stValues;
char Path[255], File[255];
char *psz_Temp;
CString csBaseMsg="Would you like to load QuickSave for ";
char *psz_Famil = fn_szGetFamiliesDataPath();
SCR_M_RdL0_SetContextLong(1,0,(long)(((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_pclBrain));
bQuickSaveFileExists=FALSE;
bDeleteQuick=FALSE;
if(QuickSaveNoAll == FALSE)
bQuickSaveFileExists=SCR_fn_c_RdL0_IsSectionExists(M_MAKECHAR(csSectionNameQS));
if(bQuickSaveFileExists)
{
CString csMsg=csBaseMsg+csModelName+" model ?";
if((QuickSaveDeleteAll == FALSE)&&(bAsksQuestion))
{
int iRes = QuickSaveDialog(csMsg);
switch(iRes)
{
case IDYES: bLoadQuickSaveFile = TRUE; break;
case IDNO: bLoadQuickSaveFile = FALSE; break;
case IDNOALL: bLoadQuickSaveFile = FALSE; QuickSaveNoAll = TRUE; break;
case IDDELETE: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; break;
case IDDELETEALL: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; QuickSaveDeleteAll = TRUE; break;
}
}
bAsksQuestion=FALSE;
if(bDeleteQuick || QuickSaveDeleteAll)
{
strcpy(Path, psz_Famil);
strcat(Path, "\\");
strcpy(File, (char *) (LPCSTR) csSectionNameQS);
psz_Temp = strrchr(File, '^');
if(psz_Temp)
{
*psz_Temp = '\0';
strcat(Path, File);
chmod(Path, _S_IWRITE);
unlink(Path);
}
bLoadQuickSaveFile = FALSE;
}
else if (bLoadQuickSaveFile)
{
CPA_EdIR_Brain *pclBrain=((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_pclBrain;
pclBrain->m_fn_vSetModified(TRUE);
pclBrain->m_fn_vNotify();
// for instances
CPA_List<CPA_BaseObject> clInstancesList;
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clInstancesList,"",C_szActorInstanceTypeName,pclModel);
POSITION pos1=clInstancesList.GetHeadPosition();
while(pos1!=NULL)
{
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetNext(pos1));
tdstEngineObject *pstEngineObject=(tdstEngineObject *)pclInstance->GetStruct();
MS_tdxHandleToBrain hBrain=pstEngineObject->h_Brain;
if(hBrain)
AI_M_ucErrorFlag(M_pstGetMindOfBrain(hBrain))=1;
}
}
}
if(bLoadQuickSaveFile)
p_stValues=SCR_fnp_st_RdL0_AnalyseSection(M_MAKECHAR(csSectionNameQS),SCR_CDF_uw_Anl_Normal);
else
p_stValues=SCR_fnp_st_RdL0_AnalyseSection(M_MAKECHAR(csSectionName),SCR_CDF_uw_Anl_Normal);
//Loads Reflex
csFileName=csModelName+g_c_csReflexFileExtension;
csFileNameQS=csModelName+g_c_csReflexFileExtensionQS;
csSectionName=csFileName+'^'+g_c_csReflexSectionName;
csSectionNameQS=csFileNameQS+'^'+g_c_csReflexSectionName;
SCR_M_RdL0_SetContextLong(1,0,(long)(((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_pclBrain));
bQuickSaveFileExists=FALSE;
if(QuickSaveNoAll == FALSE)
bQuickSaveFileExists=SCR_fn_c_RdL0_IsSectionExists(M_MAKECHAR(csSectionNameQS));
if(bQuickSaveFileExists)
{
CString csMsg=csBaseMsg+csModelName+" model ?";
if((QuickSaveDeleteAll == FALSE)&&(bAsksQuestion))
{
int iRes = QuickSaveDialog(csMsg);
switch(iRes)
{
case IDYES: bLoadQuickSaveFile = TRUE; break;
case IDNO: bLoadQuickSaveFile = FALSE; break;
case IDNOALL: bLoadQuickSaveFile = FALSE; QuickSaveNoAll = TRUE; break;
case IDDELETE: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; break;
case IDDELETEALL: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; QuickSaveDeleteAll = TRUE; break;
}
}
bAsksQuestion=FALSE;
if(bDeleteQuick || QuickSaveDeleteAll)
{
strcpy(Path, psz_Famil);
strcat(Path, "\\");
strcpy(File, (char *) (LPCSTR) csSectionNameQS);
psz_Temp = strrchr(File, '^');
if(psz_Temp)
{
*psz_Temp = '\0';
strcat(Path, File);
chmod(Path, _S_IWRITE);
unlink(Path);
}
bLoadQuickSaveFile = FALSE;
}
}
if(bLoadQuickSaveFile)
p_stValues=SCR_fnp_st_RdL0_AnalyseSection(M_MAKECHAR(csSectionNameQS),SCR_CDF_uw_Anl_Normal);
else
p_stValues=SCR_fnp_st_RdL0_AnalyseSection(M_MAKECHAR(csSectionName),SCR_CDF_uw_Anl_Normal);
//Loads Declaration
csFileName=csModelName+g_c_csDeclarationFileExtension;
csFileNameQS=csModelName+g_c_csDeclarationFileExtensionQS;
csSectionName=csFileName+'^'+g_c_csDeclarationSectionName;
csSectionNameQS=csFileNameQS+'^'+g_c_csDeclarationSectionName;
SCR_M_RdL0_SetContextLong(1,0,(long)(((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_pclBrain));
bQuickSaveFileExists=FALSE;
if(QuickSaveNoAll == FALSE)
bQuickSaveFileExists=SCR_fn_c_RdL0_IsSectionExists(M_MAKECHAR(csSectionNameQS));
if(bQuickSaveFileExists)
{
CString csMsg=csBaseMsg+csModelName+" model ?";
if((QuickSaveDeleteAll == FALSE)&&(bAsksQuestion))
{
int iRes = QuickSaveDialog(csMsg);
switch(iRes)
{
case IDYES: bLoadQuickSaveFile = TRUE; break;
case IDNO: bLoadQuickSaveFile = FALSE; break;
case IDNOALL: bLoadQuickSaveFile = FALSE; QuickSaveNoAll = TRUE; break;
case IDDELETE: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; break;
case IDDELETEALL: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; QuickSaveDeleteAll = TRUE; break;
}
}
bAsksQuestion=FALSE;
if(bDeleteQuick || QuickSaveDeleteAll)
{
strcpy(Path, psz_Famil);
strcat(Path, "\\");
strcpy(File, (char *) (LPCSTR) csSectionNameQS);
psz_Temp = strrchr(File, '^');
if(psz_Temp)
{
*psz_Temp = '\0';
strcat(Path, File);
chmod(Path, _S_IWRITE);
unlink(Path);
}
bLoadQuickSaveFile = FALSE;
}
}
if(bLoadQuickSaveFile)
p_stValues=SCR_fnp_st_RdL0_AnalyseSection(M_MAKECHAR(csSectionNameQS),SCR_CDF_uw_Anl_Normal);
else
p_stValues=SCR_fnp_st_RdL0_AnalyseSection(M_MAKECHAR(csSectionName),SCR_CDF_uw_Anl_Normal);
//BEGIN ROMTEAM Cristi Petrescu 98-04-
//Loads Macros
csFileName=csModelName+g_c_csMacroFileExtension;
csFileNameQS=csModelName+g_c_csMacroFileExtensionQS;
csSectionName=csFileName+'^'+g_c_csMacroSectionName;
csSectionNameQS=csFileNameQS+'^'+g_c_csMacroSectionName;
SCR_M_RdL0_SetContextLong(1,0,(long)(((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_pclBrain));
bQuickSaveFileExists=FALSE;
if(QuickSaveNoAll == FALSE)
bQuickSaveFileExists=SCR_fn_c_RdL0_IsSectionExists(M_MAKECHAR(csSectionNameQS));
if(bQuickSaveFileExists)
{
CString csMsg=csBaseMsg+csModelName+" model ?";
if((QuickSaveDeleteAll == FALSE)&&(bAsksQuestion))
{
int iRes = QuickSaveDialog(csMsg);
switch(iRes)
{
case IDYES: bLoadQuickSaveFile = TRUE; break;
case IDNO: bLoadQuickSaveFile = FALSE; break;
case IDNOALL: bLoadQuickSaveFile = FALSE; QuickSaveNoAll = TRUE; break;
case IDDELETE: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; break;
case IDDELETEALL: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; QuickSaveDeleteAll = TRUE; break;
}
}
bAsksQuestion=FALSE;
if(bDeleteQuick || QuickSaveDeleteAll)
{
strcpy(Path, psz_Famil);
strcat(Path, "\\");
strcpy(File, (char *) (LPCSTR) csSectionNameQS);
psz_Temp = strrchr(File, '^');
if(psz_Temp)
{
*psz_Temp = '\0';
strcat(Path, File);
chmod(Path, _S_IWRITE);
unlink(Path);
}
bLoadQuickSaveFile = FALSE;
}
}
if(bLoadQuickSaveFile)
{
if (SCR_fn_c_RdL0_IsSectionExists(M_MAKECHAR(csSectionNameQS)))
p_stValues=SCR_fnp_st_RdL0_AnalyseSection(M_MAKECHAR(csSectionNameQS),SCR_CDF_uw_Anl_Normal);
}
else
{
if (SCR_fn_c_RdL0_IsSectionExists(M_MAKECHAR(csSectionName)))
p_stValues=SCR_fnp_st_RdL0_AnalyseSection(M_MAKECHAR(csSectionName),SCR_CDF_uw_Anl_Normal);
}
//Loads Subrs
csFileName=csModelName+g_c_csSubrFileExtension;
csFileNameQS=csModelName+g_c_csSubrFileExtensionQS;
csSectionName=csFileName+'^'+g_c_csSubrSectionName;
csSectionNameQS=csFileNameQS+'^'+g_c_csSubrSectionName;
SCR_M_RdL0_SetContextLong(1,0,(long)(((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_pclBrain));
bQuickSaveFileExists=FALSE;
if(QuickSaveNoAll == FALSE)
bQuickSaveFileExists=SCR_fn_c_RdL0_IsSectionExists(M_MAKECHAR(csSectionNameQS));
if(bQuickSaveFileExists)
{
CString csMsg=csBaseMsg+csModelName+" model ?";
if((QuickSaveDeleteAll == FALSE)&&(bAsksQuestion))
{
int iRes = QuickSaveDialog(csMsg);
switch(iRes)
{
case IDYES: bLoadQuickSaveFile = TRUE; break;
case IDNO: bLoadQuickSaveFile = FALSE; break;
case IDNOALL: bLoadQuickSaveFile = FALSE; QuickSaveNoAll = TRUE; break;
case IDDELETE: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; break;
case IDDELETEALL: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; QuickSaveDeleteAll = TRUE; break;
}
}
bAsksQuestion=FALSE;
if(bDeleteQuick || QuickSaveDeleteAll)
{
strcpy(Path, psz_Famil);
strcat(Path, "\\");
strcpy(File, (char *) (LPCSTR) csSectionNameQS);
psz_Temp = strrchr(File, '^');
if(psz_Temp)
{
*psz_Temp = '\0';
strcat(Path, File);
chmod(Path, _S_IWRITE);
unlink(Path);
}
bLoadQuickSaveFile = FALSE;
}
}
if(bLoadQuickSaveFile)
{
if (SCR_fn_c_RdL0_IsSectionExists(M_MAKECHAR(csSectionNameQS)))
p_stValues=SCR_fnp_st_RdL0_AnalyseSection(M_MAKECHAR(csSectionNameQS),SCR_CDF_uw_Anl_Normal);
}
else
{
if (SCR_fn_c_RdL0_IsSectionExists(M_MAKECHAR(csSectionName)))
p_stValues=SCR_fnp_st_RdL0_AnalyseSection(M_MAKECHAR(csSectionName),SCR_CDF_uw_Anl_Normal);
}
//END ROMTEAM Cristi Petrescu 98-04-
}
/* } END CHRISTOPHE QUICK SAVE MODIFICATIONS */
/**********************************************************************************/
SCR_tde_Anl_ReturnValue CPA_EdIR_Frame::m_fn_tdeCallBackLoadIntelligence(SCR_tdst_File_Description *pfFile,
char *szAction,
char *szPars[],
SCR_tde_Anl_Action eType)
{
if(eType==SCR_EA_Anl_BeginSection)
{
CPA_EdIR_Brain *p_clBrain;
SCR_M_RdL0_GetContextLong(0,0,CPA_EdIR_Brain *,p_clBrain);
SCR_M_RdL0_SetContextLong(1,0,long(&(p_clBrain->m_clListOfIntelligenceBehaviours)));
SCR_M_RdL0_SetContextLong(1,1,long(p_clBrain->m_fn_pclGetModel()));
}
return SCR_ERV_Anl_NormalReturn;
}
/**********************************************************************************/
SCR_tde_Anl_ReturnValue CPA_EdIR_Frame::m_fn_tdeCallBackLoadReflex(SCR_tdst_File_Description *pfFile,
char *szAction,
char *szPars[],
SCR_tde_Anl_Action eType)
{
if(eType==SCR_EA_Anl_BeginSection)
{
CPA_EdIR_Brain *p_clBrain;
SCR_M_RdL0_GetContextLong(0,0,CPA_EdIR_Brain *,p_clBrain);
SCR_M_RdL0_SetContextLong(1,0,long(&(p_clBrain->m_clListOfReflexBehaviours)));
SCR_M_RdL0_SetContextLong(1,1,long(p_clBrain->m_fn_pclGetModel()));
}
return SCR_ERV_Anl_NormalReturn;
}
/**********************************************************************************/
SCR_tde_Anl_ReturnValue CPA_EdIR_Frame::m_fn_tdeCallBackLoadDeclaration(SCR_tdst_File_Description *pfFile,
char *szAction,
char *szPars[],
SCR_tde_Anl_Action eType)
{
if(eType==SCR_EA_Anl_BeginSection)
{
CPA_EdIR_Brain *p_clBrain;
SCR_M_RdL0_GetContextLong(0,0,CPA_EdIR_Brain *,p_clBrain);
SCR_M_RdL0_SetContextLong(1,0,long(&(p_clBrain->m_clListOfDeclarations)));
SCR_M_RdL0_SetContextLong(1,1,long(p_clBrain->m_fn_pclGetModel()));
}
return SCR_ERV_Anl_NormalReturn;
}
// BEGIN CPA2 Cristi Petrescu 98-03-
/**********************************************************************************/
SCR_tde_Anl_ReturnValue CPA_EdIR_Frame::m_fn_tdeCallBackLoadMacro(SCR_tdst_File_Description *pfFile,
char *szAction,
char *szPars[],
SCR_tde_Anl_Action eType)
{
if(eType==SCR_EA_Anl_BeginSection)
{
CPA_EdIR_Brain *p_clBrain;
SCR_M_RdL0_GetContextLong(0,0,CPA_EdIR_Brain *,p_clBrain);
SCR_M_RdL0_SetContextLong(1,0,long(&(p_clBrain->m_clListOfMacros)));
SCR_M_RdL0_SetContextLong(1,1,long(p_clBrain->m_fn_pclGetModel()));
}
return SCR_ERV_Anl_NormalReturn;
}
// END CPA2 Cristi Petrescu 98-03-
// BEGIN ROMTEAM CPA2 Cristi Petrescu 98-04-
/**********************************************************************************/
SCR_tde_Anl_ReturnValue CPA_EdIR_Frame::m_fn_tdeCallBackLoadSubr(SCR_tdst_File_Description *pfFile,
char *szAction,
char *szPars[],
SCR_tde_Anl_Action eType)
{
if(eType==SCR_EA_Anl_BeginSection)
{
CPA_EdIR_Brain *p_clBrain;
SCR_M_RdL0_GetContextLong(0,0,CPA_EdIR_Brain *,p_clBrain);
SCR_M_RdL0_SetContextLong(1,0,long(&(p_clBrain->m_clListOfSubrs)));
SCR_M_RdL0_SetContextLong(1,1,long(p_clBrain->m_fn_pclGetModel()));
}
return SCR_ERV_Anl_NormalReturn;
}
// END ROMTEAM CPA2 Cristi Petrescu 98-04-
/**********************************************************************************/
SCR_tde_Anl_ReturnValue CPA_EdIR_Frame::m_fn_tdeCreateMainBehaviour(SCR_tdst_File_Description *pfFile,
char *szAction,
char *szPars[],
SCR_tde_Anl_Action eType)
{
static CPA_EdIR_MainBehaviour *s_pclMainBehaviour;
static CString s_csLanguage;
if(eType==SCR_EA_Anl_BeginSection)
{
CPA_Actor *pclModel;
SCR_M_RdL0_GetContextLong(0,1,CPA_Actor *,pclModel);
s_pclMainBehaviour=new CPA_EdIR_MainBehaviour(pclModel);
s_csLanguage="French";
}
else
if(eType==SCR_EA_Anl_Entry)
{
if(strcmpi(szAction,g_c_csBehaviourLanguage)==0)
{
s_csLanguage=szPars[0];
}
else
if(strcmpi(szAction,g_c_csBehaviourName)==0)
{
if(s_pclMainBehaviour->fn_eRename(CString(szPars[0]))!=E_mc_None)
s_pclMainBehaviour->SetDefaultUniqueName();
}
else
if(strcmpi(szAction,g_c_csBehaviourBoundingBox)==0)
{
s_pclMainBehaviour->m_crPosition.left=atol(szPars[0]);
s_pclMainBehaviour->m_crPosition.top=atol(szPars[1]);
s_pclMainBehaviour->m_crPosition.right=atol(szPars[2]);
s_pclMainBehaviour->m_crPosition.bottom=atol(szPars[3]);
}
else
if(strcmpi(szAction,g_c_csBehaviourText)==0)
{
//Old file format
if(SCR_fn_uc_RdL0_GetNumberOfParameters(szPars)==3)
{
CFile cfFile;
CString csFileName;
csFileName=fn_szGetFamiliesDataPath()+CString("\\")+
CString(szPars[0]);
if(cfFile.Open(csFileName,CFile::modeRead))
{
long lOffset=atol(szPars[1]);
long lLen=atol(szPars[2]);
char *p_cBuf=new char[lLen+1];
cfFile.Seek(lOffset,CFile::begin);
cfFile.Read(p_cBuf,lLen);
p_cBuf[lLen]=0;
s_pclMainBehaviour->m_csText=p_cBuf;
delete[] p_cBuf;
cfFile.Close();
}
}
//New file format
else
{
CString csLine=CString(szPars[0]);
csLine=fn_csReplaceChar(csLine,'\'','\"');
s_pclMainBehaviour->m_csText+=csLine+"\xD\xA";
}
}
}
else
if(eType==SCR_EA_Anl_EndSection)
{
CPA_EdIR_MainBehaviourList *p_clMainBehaviourList;
SCR_M_RdL0_GetContextLong(0,0,CPA_EdIR_MainBehaviourList *,p_clMainBehaviourList);
//Deletes the last "\xD\xA" sequence
if(s_pclMainBehaviour->m_csText.Right(2).CompareNoCase("\xD\xA")==0)
s_pclMainBehaviour->m_csText=s_pclMainBehaviour->m_csText.Left(s_pclMainBehaviour->m_csText.GetLength()-2);
//Translates text if needed
CString csCurrentLanguage=g_pclAIInterface->M_GetMainWorld()->GetInterface()->fn_csGetCurrentLanguage();
if(s_csLanguage!=csCurrentLanguage)
{
//s_pclMainBehaviour->m_csText=fn_csTranslateText(s_pclMainBehaviour->m_csText,csCurrentLanguage);
s_pclMainBehaviour->m_csText=fn_csFastTranslateText(s_pclMainBehaviour->m_csText,s_csLanguage,csCurrentLanguage);
}
p_clMainBehaviourList->AddTail(s_pclMainBehaviour);
}
return SCR_ERV_Anl_NormalReturn;
}
//#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,69 @@
// EdIRMac.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRMac.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_Macro
//////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_Macro::CPA_EdIR_Macro()
{
m_csName="";
m_csContent="";
}
/****************************************************************************/
CPA_EdIR_Macro::CPA_EdIR_Macro(CString csName,CString csContent)
{
m_csName=csName;
m_csContent=csContent;
}
/****************************************************************************/
CPA_EdIR_Macro::~CPA_EdIR_Macro()
{
}
/****************************************************************************/
CString CPA_EdIR_Macro::m_fn_csGetMacroName()
{
return m_csName;
}
/****************************************************************************/
CString CPA_EdIR_Macro::m_fn_csGetMacroContent()
{
return m_csContent;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Method : CPA_EdIR_Macro::m_fn_vRenameMacro
// Date : 98.03
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Description :
// Author : Cristi Petrescu
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Modification :
// Date :
// By :
//////////////////////////////////////////////////////////////////////////////////////////////////////
void CPA_EdIR_Macro::m_fn_vRenameMacro (CString csNewName)
{
m_csName = csNewName;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,67 @@
// EdIRMacL.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRMacL.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////
// class CPA_EdIR_MacroList
//////////////////////////////////////////////////////////////////
/****************************************************************************/
CPA_EdIR_MacroList::CPA_EdIR_MacroList()
{
map = new CMapStringToPtr(500);
map->InitHashTable(500, TRUE);
}
/****************************************************************************/
CPA_EdIR_MacroList::~CPA_EdIR_MacroList()
{
m_fn_vDestroyAndRemoveAllEntries();
}
/****************************************************************************/
void CPA_EdIR_MacroList::m_fn_vDestroyAndRemoveAllEntries()
{
POSITION pos=GetHeadPosition();
while(pos!=NULL)
delete GetNext(pos);
RemoveAll();
map->RemoveAll();
}
/****************************************************************************/
char *CPA_EdIR_MacroList::m_fn_bIsAMacro(CString csMacro)
{
void *p;
csMacro.MakeLower();
if(map->Lookup(csMacro, p))
{
CPA_EdIR_Macro *p1 = (CPA_EdIR_Macro *) p;
return (char *) (LPCSTR) p1->m_csContent;
}
return NULL;
}
/****************************************************************************/
void CPA_EdIR_MacroList::AddTail(CPA_EdIR_Macro *p)
{
InsertAfter(GetTailPosition(), p);
p->m_csName.MakeLower();
map->SetAt(p->m_csName, p);
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,200 @@
// EdIRPrtB.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRPrtB.hpp"
#include "ai_intf.hpp"
#include "IncTUT.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_PrintDialog dialog
/////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CPA_EdIR_PrintDialog, CDialog)
//{{AFX_MSG_MAP(CPA_EdIR_PrintDialog)
ON_WM_DESTROY()
ON_BN_CLICKED(IDC_BUTTON_CHANGE_FONT, OnButtonChangeFont)
ON_BN_CLICKED(IDC_BUTTON_PREVIEW, OnButtonPrintPreview)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/**********************************************************************************/
CPA_EdIR_PrintDialog::CPA_EdIR_PrintDialog(CString csBehaviourListName,CString csFontName,long lFontSize,CWnd* pParent /*=NULL*/)
: CDialog(CPA_EdIR_PrintDialog::IDD, &g_oBaseFrame)
{
//{{AFX_DATA_INIT(CPA_EdIR_PrintDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_csBehaviourListName=csBehaviourListName;
m_csFontName=csFontName;
m_lFontSize=lFontSize;
m_bIsPreview=FALSE;
m_bCurrentBehaviour=TRUE;
m_bAllBehaviours=FALSE;
m_bAllIA=FALSE;
m_bOneBehaviourOnAPage=FALSE;
m_hOldInstance=AfxGetResourceHandle();
AfxSetResourceHandle(g_stAIIdentity.hModule);
}
/**********************************************************************************/
CPA_EdIR_PrintDialog::~CPA_EdIR_PrintDialog()
{
AfxSetResourceHandle(m_hOldInstance);
}
/**********************************************************************************/
void CPA_EdIR_PrintDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPA_EdIR_PrintDialog)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_Print_Dialog message handlers
/**********************************************************************************/
BOOL CPA_EdIR_PrintDialog::OnInitDialog()
{
CDialog::OnInitDialog();
//Sets font name
GetDlgItem(IDC_STATIC_FONT_NAME)->SetWindowText(m_csFontName);
//Sets Print Prefs
((CButton *)GetDlgItem(IDC_RADIO_CURRENT_BEHAVIOUR))->SetCheck((m_bCurrentBehaviour)?1:0);
((CButton *)GetDlgItem(IDC_RADIO_ALL_BEHAVIOURS))->SetCheck((m_bAllBehaviours)?1:0);
((CButton *)GetDlgItem(IDC_RADIO_ALL_BEHAVIOURS))->SetWindowText(m_csBehaviourListName);
((CButton *)GetDlgItem(IDC_RADIO_ALL_IA))->SetCheck((m_bAllIA)?1:0);
((CButton *)GetDlgItem(IDC_CHECK_ONE_BEHAVIOUR_ON_PAGE))->SetCheck((m_bOneBehaviourOnAPage)?1:0);
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControl(m_hWnd,"EdIR_PrintDlg_Window",TUT_e_Window);
TUT_M_vRegisterControlID(IDC_STATIC_FONT_NAME,"EdIR_PrintDlg_FontName",TUT_e_TextEdit);
TUT_M_vRegisterControlID(IDC_BUTTON_CHANGE_FONT,"EdIR_PrintDlg_ChangeFont",TUT_e_Button);
TUT_M_vRegisterControlID(IDC_RADIO_CURRENT_BEHAVIOUR,"EdIR_PrintDlg_CheckCurrent",TUT_e_Button);
TUT_M_vRegisterControlID(IDC_RADIO_ALL_BEHAVIOURS,"EdIR_PrintDlg_CheckAll",TUT_e_Button);
TUT_M_vRegisterControlID(IDC_RADIO_ALL_IA,"EdIR_PrintDlg_CheckAllIA",TUT_e_Button);
TUT_M_vRegisterControlID(IDC_CHECK_ONE_BEHAVIOUR_ON_PAGE,"EdIR_PrintDlg_CheckOneBehaviourOnPage",TUT_e_Button);
TUT_M_vRegisterControlID(IDOK,"EdIR_PrintDlg_Print",TUT_e_Button);
TUT_M_vRegisterControlID(IDC_BUTTON_PREVIEW,"EdIR_PrintDlg_PrintPriview",TUT_e_Button);
TUT_M_vRegisterControlID(IDCANCEL,"EdIR_PrintDlg_Cancel",TUT_e_Button);
//End of Register for TUT Module
//////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
/**********************************************************************************/
void CPA_EdIR_PrintDialog::OnDestroy()
{
//////////////
//////////////
//UnRegisters for TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControl(m_hWnd);
TUT_M_vUnregisterControlID(IDC_STATIC_FONT_NAME);
TUT_M_vUnregisterControlID(IDC_BUTTON_CHANGE_FONT);
TUT_M_vUnregisterControlID(IDC_RADIO_CURRENT_BEHAVIOUR);
TUT_M_vUnregisterControlID(IDC_RADIO_ALL_BEHAVIOURS);
TUT_M_vUnregisterControlID(IDC_RADIO_ALL_IA);
TUT_M_vUnregisterControlID(IDC_CHECK_ONE_BEHAVIOUR_ON_PAGE);
TUT_M_vUnregisterControlID(IDOK);
TUT_M_vUnregisterControlID(IDC_BUTTON_PREVIEW);
TUT_M_vUnregisterControlID(IDCANCEL);
//End of UnRegister for TUT Module
//////////////
CDialog::OnDestroy();
}
/**********************************************************************************/
void CPA_EdIR_PrintDialog::OnButtonChangeFont()
{
//Gets font name
GetDlgItem(IDC_STATIC_FONT_NAME)->GetWindowText(m_csFontName);
//Inits params to call a CFontDialog box
LOGFONT lfFont;
lfFont.lfHeight=m_lFontSize;
lfFont.lfWidth=0;
lfFont.lfEscapement=0;
lfFont.lfOrientation=0;
lfFont.lfWeight=FW_NORMAL;
lfFont.lfItalic=FALSE;
lfFont.lfUnderline=FALSE;
lfFont.lfStrikeOut=FALSE;
lfFont.lfCharSet=DEFAULT_CHARSET;
lfFont.lfOutPrecision=OUT_STRING_PRECIS;
lfFont.lfClipPrecision=CLIP_CHARACTER_PRECIS;
lfFont.lfQuality=DEFAULT_QUALITY;
lfFont.lfPitchAndFamily=DEFAULT_PITCH;
strcpy(lfFont.lfFaceName,(char *)LPCTSTR(m_csFontName));
CFontDialog cfd(&lfFont);
if(cfd.DoModal()==IDOK)
{
//Sets font name
m_csFontName=cfd.GetFaceName();
GetDlgItem(IDC_STATIC_FONT_NAME)->SetWindowText(m_csFontName);
//Sets font size
m_lFontSize=cfd.GetSize()/10;
}
}
/**********************************************************************************/
void CPA_EdIR_PrintDialog::OnButtonPrintPreview()
{
m_bIsPreview=TRUE;
OnOK();
}
/**********************************************************************************/
void CPA_EdIR_PrintDialog::OnOK()
{
//Gets font name
GetDlgItem(IDC_STATIC_FONT_NAME)->GetWindowText(m_csFontName);
//Gets Print Prefs
m_bCurrentBehaviour=((CButton *)GetDlgItem(IDC_RADIO_CURRENT_BEHAVIOUR))->GetCheck();
m_bAllBehaviours=((CButton *)GetDlgItem(IDC_RADIO_ALL_BEHAVIOURS))->GetCheck();
m_bAllIA=((CButton *)GetDlgItem(IDC_RADIO_ALL_IA))->GetCheck();
m_bOneBehaviourOnAPage=((CButton *)GetDlgItem(IDC_CHECK_ONE_BEHAVIOUR_ON_PAGE))->GetCheck();
CDialog::OnOK();
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,72 @@
// EdIRPrtF.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRPrtF.hpp"
#include "EdIRPrtV.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_PrintFrame dialog
/////////////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNCREATE(CPA_EdIR_PrintFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CPA_EdIR_PrintFrame, CFrameWnd)
//{{AFX_MSG_MAP(CPA_EdIR_PrintFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/**********************************************************************************/
CPA_EdIR_PrintFrame::CPA_EdIR_PrintFrame()
{
}
/**********************************************************************************/
CPA_EdIR_PrintFrame::~CPA_EdIR_PrintFrame()
{
}
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_PrintFrame message handlers
/**********************************************************************************/
BOOL CPA_EdIR_PrintFrame::m_fn_bCreate(CPA_EdIR_DiagView *pclDiagView,CString csWindowName,CRect crRect)
{
CCreateContext clPrintFrameContext;
clPrintFrameContext.m_pNewViewClass=RUNTIME_CLASS(CPA_EdIR_PrintView);
clPrintFrameContext.m_pCurrentDoc=NULL;
clPrintFrameContext.m_pNewDocTemplate=NULL;
clPrintFrameContext.m_pLastView=NULL;
clPrintFrameContext.m_pCurrentFrame=this;
BOOL bRes=CFrameWnd::Create(NULL,csWindowName,WS_OVERLAPPEDWINDOW|WS_VISIBLE,crRect,NULL,NULL,0,&clPrintFrameContext);
if(bRes)
{
CPA_EdIR_PrintView *pclPrintView=(CPA_EdIR_PrintView *)clPrintFrameContext.m_pNewViewClass->CreateObject();
pclPrintView->m_fn_bCreate(this);
pclPrintView->m_pclDiagView=pclDiagView;
pclPrintView->m_fn_vPrintPreview();
}
return bRes;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,114 @@
// EdIRPrtV.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRPrtV.hpp"
#include "EdIRBVw.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_PrintView dialog
/////////////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNCREATE(CPA_EdIR_PrintView, CView)
BEGIN_MESSAGE_MAP(CPA_EdIR_PrintView, CView)
//{{AFX_MSG_MAP(CPA_EdIR_PrintView)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/**********************************************************************************/
CPA_EdIR_PrintView::CPA_EdIR_PrintView()
{
}
/**********************************************************************************/
CPA_EdIR_PrintView::~CPA_EdIR_PrintView()
{
}
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_PrintView drawing
/**********************************************************************************/
void CPA_EdIR_PrintView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_PrintView diagnostics
#ifdef _DEBUG
/**********************************************************************************/
void CPA_EdIR_PrintView::AssertValid() const
{
CView::AssertValid();
}
/**********************************************************************************/
void CPA_EdIR_PrintView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_PrintView message handlers
/**********************************************************************************/
BOOL CPA_EdIR_PrintView::OnPreparePrinting(CPrintInfo* pInfo)
{
DoPreparePrinting(pInfo);
return CView::OnPreparePrinting(pInfo);
}
/**********************************************************************************/
void CPA_EdIR_PrintView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
m_pclDiagView->m_fn_vPrint(pDC,pInfo);
}
/**********************************************************************************/
void CPA_EdIR_PrintView::m_fn_vPrintPreview()
{
OnFilePrintPreview();
}
/**********************************************************************************/
BOOL CPA_EdIR_PrintView::m_fn_bCreate(CWnd *pParent)
{
return CWnd::Create(NULL,NULL,AFX_WS_DEFAULT_VIEW,CRect(0,0,0,0),pParent,123456798);
}
/**********************************************************************************/
void CPA_EdIR_PrintView::OnEndPrintPreview(CDC* pDC,CPrintInfo* pInfo,POINT point,CPreviewView* pView)
{
CView::OnEndPrintPreview(pDC,pInfo,point,pView);
GetParentFrame()->PostMessage(WM_SYSCOMMAND,SC_CLOSE);
m_pclDiagView->m_fn_vEndPrintPreview();
}
/**********************************************************************************/
void CPA_EdIR_PrintView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
m_pclDiagView->m_fn_vBeginPrinting(pDC,pInfo);
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,30 @@
// EdIRQuer.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "ai_intf.hpp"
#include "EdIRQuer.hpp"
#include "EDACDoc.hpp"
#include "x:\cpa\main\inc\_EditID.h"
//*******************************************************************************
EdActors_MyDocument *fn_pclGetEdActorsDocument()
{
CPA_DLLBase *pclActorDLL=(CPA_DLLBase*)(g_pclAIInterface->GetMainWorld()->GetObjectDLLWithName(C_szDLLActorName));
if(pclActorDLL!=NULL)
{
return (EdActors_MyDocument *)pclActorDLL->OnQueryAction(g_pclAIInterface,C_uiActor_GetDocument,0);
}
else
return NULL;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,155 @@
// CPA_Box.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRRBox.hpp"
#include "ai_intf.hpp"
#include "IncTUT.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_ActCondBoxDlg
/////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CPA_EdIR_ActCondBoxDlg, CDialog)
//{{AFX_MSG_MAP(CPA_EdIR_ActCondBoxDlg)
ON_WM_DESTROY()
ON_LBN_DBLCLK(IDC_IR_LISTBOX, OnDblclk)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/**********************************************************************************/
CPA_EdIR_ActCondBoxDlg::CPA_EdIR_ActCondBoxDlg(CStringList *p_clListString,CWnd* pParent)
: CDialog(CPA_EdIR_ActCondBoxDlg::IDD, &g_oBaseFrame)
{
mp_clListString=p_clListString;
m_csSelectedString="";
m_hOldInstance=AfxGetResourceHandle();
AfxSetResourceHandle(g_stAIIdentity.hModule);
//{{AFX_DATA_INIT(CPA_EdIR_ActCondBoxDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
/**********************************************************************************/
CPA_EdIR_ActCondBoxDlg::~CPA_EdIR_ActCondBoxDlg()
{
AfxSetResourceHandle(m_hOldInstance);
}
/**********************************************************************************/
void CPA_EdIR_ActCondBoxDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPA_EdIR_ActCondBoxDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_ActCondBoxDlg message handlers
/**********************************************************************************/
BOOL CPA_EdIR_ActCondBoxDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CListBox *p_clListBox=(CListBox *)GetDlgItem(IDC_IR_LISTBOX);
POSITION pos=mp_clListString->GetHeadPosition();
while(pos)
p_clListBox->AddString(mp_clListString->GetNext(pos));
p_clListBox->SetCurSel(0);
//////////////
//////////////
//Registers for TUT Module
TUT_M_vGetTutDll();
TUT_M_vRegisterControl(m_hWnd,"EdIR_ChooseBox_Window",TUT_e_Window);
TUT_M_vRegisterControlID(IDC_IR_LISTBOX,"EdIR_ChooseBox_ListBox",TUT_e_ListBox);
//End of Register for TUT Module
//////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
/**********************************************************************************/
void CPA_EdIR_ActCondBoxDlg::OnDestroy()
{
//////////////
//////////////
//UnRegisters for TUT Module
TUT_M_vGetTutDll();
TUT_M_vUnregisterControl(m_hWnd);
TUT_M_vUnregisterControlID(IDC_IR_LISTBOX);
//End of UnRegister for TUT Module
//////////////
CDialog::OnDestroy();
}
/**********************************************************************************/
void CPA_EdIR_ActCondBoxDlg::OnOK()
{
CListBox *p_clListBox=(CListBox *)GetDlgItem(IDC_IR_LISTBOX);
p_clListBox->GetText(p_clListBox->GetCurSel(),m_csSelectedString);
//ROMTEAM Display Parameter (Ionut Grozea 14/04/98)
SHORT mShort = GetKeyState(VK_CONTROL);
if (!(mShort & (1<<15)))
m_csSelectedString = m_fn_csGetNameOfProcedureWithoutParams(m_csSelectedString);
//ENDROMTEAM Display Parameter (Ionut Grozea 14/04/98)
CDialog::OnOK();
}
/**********************************************************************************/
void CPA_EdIR_ActCondBoxDlg::OnDblclk()
{
CListBox *p_clListBox=(CListBox *)GetDlgItem(IDC_IR_LISTBOX);
p_clListBox->GetText(p_clListBox->GetCurSel(),m_csSelectedString);
//ROMTEAM Display Parameter (Ionut Grozea 14/04/98)
SHORT mShort = GetKeyState(VK_CONTROL);
if (!(mShort & (1<<15)))
m_csSelectedString = m_fn_csGetNameOfProcedureWithoutParams(m_csSelectedString);
//ENDROMTEAM Display Parameter (Ionut Grozea 14/04/98)
CDialog::OnOK();
}
//ROMTEAM Display Parameter (Ionut Grozea 14/04/98)
CString CPA_EdIR_ActCondBoxDlg::m_fn_csGetNameOfProcedureWithoutParams(CString csString)
{
CString csName;
long lIndex = csString.Find('(');
if (lIndex==-1)
return csString;
else
if (lIndex == 0)
return "";
else
return csString.Left(lIndex);
}
//ENDROMTEAM Display Parameter (Ionut Grozea 14/04/98)
#endif //D_ED_IR_ACTIVE

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,60 @@
// EdIRREdA.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRREdA.hpp"
#include "EdIRREd.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_UndoPressAKey
/////////////////////////////////////////////////////////////////////////////
/**********************************************************************************/
CPA_EdIR_UndoPressAKey::CPA_EdIR_UndoPressAKey(CPA_EdIR_EditCtrl *pclEditCtrl,
UINT nKey,
long lIndex,long lScrollPosition,
BOOL bBlock)
:CPA_Modif(2,"Press A Key",bBlock)
{
m_nKey=nKey;
m_lIndex=lIndex;
m_lScrollPosition=lScrollPosition;
m_pclEditCtrl=pclEditCtrl;
}
/**********************************************************************************/
CPA_EdIR_UndoPressAKey::~CPA_EdIR_UndoPressAKey()
{
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoPressAKey::Do()
{
m_pclEditCtrl->m_fn_vAddChar(m_lIndex,m_lScrollPosition,m_nKey);
m_pclEditCtrl->m_fn_vSetModified(TRUE);
return TRUE;
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoPressAKey::Undo()
{
m_pclEditCtrl->m_fn_vDelChar(m_lIndex,m_lScrollPosition,m_nKey);
m_pclEditCtrl->m_fn_vSetModified(TRUE);
return TRUE;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,60 @@
// EdIRREdD.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRREdD.hpp"
#include "EdIRREd.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_UndoDelete
/////////////////////////////////////////////////////////////////////////////
/**********************************************************************************/
CPA_EdIR_UndoDelete::CPA_EdIR_UndoDelete(CPA_EdIR_EditCtrl *pclEditCtrl,
CString csString,
long lIndex,long lScrollPosition,
BOOL bBlock)
:CPA_Modif(2,"Delete String",bBlock)
{
m_csString=csString;
m_lIndex=lIndex;
m_lScrollPosition=lScrollPosition;
m_pclEditCtrl=pclEditCtrl;
}
/**********************************************************************************/
CPA_EdIR_UndoDelete::~CPA_EdIR_UndoDelete()
{
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoDelete::Do()
{
m_pclEditCtrl->m_fn_vDelString(m_lIndex,m_lScrollPosition,m_csString);
m_pclEditCtrl->m_fn_vSetModified(TRUE);
return TRUE;
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoDelete::Undo()
{
m_pclEditCtrl->m_fn_vAddString(m_lIndex,m_lScrollPosition,m_csString);
m_pclEditCtrl->m_fn_vSetModified(TRUE);
return TRUE;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,60 @@
// EdIRREdP.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRREdP.hpp"
#include "EdIRREd.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_UndoPaste
/////////////////////////////////////////////////////////////////////////////
/**********************************************************************************/
CPA_EdIR_UndoPaste::CPA_EdIR_UndoPaste(CPA_EdIR_EditCtrl *pclEditCtrl,
CString csString,
long lIndex,long lScrollPosition,
BOOL bBlock)
:CPA_Modif(2,"Paste",bBlock)
{
m_csString=csString;
m_lIndex=lIndex;
m_lScrollPosition=lScrollPosition;
m_pclEditCtrl=pclEditCtrl;
}
/**********************************************************************************/
CPA_EdIR_UndoPaste::~CPA_EdIR_UndoPaste()
{
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoPaste::Do()
{
m_pclEditCtrl->m_fn_vAddString(m_lIndex,m_lScrollPosition,m_csString);
m_pclEditCtrl->m_fn_vSetModified(TRUE);
return TRUE;
}
/**********************************************************************************/
BOOL CPA_EdIR_UndoPaste::Undo()
{
m_pclEditCtrl->m_fn_vDelString(m_lIndex,m_lScrollPosition,m_csString);
m_pclEditCtrl->m_fn_vSetModified(TRUE);
return TRUE;
}
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,403 @@
// EdIAView.cpp : implementation of the CEdIAView class
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRRVw.hpp"
#include "EdIRBeha.hpp"
#include "EdIRBeEn.hpp"
#include "EdIRIRD.hpp"
#include "EdIRBVw.hpp"
#include "EdIRFrm.hpp"
#include "EdIRRes.hm"
#include "ai_intf.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//Stefan Dumitrean 22-06-98 ( choose font )
#define C_FONT_SETTINGS_FILE_NAME "\\cpa\\exe\\main\\edt_data\\fontsize.dat"
//End Stefan Dumitrean 22-06-98 ( choose font )
/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_View
/////////////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNCREATE(CPA_EdIR_View, CFormView)
BEGIN_MESSAGE_MAP(CPA_EdIR_View, CFormView)
//{{AFX_MSG_MAP(CPA_EdIR_View)
ON_WM_HELPINFO()
ON_WM_PAINT()
ON_WM_SIZE()
//}}AFX_MSG_MAP
ON_WM_NCHITTEST()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_View construction/destruction
/**********************************************************************************/
CPA_EdIR_View::CPA_EdIR_View()
: CFormView(CPA_EdIR_View::IDD)
{
//{{AFX_DATA_INIT(CPA_EdIR_View)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// TODO: add construction code here
m_bIsReadOnly=FALSE;
m_pclBreakPointList=NULL;
//BEGIN ROMTEAM Cristi Petrescu 98-05-
m_pclDebugInfoList = NULL;
//END ROMTEAM Cristi Petrescu 98-05-
//Stefan Dumitrean 8-06-98 (new scroll )
m_p_clEditControl = NULL;
//End Stefan Dumitrean 8-06-98
}
/**********************************************************************************/
CPA_EdIR_View::~CPA_EdIR_View()
{
}
/**********************************************************************************/
void CPA_EdIR_View::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPA_EdIR_View)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
/**********************************************************************************/
BOOL CPA_EdIR_View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFormView::PreCreateWindow(cs);
}
/**********************************************************************************/
BOOL CPA_EdIR_View::Create(LPCTSTR lpszClassName,LPCTSTR lpszWindowName,DWORD dwStyle,const RECT &rect,CWnd *pParentWnd,UINT nID,CCreateContext *pContext)
{
BOOL bRes=CFormView::Create(lpszClassName,lpszWindowName,dwStyle,rect,pParentWnd,nID,pContext);
//Stefan Dumitrean 19-06-98 ( choose font )
if( bRes && !m_fn_bLoadFontSettings( C_FONT_SETTINGS_FILE_NAME ) )
{
GetFont()->GetLogFont( &m_stCurrentFont );
m_nFontSize = 100; //don't know how to get the size from the LOGFONT structure
}
//End Stefan Dumitrean 19-06-98 ( choose font )
return bRes;
}
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_View diagnostics
#ifdef _DEBUG
/**********************************************************************************/
void CPA_EdIR_View::AssertValid() const
{
CFormView::AssertValid();
}
/**********************************************************************************/
void CPA_EdIR_View::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_View message handlers
/**********************************************************************************/
void CPA_EdIR_View::OnInitialUpdate()
{
HINSTANCE hOldInstance=AfxGetResourceHandle();
AfxSetResourceHandle(g_stAIIdentity.hModule);
CFormView::OnInitialUpdate();
AfxSetResourceHandle(hOldInstance);
}
/**********************************************************************************/
UINT CPA_EdIR_View::OnNcHitTest(CPoint point)
{
UINT uiHitTest=CWnd::OnNcHitTest(point);
if(uiHitTest!=HTBOTTOM &&
uiHitTest!=HTBOTTOMLEFT &&
uiHitTest!=HTBOTTOMRIGHT &&
uiHitTest!=HTCAPTION &&
uiHitTest!=HTGROWBOX &&
uiHitTest!=HTLEFT &&
uiHitTest!=HTMENU &&
uiHitTest!=HTRIGHT &&
uiHitTest!=HTSIZE &&
uiHitTest!=HTTOPLEFT &&
uiHitTest!=HTTOPRIGHT)
return uiHitTest;
else
return 0;
}
/**********************************************************************************/
void CPA_EdIR_View::OnPaint()
{
CPA_EdIR_Behaviour *pclActiveBehaviour=((CPA_EdIR_Frame *)GetParentFrame())->m_fn_pclGetDiagrammeView()->m_fn_pclGetActiveBehaviour();
//Stefan Dumitrean 9-06-98 (new scroll)
// CPoint cpOffset=GetScrollPosition();
CPoint cpOffset=0;
//End Stefan Dumitrean 9-06-98
CClientDC cDc(this);
CFormView::OnPaint();
//BEGIN ROMTEAM Cristi Petrescu 98-05-
//Mark executed lines
CPA_EdIR_Frame *pclIRMainFrame=g_pclAIInterface->m_pclIRMainFrame;
tdeEditState tdeState=pclIRMainFrame->m_fn_pclGetButtonView()->m_fn_tdeGetEditState();
if (tdeState == EditIntell || tdeState == EditReflex)
{
CPA_DLLBase *pclDebugDLL = (CPA_DLLBase*) (g_pclAIInterface -> GetMainWorld () -> GetToolDLLWithName ("IA_Debugger"));
if (pclDebugDLL -> fn_bIsCurrentEditor () &&
g_pclAIInterface -> m_pclIRMainFrame -> m_bMarkExecutedLines)
{
if(m_pclDebugInfoList!=NULL)
{
HICON hDebugInfoIcon=AfxGetApp()->LoadIcon(IDI_ICON_IR_MARKEXECUTED);
//Draws mark
if(pclActiveBehaviour!=NULL)
{
POSITION pos=m_pclDebugInfoList->GetHeadPosition();
while(pos!=NULL)
{
CPA_EdIR_DebugInfo *pclDebugInfo=m_pclDebugInfoList->GetNext(pos);
if(pclDebugInfo -> m_fn_bGetExecuted ())
{
long lLineIndex=pclActiveBehaviour->m_fn_lGetLineNumberInPixel(pclDebugInfo->m_fn_lGetIndex());
CPoint p(0,lLineIndex);
p-=cpOffset;
cDc.DrawIcon(p,hDebugInfoIcon);
}
}
}
}
}
//END ROMTEAM Cristi Petrescu 98-05-
// BEGIN ROMTEAM Cristi Petrescu 98-08-
// Draws Executed line
if (pclDebugDLL -> fn_bIsCurrentEditor ())
{
HICON hDebugInfoIcon=AfxGetApp()->LoadIcon(IDI_ICON_EXECUTED_LINE);
if (m_lExecutedLine >=0)
{
long lLineIndex=pclActiveBehaviour->m_fn_lGetLineNumberInPixel(m_lExecutedLine);
CPoint p(0,lLineIndex);
p-=cpOffset;
cDc.DrawIcon(p,hDebugInfoIcon);
}
}
// END ROMTEAM Cristi Petrescu 98-08-
}
//Draws BreakPointList
if(m_pclBreakPointList!=NULL)
{
HICON hBreakPointIcon=AfxGetApp()->LoadIcon(IDI_ICON_IR_BREAKPOINT);
//Draws BreakPoint
if(pclActiveBehaviour!=NULL)
{
CString csActiveBehaviourName=pclActiveBehaviour->m_fn_pclGetMainBehaviour()->GetName();
POSITION pos=m_pclBreakPointList->GetHeadPosition();
while(pos!=NULL)
{
CPA_EdIR_BreakPoint *pclBreakPoint=m_pclBreakPointList->GetNext(pos);
if(pclBreakPoint->m_fn_csGetBehaviourName()==csActiveBehaviourName)
{
long lLineIndex=pclActiveBehaviour->m_fn_lGetLineNumberInPixel(pclBreakPoint->m_fn_lGetIndex());
CPoint p(0,lLineIndex);
p-=cpOffset;
cDc.DrawIcon(p,hBreakPointIcon);
}
}
}
}
//ANNECY CB
if(pclActiveBehaviour && pclActiveBehaviour->m_lErrorIndex != -1)
{
HICON hIcon=AfxGetApp()->LoadIcon(IDI_ICON_IR_ERROR);
long lLineIndex=pclActiveBehaviour->m_fn_lGetLineNumberInPixel(pclActiveBehaviour->m_lErrorIndex);
CPoint p(0,lLineIndex);
p-=cpOffset;
cDc.DrawIcon(p,hIcon);
}
//END ANNECY
}
/**********************************************************************************/
BOOL CPA_EdIR_View::OnHelpInfo(HELPINFO* pHelpInfo)
{
::WinHelp(m_hWnd,g_pclAIInterface->m_csBrainHelpFileNameAndPath,HELP_CONTEXT,HID_RULES_ZONE);
return CFormView::OnHelpInfo(pHelpInfo);
}
/**********************************************************************************/
void CPA_EdIR_View::m_fn_vSetReadOnly(BOOL bReadOnly)
{
m_bIsReadOnly=bReadOnly;
}
/**********************************************************************************/
void CPA_EdIR_View::m_fn_vSetBreakPointList(CPA_EdIR_BreakPointList *pclBreakPointList)
{
m_pclBreakPointList=pclBreakPointList;
}
//BEGIN ROMTEAM Cristi Petrescu 98-05-
/**********************************************************************************/
void CPA_EdIR_View::m_fn_vSetDebugInfoList(CPA_EdIR_DebugInfoList *pclDebugInfoList)
{
m_pclDebugInfoList=pclDebugInfoList;
}
//END ROMTEAM Cristi Petrescu 98-05-
//Stefan Dumitrean 8-06-98 ( new scroll )
void CPA_EdIR_View::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
if( m_p_clEditControl )
m_p_clEditControl->m_fn_vResizeToFitParent();
}
//End Stefan Dumitrean 8-06-98
//Stefan Dumitrean 19-06-98 ( choose font )
void CPA_EdIR_View::m_fn_vChooseFont()
{
CFontDialog clFDlg( &m_stCurrentFont, CF_NOSTYLESEL | CF_SCREENFONTS | CF_NOSCRIPTSEL | CF_FIXEDPITCHONLY, NULL, this );
if( clFDlg.DoModal() == IDOK )
{
clFDlg.GetCurrentFont( &m_stCurrentFont );
m_stCurrentFont.lfWeight = 0;
m_stCurrentFont.lfItalic = 0;
m_stCurrentFont.lfUnderline = 0;
m_nFontSize = clFDlg.GetSize();
m_fn_vSaveFontSettings( C_FONT_SETTINGS_FILE_NAME );
if( m_p_clEditControl )
m_p_clEditControl->m_fn_vSetFontTypeAndSize( );
}
}
CString CPA_EdIR_View::m_fn_csGetFontType()
{
CString csRet = m_stCurrentFont.lfFaceName;
return csRet;
}
int CPA_EdIR_View::m_fn_nGetFontSize()
{
return m_nFontSize;
}
CSize CPA_EdIR_View::m_fn_clGetFontExtent()
{
CFont clFont;
clFont.CreateFontIndirect( &m_stCurrentFont );
CClientDC cdc(this);
CFont *p_clOldFont=cdc.SelectObject(&clFont);
CSize clFontSize = cdc.GetTextExtent("A");
cdc.SelectObject(p_clOldFont);
return clFontSize;
}
void CPA_EdIR_View::m_fn_vSaveFontSettings( CString csString )
{
FILE * stFile = fopen( LPCSTR( csString ), "wt" );
if( !stFile )
return;
fprintf( stFile, "[LOGFONT structure]\n\n" );
fprintf( stFile, "lfHeight = %ld\n", m_stCurrentFont.lfHeight );
fprintf( stFile, "lfWidth = %ld\n", m_stCurrentFont.lfWidth );
fprintf( stFile, "lfEscapement = %ld\n", m_stCurrentFont.lfEscapement );
fprintf( stFile, "lfOrientation = %ld\n", m_stCurrentFont.lfOrientation );
fprintf( stFile, "lfWeight = %ld\n", m_stCurrentFont.lfWeight );
fprintf( stFile, "lfItalic = %d\n", m_stCurrentFont.lfItalic );
fprintf( stFile, "lfUnderline = %d\n", m_stCurrentFont.lfUnderline );
fprintf( stFile, "lfStrikeOut = %d\n", m_stCurrentFont.lfStrikeOut );
fprintf( stFile, "lfCharSet = %d\n", m_stCurrentFont.lfCharSet );
fprintf( stFile, "lfOutPrecision = %d\n", m_stCurrentFont.lfOutPrecision );
fprintf( stFile, "lfClipPrecision = %d\n", m_stCurrentFont.lfClipPrecision );
fprintf( stFile, "lfQuality = %d\n", m_stCurrentFont.lfQuality );
fprintf( stFile, "lfPitchAndFamily = %d\n", m_stCurrentFont.lfPitchAndFamily );
fprintf( stFile, "lfFaceName = %s\n\n", m_stCurrentFont.lfFaceName );
fprintf( stFile, "[Font Size]\n\n" );
fprintf( stFile, "Size = %d\n", m_nFontSize );
fclose( stFile );
}
BOOL CPA_EdIR_View::m_fn_bLoadFontSettings( CString csString )
{
FILE * stFile = fopen( LPCSTR( csString ), "rt" );
if( !stFile )
return FALSE;
fscanf( stFile, "[LOGFONT structure]\n\n" );
fscanf( stFile, "lfHeight = %ld\n", &m_stCurrentFont.lfHeight );
fscanf( stFile, "lfWidth = %ld\n", &m_stCurrentFont.lfWidth );
fscanf( stFile, "lfEscapement = %ld\n", &m_stCurrentFont.lfEscapement );
fscanf( stFile, "lfOrientation = %ld\n", &m_stCurrentFont.lfOrientation );
fscanf( stFile, "lfWeight = %ld\n", &m_stCurrentFont.lfWeight );
fscanf( stFile, "lfItalic = %d\n", &m_stCurrentFont.lfItalic );
fscanf( stFile, "lfUnderline = %d\n", &m_stCurrentFont.lfUnderline );
fscanf( stFile, "lfStrikeOut = %d\n", &m_stCurrentFont.lfStrikeOut );
fscanf( stFile, "lfCharSet = %d\n", &m_stCurrentFont.lfCharSet );
fscanf( stFile, "lfOutPrecision = %d\n", &m_stCurrentFont.lfOutPrecision );
fscanf( stFile, "lfClipPrecision = %d\n", &m_stCurrentFont.lfClipPrecision );
fscanf( stFile, "lfQuality = %d\n", &m_stCurrentFont.lfQuality );
fscanf( stFile, "lfPitchAndFamily = %d\n", &m_stCurrentFont.lfPitchAndFamily );
fscanf( stFile, "lfFaceName = %s\n\n", m_stCurrentFont.lfFaceName );
fscanf( stFile, "[Font Size]\n\n" );
fscanf( stFile, "Size = %d\n", &m_nFontSize );
fclose( stFile );
return TRUE;
}
//End Stefan Dumitrean 19-06-98 ( choose font )
#endif //D_ED_IR_ACTIVE

View File

@@ -0,0 +1,357 @@
// PA_EdIR_DiagReplace.cpp : implementation file
//
#include "stdafx.h"
//#include "edir.h"
#include "EdIRReplce.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "ITF/FrmGest.hpp"
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_DiagReplace dialog
CPA_EdIR_DiagReplace::CPA_EdIR_DiagReplace(CPA_EdIR_EditCtrl *EditCtrl ,CWnd* pParent /*=NULL*/)
: CDialog(CPA_EdIR_DiagReplace::IDD, &g_oBaseFrame)
{
m_EditCtrl = EditCtrl;
m_EditCtrl->m_fnSetSelectAString(FALSE);
m_bFirst = TRUE;
//{{AFX_DATA_INIT(CPA_EdIR_DiagReplace)
m_bCaseSensitive = FALSE;
m_bAllAi = FALSE;
//}}AFX_DATA_INIT
m_DiagView = ((CPA_EdIR_Frame*)(m_EditCtrl->GetParentFrame()))->m_fn_pclGetDiagrammeView();
}
void CPA_EdIR_DiagReplace::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPA_EdIR_DiagReplace)
DDX_Control(pDX, IDC_COMBO_REPLACE, m_replace);
DDX_Control(pDX, IDC_COMBO_FIND, m_find);
DDX_Check(pDX, IDC_CHECK_CASE_SENSITIVE, m_bCaseSensitive);
DDX_Check(pDX, IDC_CHECK_ALL_AI, m_bAllAi);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPA_EdIR_DiagReplace, CDialog)
//{{AFX_MSG_MAP(CPA_EdIR_DiagReplace)
ON_BN_CLICKED(IDC_BUTTON_FIND_NEXT, OnButtonFindNext)
ON_BN_CLICKED(IDC_BUTTON_REPLACE, OnButtonReplace)
ON_BN_CLICKED(IDC_BUTTON_REPLACE_ALL, OnButtonReplaceAll)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_DiagReplace message handlers
void CPA_EdIR_DiagReplace::OnButtonFindNext()
{
UpdateData(TRUE);
CString csText1;
m_find.GetWindowText(csText1);
CString csText2;
m_replace.GetWindowText(csText2);
m_EditCtrl->m_bSearchIsFinished=FALSE;
long l_SizeFind = csText1.GetLength();
long l_SizeReplace = csText2.GetLength();
long l_find;
long iCount;
long iActive;
if (!fn_ExistFind(csText1)) m_find.InsertString(0,csText1);
if (!fn_ExistReplace(csText2)) m_replace.InsertString(0,csText2);
//Stefan Dumitrean 7-07-98 ( Find-Replace scroll )
// long index = m_EditCtrl->m_fn_lGetCurrentCharIndex();
long lStart, index;
m_EditCtrl->GetSel( lStart, index );
//End Stefan Dumitrean 7-07-98 ( Find-Replace scroll )
if (m_bFirst)
{
l_find = m_EditCtrl->m_fn_lFindString(m_bCaseSensitive ,(index- l_SizeFind)>=0 ?index- l_SizeFind:0,csText1);
m_bFirst=FALSE;
}
else
l_find = m_EditCtrl->m_fn_lFindString(m_bCaseSensitive ,index ,csText1);
if (l_find == -1)
{
if (m_EditCtrl->m_fnGetSelectAString())
{
m_EditCtrl->m_fn_vColorText( m_EditCtrl->m_lFirstSelectIndex,m_EditCtrl->m_lLastSelectIndex,m_EditCtrl->col_last);
}
if (m_bAllAi)
{
iCount = m_DiagView->m_clBehaviourListBox.GetCount();
iActive = m_DiagView->m_clBehaviourListBox.GetCurSel();
if (iActive < iCount-1)
{
m_DiagView->m_clBehaviourListBox.SetCurSel(iActive+1);
CPA_EdIR_Behaviour *pclBehaviour;
pclBehaviour=(CPA_EdIR_Behaviour *)m_DiagView->m_clBehaviourListBox.GetItemDataPtr((m_DiagView->m_clBehaviourListBox).GetCurSel());
m_DiagView->m_fn_vOldActiveBehaviourHasChanged(pclBehaviour,FALSE);
m_EditCtrl = &(m_DiagView->m_fn_pclGetActiveBehaviour())->m_clEditCtrl;
m_EditCtrl->ShowWindow(TRUE);
m_bFirst = TRUE;
m_EditCtrl->m_fnSetSelectAString(FALSE);
}
}
}
else
{
//Stefan Dumitrean 6-07-98 ( Find-Replace scroll )
m_EditCtrl->HideSelection( FALSE, TRUE );
m_EditCtrl->SetSel( l_find, l_find + l_SizeFind );
// m_EditCtrl->m_fn_vSetCursorPos(l_find+l_SizeFind+1);
//End Stefan Dumitrean 6-07-98 ( Find-Replace scroll )
}
if (m_EditCtrl->m_bSearchIsFinished == TRUE)
{
AfxMessageBox("End of file" );
SetFocus();
}
}
void CPA_EdIR_DiagReplace::OnButtonReplace()
{
UpdateData(TRUE);
CString csText1;
m_find.GetWindowText(csText1);
CString csText2;
m_replace.GetWindowText(csText2);
long lFind = csText1.GetLength();
long l_find ;
long iCount;
long iActive;
m_EditCtrl->m_bSearchIsFinished = FALSE;
if (!m_EditCtrl->m_fnGetSelectAString())
{
long lCharIndex = m_EditCtrl->m_fn_lGetCurrentCharIndex();
long lFirst,lLast;
m_EditCtrl->m_fn_csGetWordIn(lCharIndex , lFirst, lLast);
l_find = m_EditCtrl->m_fn_lFindString(m_bCaseSensitive , lFirst ,csText1);
if (l_find ==-1 && m_bAllAi)
{
iCount = m_DiagView->m_clBehaviourListBox.GetCount();
iActive = m_DiagView->m_clBehaviourListBox.GetCurSel();
if (iActive < iCount-1)
{
m_DiagView->m_clBehaviourListBox.SetCurSel(iActive+1);
CPA_EdIR_Behaviour *pclBehaviour;
pclBehaviour=(CPA_EdIR_Behaviour *)m_DiagView->m_clBehaviourListBox.GetItemDataPtr((m_DiagView->m_clBehaviourListBox).GetCurSel());
m_DiagView->m_fn_vOldActiveBehaviourHasChanged(pclBehaviour,FALSE);
m_EditCtrl = &(m_DiagView->m_fn_pclGetActiveBehaviour())->m_clEditCtrl;
m_EditCtrl->ShowWindow(TRUE);
m_bFirst = TRUE;
m_EditCtrl->m_fnSetSelectAString(FALSE);
}
}
//Stefan Dumitrean 6-07-98 ( Find-Replace scroll )
else
{
m_EditCtrl->HideSelection( FALSE, TRUE );
m_EditCtrl->SetSel( l_find, l_find + lFind );
}
//End Stefan Dumitrean 6-07-98 ( Find-Replace scroll )
}
else
{
CString csText;
m_EditCtrl->GetWindowText(csText);
long l1 = m_EditCtrl->m_lFirstSelectIndex;
long l2 = lFind;
CString csReplaceString = csText.Mid(l1, l2);
m_EditCtrl->m_fn_ReplaceString(m_EditCtrl->m_lLastSelectIndex, csReplaceString , csText2);
l_find =m_EditCtrl->m_fn_lFindString(m_bCaseSensitive ,m_EditCtrl->m_lLastSelectIndex, csText1 );
//Stefan Dumitrean 6-07-98 ( Find-Replace scroll )
m_EditCtrl->HideSelection( FALSE, TRUE );
m_EditCtrl->SetSel( l_find, l_find + lFind );
// m_EditCtrl->m_fn_vSetCursorPos(l_find+lFind +1);
//End Stefan Dumitrean 6-07-98 ( Find-Replace scroll )
}
if (m_EditCtrl->m_bSearchIsFinished == TRUE)
{
AfxMessageBox("End of file" );
SetFocus();
}
}
void CPA_EdIR_DiagReplace::OnButtonReplaceAll()
{
int iCount;
int iActiveBehaviour;
HCURSOR hWaitCursor;
HCURSOR hOldCursor;
UpdateData(TRUE);
CString csText1;
m_find.GetWindowText(csText1);
CString csText2;
m_replace.GetWindowText(csText2);
m_EditCtrl->m_bSearchIsFinished = FALSE;
if(!m_bAllAi)
{
m_EditCtrl->m_fn_ReplaceAllString(m_bCaseSensitive ,0 , csText1 , csText2);
}
else
{
hWaitCursor = AfxGetApp()->LoadStandardCursor( IDC_WAIT );
hOldCursor = SetCursor( hWaitCursor );
iCount = m_DiagView->m_clBehaviourListBox.GetCount();
for (iActiveBehaviour=0;iActiveBehaviour<=iCount-1;iActiveBehaviour++)
{
m_DiagView->m_clBehaviourListBox.SetCurSel(iActiveBehaviour);
CPA_EdIR_Behaviour *pclBehaviour;
pclBehaviour=(CPA_EdIR_Behaviour *)m_DiagView->m_clBehaviourListBox.GetItemDataPtr((m_DiagView->m_clBehaviourListBox).GetCurSel());
m_DiagView->m_fn_vOldActiveBehaviourHasChanged(pclBehaviour,FALSE);
m_EditCtrl = &(m_DiagView->m_fn_pclGetActiveBehaviour())->m_clEditCtrl;
m_EditCtrl->m_fn_ReplaceAllString(m_bCaseSensitive ,0 , csText1 , csText2);
}
}
SetCursor( hOldCursor );
if (m_EditCtrl->m_bSearchIsFinished == TRUE)
AfxMessageBox("End of file" );
SetFocus();
}
BOOL CPA_EdIR_DiagReplace::OnInitDialog()
{
CDialog::OnInitDialog();
GetDlgItem(IDC_COMBO_FIND)->SetFocus();
FILE *File1;
FILE *File2;
char text[512];
File1=fopen("\\cpa\\tempgrp\\tia\\ListAIFind.lst","r") ;
if(File1)
{
fscanf(File1, "%s" , text);
if (feof(File1))
{
}
else
{
while(!feof(File1))
{
if (text !="\n")
m_find.AddString(text);
fscanf(File1, "%s" , text);
}
}
fclose(File1);
}
File2=fopen("\\cpa\\tempgrp\\tia\\ListAIReplace.lst","r") ;
if(File2)
{
fscanf(File2, "%s" , text);
if (feof(File2))
{
}
else
{
while(!feof(File2))
{
if (text !="\n")
m_replace.AddString(text);
fscanf(File2, "%s" , text);
}
}
fclose(File2);
}
long first , last;
CString cs_actual;
cs_actual = m_EditCtrl->m_fn_csGetWordIn(m_EditCtrl->m_fn_lGetCurrentCharIndex(),first , last);
m_find.InsertString(-1 , cs_actual);
m_find.SelectString(-1,cs_actual);
return TRUE;
}
BOOL CPA_EdIR_DiagReplace::DestroyWindow()
{
FILE *File1;
FILE *File2;
char text[512];
int i;
m_EditCtrl->m_lFirstSelectIndex=0;
m_EditCtrl->m_lLastSelectIndex=0;
if(File1=fopen("\\cpa\\tempgrp\\tia\\ListAIFind.lst","w"))
{
for (i=0;i<m_find.GetCount();i++)
{
m_find.GetLBText(i , text);
fprintf(File1, "%s\n" , text);
}
fclose(File1);
}
if(File2=fopen("\\cpa\\tempgrp\\tia\\ListAIReplace.lst","w"))
{
for (i=0;i<m_replace.GetCount();i++)
{
m_replace.GetLBText(i , text);
fprintf(File2, "%s\n" , text);
}
fclose(File2);
}
m_EditCtrl->RestoreCol();
return CDialog::DestroyWindow();
}
BOOL CPA_EdIR_DiagReplace::fn_ExistFind(CString search)
{
UpdateData(TRUE);
int i;
char text[300];
for (i=0;i<m_find.GetCount();i++)
{
m_find.GetLBText(i , text);
if(text == search )
return TRUE;
}
return FALSE;
}
BOOL CPA_EdIR_DiagReplace::fn_ExistReplace(CString search)
{
UpdateData(TRUE);
int i;
char text[30];
for (i=0;i<m_replace.GetCount();i++)
{
m_replace.GetLBText(i , text);
if(text == search )
return TRUE;
}
return FALSE;
}
void CPA_EdIR_DiagReplace::OnCancel()
{
m_EditCtrl->RestoreCol();
CDialog::OnCancel();
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,290 @@
// EdIRWaW.cpp : implementation file
//
#include "stdafx.h"
#include "Defines.hpp"
#ifdef D_ED_IR_ACTIVE
#include "EdIRWaW.hpp"
#include "EdIRDat.hpp"
#include "EdIRStrg.hpp"
#include "EDACActr.hpp"
#include "_Actors.hpp"
#include "WAW.h"
// CPA2 ASilvescu 98-05-06
#include "dpt.h"
// CPA2 ASilvescu 98-05-06
/**********************************************************************************/
static CString fn_csGetValue(WAW_Data *pclWatchData)
{
CString csValue;
CTL_Editor_Data *pclData=(CTL_Editor_Data *)pclWatchData->m_pub_fn_pvGetUserData();
if(pclData!=NULL)
{
CString csDsgVarName;
CString csDsgVarType;
CStringList cslDsgVarValues;
fn_vGetInfoAboutDsgVar(pclData,csDsgVarName,csDsgVarType,&cslDsgVarValues);
//Is it an array ?
if(cslDsgVarValues.GetCount()>1)
{
CString csWatchName=pclWatchData->m_pub_fn_csGetDataName();
long lIndex=csWatchName.Find('[');
if(lIndex!=-1)
{
long lEndIndex=csWatchName.Find(']');
if(lEndIndex!=-1)
{
CString csArrayIndex=csWatchName.Mid(lIndex+1,lEndIndex-(lIndex+1));
long lArrayIndex=atol(M_MAKECHAR(csArrayIndex));
POSITION pos=cslDsgVarValues.FindIndex(lArrayIndex);
if(pos!=NULL)
csValue=cslDsgVarValues.GetAt(pos);
else
{
ASSERT(FALSE);
}
}
else
{
ASSERT(FALSE);
}
}
else
{
ASSERT(FALSE);
}
}
else
csValue=cslDsgVarValues.GetHead();
}
else
{
ASSERT(FALSE);
}
return csValue;
}
/**********************************************************************************/
void fn_vCallBackForWatchWindow(WAW_tdeMessage eMessage,void *pvData)
{
switch(eMessage)
{
case WAW_eDeletedData:
{
WAW_Data *pclWatchData=(WAW_Data *)pvData;
if(pclWatchData!=NULL)
{
CTL_Editor_Data *pclData=(CTL_Editor_Data *)pclWatchData->m_pub_fn_pvGetUserData();
if(pclData!=NULL)
{
fn_vSetWatchData(pclData,NULL);
fn_vSetInWatch(pclData,FALSE);
// CPA2 ASilvescu 98-05-06
CString saveFileName = M_GetMainApp()->m_csEditorDataPath;
saveFileName += "watch.dat";
EdActors_EditorActor *pclActor=fn_pclGetParentActor(pclData);
if(pclActor)
WritePrivateProfileString(pclActor->m_pclActor->GetName(), pclData->m_pub_fn_csGetDataName(), NULL, saveFileName);
// CPA2 ASilvescu 98-05-06
CString csDsgVarName;
CString csDsgVarType;
CStringList cslDsgVarValues;
fn_vGetInfoAboutDsgVar(pclData,csDsgVarName,csDsgVarType,&cslDsgVarValues);
//Is it an single entry ?
if(cslDsgVarValues.GetCount()==1)
{
//Update display
CTL_Editor_Control *pclControl=pclData->m_pub_fn_pclGetParentControl();
CTL_Editor_Static *pclStatic=pclControl->m_pub_fn_pclGetNameStatic();
// CPA2 ASilvescu 98-04-30
if(pclStatic)
// End CPA2 ASilvescu 98-04-30
pclStatic->InvalidateRect(NULL);
}
}
else
{
ASSERT(FALSE);
}
}
else
{
ASSERT(FALSE);
}
}
break;
case WAW_eDeletedNode:
{
WAW_Data *pclWatchData=(WAW_Data *)pvData;
if(pclWatchData!=NULL)
{
CTL_Editor_Data *pclData=(CTL_Editor_Data *)pclWatchData->m_pub_fn_pvGetUserData();
if(pclData!=NULL)
{
fn_vSetWatchData(pclData,NULL);
CString csDsgVarName;
CString csDsgVarType;
CStringList cslDsgVarValues;
fn_vGetInfoAboutDsgVar(pclData,csDsgVarName,csDsgVarType,&cslDsgVarValues);
//Is it an array ?
if(cslDsgVarValues.GetCount()>1)
{
fn_vSetInWatch(pclData,FALSE);
//Update display
CTL_Editor_Control *pclControl=pclData->m_pub_fn_pclGetParentControl();
CTL_Editor_Static *pclStatic=pclControl->m_pub_fn_pclGetNameStatic();
// CPA2 ASilvescu 98-04-30
if(pclStatic)
// End CPA2 ASilvescu 98-04-30
pclStatic->InvalidateRect(NULL);
}
}
}
else
{
ASSERT(FALSE);
}
}
break;
case WAW_eUpdateData:
{
WAW_DataList clWAWDataList(C_MODULE_NAME);
clWAWDataList.m_pub_fn_vGetVisible();
clWAWDataList.m_pub_fn_vSelectData();
POSITION pos=clWAWDataList.GetHeadPosition();
while(pos!=NULL)
{
WAW_Data *pclWatchData=clWAWDataList.GetNext(pos);
CString csValue=fn_csGetValue(pclWatchData);
WAW_fn_bUpdateData(pclWatchData,csValue);
}
}
break;
case WAW_eHideWindow:
{
}
break;
case WAW_eShowWindow:
{
}
break;
default:
{
AfxMessageBox("fn_vCallBackForWatchWindow: unknown message !!");
}
}
}
//*******************************************************************************
void fn_vAddValueInWatch(CTL_Editor_Data *pclData)
{
EdActors_EditorActor *pclActor=fn_pclGetParentActor(pclData);
if(pclActor!=NULL)
{
//Adds Actor Name node
CString csActorName=pclActor->m_pclActor->GetName();
WAW_Data *pclWatchData=WAW_fn_pclAddNode(C_MODULE_NAME,NULL,csActorName);
//Adds "Designer Variables" node
pclWatchData=WAW_fn_pclAddNode(C_MODULE_NAME,pclWatchData,"Designer Variables");
//Adds Data (Name+Value)
CString csDsgVarName;
CString csDsgVarType;
CStringList cslDsgVarValues;
fn_vGetInfoAboutDsgVar(pclData,csDsgVarName,csDsgVarType,&cslDsgVarValues);
ASSERT(cslDsgVarValues.IsEmpty()==FALSE);
// CPA2 ASilvescu 98-05-06
CString saveFileName = M_GetMainApp()->m_csEditorDataPath;
saveFileName += "watch.dat";
WritePrivateProfileString(csActorName, pclData->m_pub_fn_csGetDataName(), "Designer Variables", saveFileName);
// CPA2 ASilvescu 98-05-06
if(cslDsgVarValues.GetCount()==1)
{
pclWatchData=WAW_fn_pclAddData(C_MODULE_NAME,pclWatchData,csDsgVarName,cslDsgVarValues.GetHead(),pclData);
fn_vSetWatchData(pclData,pclWatchData);
}
else
{
//It is an array
//Adds a node for the array
pclWatchData=WAW_fn_pclAddNode(C_MODULE_NAME,pclWatchData,csDsgVarName,pclData);
fn_vSetWatchData(pclData,pclWatchData);
//Adds array entries
long lIndex=0;
CString csIndex;
CString csDsgVarNameEntry;
POSITION pos=cslDsgVarValues.GetHeadPosition();
while(pos!=NULL)
{
csIndex.Format("%ld",lIndex);
csDsgVarNameEntry=csDsgVarName+"["+csIndex+"]";
WAW_fn_pclAddData(C_MODULE_NAME,pclWatchData,csDsgVarNameEntry,cslDsgVarValues.GetNext(pos),pclData);
lIndex++;
}
}
}
else
{
AfxMessageBox("EdIRWaW::fn_vAddValueInWatch : Parent actor is NULL !!");
ASSERT(FALSE);
}
}
//*******************************************************************************
void fn_vRemoveValueFromWatch(CTL_Editor_Data *pclData)
{
WAW_Data *pclWatchData=fn_pclGetWatchData(pclData);
if(pclWatchData!=NULL)
{
WAW_fn_bDeleteData(pclWatchData);
fn_vSetWatchData(pclData,NULL);
}
else
{
AfxMessageBox("EdIRWaW::fn_vRemoveValueFromWatch : Watch data is NULL !!");
ASSERT(FALSE);
}
// CPA2 ASilvescu 98-05-06
CString saveFileName = M_GetMainApp()->m_csEditorDataPath;
saveFileName += "watch.dat";
EdActors_EditorActor *pclActor=fn_pclGetParentActor(pclData);
if(pclActor)
WritePrivateProfileString(pclActor->m_pclActor->GetName(), pclData->m_pub_fn_csGetDataName(), NULL, saveFileName);
// CPA2 ASilvescu 98-05-06
}
#endif //D_ED_IR_ACTIVE

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// ACPProject.pch will be the pre-compiled header
// stdafx.obj will conTIAn the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,8 @@
LIBRARY
EXPORTS
fn_p_szGetCPAVersion
fn_p_stGetDLLIdentity
fn_p_oGetDLL
fn_vInitDll
SECTIONS
.data READ WRITE

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,126 @@
/*
*=======================================================================================
* Name : dllcom.cpp
* Author : C. Beaudet Date :20/05/97
* Description : Common functions for Object DLL capabilities
*=======================================================================================
* Modification -> Author : VL Date : 20/05/97
* Description : Common functions for Object Table Tool DLL
*=======================================================================================
*/
#include "stdafx.h"
#include "acp_base.h"
#include "afxdllx.h"
#include "ITF.h"
#include "ai_intf.hpp"
#include "x:\cpa\main\inc\_EditID.h"
/*
*------------------------------------------------------------------------
* Global vars
*------------------------------------------------------------------------
*/
static char *gs_p_szCPAVersion = C_szCPAVersion;
static AFX_EXTENSION_MODULE NEAR extensionDLL = { NULL, NULL };
#ifdef DLL_ONLY_ONE_INSTANCE
static CPA_EdIR_Interface *gs_p_oAIInterface = NULL;
#endif
static CList<CPA_DLLBase*,CPA_DLLBase*> g_oListOfInstances; //private internal
//------------------------------------------------------------------------
// functions that are present in all DLL :
//------------------------------------------------------------------------
//========================================================================
// Get current CPA version
//========================================================================
extern "C" char __declspec(dllexport) *fn_p_szGetCPAVersion(void)
{
return gs_p_szCPAVersion;
}
//========================================================================
// Get type of this DLL
//========================================================================
extern "C" tdstDLLIdentity __declspec(dllexport) *fn_p_stGetDLLIdentity(void)
{
g_stAIIdentity.eType = TOOL_DLL; //DLL type
g_stAIIdentity.csName = C_szDLLAIEditorName; //DLL name (unique name)
g_stAIIdentity.hModule = NULL; //********************** private internal
g_stAIIdentity.p_oListOfInstances = &g_oListOfInstances; //********************** private internal
return &g_stAIIdentity;
}
//========================================================================
// DLL init function
//========================================================================
extern "C" void _declspec(dllexport) fn_vInitDll(void)
{
new CDynLinkLibrary(extensionDLL);
}
//========================================================================
// DLL entry point
//========================================================================
extern "C" int __stdcall DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
if (!AfxInitExtensionModule(extensionDLL, hInstance))
return 0;
}
return 1;
}
//========================================================================
// Get the DLL
//========================================================================
extern "C" CPA_DLLBase __declspec(dllexport) *fn_p_oGetDLL(long lKey)
{
#ifdef DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
if (gs_p_oAIInterface == NULL)
{
gs_p_oAIInterface = new CPA_EdIR_Interface();
ASSERT(gs_p_oAIInterface != NULL);
}
g_pclAIInterface = gs_p_oAIInterface;
return gs_p_oAIInterface;
break;
default:
return NULL;
}
#else //DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
g_pclAIInterface=new CPA_EdIR_Interface();
return g_pclAIInterface;
break;
default:
return NULL;
}
#endif //DLL_ONLY_ONE_INSTANCE
}
//------------------------------------------------------------------------
// functions that are present in this type of DLL only :
//------------------------------------------------------------------------
#undef DLL_ONLY_ONE_INSTANCE

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,45 @@
// edirctsl.cpp : implementation file
//
#include "stdafx.h"
#include "EdIRRes.h"
#include "EdIRCtSl.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_SelCtrlList
CPA_EdIR_SelCtrlList::CPA_EdIR_SelCtrlList()
{
}
CPA_EdIR_SelCtrlList::~CPA_EdIR_SelCtrlList()
{
}
BEGIN_MESSAGE_MAP(CPA_EdIR_SelCtrlList, CListCtrl)
//{{AFX_MSG_MAP(CPA_EdIR_SelCtrlList)
ON_WM_KEYUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_SelCtrlList message handlers
void CPA_EdIR_SelCtrlList::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CWnd * pCWnd = GetParent();
if( pCWnd )
{
pCWnd->SendMessage( WM_COMMAND, ID_IR_LIST_REFRESH, (LPARAM)m_hWnd );
}
CListCtrl::OnKeyUp(nChar, nRepCnt, nFlags);
}

View File

@@ -0,0 +1,212 @@
// EdIRIAWd.cpp : implementation file
//
int fn_iLoadAllWords( LDT_tdst_Link* pLink, CPA_EdIR_Dictionary **ppclDictionnnary )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *sz;
ASSERT(LDT_szGetParam(2)==NULL);
ASSERT((sz=LDT_szGetParam(1))!=NULL);
(*ppclDictionnnary)=new CPA_EdIR_Dictionary(atoi(sz),C_NB_LANGUAGES);
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_BeginSection: /* a subsection */
LDT_LoadSection( NULL );
}
}
return 0;
}
/****************************************************************************/
int fn_iLoadOneWord( LDT_tdst_Link *pLink,
CPA_EdIR_Dictionary *pclDictionnnary,
td_fn_lFindIdFromScriptName fn_lFindIdFromScriptName,
td_fn_bIdIsValid fn_bIdIsValid)
{
LDT_tdeParseResult result=ParseResult_BeginSection;
static CString csScriptName=C_INVALID_SCRIPTNAME;
static long lId=C_INVALID_ID;
static char szAction[MAX_PATH];
strcpy( szAction, LDT_szGetSectionName() );
csScriptName=szAction;
lId=fn_lFindIdFromScriptName(szAction);
ASSERT(M_SCRIPTNAME_IS_VALID(csScriptName));
ASSERT(fn_bIdIsValid(lId));
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *sz;
ASSERT(LDT_szGetParam(2)==NULL);
ASSERT((sz=LDT_szGetParam(1))!=NULL);
CString csName=sz;
CString csLanguage=LDT_szGetEntryName();
pclDictionnnary->m_fn_vAddEntry(csScriptName,lId,csName,csLanguage);
}
}
}
csScriptName=C_INVALID_SCRIPTNAME;
lId=C_INVALID_ID;
return SCR_ERV_Anl_NormalReturn;
}
/****************************************************************************/
int fn_iLoadAllMetaActions(LDT_tdst_Link *pLink)
{
return fn_iLoadAllWords(pLink, &gs_pclMetaActionDictionnary);
}
/****************************************************************************/
int fn_iLoadOneMetaAction(LDT_tdst_Link *pLink)
{
return fn_iLoadOneWord(pLink,
gs_pclMetaActionDictionnary,
(td_fn_lFindIdFromScriptName *)fn_eFindMetaActionIdFromScriptName,
fn_bIsMetaActionIdValid);
}
/****************************************************************************/
int fn_iLoadAllProcedures(LDT_tdst_Link *pLink)
{
return fn_iLoadAllWords(pLink, &gs_pclProcedureDictionnary);
}
/****************************************************************************/
int fn_iLoadOneProcedure(LDT_tdst_Link *pLink)
{
return fn_iLoadOneWord(pLink,
gs_pclProcedureDictionnary,
(td_fn_lFindIdFromScriptName *)fn_eFindProcedureIdFromScriptName,
fn_bIsProcedureIdValid);
}
/****************************************************************************/
int fn_iLoadAllFunctions(LDT_tdst_Link *pLink)
{
return fn_iLoadAllWords(pLink,&gs_pclFunctionDictionnary);
}
/****************************************************************************/
int fn_iLoadOneFunction(LDT_tdst_Link *pLink)
{
return fn_iLoadOneWord(pLink,
gs_pclFunctionDictionnary,
(td_fn_lFindIdFromScriptName *)fn_eFindFunctionIdFromScriptName,
fn_bIsFunctionIdValid);
}
/****************************************************************************/
int fn_iLoadAllConditions(LDT_tdst_Link *pLink)
{
return fn_iLoadAllWords(pLink, &gs_pclConditionDictionnary);
}
/****************************************************************************/
int fn_iLoadOneCondition(LDT_tdst_Link *pLink)
{
return fn_iLoadOneWord(pLink,
gs_pclConditionDictionnary,
(td_fn_lFindIdFromScriptName *)fn_eFindConditionIdFromScriptName,
fn_bIsConditionIdValid);
}
/****************************************************************************/
int fn_iLoadAllKeyWords(LDT_tdst_Link *pLink)
{
return fn_iLoadAllWords(pLink, &gs_pclKeyWordDictionnary);
}
/****************************************************************************/
int fn_iLoadOneKeyWord(LDT_tdst_Link *pLink)
{
return fn_iLoadOneWord(pLink,
gs_pclKeyWordDictionnary,
(td_fn_lFindIdFromScriptName *)fn_eFindKeyWordIdFromScriptName,
fn_bIsKeyWordIdValid);
}
/****************************************************************************/
int fn_iLoadAllFields(LDT_tdst_Link *pLink)
{
return fn_iLoadAllWords(pLink, &gs_pclFieldDictionnary);
}
/****************************************************************************/
int fn_iLoadOneField(LDT_tdst_Link *pLink)
{
return fn_iLoadOneWord(pLink,
gs_pclFieldDictionnary,
(td_fn_lFindIdFromScriptName *)fn_eFindFieldIdFromScriptName,
fn_bIsFieldIdValid);
}
/****************************************************************************/
int fn_iLoadAllDsgVarTypes(LDT_tdst_Link *pLink)
{
return fn_iLoadAllWords(pLink, &gs_pclDsgVarTypeDictionnary);
}
/****************************************************************************/
int fn_iLoadOneDsgVarType(LDT_tdst_Link *pLink)
{
return fn_iLoadOneWord(pLink,
gs_pclDsgVarTypeDictionnary,
(td_fn_lFindIdFromScriptName *)fn_eFindDsgVarTypeIdFromScriptName,
fn_bIsDsgVarTypeIdValid);
}
/****************************************************************************/
int fn_iLoadAllDsgVarSaveTypes(LDT_tdst_Link *pLink)
{
return fn_iLoadAllWords(pLink, &gs_pclDsgVarSaveTypeDictionnary);
}
/****************************************************************************/
int fn_iLoadOneDsgVarSaveType(LDT_tdst_Link *pLink)
{
return fn_iLoadOneWord( pLink,
gs_pclDsgVarSaveTypeDictionnary,
(td_fn_lFindIdFromScriptName *)fn_ucFindSaveTypeNumberFromScriptName,
fn_bIsDsgVarSaveTypeIdValid);
}
/****************************************************************************/
int fn_iLoadAllDsgVarInitTypes(LDT_tdst_Link *pLink)
{
return fn_iLoadAllWords(pLink, &gs_pclDsgVarInitTypeDictionnary);
}
/****************************************************************************/
int fn_iLoadOneDsgVarInitType(LDT_tdst_Link *pLink)
{
return fn_iLoadOneWord(pLink,
gs_pclDsgVarInitTypeDictionnary,
(td_fn_lFindIdFromScriptName *)fn_ucFindInitTypeNumberFromScriptName,
fn_bIsDsgVarInitTypeIdValid);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,517 @@
// EdIRLoadCB.cpp : implementation of the CEdIAFrame class
//
/**********************************************************************************/
long pBrain;
long pList;
long pModel;
void CPA_EdIR_Frame::m_fn_vLoadBrain(CPA_Actor *pclModel,CString csModelName)
{
//Loads Intelligence
CString csFileName=csModelName+g_c_csIntelligenceFileExtension;
CString csFileNameQS=csModelName+g_c_csIntelligenceFileExtensionQS;
CString csSectionName=csFileName+'^'+g_c_csIntelligenceSectionName;
CString csSectionNameQS=csFileNameQS+'^'+g_c_csIntelligenceSectionName;
BOOL bQuickSaveFileExists=FALSE;
BOOL bLoadQuickSaveFile=FALSE;
BOOL bAsksQuestion=TRUE;
BOOL bDeleteQuick = FALSE;
char Path[255], File[255];
char *psz_Temp;
CString csBaseMsg="Would you like to load QuickSave for ";
char *psz_Famil = fn_szGetFamiliesDataPath();
pBrain=(long)(((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_pclBrain);
bQuickSaveFileExists=FALSE;
bDeleteQuick=FALSE;
if(QuickSaveNoAll == FALSE)
bQuickSaveFileExists=!LDT_SearchFile(M_MAKECHAR(csFileNameQS), NULL);
if(bQuickSaveFileExists)
{
CString csMsg=csBaseMsg+csModelName+" model ?";
if((QuickSaveDeleteAll == FALSE)&&(bAsksQuestion))
{
int iRes = QuickSaveDialog(csMsg);
switch(iRes)
{
case IDYES: bLoadQuickSaveFile = TRUE; break;
case IDNO: bLoadQuickSaveFile = FALSE; break;
case IDNOALL: bLoadQuickSaveFile = FALSE; QuickSaveNoAll = TRUE; break;
case IDDELETE: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; break;
case IDDELETEALL: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; QuickSaveDeleteAll = TRUE; break;
}
}
bAsksQuestion=FALSE;
if(bDeleteQuick || QuickSaveDeleteAll)
{
strcpy(Path, psz_Famil);
strcat(Path, "\\");
strcpy(File, (char *) (LPCSTR) csSectionNameQS);
psz_Temp = strrchr(File, '^');
if(psz_Temp)
{
*psz_Temp = '\0';
strcat(Path, File);
chmod(Path, _S_IWRITE);
unlink(Path);
}
bLoadQuickSaveFile = FALSE;
}
else if (bLoadQuickSaveFile)
{
CPA_EdIR_Brain *pclBrain=((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_pclBrain;
pclBrain->m_fn_vSetModified(TRUE);
pclBrain->m_fn_vNotify();
// for instances
CPA_List<CPA_BaseObject> clInstancesList;
g_pclAIInterface->GetMainWorld()->fn_lFindObjects(&clInstancesList,"",C_szActorInstanceTypeName,pclModel);
POSITION pos1=clInstancesList.GetHeadPosition();
while(pos1!=NULL)
{
CPA_Actor *pclInstance=(CPA_Actor *)(clInstancesList.GetNext(pos1));
tdstEngineObject *pstEngineObject=(tdstEngineObject *)pclInstance->GetStruct();
MS_tdxHandleToBrain hBrain=pstEngineObject->h_Brain;
if(hBrain)
AI_M_ucErrorFlag(M_pstGetMindOfBrain(hBrain))=1;
}
}
}
if(bLoadQuickSaveFile)
LDT_LoadSection(M_MAKECHAR(csSectionNameQS));
else
LDT_LoadSection(M_MAKECHAR(csSectionName));
//Loads Reflex
csFileName=csModelName+g_c_csReflexFileExtension;
csFileNameQS=csModelName+g_c_csReflexFileExtensionQS;
csSectionName=csFileName+'^'+g_c_csReflexSectionName;
csSectionNameQS=csFileNameQS+'^'+g_c_csReflexSectionName;
bQuickSaveFileExists=FALSE;
if(QuickSaveNoAll == FALSE)
bQuickSaveFileExists=!LDT_SearchFile(M_MAKECHAR(csFileNameQS), NULL);
if(bQuickSaveFileExists)
{
CString csMsg=csBaseMsg+csModelName+" model ?";
if((QuickSaveDeleteAll == FALSE)&&(bAsksQuestion))
{
int iRes = QuickSaveDialog(csMsg);
switch(iRes)
{
case IDYES: bLoadQuickSaveFile = TRUE; break;
case IDNO: bLoadQuickSaveFile = FALSE; break;
case IDNOALL: bLoadQuickSaveFile = FALSE; QuickSaveNoAll = TRUE; break;
case IDDELETE: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; break;
case IDDELETEALL: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; QuickSaveDeleteAll = TRUE; break;
}
}
bAsksQuestion=FALSE;
if(bDeleteQuick || QuickSaveDeleteAll)
{
strcpy(Path, psz_Famil);
strcat(Path, "\\");
strcpy(File, (char *) (LPCSTR) csSectionNameQS);
psz_Temp = strrchr(File, '^');
if(psz_Temp)
{
*psz_Temp = '\0';
strcat(Path, File);
chmod(Path, _S_IWRITE);
unlink(Path);
}
bLoadQuickSaveFile = FALSE;
}
}
if(bLoadQuickSaveFile)
LDT_LoadSection(M_MAKECHAR(csSectionNameQS));
else
LDT_LoadSection(M_MAKECHAR(csSectionName));
//Loads Declaration
csFileName=csModelName+g_c_csDeclarationFileExtension;
csFileNameQS=csModelName+g_c_csDeclarationFileExtensionQS;
csSectionName=csFileName+'^'+g_c_csDeclarationSectionName;
csSectionNameQS=csFileNameQS+'^'+g_c_csDeclarationSectionName;
//SCR_M_RdL0_SetContextLong(1,0,(long)(((EdActors_EditorActorModel *)pclModel->m_fn_pclGetEditorActor())->m_pclBrain));
bQuickSaveFileExists=FALSE;
if(QuickSaveNoAll == FALSE)
bQuickSaveFileExists=!LDT_SearchFile(M_MAKECHAR(csFileNameQS), NULL);
if(bQuickSaveFileExists)
{
CString csMsg=csBaseMsg+csModelName+" model ?";
if((QuickSaveDeleteAll == FALSE)&&(bAsksQuestion))
{
int iRes = QuickSaveDialog(csMsg);
switch(iRes)
{
case IDYES: bLoadQuickSaveFile = TRUE; break;
case IDNO: bLoadQuickSaveFile = FALSE; break;
case IDNOALL: bLoadQuickSaveFile = FALSE; QuickSaveNoAll = TRUE; break;
case IDDELETE: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; break;
case IDDELETEALL: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; QuickSaveDeleteAll = TRUE; break;
}
}
bAsksQuestion=FALSE;
if(bDeleteQuick || QuickSaveDeleteAll)
{
strcpy(Path, psz_Famil);
strcat(Path, "\\");
strcpy(File, (char *) (LPCSTR) csSectionNameQS);
psz_Temp = strrchr(File, '^');
if(psz_Temp)
{
*psz_Temp = '\0';
strcat(Path, File);
chmod(Path, _S_IWRITE);
unlink(Path);
}
bLoadQuickSaveFile = FALSE;
}
}
if(bLoadQuickSaveFile)
LDT_LoadSection(M_MAKECHAR(csSectionNameQS));
else
LDT_LoadSection(M_MAKECHAR(csSectionName));
//Loads Macros
csFileName=csModelName+g_c_csMacroFileExtension;
csFileNameQS=csModelName+g_c_csMacroFileExtensionQS;
csSectionName=csFileName+'^'+g_c_csMacroSectionName;
csSectionNameQS=csFileNameQS+'^'+g_c_csMacroSectionName;
bQuickSaveFileExists=FALSE;
if(QuickSaveNoAll == FALSE)
bQuickSaveFileExists=!LDT_SearchFile(M_MAKECHAR(csFileNameQS), NULL);
if(bQuickSaveFileExists)
{
CString csMsg=csBaseMsg+csModelName+" model ?";
if((QuickSaveDeleteAll == FALSE)&&(bAsksQuestion))
{
int iRes = QuickSaveDialog(csMsg);
switch(iRes)
{
case IDYES: bLoadQuickSaveFile = TRUE; break;
case IDNO: bLoadQuickSaveFile = FALSE; break;
case IDNOALL: bLoadQuickSaveFile = FALSE; QuickSaveNoAll = TRUE; break;
case IDDELETE: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; break;
case IDDELETEALL: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; QuickSaveDeleteAll = TRUE; break;
}
}
bAsksQuestion=FALSE;
if(bDeleteQuick || QuickSaveDeleteAll)
{
strcpy(Path, psz_Famil);
strcat(Path, "\\");
strcpy(File, (char *) (LPCSTR) csSectionNameQS);
psz_Temp = strrchr(File, '^');
if(psz_Temp)
{
*psz_Temp = '\0';
strcat(Path, File);
chmod(Path, _S_IWRITE);
unlink(Path);
}
bLoadQuickSaveFile = FALSE;
}
}
if(bLoadQuickSaveFile)
LDT_LoadSection(M_MAKECHAR(csSectionNameQS));
else
LDT_LoadSection(M_MAKECHAR(csSectionName));
//Loads Subrs
csFileName=csModelName+g_c_csSubrFileExtension;
csFileNameQS=csModelName+g_c_csSubrFileExtensionQS;
csSectionName=csFileName+'^'+g_c_csSubrSectionName;
csSectionNameQS=csFileNameQS+'^'+g_c_csSubrSectionName;
bQuickSaveFileExists=FALSE;
if(QuickSaveNoAll == FALSE)
bQuickSaveFileExists=!LDT_SearchFile(M_MAKECHAR(csFileNameQS), NULL);
if(bQuickSaveFileExists)
{
CString csMsg=csBaseMsg+csModelName+" model ?";
if((QuickSaveDeleteAll == FALSE)&&(bAsksQuestion))
{
int iRes = QuickSaveDialog(csMsg);
switch(iRes)
{
case IDYES: bLoadQuickSaveFile = TRUE; break;
case IDNO: bLoadQuickSaveFile = FALSE; break;
case IDNOALL: bLoadQuickSaveFile = FALSE; QuickSaveNoAll = TRUE; break;
case IDDELETE: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; break;
case IDDELETEALL: bLoadQuickSaveFile = FALSE; bDeleteQuick = TRUE; QuickSaveDeleteAll = TRUE; break;
}
}
bAsksQuestion=FALSE;
if(bDeleteQuick || QuickSaveDeleteAll)
{
strcpy(Path, psz_Famil);
strcat(Path, "\\");
strcpy(File, (char *) (LPCSTR) csSectionNameQS);
psz_Temp = strrchr(File, '^');
if(psz_Temp)
{
*psz_Temp = '\0';
strcat(Path, File);
chmod(Path, _S_IWRITE);
unlink(Path);
}
bLoadQuickSaveFile = FALSE;
}
}
if(bLoadQuickSaveFile)
LDT_LoadSection(M_MAKECHAR(csSectionNameQS));
else
LDT_LoadSection(M_MAKECHAR(csSectionName));
}
/**********************************************************************************/
int CPA_EdIR_Frame::m_fn_iLoadIntelligence( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
CPA_EdIR_Brain *p_clBrain=(CPA_EdIR_Brain *)pBrain;
pList=long(&(p_clBrain->m_clListOfIntelligenceBehaviours));
pModel=long(p_clBrain->m_fn_pclGetModel());
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_BeginSection: /* a subsection */
LDT_LoadSection( NULL );
}
}
return 0;
}
/**********************************************************************************/
int CPA_EdIR_Frame::m_fn_iLoadReflex( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
CPA_EdIR_Brain *p_clBrain=(CPA_EdIR_Brain *)pBrain;
pList=long(&(p_clBrain->m_clListOfReflexBehaviours));
pModel=long(p_clBrain->m_fn_pclGetModel());
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_BeginSection: /* a subsection */
LDT_LoadSection( NULL );
}
}
return 0;
}
/**********************************************************************************/
int CPA_EdIR_Frame::m_fn_iLoadDeclaration( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
CPA_EdIR_Brain *p_clBrain=(CPA_EdIR_Brain *)pBrain;
pList=long(&(p_clBrain->m_clListOfDeclarations));
pModel=long(p_clBrain->m_fn_pclGetModel());
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_BeginSection: /* a subsection */
LDT_LoadSection( NULL );
}
}
return 0;
}
/**********************************************************************************/
int CPA_EdIR_Frame::m_fn_iLoadMacro( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
CPA_EdIR_Brain *p_clBrain=(CPA_EdIR_Brain *)pBrain;
pList=long(&(p_clBrain->m_clListOfMacros));
pModel=long(p_clBrain->m_fn_pclGetModel());
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_BeginSection: /* a subsection */
LDT_LoadSection( NULL );
}
}
return 0;
}
/**********************************************************************************/
int CPA_EdIR_Frame::m_fn_iLoadSubr( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
CPA_EdIR_Brain *p_clBrain=(CPA_EdIR_Brain *)pBrain;
pList=long(&(p_clBrain->m_clListOfSubrs));
pModel=long(p_clBrain->m_fn_pclGetModel());
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_BeginSection: /* a subsection */
LDT_LoadSection( NULL );
}
}
return 0;
}
/**********************************************************************************/
int CPA_EdIR_Frame::m_fn_iLoadMainBehaviour( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
CPA_EdIR_MainBehaviourList *p_clMainBehaviourList=(CPA_EdIR_MainBehaviourList *)pList;
static CPA_EdIR_MainBehaviour *s_pclMainBehaviour;
static CString s_csLanguage;
CPA_Actor *pclModel=(CPA_Actor*)pModel;
s_pclMainBehaviour=new CPA_EdIR_MainBehaviour(pclModel);
s_csLanguage="French";
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szAction=LDT_szGetEntryName();
if(strcmpi(szAction,g_c_csBehaviourLanguage)==0)
{
s_csLanguage=LDT_szGetParam(1);
}
else
if(strcmpi(szAction,g_c_csBehaviourName)==0)
{
if(s_pclMainBehaviour->fn_eRename(CString(LDT_szGetParam(1)))!=E_mc_None)
s_pclMainBehaviour->SetDefaultUniqueName();
}
else
if(strcmpi(szAction,g_c_csBehaviourBoundingBox)==0)
{
s_pclMainBehaviour->m_crPosition.left=atol(LDT_szGetParam(1));
s_pclMainBehaviour->m_crPosition.top=atol(LDT_szGetParam(2));
s_pclMainBehaviour->m_crPosition.right=atol(LDT_szGetParam(3));
s_pclMainBehaviour->m_crPosition.bottom=atol(LDT_szGetParam(4));
}
else
if(strcmpi(szAction,g_c_csBehaviourText)==0)
{
//Old file format
if(LDT_iGetNbParams()==4)
{
CFile cfFile;
CString csFileName;
csFileName=fn_szGetFamiliesDataPath()+CString("\\")+
CString(LDT_szGetParam(1));
if(cfFile.Open(csFileName,CFile::modeRead))
{
long lOffset=atol(LDT_szGetParam(1));
long lLen=atol(LDT_szGetParam(2));
char *p_cBuf=new char[lLen+1];
cfFile.Seek(lOffset,CFile::begin);
cfFile.Read(p_cBuf,lLen);
p_cBuf[lLen]=0;
s_pclMainBehaviour->m_csText=p_cBuf;
delete[] p_cBuf;
cfFile.Close();
}
}
//New file format
else
{
CString csLine=CString(LDT_szGetParam(1));
csLine=fn_csReplaceChar(csLine,'\'','\"');
s_pclMainBehaviour->m_csText+=csLine+"\xD\xA";
}
}
}
}
}
//Deletes the last "\xD\xA" sequence
if(s_pclMainBehaviour->m_csText.Right(2).CompareNoCase("\xD\xA")==0)
s_pclMainBehaviour->m_csText=s_pclMainBehaviour->m_csText.Left(s_pclMainBehaviour->m_csText.GetLength()-2);
//Translates text if needed
CString csCurrentLanguage=g_pclAIInterface->M_GetMainWorld()->GetInterface()->fn_csGetCurrentLanguage();
if(s_csLanguage!=csCurrentLanguage)
{
s_pclMainBehaviour->m_csText=fn_csFastTranslateText(s_pclMainBehaviour->m_csText,s_csLanguage,csCurrentLanguage);
}
p_clMainBehaviourList->AddTail(s_pclMainBehaviour);
LDT_SetVolatileSubsection( pLink );
return 0;
}

View File

@@ -0,0 +1,343 @@
// edirsele.cpp : implementation file
//
#include "stdafx.h"
#include "EdIRRes.h"
#include "EdIRSele.hpp"
#include "EdIRFrm.hpp"
#include "EdIRIRD.hpp"
#include "EdIRBeEn.hpp"
#include "EdIRIAGl.hpp"
#include "ai_intf.hpp"
#include "_Actors.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_Select_IAObj dialog
CPA_EdIR_Select_IAObj::CPA_EdIR_Select_IAObj(CWnd* pParent /*=NULL*/, BOOL bPShow /*=FALSE*/, CString csIncomplete /*=""*/)
: CDialog(CPA_EdIR_Select_IAObj::IDD, pParent)
{
//{{AFX_DATA_INIT(CPA_EdIR_Select_IAObj)
//}}AFX_DATA_INIT
m_bParentsShow = bPShow;
m_csIncompleteWord = csIncomplete;
m_pclTypesList = fn_pclGetListIATypeObjects();
m_pclParentsList = new CStringList();
m_pclDataList = new CStringList();
CPA_BaseObject *p = g_pclAIInterface->m_pclIRMainFrame->m_pclBrain->m_fn_pclGetModel();
ASSERT( p && p->GetOwner() );
m_csCurrentModel = p->GetName();
m_csCurrentFamily = p->GetOwner()->GetName();
m_csCurrentParent = "";
m_csCurrentType = "";
}
void CPA_EdIR_Select_IAObj::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPA_EdIR_Select_IAObj)
DDX_Control(pDX, IDC_LIST_TYPES, m_clCListTypes);
DDX_Control(pDX, IDC_LIST_PARENTS, m_clCListParents);
DDX_Control(pDX, IDC_LIST_DATA, m_clCListData);
DDX_Control(pDX, IDC_BUTTON_SHOW_HIDE, m_cbCButton);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPA_EdIR_Select_IAObj, CDialog)
//{{AFX_MSG_MAP(CPA_EdIR_Select_IAObj)
ON_BN_CLICKED(IDC_BUTTON_SHOW_HIDE, OnButtonShowHide)
ON_NOTIFY(NM_CLICK, IDC_LIST_TYPES, OnClickListTypes)
ON_NOTIFY(NM_CLICK, IDC_LIST_PARENTS, OnClickListParents)
ON_NOTIFY(NM_DBLCLK, IDC_LIST_DATA, OnDblclkListData)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPA_EdIR_Select_IAObj message handlers
void CPA_EdIR_Select_IAObj::OnButtonShowHide()
{
m_bParentsShow = !m_bParentsShow;
m_fn_vToggleParents();
}
BOOL CPA_EdIR_Select_IAObj::OnInitDialog()
{
CDialog::OnInitDialog();
m_clCListTypes.GetWindowRect( &m_crCRectTypes1 );
ScreenToClient( &m_crCRectTypes1 );
m_clCListData.GetWindowRect( &m_crCRectData1 );
ScreenToClient( &m_crCRectData1 );
CRect CRectParents;
m_clCListParents.GetWindowRect( &CRectParents );
m_crCRectTypes2 = m_crCRectTypes1;
m_crCRectData2 = m_crCRectData1;
m_crCRectTypes2.DeflateRect( 0, 0, ( CRectParents.Width()/2 ), 0 );
m_crCRectData2.DeflateRect( ( CRectParents.Width()/2 ), 0, 0, 0 );
m_clCListTypes.InsertColumn( 0, "Object type", LVCFMT_LEFT, 300,0 );
POSITION pos=m_pclTypesList->GetHeadPosition();
int ipos = 0;
while(pos)
m_clCListTypes.InsertItem(ipos++, m_pclTypesList->GetNext(pos));
m_clCListParents.InsertColumn( 0, "Object name", LVCFMT_LEFT, 300, 0 );
//m_clCListParents.InsertColumn( 1, "Object type", LVCFMT_LEFT, CRectParents.Width()/2, 1 );
m_clCListData.InsertColumn( 0, "Object name", LVCFMT_LEFT, 300, 0 );
m_fn_vToggleParents();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPA_EdIR_Select_IAObj::m_fn_vToggleParents()
{
if( m_bParentsShow )
{ m_clCListParents.ShowWindow( SW_SHOW );
m_clCListTypes.MoveWindow( m_crCRectTypes2, TRUE );
m_clCListData.MoveWindow( m_crCRectData2, TRUE );
m_cbCButton.SetWindowText( "&Hide parents" );
OnTypeSelection();
m_clCListParents.SetFocus();
}
else
{ m_clCListParents.ShowWindow( SW_HIDE );
m_clCListTypes.MoveWindow( m_crCRectTypes1, TRUE );
m_clCListData.MoveWindow( m_crCRectData1, TRUE );
m_cbCButton.SetWindowText( "&Show parents" );
OnTypeSelection();
m_clCListTypes.SetFocus();
}
}
CPA_EdIR_Select_IAObj::~CPA_EdIR_Select_IAObj()
{
delete m_pclTypesList;
delete m_pclParentsList;
delete m_pclDataList;
}
void CPA_EdIR_Select_IAObj::OnTypeSelection( )
{
int SelectedItem = -1;
for( int i = 0; i < m_clCListTypes.GetItemCount(); i++ )
if( m_clCListTypes.GetItemState( i, LVIS_SELECTED ) )
{
SelectedItem = i;
break;
}
if( SelectedItem == -1 )
return;
m_csCurrentType = m_clCListTypes.GetItemText( SelectedItem, 0);
m_pclParentsList->RemoveAll();
m_pclDataList->RemoveAll();
fn_vAddListOfIAObjectsForType( m_pclParentsList, m_pclDataList, "", m_csCurrentType );
if( m_bParentsShow )
{
m_fn_vRefreshListParents( );
if( m_fn_bTrySelectModelOrFamily() )
{
OnParentsSelection();
m_clCListParents.SetFocus( );
}
else
m_fn_vRefreshListData( );
}
else
m_fn_vRefreshListData( );
}
void CPA_EdIR_Select_IAObj::OnClickListTypes(NMHDR* pNMHDR, LRESULT* pResult)
{
OnTypeSelection( );
*pResult = 0;
}
BOOL CPA_EdIR_Select_IAObj::m_fn_bCheckComplete( CString csName )
{
int iIndex = csName.Find( m_csIncompleteWord );
if( iIndex )
return FALSE;
return TRUE;
}
void CPA_EdIR_Select_IAObj::OnParentsSelection()
{
int SelectedItem = -1;
for( int i = 0; i < m_clCListParents.GetItemCount(); i++ )
if( m_clCListParents.GetItemState( i, LVIS_SELECTED ) )
{
SelectedItem = i;
break;
}
if( SelectedItem == -1 )
return;
m_csCurrentParent = m_clCListParents.GetItemText( SelectedItem, 0 );
m_pclDataList->RemoveAll();
fn_vAddListOfIAObjectsForType( m_pclParentsList, m_pclDataList, m_csCurrentParent, m_csCurrentType );
m_fn_vRefreshListData( );
}
void CPA_EdIR_Select_IAObj::m_fn_vRefreshListData( )
{
int ipos = 0;
POSITION pos;
CString csString;
m_clCListData.DeleteAllItems();
pos = m_pclDataList->GetHeadPosition();
while(pos)
{
csString = m_pclDataList->GetNext( pos );
if( m_fn_bCheckComplete( csString ) )
m_clCListData.InsertItem( ipos++, csString );
}
m_clCListData.UpdateWindow();
}
void CPA_EdIR_Select_IAObj::m_fn_vRefreshListParents( )
{
int ipos = 0;
POSITION pos;
m_clCListParents.DeleteAllItems();
pos = m_pclParentsList->GetHeadPosition();
while(pos)
m_clCListParents.InsertItem( ipos++, m_pclParentsList->GetNext( pos ) );
m_clCListParents.UpdateWindow();
}
void CPA_EdIR_Select_IAObj::OnClickListParents(NMHDR* pNMHDR, LRESULT* pResult)
{
OnParentsSelection();
*pResult = 0;
}
BOOL CPA_EdIR_Select_IAObj::m_fn_bTrySelectModelOrFamily()
{
LV_FINDINFO lvInfo;
int iIndex;
lvInfo.flags = LVFI_STRING;
lvInfo.psz = m_csCurrentParent;
iIndex = m_clCListParents.FindItem( &lvInfo );
if( iIndex >=0 )
{
m_clCListParents.SetItemState( iIndex, LVIS_SELECTED, LVIS_SELECTED );
m_clCListParents.EnsureVisible( iIndex, FALSE );
return TRUE;
}
lvInfo.psz = m_csCurrentFamily;
iIndex = m_clCListParents.FindItem( &lvInfo );
if( iIndex >=0 )
{
m_clCListParents.SetItemState( iIndex, LVIS_SELECTED, LVIS_SELECTED );
m_clCListParents.EnsureVisible( iIndex, FALSE );
return TRUE;
}
lvInfo.psz = m_csCurrentModel;
iIndex = m_clCListParents.FindItem( &lvInfo );
if( iIndex >=0 )
{
m_clCListParents.SetItemState( iIndex, LVIS_SELECTED, LVIS_SELECTED );
m_clCListParents.EnsureVisible( iIndex, FALSE );
return TRUE;
}
return FALSE;
}
void CPA_EdIR_Select_IAObj::OnDblclkListData(NMHDR* pNMHDR, LRESULT* pResult)
{
OnDataSelection();
*pResult = 0;
}
void CPA_EdIR_Select_IAObj::OnOK()
{
if( GetFocus() == &m_clCListData )
OnDataSelection();
}
void CPA_EdIR_Select_IAObj::OnDataSelection()
{
int SelectedItem = -1;
for( int i = 0; i < m_clCListData.GetItemCount(); i++ )
if( m_clCListData.GetItemState( i, LVIS_SELECTED ) )
{
SelectedItem = i;
break;
}
if( SelectedItem == -1 )
return;
if ( ( GetKeyState(VK_CONTROL) & (1<<15) ) && m_fn_bTrySelectModelOrFamily() && m_csIncompleteWord.IsEmpty() )
m_csRetWord = m_csCurrentParent + "@";
else
m_csRetWord = "";
m_csRetWord = m_csRetWord + m_clCListData.GetItemText( SelectedItem, 0 );
CDialog::OnOK();
}
BOOL CPA_EdIR_Select_IAObj::OnCommand(WPARAM wParam, LPARAM lParam)
{
if( wParam == ID_IR_LIST_REFRESH )
{
if( ::GetDlgItem( m_hWnd, IDC_LIST_TYPES ) == (HWND)lParam )
OnTypeSelection();
else
if( ::GetDlgItem( m_hWnd, IDC_LIST_PARENTS ) == (HWND)lParam )
OnParentsSelection();
return TRUE;
}
return CDialog::OnCommand(wParam, lParam);
}

View File

@@ -0,0 +1,261 @@
// RichEditCtrlWithLineManagement.cpp : implementation file
//
#include "stdafx.h"
#include "RichEditCtrlWithLineManagement.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define EDIT_EOLN "\r\n"
/////////////////////////////////////////////////////////////////////////////
// CRichEditCtrlWithLineManagement
//**********************************************************************************
CRichEditCtrlWithLineManagement::CRichEditCtrlWithLineManagement()
: CRichEditCtrl ()
{
}
//**********************************************************************************
CRichEditCtrlWithLineManagement::~CRichEditCtrlWithLineManagement()
{
}
//**********************************************************************************
CString CRichEditCtrlWithLineManagement::m_fn_csGetLine (long lLineNumber)
{
static char buf[500];
long lLength = GetLine (lLineNumber, & buf [0], 496);
// without the eol!
buf [lLength - strlen (EDIT_EOLN)] = 0;
return (CString) buf;
}
//**********************************************************************************
void CRichEditCtrlWithLineManagement::m_fn_vDeleteLine (long lLineNumber)
{
long lLineIndex = LineIndex (lLineNumber);
if (lLineIndex >= 0)
{
long lNextLineIndex = LineIndex (lLineNumber + 1);
if (lNextLineIndex < 0)
{
// last line
lNextLineIndex = lLineIndex + LineLength (lLineNumber);
}
SetSel (lLineIndex, lNextLineIndex);
ReplaceSel ("");
}
}
//**********************************************************************************
void CRichEditCtrlWithLineManagement::m_fn_vAddLine (long lLineNumber, CString csLineText)
{
long lLineIndex = LineIndex (lLineNumber);
if (lLineIndex >= 0)
{
SetSel (lLineIndex, lLineIndex);
csLineText += EDIT_EOLN;
ReplaceSel (csLineText);
}
}
//**********************************************************************************
void CRichEditCtrlWithLineManagement::m_fn_vReplaceLine (long lLineNumber, CString csLineText)
{
long lLineIndex = LineIndex (lLineNumber);
if (lLineIndex >= 0)
{
long lNextLineIndex = LineIndex (lLineNumber + 1);
if (lNextLineIndex < 0)
{
// last line
lNextLineIndex = lLineIndex + LineLength (lLineNumber);
}
else
{
// append as a line
csLineText += EDIT_EOLN;
}
SetSel (lLineIndex, lNextLineIndex);
ReplaceSel (csLineText);
}
}
//**********************************************************************************
void CRichEditCtrlWithLineManagement::m_fn_vAppendLine (CString csLineText)
{
long lLastCharIndex = GetTextLength ();
SetSel (lLastCharIndex, lLastCharIndex);
char buf[2];
GetSelText (& buf [0]);
csLineText = (CString) buf + EDIT_EOLN + csLineText;
ReplaceSel (csLineText);
}
//**********************************************************************************
void CRichEditCtrlWithLineManagement::m_fn_vHideLines (CList <long, long> & clHiddenLinesNumbers)
{
long lHiddenLineNumber;
CString csHiddenLineText;
// put back the old hidden lines
POSITION posNumber = m_clHiddenLinesNumbers . GetHeadPosition ();
POSITION posText = m_cslHiddenLines . GetHeadPosition ();
while (posNumber && posText)
{
lHiddenLineNumber = m_clHiddenLinesNumbers . GetNext (posNumber);
csHiddenLineText = m_cslHiddenLines . GetNext (posText);
if (lHiddenLineNumber <= GetLineCount ())
m_fn_vAddLine (lHiddenLineNumber, csHiddenLineText);
else
m_fn_vAppendLine (csHiddenLineText);
}
// clean up
m_clHiddenLinesNumbers . RemoveAll ();
m_cslHiddenLines . RemoveAll ();
// hide the new ones
POSITION pos = clHiddenLinesNumbers . GetHeadPosition ();
long lAlreadyHiddenCount = 0;
long lLastHiddenLineNumber = -1;
while (pos)
{
lHiddenLineNumber = clHiddenLinesNumbers . GetNext (pos);
if (lHiddenLineNumber >= 0 && lHiddenLineNumber < GetLineCount () + lAlreadyHiddenCount && lHiddenLineNumber > lLastHiddenLineNumber)
{
// assuming ascending order, plus only one appearance, ignore anything breaking the rule
m_clHiddenLinesNumbers . AddTail (lHiddenLineNumber);
csHiddenLineText = m_fn_csGetLine (lHiddenLineNumber - lAlreadyHiddenCount);
m_cslHiddenLines . AddTail (csHiddenLineText);
m_fn_vDeleteLine (lHiddenLineNumber - lAlreadyHiddenCount);
// update cycle parameters
lLastHiddenLineNumber = lHiddenLineNumber;
lAlreadyHiddenCount ++;
}
}
}
//**********************************************************************************
/*
void CRichEditCtrlWithLineManagement::m_fn_vMarkLines (CList <long, long> & clLineNumbers, COLORREF rgbMarkColor)
{
m_rgbMarkColor = rgbMarkColor;
POSITION pos = clLineNumbers . GetHeadPosition ();
}
*/
//**********************************************************************************
void CRichEditCtrlWithLineManagement::m_fn_vSetSelLine (long lLineNumber)
{
long lHiddenLineNumber;
long lRealLineNumber = lLineNumber;
POSITION pos = m_clHiddenLinesNumbers . GetHeadPosition ();
while (pos)
{
lHiddenLineNumber = m_clHiddenLinesNumbers . GetNext (pos);
if (lHiddenLineNumber < lLineNumber)
lRealLineNumber --;
else
break;
}
long lIndex = LineIndex (lRealLineNumber);
SetSel (lIndex, lIndex);
// scroll to the sel line
// scroll to the sel line
//Stefan Dumitrean 8-06-98 (new scroll)
// CPoint clCurPos = GetCharPos (lIndex);
//Sets scroll position
// clCurPos . x=0;
// ((CScrollView *) GetParent ()) -> ScrollToPosition (clCurPos);
//End Stefan Dumitrean 8-06-98
}
//**********************************************************************************
void CRichEditCtrlWithLineManagement::m_fn_vMarkLine (long lLineNumber)
{
long lHiddenLineNumber;
long lRealLineNumber = lLineNumber;
POSITION pos = m_clHiddenLinesNumbers . GetHeadPosition ();
while (pos)
{
lHiddenLineNumber = m_clHiddenLinesNumbers . GetNext (pos);
if (lHiddenLineNumber < lLineNumber)
lRealLineNumber --;
else
break;
}
long lIndexStart = LineIndex (lRealLineNumber);
long lIndexEnd = LineIndex (lRealLineNumber + 1);
SetSel (lIndexStart, lIndexEnd);
}
//**********************************************************************************
long CRichEditCtrlWithLineManagement::m_fn_lGetSelLine (void)
{
long lStartIndex, lEndIndex;
GetSel (lStartIndex, lEndIndex);
// get the sel line nb
long lCurLine = 0;
long lLineCount = GetLineCount ();
long lCurIndex = 0;
while (lCurLine < lLineCount && lCurIndex <= lStartIndex)
{
lCurLine ++;
lCurIndex = LineIndex (lCurLine);
}
lCurLine --;
if (lCurLine < 0)
lCurLine = 0;
// update with hidden lines
long lHiddenLineNumber;
POSITION pos = m_clHiddenLinesNumbers . GetHeadPosition ();
while (pos)
{
lHiddenLineNumber = m_clHiddenLinesNumbers . GetNext (pos);
if (lHiddenLineNumber <= lCurLine)
lCurLine ++;
else
break;
}
return lCurLine;
}
BEGIN_MESSAGE_MAP(CRichEditCtrlWithLineManagement, CRichEditCtrl)
//{{AFX_MSG_MAP(CRichEditCtrlWithLineManagement)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRichEditCtrlWithLineManagement message handlers