Files
EgtInterface/LUA_GdbModify.cpp
T
Dario Sassi 0966f86f9d EgtInterface 1.6c6 :
- utilizzato gestore lua di EgtGeneral.
2015-03-22 09:27:35 +00:00

173 lines
4.9 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 "LUA_Aux.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EInConst.h"
#include "/EgtDev/Include/EgnStringUtils.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaChangeGroupFrame( lua_State* L)
{
// 2 o 3 parametri : Id, frNewRef [, sRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Frame3d frNewRef ;
LuaCheckParam( L, 2, frNewRef)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( 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 [, sRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptBase ;
LuaCheckParam( L, 2, ptBase)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( 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 [, sOnL]
int nId ;
LuaCheckParam( L, 1, nId)
bool bOnL = true ;
if ( lua_gettop( L) >= 2) {
string sLorH ;
LuaCheckParam( L, 2, sLorH) ;
ToUpper( sLorH) ;
if ( sLorH == "H")
bOnL = false ;
}
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
bool bOk = ( EgtExplodeText( nId) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
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
bool bOk = ( EgtSplitText( nId) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
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 ;
}