EgtExecutor 1.6x8 :

- aggiunto nome asse a ExeSimGetAxisInfoPos
- in lua EgtSimGetAxisInfoPos restituisce anche nome asse
- aggiunta funzione Exe e Lua GetAllHeadsNames
- in lua aggiunta EgtDialogBox.
This commit is contained in:
Dario Sassi
2017-01-30 08:04:48 +00:00
parent 1b41407b0a
commit 841816e3ce
9 changed files with 162 additions and 4 deletions
+20
View File
@@ -0,0 +1,20 @@
//----------------------------------------------------------------------------
// EgalTech 2017-2017
//----------------------------------------------------------------------------
// File : DllMain.h Data : 29.01.17 Versione : 1.6x8
// Contenuto : Prototipi funzioni per uso locale della DLL.
//
//
//
// Modifiche : 29.01.17 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#define NOMINMAX
#include <windows.h>
//-----------------------------------------------------------------------------
HINSTANCE GetModuleIstance( void) ;
+12 -2
View File
@@ -2165,12 +2165,12 @@ ExeSimHome( void)
//-----------------------------------------------------------------------------
bool
ExeSimGetAxisInfoPos( int nI, string& sToken, bool& bLinear, double& dVal)
ExeSimGetAxisInfoPos( int nI, string& sName, string& sToken, bool& bLinear, double& dVal)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero stringa con info asse di simulazione
return pMachMgr->SimGetAxisInfoPos( nI, sToken, bLinear, dVal) ;
return pMachMgr->SimGetAxisInfoPos( nI, sName, sToken, bLinear, dVal) ;
}
//-----------------------------------------------------------------------------
@@ -2393,6 +2393,16 @@ ExeGetAxisToken( const string& sAxis, string& sToken)
return pMachMgr->GetAxisToken( sAxis, sToken) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetAllHeadsNames( STRVECTOR& vNames)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// recupero l'elenco delle teste
return pMachMgr->GetAllHeadsNames( vNames) ;
}
//-----------------------------------------------------------------------------
bool
ExeSetAxisPos( const string& sAxis, double dVal)
+7
View File
@@ -13,6 +13,7 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "DllMain.h"
#include "/EgtDev/Include/EXeDllMain.h"
#include "/EgtDev/Include/EGnGetModuleVer.h"
#include "/EgtDev/Include/EgtTrace.h"
@@ -78,3 +79,9 @@ GetEXeVersion( void)
return s_szEXeNameVer ;
}
//-----------------------------------------------------------------------------
HINSTANCE
GetModuleIstance( void)
{
return s_hModule ;
}
BIN
View File
Binary file not shown.
+1
View File
@@ -213,6 +213,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="..\Include\EXeConst.h" />
<ClInclude Include="..\Include\EXeDllMain.h" />
<ClInclude Include="..\Include\EXeExecutor.h" />
<ClInclude Include="DllMain.h" />
<ClInclude Include="EXE.h" />
<ClInclude Include="EXE_Macro.h" />
<ClInclude Include="AuxTools.h" />
+3
View File
@@ -99,6 +99,9 @@
<ClInclude Include="EXE_Nst.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="DllMain.h">
<Filter>File di intestazione</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="LUA_Exchange.cpp">
+96
View File
@@ -13,9 +13,11 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "DllMain.h"
#include "EXE.h"
#include "LUA.h"
#include "GenTools.h"
#include "resource.h"
#include "/EgtDev/Include/ExeExecutor.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGnStringUtils.h"
@@ -519,6 +521,99 @@ LuaGetLanguage( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
const int MAX_CTRLS = 6 ;
static int s_nCtrls = 0 ;
static string s_sCaption ;
static string s_sText[MAX_CTRLS] ;
static string s_sEdit[MAX_CTRLS] ;
//-------------------------------------------------------------------------------
BOOL
CALLBACK DialogBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch ( message) {
case WM_INITDIALOG :
{ // centro il dialogo
HWND hwndOwner = GetParent( hwndDlg) ;
if ( hwndOwner == nullptr)
hwndOwner = GetDesktopWindow() ;
RECT rcDlg, rcOwner ;
GetWindowRect( hwndOwner, &rcOwner) ;
GetWindowRect( hwndDlg, &rcDlg) ;
SetWindowPos( hwndDlg,
HWND_TOP,
( rcOwner.left + rcOwner.right - ( rcDlg.right - rcDlg.left)) / 2,
( rcOwner.top + rcOwner.bottom - ( rcDlg.bottom - rcDlg.top)) / 2,
0, 0, // Ignores size arguments.
SWP_NOSIZE) ;
}
// assegno titolo del dialogo
SetWindowText( hwndDlg, stringtoW( s_sCaption)) ;
// assegno testi e valori di default e nascondo linee dei controlli non usati
for ( int i = 0 ; i < MAX_CTRLS ; ++ i) {
if ( i < s_nCtrls) {
SetDlgItemText( hwndDlg, IDC_TEXT1 + i, stringtoW( s_sText[i])) ;
SetDlgItemText( hwndDlg, IDC_EDIT1 + i, stringtoW( s_sEdit[i])) ;
}
else {
ShowWindow( GetDlgItem( hwndDlg, IDC_TEXT1 + i), SW_HIDE) ;
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT1 + i), SW_HIDE) ;
}
}
break ;
case WM_COMMAND :
switch ( LOWORD( wParam)) {
case IDOK :
for ( int i = 0 ; i < s_nCtrls ; ++ i) {
AtoWEX<128> wsEdit( "") ;
if ( GetDlgItemText( hwndDlg, IDC_EDIT1 + i, LPWSTR( wsEdit), 128) > 0)
s_sEdit[i] = wstrztoA( wsEdit) ;
else
s_sEdit[i] = "" ;
}
// continua di seguito
case IDCANCEL :
EndDialog( hwndDlg, wParam) ;
return TRUE ;
}
}
return FALSE ;
}
//-------------------------------------------------------------------------------
static int
LuaDialogBox( lua_State* L)
{
// 1 .. 7 parametri : sCaption, { sText, sDefault}, ...
LuaCheckParam( L, 1, s_sCaption)
s_nCtrls = 0 ;
for ( int i = 0 ; i < MAX_CTRLS ; ++ i) {
STRVECTOR vData ;
if ( LuaGetParam( L, 2 + i, vData)) {
s_sText[i] = vData[0] ;
s_sEdit[i] = vData[1] ;
++ s_nCtrls ;
}
else
break ;
}
LuaClearStack( L) ;
// lancio dialogo
bool bOk = ( DialogBox( GetModuleIstance(), MAKEINTRESOURCE( IDD_LUADLG), FindTopWindow(), (DLGPROC)DialogBoxProc) == IDOK) ;
// restituzione parametri
if ( bOk) {
STRVECTOR vRes ;
for ( int i = 0 ; i < s_nCtrls ; ++ i)
vRes.emplace_back( s_sEdit[i]) ;
LuaSetParam( L, vRes) ;
}
else {
LuaSetParam( L) ;
}
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGeneral( LuaMgr& luaMgr)
@@ -550,5 +645,6 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetVersion", LuaGetVersion) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtIs64bit", LuaIs64bit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLanguage", LuaGetLanguage) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
return bOk ;
}
+23 -2
View File
@@ -2356,12 +2356,14 @@ LuaSimGetAxisInfoPos( lua_State* L)
LuaCheckParam( L, 1, nInd)
LuaClearStack( L) ;
// calcolo nome e posizione dell'asse
string sName ;
string sToken ;
bool bLinear ;
double dVal ;
bool bOk = ExeSimGetAxisInfoPos( nInd, sToken, bLinear, dVal) ;
bool bOk = ExeSimGetAxisInfoPos( nInd, sName, sToken, bLinear, dVal) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, sName) ;
LuaSetParam( L, sToken) ;
LuaSetParam( L, bLinear) ;
LuaSetParam( L, dVal) ;
@@ -2370,8 +2372,9 @@ LuaSimGetAxisInfoPos( lua_State* L)
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
return 4 ;
}
//-------------------------------------------------------------------------------
@@ -2797,6 +2800,23 @@ LuaGetAxisToken( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetAllHeadsNames( lua_State* L)
{
// nessun parametro
LuaClearStack( L) ;
// recupero l'elenco delle teste della macchina corrente
STRVECTOR vNames ;
bool bOk = ExeGetAllHeadsNames( vNames) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vNames) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetAxisPos( lua_State* L)
@@ -3100,6 +3120,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisId", LuaGetAxisId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetHeadId", LuaGetHeadId) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAxisToken", LuaGetAxisToken) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllHeadsNames", LuaGetAllHeadsNames) ;
// Machine Calc
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTable", LuaSetCalcTable) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCalcTool", LuaSetCalcTool) ;
BIN
View File
Binary file not shown.