diff --git a/DdfFile.vb b/DdfFile.vb index 5440127..2060925 100644 --- a/DdfFile.vb +++ b/DdfFile.vb @@ -985,7 +985,7 @@ Friend Module DdfFile z = DoubleToString(-dDeltaThickness + dDeltaBottom, 4) End If End If - Return z + Return z End Function #End Region ' Funzioni per il posizionamento @@ -1081,10 +1081,32 @@ Friend Module DdfFile Return True End Function - Private Function AscendingOrder(List As ObservableCollection(Of Compo), DdfFileContent As List(Of String), bIsDDF As Boolean) As Boolean + ' ritorna una lista con tutti i compo dello stesso tipo + Public Function GetCurrentListSameCompoType(ByVal ListCompo As ObservableCollection(Of Compo), sCompoTypeDDF As String) As ObservableCollection(Of Compo) + Dim TempList As New ObservableCollection(Of Compo) + For Index As Integer = 0 To ListCompo.Count - 1 + If ListCompo(Index).CompoType.DDFName = sCompoTypeDDF Then + TempList.Add(ListCompo(Index)) + End If + Next + Return TempList + End Function + + ' ritorna una lista con tutti i compo dello stesso tipo con lo stesso nome + Public Function GetCurrentListSameCompoDDFName(ByVal ListCompo As ObservableCollection(Of Compo), sSelFile As String, sSelBrand As String) As ObservableCollection(Of Compo) + Dim TempList As New ObservableCollection(Of Compo) + For Index As Integer = 0 To ListCompo.Count - 1 + If ListCompo(Index).SelFile = sSelFile And ListCompo(Index).SelBrandPart = sSelBrand Then + TempList.Add(ListCompo(Index)) + End If + Next + Return TempList + End Function + + ' data la lista compo dello stesso tipo, la riordino ( Config.ini → TidyLayer = ...) + Public Sub GetOrderedListSameCompo(ByRef List As ObservableCollection(Of Compo)) Dim tidyParamIndex1 As Integer = -1 Dim tidyParamIndex2 As Integer = -1 - Dim WritingError As String = String.Empty If List.Count >= 2 Then For IndexList1 As Integer = 0 To List.Count - 2 For IndexList2 As Integer = IndexList1 + 1 To List.Count - 1 @@ -1117,6 +1139,66 @@ Friend Module DdfFile Next Next End If + End Sub + + ' rercupera indice nella lista corrente della componente passata + Public Function GetIndexInList(ListCompo As ObservableCollection(Of Compo), SelCompo As Compo) As Integer + ' Se sono qui allora i compo devono avere lo stesso nome?.. Mettere controllo.. + Dim bFoundSelCompo As Boolean = True + For Ind As Integer = 0 To ListCompo.Count - 1 + For Ind2 As Integer = 0 To ListCompo(Ind).CompoParamList.Count - 1 + ' verifco che gli oggetti abbiano lo stesso nome?.. Metter controllo.. + If TypeOf ListCompo(Ind).CompoParamList(Ind2) Is TextBoxOnOffParam And + TypeOf SelCompo.CompoParamList(Ind2) Is TextBoxOnOffParam Then + Dim Temp As TextBoxOnOffParam = DirectCast(ListCompo(Ind).CompoParamList(Ind2), TextBoxOnOffParam) + Dim SelTemp As TextBoxOnOffParam = DirectCast(SelCompo.CompoParamList(Ind2), TextBoxOnOffParam) + If Temp.Value <> SelTemp.Value Or Temp.IsActive <> SelTemp.IsActive Then + bFoundSelCompo = False + End If + ElseIf TypeOf ListCompo(Ind).CompoParamList(Ind2) Is TextBoxParam And + TypeOf SelCompo.CompoParamList(Ind2) Is TextBoxParam Then + Dim Temp As TextBoxParam = DirectCast(ListCompo(Ind).CompoParamList(Ind2), TextBoxParam) + Dim SelTemp As TextBoxParam = DirectCast(SelCompo.CompoParamList(Ind2), TextBoxParam) + If Temp.Value <> SelTemp.Value Then + bFoundSelCompo = False + End If + ElseIf TypeOf ListCompo(Ind).CompoParamList(Ind2) Is ComboBoxOnOffParam And + TypeOf SelCOmpo.CompoParamList(Ind2) Is ComboBoxOnOffParam Then + Dim Temp As ComboBoxOnOffParam = DirectCast(ListCompo(Ind).CompoParamList(Ind2), ComboBoxOnOffParam) + Dim SelTemp As ComboBoxOnOffParam = DirectCast(SelCompo.CompoParamList(Ind2), ComboBoxOnOffParam) + If Temp.SelItem <> SelTemp.SelItem Or Temp.IsActive <> SelTemp.IsActive Then + bFoundSelCompo = False + End If + ElseIf TypeOf ListCompo(Ind).CompoParamList(Ind2) Is ComboBoxParam And + TypeOf SelCompo.CompoParamList(Ind2) Is ComboBoxParam Then + Dim Temp As ComboBoxParam = DirectCast(ListCompo(Ind).CompoParamList(Ind2), ComboBoxParam) + Dim SelTemp As ComboBoxParam = DirectCast(SelCompo.CompoParamList(Ind2), ComboBoxParam) + If Temp.SelItem <> SelTemp.SelItem Then + bFoundSelCompo = False + End If + Else + ' le componeti non sono dello stesso tipo! + Return -1 + End If + ' verifico che il parametro corrente è uguale a quello della compo selezionata + If Not bFoundSelCompo Then + Exit For + End If + Next + ' verifico se ho trovato la compo + If Not bFoundSelCompo Then + bFoundSelCompo = True + Else + Return Ind + End If + Next + ' se esco senza aver trovato niente + Return -1 + End Function + + Private Function AscendingOrder(List As ObservableCollection(Of Compo), DdfFileContent As List(Of String), bIsDDF As Boolean) As Boolean + Dim WritingError As String = String.Empty + GetOrderedListSameCompo(List) ' stampa lista DdfFileContent.AddRange(GenerateCompolistDDF(List(0), WritingError, True, bIsDDF)) For IndexItem As Integer = 1 To List.Count - 1 diff --git a/DoorParameters/Part.vb b/DoorParameters/Part.vb index 16899f4..6c8af06 100644 --- a/DoorParameters/Part.vb +++ b/DoorParameters/Part.vb @@ -1197,6 +1197,7 @@ Public Class Part End Get Set(value As Compo) m_SelCompo = value + MarkCompoInScena() End Set End Property @@ -1506,6 +1507,54 @@ Public Class Part #End Region 'AddCompo +#Region "Selection compo" + + Private Sub ResetAllMark() + Dim nIdFirstPart As Integer = EgtGetFirstPart() + Dim nIdLay As Integer = EgtGetFirstLayer(nIdFirstPart) + While nIdLay <> GDB_ID.NULL + EgtResetMark(nIdLay) + nIdLay = EgtGetNextLayer(nIdLay) + End While + EgtDraw() + End Sub + + Private Sub MarkCompoInScena() + If GetMainPrivateProfileInt(S_GENERAL, "MarkCompo", 0) = 0 Then Return + ResetAllMark() + ' recupero la lista dei compo dello stesso tipo + Dim TempList As ObservableCollection(Of Compo) = DdfFile.GetCurrentListSameCompoType(m_CompoList, m_SelCompo.CompoType.DDFName) + ' recupero la lista dei compo con lo stesso nome + DdfFile.GetCurrentListSameCompoDDFName(TempList, m_SelCompo.SelFile, m_SelCompo.SelBrandPart) + ' riordino la lista appena trovata secondo le regole di stampa DDF + DdfFile.GetOrderedListSameCompo(TempList) + ' ontengo la posizione prevista nella grafica + Dim IndexInList As Integer = DdfFile.GetIndexInList(TempList, m_SelCompo) + ' recupero la lista ordinata + Dim sCompoName As String = m_SelCompo.SelFile + ' recupero il primo part disponibile + Dim nIdFirstPart As Integer = EgtGetFirstPart() + Dim nIdLay As Integer = EgtGetFirstLayer(nIdFirstPart) + Dim IndexLay As Integer = 0 + While nIdLay <> GDB_ID.NULL + Dim sInfoPath As String = String.Empty + If EgtGetInfo(nIdLay, "Path", sInfoPath) Then + Dim sNamePath As String = Path.GetFileNameWithoutExtension(sInfoPath) + If sNamePath = sCompoName And IndexLay = IndexInList Then + EgtSetMark(nIdLay) + Exit While + ElseIf sNamePath = sCompoName And IndexLay < IndexInList Then + IndexLay = IndexLay + 1 + End If + End If + nIdLay = EgtGetNextLayer(nIdLay) + End While + + EgtDraw() + End Sub + +#End Region + #Region "RemoveCompo" Friend Sub RemoveCompo(CompoToRemove As Compo, Optional OnlyOnJamb As Boolean = False) diff --git a/MainWindow/MainWindowModel.vb b/MainWindow/MainWindowModel.vb index 1aaea69..b7ff29a 100644 --- a/MainWindow/MainWindowModel.vb +++ b/MainWindow/MainWindowModel.vb @@ -76,8 +76,8 @@ Friend Class MainWindowModel m_bAutoNest = Not String.IsNullOrWhiteSpace(sNestKey) ' Recupero livello e opzioni della chiave - Dim bKey As Boolean = EgtGetKeyLevel(3279, 2607, 1, IniFile.m_nKeyLevel) And - EgtGetKeyOptions(3279, 2607, 1, IniFile.m_nKeyOptions) + Dim bKey As Boolean = EgtGetKeyLevel(3279, 2608, 1, IniFile.m_nKeyLevel) And + EgtGetKeyOptions(3279, 2608, 1, IniFile.m_nKeyOptions) 'Inizializzazione generale di EgtInterface m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0) Dim sLogFile As String = IniFile.m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString()) diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 351b3c6..5b4b0d4 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -73,4 +73,4 @@ Imports System.Windows ' - +