Files
egtstone3d/OptionsWindow/OptionModule.vb
T
2025-02-04 16:47:20 +01:00

143 lines
5.6 KiB
VB.net

Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
Friend Module OptionModule
#Region "FIELDS & PROPERTIES"
' Parametri che contengono lista delle lingue disponibili e lingua selezionata
Friend m_LanguageList As New ObservableCollection(Of Language)
Friend m_SelectedLanguage As Language
' Colori di sfondo della vista e della griglia
Friend m_TopSceneBackground As Color3d
Friend m_BotSceneBackground As Color3d
Friend m_GridColor As Color3d
' Flag per visualizzazione spessa delle linee
Friend m_bThickLine As Boolean
' Flag per visualizzazione smussata delle superfici
Friend m_bSmoothTriMesh As Boolean
' Colore di default in disegno
Friend m_DefMaterialColor As Color3d
' Colore di evidenziazione
Friend m_MarkColor As Color3d
' Colore superfici
Friend m_SelSurfColor As Color3d
' Colore rettangolo di zoom
Friend m_RectangleZoomColor As Color3d
' Colore linea di distanz
Friend m_LineDistanceColor As Color3d
' selezione tema (default=0)
Friend m_SelectedThema As Integer = 0
' selezione tema toppanel (default=0)
Friend m_SelectedThemaTopPanel As Integer = 0
Friend m_bShowGridFrame As Boolean
Friend m_bGridState As Integer
Friend m_bMmUnits As Boolean
Friend m_MinLnColor As Color3d
Friend m_MajLnColor As Color3d
Friend m_dSnapStepMm As Double
Friend m_dSnapStepInch As Double
Friend m_nMinLineSStep As Integer
Friend m_nMajLineSStep As Integer
Friend m_nExtSStep As Integer
#End Region ' Fields & Properties
#Region "METHODS"
' inizializzazione lettura variabili ad inizio programma
Friend Sub InitOptionModule()
' Leggo elenco lingue disponibili da file ini
Dim nIndex As Integer = 1
Dim ReadLanguage As Language = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex, IniFile.m_sIniFile)
While Not IsNothing(ReadLanguage)
OptionModule.m_LanguageList.Add(ReadLanguage)
nIndex += 1
ReadLanguage = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex, IniFile.m_sIniFile)
End While
If nIndex = 1 Then
EgtOutLog("Error missing languages section in Config.ini")
EgtStone3D.EgtMessageBoxV.Show(Application.Current.MainWindow, "Error : missing languages informations", "EgtCAM5", MessageBoxButton.OK, MessageBoxImage.Error)
End
End If
' Inizializzo la lingua corrente
OptionModule.m_SelectedLanguage = OptionModule.m_LanguageList(0)
Dim sMsgName As String = String.Empty
GetMainPrivateProfileString(S_GENERAL, K_MESSAGES, "", sMsgName)
For Each Language In OptionModule.m_LanguageList
If Language.Name = sMsgName Then
OptionModule.m_SelectedLanguage = Language
Exit For
End If
Next
' Inizializzo variabili colori di sfondo scena, griglia
Dim BackTopColor As New Color3d(0, 123, 167)
GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
m_TopSceneBackground = BackTopColor
Dim BackBotColor As New Color3d(BackTopColor)
GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
m_BotSceneBackground = BackBotColor
Dim GridColor As New Color3d(0, 0, 0)
GetMainPrivateProfileColor(S_GRID, K_MINLNCOLOR, GridColor)
m_GridColor = GridColor
' Inizializzo flag linee ingrossate
m_bThickLine = GetMainPrivateProfileInt(S_SCENE, K_LINEWIDTH, 1) <> 1
' Inizializzo flag visualizzazione smussata delle superfici
m_bSmoothTriMesh = GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0
' imposto colore di default
Dim DefColor As New Color3d(100, 10, 20)
GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor)
m_DefMaterialColor = DefColor
' imposto colore di evidenziazione
Dim MarkColor As New Color3d(255, 255, 0)
GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor)
m_MarkColor = MarkColor
' imposto colore per superfici selezionate
Dim SelSurfColor As New Color3d(255, 255, 192)
GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor)
m_SelSurfColor = SelSurfColor
' imposto tipo e colore del rettangolo di zoom
Dim ZwColor As New Color3d(0, 0, 0)
GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, True, ZwColor)
m_RectangleZoomColor = ZwColor
' imposto colore della linea di distanza
Dim DstLnColor As New Color3d(255, 0, 0)
GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor)
m_LineDistanceColor = DstLnColor
' imposto il tema
m_SelectedThema = GetMainPrivateProfileInt(S_GENERAL, K_THEMA, 0)
' imposto il tema toppanel
m_SelectedThemaTopPanel = GetMainPrivateProfileInt(S_GENERAL, K_TOPPANEL, 0)
m_bShowGridFrame = (GetMainPrivateProfileInt(S_GRID, K_SHOWFRAME, 1) <> 0)
m_bGridState = GetMainPrivateProfileInt(S_GENERAL, K_GRIDSTATE, 1)
' imposto unità di misura per interfaccia utente
m_bMmUnits = (GetMainPrivateProfileInt(S_SCENE, K_MMUNITS, 1) <> 0)
m_MinLnColor = New Color3d(160, 160, 160)
GetMainPrivateProfileColor(S_GRID, K_MINLNCOLOR, m_MinLnColor)
m_MajLnColor = New Color3d(160, 160, 160)
GetMainPrivateProfileColor(S_GRID, K_MINLNCOLOR, m_MajLnColor)
m_dSnapStepMm = GetMainPrivateProfileDouble(S_GRID, K_SNAPSTEP, 10)
m_dSnapStepInch = GetMainPrivateProfileDouble(S_GRID, K_SNAPSTEPINCH, 10)
m_nMinLineSStep = GetMainPrivateProfileInt(S_GRID, K_MINLINESSTEP, 1)
m_nMajLineSStep = GetMainPrivateProfileInt(S_GRID, K_MAJLINESSTEP, 10)
m_nExtSStep = GetMainPrivateProfileInt(S_GRID, K_EXTSSTEP, 50)
End Sub
#End Region ' Methods
End Module