EgtExecutor :
- aggiunte a Lua EgtGetLastPart, EgtGetPrevPart, EgtGetLastLayer e EgtGetPrevLayer - aggiunto parametro opzionale (separatore) a EgtSplitString di Lua - corrette (parametro di ritorno di tipo errato) EgtPackBox e EgtPackBoxCluster di Lua.
This commit is contained in:
@@ -159,6 +159,44 @@ LuaGetNextPart( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetLastPart( lua_State* L)
|
||||
{
|
||||
// nessuno o 1 parametro : [bOnlyVisible]
|
||||
bool bOnlyVisible = false ;
|
||||
LuaGetParam( L, 1, bOnlyVisible) ;
|
||||
LuaClearStack( L) ;
|
||||
// cerco ultimo pezzo
|
||||
int nId = ExeGetLastPart( bOnlyVisible) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetPrevPart( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nPartId [, bOnlyVisible]
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
bool bOnlyVisible = false ;
|
||||
LuaGetParam( L, 2, bOnlyVisible) ;
|
||||
LuaClearStack( L) ;
|
||||
// cerco pezzo precedente
|
||||
int nId = ExeGetPrevPart( nPartId, bOnlyVisible) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetFirstLayer( lua_State* L)
|
||||
@@ -199,6 +237,46 @@ LuaGetNextLayer( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetLastLayer( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nPartId [, bOnlyVisible]
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
bool bOnlyVisible = false ;
|
||||
LuaGetParam( L, 2, bOnlyVisible) ;
|
||||
LuaClearStack( L) ;
|
||||
// cerco l'ultimo layer del pezzo
|
||||
int nId = ExeGetLastLayer( nPartId, bOnlyVisible) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetPrevLayer( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nLayerId [, bOnlyVisible]
|
||||
int nLayerId ;
|
||||
LuaCheckParam( L, 1, nLayerId)
|
||||
bool bOnlyVisible = false ;
|
||||
LuaGetParam( L, 2, bOnlyVisible) ;
|
||||
LuaClearStack( L) ;
|
||||
// cerco il precedente layer (ovviamente dello stesso pezzo)
|
||||
int nId = ExeGetPrevLayer( nLayerId, bOnlyVisible) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaEraseEmptyParts( lua_State* L)
|
||||
@@ -303,8 +381,12 @@ LuaInstallGdbPartLayer( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPartCount", LuaGetPartCount) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstPart", LuaGetFirstPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextPart", LuaGetNextPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastPart", LuaGetLastPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevPart", LuaGetPrevPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstLayer", LuaGetFirstLayer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextLayer", LuaGetNextLayer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastLayer", LuaGetLastLayer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevLayer", LuaGetPrevLayer) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseEmptyParts", LuaEraseEmptyParts) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSelectPartObjs", LuaSelectPartObjs) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDeselectPartObjs", LuaDeselectPartObjs) ;
|
||||
|
||||
+5
-2
@@ -147,14 +147,17 @@ LuaNumToString( lua_State* L)
|
||||
static int
|
||||
LuaSplitString( lua_State* L)
|
||||
{
|
||||
// 1 parametro : sVal
|
||||
// 1 o 2 parametri : sVal [, sSep]
|
||||
string sVal ;
|
||||
string sSep = "," ;
|
||||
bool bFound = LuaGetParam( L, 1, sVal) ;
|
||||
if ( bFound)
|
||||
LuaGetParam( L, 2, sSep) ;
|
||||
LuaClearStack( L) ;
|
||||
// se ricevuta stringa, la divido in parti separate da ','
|
||||
if ( bFound) {
|
||||
STRVECTOR vsVal ;
|
||||
FromString( sVal, vsVal) ;
|
||||
Tokenize( sVal, sSep, vsVal) ;
|
||||
// ritorno il risultato
|
||||
LuaSetParam( L, vsVal) ;
|
||||
}
|
||||
|
||||
+4
-4
@@ -39,9 +39,9 @@ LuaPackBox( lua_State* L)
|
||||
LuaCheckParam( L, 7, bBottomUp)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo il nesting del pezzo
|
||||
int nTot = ExePackBox( nId, dXmin, dYmin, dXmax, dYmax, dOffs, bBottomUp) ;
|
||||
bool bOk = ExePackBox( nId, dXmin, dYmin, dXmax, dYmax, dOffs, bBottomUp) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, nTot) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
@@ -66,9 +66,9 @@ LuaPackBoxCluster( lua_State* L)
|
||||
LuaCheckParam( L, 7, bBottomUp)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo il nesting dell'insieme di pezzi
|
||||
int nTot = ExePackBoxCluster( vIds, dXmin, dYmin, dXmax, dYmax, dOffs, bBottomUp) ;
|
||||
bool bOk = ExePackBoxCluster( vIds, dXmin, dYmin, dXmax, dYmax, dOffs, bBottomUp) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, nTot) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user