EgtInterface 1.6a7 :

- aggiunta gestione nome file di progetto e suo stato
- aggiunta gestione pezzo e layer
- riordino generale.
This commit is contained in:
Dario Sassi
2015-01-30 08:16:05 +00:00
parent f039e22297
commit 0c41c8c631
20 changed files with 868 additions and 178 deletions
+116 -6
View File
@@ -174,6 +174,104 @@ EgtGetGridVersZ( int nRefId, Vector3d& vtVersZ)
return vtVersZ.ToLoc( frDest) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetCurrFilePath( const wchar_t* wsFilePath)
{
return ( EgtSetCurrFilePath( wstrztoA( wsFilePath)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
bool
EgtSetCurrFilePath( const string& sFilePath)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
// assegno la path
pGseCtx->m_sFilePath = sFilePath ;
return true ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCurrFilePath( wchar_t*& wsFilePath)
{
if ( &wsFilePath == nullptr)
return false ;
string sFilePath ;
if ( ! EgtGetCurrFilePath( sFilePath))
return FALSE ;
wsFilePath = _wcsdup( stringtoW( sFilePath)) ;
return (( wsFilePath == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
bool
EgtGetCurrFilePath( string& sFilePath)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
// restituisco la path
sFilePath = pGseCtx->m_sFilePath ;
return ( ! sFilePath.empty()) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtEnableModified( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, FALSE)
// abilito possibilità di alterare il flag di modifica
pGseCtx->m_bEnableModified = true ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtDisableModified( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, FALSE)
// disabilito possibilità di alterare il flag di modifica
pGseCtx->m_bEnableModified = false ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetModified( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, FALSE)
// se consentito, imposto il flag
if ( pGseCtx->m_bEnableModified)
pGseCtx->m_bModified = true ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetModified( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, FALSE)
// se consentito, cancello il flag
if ( pGseCtx->m_bEnableModified)
pGseCtx->m_bModified = false ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetModified( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, FALSE)
// imposto il flag
return ( pGseCtx->m_bModified ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtNewFile( void)
@@ -184,6 +282,9 @@ __stdcall EgtNewFile( void)
// reinizializzazione (con pulizia) del DB geometrico
bOk = bOk && pGseCtx->m_pGeomDB->Init() ;
bOk = bOk && pGseCtx->m_pGeomDB->SetDefaultMaterial( pGseCtx->m_colDef) ;
// aggiorno stato file corrente
pGseCtx->m_sFilePath.clear() ;
pGseCtx->m_bModified = false ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtNewFile()"
@@ -213,6 +314,9 @@ EgtOpenFile( const string& sFilePath)
bOk = bOk && pGseCtx->m_pGeomDB->SetDefaultMaterial( pGseCtx->m_colDef) ;
// carico il file
bOk = bOk && GetCurrGeomDB()->Load( sFilePath) ;
// aggiorno stato file corrente
pGseCtx->m_sFilePath = sFilePath ;
pGseCtx->m_bModified = false ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLuaPath = sFilePath ;
@@ -236,10 +340,12 @@ __stdcall EgtInsertFile( const wchar_t* wsFilePath)
bool
EgtInsertFile( const string& sFilePath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
// carico il file
bool bOk = pGeomDB->Load( sFilePath) ;
bool bOk = pGseCtx->m_pGeomDB->Load( sFilePath) ;
// aggiorno stato file corrente
pGseCtx->m_bModified = true ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLuaPath = sFilePath ;
@@ -263,10 +369,14 @@ __stdcall EgtSaveFile( const wchar_t* wsFilePath, int nFlag)
bool
EgtSaveFile( const string& sFilePath, int nFlag)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
// salvo il file
bool bOk = pGeomDB->Save( sFilePath, nFlag) ;
bool bOk = pGseCtx->m_pGeomDB->Save( sFilePath, nFlag) ;
// aggiorno stato file corrente
pGseCtx->m_sFilePath = sFilePath ;
if ( bOk)
pGseCtx->m_bModified = false ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLuaPath = sFilePath ;