Salvataggio ultima estensione aperta, evidenzio da scena

This commit is contained in:
Nicola Pievani
2024-11-19 11:52:15 +01:00
parent 03f8312a3d
commit ee5a14a8f8
6 changed files with 125 additions and 7 deletions
+26
View File
@@ -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"
+5 -1
View File
@@ -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
+2 -2
View File
@@ -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())
+2 -2
View File
@@ -72,5 +72,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.6.10.1")>
<Assembly: AssemblyFileVersion("2.6.10.1")>
<Assembly: AssemblyVersion("2.6.11.1")>
<Assembly: AssemblyFileVersion("2.6.11.1")>
+19 -2
View File
@@ -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"
+71
View File
@@ -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 ")