EgtInterface 1.5i5 :
- aggiunto interprete Lua - portate in interfaccia API molte funzioni di base.
This commit is contained in:
@@ -0,0 +1,158 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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 "LUA.h"
|
||||
#include "API.h"
|
||||
#include "/EgtDev/Include/EInAPI.h"
|
||||
#include "/EgtDev/Include/EgnStringUtils.h"
|
||||
#include "/EgtDev/Extern/Lua/Include/lua.hpp"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaChangeVectorBase( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, ptBase
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
Point3d ptBase ;
|
||||
LuaCheckParam( L, 2, ptBase)
|
||||
LuaClearStack( L) ;
|
||||
// modifica del testo
|
||||
bool bOk = ( EgtChangeVectorBase( LuaGetGseContext(), nId, ptBase.v) ? true : 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( LuaGetGseContext(), nId, sNewText) ? true : false) ;
|
||||
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( LuaGetGseContext(), nId, sNewFont) ? true : false) ;
|
||||
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( LuaGetGseContext(), nId) ? true : 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 ;
|
||||
string sLorH ;
|
||||
if ( LuaGetParam( L, 2, sLorH)) {
|
||||
ToUpper( sLorH) ;
|
||||
if ( sLorH == "H")
|
||||
bOnL = false ;
|
||||
}
|
||||
LuaClearStack( L) ;
|
||||
// flip del testo
|
||||
bool bOk = ( EgtMirrorText( LuaGetGseContext(), nId, bOnL) ? true : false) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaTextToOutline( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, IdGroupDest
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nIdGroupDest ;
|
||||
LuaCheckParam( L, 2, nIdGroupDest)
|
||||
LuaClearStack( L) ;
|
||||
// esplosione del testo in outline
|
||||
bool bOk = ( EgtTextToOutline( LuaGetGseContext(), nId, nIdGroupDest) ? true : false) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSplitText( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, IdGroupDest
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nIdGroupDest ;
|
||||
LuaCheckParam( L, 2, nIdGroupDest)
|
||||
LuaClearStack( L) ;
|
||||
// esplosione del testo in più testi, uno per riga
|
||||
bool bOk = ( EgtSplitText( LuaGetGseContext(), nId, nIdGroupDest) ? true : false) ;
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbModify( lua_State* L)
|
||||
{
|
||||
try {
|
||||
lua_register( L, "EgtChangeVectorBase", LuaChangeVectorBase) ;
|
||||
lua_register( L, "EgtModifyText", LuaModifyText) ;
|
||||
lua_register( L, "EgtChangeTextFont", LuaChangeTextFont) ;
|
||||
lua_register( L, "EgtFlipText", LuaFlipText) ;
|
||||
lua_register( L, "EgtMirrorText", LuaMirrorText) ;
|
||||
lua_register( L, "EgtTextToOutline", LuaTextToOutline) ;
|
||||
lua_register( L, "EgtSplitText", LuaSplitText) ;
|
||||
}
|
||||
catch ( ...) {
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
Reference in New Issue
Block a user