EgtExecutor 1.6x5 :
- migliorata in Lua EgtOutBox - aggiunta in Lua EgtFileDialog - aggiunta in Lua EgtGetCalcToolDirFromaAngles.
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
#include <string>
|
||||
|
||||
|
||||
Binary file not shown.
@@ -264,6 +264,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="DllMachKernel.cpp" />
|
||||
<ClCompile Include="EXeDllMain.cpp" />
|
||||
<ClCompile Include="EXE_UiUnits.cpp" />
|
||||
<ClCompile Include="GenTools.cpp" />
|
||||
<ClCompile Include="GeoTools.cpp" />
|
||||
<ClCompile Include="GseContext.cpp" />
|
||||
<ClCompile Include="LUA_Base.cpp" />
|
||||
|
||||
@@ -290,6 +290,9 @@
|
||||
<ClCompile Include="LUA_GdbModifyVol.cpp">
|
||||
<Filter>File di origine\LUA</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GenTools.cpp">
|
||||
<Filter>File di origine\Global</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtExecutor.rc">
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2017-2017
|
||||
//----------------------------------------------------------------------------
|
||||
// File : GenTools.cpp Data : 08.01.17 Versione : 1.6x5
|
||||
// Contenuto : Funzioni generalie.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 08.01.17 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GenTools.h"
|
||||
#include <utility>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
HWND
|
||||
FindTopWindow( void)
|
||||
{
|
||||
// Recupero l'Id del processo corrente
|
||||
DWORD pid = GetCurrentProcessId() ;
|
||||
|
||||
pair<HWND, DWORD> params = { 0, pid} ;
|
||||
|
||||
// Enumerate the windows using a lambda to process each window
|
||||
BOOL bResult = EnumWindows( []( HWND hWnd, LPARAM lParam) -> BOOL
|
||||
{
|
||||
auto pParams = ( pair<HWND, DWORD>*)(lParam) ;
|
||||
|
||||
DWORD processId ;
|
||||
if ( GetWindowThreadProcessId( hWnd, &processId) &&
|
||||
processId == pParams->second &&
|
||||
GetWindow( hWnd, GW_OWNER) == (HWND) nullptr &&
|
||||
IsWindowVisible( hWnd)) {
|
||||
// Stop enumerating
|
||||
SetLastError( -1) ;
|
||||
pParams->first = hWnd ;
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
// Continue enumerating
|
||||
return TRUE ;
|
||||
}, (LPARAM) ¶ms) ;
|
||||
|
||||
|
||||
if ( ! bResult && GetLastError() == -1 && params.first != nullptr) {
|
||||
return params.first ;
|
||||
}
|
||||
|
||||
return nullptr ;
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2017-2017
|
||||
//----------------------------------------------------------------------------
|
||||
// File : GenTools.h Data : 08.01.17 Versione : 1.6x5
|
||||
// Contenuto : Prototipi funzioni generiche.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 08.01.17 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Recupero l'handle della finestra principale dell'eseguibile
|
||||
HWND FindTopWindow( void) ;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EGkPoint3d.h"
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
|
||||
|
||||
+50
-2
@@ -15,6 +15,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "EXE.h"
|
||||
#include "LUA.h"
|
||||
#include "GenTools.h"
|
||||
#include "/EgtDev/Include/ExeExecutor.h"
|
||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
@@ -216,7 +217,7 @@ LuaOutLog( lua_State* L)
|
||||
static int
|
||||
LuaOutBox( lua_State* L)
|
||||
{
|
||||
// 3 o 4 parametri : stringa, titolo, icona [bModal]
|
||||
// 3 o 4 parametri : stringa, titolo, icona [, bModal]
|
||||
string sOut ;
|
||||
LuaCheckParam( L, 1, sOut)
|
||||
string sTitle ;
|
||||
@@ -233,7 +234,7 @@ LuaOutBox( lua_State* L)
|
||||
LuaGetParam( L, 4, bModal) ;
|
||||
LuaClearStack( L) ;
|
||||
// emetto la finestra di dialogo
|
||||
int nRes = MessageBox( nullptr, stringtoW( sOut), stringtoW( sTitle),
|
||||
int nRes = MessageBox( FindTopWindow(), stringtoW( sOut), stringtoW( sTitle),
|
||||
MB_OKCANCEL | nIcon | ( bModal ? MB_TASKMODAL : MB_SYSTEMMODAL)) ;
|
||||
// risultato (Ok->true, Cancel->false)
|
||||
LuaSetParam( L, ( nRes == IDOK)) ;
|
||||
@@ -272,6 +273,52 @@ LuaOutText( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaFileDialog( lua_State* L)
|
||||
{
|
||||
// 3 parametri : bOpenVsSave, sFile, sFilter
|
||||
bool bOpenVsSave ;
|
||||
LuaCheckParam( L, 1, bOpenVsSave)
|
||||
string sFile ;
|
||||
LuaCheckParam( L, 2, sFile)
|
||||
string sFilter ;
|
||||
LuaCheckParam( L, 3, sFilter)
|
||||
LuaClearStack( L) ;
|
||||
// Converto i parametri nel formato wide e cambio L'|' in L'\0' nel filtro
|
||||
AtoWEX<MAX_PATH> wsFileName( sFile.c_str()) ;
|
||||
AtoW wsFilter( sFilter.c_str()) ;
|
||||
for ( wchar_t* pC = wsFilter.m_psz ; *pC != L'\0' ; ++ pC) {
|
||||
if ( *pC == L'|')
|
||||
*pC = L'\0' ;
|
||||
}
|
||||
// Riempio la struttura dati per il dialogo
|
||||
OPENFILENAME ofn ;
|
||||
ZeroMemory( &ofn, sizeof( ofn)) ;
|
||||
ofn.lStructSize = sizeof( ofn) ;
|
||||
ofn.hwndOwner = FindTopWindow() ;
|
||||
ofn.lpstrFilter = LPWSTR( wsFilter) ;
|
||||
ofn.lpstrFile = LPWSTR( wsFileName) ;
|
||||
ofn.nMaxFile = MAX_PATH ;
|
||||
ofn.Flags = OFN_DONTADDTORECENT | OFN_PATHMUSTEXIST ;
|
||||
// Visualizzo il dialogo
|
||||
if ( bOpenVsSave) {
|
||||
ofn.Flags |= OFN_FILEMUSTEXIST ;
|
||||
if ( GetOpenFileName( &ofn) != FALSE)
|
||||
LuaSetParam( L, wstrztoA( wsFileName)) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
}
|
||||
else {
|
||||
ofn.Flags |= OFN_OVERWRITEPROMPT ;
|
||||
if ( GetSaveFileName( &ofn) != FALSE)
|
||||
LuaSetParam( L, wstrztoA( wsFileName)) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
}
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaExistsFile( lua_State* L)
|
||||
@@ -490,6 +537,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOutBox", LuaOutBox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtProcessEvents", LuaProcessEvents) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOutText", LuaOutText) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtFileDialog", LuaFileDialog) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExistsFile", LuaExistsFile) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyFile", LuaCopyFile) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRenameFile", LuaRenameFile) ;
|
||||
|
||||
@@ -2586,6 +2586,27 @@ LuaGetCalcTipFromPositions( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetCalcToolDirFromAngles( lua_State* L)
|
||||
{
|
||||
// 2 parametri : dAngA, dAngB
|
||||
double dAngA ;
|
||||
LuaCheckParam( L, 1, dAngA)
|
||||
double dAngB ;
|
||||
LuaCheckParam( L, 2, dAngB)
|
||||
LuaClearStack( L) ;
|
||||
// Calcolo la direzione utensile dagli angoli macchina
|
||||
Vector3d vtDir ;
|
||||
bool bOk = ExeGetCalcToolDirFromAngles( dAngA, dAngB, vtDir) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vtDir) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVerifyOutstroke( lua_State* L)
|
||||
@@ -3032,6 +3053,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTipFromPositions", LuaGetCalcTipFromPositions) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcToolDirFromAngles", LuaGetCalcToolDirFromAngles) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyOutstroke", LuaVerifyOutstroke) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetOutstrokeInfo", LuaGetOutstrokeInfo) ;
|
||||
// Machine Move
|
||||
|
||||
Reference in New Issue
Block a user