From ee5a14a8f81e3aa8bc07da5d62c5e9e570cab53d Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Tue, 19 Nov 2024 11:52:15 +0100 Subject: [PATCH 1/2] Salvataggio ultima estensione aperta, evidenzio da scena --- DoorParameters/Compo.vb | 26 +++++++++++ DoorParameters/Part.vb | 6 ++- MainWindow/MainWindowModel.vb | 4 +- My Project/AssemblyInfo.vb | 4 +- ProjectManager/ProjectManagerVM.vb | 21 ++++++++- SceneManager/SceneManagerVM.vb | 71 ++++++++++++++++++++++++++++++ 6 files changed, 125 insertions(+), 7 deletions(-) diff --git a/DoorParameters/Compo.vb b/DoorParameters/Compo.vb index ff0218e..d8ef4ba 100644 --- a/DoorParameters/Compo.vb +++ b/DoorParameters/Compo.vb @@ -111,6 +111,32 @@ Public Class Compo End Set End Property + Public Sub ResetMark() + m_BorderColor = DirectCast(New BrushConverter().ConvertFrom("#DCDCDC"), SolidColorBrush) + m_BackGroundColor = Brushes.White + m_Foreground = Brushes.Black + m_BorderThickness = 1 + m_FontBold = FontWeights.Normal + NotifyPropertyChanged("BorderColor") + NotifyPropertyChanged("BackGroundColor") + NotifyPropertyChanged("Foreground") + NotifyPropertyChanged("BorderThickness") + NotifyPropertyChanged("FontBold") + End Sub + + Public Sub SetMark() + m_BorderColor = Brushes.LightGoldenrodYellow + m_BackGroundColor = Brushes.White + m_Foreground = Brushes.Gold + m_BorderThickness = 2 + m_FontBold = FontWeights.Bold + NotifyPropertyChanged("BorderColor") + NotifyPropertyChanged("BackGroundColor") + NotifyPropertyChanged("Foreground") + NotifyPropertyChanged("BorderThickness") + NotifyPropertyChanged("FontBold") + End Sub + #End Region ' Colori GroupBox #Region "CompoRef" diff --git a/DoorParameters/Part.vb b/DoorParameters/Part.vb index f87d936..3cd06c7 100644 --- a/DoorParameters/Part.vb +++ b/DoorParameters/Part.vb @@ -1509,7 +1509,7 @@ Public Class Part #Region "Selection compo" - Private Sub ResetAllMark() + Public Sub ResetAllMark() Dim nIdFirstPart As Integer = EgtGetFirstPart() Dim nIdLay As Integer = EgtGetFirstLayer(nIdFirstPart) While nIdLay <> GDB_ID.NULL @@ -1517,6 +1517,9 @@ Public Class Part nIdLay = EgtGetNextLayer(nIdLay) End While EgtDraw() + For Each ItemCompo As Compo In CompoList + ItemCompo.ResetMark() + Next End Sub Private Sub MarkCompoInScena() @@ -1543,6 +1546,7 @@ Public Class Part Dim sNamePath As String = Path.GetFileNameWithoutExtension(sInfoPath) If sNamePath = sCompoName And IndexLay = IndexInList Then EgtSetMark(nIdLay) + m_SelCompo.SetMark() Exit While ElseIf sNamePath = sCompoName And IndexLay < IndexInList Then IndexLay = IndexLay + 1 diff --git a/MainWindow/MainWindowModel.vb b/MainWindow/MainWindowModel.vb index 7c67519..13b1df2 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, 2609, 1, IniFile.m_nKeyLevel) And - EgtGetKeyOptions(3279, 2609, 1, IniFile.m_nKeyOptions) + Dim bKey As Boolean = EgtGetKeyLevel(3279, 2611, 1, IniFile.m_nKeyLevel) And + EgtGetKeyOptions(3279, 2611, 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 f217e91..1f04947 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -72,5 +72,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/ProjectManager/ProjectManagerVM.vb b/ProjectManager/ProjectManagerVM.vb index 9b409d0..8362096 100644 --- a/ProjectManager/ProjectManagerVM.vb +++ b/ProjectManager/ProjectManagerVM.vb @@ -687,8 +687,8 @@ Public Class ProjectManagerVM fd.InitialDirectory = IniFile.m_MyProjectDir End If ' seleziono il filtro di apertura - fd.Filter = "(*.ddt) |*.ddt|(*.ddf) |*.ddf" - fd.FilterIndex = 2 + fd.Filter = "(*.ddf) |*.ddf|(*.ddt) |*.ddt" + fd.FilterIndex = GetCurrentFilter() fd.RestoreDirectory = True ' apro la finestra di dialogo If fd.ShowDialog() <> System.Windows.Forms.DialogResult.OK Then @@ -703,6 +703,8 @@ Public Class ProjectManagerVM sFilePath = Path.GetDirectoryName(fd.FileName) ' salvo il nome completo del file sFilePathComplete = fd.FileName + ' salvo l'estensione dell'ultimo progetto aperto + WriteMainPrivateProfileString("General", "LastExtensionOpened", Path.GetExtension(fd.FileName)) ' se esiste un file in lettura con questo nome allora blocco tutto If Utility.IsFileLocked(sFilePath, Path.GetFileNameWithoutExtension(sFilePathComplete)) Then If Not IsNothing(Map.refAssemblyManagerVM.CurrProject) AndAlso Not IsNothing(Map.refAssemblyManagerVM.CurrProject.SelAssemblyName) Then @@ -846,6 +848,21 @@ Public Class ProjectManagerVM End If End Sub + Private Function GetCurrentFilter() As Integer + Dim nFilter As Integer = 1 + Dim sExt As String = String.Empty + GetMainPrivateProfileString("General", "LastExtensionOpened", "ddf", sExt) + sExt = sExt.Replace("."c, "") + sExt = sExt.Trim + Select Case sExt + Case = "ddf" + nFilter = 1 + Case = "ddt" + nFilter = 2 + End Select + Return nFilter + End Function + #End Region ' OpenCommand #Region "OpenMruFileCommand" diff --git a/SceneManager/SceneManagerVM.vb b/SceneManager/SceneManagerVM.vb index 17607df..75b4688 100644 --- a/SceneManager/SceneManagerVM.vb +++ b/SceneManager/SceneManagerVM.vb @@ -435,6 +435,77 @@ Public Class SceneManagerVM #End Region ' Command +#Region "EVENT Scene" + + Private Sub MouseMoveOverScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_ProjectScene.OnMouseMoveScene + ' Se non abilitata l'evidenziazione dei compo allora esco + If GetMainPrivateProfileInt(S_GENERAL, "MarkCompo", 0) = 0 Then Return + ' se non esiste una porta corrente allora esco + If IsNothing(Map.refPartPageVM) OrElse IsNothing(Map.refPartPageVM.CurrPart) Then + Return + End If + Dim LocalCompoList As ObservableCollection(Of Compo) = Map.refPartPageVM.CurrPart.CompoList + Map.refPartPageVM.CurrPart.ResetAllMark() + ' Se la lista dei componenti รจ vuota allora esco + If Map.refPartPageVM.CurrPart.CompoList.Count < 1 Then Return + ' Ricavo il punto corrente in coordinate mondo + Dim ptCurr As Point3d + EgtUnProjectPoint(e.Location, ptCurr) + ' Verifico se selezionato curva + EgtSetObjFilterForSelWin(False, True, False, False, False) + Dim nSel As Integer + EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel) + Dim nId As Integer = EgtGetFirstObjInSelWin() + While nId <> GDB_ID.NULL + If EgtGetType(nId) = GDB_TY.CRV_COMPO Or EgtGetType(nId) = GDB_TY.CRV_ARC Or EgtGetType(nId) = GDB_TY.CRV_LINE Then + Dim nIdParent As Integer = EgtGetParent(nId) + Dim sNameLayer As String = String.Empty + EgtGetName(nIdParent, sNameLayer) + If Not sNameLayer.StartsWith("AUX") Or Not sNameLayer.StartsWith("SOLID") Or Not sNameLayer.StartsWith("DIM") Then + ' scorro l'elenco dei componenti fino a trovare un riscontro tra i nomi e i parametri + For Each ItemCompo As Compo In LocalCompoList + MatchCompoFromScena(nIdParent, ItemCompo, LocalCompoList) + Next + End If + End If + ' Passo al successivo + nId = EgtGetNextObjInSelWin() + End While + End Sub + + Private Sub MatchCompoFromScena(nIdLay As Integer, CurrCompo As Compo, CompoList As ObservableCollection(Of Compo)) + If IsNothing(CurrCompo) Then Return + 'ResetAllMark() + ' recupero la lista dei compo dello stesso tipo + Dim TempList As ObservableCollection(Of Compo) = DdfFile.GetCurrentListSameCompoType(CompoList, CurrCompo.CompoType.DDFName) + ' recupero la lista dei compo con lo stesso nome + TempList = DdfFile.GetCurrentListSameCompoDDFName(TempList, CurrCompo.SelFile, CurrCompo.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, CurrCompo) + ' recupero la lista ordinata + Dim sCompoName As String = CurrCompo.SelFile + ' recupero il primo part disponibile + Dim IndexLay As Integer = 0 + If nIdLay <> GDB_ID.NULL Then + 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) + ' evidenzio la compo corrente + CurrCompo.SetMark() + ElseIf sNamePath = sCompoName And IndexLay < IndexInList Then + IndexLay = IndexLay + 1 + End If + End If + End If + EgtDraw() + End Sub + +#End Region ' Event scene + Public Sub ComposeAssembly(nAssembl As Integer) If Not File.Exists(IniFile.m_sDoorsDirPath & "\" & "Main_Assemb.lua") Then EgtOutLog("SetUp error: SetUp configuration file (" & IniFile.m_sDoorsDirPath & "\" & "Main_Assemb.lua)" & " doesn't exist ") From 301ec52bf3225311f9098b0083c7f24e3f3330e7 Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Tue, 19 Nov 2024 11:53:00 +0100 Subject: [PATCH 2/2] Cambio colore bordo in evidenza --- DoorParameters/Compo.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DoorParameters/Compo.vb b/DoorParameters/Compo.vb index d8ef4ba..dd47a7e 100644 --- a/DoorParameters/Compo.vb +++ b/DoorParameters/Compo.vb @@ -125,7 +125,7 @@ Public Class Compo End Sub Public Sub SetMark() - m_BorderColor = Brushes.LightGoldenrodYellow + m_BorderColor = Brushes.DeepPink m_BackGroundColor = Brushes.White m_Foreground = Brushes.Gold m_BorderThickness = 2