dc0396f6af
- aggiunte Exe e lua ChangeTextHeight e ChangeTextItalic - aggiunte Exe TextGetHeight e TextGetItalic.
226 lines
6.5 KiB
C++
226 lines
6.5 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 "/EgtDev/Include/ExeExecutor.h"
|
|
#include "/EgtDev/Include/EXeConst.h"
|
|
#include "/EgtDev/Include/EGkGdbConst.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 = ExeChangeGroupFrame( nId, frNewRef, nRefType) ;
|
|
LuaSetParam( 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 = ExeChangeVectorBase( nId, ptBase, nRefType) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaInvertVector( lua_State* L)
|
|
{
|
|
// 1 parametro : Id/s
|
|
INTVECTOR vId ;
|
|
LuaCheckParam( L, 1, vId)
|
|
LuaClearStack( L) ;
|
|
// eseguo inversione vettori
|
|
bool bOk = ExeInvertVector( vId) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( 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 = ExeModifyText( nId, sNewText) ;
|
|
LuaSetParam( 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 = ExeChangeTextFont( nId, sNewFont) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaChangeTextHeight( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, dNewH
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dNewH ;
|
|
LuaCheckParam( L, 2, dNewH)
|
|
LuaClearStack( L) ;
|
|
// modifica del testo
|
|
bool bOk = ExeChangeTextHeight( nId, dNewH) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaChangeTextItalic( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, bNewItalic
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
bool bNewItalic ;
|
|
LuaCheckParam( L, 2, bNewItalic)
|
|
LuaClearStack( L) ;
|
|
// modifica del testo
|
|
bool bOk = ExeChangeTextItalic( nId, bNewItalic) ;
|
|
LuaSetParam( 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 = ExeFlipText( nId) ;
|
|
LuaSetParam( 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 = ExeMirrorText( nId, bOnL) ;
|
|
LuaSetParam( 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 = ExeExplodeText( nId, &nCount) ;
|
|
if ( nFirstId != GDB_ID_NULL)
|
|
LuaSetParam( L, nFirstId) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
LuaSetParam( 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 = ExeSplitText( nId, &nCount) ;
|
|
if ( nFirstId != GDB_ID_NULL)
|
|
LuaSetParam( L, nFirstId) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
LuaSetParam( L, nCount) ;
|
|
return 2 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
bool
|
|
LuaInstallGdbModify( LuaMgr& luaMgr)
|
|
{
|
|
bool bOk = ( &luaMgr != nullptr) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeGroupFrame", LuaChangeGroupFrame) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeVectorBase", LuaChangeVectorBase) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtInvertVector", LuaInvertVector) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyText", LuaModifyText) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeTextFont", LuaChangeTextFont) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeTextHeight", LuaChangeTextHeight) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeTextItalic", LuaChangeTextItalic) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtFlipText", LuaFlipText) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtMirrorText", LuaMirrorText) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeText", LuaExplodeText) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitText", LuaSplitText) ;
|
|
return bOk ;
|
|
}
|