Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d5a8bd01e | |||
| 292361139a |
@@ -0,0 +1,90 @@
|
|||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// EgalTech 2026-2026
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// File : AuxDialogBox.cpp Data : 24.04.26 Versione : 3.1d4
|
||||||
|
// Contenuto : Funzioni DialogBox.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Modifiche : 24.04.26 RE Creazione modulo.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//--------------------------- Include ----------------------------------------
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "EXE.h"
|
||||||
|
#include "EXE_Macro.h"
|
||||||
|
#include "AuxDialogBox.h"
|
||||||
|
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||||
|
#include "/EgtDev/Include/EXeExecutor.h"
|
||||||
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
|
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||||
|
|
||||||
|
using namespace std ;
|
||||||
|
|
||||||
|
#pragma comment( lib, "Comctl32.lib")
|
||||||
|
|
||||||
|
HWND phDlgModeless = nullptr ;
|
||||||
|
int nDlgModelessItem = -1 ;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool
|
||||||
|
UpdateIdsModelessDialog( HWND phDlgModeless, int nDlgModelessItem)
|
||||||
|
{
|
||||||
|
// se DialogBox Modeless non inizializzato, esco
|
||||||
|
if ( phDlgModeless == nullptr)
|
||||||
|
return false ;
|
||||||
|
// se Id del controllo da aggiornare non valido, esco
|
||||||
|
if ( nDlgModelessItem == -1)
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
// recupero tutti gli elementi selezionati
|
||||||
|
string sIds ;
|
||||||
|
int nId = ExeGetFirstSelectedObj() ;
|
||||||
|
while ( nId != GDB_ID_NULL) {
|
||||||
|
sIds.append( ToString( nId) + string{","}) ;
|
||||||
|
nId = ExeGetNextSelectedObj() ;
|
||||||
|
}
|
||||||
|
if ( ! sIds.empty())
|
||||||
|
sIds.pop_back() ;
|
||||||
|
|
||||||
|
// aggiorno il contenuto nel dialogo
|
||||||
|
return ( SetDlgItemText( phDlgModeless, nDlgModelessItem, stringtoW( sIds))) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
LRESULT CALLBACK UpdateSelectionModelessDialog( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
|
||||||
|
{
|
||||||
|
if ( msg == WM_GETDLGCODE)
|
||||||
|
return DLGC_WANTALLKEYS ;
|
||||||
|
|
||||||
|
if ( msg == WM_KEYDOWN && wParam == VK_RETURN) {
|
||||||
|
// dwRefData contiene l'ID dell'EDIT
|
||||||
|
int nEditId = int( dwRefData) ;
|
||||||
|
HWND hwndDlg = GetParent(hwnd);
|
||||||
|
if ( hwndDlg == nullptr)
|
||||||
|
return FALSE ;
|
||||||
|
// recupero il testo dell'EDIT corretto
|
||||||
|
string sIds ;
|
||||||
|
AtoWEX<128> wsEdit( "") ;
|
||||||
|
if ( GetDlgItemText( hwndDlg, nEditId, LPWSTR( wsEdit), 128) > 0)
|
||||||
|
sIds = wstrztoA( wsEdit) ;
|
||||||
|
// deseleziono tutto
|
||||||
|
ExeDeselectAll() ;
|
||||||
|
// seleziono gli ID contenuti
|
||||||
|
if ( ! sIds.empty()) {
|
||||||
|
STRVECTOR vsIds;
|
||||||
|
Tokenize( sIds, ",", vsIds) ;
|
||||||
|
for ( auto& s : vsIds) {
|
||||||
|
int nId = GDB_ID_NULL ;
|
||||||
|
if ( FromString( s, nId) && nId != GDB_ID_NULL)
|
||||||
|
ExeSelectObj( nId) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// aggiorno la grafica ed esco
|
||||||
|
ExeDraw() ;
|
||||||
|
return TRUE ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( DefSubclassProc(hwnd, msg, wParam, lParam)) ;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// EgalTech 2026-2026
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// File : AuxDialogBox.h Data : 24.04.2026 Versione : 3.1d4
|
||||||
|
// Contenuto : Prototipi funzioni DialogBox.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Modifiche : 22.04.26 RE Creazione modulo.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include "/EgtDev/Include/ExeExecutor.h"
|
||||||
|
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||||
|
#include <shlobj.h>
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
// Identificativo della finestra ModeLess corrente ( nullptr se non esiste)
|
||||||
|
extern HWND phDlgModeless ;
|
||||||
|
extern int nDlgModelessItem ;
|
||||||
|
|
||||||
|
// Funzione per passaggi di parametri tra Selezione DB e dialogo non modale
|
||||||
|
bool UpdateIdsModelessDialog( HWND phDlgModeless, int UpdateIdsModelessDialog) ;
|
||||||
|
|
||||||
|
//Funzione per selezionare gli Id presenti all'interno dei un EditText
|
||||||
|
LRESULT CALLBACK UpdateSelectionModelessDialog( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) ;
|
||||||
@@ -59,8 +59,8 @@ ExePocketing( int nId, double dRad, double dStep, double dAngle, int nType, bool
|
|||||||
|
|
||||||
// eseguo Pocketing
|
// eseguo Pocketing
|
||||||
ICRVCOMPOPOVECTOR vCrvCompoRes ;
|
ICRVCOMPOPOVECTOR vCrvCompoRes ;
|
||||||
bool bOk = CalcPocketing( pSfr, dRad, 0, dStep, dAngle, 5., nType, bSmooth, true, false, false, true, false, true, P_INVALID, nullptr, false,
|
bool bOk = CalcPocketing( pSfr, dRad, 0, dStep, dAngle, 5., nType, bSmooth, true, false, false, false, true, P_INVALID, nullptr, false,
|
||||||
dStep, 0, INFINITO, 0, 0, INFINITO, false, 0., 0., false, vCrvCompoRes) ;
|
dStep, 0, INFINITO, 0, 0, INFINITO, false, 0., 0., vCrvCompoRes) ;
|
||||||
nFirstId = GDB_ID_NULL ;
|
nFirstId = GDB_ID_NULL ;
|
||||||
nCrvCount = int( vCrvCompoRes.size()) ;
|
nCrvCount = int( vCrvCompoRes.size()) ;
|
||||||
if ( bOk && nCrvCount > 0) {
|
if ( bOk && nCrvCount > 0) {
|
||||||
|
|||||||
@@ -2358,7 +2358,7 @@ ExeCurveCompoSetTempParam( int nId, int nCrv, double dParam, int nParamInd)
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static bool
|
static bool
|
||||||
MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType, double dToler)
|
MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType)
|
||||||
{
|
{
|
||||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||||
VERIFY_GEOMDB( pGeomDB, false)
|
VERIFY_GEOMDB( pGeomDB, false)
|
||||||
@@ -2368,6 +2368,7 @@ MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, in
|
|||||||
if ( ! pGeomDB->GetGroupGlobFrame( nGroupId, frGrp))
|
if ( ! pGeomDB->GetGroupGlobFrame( nGroupId, frGrp))
|
||||||
return false ;
|
return false ;
|
||||||
// preparo i dati per il concatenamento
|
// preparo i dati per il concatenamento
|
||||||
|
double dToler = 10 * EPS_SMALL ;
|
||||||
ChainCurves chainC ;
|
ChainCurves chainC ;
|
||||||
chainC.Init( bAllowInvert, dToler, pGeomDB->GetGroupObjs( nGroupId)) ;
|
chainC.Init( bAllowInvert, dToler, pGeomDB->GetGroupObjs( nGroupId)) ;
|
||||||
int nId = pGeomDB->GetFirstInGroup( nGroupId) ;
|
int nId = pGeomDB->GetFirstInGroup( nGroupId) ;
|
||||||
@@ -2411,9 +2412,9 @@ MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, in
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType, double dToler)
|
ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
||||||
{
|
{
|
||||||
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, true, nRefType, dToler) ;
|
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, true, nRefType) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
@@ -2428,9 +2429,9 @@ ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType, double
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType, double dToler)
|
ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
|
||||||
{
|
{
|
||||||
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, false, nRefType, dToler) ;
|
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, false, nRefType) ;
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "EXE.h"
|
#include "EXE.h"
|
||||||
#include "EXE_Macro.h"
|
#include "EXE_Macro.h"
|
||||||
|
#include "AuxDialogBox.h"
|
||||||
#include "/EgtDev/Include/EXeExecutor.h"
|
#include "/EgtDev/Include/EXeExecutor.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||||
@@ -76,6 +77,9 @@ ExeSelectObj( int nId)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
|
// verifico se presente un dialogo modeless per aggiornare i valori
|
||||||
|
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
|
||||||
|
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
|
||||||
// restituisco risultato
|
// restituisco risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -100,6 +104,9 @@ ExeDeselectObj( int nId)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
|
// verifico se presente un dialogo modeless per aggiornare i valori
|
||||||
|
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
|
||||||
|
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
|
||||||
// restituisco risultato
|
// restituisco risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -139,6 +146,9 @@ ExeSelectAll( bool bOnlyIfVisible)
|
|||||||
" -- bOk=1" ;
|
" -- bOk=1" ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
|
// verifico se presente un dialogo modeless per aggiornare i valori
|
||||||
|
if ( phDlgModeless != nullptr && nDlgModelessItem != -1)
|
||||||
|
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
|
||||||
// restituisco risultato
|
// restituisco risultato
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -160,6 +170,9 @@ ExeDeselectAll( void)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
|
// verifico se presente un dialogo modeless per aggiornare i valori
|
||||||
|
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
|
||||||
|
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
|
||||||
// restituisco risultato
|
// restituisco risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -186,6 +199,9 @@ ExeSelectGroupObjs( int nGroupId)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
|
// verifico se presente un dialogo modeless per aggiornare i valori
|
||||||
|
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
|
||||||
|
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
|
||||||
// restituisco risultato
|
// restituisco risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -209,6 +225,9 @@ ExeDeselectGroupObjs( int nGroupId)
|
|||||||
" -- Ok=" + ToString( bOk) ;
|
" -- Ok=" + ToString( bOk) ;
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||||
}
|
}
|
||||||
|
// verifico se presente un dialogo modeless per aggiornare i valori
|
||||||
|
if ( bOk && phDlgModeless != nullptr && nDlgModelessItem != -1)
|
||||||
|
UpdateIdsModelessDialog( phDlgModeless, nDlgModelessItem) ;
|
||||||
// restituisco risultato
|
// restituisco risultato
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-24
@@ -524,38 +524,17 @@ ExeAddRawPart( Point3d ptOrig, double dLength, double dWidth, double dHeight, Co
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeAddRawPartGen( int nCrvSrfId, double dOverMat, Color cCol)
|
ExeAddRawPartWithPart( int nPartId, int nCrvId, double dOverMat, Color cCol)
|
||||||
{
|
{
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
||||||
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
||||||
// inserisco grezzo con pezzo nella macchinata corrente
|
// inserisco grezzo con pezzo nella macchinata corrente
|
||||||
int nId = pMachMgr->AddRawPart( nCrvSrfId, dOverMat, cCol) ;
|
int nId = pMachMgr->AddRawPartWithPart( nPartId, nCrvId, dOverMat, cCol) ;
|
||||||
ExeSetModified() ;
|
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
|
||||||
if ( IsCmdLog()) {
|
|
||||||
string sLua = "EgtAddRawPartGen(" + ToString( nCrvSrfId) + "," +
|
|
||||||
ToString( dOverMat) + ",{" +
|
|
||||||
ToString( cCol) + "})" +
|
|
||||||
" -- Id=" + ToString( nId) ;
|
|
||||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
|
||||||
}
|
|
||||||
// restituisco il risultato
|
|
||||||
return nId ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
int
|
|
||||||
ExeAddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol)
|
|
||||||
{
|
|
||||||
IMachMgr* pMachMgr = GetCurrMachMgr() ;
|
|
||||||
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
|
|
||||||
// inserisco grezzo con pezzo nella macchinata corrente
|
|
||||||
int nId = pMachMgr->AddRawPartWithPart( nPartId, nCrvSrfId, dOverMat, cCol) ;
|
|
||||||
ExeSetModified() ;
|
ExeSetModified() ;
|
||||||
// se richiesto, salvo il comando Lua equivalente
|
// se richiesto, salvo il comando Lua equivalente
|
||||||
if ( IsCmdLog()) {
|
if ( IsCmdLog()) {
|
||||||
string sLua = "EgtAddRawPartWithPart(" + ToString( nPartId) + "," +
|
string sLua = "EgtAddRawPartWithPart(" + ToString( nPartId) + "," +
|
||||||
ToString( nCrvSrfId) + "," +
|
ToString( nCrvId) + "," +
|
||||||
ToString( dOverMat) + ",{" +
|
ToString( dOverMat) + ",{" +
|
||||||
ToString( cCol) + "})" +
|
ToString( cCol) + "})" +
|
||||||
" -- Id=" + ToString( nId) ;
|
" -- Id=" + ToString( nId) ;
|
||||||
|
|||||||
+2
-2
@@ -869,7 +869,7 @@ ExeTrimmingGetSurfBzSyncPoints( int nParentId, int nEdge1Id, int nEdge2Id, doubl
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
ExeRegolarizeSurfaceLocally( int nParentId, int nSurfId, int nSyncStartId, int nSyncEndId, double dLinTol, int nType)
|
ExeRegolarizeSurfaceLocally( int nParentId, int nSurfId, int nSyncStartId, int nSyncEndId, double dLinTol)
|
||||||
{
|
{
|
||||||
bool bOk = true ;
|
bool bOk = true ;
|
||||||
// Verifica database geometrico
|
// Verifica database geometrico
|
||||||
@@ -889,7 +889,7 @@ ExeRegolarizeSurfaceLocally( int nParentId, int nSurfId, int nSyncStartId, int n
|
|||||||
Point3d ptE2 ; pSyncEnd->GetEndPoint( ptE2) ;
|
Point3d ptE2 ; pSyncEnd->GetEndPoint( ptE2) ;
|
||||||
BIPOINT bpIsoEnd( ptS2, ptE2) ;
|
BIPOINT bpIsoEnd( ptS2, ptE2) ;
|
||||||
|
|
||||||
PtrOwner<ISurfBezier> pNewSurf( RegolarizeBordersLocally( pSurfBez, bpIsoStart, bpIsoEnd, dLinTol, nType)) ;
|
PtrOwner<ISurfBezier> pNewSurf( RegolarizeBordersLocally( pSurfBez, bpIsoStart, bpIsoEnd, dLinTol)) ;
|
||||||
if ( IsNull( pNewSurf))
|
if ( IsNull( pNewSurf))
|
||||||
return GDB_ID_NULL ;
|
return GDB_ID_NULL ;
|
||||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pNewSurf)) ;
|
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pNewSurf)) ;
|
||||||
|
|||||||
Binary file not shown.
@@ -228,6 +228,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClInclude Include="..\Include\EXeConst.h" />
|
<ClInclude Include="..\Include\EXeConst.h" />
|
||||||
<ClInclude Include="..\Include\EXeDllMain.h" />
|
<ClInclude Include="..\Include\EXeDllMain.h" />
|
||||||
<ClInclude Include="..\Include\EXeExecutor.h" />
|
<ClInclude Include="..\Include\EXeExecutor.h" />
|
||||||
|
<ClInclude Include="AuxDialogBox.h" />
|
||||||
<ClInclude Include="DllExch3dm.h" />
|
<ClInclude Include="DllExch3dm.h" />
|
||||||
<ClInclude Include="DllMain.h" />
|
<ClInclude Include="DllMain.h" />
|
||||||
<ClInclude Include="DllNesting.h" />
|
<ClInclude Include="DllNesting.h" />
|
||||||
@@ -249,6 +250,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
|||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="AuxDialogBox.cpp" />
|
||||||
<ClCompile Include="DllExch3dm.cpp" />
|
<ClCompile Include="DllExch3dm.cpp" />
|
||||||
<ClCompile Include="DllNesting.cpp" />
|
<ClCompile Include="DllNesting.cpp" />
|
||||||
<ClCompile Include="EXE_Base64.cpp" />
|
<ClCompile Include="EXE_Base64.cpp" />
|
||||||
|
|||||||
@@ -111,6 +111,9 @@
|
|||||||
<ClInclude Include="DllExch3dm.h">
|
<ClInclude Include="DllExch3dm.h">
|
||||||
<Filter>File di intestazione</Filter>
|
<Filter>File di intestazione</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="AuxDialogBox.h">
|
||||||
|
<Filter>File di intestazione</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="LUA_Exchange.cpp">
|
<ClCompile Include="LUA_Exchange.cpp">
|
||||||
@@ -431,6 +434,9 @@
|
|||||||
<ClCompile Include="LUA_Base64.cpp">
|
<ClCompile Include="LUA_Base64.cpp">
|
||||||
<Filter>File di origine\LUA</Filter>
|
<Filter>File di origine\LUA</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="AuxDialogBox.cpp">
|
||||||
|
<Filter>File di origine\Global</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="EgtExecutor.rc">
|
<ResourceCompile Include="EgtExecutor.rc">
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ AdjustId( int nId, int nCtx)
|
|||||||
Vector3d
|
Vector3d
|
||||||
GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc)
|
GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc)
|
||||||
{
|
{
|
||||||
if ( ! vtV.IsValid())
|
|
||||||
return vtV ;
|
|
||||||
Vector3d vtVL( vtV) ;
|
Vector3d vtVL( vtV) ;
|
||||||
if ( nRefType == RTY_GLOB)
|
if ( nRefType == RTY_GLOB)
|
||||||
vtVL.ToLoc( frLoc) ;
|
vtVL.ToLoc( frLoc) ;
|
||||||
@@ -52,8 +50,6 @@ GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame
|
|||||||
Vector3d
|
Vector3d
|
||||||
GetVectorInRef( IGeomDB* pGeomDB, const Vector3d& vtV, const Frame3d& frLoc, int nRefType)
|
GetVectorInRef( IGeomDB* pGeomDB, const Vector3d& vtV, const Frame3d& frLoc, int nRefType)
|
||||||
{
|
{
|
||||||
if ( ! vtV.IsValid())
|
|
||||||
return vtV ;
|
|
||||||
Vector3d vtVL( vtV) ;
|
Vector3d vtVL( vtV) ;
|
||||||
if ( nRefType == RTY_GLOB)
|
if ( nRefType == RTY_GLOB)
|
||||||
vtVL.ToGlob( frLoc) ;
|
vtVL.ToGlob( frLoc) ;
|
||||||
@@ -66,8 +62,6 @@ GetVectorInRef( IGeomDB* pGeomDB, const Vector3d& vtV, const Frame3d& frLoc, int
|
|||||||
Point3d
|
Point3d
|
||||||
GetPointLocal( IGeomDB* pGeomDB, const Point3d& ptP, int nRefType, const Frame3d& frLoc)
|
GetPointLocal( IGeomDB* pGeomDB, const Point3d& ptP, int nRefType, const Frame3d& frLoc)
|
||||||
{
|
{
|
||||||
if ( ! ptP.IsValid())
|
|
||||||
return ptP ;
|
|
||||||
Point3d ptPL( ptP) ;
|
Point3d ptPL( ptP) ;
|
||||||
if ( nRefType == RTY_GLOB)
|
if ( nRefType == RTY_GLOB)
|
||||||
ptPL.ToLoc( frLoc) ;
|
ptPL.ToLoc( frLoc) ;
|
||||||
@@ -80,8 +74,6 @@ GetPointLocal( IGeomDB* pGeomDB, const Point3d& ptP, int nRefType, const Frame3d
|
|||||||
Point3d
|
Point3d
|
||||||
GetPointInRef( IGeomDB* pGeomDB, const Point3d& ptP, const Frame3d& frLoc, int nRefType)
|
GetPointInRef( IGeomDB* pGeomDB, const Point3d& ptP, const Frame3d& frLoc, int nRefType)
|
||||||
{
|
{
|
||||||
if ( ! ptP.IsValid())
|
|
||||||
return ptP ;
|
|
||||||
Point3d ptPL( ptP) ;
|
Point3d ptPL( ptP) ;
|
||||||
if ( nRefType == RTY_GLOB)
|
if ( nRefType == RTY_GLOB)
|
||||||
ptPL.ToGlob( frLoc) ;
|
ptPL.ToGlob( frLoc) ;
|
||||||
|
|||||||
@@ -805,7 +805,7 @@ LuaCreateSurfTmSwept( lua_State* L)
|
|||||||
int nGuideId ;
|
int nGuideId ;
|
||||||
LuaCheckParam( L, 3, nGuideId)
|
LuaCheckParam( L, 3, nGuideId)
|
||||||
int nPar = 4 ;
|
int nPar = 4 ;
|
||||||
Vector3d vtAx = V_INVALID ;
|
Vector3d vtAx = V_NULL ;
|
||||||
if ( LuaGetParam( L, nPar, vtAx))
|
if ( LuaGetParam( L, nPar, vtAx))
|
||||||
++ nPar ;
|
++ nPar ;
|
||||||
bool bCapEnds ;
|
bool bCapEnds ;
|
||||||
|
|||||||
+9
-13
@@ -409,7 +409,7 @@ LuaTrimExtendCurveByLen( lua_State* L)
|
|||||||
int nRefType = RTY_DEFAULT ;
|
int nRefType = RTY_DEFAULT ;
|
||||||
LuaGetParam( L, 4, nRefType) ;
|
LuaGetParam( L, 4, nRefType) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// taglio o allungo la curva nell'estremo più vicino al punto
|
// taglio o allungo la curva nell'estremo più vicino al punto
|
||||||
bool bOk = ExeTrimExtendCurveByLen( nId, dLen, ptNear, nRefType) ;
|
bool bOk = ExeTrimExtendCurveByLen( nId, dLen, ptNear, nRefType) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -943,7 +943,7 @@ LuaCurveCompoSetTempProp( lua_State* L)
|
|||||||
int nPropInd = 0 ;
|
int nPropInd = 0 ;
|
||||||
LuaGetParam( L, 4, nPropInd) ;
|
LuaGetParam( L, 4, nPropInd) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// imposto sulla curva della composita la proprietà temporanea
|
// imposto sulla curva della composita la proprietà temporanea
|
||||||
bool bOk = ExeCurveCompoSetTempProp( nId, nCrv, nProp, nPropInd) ;
|
bool bOk = ExeCurveCompoSetTempProp( nId, nCrv, nProp, nPropInd) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -973,18 +973,16 @@ LuaCurveCompoSetTempParam( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaChainCurvesInGroup( lua_State* L)
|
LuaChainCurvesInGroup( lua_State* L)
|
||||||
{
|
{
|
||||||
// 2, 3 o 4 parametri : nGroupId, ptNear [, nRefType] [, dToler]
|
// 2 o 3 parametri : nGroupId, ptNear [, nRefType]
|
||||||
int nGroupId ;
|
int nGroupId ;
|
||||||
LuaCheckParam( L, 1, nGroupId)
|
LuaCheckParam( L, 1, nGroupId)
|
||||||
Point3d ptNear ;
|
Point3d ptNear ;
|
||||||
LuaCheckParam( L, 2, ptNear)
|
LuaCheckParam( L, 2, ptNear)
|
||||||
int nRefType = RTY_DEFAULT ;
|
int nRefType = RTY_DEFAULT ;
|
||||||
LuaGetParam( L, 3, nRefType) ;
|
LuaGetParam( L, 3, nRefType) ;
|
||||||
double dToler = 10 * EPS_SMALL ;
|
|
||||||
LuaGetParam( L, 4, dToler) ;
|
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// concateno le curve nel gruppo (senza fonderle in una curva composita)
|
// concateno le curve nel gruppo (senza fonderle in una curva composita)
|
||||||
bool bOk = ExeChainCurvesInGroup( nGroupId, ptNear, nRefType, dToler) ;
|
bool bOk = ExeChainCurvesInGroup( nGroupId, ptNear, nRefType) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
@@ -993,18 +991,16 @@ LuaChainCurvesInGroup( lua_State* L)
|
|||||||
static int
|
static int
|
||||||
LuaReorderCurvesInGroup( lua_State* L)
|
LuaReorderCurvesInGroup( lua_State* L)
|
||||||
{
|
{
|
||||||
// 2, 3 o 4 parametri : nGroupId, ptNear [, nRefType] [, dToler]
|
// 2 o 3 parametri : nGroupId, ptNear [, nRefType]
|
||||||
int nGroupId ;
|
int nGroupId ;
|
||||||
LuaCheckParam( L, 1, nGroupId)
|
LuaCheckParam( L, 1, nGroupId)
|
||||||
Point3d ptNear ;
|
Point3d ptNear ;
|
||||||
LuaCheckParam( L, 2, ptNear)
|
LuaCheckParam( L, 2, ptNear)
|
||||||
int nRefType = RTY_DEFAULT ;
|
int nRefType = RTY_DEFAULT ;
|
||||||
LuaGetParam( L, 3, nRefType) ;
|
LuaGetParam( L, 3, nRefType) ;
|
||||||
double dToler = 10 * EPS_SMALL ;
|
|
||||||
LuaGetParam( L, 4, dToler) ;
|
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// riordino le curve nel gruppo (senza fonderle in una curva composita)
|
// riordino le curve nel gruppo (senza fonderle in una curva composita)
|
||||||
bool bOk = ExeReorderCurvesInGroup( nGroupId, ptNear, nRefType, dToler) ;
|
bool bOk = ExeReorderCurvesInGroup( nGroupId, ptNear, nRefType) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
@@ -1025,7 +1021,7 @@ LuaProjectCurveOnSurf( lua_State* L)
|
|||||||
if ( LuaGetParam( L, 4, dLinTol))
|
if ( LuaGetParam( L, 4, dLinTol))
|
||||||
LuaGetParam( L, 5, dMaxSegmLen) ;
|
LuaGetParam( L, 5, dMaxSegmLen) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// proietto la curva su una o più superfici a minima distanza
|
// proietto la curva su una o più superfici a minima distanza
|
||||||
bool bOk = ExeProjectCurveOnSurf( nCurveId, vSurfId, nDestGrpId, dLinTol, dMaxSegmLen) ;
|
bool bOk = ExeProjectCurveOnSurf( nCurveId, vSurfId, nDestGrpId, dLinTol, dMaxSegmLen) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -1055,7 +1051,7 @@ LuaProjectCurveOnSurfDir( lua_State* L)
|
|||||||
LuaGetParam( L, 8, bFromVsTo))
|
LuaGetParam( L, 8, bFromVsTo))
|
||||||
LuaGetParam( L, 9, nRefType) ;
|
LuaGetParam( L, 9, nRefType) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// proietto la curva su una o più superfici secondo la direzione data
|
// proietto la curva su una o più superfici secondo la direzione data
|
||||||
bool bOk = ExeProjectCurveOnSurfDir( nCurveId, vSurfId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, bFromVsTo, nRefType) ;
|
bool bOk = ExeProjectCurveOnSurfDir( nCurveId, vSurfId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, bFromVsTo, nRefType) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -1083,7 +1079,7 @@ LuaProjectCurveOnSurfExt( lua_State* L)
|
|||||||
LuaGetParam( L, 7, bDirFromGuide))
|
LuaGetParam( L, 7, bDirFromGuide))
|
||||||
LuaGetParam( L, 8, bFromVsTo) ;
|
LuaGetParam( L, 8, bFromVsTo) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// proietto la curva su una o più superfici secondo la direzione verso la guida
|
// proietto la curva su una o più superfici secondo la direzione verso la guida
|
||||||
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, vSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide, bFromVsTo) ;
|
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, vSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide, bFromVsTo) ;
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
|
|||||||
+494
-9
@@ -18,6 +18,7 @@
|
|||||||
#include "LUA.h"
|
#include "LUA.h"
|
||||||
#include "GenTools.h"
|
#include "GenTools.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
#include "AuxDialogBox.h"
|
||||||
#include "/EgtDev/Include/ExeExecutor.h"
|
#include "/EgtDev/Include/ExeExecutor.h"
|
||||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
@@ -1212,22 +1213,39 @@ LuaReleaseMutex( lua_State* L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
const int MAX_CTRLS = IDC_TEXT8 -IDC_TEXT1 + 1 ;
|
// =================================== DIALOG ===================================
|
||||||
|
// Variabili Globali
|
||||||
const int OFFS_CTRLS = 40 ;
|
const int OFFS_CTRLS = 40 ;
|
||||||
enum TYPE_CTRLS { CTRL_NONE = 0, CTRL_CHECK = 1, CTRL_COMBO = 2, CTRL_EDIT = 3, CTRL_COLOR = 4} ;
|
enum TYPE_CTRLS { CTRL_NONE = 0, CTRL_CHECK = 1, CTRL_COMBO = 2, CTRL_EDIT = 3, CTRL_COLOR = 4, CTRL_BUTTON = 5} ;
|
||||||
static int s_nCtrls = 0 ;
|
|
||||||
static string s_sCaption ;
|
|
||||||
static string s_sText[MAX_CTRLS] ;
|
|
||||||
static string s_sEdit[MAX_CTRLS] ;
|
|
||||||
static int s_nType[MAX_CTRLS] ;
|
|
||||||
static COLORREF s_CustomColors[16] = {12632256} ; // 16 colori GRAY
|
static COLORREF s_CustomColors[16] = {12632256} ; // 16 colori GRAY
|
||||||
static bool s_bCustomColorsInit = false ; // flag di inizializzazione colori
|
static bool s_bCustomColorsInit = false ; // flag di inizializzazione colori
|
||||||
const char* SEC_SCENE = "Scene" ;
|
const char* SEC_SCENE = "Scene" ;
|
||||||
const char* KEY_CUSTOMCOLORS = "CustomColors" ;
|
const char* KEY_CUSTOMCOLORS = "CustomColors" ;
|
||||||
|
|
||||||
|
// Dialogo Modale
|
||||||
|
const int MAX_CTRLS = IDC_TEXT8 - IDC_TEXT1 + 1 ;
|
||||||
|
static int s_nCtrls = 0 ;
|
||||||
|
static string s_sCaption ;
|
||||||
|
static string s_sText[MAX_CTRLS] ;
|
||||||
|
static string s_sEdit[MAX_CTRLS] ;
|
||||||
|
static int s_nType[MAX_CTRLS] ;
|
||||||
|
|
||||||
|
// Dialogo non modale
|
||||||
|
const int MAX_CTRLS_ML = IDC_TEXT_ML_8 - IDC_TEXT_ML_1 + 1 ;
|
||||||
|
static int s_nCtrls_ML = 0 ;
|
||||||
|
static string s_sCaption_ML ;
|
||||||
|
static string s_sText_ML[MAX_CTRLS_ML] ;
|
||||||
|
static string s_sEdit_ML[MAX_CTRLS_ML] ;
|
||||||
|
static int s_nType_ML[MAX_CTRLS_ML] ;
|
||||||
|
struct DialogContext {
|
||||||
|
lua_State* L ; // stato Lua per Click bottone OK
|
||||||
|
int nCallBackFun ; // indice di funzione CallBack
|
||||||
|
} ;
|
||||||
|
static string s_sIdSel_ML ;
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
BOOL
|
BOOL
|
||||||
CALLBACK DialogBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
CALLBACK DialogBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// variabili static locali per mantenere lo stato tra chiamate per selezione colori
|
// variabili static locali per mantenere lo stato tra chiamate per selezione colori
|
||||||
static COLORREF selectedColor[MAX_CTRLS] = {0} ; // BLACK
|
static COLORREF selectedColor[MAX_CTRLS] = {0} ; // BLACK
|
||||||
@@ -1507,6 +1525,408 @@ CALLBACK DialogBoxProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam
|
|||||||
return FALSE ;
|
return FALSE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
BOOL
|
||||||
|
CALLBACK DialogBoxModelessProc( HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
// variabili static locali per mantenere lo stato tra chiamate per selezione colori
|
||||||
|
static COLORREF selectedColor[MAX_CTRLS_ML] = {0} ; // BLACK
|
||||||
|
static HBRUSH hColorBrush[MAX_CTRLS_ML] = {NULL} ; // non definito
|
||||||
|
|
||||||
|
switch ( message) {
|
||||||
|
case WM_INITDIALOG :
|
||||||
|
{
|
||||||
|
// imposto il contesto per recuperalo in futuro ( per la funzione di CallBack Lua)
|
||||||
|
SetWindowLongPtr( hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam) ;
|
||||||
|
|
||||||
|
// colore di default
|
||||||
|
COLORREF defaultColor = RGB( 255, 0, 0) ;
|
||||||
|
// inizializzazione colori e brush
|
||||||
|
for ( int i = 0 ; i < MAX_CTRLS_ML ; ++ i) {
|
||||||
|
selectedColor[i] = defaultColor ;
|
||||||
|
if ( hColorBrush[i] != NULL)
|
||||||
|
DeleteObject( hColorBrush[i]) ;
|
||||||
|
hColorBrush[i] = CreateSolidBrush( selectedColor[i]) ;
|
||||||
|
}
|
||||||
|
// dati del dialogo
|
||||||
|
HWND hwndOwner = GetParent( hwndDlg) ;
|
||||||
|
if ( hwndOwner == nullptr)
|
||||||
|
hwndOwner = GetDesktopWindow() ;
|
||||||
|
RECT rcOwner, rcDlg ;
|
||||||
|
GetWindowRect( hwndOwner, &rcOwner) ;
|
||||||
|
GetWindowRect( hwndDlg, &rcDlg) ;
|
||||||
|
// determino la posizione dell'ultima riga di dati da visualizzare
|
||||||
|
HWND hwndLR = GetDlgItem( hwndDlg, IDC_TEXT_ML_1 + Clamp( s_nCtrls_ML, 1, MAX_CTRLS_ML) - 1) ;
|
||||||
|
RECT rcLR ;
|
||||||
|
GetWindowRect( hwndLR, &rcLR) ;
|
||||||
|
POINT ptLR{ rcLR.left, rcLR.top} ;
|
||||||
|
ScreenToClient( hwndDlg, &ptLR) ;
|
||||||
|
// centro e scalo il dialogo
|
||||||
|
int nNewH = rcLR.top - rcOwner.top + 2 * OFFS_CTRLS ; // non chiaro perchè va sottratto rcOwner.top ma funziona sempre
|
||||||
|
SetWindowPos( hwndDlg, HWND_TOP,
|
||||||
|
( rcOwner.left + rcOwner.right - ( rcDlg.right - rcDlg.left)) / 2,
|
||||||
|
( rcOwner.top + rcOwner.bottom - nNewH) / 2,
|
||||||
|
( rcDlg.right - rcDlg.left),
|
||||||
|
nNewH, 0) ;
|
||||||
|
// riposiziono il bottone Ok
|
||||||
|
HWND hwndOk = GetDlgItem( hwndDlg, IDOK_ML) ;
|
||||||
|
RECT rcOk ;
|
||||||
|
GetWindowRect( hwndOk, &rcOk) ;
|
||||||
|
POINT ptOk{ rcOk.left, rcOk.top} ;
|
||||||
|
ScreenToClient( hwndDlg, &ptOk) ;
|
||||||
|
SetWindowPos( hwndOk, hwndDlg, ptOk.x, ptLR.y + OFFS_CTRLS, 0, 0, SWP_NOSIZE | SWP_NOZORDER) ;
|
||||||
|
// riposiziono il bottone Cancel
|
||||||
|
HWND hwndCl = GetDlgItem( hwndDlg, IDCANCEL_ML) ;
|
||||||
|
RECT rcCl ;
|
||||||
|
GetWindowRect( hwndCl, &rcCl) ;
|
||||||
|
POINT ptCl{ rcCl.left, rcCl.top} ;
|
||||||
|
ScreenToClient( hwndDlg, &ptCl) ;
|
||||||
|
SetWindowPos( hwndCl, hwndDlg, ptCl.x, ptLR.y + OFFS_CTRLS, 0, 0, SWP_NOSIZE | SWP_NOZORDER) ;
|
||||||
|
// stile finestra
|
||||||
|
LONG style = GetWindowLong( hwndDlg, GWL_STYLE) ;
|
||||||
|
style |= WS_SYSMENU ;
|
||||||
|
SetWindowLong( hwndDlg, GWL_STYLE, style) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// assegno titolo del dialogo
|
||||||
|
SetWindowText( hwndDlg, stringtoW( s_sCaption_ML)) ;
|
||||||
|
|
||||||
|
// assegno testi e valori di default e nascondo linee dei controlli non usati
|
||||||
|
for ( int i = 0 ; i < MAX_CTRLS_ML ; ++ i) {
|
||||||
|
if ( i < s_nCtrls_ML) {
|
||||||
|
|
||||||
|
// imposto il testo nella riga corrente
|
||||||
|
SetDlgItemText( hwndDlg, IDC_TEXT_ML_1 + i, stringtoW( s_sText_ML[i])) ;
|
||||||
|
|
||||||
|
// --- se CheckBox
|
||||||
|
if ( s_sEdit_ML[i].find( "CK:") == 0) {
|
||||||
|
bool bChecked = false ;
|
||||||
|
FromString( s_sEdit_ML[i].substr( 3), bChecked) ;
|
||||||
|
CheckDlgButton( hwndDlg, IDC_CHECK_ML_1 + i, ( bChecked ? BST_CHECKED : BST_UNCHECKED)) ;
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT_ML_1 + i), SW_HIDE) ; // nascondo Edit
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO_ML_1 + i), SW_HIDE) ; // nascondo Combo
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_BUTTON_ML_1 + i), SW_HIDE) ; // nascondo Button di selezione
|
||||||
|
s_nType_ML[i] = CTRL_CHECK ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- se ComboBox
|
||||||
|
else if ( s_sEdit_ML[i].find( "CB:") == 0) {
|
||||||
|
string sList = s_sEdit_ML[i].substr( 3) ;
|
||||||
|
STRVECTOR vsVal ;
|
||||||
|
Tokenize( sList, ",", vsVal) ;
|
||||||
|
int nSel = 0 ;
|
||||||
|
HWND hwndCBox = GetDlgItem( hwndDlg, IDC_COMBO_ML_1 + i) ;
|
||||||
|
for ( int j = 0 ; j < ssize( vsVal) ; ++ j) {
|
||||||
|
string sItem ;
|
||||||
|
if ( vsVal[j][0] == '*') {
|
||||||
|
nSel = j ;
|
||||||
|
sItem = vsVal[j].substr( 1) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sItem = vsVal[j] ;
|
||||||
|
ComboBox_AddString( hwndCBox, stringtoW( sItem)) ;
|
||||||
|
}
|
||||||
|
ComboBox_SetCurSel( hwndCBox, nSel) ;
|
||||||
|
int nEditHeight = int( SendMessage( hwndCBox, CB_GETITEMHEIGHT, (WPARAM)-1, 0)) ;
|
||||||
|
int nItemHeight = int( SendMessage( hwndCBox, CB_GETITEMHEIGHT, 0, 0)) ;
|
||||||
|
int nTotalHeight = nEditHeight + nItemHeight * ( ssize( vsVal) + 1) ;
|
||||||
|
RECT rc ; GetWindowRect( hwndCBox, &rc) ;
|
||||||
|
HWND parent = GetParent(hwndCBox) ; MapWindowPoints( NULL, parent, (LPPOINT)&rc, 2) ;
|
||||||
|
SetWindowPos( hwndCBox, NULL, rc.left, rc.top, rc.right - rc.left, nTotalHeight, SWP_NOZORDER) ;
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT_ML_1 + i), SW_HIDE) ; // nascondo Edit
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK_ML_1 + i), SW_HIDE) ; // nascondo CheckBox
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_BUTTON_ML_1 + i), SW_HIDE) ; // nascondo Button di selezione
|
||||||
|
s_nType_ML[i] = CTRL_COMBO ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- se ColorPicker
|
||||||
|
else if ( s_sEdit_ML[i].find( "CP:") == 0) {
|
||||||
|
string sVal = s_sEdit_ML[i].substr( 3) ;
|
||||||
|
Color CColor ;
|
||||||
|
if ( ! FromString( sVal, CColor))
|
||||||
|
CColor = INVISIBLE ;
|
||||||
|
selectedColor[i] = RGB( CColor.GetIntRed(), CColor.GetIntGreen(), CColor.GetIntBlue()) ;
|
||||||
|
if ( hColorBrush[i] != NULL)
|
||||||
|
DeleteObject( hColorBrush[i]) ;
|
||||||
|
hColorBrush[i] = CreateSolidBrush( selectedColor[i]) ;
|
||||||
|
// recupero i valori dei colori personalizzati dal file .ini
|
||||||
|
if ( ! s_bCustomColorsInit) {
|
||||||
|
// recupero il file Ini
|
||||||
|
string sIniFile = ExeGetIniFile() ;
|
||||||
|
if ( ! sIniFile.empty()) {
|
||||||
|
string sCustomVals = GetPrivateProfileStringUtf8( SEC_SCENE, KEY_CUSTOMCOLORS, "", sIniFile.c_str()) ;
|
||||||
|
STRVECTOR vsWinColors ; Tokenize( sCustomVals, ",", vsWinColors) ;
|
||||||
|
for ( int j = 0 ; j < ssize( vsWinColors) && j < 16 ; ++ j) {
|
||||||
|
unsigned int unVal ;
|
||||||
|
if ( FromString( vsWinColors[j], unVal)) {
|
||||||
|
unsigned int unR = unVal & 0xFF ;
|
||||||
|
unsigned int unG = ( unVal >> 8) & 0xFF ;
|
||||||
|
unsigned int unB = ( unVal >> 16) & 0xFF ;
|
||||||
|
s_CustomColors[j] = RGB( unR, unG, unB) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s_bCustomColorsInit = true ;
|
||||||
|
}
|
||||||
|
// nascondo qualsiasi tipo di componente
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT_ML_1 + i), SW_HIDE) ; // nascondo Edit
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO_ML_1 + i), SW_HIDE) ; // nascondo Combo
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK_ML_1 + i), SW_HIDE) ; // nascondo Check
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_BUTTON_ML_1 + i), SW_HIDE) ; // nascondo Button di selezione
|
||||||
|
|
||||||
|
// margini per dimensione del rettangolo preview pickColor
|
||||||
|
const int MARGIN_RIGHT = 8 ; // spazio tra preview e bordo destro dialog
|
||||||
|
const int PREVIEW_HEIGHT = 20 ; // altezza del rettangolo
|
||||||
|
const int PREVIEW_MIN_WIDTH = 40 ; // larghezza minima
|
||||||
|
|
||||||
|
// creazione della static preview
|
||||||
|
HWND hwndPreview = NULL ;
|
||||||
|
HWND hwndEdit = GetDlgItem( hwndDlg, IDC_EDIT_ML_1 + i) ;
|
||||||
|
RECT rcEdit ; GetClientRect( hwndDlg, &rcEdit) ; // coordinate client del dialog
|
||||||
|
if ( hwndEdit != nullptr && GetWindowRect( hwndEdit, &rcEdit)) {
|
||||||
|
// converti rcLabel in coordinate client
|
||||||
|
POINT ptEdit = { rcEdit.left, rcEdit.top } ;
|
||||||
|
ScreenToClient( hwndDlg, &ptEdit) ;
|
||||||
|
int x = ptEdit.x ;
|
||||||
|
int y = ptEdit.y ;
|
||||||
|
int width = rcEdit.right - rcEdit.left ;
|
||||||
|
if ( width < PREVIEW_MIN_WIDTH)
|
||||||
|
width = PREVIEW_MIN_WIDTH ;
|
||||||
|
hwndPreview = CreateWindowEx( 0, L"STATIC", NULL,
|
||||||
|
WS_CHILD | WS_VISIBLE | SS_NOTIFY | SS_CENTERIMAGE | WS_BORDER,
|
||||||
|
x, y, width, PREVIEW_HEIGHT,
|
||||||
|
hwndDlg, ( HMENU)( IDC_COLOR1 + i),
|
||||||
|
GetModuleHandle( NULL), NULL) ;
|
||||||
|
}
|
||||||
|
// pulizia elementi testuali
|
||||||
|
if ( hwndPreview) {
|
||||||
|
SetWindowText( hwndPreview, L"") ;
|
||||||
|
SetWindowPos( hwndPreview, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) ;
|
||||||
|
InvalidateRect( hwndPreview, NULL, TRUE) ;
|
||||||
|
UpdateWindow( hwndPreview) ;
|
||||||
|
}
|
||||||
|
s_nType_ML[i] = CTRL_COLOR ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- se Button di selezione
|
||||||
|
else if ( s_sEdit_ML[i].find( "BT:") == 0) {
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO_ML_1 + i), SW_HIDE) ; // nascondo la Combo
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK_ML_1 + i), SW_HIDE) ; // nascondo la Check
|
||||||
|
SetDlgItemText( hwndDlg, IDC_BUTTON_ML_1 + i, stringtoW( string{ "N"})) ; // modalità non Selezione
|
||||||
|
// associo alla casella di testo la funzione di KeyPress su Enter
|
||||||
|
HWND hEdit = GetDlgItem( hwndDlg, IDC_EDIT_ML_1 + i) ;
|
||||||
|
if ( hEdit != nullptr)
|
||||||
|
SetWindowSubclass( hEdit, UpdateSelectionModelessDialog, 1, (DWORD_PTR)( IDC_EDIT_ML_1 + i)) ;
|
||||||
|
s_nType_ML[i] = CTRL_BUTTON ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- se Testo
|
||||||
|
else {
|
||||||
|
SetDlgItemText( hwndDlg, IDC_EDIT_ML_1 + i, stringtoW( s_sEdit_ML[i])) ;
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO_ML_1 + i), SW_HIDE) ; // nascondo Combo
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK_ML_1 + i), SW_HIDE) ; // nascondo Check
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_BUTTON_ML_1 + i), SW_HIDE) ; // nascondo Button di selezione
|
||||||
|
s_nType_ML[i] = CTRL_EDIT ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// se numero di controllo superiore al massimo, non visualizzo nullo ( in questo caso aggiungere elementi a Dialog in .rc)
|
||||||
|
else {
|
||||||
|
// nascondo tutto
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_TEXT_ML_1 + i), SW_HIDE) ;
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT_ML_1 + i), SW_HIDE) ;
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_COMBO_ML_1 + i), SW_HIDE) ;
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_CHECK_ML_1 + i), SW_HIDE) ;
|
||||||
|
ShowWindow( GetDlgItem( hwndDlg, IDC_BUTTON_ML_1 + i), SW_HIDE) ;
|
||||||
|
s_nType[i] = CTRL_NONE ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case WM_CTLCOLORSTATIC :
|
||||||
|
{
|
||||||
|
HDC hdcStatic = ( HDC)wParam ;
|
||||||
|
HWND hwndCtrl = ( HWND)lParam ;
|
||||||
|
int ctrlId = GetDlgCtrlID( hwndCtrl) ;
|
||||||
|
if ( ctrlId >= IDC_COLOR1 && ctrlId <= IDC_COLOR8) {
|
||||||
|
int idx = ctrlId - IDC_COLOR1 ;
|
||||||
|
if ( hColorBrush[idx] == NULL)
|
||||||
|
hColorBrush[idx] = CreateSolidBrush( selectedColor[idx]) ;
|
||||||
|
SetBkMode( hdcStatic, OPAQUE) ;
|
||||||
|
SetBkColor( hdcStatic, selectedColor[idx]) ;
|
||||||
|
return ( INT_PTR)hColorBrush[idx] ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case WM_COMMAND : {
|
||||||
|
int id = LOWORD( wParam) ;
|
||||||
|
int code = HIWORD( wParam) ;
|
||||||
|
|
||||||
|
// --- se click di un Button di selezione
|
||||||
|
if ( id >= IDC_BUTTON_ML_1 && id < IDC_BUTTON_ML_1 + MAX_CTRLS_ML) {
|
||||||
|
int nBtnId = id ;
|
||||||
|
int nEditId = IDC_EDIT_ML_1 + ( id - IDC_BUTTON_ML_1) ;
|
||||||
|
// se il bottone premuto è lo stesso, allora termina le selezione degli Ids
|
||||||
|
if ( nDlgModelessItem == nEditId) {
|
||||||
|
SetDlgItemText( hwndDlg, nBtnId, stringtoW( string{ "N"})) ;
|
||||||
|
nDlgModelessItem = -1 ;
|
||||||
|
}
|
||||||
|
// se nuovo buttone premuto
|
||||||
|
else {
|
||||||
|
// se esisteva una selezione precedente, questa viene annullata
|
||||||
|
if ( nDlgModelessItem != -1) {
|
||||||
|
// recupero il Button di selezione precedente e modifico il suo testo
|
||||||
|
int nPrevBtnId = IDC_BUTTON_ML_1 + ( nDlgModelessItem - IDC_EDIT_ML_1) ;
|
||||||
|
SetDlgItemText( hwndDlg, nPrevBtnId, stringtoW( string{ "N"})) ;
|
||||||
|
}
|
||||||
|
// la selezione passa al comando corrente
|
||||||
|
nDlgModelessItem = nEditId ;
|
||||||
|
SetDlgItemText( hwndDlg, nBtnId, stringtoW( string{ "S"})) ;
|
||||||
|
}
|
||||||
|
// per semplicità, deseleziono tutto
|
||||||
|
ExeDeselectAll() ;
|
||||||
|
ExeDraw() ;
|
||||||
|
}
|
||||||
|
// --- se comando di Preview per brush di colori mediante click del mouse
|
||||||
|
else if ( code == STN_CLICKED && id >= IDC_COLOR1 && id <= IDC_COLOR8) {
|
||||||
|
int idx = id - IDC_COLOR1 ;
|
||||||
|
HWND hwndPreview = GetDlgItem( hwndDlg, IDC_COLOR1 + idx) ;
|
||||||
|
if ( ! hwndPreview)
|
||||||
|
return TRUE ;
|
||||||
|
// apertura ChooseColor (usa hwndDlg come owner)
|
||||||
|
CHOOSECOLOR cc = {} ;
|
||||||
|
cc.lStructSize = sizeof( cc) ;
|
||||||
|
cc.hwndOwner = hwndDlg ;
|
||||||
|
cc.lpCustColors = s_CustomColors ;
|
||||||
|
cc.rgbResult = selectedColor[idx] ;
|
||||||
|
cc.Flags = CC_FULLOPEN | CC_RGBINIT ;
|
||||||
|
if ( ChooseColor( &cc)) {
|
||||||
|
selectedColor[idx] = cc.rgbResult ;
|
||||||
|
// salvo nel file Ini i nuovi colori personalizzati
|
||||||
|
string sIniFile = ExeGetIniFile() ;
|
||||||
|
if ( ! sIniFile.empty()) {
|
||||||
|
string sOut = "" ;
|
||||||
|
for ( int j = 0 ; j < ssize( s_CustomColors) && j < 16 ; ++ j)
|
||||||
|
sOut += ToString( ( unsigned int)s_CustomColors[j]) + "," ;
|
||||||
|
sOut.pop_back() ;
|
||||||
|
WritePrivateProfileStringUtf8( SEC_SCENE, KEY_CUSTOMCOLORS, sOut.c_str(), sIniFile.c_str()) ;
|
||||||
|
}
|
||||||
|
if ( hColorBrush[idx] != NULL)
|
||||||
|
DeleteObject( hColorBrush[idx]) ;
|
||||||
|
hColorBrush[idx] = CreateSolidBrush( selectedColor[idx]) ;
|
||||||
|
InvalidateRect(hwndPreview, NULL, TRUE) ;
|
||||||
|
UpdateWindow( hwndPreview) ;
|
||||||
|
}
|
||||||
|
return TRUE ;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ( LOWORD( wParam)) {
|
||||||
|
case IDOK_ML : {
|
||||||
|
// recupero il contesto impostato alla creazione della finestra ( durante esecuzione WM_INITDIALOG)
|
||||||
|
DialogContext* ctx = (DialogContext*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA) ;
|
||||||
|
if ( ctx != nullptr && ctx->nCallBackFun != LUA_NOREF) {
|
||||||
|
|
||||||
|
// recupero la CallBack
|
||||||
|
lua_rawgeti( ctx->L, LUA_REGISTRYINDEX, ctx->nCallBackFun) ;
|
||||||
|
// definisco una tabella per tutti i valori Lua da restituire
|
||||||
|
lua_newtable( ctx->L) ;
|
||||||
|
|
||||||
|
// recupero i valori degli Item
|
||||||
|
for ( int i = 0 ; i < s_nCtrls_ML ; ++ i) {
|
||||||
|
AtoWEX<128> wsEdit( "") ;
|
||||||
|
s_sEdit_ML[i] = "" ;
|
||||||
|
|
||||||
|
switch ( s_nType_ML[i]) {
|
||||||
|
case CTRL_CHECK :
|
||||||
|
s_sEdit_ML[i] = ( IsDlgButtonChecked( hwndDlg, IDC_CHECK_ML_1 + i) == BST_CHECKED ? "1" : "0") ;
|
||||||
|
break ;
|
||||||
|
case CTRL_COMBO :
|
||||||
|
if ( GetDlgItemText( hwndDlg, IDC_COMBO_ML_1 + i, LPWSTR( wsEdit), 128) > 0)
|
||||||
|
s_sEdit_ML[i] = wstrztoA( wsEdit) ;
|
||||||
|
break ;
|
||||||
|
case CTRL_EDIT :
|
||||||
|
if ( GetDlgItemText( hwndDlg, IDC_EDIT_ML_1 + i, LPWSTR( wsEdit), 128) > 0)
|
||||||
|
s_sEdit_ML[i] = wstrztoA( wsEdit) ;
|
||||||
|
break ;
|
||||||
|
case CTRL_COLOR :
|
||||||
|
{
|
||||||
|
COLORREF col = selectedColor[i] ;
|
||||||
|
BYTE r = GetRValue( col), g = GetGValue( col), b = GetBValue( col) ;
|
||||||
|
char buf[16] ;
|
||||||
|
sprintf_s( buf, sizeof( buf), "%u,%u,%u", r, g, b) ;
|
||||||
|
s_sEdit_ML[i] = buf ;
|
||||||
|
}
|
||||||
|
break ;
|
||||||
|
case CTRL_BUTTON :
|
||||||
|
if ( GetDlgItemText( hwndDlg, IDC_EDIT_ML_1 + i, LPWSTR( wsEdit), 128) > 0)
|
||||||
|
s_sEdit_ML[i] = wstrztoA( wsEdit) ;
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ogni valore letto viene inserito all'interno della Table creata in precedenza e passata alla CallBack di lua
|
||||||
|
int nIndex = 1 ;
|
||||||
|
for ( const string& sVal : s_sEdit_ML) {
|
||||||
|
lua_pushstring( ctx->L, sVal.c_str()) ;
|
||||||
|
lua_rawseti( ctx->L, -2, nIndex ++) ;
|
||||||
|
}
|
||||||
|
// chiamo la CallBack
|
||||||
|
lua_pcall( ctx->L, 1, 0, 0) ;
|
||||||
|
// libero la memoria
|
||||||
|
luaL_unref( ctx->L, LUA_REGISTRYINDEX, ctx->nCallBackFun) ;
|
||||||
|
delete ctx ;
|
||||||
|
ctx = nullptr ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// rimuovo finestra e annullo il contesto
|
||||||
|
DestroyWindow( hwndDlg) ;
|
||||||
|
phDlgModeless = nullptr ;
|
||||||
|
nDlgModelessItem = -1 ;
|
||||||
|
return TRUE ;
|
||||||
|
}
|
||||||
|
[[fallthrough]] ;
|
||||||
|
case IDCANCEL_ML : {
|
||||||
|
// pulizia brush colori
|
||||||
|
for ( int i = 0 ; i < MAX_CTRLS_ML ; ++ i) {
|
||||||
|
if ( hColorBrush[i] != NULL) {
|
||||||
|
DeleteObject( hColorBrush[i]) ;
|
||||||
|
hColorBrush[i] = NULL ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// recupero il contesto impostato alla creazione della finestra ( durante esecuzione WM_INITDIALOG) e se esiste lo rimuovo
|
||||||
|
DialogContext* ctx = (DialogContext*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA) ;
|
||||||
|
if ( ctx != nullptr && ctx->nCallBackFun != LUA_NOREF) {
|
||||||
|
luaL_unref( ctx->L, LUA_REGISTRYINDEX, ctx->nCallBackFun) ;
|
||||||
|
delete ctx ;
|
||||||
|
ctx = nullptr ;
|
||||||
|
}
|
||||||
|
// rimuovo finestra e annullo il contesto
|
||||||
|
DestroyWindow( hwndDlg) ;
|
||||||
|
phDlgModeless = nullptr ;
|
||||||
|
nDlgModelessItem = -1 ;
|
||||||
|
return TRUE ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break ;
|
||||||
|
case WM_CLOSE : {
|
||||||
|
// recupero il contesto impostato alla creazione della finestra ( durante esecuzione WM_INITDIALOG) e se esiste lo rimuovo
|
||||||
|
DialogContext* ctx = (DialogContext*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA) ;
|
||||||
|
if ( ctx != nullptr && ctx->nCallBackFun != LUA_NOREF) {
|
||||||
|
luaL_unref( ctx->L, LUA_REGISTRYINDEX, ctx->nCallBackFun) ;
|
||||||
|
delete ctx ;
|
||||||
|
ctx = nullptr ;
|
||||||
|
}
|
||||||
|
// rimuovo finestra e annullo il contesto
|
||||||
|
DestroyWindow( hwndDlg) ;
|
||||||
|
phDlgModeless = nullptr ;
|
||||||
|
nDlgModelessItem = -1 ;
|
||||||
|
return TRUE ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaDialogBox( lua_State* L)
|
LuaDialogBox( lua_State* L)
|
||||||
@@ -1546,6 +1966,71 @@ LuaDialogBox( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
static int
|
||||||
|
LuaDialogBoxModeless( lua_State* L)
|
||||||
|
{
|
||||||
|
// 1 .. 9 parametri : sCaption, { sText, sDefault}, ...
|
||||||
|
LuaCheckParam( L, 1, s_sCaption_ML)
|
||||||
|
s_nCtrls_ML = 0 ;
|
||||||
|
for ( int i = 0 ; i < MAX_CTRLS_ML ; ++ i) {
|
||||||
|
STRVECTOR vData ;
|
||||||
|
if ( LuaGetParam( L, 2 + i, vData) && ssize( vData) >= 2) {
|
||||||
|
s_sText_ML[i] = Trim( vData[0]) ;
|
||||||
|
s_sEdit_ML[i] = Trim( vData[1]) ;
|
||||||
|
++ s_nCtrls_ML ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
// se abilitata UI, lancio dialogo
|
||||||
|
if ( ExeGetEnableUI()) {
|
||||||
|
// se dialogo già presente, errore ( per ora una sola finestra non modale per volta)
|
||||||
|
if ( phDlgModeless != nullptr) {
|
||||||
|
LuaSetParam( L, false) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
// definisco il contesto per il dialogo
|
||||||
|
DialogContext* ctx = new DialogContext() ;
|
||||||
|
if ( ctx != nullptr) {
|
||||||
|
// recupero la funzione di CallBack per restituire i valori presenti nella DialogBoxModeless
|
||||||
|
// questa funzione deve essere l'ultimo parametro
|
||||||
|
int nCallBackRef = LUA_NOREF ;
|
||||||
|
int nLastPar = lua_gettop( L) ;
|
||||||
|
if ( lua_isfunction( L, nLastPar)) {
|
||||||
|
lua_pushvalue( L, nLastPar) ; // copio la funzione
|
||||||
|
ctx->nCallBackFun = luaL_ref( L, LUA_REGISTRYINDEX) ; // salvo nel registro
|
||||||
|
ctx->L = L ; // salvo lo State Lua
|
||||||
|
// lancio dialogo
|
||||||
|
HWND hTopWnd = ExeGetMainWindowHandle() ;
|
||||||
|
nDlgModelessItem = -1 ;
|
||||||
|
phDlgModeless = ( CreateDialogParam( GetModuleIstance(), MAKEINTRESOURCE( IDD_LUADLG_ML), hTopWnd,
|
||||||
|
(DLGPROC)DialogBoxModelessProc, (LPARAM)ctx)) ;
|
||||||
|
if ( phDlgModeless != nullptr) {
|
||||||
|
// se dialogo creato, porto la finestra in primo piano
|
||||||
|
ShowWindow( phDlgModeless, SW_SHOW) ;
|
||||||
|
SetForegroundWindow( phDlgModeless) ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
delete ctx ;
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
delete ctx ;
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LuaSetParam( L) ;
|
||||||
|
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
LuaInstallGeneral( LuaMgr& luaMgr)
|
LuaInstallGeneral( LuaMgr& luaMgr)
|
||||||
@@ -1607,6 +2092,6 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateMutex", LuaCreateMutex) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCreateMutex", LuaCreateMutex) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtReleaseMutex", LuaReleaseMutex) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtReleaseMutex", LuaReleaseMutex) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
|
||||||
|
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBoxModeless", LuaDialogBoxModeless) ;
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -504,7 +504,6 @@ LuaGetNextRawPart( lua_State* L)
|
|||||||
LuaSetParam( L) ;
|
LuaSetParam( L) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaAddRawPart( lua_State* L)
|
LuaAddRawPart( lua_State* L)
|
||||||
@@ -531,28 +530,6 @@ LuaAddRawPart( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
static int
|
|
||||||
LuaAddRawPartGen( lua_State* L)
|
|
||||||
{
|
|
||||||
// 3 parametri : nCrvSrfId, dOverMat, Color
|
|
||||||
int nCrvSrfId ;
|
|
||||||
LuaCheckParam( L, 1, nCrvSrfId)
|
|
||||||
double dOverMat ;
|
|
||||||
LuaCheckParam( L, 2, dOverMat)
|
|
||||||
Color cCol ;
|
|
||||||
LuaCheckParam( L, 3, cCol)
|
|
||||||
LuaClearStack( L) ;
|
|
||||||
// inserisco il grezzo nella macchinata corrente
|
|
||||||
int nInd = ExeAddRawPartGen( nCrvSrfId, dOverMat, cCol) ;
|
|
||||||
// restituisco il risultato
|
|
||||||
if ( nInd != GDB_ID_NULL)
|
|
||||||
LuaSetParam( L, nInd) ;
|
|
||||||
else
|
|
||||||
LuaSetParam( L) ;
|
|
||||||
return 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
static int
|
static int
|
||||||
LuaAddRawPartWithPart( lua_State* L)
|
LuaAddRawPartWithPart( lua_State* L)
|
||||||
@@ -4607,7 +4584,6 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
|||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstRawPart", LuaGetFirstRawPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstRawPart", LuaGetFirstRawPart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextRawPart", LuaGetNextRawPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextRawPart", LuaGetNextRawPart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPart", LuaAddRawPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPart", LuaAddRawPart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPartGen", LuaAddRawPartGen) ;
|
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPartWithPart", LuaAddRawPartWithPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPartWithPart", LuaAddRawPartWithPart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPart", LuaModifyRawPart) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPart", LuaModifyRawPart) ;
|
||||||
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartSize", LuaModifyRawPartSize) ;
|
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartSize", LuaModifyRawPartSize) ;
|
||||||
|
|||||||
+1
-3
@@ -297,10 +297,8 @@ LuaRegolarizeSurfaceLocally( lua_State* L)
|
|||||||
LuaCheckParam( L, 4, nSyncEndId)
|
LuaCheckParam( L, 4, nSyncEndId)
|
||||||
double dLinTol ;
|
double dLinTol ;
|
||||||
LuaCheckParam( L, 5, dLinTol)
|
LuaCheckParam( L, 5, dLinTol)
|
||||||
int nType = 0 ;
|
|
||||||
LuaCheckParam( L, 6, nType)
|
|
||||||
|
|
||||||
int nId = ExeRegolarizeSurfaceLocally( nParentId, nSurfId, nSyncStartId, nSyncEndId, dLinTol, nType) ;
|
int nId = ExeRegolarizeSurfaceLocally( nParentId, nSurfId, nSyncStartId, nSyncEndId, dLinTol) ;
|
||||||
LuaSetParam( L, nId) ;
|
LuaSetParam( L, nId) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|||||||
+60
-4
@@ -1,10 +1,13 @@
|
|||||||
//{{NO_DEPENDENCIES}}
|
//{{NO_DEPENDENCIES}}
|
||||||
// Microsoft Visual C++ generated include file.
|
// File di inclusione generato con Microsoft Visual C++.
|
||||||
// Used by EgtExecutor.rc
|
// Utilizzato da EgtExecutor.rc
|
||||||
//
|
//
|
||||||
#define VS_VERSION_INFO 1
|
#define VS_VERSION_INFO 1
|
||||||
|
|
||||||
#define IDD_LUADLG 101
|
#define IDD_LUADLG 101
|
||||||
#define IDD_LUASCENE 102
|
#define IDD_LUASCENE 102
|
||||||
|
#define IDD_LUADLG_ML 103
|
||||||
|
|
||||||
#define IDC_TEXT1 1001
|
#define IDC_TEXT1 1001
|
||||||
#define IDC_TEXT2 1002
|
#define IDC_TEXT2 1002
|
||||||
#define IDC_TEXT3 1003
|
#define IDC_TEXT3 1003
|
||||||
@@ -13,6 +16,7 @@
|
|||||||
#define IDC_TEXT6 1006
|
#define IDC_TEXT6 1006
|
||||||
#define IDC_TEXT7 1007
|
#define IDC_TEXT7 1007
|
||||||
#define IDC_TEXT8 1008
|
#define IDC_TEXT8 1008
|
||||||
|
|
||||||
#define IDC_EDIT1 1011
|
#define IDC_EDIT1 1011
|
||||||
#define IDC_EDIT2 1012
|
#define IDC_EDIT2 1012
|
||||||
#define IDC_EDIT3 1013
|
#define IDC_EDIT3 1013
|
||||||
@@ -21,6 +25,7 @@
|
|||||||
#define IDC_EDIT6 1016
|
#define IDC_EDIT6 1016
|
||||||
#define IDC_EDIT7 1017
|
#define IDC_EDIT7 1017
|
||||||
#define IDC_EDIT8 1018
|
#define IDC_EDIT8 1018
|
||||||
|
|
||||||
#define IDC_COMBO1 1021
|
#define IDC_COMBO1 1021
|
||||||
#define IDC_COMBO2 1022
|
#define IDC_COMBO2 1022
|
||||||
#define IDC_COMBO3 1023
|
#define IDC_COMBO3 1023
|
||||||
@@ -29,6 +34,7 @@
|
|||||||
#define IDC_COMBO6 1026
|
#define IDC_COMBO6 1026
|
||||||
#define IDC_COMBO7 1027
|
#define IDC_COMBO7 1027
|
||||||
#define IDC_COMBO8 1028
|
#define IDC_COMBO8 1028
|
||||||
|
|
||||||
#define IDC_CHECK1 1031
|
#define IDC_CHECK1 1031
|
||||||
#define IDC_CHECK2 1032
|
#define IDC_CHECK2 1032
|
||||||
#define IDC_CHECK3 1033
|
#define IDC_CHECK3 1033
|
||||||
@@ -37,6 +43,7 @@
|
|||||||
#define IDC_CHECK6 1036
|
#define IDC_CHECK6 1036
|
||||||
#define IDC_CHECK7 1037
|
#define IDC_CHECK7 1037
|
||||||
#define IDC_CHECK8 1038
|
#define IDC_CHECK8 1038
|
||||||
|
|
||||||
#define IDC_COLOR1 1041
|
#define IDC_COLOR1 1041
|
||||||
#define IDC_COLOR2 1042
|
#define IDC_COLOR2 1042
|
||||||
#define IDC_COLOR3 1043
|
#define IDC_COLOR3 1043
|
||||||
@@ -45,15 +52,64 @@
|
|||||||
#define IDC_COLOR6 1046
|
#define IDC_COLOR6 1046
|
||||||
#define IDC_COLOR7 1047
|
#define IDC_COLOR7 1047
|
||||||
#define IDC_COLOR8 1048
|
#define IDC_COLOR8 1048
|
||||||
|
|
||||||
#define IDC_PICTURE1 1101
|
#define IDC_PICTURE1 1101
|
||||||
|
|
||||||
|
#define IDC_TEXT_ML_1 2001
|
||||||
|
#define IDC_TEXT_ML_2 2002
|
||||||
|
#define IDC_TEXT_ML_3 2003
|
||||||
|
#define IDC_TEXT_ML_4 2004
|
||||||
|
#define IDC_TEXT_ML_5 2005
|
||||||
|
#define IDC_TEXT_ML_6 2006
|
||||||
|
#define IDC_TEXT_ML_7 2007
|
||||||
|
#define IDC_TEXT_ML_8 2008
|
||||||
|
|
||||||
|
#define IDC_EDIT_ML_1 2011
|
||||||
|
#define IDC_EDIT_ML_2 2012
|
||||||
|
#define IDC_EDIT_ML_3 2013
|
||||||
|
#define IDC_EDIT_ML_4 2014
|
||||||
|
#define IDC_EDIT_ML_5 2015
|
||||||
|
#define IDC_EDIT_ML_6 2016
|
||||||
|
#define IDC_EDIT_ML_7 2017
|
||||||
|
#define IDC_EDIT_ML_8 2018
|
||||||
|
|
||||||
|
#define IDC_COMBO_ML_1 2021
|
||||||
|
#define IDC_COMBO_ML_2 2022
|
||||||
|
#define IDC_COMBO_ML_3 2023
|
||||||
|
#define IDC_COMBO_ML_4 2024
|
||||||
|
#define IDC_COMBO_ML_5 2025
|
||||||
|
#define IDC_COMBO_ML_6 2026
|
||||||
|
#define IDC_COMBO_ML_7 2027
|
||||||
|
#define IDC_COMBO_ML_8 2028
|
||||||
|
|
||||||
|
#define IDC_CHECK_ML_1 2031
|
||||||
|
#define IDC_CHECK_ML_2 2032
|
||||||
|
#define IDC_CHECK_ML_3 2033
|
||||||
|
#define IDC_CHECK_ML_4 2034
|
||||||
|
#define IDC_CHECK_ML_5 2035
|
||||||
|
#define IDC_CHECK_ML_6 2036
|
||||||
|
#define IDC_CHECK_ML_7 2037
|
||||||
|
#define IDC_CHECK_ML_8 2038
|
||||||
|
|
||||||
|
#define IDC_BUTTON_ML_1 2041
|
||||||
|
#define IDC_BUTTON_ML_2 2042
|
||||||
|
#define IDC_BUTTON_ML_3 2043
|
||||||
|
#define IDC_BUTTON_ML_4 2044
|
||||||
|
#define IDC_BUTTON_ML_5 2045
|
||||||
|
#define IDC_BUTTON_ML_6 2046
|
||||||
|
#define IDC_BUTTON_ML_7 2047
|
||||||
|
#define IDC_BUTTON_ML_8 2048
|
||||||
|
|
||||||
|
#define IDOK_ML 2051
|
||||||
|
#define IDCANCEL_ML 2052
|
||||||
|
|
||||||
// Next default values for new objects
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 103
|
#define _APS_NEXT_RESOURCE_VALUE 105
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1030
|
#define _APS_NEXT_CONTROL_VALUE 1072
|
||||||
#define _APS_NEXT_SYMED_VALUE 115
|
#define _APS_NEXT_SYMED_VALUE 115
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user