diff --git a/Designing/WinConst.lua b/Designing/WinConst.lua index b59f716..efefba4 100644 --- a/Designing/WinConst.lua +++ b/Designing/WinConst.lua @@ -263,6 +263,10 @@ WIN_GASKET = 'Gasket' WIN_THRESHOLD = 'Threshold' -- info sui profili +WIN_DIM_STD = 'DimStd' +WIN_DIM_MIN = 'DimMin' +WIN_DIM_MAX = 'DimMax' +WIN_OVERLAP = 'Overlap' WIN_SASH_TOP_OVERLAP = 'SashTopOverlap' WIN_SASH_BOTTOM_OVERLAP = 'SashBottomOverlap' WIN_DELTA = 'Delta' diff --git a/Designing/WinProject.lua b/Designing/WinProject.lua index 8ef7deb..504a60d 100644 --- a/Designing/WinProject.lua +++ b/Designing/WinProject.lua @@ -135,6 +135,7 @@ local function FindThresholds( nGrpId) return tThresholds end +---------------------------------------------------------------------------------- local function GetProfileThresholdsList() local tThresholds = {} if _G.sProfile == WDG.PROFILE then @@ -161,6 +162,91 @@ local function GetProfileThresholdsList() end _G.GetProfileThresholdsList = GetProfileThresholdsList +---------------------------------------------------------------------------------- +local function GetProfileData( nFrameGrp, nSashGrp) + local tData = {} + + -- a) dimensioni + for i = 1, 2 do + -- scorro tutti i profili e salvo le dimensioni + local sName = EgtIf( i == 1, WIN_FRAME, WIN_SASH) + local vProfiles = EgtGetAllInGroup( EgtIf( i ==1, nFrameGrp, nSashGrp)) + for j = 1, #vProfiles do + local sCurrName = sName .. '_' .. EgtGetName( vProfiles[j]) + tData[sCurrName .. '_' .. WIN_DIM_STD] = EgtGetInfo( vProfiles[j], WIN_DIM_STD, 'd') + tData[sCurrName .. '_' .. WIN_DIM_MIN] = EgtGetInfo( vProfiles[j], WIN_DIM_MIN, 'd') + tData[sCurrName .. '_' .. WIN_DIM_MAX] = EgtGetInfo( vProfiles[j], WIN_DIM_MAX, 'd') + end + end + + -- b) overlap + -- tra ante e telaio + local vProfiles = EgtGetAllInGroup( nFrameGrp) + for i = 1, #vProfiles do + local dTopOverlap = EgtGetInfo( vProfiles[i], WIN_SASH_TOP_OVERLAP, 'd') + local dBottomOverlap = EgtGetInfo( vProfiles[i], WIN_SASH_BOTTOM_OVERLAP, 'd') + if dTopOverlap and dBottomOverlap then + tData[EgtGetName( vProfiles[i]) .. '_' .. WIN_TOP .. '_' .. WIN_OVERLAP] = dTopOverlap + tData[EgtGetName( vProfiles[i]) .. '_' .. WIN_BOTTOM .. '_' .. WIN_OVERLAP] = dBottomOverlap + else + tData[EgtGetName( vProfiles[i]) .. '_' .. WIN_OVERLAP] = dTopOverlap or dBottomOverlap + end + end + + -- tra ante battenti/riceventi + local nSashActive = EgtGetFirstNameInGroup( nSashGrp, WIN_SASH_ACTIVE) + if nSashActive then + tData[WIN_SASH_ACTIVE .. '_' .. WIN_OVERLAP] = EgtGetInfo( nSashActive, WIN_OVERLAP, 'd') + end + local nSashFrench = EgtGetFirstNameInGroup( nSashGrp, WIN_FRENCH_IN) + if nSashFrench then + tData[WIN_FRENCH_IN .. '_' .. WIN_OVERLAP] = EgtGetInfo( nSashFrench, WIN_OVERLAP, 'd') + end + local nSlideActive = EgtGetFirstNameInGroup( nSashGrp, WIN_SLIDE_ACTIVE) + if nSlideActive then + tData[WIN_SLIDE_ACTIVE .. '_' .. WIN_OVERLAP] = EgtGetInfo( nSlideActive, WIN_OVERLAP, 'd') + end + + -- tra bottomrail + local nFrameBottomRail = EgtGetFirstNameInGroup( nFrameGrp, WIN_RAIL_BOTTOM) + if nFrameBottomRail then + tData[WIN_FRAME .. '_'.. WIN_BOTTOMRAIL .. '_' .. WIN_OVERLAP] = EgtGetInfo( nFrameBottomRail, WIN_OVERLAP, 'd') + end + local nSashBottomRail = EgtGetFirstNameInGroup( nSashGrp, WIN_RAIL_BOTTOM) + if nSashBottomRail then + tData[WIN_SASH .. '_'.. WIN_BOTTOMRAIL .. '_' .. WIN_OVERLAP] = EgtGetInfo( nSashBottomRail, WIN_OVERLAP, 'd') + end + + return tData +end + +---------------------------------------------------------------------------------- +local function WinGetProfileData() + + local tData + if _G.sProfile == WDG.PROFILE then + -- se profilo corrente + local nProfileGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, WIN_PROFILE) + local nFrameGrp = EgtGetFirstNameInGroup( nProfileGrp, WIN_FRAME) + local nSashGrp = EgtGetFirstNameInGroup( nProfileGrp, WIN_SASH) + tData = GetProfileData( nFrameGrp, nSashGrp) + else + -- importo temporaneamente il profilo + local nLastId = EgtGetLastInGroup( GDB_ID.ROOT) + local bOk = EgtInsertFile( _G.sProfilePath .. '\\' .. WDG.PROFILE .. '.nge') + local nCurrId = EgtGetNext( nLastId or GDB_ID.NULL) or EgtGetFirstInGroup( GDB_ID.ROOT) + local vGrps = {} + while nCurrId do + table.insert( vGrps, nCurrId) + nCurrId = EgtGetNext( nCurrId) + end + tData = GetProfileData( vGrps[1], vGrps[2]) + EgtErase( vGrps) + end + WDG.PROFILEDATA = tData +end +_G.WinGetProfileData = WinGetProfileData + ---------------------------------------------------------------------------------- local function WinCreate_CreateFrame() local JointList = GetVariableList( 'JOINT')