EgtInterface 1.6d3 :

- costanti stringa sostituite con costanti numeriche
- modificate funzioni API e LUA per scansione pezzi e layer
- aggiunta pulizia memoria al caricamento messaggi (necessario al cambio lingua)
- migliorie varie a funzioni Lua.
This commit is contained in:
Dario Sassi
2015-04-20 08:43:10 +00:00
parent fd718143e6
commit 9d3dc5e537
38 changed files with 810 additions and 824 deletions
+45 -19
View File
@@ -22,6 +22,14 @@
using namespace std ;
//-------------------------------------------------------------------------------
static bool
EgtIsUserObj( IGeomDB* pGeomDB, int nId)
{
int nLev ;
return ( pGeomDB->GetCalcLevel( nId, nLev) && nLev == GDB_LV_USER) ;
}
//-------------------------------------------------------------------------------
static bool
EgtIsVisibleObj( IGeomDB* pGeomDB, int nId)
@@ -32,10 +40,11 @@ EgtIsVisibleObj( IGeomDB* pGeomDB, int nId)
//-------------------------------------------------------------------------------
static int
EgtVerifyOrNextVisible( IGeomDB* pGeomDB, int nId)
EgtVerifyOrNext( IGeomDB* pGeomDB, int nId, bool bOnlyVisible)
{
while ( nId != GDB_ID_NULL) {
if ( EgtIsVisibleObj( pGeomDB, nId))
if ( EgtIsUserObj( pGeomDB, nId) &&
( ! bOnlyVisible || EgtIsVisibleObj( pGeomDB, nId)))
return nId ;
nId = pGeomDB->GetNextGroup( nId) ;
}
@@ -114,10 +123,10 @@ __stdcall EgtResetCurrPartLayer( void)
pGseCtx->m_nCurrPart = GDB_ID_NULL ;
pGseCtx->m_nCurrLayer = GDB_ID_NULL ;
// cerco il primo pezzo con un layer visibile
int nPartId = EgtGetFirstVisiblePart() ;
int nPartId = EgtGetFirstPart( true) ;
while ( nPartId != GDB_ID_NULL) {
// cerco il primo layer visibile del pezzo
int nLayerId = EgtGetFirstVisibleLayer( nPartId) ;
int nLayerId = EgtGetFirstLayer( nPartId, true) ;
if ( nLayerId != GDB_ID_NULL) {
// assegno il pezzo corrente
pGseCtx->m_nCurrPart = nPartId ;
@@ -126,11 +135,11 @@ __stdcall EgtResetCurrPartLayer( void)
// esco dal ciclo di ricerca
break ;
}
nPartId = EgtGetNextVisiblePart( nPartId) ;
nPartId = EgtGetNextPart( nPartId, true) ;
}
// se non ho trovato layer visibile mi accontento del primo pezzo visibile
if ( pGseCtx->m_nCurrPart == GDB_ID_NULL)
pGseCtx->m_nCurrPart = EgtGetFirstVisiblePart() ;
pGseCtx->m_nCurrPart = EgtGetFirstPart( true) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtResetCurrPartLayer()"
@@ -143,53 +152,70 @@ __stdcall EgtResetCurrPartLayer( void)
//-------------------------------------------------------------------------------
int
__stdcall EgtGetFirstVisiblePart( void)
__stdcall EgtGetPartNbr( bool bOnlyVisible)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// conto i pezzi, considerando richiesta di visibilità
int nCount = 0 ;
int nPartId = EgtGetFirstPart( bOnlyVisible) ;
while ( nPartId != GDB_ID_NULL) {
++ nCount ;
nPartId = EgtGetNextPart( nPartId, bOnlyVisible) ;
}
return nCount ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtGetFirstPart( bool bOnlyVisible)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero il primo gruppo sotto la radice
int nPartId = pGeomDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
// verifico sia visibile oppure passo al primo successivo visibile
return EgtVerifyOrNextVisible( pGeomDB, nPartId) ;
// verifico oppure passo al primo successivo valido
return EgtVerifyOrNext( pGeomDB, nPartId, bOnlyVisible) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtGetNextVisiblePart( int nId)
__stdcall EgtGetNextPart( int nId, bool bOnlyVisible)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero il successivo gruppo
int nPartId = pGeomDB->GetNextGroup( nId) ;
// verifico sia visibile oppure passo al primo successivo visibile
return EgtVerifyOrNextVisible( pGeomDB, nPartId) ;
// verifico oppure passo al primo successivo valido
return EgtVerifyOrNext( pGeomDB, nPartId, bOnlyVisible) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtGetFirstVisibleLayer( int nPartId)
__stdcall EgtGetFirstLayer( int nPartId, bool bOnlyVisible)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// verifico la visibilità del pezzo
if ( ! EgtIsVisibleObj( pGeomDB, nPartId))
// verifico il pezzo (livello utente e se richiesto visibile)
if ( ! EgtIsUserObj( pGeomDB, nPartId) ||
( bOnlyVisible && ! EgtIsVisibleObj( pGeomDB, nPartId)))
return GDB_ID_NULL ;
// recupero il primo layer nel pezzo
int nLayerId = pGeomDB->GetFirstGroupInGroup( nPartId) ;
// verifico sia visibile oppure passo al primo successivo visibile
return EgtVerifyOrNextVisible( pGeomDB, nLayerId) ;
// verifico oppure passo al primo successivo valido
return EgtVerifyOrNext( pGeomDB, nLayerId, bOnlyVisible) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtGetNextVisibleLayer( int nId)
__stdcall EgtGetNextLayer( int nId, bool bOnlyVisible)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero il successivo gruppo
int nLayerId = pGeomDB->GetNextGroup( nId) ;
// verifico sia visibile oppure passo al primo successivo visibile
return EgtVerifyOrNextVisible( pGeomDB, nLayerId) ;
return EgtVerifyOrNext( pGeomDB, nLayerId, bOnlyVisible) ;
}
//-----------------------------------------------------------------------------