238 lines
6.4 KiB
VB.net
238 lines
6.4 KiB
VB.net
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class SceneButtonVM
|
|
|
|
Private m_TopListBtn As New List(Of ScenaBtn)
|
|
Public Property TopListBtn As List(Of ScenaBtn)
|
|
Get
|
|
Return m_TopListBtn
|
|
End Get
|
|
Set(value As List(Of ScenaBtn))
|
|
m_TopListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_LeftListBtn As New List(Of ScenaBtn)
|
|
Public Property LeftListBtn As List(Of ScenaBtn)
|
|
Get
|
|
Return m_LeftListBtn
|
|
End Get
|
|
Set(value As List(Of ScenaBtn))
|
|
m_LeftListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_RightListBtn As New List(Of ScenaBtn)
|
|
Public Property RightListBtn As List(Of ScenaBtn)
|
|
Get
|
|
Return m_RightListBtn
|
|
End Get
|
|
Set(value As List(Of ScenaBtn))
|
|
m_RightListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_BottomListBtn As New List(Of ScenaBtn)
|
|
Public Property BottomListBtn As List(Of ScenaBtn)
|
|
Get
|
|
Return m_BottomListBtn
|
|
End Get
|
|
Set(value As List(Of ScenaBtn))
|
|
m_BottomListBtn = value
|
|
End Set
|
|
End Property
|
|
|
|
Sub New()
|
|
SetButtonsLocation("TopListBtn", m_TopListBtn)
|
|
SetButtonsLocation("LeftListBtn", m_LeftListBtn)
|
|
SetButtonsLocation("RightListBtn", m_RightListBtn)
|
|
SetButtonsLocation("BottomListBtn", m_BottomListBtn)
|
|
End Sub
|
|
|
|
Private Sub SetButtonsLocation(PositionList As String, ListBtn As List(Of ScenaBtn))
|
|
Dim Index As Integer = 1
|
|
Dim sBtnString As String = String.Empty
|
|
While GetMainPrivateProfileString(PositionList, "Btn_" & Index.ToString, "", sBtnString) > 0
|
|
Dim sItems As String() = Split(sBtnString, ",")
|
|
If sItems.Count < 3 Then
|
|
' Errore di configurazione comando: mancano dei parametri
|
|
EgtOutLog("")
|
|
Else
|
|
Dim nType As Integer = 0
|
|
If sItems(0) = "Button" Then
|
|
' Button
|
|
ListBtn.Add(New _Button(sItems(1), sItems(2), sItems(3)))
|
|
ElseIf sItems(0) = "ToggleButton" Then
|
|
' ToggelButton
|
|
ListBtn.Add(New _ToggleButton(sItems(1), sItems(2), sItems(3)))
|
|
End If
|
|
End If
|
|
Index = Index + 1
|
|
sBtnString = String.Empty
|
|
End While
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class ScenaBtn
|
|
|
|
Private m_ResourcesDir As String = "C:\EgtData\EgtSTONE3D\Resources\"
|
|
|
|
Private m_Name As String = String.Empty
|
|
Public Property Name As String
|
|
Get
|
|
Return m_Name
|
|
End Get
|
|
Set(value As String)
|
|
m_Name = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Img As String = String.Empty
|
|
Public Property Img As String
|
|
Get
|
|
Return m_Img
|
|
End Get
|
|
Set(value As String)
|
|
m_Img = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Flag As String = String.Empty
|
|
Public Property Flag As String
|
|
Get
|
|
Return m_Flag
|
|
End Get
|
|
Set(value As String)
|
|
m_Flag = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsEnabled As Boolean = True
|
|
Public Property IsEnabled As Boolean
|
|
Get
|
|
Return m_IsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_IsEnabled = value
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(_Name As String, _Img As String, _Flag As String)
|
|
m_Name = _Name
|
|
m_Img = m_ResourcesDir & _Img
|
|
m_Flag = _Flag
|
|
End Sub
|
|
|
|
Private m_CmdBtn As ICommand
|
|
Public ReadOnly Property CmdBtn As ICommand
|
|
Get
|
|
If m_CmdBtn Is Nothing Then
|
|
m_CmdBtn = New Command(AddressOf MethodBtn)
|
|
End If
|
|
Return m_CmdBtn
|
|
End Get
|
|
End Property
|
|
|
|
Private Sub MethodBtn()
|
|
SceneCmd.Exec(m_Flag)
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class _Button
|
|
Inherits ScenaBtn
|
|
|
|
Sub New(_Name As String, _Img As String, _Flag As String)
|
|
MyBase.New(_Name, _Img, _Flag)
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class _ToggleButton
|
|
Inherits ScenaBtn
|
|
|
|
Private m_IsChecked As Boolean
|
|
Public Property IsChecked As Boolean
|
|
Get
|
|
Return m_IsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_IsChecked = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Sub New(_Name As String, _Img As String, _Flag As String)
|
|
MyBase.New(_Name, _Img, _Flag)
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Module SceneCmd
|
|
Public Sub Exec(Flag)
|
|
Dim _SceneHostVM As SceneHostVM = DirectCast(Map.refSceneHostV.DataContext, SceneHostVM)
|
|
Dim nVeinCtx As Integer = _SceneHostVM.MainScene.GetCtx()
|
|
Select Case Flag
|
|
Case "AutoPair"
|
|
EgtSetCurrentContext(nVeinCtx)
|
|
|
|
EgtLuaSetGlobIntVar("ASS.nVeinCtx", nVeinCtx)
|
|
EgtLuaCallFunction("ASS.PairAll")
|
|
Case "Unpair"
|
|
SolidManagerM.Unpair(Map.refSceneHostV.m_nIdPart)
|
|
Case "Pair"
|
|
Map.refSceneButtonV.LoadPairUC()
|
|
Case Else
|
|
Dim x As Boolean = False
|
|
End Select
|
|
End Sub
|
|
|
|
Public Sub EnableActionButtons()
|
|
|
|
|
|
'If (m_nIdPart = GDB_ID.NULL) Then Return
|
|
|
|
''abilito i bottoni che possono eseguire delle azioni
|
|
'MoveExpander.IsEnabled = True
|
|
'MoveExpander.IsExpanded = True
|
|
'TgBtn_Rotation.IsEnabled = True
|
|
'Dim PartSolidSel As PartSolid = GetPartSolid(m_nIdPart)
|
|
'If Not IsNothing(PartSolidSel) And PartSolidSel.IsPaired() Then
|
|
' UnpairBtn.IsEnabled = True
|
|
' ExplodeBtn.IsEnabled = True
|
|
' ExplodeNormalsBtn.IsEnabled = True
|
|
'End If
|
|
End Sub
|
|
|
|
Public Sub DisableActionButtons()
|
|
''disabilito tutti i bottoni che eseguono azioni sul pezzo selezionato
|
|
''TgBtn_Rotation.IsEnabled = False
|
|
'ResetRotationBtn.IsEnabled = False
|
|
'UnpairBtn.IsEnabled = False
|
|
'ExplodeBtn.IsEnabled = False
|
|
'ExplodeNormalsBtn.IsEnabled = False
|
|
'MoveExpander.IsEnabled = False
|
|
'MoveExpander.IsExpanded = False
|
|
End Sub
|
|
|
|
Public Function DeselectAll() As Boolean
|
|
Dim bDeselected As Boolean = True
|
|
Dim nOriId As Integer = GDB_ID.NULL
|
|
For Each PartSolidSel In m_PartSolidList
|
|
'EgtGetInfo(PartSolidSel.PartId, KEY_ORI_ID, nOriId)
|
|
'If EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) AndAlso EgtExistsObj(nOriId) Then
|
|
' If Not (OmagOFFICEMap.refNestingTabVM.DeselectPart(nOriId, False)) Then
|
|
' bDeselected = False
|
|
' End If
|
|
'End If
|
|
EgtSetCurrentContext(m_nVeinCtx)
|
|
PartSolidSel.DeselectPart()
|
|
Next
|
|
Map.refSceneHostV.m_nIdPart = -1
|
|
DisableActionButtons()
|
|
Return bDeselected
|
|
End Function
|
|
|
|
End Module |