bebcf1ecfe
- migliorie e modifiche in generale, specie su Lua.
160 lines
4.4 KiB
C++
160 lines
4.4 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 "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( nId, ptBase.v) != 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) != 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( nId, sNewFont) != 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( 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
|
|
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( nId, nIdGroupDest) != 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( nId, nIdGroupDest) != 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 ;
|
|
}
|