From 00b1ffb10bf37ee3c1b9fc02daa0cfbac17a4062 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 18 Mar 2019 06:48:24 +0000 Subject: [PATCH] EgtExecutor : - aggiunte funzioni ExeGetStringUtf8FromIni e ExeWriteStringUtf8ToIni. --- EXE_General.cpp | 17 +++++++++++++++++ EXE_MachMgr.cpp | 11 ++++++----- LUA_MachMgr.cpp | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/EXE_General.cpp b/EXE_General.cpp index 0411f1e..addebb9 100644 --- a/EXE_General.cpp +++ b/EXE_General.cpp @@ -27,6 +27,7 @@ #include "/EgtDev/Include/EGnStringUtils.h" #include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnPcInfo.h" +#include "/EgtDev/Include/EgtIniFile.h" #include "/EgtDev/Include/EgtLogger.h" #include "/EgtDev/Include/EgtStringConverter.h" #include "/EgtDev/Include/SELkLockId.h" @@ -484,6 +485,22 @@ ExeGetTempDir( string& sTempDir) return true ; } +//----------------------------------------------------------------------------- +bool +ExeGetStringUtf8FromIni( const string& sSec, const string& sKey, const string& sDef, string& sVal, const string& sIniFile) +{ + sVal = GetPrivateProfileStringUtf8( sSec.c_str(), sKey.c_str(), sDef.c_str(), sIniFile.c_str()) ; + return ( ! sVal.empty()) ; +} + +//----------------------------------------------------------------------------- +bool +ExeWriteStringUtf8ToIni( const string& sSec, const string& sKey, const string& sVal, const string& sIniFile) +{ + return WritePrivateProfileStringUtf8( sSec.c_str(), sKey.c_str(), sVal.c_str(), sIniFile.c_str()) ; +} + +//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- bool ExeSetMainWindowHandle( HWND hMainWnd) diff --git a/EXE_MachMgr.cpp b/EXE_MachMgr.cpp index d043cd8..fedbc89 100644 --- a/EXE_MachMgr.cpp +++ b/EXE_MachMgr.cpp @@ -2255,7 +2255,7 @@ ExePreviewMachining( bool bRecalc) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtPreviewMachining(" + ToString( bRecalc) + ")" + + string sLua = "EgtPreviewMachining(" + string( bRecalc ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } @@ -2273,7 +2273,8 @@ ExeApplyMachining( bool bRecalc, bool bPostApply) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtApplyMachining(" + ToString( bRecalc) + ")" + + string sLua = "EgtApplyMachining(" + string( bRecalc ? "true" : "false") + "," + + string( bPostApply ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } @@ -2291,8 +2292,8 @@ ExeUpdateMachining( bool bPostApply) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtUpdateMachining()" + - string( " -- Ok=") + ToString( bOk) ; + string sLua = "EgtUpdateMachining(" + string( bPostApply ? "true" : "false") + ")" + + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; @@ -2465,7 +2466,7 @@ ExeApplyAllMachinings( bool bRecalc, bool bStopOnFirstErr, string& sErrList) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtApplyAllMachinings(" + string( bRecalc ? "true" : "false") + ")" + + string sLua = "EgtApplyAllMachinings(" + string( bRecalc ? "true" : "false") + "," + string( bStopOnFirstErr ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; diff --git a/LUA_MachMgr.cpp b/LUA_MachMgr.cpp index cdb75ff..ed8227e 100644 --- a/LUA_MachMgr.cpp +++ b/LUA_MachMgr.cpp @@ -2504,7 +2504,7 @@ LuaPreviewMachining( lua_State* L) static int LuaApplyMachining( lua_State* L) { - // 1 o nessun parametro : [bRecalc] + // 2 o 1 o nessun parametro : [bRecalc] [, bPostApply] bool bRecalc = false ; bool bPostApply = true ; if ( LuaGetParam( L, 1, bRecalc))