Files
EgtInterface/LUA_GdbModify.cpp
T
Dario Sassi 9d3dc5e537 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.
2015-04-20 08:43:10 +00:00

177 lines
5.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : LUA_GdbModify.cpp Data : 06.10.14 Versione : 1.5i5
// Contenuto : Funzioni di modifica geometrica per LUA.
//
//
//
// Modifiche : 06.10.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "API.h"
#include "LUA.h"
#include "LUA_Base.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EInConst.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGnStringUtils.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaChangeGroupFrame( lua_State* L)
{
// 2 o 3 parametri : Id, frNewRef [, nRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Frame3d frNewRef ;
LuaCheckParam( L, 2, frNewRef)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 3, nRefType) ;
LuaClearStack( L) ;
// modifica del riferimento
bool bOk = ( EgtChangeGroupFrame( nId, frNewRef, nRefType) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaChangeVectorBase( lua_State* L)
{
// 2 o 3 parametri : Id, ptBase [, nRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptBase ;
LuaCheckParam( L, 2, ptBase)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 3, nRefType) ;
LuaClearStack( L) ;
// modifica del punto base
bool bOk = ( EgtChangeVectorBase( nId, ptBase.v, nRefType) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaModifyText( lua_State* L)
{
// 2 parametri : Id, sNewText
int nId ;
LuaCheckParam( L, 1, nId)
string sNewText ;
LuaCheckParam( L, 2, sNewText)
LuaClearStack( L) ;
// modifica del testo
bool bOk = EgtModifyText( nId, sNewText) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaChangeTextFont( lua_State* L)
{
// 2 parametri : Id, sNewFont
int nId ;
LuaCheckParam( L, 1, nId)
string sNewFont ;
LuaCheckParam( L, 2, sNewFont)
LuaClearStack( L) ;
// modifica del testo
bool bOk = EgtChangeTextFont( nId, sNewFont) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaFlipText( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// flip del testo
bool bOk = ( EgtFlipText( nId) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaMirrorText( lua_State* L)
{
// 1 o 2 parametri : Id [, bOnL]
int nId ;
LuaCheckParam( L, 1, nId)
bool bOnL = true ;
LuaGetParam( L, 2, bOnL) ;
LuaClearStack( L) ;
// flip del testo
bool bOk = ( EgtMirrorText( nId, bOnL) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaExplodeText( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// esplosione del testo in contorni
int nCount ;
int nFirstId = EgtExplodeText( nId, &nCount) ;
if ( nFirstId != GDB_ID_NULL)
LuaSetReturn( L, nFirstId) ;
else
LuaSetReturn( L) ;
LuaSetReturn( L, nCount) ;
return 2 ;
}
//-------------------------------------------------------------------------------
static int
LuaSplitText( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// esplosione del testo in più testi, uno per riga
int nCount ;
int nFirstId = EgtSplitText( nId, &nCount) ;
if ( nFirstId != GDB_ID_NULL)
LuaSetReturn( L, nFirstId) ;
else
LuaSetReturn( L) ;
LuaSetReturn( L, nCount) ;
return 2 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbModify( void)
{
bool bOk = true ;
bOk = bOk && LuaRegisterFunction( "EgtChangeGroupFrame", LuaChangeGroupFrame) ;
bOk = bOk && LuaRegisterFunction( "EgtChangeVectorBase", LuaChangeVectorBase) ;
bOk = bOk && LuaRegisterFunction( "EgtModifyText", LuaModifyText) ;
bOk = bOk && LuaRegisterFunction( "EgtChangeTextFont", LuaChangeTextFont) ;
bOk = bOk && LuaRegisterFunction( "EgtFlipText", LuaFlipText) ;
bOk = bOk && LuaRegisterFunction( "EgtMirrorText", LuaMirrorText) ;
bOk = bOk && LuaRegisterFunction( "EgtExplodeText", LuaExplodeText) ;
bOk = bOk && LuaRegisterFunction( "EgtSplitText", LuaSplitText) ;
return bOk ;
}