18 Commits

Author SHA1 Message Date
Demetrio Cassarino dff00ca1e7 -aggiunto colorazione testo richtext 2025-02-24 09:54:22 +01:00
Demetrio Cassarino f70eba5633 riattivato splashscreen 2025-02-20 17:10:35 +01:00
Demetrio Cassarino 433cec7c52 Merge commit 'b7e6d1dd7d70e38a79385ca85eb7975e14b7de2d' into ScriptEditor 2025-02-20 08:18:03 +01:00
Demetrio Cassarino 862ee938c3 -aggiunto svg per script
-sistemato dizionario
-sistemato rimozione del testo su invio
2025-02-19 16:52:54 +01:00
Daniele Bariletti b7e6d1dd7d - modifica dell'UC per la modifica di un piano cucina. 2025-02-19 16:10:31 +01:00
Daniele Bariletti b5026d0a62 - aggiunta dell'UC per la modifica di un piano cucina. 2025-02-19 16:04:46 +01:00
Daniele Bariletti 2cf32788c4 - aggiunti controlli. 2025-02-19 15:52:44 +01:00
Daniele Bariletti f62672b1c6 Merge remote-tracking branch 'origin/ScriptEditor' into develop 2025-02-19 09:17:08 +01:00
Demetrio Cassarino 93e1651af4 -modifa a script rimesso richtext 2025-02-19 09:14:59 +01:00
Daniele Bariletti 804f72527b - draw dopo la cancellazione di un pezzo. 2025-02-19 09:12:58 +01:00
Demetrio Cassarino 7c5a2b6106 -aggiunto funzione che recupera il testo dal richtextbox 2025-02-18 08:49:12 +01:00
Daniele Bariletti e537861ca5 - corretta la gestione della lista PartSolid alla creazione e modifica dei pezzi.
- aggiunta la scelta del tipo di giunzione alla creazione delle paretine
- ricreazione dei vicini alla cancellazione di una paretina.
2025-02-17 17:35:56 +01:00
Daniele Bariletti 92e76f0c32 - aggiunti enum per la modifica delle paretine
- aggiunta informazione addizionale per paretine e fondo di una buca(se create tutte insieme)
- migliorata la gestione dell'UC per la modifica dei Part.
2025-02-14 16:59:32 +01:00
Demetrio Cassarino d04d9fedc7 -aggiunto script editor per file lua
-al momento funziona con textbox
2025-02-14 16:55:52 +01:00
Daniele Bariletti 17fb0e9f51 Merge branch 'develop' of https://gitlab.steamware.net/egalware-cadcam/interfacce/egtstone3d into develop 2025-02-13 10:08:02 +01:00
Daniele Bariletti 68e2cc5c08 - aggiunto enum per il tipo di part
- migliorato l'UC per l'edit delle paretine
- migliorata la gestinoe degli UC
- aggiunta gestione dei click per l'edit paretina
- aggiunta la proprietà indice del selezionato per la comboBoxParam
- upgrade per lo spessore delle linee negli SVG.
2025-02-13 10:07:57 +01:00
Demetrio Cassarino ce39300091 -pulizia codice 2025-02-13 09:20:51 +01:00
Demetrio Cassarino 9c646a6ff7 -Aggiunto svg per grid 2025-02-12 15:18:51 +01:00
35 changed files with 1934 additions and 307 deletions
+7 -7
View File
@@ -12,13 +12,13 @@
Protected Overrides Sub OnStartup(e As StartupEventArgs) Protected Overrides Sub OnStartup(e As StartupEventArgs)
MyBase.OnStartup(e) MyBase.OnStartup(e)
ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose
'If e.Args.Count = 0 Then If e.Args.Count = 0 Then
' ' creo finestra SplashScreen ' creo finestra SplashScreen
' Dim SplashScreen As New SplashScreenV Dim SplashScreen As New SplashScreenV
' Me.MainWindow = SplashScreen Me.MainWindow = SplashScreen
' Me.MainWindow.Show() Me.MainWindow.Show()
' Map.SetRefSplashScreen(SplashScreen) Map.SetRefSplashScreen(SplashScreen)
'End If End If
' Creo la View principale ' Creo la View principale
Me.MainWindow = New MainWindowV Me.MainWindow = New MainWindowV
' Mostro la View principale ' Mostro la View principale
+36 -22
View File
@@ -7,19 +7,32 @@ Public Class ParametricCompoVM
#Region "FIELDS & PROPERTIES" #Region "FIELDS & PROPERTIES"
Private ReadOnly sLuaPath As String = String.Empty Private m_sLuaPath As String = String.Empty
Friend ReadOnly bFileExsist As Boolean = False
Private m_nVeinCtx As Integer
#End Region ' Fields & Properties #End Region ' Fields & Properties
#Region "CONSTRUCTOR" #Region "CONSTRUCTOR"
Sub New(sFile As String) Sub New(sFile As String, nVeinCtx As Integer, Optional dir As String = "")
MyBase.New() MyBase.New()
m_nVeinCtx = nVeinCtx
Title = EGT_PARAMETRIC.ToUpper() Title = EGT_PARAMETRIC.ToUpper()
' Recupero path cartella che contiene i componenti ' Recupero path cartella che contiene i componenti
GetMainPrivateProfileString(K_COMPO, COMPO_DIR, "", sLuaPath) If Not File.Exists(dir & sFile) Then
sLuaPath &= sFile GetMainPrivateProfileString(K_COMPO, COMPO_DIR, "", m_sLuaPath)
LoadParamList() ' Controllo se il file esiste
m_sLuaPath &= sFile
Else
m_sLuaPath = dir & sFile
End If
If File.Exists(m_sLuaPath) Then
LoadParamList()
bFileExsist = True
Else
EgtOutLog("File " & m_sLuaPath & " non esiste nella cartella dei componenti")
End If
' aggiorno visualizzazione ' aggiorno visualizzazione
EgtSetView(VT.TOP, False) EgtSetView(VT.TOP, False)
EgtZoom(ZM.ALL) EgtZoom(ZM.ALL)
@@ -32,31 +45,32 @@ Public Class ParametricCompoVM
Public Overrides Sub LoadParamList() Public Overrides Sub LoadParamList()
' Pulisco lista variabili ' Pulisco lista variabili
ParamList.Clear() ParamList.Clear()
EgtLuaExecFile(sLuaPath) EgtLuaExecFile(m_sLuaPath)
Dim sPar As String = "0" Dim sPar As String = "0"
EgtLuaGetGlobStringVar("CMP.Npar", sPar) EgtLuaGetGlobStringVar("CMP.Npar", sPar)
Dim sName As String = String.Empty If Not String.IsNullOrEmpty(sPar) Then
EgtLuaGetGlobStringVar("CMP.Nome", sName) Dim sName As String = String.Empty
Dim nPar As Integer = CInt(sPar) EgtLuaGetGlobStringVar("CMP.Nome", sName)
ParamList.Add(New _TextBlockParam("Messaggio", sName, Visibility.Visible)) Dim nPar As Integer = CInt(sPar)
' Recupero nome, tipo e valore delle variabili globali ParamList.Add(New _TextBlockParam("Messaggio", sName, Visibility.Visible))
For Index As Integer = 1 To nPar ' Recupero nome, tipo e valore delle variabili globali
Dim NewCompo As GenericParam = Nothing For Index As Integer = 1 To nPar
If NameTypeValueFromLua(Index, NewCompo) Then Dim NewCompo As GenericParam = Nothing
ParamList.Add(NewCompo) If NameTypeValueFromLua(Index, NewCompo) Then
End If ParamList.Add(NewCompo)
Next End If
Next
End If
End Sub End Sub
Private Sub ExecLua() Private Sub ExecLua()
Dim nVeinCtx As Integer = Map.refSceneHostVM.MainScene.GetCtx() If Not File.Exists(m_sLuaPath) Then
If Not File.Exists(sLuaPath) Then EgtOutLog("Matching error: missing file (" & m_sLuaPath & ")")
EgtOutLog("Matching error: missing file (" & sLuaPath & ")")
Return Return
End If End If
' Parsing ' Parsing
EgtLuaExecFile(sLuaPath) EgtLuaExecFile(m_sLuaPath)
EgtSetCurrentContext(nVeinCtx) EgtSetCurrentContext(m_nVeinCtx)
For Index As Integer = 0 To ParamList.Count - 1 For Index As Integer = 0 To ParamList.Count - 1
If TypeOf ParamList(Index) Is _TextBoxParam Then If TypeOf ParamList(Index) Is _TextBoxParam Then
Dim _TextBox As _TextBoxParam = DirectCast(ParamList(Index), _TextBoxParam) Dim _TextBox As _TextBoxParam = DirectCast(ParamList(Index), _TextBoxParam)
+21
View File
@@ -16,6 +16,7 @@
Public Const EGT_FRO As String = "AddWaterfall" Public Const EGT_FRO As String = "AddWaterfall"
Public Const EGT_PANEL As String = "AddPanel" Public Const EGT_PANEL As String = "AddPanel"
Public Const EGT_EDIT_PANEL As String = "EditPanel" Public Const EGT_EDIT_PANEL As String = "EditPanel"
Public Const EGT_EDIT_TOPK As String = "EditTopKitchen"
Public Const EGT_EXPORTPROJECT As String = "ExportProject" Public Const EGT_EXPORTPROJECT As String = "ExportProject"
Public Const EGT_DELETE As String = "Delete" Public Const EGT_DELETE As String = "Delete"
Public Const EGT_RECTANGE As String = "Rettangolo" Public Const EGT_RECTANGE As String = "Rettangolo"
@@ -117,6 +118,26 @@
ShowPreview = 2 ShowPreview = 2
End Enum End Enum
Public Enum PartType As Integer
Unknown = -1
TopKitchen = 0
Panel = 1
Sink = 2
End Enum
Public Enum JunctionType As Integer
TrimStart = 0
TrimEnd = 1
Angled = 3
End Enum
'enum per le fasi di modifica di un piano cucina
Public Enum EditTopKStage As Integer
SelectPart = 0
SelectPoint = 1
SelectEdge = 2
End Enum
' Constanti ParametricCompo ' Constanti ParametricCompo
Public Enum ParamType As Integer Public Enum ParamType As Integer
BOOL = 1 BOOL = 1
+2 -2
View File
@@ -249,7 +249,7 @@ Public Class EgtManageFileDialogVM
Set(value As Integer) Set(value As Integer)
m_nFilterIndex = value m_nFilterIndex = value
m_SelFilter = m_FilterList.FirstOrDefault(Function(x) x.nIndexExstension = m_nFilterIndex) m_SelFilter = m_FilterList.FirstOrDefault(Function(x) x.nIndexExstension = m_nFilterIndex)
sFileName = "New" & m_SelFilter.sExstension.Trim("*"c) sFileName = Path.GetFileNameWithoutExtension(sFileName) & m_SelFilter.sExstension.Trim("*"c)
End Set End Set
End Property End Property
@@ -370,7 +370,7 @@ Public Class EgtManageFileDialogVM
#End Region #End Region
'Comandi ' Comandi
Private m_cmdCancel As ICommand Private m_cmdCancel As ICommand
Private m_cmdOk As ICommand Private m_cmdOk As ICommand
Private m_cmdGoBack As ICommand Private m_cmdGoBack As ICommand
+26 -3
View File
@@ -118,9 +118,15 @@
<Compile Include="EgtMessageBox\EgtMessageBoxV.xaml.vb"> <Compile Include="EgtMessageBox\EgtMessageBoxV.xaml.vb">
<DependentUpon>EgtMessageBoxV.xaml</DependentUpon> <DependentUpon>EgtMessageBoxV.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="GridPanel\GridDimensionPanelV.xaml.vb">
<DependentUpon>GridDimensionPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="GridPanel\GridPanelVM.vb" /> <Compile Include="GridPanel\GridPanelVM.vb" />
<Compile Include="GridPanel\GridPaneV.xaml.vb"> <Compile Include="GridPanel\GridPanelV.xaml.vb">
<DependentUpon>GridPaneV.xaml</DependentUpon> <DependentUpon>GridPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="GridPanel\GridViewPanelV.xaml.vb">
<DependentUpon>GridViewPanelV.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="MainWindow\MainWindowV.xaml.vb"> <Compile Include="MainWindow\MainWindowV.xaml.vb">
<DependentUpon>MainWindowV.xaml</DependentUpon> <DependentUpon>MainWindowV.xaml</DependentUpon>
@@ -133,6 +139,7 @@
<Compile Include="OptionsWindow\OptionWindowVM.vb" /> <Compile Include="OptionsWindow\OptionWindowVM.vb" />
<Compile Include="Pair\PairVM.vb" /> <Compile Include="Pair\PairVM.vb" />
<Compile Include="Panel\EditPanelVM.vb" /> <Compile Include="Panel\EditPanelVM.vb" />
<Compile Include="Panel\EditTopKitchenVM.vb" />
<Compile Include="Panel\NewPanelVM.vb" /> <Compile Include="Panel\NewPanelVM.vb" />
<Compile Include="Panel\PanelManagerM.vb" /> <Compile Include="Panel\PanelManagerM.vb" />
<Compile Include="ProjManager\ProjManagerButtonV.xaml.vb"> <Compile Include="ProjManager\ProjManagerButtonV.xaml.vb">
@@ -155,6 +162,10 @@
<DependentUpon>SceneUserControlV.xaml</DependentUpon> <DependentUpon>SceneUserControlV.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="SceneUserControl\SceneUserControlVM.vb" /> <Compile Include="SceneUserControl\SceneUserControlVM.vb" />
<Compile Include="ScriptWindow\ScriptWindowV.xaml.vb">
<DependentUpon>ScriptWindowV.xaml</DependentUpon>
</Compile>
<Compile Include="ScriptWindow\ScriptWindowVM.vb" />
<Compile Include="SecondaryWindow\SecondaryWindowV.xaml.vb"> <Compile Include="SecondaryWindow\SecondaryWindowV.xaml.vb">
<DependentUpon>SecondaryWindowV.xaml</DependentUpon> <DependentUpon>SecondaryWindowV.xaml</DependentUpon>
</Compile> </Compile>
@@ -240,7 +251,15 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="GridPanel\GridPaneV.xaml"> <Page Include="GridPanel\GridDimensionPanelV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="GridPanel\GridPanelV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="GridPanel\GridViewPanelV.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
@@ -272,6 +291,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="ScriptWindow\ScriptWindowV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SecondaryWindow\SecondaryWindowV.xaml"> <Page Include="SecondaryWindow\SecondaryWindowV.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
+35
View File
@@ -0,0 +1,35 @@
<Grid x:Class="GridDimensionPanelV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtStone3D="clr-namespace:EgtStone3D"
Margin="0,10,0,5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Button Content="{Binding MeasureUnit}"
ToolTip="{Binding MeasureUnit_Msg}"
Command="{Binding StatusUnitsCommand}"
Style="{StaticResource GridPanel_Btn}"/>
<Button Grid.Row="1"
Name="GridDimensionBtn"
Command="{Binding ShowPopUpCommand}"
Style="{StaticResource Grid_Btn}">
<EgtStone3D:SVGV FileSource="{Binding FileGridDimSVG, UpdateSourceTrigger=PropertyChanged}"/>
</Button>
<Popup IsOpen="{Binding IsOpenGridDimension}"
AllowsTransparency="True"
PopupAnimation="Scroll"
StaysOpen="False"
PlacementTarget="{Binding ElementName=GridDimensionBtn}">
<TextBox Text="{Binding GridDimensionText, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource GridPanel_TextBox}">
<TextBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding GridDimensionCommand}"/>
</TextBox.InputBindings>
</TextBox>
</Popup>
</Grid>
+3
View File
@@ -0,0 +1,3 @@
Public Class GridDimensionPanelV
End Class
-37
View File
@@ -1,37 +0,0 @@
<WrapPanel x:Class="GridPaneV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Style="{StaticResource GridPanel_WrapPanel}">
<UniformGrid Columns="2">
<Button ToolTip="{Binding ZoomAllToolTip}"
Command="{Binding ZoomAllCommand}"
Style="{StaticResource Proj_Btn}">
<Image Source="/Resources/GridViewPanel/ZoomAll.png"
Style="{StaticResource Proj_Img}"/>
</Button>
<Button Content="{Binding StatusGridText}"
Command="{Binding StatusGridCommand}"
Style="{StaticResource Grid_Btn}"/>
</UniformGrid>
<UniformGrid Columns="2">
<TextBlock Text="Grid" Style="{StaticResource GridPanel_TxBl}"/>
<TextBox Text="{Binding GridDimensionText, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource GridPanel_TextBox}">
<TextBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding GridDimensionCommand}"/>
</TextBox.InputBindings>
</TextBox>
</UniformGrid>
<UniformGrid Columns="2"
Style="{StaticResource GridPanel_UniformGrid}">
<TextBlock Text="{Binding MeasureUnit_Msg}"
Style="{StaticResource GridPanel_TxBl}"/>
<Button Content="{Binding MeasureUnit}"
Command="{Binding StatusUnitsCommand}"
Style="{StaticResource GridPanel_Btn}"/>
</UniformGrid>
</WrapPanel>
-3
View File
@@ -1,3 +0,0 @@
Public Class GridPaneV
End Class
+13
View File
@@ -0,0 +1,13 @@
<WrapPanel x:Class="GridPaneV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtStone3D="clr-namespace:EgtStone3D"
Style="{StaticResource GridPanel_WrapPanel}">
<EgtStone3D:GridViewPanelV DataContext="{StaticResource GridPanelVM}"/>
<Separator Style="{StaticResource TopPanel_Separator}"/>
<EgtStone3D:GridDimensionPanelV DataContext="{StaticResource GridPanelVM}"/>
</WrapPanel>
+3
View File
@@ -0,0 +1,3 @@
Public Class GridPanelV
End Class
+69
View File
@@ -39,6 +39,50 @@ Public Class GridPanelVM
NotifyPropertyChanged(NameOf(MeasureUnit)) NotifyPropertyChanged(NameOf(MeasureUnit))
End Sub End Sub
Private m_FileGridOnOffSVG As String = String.Empty
Public Property FileGridOnOffSVG As String
Get
Return m_FileGridOnOffSVG
End Get
Set(value As String)
m_FileGridOnOffSVG = value
NotifyPropertyChanged(NameOf(FileGridOnOffSVG))
End Set
End Property
Friend Sub SetFileGridOnOffSVG(sFileGridOnOffSVG As String)
m_FileGridOnOffSVG = sFileGridOnOffSVG
NotifyPropertyChanged(NameOf(FileGridOnOffSVG))
End Sub
Private m_FileGridDimSVG As String = String.Empty
Public Property FileGridDimSVG As String
Get
Return m_FileGridDimSVG
End Get
Set(value As String)
m_FileGridDimSVG = value
NotifyPropertyChanged(NameOf(FileGridDimSVG))
End Set
End Property
Friend Sub SetFileGridDimSVG(sFileGridDimSVG As String)
m_FileGridDimSVG = sFileGridDimSVG
NotifyPropertyChanged(NameOf(FileGridDimSVG))
End Sub
Private m_IsOpenGridDimension As Boolean = False
Public Property IsOpenGridDimension As Boolean
Get
Return m_IsOpenGridDimension
End Get
Set(value As Boolean)
m_IsOpenGridDimension = value
End Set
End Property
Friend Sub SetIsOpenGridDimension(bIsOpenGridDimension As Boolean)
m_IsOpenGridDimension = bIsOpenGridDimension
NotifyPropertyChanged(NameOf(IsOpenGridDimension))
End Sub
#Region "Messages" #Region "Messages"
Public ReadOnly Property MeasureUnit_Msg Public ReadOnly Property MeasureUnit_Msg
@@ -64,6 +108,7 @@ Public Class GridPanelVM
Private m_cmdGridDimension As ICommand Private m_cmdGridDimension As ICommand
Private m_cmdStatusUnits As ICommand Private m_cmdStatusUnits As ICommand
Private m_cmdZoomAll As ICommand Private m_cmdZoomAll As ICommand
Private m_cmdShowPopUpCmd As ICommand
#End Region ' Fields & Properties #End Region ' Fields & Properties
@@ -71,6 +116,8 @@ Public Class GridPanelVM
Sub New() Sub New()
Map.SetRefGridPanelVM(Me) Map.SetRefGridPanelVM(Me)
SetFileGridOnOffSVG(Map.refMainWindowVM.MainWindowM.sResourcesDir & "\GridON.svg")
SetFileGridDimSVG(Map.refMainWindowVM.MainWindowM.sResourcesDir & "\GridDIM.svg")
End Sub End Sub
#End Region ' Constructor #End Region ' Constructor
@@ -190,6 +237,28 @@ Public Class GridPanelVM
#End Region ' ZoomAllCommand #End Region ' ZoomAllCommand
#Region "ShowPopUpCommand"
Public ReadOnly Property ShowPopUpCommand As ICommand
Get
If m_cmdShowPopUpCmd Is Nothing Then
m_cmdShowPopUpCmd = New Command(AddressOf ShowPopUp)
End If
Return m_cmdShowPopUpCmd
End Get
End Property
Public Sub ShowPopUp(ByVal param As Object)
If m_IsOpenGridDimension Then
SetIsOpenGridDimension(False)
'SetView_Msg("▼" & EgtMsg(110019)) ' Vista
Else
SetIsOpenGridDimension(True)
'SetView_Msg("▲" & EgtMsg(110019)) ' Vista
End If
End Sub
#End Region ' ShowPopUpCommand
#End Region ' Commands #End Region ' Commands
+24
View File
@@ -0,0 +1,24 @@
<Grid x:Class="GridViewPanelV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtStone3D="clr-namespace:EgtStone3D"
Margin="0,0,10,5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Button ToolTip="{Binding ZoomAllToolTip}"
Command="{Binding ZoomAllCommand}"
Style="{StaticResource Proj_Btn}">
<Image Source="/Resources/GridViewPanel/ZoomAll.png"
Style="{StaticResource Proj_Img}"/>
</Button>
<Button Grid.Row="1"
ToolTip="{Binding StatusGridText}"
Command="{Binding StatusGridCommand}"
Style="{StaticResource Grid_Btn}">
<EgtStone3D:SVGV FileSource="{Binding FileGridOnOffSVG, UpdateSourceTrigger=PropertyChanged}"/>
</Button>
</Grid>
+3
View File
@@ -0,0 +1,3 @@
Public Class GridViewPanelV
End Class
+284 -151
View File
@@ -2,9 +2,10 @@
Public Class EditPanelVM Public Class EditPanelVM
Inherits SceneUserControlVM Inherits SceneUserControlVM
#Region "FIELDS & PROPERTIES" #Region "FIELDS & PROPERTIES"
Private ReadOnly m_MsgList As New List(Of String)({TopBar_Msg_Stg0, TopBar_Msg_Stg1, TopBar_Msg_Stg2}) Private ReadOnly m_MsgList As New List(Of String)({TopBar_Msg_Stg0, TopBar_Msg_Stg1, TopBar_Msg_Stg2, Msg_Paragraph1, Msg_Paragraph2})
Public ReadOnly Property MsgList As List(Of String) Public ReadOnly Property MsgList As List(Of String)
Get Get
Return m_MsgList Return m_MsgList
@@ -22,6 +23,16 @@ Public Class EditPanelVM
End Set End Set
End Property End Property
Private m_PartType As PartType = PartType.Unknown
Friend Property PartType As PartType
Get
Return m_PartType
End Get
Set(value As PartType)
m_PartType = value
End Set
End Property
' id del part selezionato per essere modificato ' id del part selezionato per essere modificato
Private m_nIdPart As Integer = GDB_ID.NULL Private m_nIdPart As Integer = GDB_ID.NULL
Public Property nIdPart As Integer Public Property nIdPart As Integer
@@ -29,7 +40,31 @@ Public Class EditPanelVM
Return m_nIdPart Return m_nIdPart
End Get End Get
Set(value As Integer) Set(value As Integer)
If m_nIdPart <> GDB_ID.NULL Then SceneCmd.DeselectAll()
m_nIdPart = value m_nIdPart = value
Stage = EditPanelStage.InsertNewParam
' devo capire che tipo di pezzo sto modificando
' se non ha info di accoppiamento è una base (piano cucina)
' se ha l'info "Sink" allora è un pezzo di una buca
' se ha info di accoppiamento generico è una paretina
PartType = GetPartType()
If ParamList.Count > 0 Then
Select Case PartType
Case PartType.Panel
UpdatePanelInfoFromPart(m_nIdPart)
Case PartType.Sink
Dim bIsBottom As Boolean = False
EgtGetInfo(m_nIdPart, "Bottom", bIsBottom)
If bIsBottom Then
Dim nParent As Integer = GDB_ID.NULL
EgtGetInfo(m_nIdPart, "Parent", nParent)
UpdatePanelInfoFromPart(nParent)
Else
UpdatePanelInfoFromPart(m_nIdPart)
End If
End Select
End If
UpdateParameterListShown()
End Set End Set
End Property End Property
@@ -50,6 +85,16 @@ Public Class EditPanelVM
Return EgtMsg(110042) ' Conferma, modifica con altri parametri o annulla Return EgtMsg(110042) ' Conferma, modifica con altri parametri o annulla
End Get End Get
End Property End Property
Public ReadOnly Property Msg_Paragraph1 As String
Get
Return EgtMsg(110038) ' Frontalino
End Get
End Property
Public ReadOnly Property Msg_Paragraph2 As String
Get
Return EgtMsg(110039) ' Fondo
End Get
End Property
#End Region ' Messages #End Region ' Messages
@@ -60,73 +105,91 @@ Public Class EditPanelVM
Public Sub New() Public Sub New()
MyBase.New() MyBase.New()
Title = "Modifica Paretina".ToUpper() Title = "Modifica Paretina".ToUpper()
If Map.refSceneHostVM.m_nIdPart <> GDB_ID.NULL Then
nIdPart = Map.refSceneHostVM.m_nIdPart
Stage = EditPanelStage.InsertNewParam
End If
LoadParamList() LoadParamList()
UpdatePanelInfoFromPart(m_nIdPart)
End Sub End Sub
#End Region ' Constructor #End Region ' Constructor
#Region "METHODS" #Region "METHODS"
Private Sub UpdatePanelInfoFromPart(nIdPart As Integer)
If nIdPart = GDB_ID.NULL Then Return
Dim dH As Double = 100
EgtGetInfo(nIdPart, "H", dH)
DirectCast(ParamList(2), _TextBoxParam).sValue = dH.ToString()
Dim dTh As Double = 10
EgtGetInfo(nIdPart, "Th", dTh)
DirectCast(ParamList(3), _TextBoxParam).sValue = dTh.ToString()
Dim nJunctionType As Integer
EgtGetInfo(nIdPart, "JunctionType", nJunctionType)
DirectCast(ParamList(4), _ComboBoxParam).IndexSelParamCmBx = nJunctionType - 1
End Sub
Private Sub UpdateParameterListShown()
'' dalle info leggo se l'oggetto è una paretina o una buca
If PartType = PartType.TopKitchen Then
'ParamList(3).nVisibility = Visibility.Collapsed
'ParamList(4).nVisibility = Visibility.Collapsed
'ParamList(5).nVisibility = Visibility.Visible
'ParamList(6).nVisibility = Visibility.Visible
'ParamList(7).nVisibility = Visibility.Visible
'ParamList(8).nVisibility = Visibility.Visible
'ParamList(9).nVisibility = Visibility.Visible
ElseIf PartType = PartType.Sink Then
ParamList(1).nVisibility = Visibility.Visible
ParamList(2).nVisibility = Visibility.Visible
ParamList(3).nVisibility = Visibility.Visible
ParamList(4).nVisibility = Visibility.Collapsed
ParamList(5).nVisibility = Visibility.Visible
ParamList(6).nVisibility = Visibility.Visible
ParamList(7).nVisibility = Visibility.Visible
ParamList(8).nVisibility = Visibility.Visible
ParamList(9).nVisibility = Visibility.Collapsed
ElseIf PartType = PartType.Panel Then
ParamList(1).nVisibility = Visibility.Collapsed
ParamList(2).nVisibility = Visibility.Visible
ParamList(3).nVisibility = Visibility.Visible
ParamList(4).nVisibility = Visibility.Visible
ParamList(5).nVisibility = Visibility.Collapsed
ParamList(6).nVisibility = Visibility.Collapsed
ParamList(7).nVisibility = Visibility.Collapsed
ParamList(8).nVisibility = Visibility.Collapsed
ParamList(9).nVisibility = Visibility.Visible
End If
End Sub
Public Overrides Sub LoadParamList() Public Overrides Sub LoadParamList()
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(0), ParamType.STR, Visibility.Visible)) AddGenericParam(New _TextBlockParam("Messaggio", MsgList(0), ParamType.STR, Visibility.Visible))
' sezione paretina ' sezione paretina
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(1), ParamType.STR, Visibility.Collapsed)) AddGenericParam(New _TextBlockParam("Messaggio", MsgList(3), ParamType.STR, Visibility.Collapsed))
Dim dH As Double = 0 Dim dH As Double = 200
EgtGetInfo(nIdPart, "H", dH)
AddGenericParam(New _TextBoxParam("Altezza", dH, ParamType.LEN, Visibility.Visible)) AddGenericParam(New _TextBoxParam("Altezza", dH, ParamType.LEN, Visibility.Visible))
Dim dTh As Double = 0 Dim dTh As Double = 20
EgtGetInfo(nIdPart, "Th", dTh)
AddGenericParam(New _TextBoxParam("Spessore", dTh, ParamType.LEN, Visibility.Visible)) AddGenericParam(New _TextBoxParam("Spessore", dTh, ParamType.LEN, Visibility.Visible))
Dim nJunctionType As Integer = 0
Dim JunctionTypeList As New List(Of ParamCmBx)({New ParamCmBx("Trim Start"), New ParamCmBx("Trim End"), New ParamCmBx("Angle"), New ParamCmBx("Trim Both")})
AddGenericParam(New _ComboBoxParam("Tipo Giunzione", JunctionTypeList, nJunctionType))
' sezione fondello ' sezione fondello
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(2), ParamType.STR, Visibility.Collapsed)) AddGenericParam(New _TextBlockParam("Messaggio", MsgList(4), ParamType.STR, Visibility.Collapsed))
AddGenericParam(New _TextBoxParam("Altezza", 100, ParamType.LEN, Visibility.Collapsed))
AddGenericParam(New _TextBoxParam("Spessore", 10, ParamType.LEN, Visibility.Collapsed)) AddGenericParam(New _TextBoxParam("Spessore", 10, ParamType.LEN, Visibility.Collapsed))
AddGenericParam(New _TextBoxParam("Inclinazione", 0.1, ParamType.DOUB, Visibility.Collapsed)) AddGenericParam(New _TextBoxParam("Inclinazione", 0.1, ParamType.DOUB, Visibility.Collapsed))
AddGenericParam(New _TextBoxParam("Diametro foro", 30, ParamType.LEN, Visibility.Collapsed)) AddGenericParam(New _TextBoxParam("Diametro foro", 30, ParamType.LEN, Visibility.Collapsed))
' ' checkbox
AddGenericParam(New _CheckBoxParam("ModificaAdiacenti", "Modifica anche paretine adiacenti", Visibility.Visible)) AddGenericParam(New _CheckBoxParam("ModificaAdiacenti", "Modifica anche altre paretine dello stesso tipo", Visibility.Visible))
'' dalle info leggo se l'oggetto è una paretina o una buca
'If DirectCast(sender, _ComboBoxParam).Name = "TipoParetina" Then
' If DirectCast(Selection, ParamCmBx).Name = "SplitBottom" Then
' ParamList(3).nVisibility = Visibility.Collapsed
' ParamList(4).nVisibility = Visibility.Collapsed
' ParamList(5).nVisibility = Visibility.Visible
' ParamList(6).nVisibility = Visibility.Visible
' ParamList(7).nVisibility = Visibility.Visible
' ParamList(8).nVisibility = Visibility.Visible
' ParamList(9).nVisibility = Visibility.Visible
' Map.refSceneHostVM.m_SelType = GDB_TY.SRF_MESH
' 'DirectCast(Map.refSceneButtonV.m_PanelUC, SceneUserControlV).Preview.Visibility = Visibility.Visible
' ElseIf DirectCast(Selection, ParamCmBx).Name = "Tappa Buca" Then
' ParamList(2).nVisibility = Visibility.Visible
' ParamList(3).nVisibility = Visibility.Visible
' ParamList(4).nVisibility = Visibility.Visible
' ParamList(5).nVisibility = Visibility.Visible
' ParamList(6).nVisibility = Visibility.Visible
' ParamList(7).nVisibility = Visibility.Visible
' ParamList(8).nVisibility = Visibility.Visible
' ParamList(9).nVisibility = Visibility.Visible
' Map.refSceneHostVM.m_SelType = GDB_TY.CRV_LINE
' Else
' ParamList(2).nVisibility = Visibility.Collapsed
' ParamList(3).nVisibility = Visibility.Visible
' ParamList(4).nVisibility = Visibility.Visible
' ParamList(5).nVisibility = Visibility.Collapsed
' ParamList(6).nVisibility = Visibility.Collapsed
' ParamList(7).nVisibility = Visibility.Collapsed
' ParamList(8).nVisibility = Visibility.Collapsed
' ParamList(9).nVisibility = Visibility.Collapsed
' Map.refSceneHostVM.m_SelType = GDB_TY.CRV_LINE
' 'DirectCast(Map.refSceneButtonV.m_PanelUC, SceneUserControlV).Preview.Visibility = Visibility.Hidden
' End If
'End If
End Sub End Sub
Public Sub AdvanceStage() Public Sub AdvanceStage()
@@ -138,15 +201,17 @@ Public Class EditPanelVM
End Function End Function
Public Overrides Sub Conferma() Public Overrides Sub Conferma()
' se sono in modalità fondello allora devo creare il pezzo ' in base al tipo di pezzo che sto modificando chiamo la funzione corrispondente
If DirectCast(ParamList(1), _ComboBoxParam).SelParamCmBx.Name = "SplitBottom" Then Select Case PartType
AddSplitBottom(Map.refSceneHostVM.m_PanelPartList) Case PartType.Sink
End If EditSinkWithSplitBottom()
' resetto la lista dei part selezionati per la creazione di uno splitBottom Case PartType.Panel
Map.refSceneHostVM.m_PanelPartList.Clear() EditPanel(nIdPart)
' resetto il tipo di elementi da evidenziare Case PartType.TopKitchen
Map.refSceneHostVM.m_SelType = GDB_TY.NONE 'EditTopKitchen()
End Select
' aggiorno la lista dei partSolid
SolidManagerM.CreatePartSolid()
' chiudo lo user control ' chiudo lo user control
Close() Close()
End Sub End Sub
@@ -161,86 +226,129 @@ Public Class EditPanelVM
Private Sub Close() Private Sub Close()
SolidManagerM.ResetOperationMarks(Map.refSceneHostVM.m_nIdPart) SolidManagerM.ResetOperationMarks(Map.refSceneHostVM.m_nIdPart)
EgtDraw() EgtDraw()
Dim Btn As SceneBtn = Map.refSceneButtonVM.GetButton(EGT_PANEL) Dim Btn As SceneBtn = Map.refSceneButtonVM.GetButton(EGT_EDIT_PANEL)
If TypeOf (Btn) Is _ToggleButton Then If TypeOf (Btn) Is _ToggleButton Then
DirectCast(Btn, _ToggleButton).IsChecked = False DirectCast(Btn, _ToggleButton).IsChecked = False
Else Else
EgtOutLog("CONFIG ERR: Il pulsante di Panel è stato definito come Button anziché ToggleButton") EgtOutLog("CONFIG ERR: Il pulsante di Edit Panel è stato definito come Button anziché ToggleButton")
End If End If
' rimuovo lo UC dalla griglia ' rimuovo lo UC dalla griglia
Map.refSceneButtonVM.RemoveUC(Map.refSceneButtonVM.m_NewPanelUC) Map.refSceneButtonVM.RemoveUC(Map.refSceneButtonVM.m_EditPanelUC)
SolidManagerM.ManageUndoRedo() SolidManagerM.ManageUndoRedo()
End Sub End Sub
Public Sub AddPanel(nId As Integer) Public Function GetPartType()
Dim ComboBoxParam As _ComboBoxParam = DirectCast(ParamList(1), _ComboBoxParam) Dim bIsSink As Boolean = False
If ComboBoxParam.SelParamCmBx.Name = "Alzatina" Then EgtGetInfo(m_nIdPart, "Sink", bIsSink)
AddSplashTop(nId) If bIsSink Then
ElseIf ComboBoxParam.SelParamCmBx.Name = "Frontalino" Then Return PartType.Sink
AddWaterfall(nId)
ElseIf ComboBoxParam.SelParamCmBx.Name = "Tappa Buca" Then
AddWaterfallAndBottom(nId)
End If End If
End Sub Dim sPair As String = String.Empty
EgtGetInfo(m_nIdPart, "PairMyRef", sPair)
Public Function GetPanelType() Dim bIsPanel As Boolean = sPair <> String.Empty
Return DirectCast(ParamList(1), _ComboBoxParam).SelParamCmBx.Name If bIsPanel Then
Return PartType.Panel
End If
' altrimenti è un piano cucina
Return PartType.TopKitchen
End Function End Function
Private Sub AddSplashTop(nId As Integer) Private Sub SetVariablesAndRecreate(nEdgeId As Integer)
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId)) If EgtLuaSetGlobIntVar("TOOL.nEdgeId", nEdgeId) Then AssLog("TOOL.nEdgeId = " & nEdgeId.ToString())
' setto l'indice del lato e il parent Dim nJunctionType = DirectCast(ParamList(4), _ComboBoxParam).IndexSelParamCmBx + 1 ' in Lua l'enum è 1-based
If EgtLuaSetGlobIntVar("TOOL.nEdgeId", nId) Then AssLog("TOOL.nEdgeId = " & nId.ToString()) If EgtLuaSetGlobIntVar("TOOL.nJunctionType", nJunctionType) Then AssLog("TOOL.nJunctionType = " & nJunctionType.ToString())
If EgtLuaSetGlobIntVar("TOOL.nParent", nPartId) Then AssLog("TOOL.nParent = " & nPartId.ToString()) Dim dTh As Double = DirectCast(ParamList(3), _TextBoxParam).GetValue()
' setto le variabili per l'alzatina
Dim dAngAlzatina As Double = 90
If EgtLuaSetGlobNumVar("TOOL.dPairAng", dAngAlzatina) Then AssLog("TOOL.dPairAng = " & dAngAlzatina.ToString())
Dim nJunctionTypeAlz = 1
If EgtLuaSetGlobIntVar("TOOL.nJunctionType", nJunctionTypeAlz) Then AssLog("TOOL.nJunctionType = " & nJunctionTypeAlz.ToString())
Dim bOnLoop As Boolean = False
If EgtLuaSetGlobBoolVar("TOOL.bOnLoop", bOnLoop) Then AssLog("TOOL.bOnLoop = false")
Dim bInsideLoop As Boolean = True
If EgtLuaSetGlobBoolVar("TOOL.bInsideLoop", bInsideLoop) Then AssLog("TOOL.bInsideLoop = true")
' setto le varibili generiche per il pezzo
Dim dTh As Double = DirectCast(ParamList(4), _TextBoxParam).GetValue()
If EgtLuaSetGlobNumVar("TOOL.dTh", dTh) Then AssLog("TOOL.dTh = " & dTh.ToString()) If EgtLuaSetGlobNumVar("TOOL.dTh", dTh) Then AssLog("TOOL.dTh = " & dTh.ToString())
Dim dH As Double = DirectCast(ParamList(3), _TextBoxParam).GetValue() Dim dH As Double = DirectCast(ParamList(2), _TextBoxParam).GetValue()
If EgtLuaSetGlobNumVar("TOOL.dH", dH) Then AssLog("TOOL.dH = " & dH.ToString()) If EgtLuaSetGlobNumVar("TOOL.dH", dH) Then AssLog("TOOL.dH = " & dH.ToString())
If EgtLuaSetGlobBoolVar("TOOL.bPrev", True) Then AssLog("TOOL.bPrev = true") Dim bPrev As Boolean = True
If EgtLuaSetGlobBoolVar("TOOL.bNext", True) Then AssLog("TOOL.bNext = true") If EgtLuaSetGlobBoolVar("TOOL.bPrev", bPrev) Then AssLog("TOOL.bPrev = true")
' chiamo la funzione per la creazione Dim bNext As Boolean = True
If EgtLuaCallFunction("TOOL.CreateParetinaFull") Then AssLog("TOOL.CreateParetinaFull()") If EgtLuaSetGlobBoolVar("TOOL.bNext", bNext) Then AssLog("TOOL.bNext = true")
End Sub
Private Sub AddWaterfall(nId As Integer)
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
' setto l'indice del lato e il parent
If EgtLuaSetGlobIntVar("TOOL.nEdgeId", nId) Then AssLog("TOOL.nEdgeId = " & nId.ToString())
If EgtLuaSetGlobIntVar("TOOL.nParent", nPartId) Then AssLog("TOOL.nParent = " & nPartId.ToString())
' setto le variabili per l'alzatina
Dim dAngFrontalino As Double = -90
If EgtLuaSetGlobNumVar("TOOL.dPairAng", dAngFrontalino) Then AssLog("TOOL.dPairAng = " & dAngFrontalino.ToString())
Dim nJunctionTypeAlz = 3
If EgtLuaSetGlobIntVar("TOOL.nJunctionType", nJunctionTypeAlz) Then AssLog("TOOL.nJunctionType = " & nJunctionTypeAlz.ToString())
Dim bOnLoop As Boolean = True
If EgtLuaSetGlobBoolVar("TOOL.bOnLoop", bOnLoop) Then AssLog("TOOL.bOnLoop = false")
Dim bInsideLoop As Boolean = True
If EgtLuaSetGlobBoolVar("TOOL.bInsideLoop", bInsideLoop) Then AssLog("TOOL.bInsideLoop = true")
' setto le varibili generiche per il pezzo
Dim dTh As Double = DirectCast(ParamList(4), _TextBoxParam).GetValue()
If EgtLuaSetGlobNumVar("TOOL.dTh", dTh) Then AssLog("TOOL.dTh = " & dTh.ToString())
Dim dH As Double = DirectCast(ParamList(3), _TextBoxParam).GetValue()
If EgtLuaSetGlobNumVar("TOOL.dH", dH) Then AssLog("TOOL.dH = " & dH.ToString())
If EgtLuaSetGlobBoolVar("TOOL.bPrev", True) Then AssLog("TOOL.bPrev = true")
If EgtLuaSetGlobBoolVar("TOOL.bNext", True) Then AssLog("TOOL.bNext = true")
' chiamo la funzione per la creazione
If EgtLuaCallFunction("TOOL.CreateParetinaFull") Then AssLog("TOOL.CreateParetinaFull()") If EgtLuaCallFunction("TOOL.CreateParetinaFull") Then AssLog("TOOL.CreateParetinaFull()")
End Sub End Sub
Private Sub AddSplitBottom(PartList As List(Of Integer)) Private Sub EditPanel(nId)
If PartList.Count = 0 Then ' recupero le info salvate nel Part
Close() EgtLuaExecLine("TOOL.FillInfoTableFromPart(" & nId.ToString() & ")")
Return ' recupero l'id dell'edge che ha generato la paretina
Dim nParent As Integer = GDB_ID.NULL
EgtGetInfo(nId, "Parent", nParent)
Dim nIn As Integer = 0
EgtGetInfo(nId, "nInLoop", nIn)
Dim sLayName As String = "OutLoop"
Dim nLayId As Integer = GDB_ID.NULL
If nIn = 0 Then
nLayId = EgtGetFirstNameInGroup(nParent, sLayName)
Else
sLayName = "InLoop"
nLayId = EgtGetFirstNameInGroup(nParent, sLayName)
Dim nInLays = 1
While nInLays <> nIn
nLayId = EgtGetNextName(nLayId, sLayName)
nInLays += 1
End While
End If End If
Dim nEdge As Integer = 0
EgtGetInfo(nId, "ParentEdge", nEdge)
Dim sEdgeName As String = "A" & nEdge.ToString()
Dim nEdgeId As Integer = EgtGetFirstNameInGroup(nLayId, sEdgeName)
' setto i parametri che ha scelto l'utente
SetVariablesAndRecreate(nEdgeId)
' se la checkbox per la modifica delle paretine dello stesso tipo, sullo stesso loop, è checkata allora scorro il loop e continuo a chiamare la ricreazione
If DirectCast(ParamList(9), _CheckBoxParam).IsChecked Then
' scorro i next e prev modificando anche le paretine adiacenti con le stesse modifiche
' facendo attenzione a non entrare in un loop
Dim sCurrPartName As String = String.Empty
EgtGetName(nId, sCurrPartName)
Dim sNamePrev As String = String.Empty
EgtGetInfo(nId, "Prev", sNamePrev)
Dim nLastPrev As Integer = GDB_ID.NULL
While sNamePrev <> String.Empty And sNamePrev <> sCurrPartName
Dim nPrev As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, sNamePrev)
' recupero l'edge del parent e ricreo la paretina
EgtGetInfo(nPrev, "ParentEdge", nEdge)
' recupero le info salvate nel Part
EgtLuaExecLine("TOOL.FillInfoTableFromPart(" & nPrev.ToString() & ")")
sEdgeName = "A" & nEdge.ToString()
nEdgeId = EgtGetFirstNameInGroup(nLayId, sEdgeName)
SetVariablesAndRecreate(nEdgeId)
EgtGetInfo(nPrev, "Prev", sNamePrev)
nLastPrev = nPrev
End While
Dim sNameNext As String = String.Empty
EgtGetInfo(nId, "Next", sNameNext)
While sNameNext <> String.Empty
Dim nNext As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, sNameNext)
' recupero l'edge del parent e ricreo la paretina
If nNext = nLastPrev Then Exit While
' recupero le info salvate nel Part
EgtLuaExecLine("TOOL.FillInfoTableFromPart(" & nNext.ToString() & ")")
EgtGetInfo(nNext, "ParentEdge", nEdge)
sEdgeName = "A" & nEdge.ToString()
nEdgeId = EgtGetFirstNameInGroup(nLayId, sEdgeName)
SetVariablesAndRecreate(nEdgeId)
EgtGetInfo(nNext, "Next", sNameNext)
End While
End If
End Sub
Private Function GetNeighbours(nId As Integer)
Dim NeighList As New List(Of Integer)
If nId = GDB_ID.NULL Then Return NeighList
Dim nNextId As Integer = nId
While nNextId <> GDB_ID.NULL
NeighList.Add(nNextId)
Dim sNextName As String = String.Empty
EgtGetInfo(nNextId, "Next", sNextName)
nNextId = EgtGetFirstNameInGroup(GDB_ID.ROOT, sNextName)
If nNextId = nId Then Exit While
End While
Return NeighList
End Function
Private Sub EditSinkBottom(PartList As List(Of Integer))
Dim lEdgeList As New List(Of Integer) Dim lEdgeList As New List(Of Integer)
For Each nPart As Integer In PartList For Each nPart As Integer In PartList
Dim nOutLay As Integer = EgtGetFirstNameInGroup(nPart, "OutLoop") Dim nOutLay As Integer = EgtGetFirstNameInGroup(nPart, "OutLoop")
@@ -251,41 +359,66 @@ Public Class EditPanelVM
For i As Integer = 1 To lEdgeList.Count For i As Integer = 1 To lEdgeList.Count
EgtLuaSetGlobIntVar("TOOL.tbIdEdges." & i.ToString(), lEdgeList(i - 1).ToString()) EgtLuaSetGlobIntVar("TOOL.tbIdEdges." & i.ToString(), lEdgeList(i - 1).ToString())
Next Next
Dim dTh As Double = DirectCast(ParamList(7), _TextBoxParam).GetValue() Dim dTh As Double = DirectCast(ParamList(6), _TextBoxParam).GetValue()
EgtLuaSetGlobNumVar("TOOL.dTh", dTh) EgtLuaSetGlobNumVar("TOOL.dTh", dTh)
Dim dDiam As Double = DirectCast(ParamList(9), _TextBoxParam).GetValue() Dim dDiam As Double = DirectCast(ParamList(8), _TextBoxParam).GetValue()
EgtLuaSetGlobNumVar("TOOL.dDiamBore", dDiam) EgtLuaSetGlobNumVar("TOOL.dDiamBore", dDiam)
Dim dAng As Double = DirectCast(ParamList(8), _TextBoxParam).GetValue() Dim dAng As Double = DirectCast(ParamList(7), _TextBoxParam).GetValue()
EgtLuaSetGlobNumVar("TOOL.dSlopeAng", dAng) EgtLuaSetGlobNumVar("TOOL.dSlopeAng", dAng)
EgtLuaCallFunction("TOOL.CreateSplitBottom") EgtLuaCallFunction("TOOL.CreateSplitBottom")
End Sub End Sub
Private Sub AddWaterfallAndBottom(nId As Integer) Private Sub EditSinkWithSplitBottom()
Dim nInLoopLay As Integer = EgtGetParent(nId) ' risalgo ai frontalini
Dim nEdges As Integer = EgtGetGroupObjs(nInLoopLay) Dim bBottom As Boolean = False
Dim nEdge As Integer = EgtGetFirstInGroup(nInLoopLay) EgtGetInfo(nIdPart, "Bottom", bBottom)
While nEdge <> GDB_ID.NULL Dim nWaterfallId As Integer = nIdPart
AddWaterfall(nEdge) If bBottom Then
nEdge = EgtGetNext(nEdge) Dim sInfoPartDest As String = String.Empty
End While EgtGetInfo(nIdPart, "PairToRef", sInfoPartDest)
' recupero le info dei part creati come frontalini dalle info del Parent Dim sInfoPartDestSplit As Array = sInfoPartDest.Split(","c)
Dim nParent As Integer = EgtGetParent(nInLoopLay) Dim sPartDest As String = sInfoPartDestSplit(0)
' scopro la posizione ordinale dell'inloop in questione nWaterfallId = EgtGetFirstNameInGroup(GDB_ID.ROOT, sPartDest)
Dim nIn As Integer = 1 End If
Dim nInLoop As Integer = EgtGetFirstNameInGroup(nParent, "InLoop") ' modifico i frontalini
While nInLoop <> nInLoopLay DirectCast(ParamList(9), _CheckBoxParam).IsChecked = True
nIn += 1 EditPanel(nWaterfallId)
nInLoop = EgtGetNextName(nInLoop, "InLoop") ' recupero la lista degli id dei frontalini
End While Dim WaterfallList As List(Of Integer) = GetNeighbours(nWaterfallId)
Dim WaterFallList As New List(Of Integer) ' modifico i pezzi dello split bottom
For i As Integer = 1 To nEdges EditSinkBottom(WaterfallList)
Dim sInfoName As String = "A" & i.ToString() & "_I" & nIn.ToString() End Sub
Dim sPartName As String = String.Empty
EgtGetInfo(nParent, sInfoName, sPartName) Public Sub SelectPartOrPartsToEdit()
WaterFallList.Add(EgtGetFirstNameInGroup(GDB_ID.ROOT, sPartName)) If PartType = PartType.Sink Then
Next Dim bBottom As Boolean = False
' ora che ho la lista dei frontalini posso creare lo split bottom EgtGetInfo(nIdPart, "Bottom", bBottom)
AddSplitBottom(WaterFallList) Dim BottomList As List(Of Integer)
Dim WaterFallList As List(Of Integer)
If bBottom Then
BottomList = GetNeighbours(nIdPart)
Dim nWaterfallId As Integer = GDB_ID.NULL
EgtGetInfo(nIdPart, "Parent", nWaterfallId)
WaterFallList = GetNeighbours(nWaterfallId)
Else
WaterFallList = GetNeighbours(nIdPart)
Dim sBottomName As String = String.Empty
EgtGetInfo(nIdPart, "A3", sBottomName)
Dim nBottomId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, sBottomName)
BottomList = GetNeighbours(nBottomId)
End If
For Each nPartId In BottomList
Dim PartSolidSel As PartSolidM = GetPartSolid(nPartId)
PartSolidSel.SelectSinglePart()
Next
For Each nPartId In WaterFallList
Dim PartSolidSel As PartSolidM = GetPartSolid(nPartId)
PartSolidSel.SelectSinglePart()
Next
Else
Dim PartSolidSel As PartSolidM = GetPartSolid(nIdPart)
PartSolidSel.SelectSinglePart()
End If
End Sub End Sub
#End Region ' Methods #End Region ' Methods
+135
View File
@@ -0,0 +1,135 @@
Imports EgtUILib
Public Class EditTopKitchenVM
Inherits SceneUserControlVM
#Region "FIELDS & PROPERTIES"
Private ReadOnly m_MsgList As New List(Of String)({TopBar_Msg_Stg0, TopBar_Msg_Stg1, TopBar_Msg_Stg2, Msg_Paragraph1, Msg_Paragraph2})
Public ReadOnly Property MsgList As List(Of String)
Get
Return m_MsgList
End Get
End Property
Private m_Stage As EditTopKStage = EditTopKStage.SelectPart
Private Property Stage As EditTopKStage
Get
Return m_Stage
End Get
Set(value As EditTopKStage)
m_Stage = value
DirectCast(ParamList(0), _TextBlockParam).MsgValue = MsgList(m_Stage)
End Set
End Property
' id del part selezionato per essere modificato
Private m_nIdPart As Integer = GDB_ID.NULL
Public Property nIdPart As Integer
Get
Return m_nIdPart
End Get
Set(value As Integer)
If m_nIdPart <> GDB_ID.NULL Then SceneCmd.DeselectAll()
m_nIdPart = value
End Set
End Property
#Region "Messages"
Public ReadOnly Property TopBar_Msg_Stg0 As String
Get
Return EgtMsg(110040) ' Seleziona il Part che vuoi modificare
End Get
End Property
Public ReadOnly Property TopBar_Msg_Stg1 As String
Get
Return EgtMsg(110041) ' Inserisci i nuovi parametri
End Get
End Property
Public ReadOnly Property TopBar_Msg_Stg2 As String
Get
Return EgtMsg(110042) ' Conferma, modifica con altri parametri o annulla
End Get
End Property
Public ReadOnly Property Msg_Paragraph1 As String
Get
Return EgtMsg(110038) ' Frontalino
End Get
End Property
Public ReadOnly Property Msg_Paragraph2 As String
Get
Return EgtMsg(110039) ' Fondo
End Get
End Property
#End Region ' Messages
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Public Sub New()
MyBase.New()
Title = "Modifica Contorno Pezzo".ToUpper()
If Map.refSceneHostVM.m_nIdPart <> GDB_ID.NULL Then
nIdPart = Map.refSceneHostVM.m_nIdPart
Stage = EditTopKStage.SelectEdge
End If
LoadParamList()
End Sub
#End Region ' Constructor
#Region "METHODS"
Public Overrides Sub LoadParamList()
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(0), ParamType.STR, Visibility.Visible))
' sezione paretina
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(3), ParamType.STR, Visibility.Collapsed))
Dim dH As Double = 200
AddGenericParam(New _TextBoxParam("Altezza", dH, ParamType.LEN, Visibility.Visible))
Dim dTh As Double = 20
AddGenericParam(New _TextBoxParam("Spessore", dTh, ParamType.LEN, Visibility.Visible))
Dim nJunctionType As Integer = 0
Dim JunctionTypeList As New List(Of ParamCmBx)({New ParamCmBx("Trim Start"), New ParamCmBx("Trim End"), New ParamCmBx("Angle"), New ParamCmBx("Trim Both")})
AddGenericParam(New _ComboBoxParam("Tipo Giunzione", JunctionTypeList, nJunctionType))
' sezione fondello
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(4), ParamType.STR, Visibility.Collapsed))
AddGenericParam(New _TextBoxParam("Spessore", 10, ParamType.LEN, Visibility.Collapsed))
AddGenericParam(New _TextBoxParam("Inclinazione", 0.1, ParamType.DOUB, Visibility.Collapsed))
AddGenericParam(New _TextBoxParam("Diametro foro", 30, ParamType.LEN, Visibility.Collapsed))
' checkbox
AddGenericParam(New _CheckBoxParam("ModificaAdiacenti", "Modifica anche altre paretine dello stesso tipo", Visibility.Visible))
End Sub
Public Overrides Sub Conferma()
' aggiorno la lista dei partSolid
SolidManagerM.CreatePartSolid()
' chiudo lo user control
Close()
End Sub
Public Overrides Sub Annulla()
Map.refSceneHostVM.m_nIdPart = GDB_ID.NULL
SceneCmd.DeselectAll()
' chiudo lo user control
Close()
End Sub
Private Sub Close()
SolidManagerM.ResetOperationMarks(Map.refSceneHostVM.m_nIdPart)
EgtDraw()
Dim Btn As SceneBtn = Map.refSceneButtonVM.GetButton(EGT_EDIT_PANEL)
If TypeOf (Btn) Is _ToggleButton Then
DirectCast(Btn, _ToggleButton).IsChecked = False
Else
EgtOutLog("CONFIG ERR: Il pulsante di Edit Panel è stato definito come Button anziché ToggleButton")
End If
' rimuovo lo UC dalla griglia
Map.refSceneButtonVM.RemoveUC(Map.refSceneButtonVM.m_EditPanelUC)
SolidManagerM.ManageUndoRedo()
End Sub
#End Region
End Class
+37 -15
View File
@@ -67,6 +67,8 @@ Public Class NewPanelVM
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(1), ParamType.STR, Visibility.Collapsed)) AddGenericParam(New _TextBlockParam("Messaggio", MsgList(1), ParamType.STR, Visibility.Collapsed))
AddGenericParam(New _TextBoxParam("Altezza", 100, ParamType.LEN, Visibility.Visible)) AddGenericParam(New _TextBoxParam("Altezza", 100, ParamType.LEN, Visibility.Visible))
AddGenericParam(New _TextBoxParam("Spessore", 10, ParamType.LEN, Visibility.Visible)) AddGenericParam(New _TextBoxParam("Spessore", 10, ParamType.LEN, Visibility.Visible))
Dim JunctionType As New List(Of ParamCmBx)({New ParamCmBx("Trim Start"), New ParamCmBx("Trim End"), New ParamCmBx("Trim Angled")})
AddGenericParam(New _ComboBoxParam("TipoGiunzione", JunctionType, 0, Visibility.Visible))
' sezione fondello ' sezione fondello
AddGenericParam(New _TextBlockParam("Messaggio", MsgList(2), ParamType.STR, Visibility.Collapsed)) AddGenericParam(New _TextBlockParam("Messaggio", MsgList(2), ParamType.STR, Visibility.Collapsed))
@@ -90,35 +92,43 @@ Public Class NewPanelVM
If DirectCast(Selection, ParamCmBx).Name = "SplitBottom" Then If DirectCast(Selection, ParamCmBx).Name = "SplitBottom" Then
ParamList(3).nVisibility = Visibility.Collapsed ParamList(3).nVisibility = Visibility.Collapsed
ParamList(4).nVisibility = Visibility.Collapsed ParamList(4).nVisibility = Visibility.Collapsed
ParamList(5).nVisibility = Visibility.Collapsed
ParamList(5).nVisibility = Visibility.Visible
ParamList(6).nVisibility = Visibility.Visible ParamList(6).nVisibility = Visibility.Visible
ParamList(7).nVisibility = Visibility.Visible ParamList(7).nVisibility = Visibility.Visible
ParamList(8).nVisibility = Visibility.Visible ParamList(8).nVisibility = Visibility.Visible
ParamList(9).nVisibility = Visibility.Visible ParamList(9).nVisibility = Visibility.Visible
ParamList(10).nVisibility = Visibility.Visible
Map.refSceneHostVM.m_SelType = GDB_TY.SRF_MESH Map.refSceneHostVM.m_SelType = GDB_TY.SRF_MESH
'DirectCast(Map.refSceneButtonV.m_PanelUC, SceneUserControlV).Preview.Visibility = Visibility.Visible 'DirectCast(Map.refSceneButtonV.m_PanelUC, SceneUserControlV).Preview.Visibility = Visibility.Visible
ElseIf DirectCast(Selection, ParamCmBx).Name = "Tappa Buca" Then ElseIf DirectCast(Selection, ParamCmBx).Name = "Tappa Buca" Then
ParamList(2).nVisibility = Visibility.Visible ParamList(2).nVisibility = Visibility.Visible
ParamList(3).nVisibility = Visibility.Visible ParamList(3).nVisibility = Visibility.Visible
ParamList(4).nVisibility = Visibility.Visible ParamList(4).nVisibility = Visibility.Visible
ParamList(5).nVisibility = Visibility.Visible ParamList(5).nVisibility = Visibility.Visible
ParamList(6).nVisibility = Visibility.Visible ParamList(6).nVisibility = Visibility.Visible
ParamList(7).nVisibility = Visibility.Visible ParamList(7).nVisibility = Visibility.Visible
ParamList(8).nVisibility = Visibility.Visible ParamList(8).nVisibility = Visibility.Visible
ParamList(9).nVisibility = Visibility.Visible ParamList(9).nVisibility = Visibility.Visible
ParamList(10).nVisibility = Visibility.Visible
Map.refSceneHostVM.m_SelType = GDB_TY.CRV_LINE Map.refSceneHostVM.m_SelType = GDB_TY.CRV_LINE
Else Else
ParamList(2).nVisibility = Visibility.Collapsed ParamList(2).nVisibility = Visibility.Collapsed
ParamList(3).nVisibility = Visibility.Visible ParamList(3).nVisibility = Visibility.Visible
ParamList(4).nVisibility = Visibility.Visible ParamList(4).nVisibility = Visibility.Visible
ParamList(5).nVisibility = Visibility.Visible
If DirectCast(Selection, ParamCmBx).Name = "Alzatina" Then
DirectCast(ParamList(5), _ComboBoxParam).IndexSelParamCmBx = 0
ElseIf DirectCast(Selection, ParamCmBx).Name = "Frontalino" Then
DirectCast(ParamList(5), _ComboBoxParam).IndexSelParamCmBx = 2
End If
ParamList(5).nVisibility = Visibility.Collapsed
ParamList(6).nVisibility = Visibility.Collapsed ParamList(6).nVisibility = Visibility.Collapsed
ParamList(7).nVisibility = Visibility.Collapsed ParamList(7).nVisibility = Visibility.Collapsed
ParamList(8).nVisibility = Visibility.Collapsed ParamList(8).nVisibility = Visibility.Collapsed
ParamList(9).nVisibility = Visibility.Collapsed ParamList(9).nVisibility = Visibility.Collapsed
ParamList(10).nVisibility = Visibility.Collapsed
Map.refSceneHostVM.m_SelType = GDB_TY.CRV_LINE Map.refSceneHostVM.m_SelType = GDB_TY.CRV_LINE
'DirectCast(Map.refSceneButtonV.m_PanelUC, SceneUserControlV).Preview.Visibility = Visibility.Hidden 'DirectCast(Map.refSceneButtonV.m_PanelUC, SceneUserControlV).Preview.Visibility = Visibility.Hidden
End If End If
@@ -148,6 +158,8 @@ Public Class NewPanelVM
Else Else
EgtOutLog("CONFIG ERR: Il pulsante di Panel è stato definito come Button anziché ToggleButton") EgtOutLog("CONFIG ERR: Il pulsante di Panel è stato definito come Button anziché ToggleButton")
End If End If
' ricostruisco l'elenco dei part solid
SolidManagerM.CreatePartSolid()
' rimuovo lo UC dalla griglia ' rimuovo lo UC dalla griglia
Map.refSceneButtonVM.RemoveUC(Map.refSceneButtonVM.m_NewPanelUC) Map.refSceneButtonVM.RemoveUC(Map.refSceneButtonVM.m_NewPanelUC)
' gestisco le attivazioni di undo/redo ' gestisco le attivazioni di undo/redo
@@ -177,8 +189,8 @@ Public Class NewPanelVM
' setto le variabili per l'alzatina ' setto le variabili per l'alzatina
Dim dAngAlzatina As Double = 90 Dim dAngAlzatina As Double = 90
If EgtLuaSetGlobNumVar("TOOL.dPairAng", dAngAlzatina) Then AssLog("TOOL.dPairAng = " & dAngAlzatina.ToString()) If EgtLuaSetGlobNumVar("TOOL.dPairAng", dAngAlzatina) Then AssLog("TOOL.dPairAng = " & dAngAlzatina.ToString())
Dim nJunctionTypeAlz = 1 Dim nJunctionType As Integer = DirectCast(ParamList(5), _ComboBoxParam).IndexSelParamCmBx + 1
If EgtLuaSetGlobIntVar("TOOL.nJunctionType", nJunctionTypeAlz) Then AssLog("TOOL.nJunctionType = " & nJunctionTypeAlz.ToString()) If EgtLuaSetGlobIntVar("TOOL.nJunctionType", nJunctionType) Then AssLog("TOOL.nJunctionType = " & nJunctionType.ToString())
Dim bOnLoop As Boolean = False Dim bOnLoop As Boolean = False
If EgtLuaSetGlobBoolVar("TOOL.bOnLoop", bOnLoop) Then AssLog("TOOL.bOnLoop = false") If EgtLuaSetGlobBoolVar("TOOL.bOnLoop", bOnLoop) Then AssLog("TOOL.bOnLoop = false")
Dim bInsideLoop As Boolean = True Dim bInsideLoop As Boolean = True
@@ -193,16 +205,16 @@ Public Class NewPanelVM
' chiamo la funzione per la creazione ' chiamo la funzione per la creazione
If EgtLuaCallFunction("TOOL.CreateParetinaFull") Then AssLog("TOOL.CreateParetinaFull()") If EgtLuaCallFunction("TOOL.CreateParetinaFull") Then AssLog("TOOL.CreateParetinaFull()")
End Sub End Sub
Private Sub AddWaterfall(nId As Integer) Private Sub AddWaterfall(nId As Integer, Optional sInfoKey As String = "", Optional bInfoValue As Boolean = False)
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId)) Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
' setto l'indice del lato e il parent ' setto l'indice del lato e il parent
If EgtLuaSetGlobIntVar("TOOL.nEdgeId", nId) Then AssLog("TOOL.nEdgeId = " & nId.ToString()) If EgtLuaSetGlobIntVar("TOOL.nEdgeId", nId) Then AssLog("TOOL.nEdgeId = " & nId.ToString())
If EgtLuaSetGlobIntVar("TOOL.nParent", nPartId) Then AssLog("TOOL.nParent = " & nPartId.ToString()) If EgtLuaSetGlobIntVar("TOOL.nParent", nPartId) Then AssLog("TOOL.nParent = " & nPartId.ToString())
' setto le variabili per l'alzatina ' setto le variabili per il frontalino
Dim dAngFrontalino As Double = -90 Dim dAngFrontalino As Double = -90
If EgtLuaSetGlobNumVar("TOOL.dPairAng", dAngFrontalino) Then AssLog("TOOL.dPairAng = " & dAngFrontalino.ToString()) If EgtLuaSetGlobNumVar("TOOL.dPairAng", dAngFrontalino) Then AssLog("TOOL.dPairAng = " & dAngFrontalino.ToString())
Dim nJunctionTypeAlz = 3 Dim nJunctionType As Integer = DirectCast(ParamList(5), _ComboBoxParam).IndexSelParamCmBx + 1
If EgtLuaSetGlobIntVar("TOOL.nJunctionType", nJunctionTypeAlz) Then AssLog("TOOL.nJunctionType = " & nJunctionTypeAlz.ToString()) If EgtLuaSetGlobIntVar("TOOL.nJunctionType", nJunctionType) Then AssLog("TOOL.nJunctionType = " & nJunctionType.ToString())
Dim bOnLoop As Boolean = True Dim bOnLoop As Boolean = True
If EgtLuaSetGlobBoolVar("TOOL.bOnLoop", bOnLoop) Then AssLog("TOOL.bOnLoop = false") If EgtLuaSetGlobBoolVar("TOOL.bOnLoop", bOnLoop) Then AssLog("TOOL.bOnLoop = false")
Dim bInsideLoop As Boolean = True Dim bInsideLoop As Boolean = True
@@ -214,11 +226,16 @@ Public Class NewPanelVM
If EgtLuaSetGlobNumVar("TOOL.dH", dH) Then AssLog("TOOL.dH = " & dH.ToString()) If EgtLuaSetGlobNumVar("TOOL.dH", dH) Then AssLog("TOOL.dH = " & dH.ToString())
If EgtLuaSetGlobBoolVar("TOOL.bPrev", True) Then AssLog("TOOL.bPrev = true") If EgtLuaSetGlobBoolVar("TOOL.bPrev", True) Then AssLog("TOOL.bPrev = true")
If EgtLuaSetGlobBoolVar("TOOL.bNext", True) Then AssLog("TOOL.bNext = true") If EgtLuaSetGlobBoolVar("TOOL.bNext", True) Then AssLog("TOOL.bNext = true")
' se presente setto l'info addizionale
If sInfoKey <> String.Empty Then
If EgtLuaSetGlobStringVar("TOOL.tbInfo.InfoKey", sInfoKey) Then AssLog("TOOL.InfoKey = " & sInfoKey)
If EgtLuaSetGlobBoolVar("TOOL.tbInfo.InfoValue", bInfoValue) Then AssLog("TOOL.InfoKey = " & (bInfoValue.ToString()).ToLower())
End If
' chiamo la funzione per la creazione ' chiamo la funzione per la creazione
If EgtLuaCallFunction("TOOL.CreateParetinaFull") Then AssLog("TOOL.CreateParetinaFull()") If EgtLuaCallFunction("TOOL.CreateParetinaFull") Then AssLog("TOOL.CreateParetinaFull()")
End Sub End Sub
Private Sub AddSplitBottom(PartList As List(Of Integer)) Private Sub AddSplitBottom(PartList As List(Of Integer), Optional sInfoKey As String = "", Optional bInfoValue As Boolean = False)
If PartList.Count = 0 Then If PartList.Count = 0 Then
Close() Close()
Return Return
@@ -233,12 +250,17 @@ Public Class NewPanelVM
For i As Integer = 1 To lEdgeList.Count For i As Integer = 1 To lEdgeList.Count
EgtLuaSetGlobIntVar("TOOL.tbIdEdges." & i.ToString(), lEdgeList(i - 1).ToString()) EgtLuaSetGlobIntVar("TOOL.tbIdEdges." & i.ToString(), lEdgeList(i - 1).ToString())
Next Next
Dim dTh As Double = DirectCast(ParamList(7), _TextBoxParam).GetValue() Dim dTh As Double = DirectCast(ParamList(8), _TextBoxParam).GetValue()
EgtLuaSetGlobNumVar("TOOL.dTh", dTh) EgtLuaSetGlobNumVar("TOOL.dTh", dTh)
Dim dDiam As Double = DirectCast(ParamList(9), _TextBoxParam).GetValue() Dim dDiam As Double = DirectCast(ParamList(10), _TextBoxParam).GetValue()
EgtLuaSetGlobNumVar("TOOL.dDiamBore", dDiam) EgtLuaSetGlobNumVar("TOOL.dDiamBore", dDiam)
Dim dAng As Double = DirectCast(ParamList(8), _TextBoxParam).GetValue() Dim dAng As Double = DirectCast(ParamList(9), _TextBoxParam).GetValue()
EgtLuaSetGlobNumVar("TOOL.dSlopeAng", dAng) EgtLuaSetGlobNumVar("TOOL.dSlopeAng", dAng)
' se presente setto l'info addizionale
If sInfoKey <> String.Empty Then
If EgtLuaSetGlobStringVar("TOOL.tbInfo.InfoKey", sInfoKey) Then AssLog("TOOL.InfoKey = " & sInfoKey)
If EgtLuaSetGlobBoolVar("TOOL.tbInfo.InfoValue", bInfoValue) Then AssLog("TOOL.InfoKey = " & (bInfoValue.ToString()).ToLower())
End If
EgtLuaCallFunction("TOOL.CreateSplitBottom") EgtLuaCallFunction("TOOL.CreateSplitBottom")
End Sub End Sub
@@ -247,7 +269,7 @@ Public Class NewPanelVM
Dim nEdges As Integer = EgtGetGroupObjs(nInLoopLay) Dim nEdges As Integer = EgtGetGroupObjs(nInLoopLay)
Dim nEdge As Integer = EgtGetFirstInGroup(nInLoopLay) Dim nEdge As Integer = EgtGetFirstInGroup(nInLoopLay)
While nEdge <> GDB_ID.NULL While nEdge <> GDB_ID.NULL
AddWaterfall(nEdge) AddWaterfall(nEdge, "Sink", True)
nEdge = EgtGetNext(nEdge) nEdge = EgtGetNext(nEdge)
End While End While
' recupero le info dei part creati come frontalini dalle info del Parent ' recupero le info dei part creati come frontalini dalle info del Parent
@@ -277,7 +299,7 @@ Public Class NewPanelVM
WaterFallList.Add(EgtGetFirstNameInGroup(GDB_ID.ROOT, sPartName)) WaterFallList.Add(EgtGetFirstNameInGroup(GDB_ID.ROOT, sPartName))
Next Next
' ora che ho la lista dei frontalini posso creare lo split bottom ' ora che ho la lista dei frontalini posso creare lo split bottom
AddSplitBottom(WaterFallList) AddSplitBottom(WaterFallList, "Sink", True)
End Sub End Sub
#End Region ' Methods #End Region ' Methods
+2 -1
View File
@@ -1,3 +1,4 @@
Module PanelManagerM Imports EgtUILib.EgtInterface
Module PanelManagerM
End Module End Module
-2
View File
@@ -143,8 +143,6 @@ Public Class ProjManagerVM
Friend Sub OpenFile() Friend Sub OpenFile()
Map.refTopPanelVM.OpenProject("") Map.refTopPanelVM.OpenProject("")
SolidManagerM.CreatePartSolid()
EgtDraw()
End Sub End Sub
#End Region ' OpenFileCmd #End Region ' OpenFileCmd
+1
View File
@@ -278,6 +278,7 @@ Public Class MyPath
' Carico colore linea ' Carico colore linea
SetBrushFromRGBString(m_stroke, m_CurrPath.Stroke) SetBrushFromRGBString(m_stroke, m_CurrPath.Stroke)
' Carico spessore linea ' Carico spessore linea
If m_stroke_width < 5 Then m_stroke_width = 10
m_CurrPath.StrokeThickness = m_stroke_width m_CurrPath.StrokeThickness = m_stroke_width
' Applico l'opacità della superificie ' Applico l'opacità della superificie
m_CurrPath.Opacity = m_fill_opacity m_CurrPath.Opacity = m_fill_opacity
+57 -19
View File
@@ -17,6 +17,7 @@ Public Class SceneButtonVM
Public m_MoveUC As SceneUserControlV Public m_MoveUC As SceneUserControlV
Public m_NewPanelUC As SceneUserControlV Public m_NewPanelUC As SceneUserControlV
Public m_EditPanelUC As SceneUserControlV Public m_EditPanelUC As SceneUserControlV
Public m_EditTopKUC As SceneUserControlV
Public m_ParametricCompoUC As SceneUserControlV Public m_ParametricCompoUC As SceneUserControlV
Private m_TopListBtn As New List(Of SceneBtn) Private m_TopListBtn As New List(Of SceneBtn)
@@ -79,6 +80,16 @@ Public Class SceneButtonVM
End Set End Set
End Property End Property
Private m_ParametricListGroupBtn As New List(Of GroupSceneBtn)
Public Property ParametricListGroupBtn As List(Of GroupSceneBtn)
Get
Return m_ParametricListGroupBtn
End Get
Set(value As List(Of GroupSceneBtn))
m_ParametricListGroupBtn = value
End Set
End Property
Friend Enum TopPanel As Integer Friend Enum TopPanel As Integer
TOP_PANEL = 0 TOP_PANEL = 0
TOP_PANEL_1 = 1 TOP_PANEL_1 = 1
@@ -105,7 +116,8 @@ Public Class SceneButtonVM
Sub New() Sub New()
Map.SetRefSceneButtonVM(Me) Map.SetRefSceneButtonVM(Me)
LoadButtons() LoadButtons()
LoadGroupButtons() LoadGroupButtons(TOPPANELLIST_BTN, m_TopPanelListGroupBtn)
LoadGroupButtons("ParametricListBtn", m_ParametricListGroupBtn)
End Sub End Sub
#End Region ' Constructor #End Region ' Constructor
@@ -123,14 +135,14 @@ Public Class SceneButtonVM
SetButtonsLocation(BOTTOMCENTERLIST_BTN, m_BottomCenterListBtn) SetButtonsLocation(BOTTOMCENTERLIST_BTN, m_BottomCenterListBtn)
End Sub End Sub
Private Sub LoadGroupButtons() Private Sub LoadGroupButtons(NameList As String, GroupSceneBtnList As List(Of GroupSceneBtn))
Dim Index As Integer = 1 Dim Index As Integer = 1
Dim SubTitle As String = String.Empty Dim SubTitle As String = String.Empty
Dim sKeyTitle As String = TOPPANELLIST_BTN & "_" & Index.ToString() Dim sKeyTitle As String = NameList & "_" & Index.ToString()
While GetMainPrivateProfileString(sKeyTitle, ConstEgtStone3D.SUBTITLE, "", SubTitle) > 0 While GetMainPrivateProfileString(sKeyTitle, ConstEgtStone3D.SUBTITLE, "", SubTitle) > 0
SetGroupButtonsLocation(sKeyTitle, m_TopPanelListGroupBtn) SetGroupButtonsLocation(sKeyTitle, GroupSceneBtnList)
Index += 1 Index += 1
sKeyTitle = TOPPANELLIST_BTN & "_" & Index.ToString() sKeyTitle = NameList & "_" & Index.ToString()
End While End While
End Sub End Sub
@@ -214,6 +226,13 @@ Public Class SceneButtonVM
''' </summary> ''' </summary>
''' <param name="SceneUC">User control generico</param> ''' <param name="SceneUC">User control generico</param>
Public Sub LoadUC(SceneUC As SceneUserControlV) Public Sub LoadUC(SceneUC As SceneUserControlV)
If Not IsNothing(m_PairUC) Then RemoveUC(m_PairUC)
If Not IsNothing(m_RotateUC) Then RemoveUC(m_RotateUC)
If Not IsNothing(m_MoveUC) Then RemoveUC(m_MoveUC)
If Not IsNothing(m_NewPanelUC) Then RemoveUC(m_NewPanelUC)
If Not IsNothing(m_EditPanelUC) Then RemoveUC(m_EditPanelUC)
If Not IsNothing(m_EditTopKUC) Then RemoveUC(m_EditTopKUC)
If Not IsNothing(m_ParametricCompoUC) Then RemoveUC(m_ParametricCompoUC)
Grid.SetColumn(SceneUC, 0) Grid.SetColumn(SceneUC, 0)
Grid.SetRow(SceneUC, 0) Grid.SetRow(SceneUC, 0)
Grid.SetColumnSpan(SceneUC, 2) Grid.SetColumnSpan(SceneUC, 2)
@@ -227,6 +246,7 @@ Public Class SceneButtonVM
''' <param name="SceneUC">User control generico</param> ''' <param name="SceneUC">User control generico</param>
Friend Sub RemoveUC(SceneUC As SceneUserControlV) Friend Sub RemoveUC(SceneUC As SceneUserControlV)
Map.refSceneButtonV.MainGrid.Children.Remove(SceneUC) Map.refSceneButtonV.MainGrid.Children.Remove(SceneUC)
SceneUC = Nothing
End Sub End Sub
#End Region ' Methods #End Region ' Methods
@@ -439,8 +459,22 @@ Module SceneCmd
#Region "METHODS" #Region "METHODS"
Public Sub Exec(Flag) Public Function ExecFile(Flag As String, nVeinCtx As Integer, Optional dir As String = "") As Boolean
Dim nVeinCtx As Integer = Map.refSceneHostVM.MainScene.GetCtx() Dim bNewParametricExsists As Boolean = False
If Flag.Contains(".lua") Then
If IsNothing(Map.refSceneButtonVM.m_ParametricCompoUC) Then Map.refSceneButtonVM.m_ParametricCompoUC = New SceneUserControlV
Dim LocalParametricCompo As New ParametricCompoVM(Flag, nVeinCtx, dir)
If LocalParametricCompo.bFileExsist Then
Map.refSceneButtonVM.m_ParametricCompoUC.DataContext = LocalParametricCompo
Map.refSceneButtonVM.LoadUC(Map.refSceneButtonVM.m_ParametricCompoUC)
bNewParametricExsists = True
End If
End If
Return bNewParametricExsists
End Function
Public Function ExecMethod(Flag As String, nVeinCtx As Integer) As Boolean
Dim bNewMethodsExsists As Boolean = True
Select Case Flag Select Case Flag
Case EGT_AUTOPAIR Case EGT_AUTOPAIR
EgtSetCurrentContext(nVeinCtx) EgtSetCurrentContext(nVeinCtx)
@@ -483,23 +517,27 @@ Module SceneCmd
Case EGT_DELETE Case EGT_DELETE
SolidManagerM.Delete(Map.refSceneHostVM.m_nIdPart) SolidManagerM.Delete(Map.refSceneHostVM.m_nIdPart)
Map.refSceneHostVM.m_nIdPart = GDB_ID.NULL Map.refSceneHostVM.m_nIdPart = GDB_ID.NULL
Case EGT_RECTANGE
If IsNothing(Map.refSceneButtonVM.m_ParametricCompoUC) Then Map.refSceneButtonVM.m_ParametricCompoUC = New SceneUserControlV
Map.refSceneButtonVM.m_ParametricCompoUC.DataContext = New ParametricCompoVM(EGT_RECTANGE & ".lua")
Map.refSceneButtonVM.LoadUC(Map.refSceneButtonVM.m_ParametricCompoUC)
Case EGT_POLIGON
If IsNothing(Map.refSceneButtonVM.m_ParametricCompoUC) Then Map.refSceneButtonVM.m_ParametricCompoUC = New SceneUserControlV
Map.refSceneButtonVM.m_ParametricCompoUC.DataContext = New ParametricCompoVM(EGT_POLIGON & ".lua")
Map.refSceneButtonVM.LoadUC(Map.refSceneButtonVM.m_ParametricCompoUC)
Case EGT_ELLIPSE
If IsNothing(Map.refSceneButtonVM.m_ParametricCompoUC) Then Map.refSceneButtonVM.m_ParametricCompoUC = New SceneUserControlV
Map.refSceneButtonVM.m_ParametricCompoUC.DataContext = New ParametricCompoVM(EGT_ELLIPSE & ".lua")
Map.refSceneButtonVM.LoadUC(Map.refSceneButtonVM.m_ParametricCompoUC)
Case EGT_EDIT_PANEL Case EGT_EDIT_PANEL
If IsNothing(Map.refSceneButtonVM.m_EditPanelUC) Then Map.refSceneButtonVM.m_EditPanelUC = New SceneUserControlV If IsNothing(Map.refSceneButtonVM.m_EditPanelUC) Then Map.refSceneButtonVM.m_EditPanelUC = New SceneUserControlV
Map.refSceneButtonVM.m_EditPanelUC.DataContext = New EditPanelVM() Map.refSceneButtonVM.m_EditPanelUC.DataContext = New EditPanelVM()
Map.refSceneButtonVM.LoadUC(Map.refSceneButtonVM.m_EditPanelUC) Map.refSceneButtonVM.LoadUC(Map.refSceneButtonVM.m_EditPanelUC)
Case EGT_EDIT_TOPK
If IsNothing(Map.refSceneButtonVM.m_EditTopKUC) Then Map.refSceneButtonVM.m_EditTopKUC = New SceneUserControlV
Map.refSceneButtonVM.m_EditTopKUC.DataContext = New EditTopKitchenVM()
Map.refSceneButtonVM.LoadUC(Map.refSceneButtonVM.m_EditTopKUC)
Case Else
EgtOutLog("La chiamata del metodo '" & Flag & "' non è andata a buon fine")
bNewMethodsExsists = False
End Select End Select
Return bNewMethodsExsists
End Function
Public Sub Exec(Flag As String)
Dim nVeinCtx As Integer = Map.refSceneHostVM.MainScene.GetCtx()
If Not ExecFile(Flag, nVeinCtx) Then
ExecMethod(Flag, nVeinCtx)
End If
End Sub End Sub
Friend Sub Undo() Friend Sub Undo()
+37 -3
View File
@@ -358,7 +358,8 @@ Public Class MySceneHostVM
.Title = EgtMsg(110013), ' Salva .Title = EgtMsg(110013), ' Salva
.Filter = "New geometry EgalTech(*.nge)|*.nge" & .Filter = "New geometry EgalTech(*.nge)|*.nge" &
"|vme files (*.vme)|*.vme", "|vme files (*.vme)|*.vme",
.FilterIndex = 1, .FileName = sFile,
.FilterIndex = 2,
.InitialDirectory = sDir, .InitialDirectory = sDir,
.ValidateNames = False, .ValidateNames = False,
.OverwritePrompt = True, .OverwritePrompt = True,
@@ -443,6 +444,29 @@ Public Class MySceneHostVM
Return bOk Return bOk
End Function End Function
Public Function SaveProj(sCurrFile As String, Optional nType As NGE = NGE.CMPTEXT) As Boolean
If String.IsNullOrWhiteSpace(sCurrFile) Or EgtGetFileType(sCurrFile) <> FT.LUA Then
Return SaveAsProject()
Else
' Reset controller and scene
MainController.ResetStatus(False)
' Before saving
OnSavingProject(Me, sCurrFile)
' Project saving
Cursor.Current = Cursors.WaitCursor
EgtEnableCommandLogger()
Dim bOk As Boolean = EgtSaveFile(sCurrFile, nType)
EgtDisableCommandLogger()
' Update
UpdateUI(Me, False)
Cursor.Current = Cursors.Default
' Result handling
Map.refSceneHostVM.OnSavedProject(Me, sCurrFile, bOk)
Return bOk
End If
End Function
Friend Sub StatusUnitsCommand() Friend Sub StatusUnitsCommand()
OptionModule.m_bMmUnits = Not OptionModule.m_bMmUnits OptionModule.m_bMmUnits = Not OptionModule.m_bMmUnits
Map.refGridPanelVM.UpdateStatusUnits(OptionModule.m_bMmUnits) Map.refGridPanelVM.UpdateStatusUnits(OptionModule.m_bMmUnits)
@@ -565,7 +589,6 @@ Public Class MySceneHostVM
Map.refOptionWindowVM.UpdateAllMessages() Map.refOptionWindowVM.UpdateAllMessages()
End Sub End Sub
Private Sub OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Private Sub OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
OnMouseOver(sender, e, m_SelType) OnMouseOver(sender, e, m_SelType)
' Se drag non abilitato o già in esecuzione, esco ' Se drag non abilitato o già in esecuzione, esco
@@ -983,6 +1006,12 @@ Line1:
Continue While Continue While
End If End If
If Map.refSceneButtonVM.IsTgBtnChecked(EGT_EDIT_PANEL) Then
Dim PartSolidId As Integer = nPartId
If sName = "SOLID" Then EgtGetInfo(nPartId, "Parent", PartSolidId)
DirectCast(Map.refSceneButtonVM.m_EditPanelUC.DataContext, EditPanelVM).nIdPart = PartSolidId
End If
' selezione semplice ' selezione semplice
If EgtIsPart(nPartId) Then If EgtIsPart(nPartId) Then
Dim nStat As Integer = GDB_ST.ON_ Dim nStat As Integer = GDB_ST.ON_
@@ -1090,7 +1119,12 @@ Line1:
' WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ' WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
' WARNING WARNING WARNING WARNING WARNING WARNING ' questo controllo è stato tolto per poter selezionare gli oggetti importati nel vme e quindi non presenti nel nesting ' WARNING WARNING WARNING WARNING WARNING WARNING ' questo controllo è stato tolto per poter selezionare gli oggetti importati nel vme e quindi non presenti nel nesting
'If bSelected Then 'If bSelected Then
PartSolidIdToSel.SelectPart() If Map.refSceneButtonVM.IsTgBtnChecked(EGT_EDIT_PANEL) Then
DirectCast(Map.refSceneButtonVM.m_EditPanelUC.DataContext, EditPanelVM).SelectPartOrPartsToEdit()
Else
PartSolidIdToSel.SelectPart()
End If
'End If 'End If
' Se deselezione da eseguire ' Se deselezione da eseguire
ElseIf m_nIdToDesel <> GDB_ID.NULL Then ElseIf m_nIdToDesel <> GDB_ID.NULL Then
+1
View File
@@ -56,6 +56,7 @@
Style="{StaticResource SceneUserControl_TxBl}"/> Style="{StaticResource SceneUserControl_TxBl}"/>
<ComboBox ItemsSource="{Binding ParamCmBxList}" <ComboBox ItemsSource="{Binding ParamCmBxList}"
SelectedItem="{Binding SelParamCmBx}" SelectedItem="{Binding SelParamCmBx}"
SelectedIndex="{Binding IndexSelParamCmBx}"
DisplayMemberPath="Name" DisplayMemberPath="Name"
IsEnabled="{Binding IsEnabled}"/> IsEnabled="{Binding IsEnabled}"/>
</UniformGrid> </UniformGrid>
+12
View File
@@ -354,6 +354,18 @@ Public Class _ComboBoxParam
m_SelParamCmBx = value m_SelParamCmBx = value
RaiseEvent SelectionChanged(Me, m_SelParamCmBx) RaiseEvent SelectionChanged(Me, m_SelParamCmBx)
NotifyPropertyChanged(NameOf(SelParamCmBx)) NotifyPropertyChanged(NameOf(SelParamCmBx))
IndexSelParamCmBx = ParamCmBxList.FindIndex(Function(x As ParamCmBx) x.Name = m_SelParamCmBx.Name)
End Set
End Property
Private m_IndexSelParamCmBx As Integer = 0
Public Property IndexSelParamCmBx As Integer
Get
Return m_IndexSelParamCmBx
End Get
Set(value As Integer)
m_IndexSelParamCmBx = value
NotifyPropertyChanged(NameOf(IndexSelParamCmBx))
End Set End Set
End Property End Property
+151
View File
@@ -0,0 +1,151 @@
<EgtWPFLib5:EgtMainWindow x:Class="ScriptWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtStone3D="clr-namespace:EgtStone3D"
Title="{Binding Title}"
Icon="/Resources/EgalwareLogo.ico"
WindowStartupLocation="CenterOwner"
PreviewKeyDown="EgtMainWindow_PreviewKeyDown"
Style="{StaticResource ScriptWindowV_Window}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBox Text="{Binding sNameFile}"
Style="{StaticResource Script_TxBx}"/>
<Border Grid.Row="1"
Style="{StaticResource ScriptWindow_Border}">
<WrapPanel Style="{StaticResource WrapScript_WrapPanel}">
<ComboBox ItemsSource="{Binding FontFamilyList}"
SelectedItem="{Binding SelFontFamily}"
Style="{StaticResource ScriptWindow_CmBx}"/>
<ComboBox ItemsSource="{Binding FontSizeList}"
SelectedItem="{Binding SelFontSize}"
Style="{StaticResource ScriptWindow_CmBx}"/>
<Button Content="CT"
Command="ApplicationCommands.Cut"
CommandTarget="{Binding ElementName=sNameFile_RichTxBx}"
Style="{StaticResource ScriptWindow_Btn}"/>
<Button Content="CP"
Command="ApplicationCommands.Copy"
CommandTarget="{Binding ElementName=sNameFile_RichTxBx}"
Style="{StaticResource ScriptWindow_Btn}"/>
<Button Content="P"
Command="ApplicationCommands.Paste"
CommandTarget="{Binding ElementName=sNameFile_RichTxBx}"
Style="{StaticResource ScriptWindow_Btn}"/>
<Button Content="U"
Command="ApplicationCommands.Undo"
CommandTarget="{Binding ElementName=sNameFile_RichTxBx}"
Style="{StaticResource ScriptWindow_Btn}"/>
<Button Content="R"
Command="ApplicationCommands.Redo"
CommandTarget="{Binding ElementName=sNameFile_RichTxBx}"
Style="{StaticResource ScriptWindowEnd_Btn}"/>
<Separator Style="{StaticResource Script_Separator}"/>
<Button Content="C"
Command="{Binding TextColorCmd}"
Style="{StaticResource Script_InputButton}"/>
<Separator Style="{StaticResource Script_Separator}"/>
<ToggleButton Content="B"
Command="EditingCommands.ToggleBold"
CommandTarget="{Binding ElementName=sNameFile_RichTxBx}"
IsChecked="{Binding BoldIsChecked}"
Style="{StaticResource General_ToogleButton}"/>
<ToggleButton Content="IT"
Command="EditingCommands.ToggleItalic"
CommandTarget="{Binding ElementName=sNameFile_RichTxBx}"
IsChecked="{Binding ItalicIsChecked}"
Style="{StaticResource General_ToogleButton}"/>
<ToggleButton Content="U"
Command="EditingCommands.ToggleUnderline"
CommandTarget="{Binding ElementName=sNameFile_RichTxBx}"
IsChecked="{Binding UnderlineChecked}"
Style="{StaticResource General_ToogleButton}"/>
<Separator Style="{StaticResource Script_Separator}"/>
<ToggleButton Command="EditingCommands.AlignLeft"
CommandTarget="{Binding ElementName=sNameFile_RichTxBx}"
IsChecked="{Binding LeftIsChecked}"
Style="{StaticResource ScriptToggleButton}">
<EgtStone3D:SVGV FileSource="{Binding FileAlignLeftSVG, UpdateSourceTrigger=PropertyChanged}"/>
</ToggleButton>
<ToggleButton Command="EditingCommands.AlignCenter"
CommandTarget="{Binding ElementName=sNameFile_RichTxBx}"
IsChecked="{Binding CenterIsChecked}"
Style="{StaticResource ScriptToggleButton1}">
<EgtStone3D:SVGV FileSource="{Binding FileAlignCenterSVG, UpdateSourceTrigger=PropertyChanged}"/>
</ToggleButton>
<ToggleButton Command="EditingCommands.AlignJustify"
CommandTarget="{Binding ElementName=sNameFile_RichTxBx}"
IsChecked="{Binding JustifyIsChecked}"
Style="{StaticResource ScriptToggleButton1}">
<EgtStone3D:SVGV FileSource="{Binding FileAlignJustifySVG, UpdateSourceTrigger=PropertyChanged}"/>
</ToggleButton>
<Separator Style="{StaticResource Script_Separator}"/>
<Button Content="II"
Command="EditingCommands.IncreaseIndentation"
CommandTarget="{Binding ElementName=sNameFile_RichTxBx}"
Style="{StaticResource ScriptWindow_Btn}"/>
<Button Content="DE"
Command="EditingCommands.DecreaseIndentation"
CommandTarget="{Binding ElementName=sNameFile_RichTxBx}"
Style="{StaticResource ScriptWindowEnd_Btn}"/>
</WrapPanel>
</Border>
<!--<TextBox Grid.Row="1"
Height="300"
AcceptsReturn="True"
TextWrapping="Wrap"
Text="{Binding sRichTextParagraph}"
Style="{StaticResource Script_TxBx}"/>-->
<RichTextBox Grid.Row="2"
Name="sNameFile_RichTxBx"
TextChanged="sNameFile_RichTxBx_TextChanged"
PreviewKeyDown="sNameFile_RichTxBx_PreviewKeyDown"
Style="{StaticResource Script_RichTxBx}">
<FlowDocument Name="FDocumentFile">
<Paragraph>
<Run Text="{Binding sRichTextParagraph, Mode=TwoWay}"/>
</Paragraph>
</FlowDocument>
</RichTextBox>
<Grid Grid.Row="3"
Style="{StaticResource SceneUserControl_Grid}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Name="Conferma"
IsDefault="True"
Content="{Binding Conferma_Msg}"
Command="{Binding ConfermaCmd}"
Style="{StaticResource Ok_Btn}"/>
<Button Grid.Column="1"
Name="Preview"
Content="{Binding Salva_Msg}"
Command="{Binding SalvaCmd}"
Style="{StaticResource Preview_Btn}"/>
<Button Grid.Column="2"
Name="Annulla"
IsCancel="True"
Content="{Binding Annulla_Msg}"
Command="{Binding AnnullaCmd}"
Style="{StaticResource Cancel_Btn}"/>
</Grid>
</Grid>
</EgtWPFLib5:EgtMainWindow>
+41
View File
@@ -0,0 +1,41 @@
Public Class ScriptWindowV
#Region "CONSTRUCTOR"
Sub New()
' La chiamata è richiesta dalla finestra di progettazione.
InitializeComponent()
' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent().
Map.SetRefScriptWindowV(Me)
End Sub
#End Region ' Constructor
#Region "EVENTS"
Private Sub EgtMainWindow_PreviewKeyDown(sender As Object, e As KeyEventArgs)
If e.Key = Key.Escape Then
Annulla.IsCancel = True
End If
End Sub
Private Sub sNameFile_RichTxBx_TextChanged(sender As Object, e As TextChangedEventArgs)
Map.refScriptWindowVM.ChangeTextColor()
End Sub
Private Sub sNameFile_RichTxBx_SelectionChanged(sender As Object, e As RoutedEventArgs)
If Not IsNothing(Map.refScriptWindowVM) Then Map.refScriptWindowVM.SetToolbar()
End Sub
Private Sub sNameFile_RichTxBx_PreviewKeyDown(sender As Object, e As KeyEventArgs)
If e.Key = Key.Enter Then
Map.refScriptWindowVM.InsertText(sNameFile_RichTxBx, vbCrLf)
e.Handled = True
End If
End Sub
#End Region ' Events
End Class
+672
View File
@@ -0,0 +1,672 @@
Imports EgtUILib
Imports EgtWPFLib5
Imports System.IO
Imports System.Runtime.CompilerServices
Imports System.Text
Public Class ScriptWindowVM
Inherits VMBase
#Region "FIELD & PROPERTIES"
Friend m_bTextHasChanged As Boolean = False
Private m_sNameFile As String = String.Empty
Public Property sNameFile As String
Get
Return m_sNameFile
End Get
Set(value As String)
m_sNameFile = value
NotifyPropertyChanged(NameOf(sNameFile))
End Set
End Property
Private m_sRichTextParagraph As String = String.Empty
Public Property sRichTextParagraph As String
Get
Return m_sRichTextParagraph
End Get
Set(value As String)
m_sRichTextParagraph = value
NotifyPropertyChanged(NameOf(sRichTextParagraph))
End Set
End Property
Private m_nFontSizeList As New List(Of Integer)
Public Property FontSizeList As List(Of Integer)
Get
Return m_nFontSizeList
End Get
Set(value As List(Of Integer))
m_nFontSizeList = value
NotifyPropertyChanged(NameOf(FontSizeList))
End Set
End Property
Private m_nSelFontSize As Integer
Public Property SelFontSize As Integer
Get
Return m_nSelFontSize
End Get
Set(value As Integer)
m_nSelFontSize = value
If Not IsNothing(m_nSelFontSize) Then ChangeFontSize(m_nSelFontSize)
NotifyPropertyChanged(NameOf(SelFontSize))
End Set
End Property
Friend Sub SetSelFontSize(value As Integer)
m_nSelFontSize = value
NotifyPropertyChanged(NameOf(SelFontSize))
End Sub
Private m_sFontFamilyList As New List(Of FontFamily)
Public Property FontFamilyList As List(Of FontFamily)
Get
Return m_sFontFamilyList
End Get
Set(value As List(Of FontFamily))
m_sFontFamilyList = value
NotifyPropertyChanged(NameOf(FontFamilyList))
End Set
End Property
Private m_sSelFontFamily As FontFamily
Public Property SelFontFamily As FontFamily
Get
Return m_sSelFontFamily
End Get
Set(value As FontFamily)
m_sSelFontFamily = value
If Not IsNothing(m_sSelFontFamily) Then ChangeFontFamily(m_sSelFontFamily)
NotifyPropertyChanged(NameOf(SelFontFamily))
End Set
End Property
Friend Sub SetSelFontFamily(value As FontFamily)
m_sSelFontFamily = value
NotifyPropertyChanged(NameOf(SelFontFamily))
End Sub
Private m_bBoldIsChecked As Boolean = False
Public Property BoldIsChecked As Boolean
Get
Return m_bBoldIsChecked
End Get
Set(value As Boolean)
m_bBoldIsChecked = value
NotifyPropertyChanged(NameOf(BoldIsChecked))
End Set
End Property
Private m_bItalicIsChecked As Boolean = False
Public Property ItalicIsChecked As Boolean
Get
Return m_bItalicIsChecked
End Get
Set(value As Boolean)
m_bItalicIsChecked = value
NotifyPropertyChanged(NameOf(ItalicIsChecked))
End Set
End Property
Private m_bUnderlineChecked As Boolean = False
Public Property UnderlineChecked As Boolean
Get
Return m_bUnderlineChecked
End Get
Set(value As Boolean)
m_bUnderlineChecked = value
NotifyPropertyChanged(NameOf(UnderlineChecked))
End Set
End Property
Private m_bLeftIsChecked As Boolean = False
Public Property LeftIsChecked As Boolean
Get
Return m_bLeftIsChecked
End Get
Set(value As Boolean)
m_bLeftIsChecked = value
SetCenterIsChecked(False)
SetJustifyIsChecked(False)
NotifyPropertyChanged(NameOf(LeftIsChecked))
End Set
End Property
Friend Sub SetLeftIsChecked(value As Boolean)
m_bLeftIsChecked = value
NotifyPropertyChanged(NameOf(LeftIsChecked))
End Sub
Private m_bCenterIsChecked As Boolean = False
Public Property CenterIsChecked As Boolean
Get
Return m_bCenterIsChecked
End Get
Set(value As Boolean)
m_bCenterIsChecked = value
SetLeftIsChecked(False)
SetJustifyIsChecked(False)
NotifyPropertyChanged(NameOf(CenterIsChecked))
End Set
End Property
Friend Sub SetCenterIsChecked(value As Boolean)
m_bCenterIsChecked = value
NotifyPropertyChanged(NameOf(CenterIsChecked))
End Sub
Private m_bJustifyIsChecked As Boolean = False
Public Property JustifyIsChecked As Boolean
Get
Return m_bJustifyIsChecked
End Get
Set(value As Boolean)
m_bJustifyIsChecked = value
SetLeftIsChecked(False)
SetCenterIsChecked(False)
NotifyPropertyChanged(NameOf(JustifyIsChecked))
End Set
End Property
Friend Sub SetJustifyIsChecked(value As Boolean)
m_bJustifyIsChecked = value
NotifyPropertyChanged(NameOf(JustifyIsChecked))
End Sub
Private m_FileAlignLeftSVG As String = String.Empty
Public Property FileAlignLeftSVG As String
Get
Return m_FileAlignLeftSVG
End Get
Set(value As String)
m_FileAlignLeftSVG = value
NotifyPropertyChanged(NameOf(FileAlignLeftSVG))
End Set
End Property
Friend Sub SetFileAlignLeftSVG(sFileAlignLeftSVG As String)
m_FileAlignLeftSVG = sFileAlignLeftSVG
NotifyPropertyChanged(NameOf(FileAlignLeftSVG))
End Sub
Private m_FileAlignCenterSVG As String = String.Empty
Public Property FileAlignCenterSVG As String
Get
Return m_FileAlignCenterSVG
End Get
Set(value As String)
m_FileAlignCenterSVG = value
NotifyPropertyChanged(NameOf(FileAlignCenterSVG))
End Set
End Property
Friend Sub SetFileAlignCenterSVG(sFileAlignCenterSVG As String)
m_FileAlignCenterSVG = sFileAlignCenterSVG
NotifyPropertyChanged(NameOf(FileAlignCenterSVG))
End Sub
Private m_FileAlignJustifySVG As String = String.Empty
Public Property FileAlignJustifySVG As String
Get
Return m_FileAlignJustifySVG
End Get
Set(value As String)
m_FileAlignJustifySVG = value
NotifyPropertyChanged(NameOf(FileAlignJustifySVG))
End Set
End Property
Friend Sub SetFileAlignJustifySVG(sFileAlignJustifySVG As String)
m_FileAlignJustifySVG = sFileAlignJustifySVG
NotifyPropertyChanged(NameOf(FileAlignJustifySVG))
End Sub
#Region "Messages"
Public ReadOnly Property Title As String
Get
Return "Script File" ' Opzioni
End Get
End Property
Public ReadOnly Property Conferma_Msg As String
Get
Return EgtMsg(110003) ' Conferma
End Get
End Property
Public ReadOnly Property Salva_Msg As String
Get
Return EgtMsg(110013) ' Salva
End Get
End Property
Public ReadOnly Property Annulla_Msg As String
Get
Return EgtMsg(110004) ' Annulla
End Get
End Property
#End Region ' Messages
' Definizione Comandi
Private m_ConfermaCmd As ICommand
Private m_cmdSaveAs As ICommand
Private m_cmdAnnulla As ICommand
Private m_cmdTextColor As ICommand
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Sub New()
Map.SetRefScriptWindowVM(Me)
If m_nFontSizeList.Count <= 0 Then CreateFontSizeList()
If m_sFontFamilyList.Count <= 0 Then CreateFontFamilyList()
SetToolbar()
SetFileAlignLeftSVG(Map.refMainWindowVM.MainWindowM.sResourcesDir & "\alignleft.svg")
SetFileAlignCenterSVG(Map.refMainWindowVM.MainWindowM.sResourcesDir & "\aligncenter.svg")
SetFileAlignJustifySVG(Map.refMainWindowVM.MainWindowM.sResourcesDir & "\alignjustify.svg")
End Sub
#End Region ' Constructor
#Region "METHODS"
Public Function SaveProject() As Boolean
Dim sFile As String = ""
Dim sFileName As String = ""
' Se nome vuoto, assegno "New"
If String.IsNullOrWhiteSpace(m_sNameFile) Then
sFile = "New.lua"
Else
sFile = m_sNameFile & ".lua"
End If
' Eventuale sistemazione estensione
sFile = IO.Path.ChangeExtension(sFile, "lua")
' Assegnazione nome file con dialogo
Dim SaveFileDialog As New EgtManageFileDialogV(Application.Current.MainWindow, New EgtManageFileDialogVM()) With {
.Title = EgtMsg(110013), ' Salva
.Filter = "lua files (*.lua)|*.lua",
.FileName = sFile,
.FilterIndex = 1,
.InitialDirectory = Map.refMainWindowVM.MainWindowM.sTempDir,
.ValidateNames = False,
.OverwritePrompt = True,
.Mode = 1
}
If SaveFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
If Path.GetExtension(SaveFileDialog.SafeFileName).Equals(String.Empty) Then
sFileName = SaveFileDialog.InitialDirectory & "\" & SaveFileDialog.SafeFileName & SaveFileDialog.SelFilter.sExstension.Trim("*"c)
Else
sFileName = SaveFileDialog.InitialDirectory & "\" & SaveFileDialog.SafeFileName
End If
End If
Dim bOk = Map.refSceneHostVM.SaveProj(sFileName)
File.WriteAllText(sFileName, m_sRichTextParagraph)
' Imposto stato gestione mouse diretto della scena a nessuno
Map.refSceneHostVM.MainScene.SetStatusNull()
Return True
End Function
Private Sub SaveScript(sPathFileScript As String, sRichTextParagraph As String)
Map.refSceneHostVM.SaveProj(sPathFileScript)
File.WriteAllText(sPathFileScript, sRichTextParagraph, Encoding.UTF8)
End Sub
Public Function RichTextBox(sPathFileScript As String) As String
' Recupero richtextbox
Dim myRichTextBox As RichTextBox = Map.refScriptWindowV.sNameFile_RichTxBx
' Recupero flowdocument
Dim myFlowDoc As FlowDocument = Map.refScriptWindowV.FDocumentFile
' Assegno al richtextbox il flowdocument
myRichTextBox.Document = myFlowDoc
' Leggo il richtextbox dall'inizio alla fine
Dim textRange As New TextRange(myRichTextBox.Document.ContentStart, myRichTextBox.Document.ContentEnd)
Return textRange.Text
End Function
Private Sub CreateFontSizeList()
For Size As Integer = 8 To 20
If Size Mod 2 = 0 Then
m_nFontSizeList.Add(Size)
End If
Next
End Sub
''' <summary>
''' Funzione che permette di cambiare la dimensione della font
''' </summary>
''' <param name="nSelFontSize">fontsize selezionata</param>
Private Sub ChangeFontSize(nSelFontSize As Integer)
If nSelFontSize = GDB_ID.NULL Then Return
Dim pixelSize As Double = Convert.ToDouble(nSelFontSize) * (96 / 72)
Dim textRange = New TextRange(Map.refScriptWindowV.sNameFile_RichTxBx.Selection.Start, Map.refScriptWindowV.sNameFile_RichTxBx.Selection.[End])
textRange.ApplyPropertyValue(TextElement.FontSizeProperty, pixelSize)
End Sub
Private Sub CreateFontFamilyList()
For Each FontFamily As FontFamily In Fonts.SystemFontFamilies
m_sFontFamilyList.Add(FontFamily)
Next
End Sub
Private Sub ChangeFontFamily(sSelFontFamily As FontFamily)
If sSelFontFamily Is Nothing Then Return
Dim fontFamily As String = sSelFontFamily.ToString()
Dim textRange = New TextRange(Map.refScriptWindowV.sNameFile_RichTxBx.Selection.Start, Map.refScriptWindowV.sNameFile_RichTxBx.Selection.[End])
textRange.ApplyPropertyValue(TextElement.FontFamilyProperty, fontFamily)
End Sub
Friend Sub SetToolbar()
Dim textRange = New TextRange(Map.refScriptWindowV.sNameFile_RichTxBx.Selection.Start, Map.refScriptWindowV.sNameFile_RichTxBx.Selection.[End])
Dim fontFamily As Object = textRange.GetPropertyValue(TextElement.FontFamilyProperty)
SetSelFontFamily(fontFamily)
Dim fontSize As Object = textRange.GetPropertyValue(TextElement.FontSizeProperty)
SetSelFontSize(fontSize)
If Not String.IsNullOrEmpty(textRange.Text) Then
m_bBoldIsChecked = textRange.GetPropertyValue(TextElement.FontWeightProperty).Equals(FontWeights.Bold)
m_bItalicIsChecked = textRange.GetPropertyValue(TextElement.FontStyleProperty).Equals(FontStyles.Italic)
m_bUnderlineChecked = textRange.GetPropertyValue(Inline.TextDecorationsProperty).Equals(TextDecorations.Underline)
End If
m_bLeftIsChecked = textRange.GetPropertyValue(FlowDocument.TextAlignmentProperty).Equals(TextAlignment.Left)
m_bCenterIsChecked = textRange.GetPropertyValue(FlowDocument.TextAlignmentProperty).Equals(TextAlignment.Center)
m_bJustifyIsChecked = textRange.GetPropertyValue(FlowDocument.TextAlignmentProperty).Equals(TextAlignment.Justify)
End Sub
Public Sub InsertText(ByVal sRichTextBox As RichTextBox, ByVal content As String)
If Not String.IsNullOrEmpty(content) Then
sRichTextBox?.BeginChange()
If Not String.IsNullOrEmpty(sRichTextBox.Selection.Text) Then
sRichTextBox.Selection.Text = String.Empty
End If
Dim textPointer As TextPointer = sRichTextBox.CaretPosition.GetPositionAtOffset(0, LogicalDirection.Forward)
sRichTextBox.CaretPosition.InsertTextInRun(content)
sRichTextBox.CaretPosition = textPointer
sRichTextBox.EndChange()
Keyboard.Focus(sRichTextBox)
End If
End Sub
Public Sub TextSearchAndColor(rtb As RichTextBox, find As String, Color As SolidColorBrush, fontWeight As FontWeight, fontStyle As FontStyle, fontSize As Integer)
Dim searchRange As New TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd)
While (FindTextInRange(searchRange, find) IsNot Nothing)
Dim found As TextRange = FindTextInRange(searchRange, find)
found.ApplyPropertyValue(TextElement.ForegroundProperty, Color)
' Seleziono la font weight
SelectFontWeight(fontWeight, found)
' Seleziono lo stile
SelectFontStyle(fontStyle, found)
' Seleziono la dimensione del testo
SelectFontSize(fontSize, found)
searchRange = New TextRange(found.End, rtb.Document.ContentEnd)
End While
End Sub
Public Function FindTextInRange(searchRange As TextRange, searchText As String) As TextRange
Dim result As TextRange = Nothing
Dim offset As Integer = searchRange.Text.IndexOf(searchText, StringComparison.OrdinalIgnoreCase)
If offset >= 0 Then
Dim start As TextPointer = GetTextPositionAtOffset(searchRange.Start, offset)
result = New TextRange(start, GetTextPositionAtOffset(start, searchText.Length))
End If
Return result
End Function
Public Function GetTextPositionAtOffset(ByVal position As TextPointer, ByVal offset As Integer) As TextPointer
Dim current As TextPointer = position
While current IsNot Nothing
position = current
Dim adjacent = position.GetAdjacentElement(LogicalDirection.Forward)
Dim context = position.GetPointerContext(LogicalDirection.Forward)
Select Case context
Case TextPointerContext.Text
Dim count As Integer = position.GetTextRunLength(LogicalDirection.Forward)
If offset <= count Then
Return position.GetPositionAtOffset(offset)
End If
offset -= count
Case TextPointerContext.ElementStart
If TypeOf adjacent Is InlineUIContainer Then offset -= 1
Case TextPointerContext.ElementEnd
If TypeOf adjacent Is Paragraph Then offset -= 2
End Select
current = position.GetNextContextPosition(LogicalDirection.Forward)
End While
Return position
End Function
Private Sub SelectFontWeight(fontWeight As FontWeight, found As TextRange)
Select Case fontWeight
Case FontWeights.Thin
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Thin)
Case FontWeights.Medium
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Medium)
Case FontWeights.Regular
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Regular)
Case FontWeights.Normal
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Normal)
Case FontWeights.Heavy
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Heavy)
Case FontWeights.Light
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Light)
Case FontWeights.ExtraLight
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.ExtraLight)
Case FontWeights.UltraLight
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.UltraLight)
Case FontWeights.Black
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Black)
Case FontWeights.ExtraBlack
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.ExtraBlack)
Case FontWeights.UltraBlack
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.UltraBlack)
Case FontWeights.Bold
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold)
Case FontWeights.DemiBold
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.DemiBold)
Case FontWeights.SemiBold
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.SemiBold)
Case FontWeights.ExtraBold
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.ExtraBold)
Case FontWeights.UltraBold
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.UltraBold)
Case Else
found.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Normal)
End Select
End Sub
Private Sub SelectFontStyle(fontStyle As FontStyle, found As TextRange)
Select Case fontStyle
Case FontStyles.Normal
found.ApplyPropertyValue(TextElement.FontStyleProperty, FontStyles.Normal)
Case FontStyles.Italic
found.ApplyPropertyValue(TextElement.FontStyleProperty, FontStyles.Italic)
Case FontStyles.Oblique
found.ApplyPropertyValue(TextElement.FontStyleProperty, FontStyles.Oblique)
Case Else
found.ApplyPropertyValue(TextElement.FontStyleProperty, FontStyles.Normal)
End Select
End Sub
Private Sub SelectFontSize(fontSize As Integer, found As TextRange)
Select Case fontSize
Case FontSizeList(0) ' 8
found.ApplyPropertyValue(TextElement.FontSizeProperty, Convert.ToDouble(FontSizeList(0)) * (96 / 72)) ' 8
Case FontSizeList(1) ' 10
found.ApplyPropertyValue(TextElement.FontSizeProperty, Convert.ToDouble(FontSizeList(1)) * (96 / 72)) ' 10
Case FontSizeList(2) ' 12
found.ApplyPropertyValue(TextElement.FontSizeProperty, Convert.ToDouble(FontSizeList(2)) * (96 / 72)) ' 12
Case FontSizeList(3) ' 14
found.ApplyPropertyValue(TextElement.FontSizeProperty, Convert.ToDouble(FontSizeList(3)) * (96 / 72)) ' 14
Case FontSizeList(4) ' 16
found.ApplyPropertyValue(TextElement.FontSizeProperty, Convert.ToDouble(FontSizeList(4)) * (96 / 72)) ' 16
Case FontSizeList(5) ' 18
found.ApplyPropertyValue(TextElement.FontSizeProperty, Convert.ToDouble(FontSizeList(5)) * (96 / 72)) ' 18
Case FontSizeList(6) ' 20
found.ApplyPropertyValue(TextElement.FontSizeProperty, Convert.ToDouble(FontSizeList(6)) * (96 / 72)) ' 20
Case Else
found.ApplyPropertyValue(TextElement.FontSizeProperty, Convert.ToDouble(FontSizeList(2)) * (96 / 72)) ' 12
End Select
End Sub
Public Sub ResetStyleRichText()
Map.refScriptWindowV.sNameFile_RichTxBx.Selection.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Black)
Map.refScriptWindowV.sNameFile_RichTxBx.Selection.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Normal)
Map.refScriptWindowV.sNameFile_RichTxBx.Selection.ApplyPropertyValue(TextElement.FontStyleProperty, FontStyles.Normal)
Map.refScriptWindowV.sNameFile_RichTxBx.Selection.ApplyPropertyValue(TextElement.FontSizeProperty, Convert.ToDouble(FontSizeList(2)) * (96 / 72))
End Sub
Public Sub ChangeTextColor()
Dim sNameRichTxBx As New TextRange(Map.refScriptWindowV.sNameFile_RichTxBx.Document.ContentStart, Map.refScriptWindowV.sNameFile_RichTxBx.Document.ContentEnd)
Dim sNameRichTxBxArray As String() = sNameRichTxBx.Text.Split(vbCrLf)
Dim sNameRichTxBxList As New List(Of String)
For Each NameRichTxBx As String In sNameRichTxBxArray
Dim NameRichTxBxTrim As String = NameRichTxBx.Trim(vbLf)
sNameRichTxBxList.Add(NameRichTxBxTrim)
Next
If Not IsNothing(Map.refScriptWindowVM) Then
'If sNameRichTxBx.Text.Contains("local") Or sNameRichTxBx.Text.Contains("require") Then
' Map.refScriptWindowVM.TextSearchAndColor(sNameFile_RichTxBx, "local", Brushes.Blue, FontWeights.Bold, FontStyles.Italic, 16)
' Map.refScriptWindowVM.TextSearchAndColor(sNameFile_RichTxBx, "require", Brushes.Green, FontWeights.Normal, FontStyles.Normal, 12)
'End If
'If sNameRichTxBxList.Contains("--") AndAlso sNameRichTxBx.Text.StartsWith("--") Then
' Map.refScriptWindowVM.TextSearchAndColor(sNameFile_RichTxBx, sNameRichTxBx.Text, Brushes.Yellow, FontWeights.Normal, FontStyles.Normal, 12)
'End If
For Each sNameRichTxBxItem As String In sNameRichTxBxList
Dim stmpNameRichTxBxItem As String() = sNameRichTxBxItem.Split(" ")
For Each tmpNameRichTxBxItem As String In stmpNameRichTxBxItem
If tmpNameRichTxBxItem.Contains("--") Then
TextSearchAndColor(Map.refScriptWindowV.sNameFile_RichTxBx, tmpNameRichTxBxItem, Brushes.Yellow, FontWeights.Normal, FontStyles.Normal, 10)
ElseIf tmpNameRichTxBxItem.Equals("local") Then
TextSearchAndColor(Map.refScriptWindowV.sNameFile_RichTxBx, tmpNameRichTxBxItem, Brushes.Blue, FontWeights.Bold, FontStyles.Italic, 16)
ElseIf tmpNameRichTxBxItem.Equals("require") Or tmpNameRichTxBxItem.Equals("require(") Or tmpNameRichTxBxItem.Equals("require (") Or tmpNameRichTxBxItem.Equals("require('") Then
TextSearchAndColor(Map.refScriptWindowV.sNameFile_RichTxBx, tmpNameRichTxBxItem, Brushes.Green, FontWeights.Normal, FontStyles.Normal, 12)
Else
If Not IsNothing(Map.refScriptWindowVM) Then Map.refScriptWindowVM.ResetStyleRichText()
End If
Next
Next
End If
End Sub
#End Region ' Methods
#Region "COMMANDS"
#Region "ConfermCmd"
Public ReadOnly Property ConfermaCmd As ICommand
Get
If m_ConfermaCmd Is Nothing Then
m_ConfermaCmd = New Command(AddressOf Conferma)
End If
Return m_ConfermaCmd
End Get
End Property
Public Sub Conferma()
' Recupero il file script
Dim sFileScript As String = RichTextBox(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & "m_sNameFile" & ".lua")
' Salvo il file
SaveScript(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & m_sNameFile & ".lua", sFileScript)
' Eseguo il file
EgtLuaExecFile(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & m_sNameFile & ".lua")
' Imposto stato gestione mouse diretto della scena a nessuno
Map.refSceneHostVM.MainScene.SetStatusNull()
End Sub
#End Region ' ConfermaCmd
#Region "SaveAsCommand"
Public ReadOnly Property SalvaCmd As ICommand
Get
If m_cmdSaveAs Is Nothing Then
m_cmdSaveAs = New Command(AddressOf SaveAs)
End If
Return m_cmdSaveAs
End Get
End Property
Public Sub SaveAs()
SaveProject()
End Sub
#End Region ' SaveAsCommand
#Region "AnnullaCmd"
Public ReadOnly Property AnnullaCmd As ICommand
Get
If m_cmdAnnulla Is Nothing Then
m_cmdAnnulla = New Command(AddressOf Annulla)
End If
Return m_cmdAnnulla
End Get
End Property
Public Sub Annulla()
Map.refScriptWindowV.Close()
End Sub
#End Region ' AnnullaCmd
#Region "TextColorCmd"
Public ReadOnly Property TextColorCmd As ICommand
Get
If m_cmdTextColor Is Nothing Then
m_cmdTextColor = New Command(AddressOf TextColor)
End If
Return m_cmdTextColor
End Get
End Property
Public Sub TextColor()
' Recupero colori custom
Dim Col As New Color3d(10, 122, 150)
Dim sCustomColors As String = ""
GetMainPrivateProfileString(S_COLORS, K_CUSTOMCOLORS, "", sCustomColors)
Dim CustomColors() As String = sCustomColors.Split(","c)
Dim nCustomColors As New List(Of Integer)
For Each Color In CustomColors
Dim nColor As Integer
If Integer.TryParse(Color, nColor) Then
nCustomColors.Add(nColor)
End If
Next
' Creo dialogo colori
Dim ColorDlg As New EgtColorPickerV(Application.Current.MainWindow, New EgtColorPickerVM()) With {
.CustomColors = nCustomColors.ToArray(),
.Color = Col.ToColor()
}
' Visualizzo dialogo
If ColorDlg.ShowDialog() <> Windows.Forms.DialogResult.OK Then Return
'Recupero colore scelto
Dim selColor As New SolidColorBrush(System.Windows.Media.Color.FromArgb(CByte(ColorDlg.Color.A),
CByte(ColorDlg.Color.R),
CByte(ColorDlg.Color.G),
CByte(ColorDlg.Color.B)))
Dim textRange = New TextRange(Map.refScriptWindowV.sNameFile_RichTxBx.Selection.Start, Map.refScriptWindowV.sNameFile_RichTxBx.Selection.[End])
textRange.ApplyPropertyValue(TextElement.ForegroundProperty, selColor)
End Sub
#End Region ' TextColorCmd
#End Region ' Commands
End Class
+2
View File
@@ -144,6 +144,8 @@ Public Class SecondaryWindowVM
ElseIf e.Key = Key.Delete Then ElseIf e.Key = Key.Delete Then
SolidManagerM.Delete(Map.refSceneHostVM.m_nIdPart) SolidManagerM.Delete(Map.refSceneHostVM.m_nIdPart)
Map.refSceneHostVM.m_nIdPart = GDB_ID.NULL Map.refSceneHostVM.m_nIdPart = GDB_ID.NULL
ElseIf e.Key = Key.Escape Then
If Not IsNothing(Map.refScriptWindowVM) Then Map.refScriptWindowVM.Annulla()
End If End If
End Sub End Sub
+1 -2
View File
@@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtStone3D="clr-namespace:EgtStone3D"> xmlns:EgtStone3D="clr-namespace:EgtStone3D">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
@@ -19,7 +18,7 @@
<Button ToolTip="{Binding Name}" <Button ToolTip="{Binding Name}"
IsEnabled="{Binding IsEnabled}" IsEnabled="{Binding IsEnabled}"
Command="{Binding CmdBtn}" Command="{Binding CmdBtn}"
Height="65" Width="65" BorderThickness="0"> Height="65" Width="100" BorderThickness="0" Background="Transparent" Margin="3,0,0,0">
<!--<Image Source="{Binding Img}"/>--> <!--<Image Source="{Binding Img}"/>-->
<StackPanel Style="{StaticResource TopPanel_StackPanel}"> <StackPanel Style="{StaticResource TopPanel_StackPanel}">
<EgtStone3D:SVGV FileSource="{Binding Img}" Height="50"/> <EgtStone3D:SVGV FileSource="{Binding Img}" Height="50"/>
+1 -1
View File
@@ -15,7 +15,7 @@
' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent(). ' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent().
m_SceneButtonVM = Map.refSceneButtonVM m_SceneButtonVM = Map.refSceneButtonVM
Me.DataContext = m_SceneButtonVM.TopPanelListGroupBtn(SceneButtonVM.m_nIndexList_1) Me.DataContext = m_SceneButtonVM.ParametricListGroupBtn(SceneButtonVM.m_nIndexList_1)
SceneButtonVM.m_nIndexList_1 += 1 SceneButtonVM.m_nIndexList_1 += 1
End Sub End Sub
+13 -6
View File
@@ -5,6 +5,7 @@
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5" xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5" xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
SelectedIndex="{Binding SelTopOption}" SelectedIndex="{Binding SelTopOption}"
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:EgtMainWindow}}}"
Style="{StaticResource TopPanel_TabControl}"> Style="{StaticResource TopPanel_TabControl}">
<TabControl.ItemContainerStyle> <TabControl.ItemContainerStyle>
<Style TargetType="{x:Type TabItem}"> <Style TargetType="{x:Type TabItem}">
@@ -43,8 +44,7 @@
ItemsSource="{Binding TopPanelListGroupBtn}"> ItemsSource="{Binding TopPanelListGroupBtn}">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<WrapPanel Style="{StaticResource TopPanel_WrapPanel}" <WrapPanel Style="{StaticResource TopPanel_WrapPanel}"/>
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:EgtMainWindow}}}"/>
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ItemsControl.ItemsPanel> </ItemsControl.ItemsPanel>
<ItemsControl.Resources> <ItemsControl.Resources>
@@ -56,7 +56,15 @@
</DataTemplate> </DataTemplate>
</ItemsControl.Resources> </ItemsControl.Resources>
</ItemsControl> </ItemsControl>
<EgtStone3D:TopPanelListV Grid.Column="9"/> <Button Grid.Column="9"
Command="{Binding ScriptFileCmd}"
Style="{DynamicResource ProjManager_Btn}">
<StackPanel Style="{StaticResource TopPanel_StackPanel}">
<EgtStone3D:SVGV Height="50" FileSource="{Binding FileScriptSVG, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Script File"
Style="{StaticResource TopPanel_TxBl}"/>
</StackPanel>
</Button>
</Grid> </Grid>
</TabItem> </TabItem>
<TabItem Header="{Binding Parametrico_Msg}"> <TabItem Header="{Binding Parametrico_Msg}">
@@ -64,11 +72,10 @@
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ItemsControl ItemsSource="{Binding TopPanelListGroupBtn}"> <ItemsControl ItemsSource="{Binding ParametricListGroupBtn}">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<WrapPanel Style="{StaticResource TopPanel_WrapPanel}" <WrapPanel Style="{StaticResource TopPanel_WrapPanel}"/>
Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type EgtWPFLib5:EgtMainWindow}}}"/>
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ItemsControl.ItemsPanel> </ItemsControl.ItemsPanel>
<ItemsControl.Resources> <ItemsControl.Resources>
+55 -21
View File
@@ -2,6 +2,7 @@
Imports EgtUILib Imports EgtUILib
Imports System.Collections.ObjectModel Imports System.Collections.ObjectModel
Imports System.IO Imports System.IO
Imports System.Text
Public Class TopPanelVM Public Class TopPanelVM
Inherits VMBase Inherits VMBase
@@ -134,6 +135,27 @@ Public Class TopPanelVM
End Get End Get
End Property End Property
Public ReadOnly Property ParametricListGroupBtn As List(Of GroupSceneBtn)
Get
Return Map.refSceneButtonVM.ParametricListGroupBtn
End Get
End Property
Private m_FileScriptSVG As String = String.Empty
Public Property FileScriptSVG As String
Get
Return m_FileScriptSVG
End Get
Set(value As String)
m_FileScriptSVG = value
NotifyPropertyChanged(NameOf(FileScriptSVG))
End Set
End Property
Friend Sub SetFileScriptSVG(sFileScriptSVG As String)
m_FileScriptSVG = sFileScriptSVG
NotifyPropertyChanged(NameOf(FileScriptSVG))
End Sub
#Region "Messages" #Region "Messages"
Public ReadOnly Property NewFile_Msg Public ReadOnly Property NewFile_Msg
@@ -177,6 +199,7 @@ Public Class TopPanelVM
Private m_cmdShowPopUpCmd As ICommand Private m_cmdShowPopUpCmd As ICommand
Private m_cmdShowPopUpProspectiveCmd As ICommand Private m_cmdShowPopUpProspectiveCmd As ICommand
Private m_cmdOpenMruFile As ICommand Private m_cmdOpenMruFile As ICommand
Private m_cmdScriptFileCmd As ICommand
#End Region ' Fields & Properties #End Region ' Fields & Properties
@@ -188,6 +211,7 @@ Public Class TopPanelVM
m_MruFiles.Init(S_MRUFILES, 8) m_MruFiles.Init(S_MRUFILES, 8)
m_MruImportFiles.Init(S_MRUIMPORTFILES, 8) m_MruImportFiles.Init(S_MRUIMPORTFILES, 8)
SetFileSourceSVG(Map.refMainWindowVM.MainWindowM.sResourcesDir & "\test.svg") SetFileSourceSVG(Map.refMainWindowVM.MainWindowM.sResourcesDir & "\test.svg")
SetFileScriptSVG(Map.refMainWindowVM.MainWindowM.sResourcesDir & "\ScriptLua.svg")
End Sub End Sub
#End Region ' Constructor #End Region ' Constructor
@@ -204,7 +228,10 @@ Public Class TopPanelVM
End Sub End Sub
Friend Function OpenProject(sFilePath As String) As Boolean Friend Function OpenProject(sFilePath As String) As Boolean
Return Map.refSceneHostVM.OpenProject(sFilePath) Dim bOk As Boolean = Map.refSceneHostVM.OpenProject(sFilePath)
SolidManagerM.CreatePartSolid()
EgtDraw()
Return bOk
End Function End Function
Public Sub Save() Public Sub Save()
@@ -223,6 +250,11 @@ Public Class TopPanelVM
SetProspectiveView_Msg("" & EgtMsg(110027)) ' Vista Prospettica SetProspectiveView_Msg("" & EgtMsg(110027)) ' Vista Prospettica
End Sub End Sub
Private Sub GetFile()
If File.Exists(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & "Prova.lua") Then Map.refScriptWindowVM.sNameFile = Path.GetFileNameWithoutExtension(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & "Prova.lua")
If File.Exists(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & "Prova.lua") Then Map.refScriptWindowVM.sRichTextParagraph = File.ReadAllText(Map.refMainWindowVM.MainWindowM.sTempDir & "\" & "Prova.lua", Encoding.UTF8)
End Sub
#End Region ' Methods #End Region ' Methods
#Region "COMMANDS" #Region "COMMANDS"
@@ -258,8 +290,6 @@ Public Class TopPanelVM
Friend Sub OpenFile() Friend Sub OpenFile()
OpenProject("") OpenProject("")
SolidManagerM.CreatePartSolid()
EgtDraw()
End Sub End Sub
#End Region ' OpenFileCmd #End Region ' OpenFileCmd
@@ -306,9 +336,6 @@ Public Class TopPanelVM
#Region "OptionsCmd" #Region "OptionsCmd"
''' <summary>
''' Returns a command that do Export.
''' </summary>
Public ReadOnly Property OptionsCommand As ICommand Public ReadOnly Property OptionsCommand As ICommand
Get Get
If m_cmdOptionsCmd Is Nothing Then If m_cmdOptionsCmd Is Nothing Then
@@ -318,9 +345,6 @@ Public Class TopPanelVM
End Get End Get
End Property End Property
''' <summary>
''' Execute the Export. This method is invoked by the ExportCommand.
''' </summary>
Public Sub Options(ByVal param As Object) Public Sub Options(ByVal param As Object)
Dim OptionsWindow As New OptionWindowV With { Dim OptionsWindow As New OptionWindowV With {
.DataContext = New OptionWindowVM, .DataContext = New OptionWindowVM,
@@ -333,9 +357,6 @@ Public Class TopPanelVM
#Region "ShowPopUpCommand" #Region "ShowPopUpCommand"
''' <summary>
''' Returns a command that do Export.
''' </summary>
Public ReadOnly Property ShowPopUpCommand As ICommand Public ReadOnly Property ShowPopUpCommand As ICommand
Get Get
If m_cmdShowPopUpCmd Is Nothing Then If m_cmdShowPopUpCmd Is Nothing Then
@@ -345,9 +366,6 @@ Public Class TopPanelVM
End Get End Get
End Property End Property
''' <summary>
''' Execute the Export. This method is invoked by the ExportCommand.
''' </summary>
Public Sub ShowPopUp(ByVal param As Object) Public Sub ShowPopUp(ByVal param As Object)
If m_IsOpen Then If m_IsOpen Then
SetIsOpen(False) SetIsOpen(False)
@@ -364,9 +382,6 @@ Public Class TopPanelVM
#Region "ShowPopUpProspectiveCommand" #Region "ShowPopUpProspectiveCommand"
''' <summary>
''' Returns a command that do Export.
''' </summary>
Public ReadOnly Property ShowPopUpProspectiveCommand As ICommand Public ReadOnly Property ShowPopUpProspectiveCommand As ICommand
Get Get
If m_cmdShowPopUpProspectiveCmd Is Nothing Then If m_cmdShowPopUpProspectiveCmd Is Nothing Then
@@ -376,9 +391,6 @@ Public Class TopPanelVM
End Get End Get
End Property End Property
''' <summary>
''' Execute the Export. This method is invoked by the ExportCommand.
''' </summary>
Public Sub ShowPopUpProspective(ByVal param As Object) Public Sub ShowPopUpProspective(ByVal param As Object)
If m_IsOpenProspective Then If m_IsOpenProspective Then
SetIsOpenProspective(False) SetIsOpenProspective(False)
@@ -416,6 +428,28 @@ Public Class TopPanelVM
#End Region ' OpenMruFileCommand #End Region ' OpenMruFileCommand
#Region "ScriptFileCmd"
Public ReadOnly Property ScriptFileCmd As ICommand
Get
If m_cmdScriptFileCmd Is Nothing Then
m_cmdScriptFileCmd = New Command(AddressOf OpenScriptFile)
End If
Return m_cmdScriptFileCmd
End Get
End Property
Public Sub OpenScriptFile()
Dim ScriptWindow As New ScriptWindowV With {
.DataContext = New ScriptWindowVM,
.Owner = Application.Current.MainWindow
}
GetFile()
ScriptWindow.Show()
End Sub
#End Region ' ScriptFileCmd
#End Region ' Commands #End Region ' Commands
End Class End Class
+108 -6
View File
@@ -296,8 +296,11 @@
</Style> </Style>
<Style x:Key="Grid_Btn" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}"> <Style x:Key="Grid_Btn" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Width" Value="80"/> <Setter Property="Background" Value="{StaticResource EgalwareTransparent}"/>
<Setter Property="Margin" Value="0,0,0,15"/> <Setter Property="Width" Value="60"/>
<Setter Property="Height" Value="60"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="0,5,0,5"/>
</Style> </Style>
<Style x:Key="TopPanel_Btn" TargetType="{x:Type Button}" BasedOn="{StaticResource Proj_Btn}"> <Style x:Key="TopPanel_Btn" TargetType="{x:Type Button}" BasedOn="{StaticResource Proj_Btn}">
@@ -357,6 +360,8 @@
<Style x:Key="GridPanel_Btn" TargetType="{x:Type Button}" BasedOn="{StaticResource Proj_Btn}"> <Style x:Key="GridPanel_Btn" TargetType="{x:Type Button}" BasedOn="{StaticResource Proj_Btn}">
<Setter Property="Width" Value="35"/> <Setter Property="Width" Value="35"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Margin" Value="0,-5,0,3.5"/>
</Style> </Style>
<Style x:Key="EgtWPFLib5_InputButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}"> <Style x:Key="EgtWPFLib5_InputButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
@@ -364,6 +369,11 @@
<Setter Property="Width" Value="60"/> <Setter Property="Width" Value="60"/>
</Style> </Style>
<Style x:Key="Script_InputButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="25"/>
<Setter Property="Width" Value="25"/>
</Style>
<Style x:Key="LeftPanel_TextButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}"> <Style x:Key="LeftPanel_TextButton" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Height" Value="30"/> <Setter Property="Height" Value="30"/>
<Setter Property="Margin" Value="0,10,0,0"/> <Setter Property="Margin" Value="0,10,0,0"/>
@@ -374,6 +384,18 @@
<Setter Property="Margin" Value="100,1"/> <Setter Property="Margin" Value="100,1"/>
</Style> </Style>
<Style x:Key="ScriptWindow_Btn" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Background" Value="{DynamicResource EgalwareTransparent}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="0,0,10,0"/>
</Style>
<Style x:Key="ScriptWindowEnd_Btn" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Background" Value="{DynamicResource EgalwareTransparent}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="0"/>
</Style>
<!--#endregion ButtonStyle--> <!--#endregion ButtonStyle-->
<!-- ______________________________________________________________________________________________________________________________________________ --> <!-- ______________________________________________________________________________________________________________________________________________ -->
@@ -513,6 +535,20 @@
<Setter Property="Width" Value="35"/> <Setter Property="Width" Value="35"/>
</Style> </Style>
<Style x:Key="ScriptToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource General_ToogleButton}">
<Setter Property="Background" Value="{StaticResource EgalwareTransparent}"/>
<Setter Property="BorderBrush" Value="{StaticResource EgalwareTransparent}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Height" Value="25"/>
<Setter Property="Width" Value="20"/>
</Style>
<Style x:Key="ScriptToggleButton1" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource ScriptToggleButton}">
<Setter Property="Margin" Value="2,0,0,0"/>
</Style>
<!--#endregion ToogleButtonStyle--> <!--#endregion ToogleButtonStyle-->
<!-- ______________________________________________________________________________________________________________________________________________ --> <!-- ______________________________________________________________________________________________________________________________________________ -->
@@ -585,6 +621,14 @@
<Setter Property="CornerRadius" Value="3"/> <Setter Property="CornerRadius" Value="3"/>
</Style> </Style>
<Style x:Key="ScriptWindow_Border" TargetType="{x:Type Border}">
<Setter Property="Background" Value="{StaticResource EgalwareUltraLightGray}"/>
<Setter Property="BorderBrush" Value="{StaticResource EgalwareUltraLightGray}"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="CornerRadius" Value="3"/>
<Setter Property="Margin" Value="10,10,10,0"/>
</Style>
<!--#endregion BorderStyle--> <!--#endregion BorderStyle-->
<!-- ______________________________________________________________________________________________________________________________________________ --> <!-- ______________________________________________________________________________________________________________________________________________ -->
@@ -881,6 +925,11 @@
<Setter Property="MinHeight" Value="382"/> <Setter Property="MinHeight" Value="382"/>
</Style> </Style>
<Style x:Key="ScriptWindowV_Window" TargetType="{x:Type EgtWPFLib5:EgtMainWindow}" BasedOn="{StaticResource Dialog_Window}">
<Setter Property="Width" Value="600"/>
<Setter Property="Height" Value="700"/>
</Style>
<!--#endregion EgtCustomWindowStyle--> <!--#endregion EgtCustomWindowStyle-->
<!-- ______________________________________________________________________________________________________________________________________________ --> <!-- ______________________________________________________________________________________________________________________________________________ -->
@@ -1116,7 +1165,7 @@
<!--#region TextBoxStyle--> <!--#region TextBoxStyle-->
<Style x:Key="BaseTextBox" TargetType="{x:Type TextBox}"> <Style x:Key="BaseTextBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Background" Value="{StaticResource EgalwareTransparent}"/> <Setter Property="Background" Value="{StaticResource EgalwareTransparent}"/>
<Setter Property="Foreground" Value="{DynamicResource BaseTextBox.Static.Foreground}"/> <Setter Property="Foreground" Value="{DynamicResource BaseTextBox.Static.Foreground}"/>
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
@@ -1125,6 +1174,7 @@
<Setter Property="TextWrapping" Value="Wrap"/> <Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Height" Value="22"/> <Setter Property="Height" Value="22"/>
<Setter Property="FontSize" Value="12"/> <Setter Property="FontSize" Value="12"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="FontFamily" Value="/Resources/Fonts/#Roboto"/> <Setter Property="FontFamily" Value="/Resources/Fonts/#Roboto"/>
<Setter Property="FontWeight" Value="Normal"/> <Setter Property="FontWeight" Value="Normal"/>
</Style> </Style>
@@ -1168,6 +1218,11 @@
<Setter Property="Margin" Value="1,5,1,0"/> <Setter Property="Margin" Value="1,5,1,0"/>
</Style> </Style>
<Style x:Key="Script_TxBx" TargetType="{x:Type TextBox}" BasedOn="{StaticResource BaseTextBox}">
<Setter Property="TextAlignment" Value="Left"/>
<Setter Property="Margin" Value="10,10,10,0"/>
</Style>
<Style x:Key="AboutBox_TextBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}"> <Style x:Key="AboutBox_TextBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Foreground" Value="{StaticResource TextBox.Static.Foreground}"/> <Setter Property="Foreground" Value="{StaticResource TextBox.Static.Foreground}"/>
<Setter Property="BorderThickness" Value="0"/> <Setter Property="BorderThickness" Value="0"/>
@@ -1181,8 +1236,8 @@
<Style x:Key="GridPanel_TextBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}"> <Style x:Key="GridPanel_TextBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Foreground" Value="{StaticResource TextBox.Static.Foreground}"/> <Setter Property="Foreground" Value="{StaticResource TextBox.Static.Foreground}"/>
<Setter Property="Width" Value="45"/> <Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Margin" Value="-5,0,0,0"/> <Setter Property="Width" Value="60"/>
</Style> </Style>
<!--#endregion TextBoxStyle--> <!--#endregion TextBoxStyle-->
@@ -1525,6 +1580,12 @@
<Setter Property="Margin" Value="0,2,0,5"/> <Setter Property="Margin" Value="0,2,0,5"/>
</Style> </Style>
<Style x:Key="ScriptWindow_CmBx" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Height" Value="25"/>
<Setter Property="Margin" Value="0,0,5,0"/>
</Style>
<!--#endregion ComboBoxStyle--> <!--#endregion ComboBoxStyle-->
<!-- ______________________________________________________________________________________________________________________________________________ --> <!-- ______________________________________________________________________________________________________________________________________________ -->
@@ -2323,12 +2384,17 @@
</Style> </Style>
<Style x:Key="GridPanel_WrapPanel" TargetType="{x:Type WrapPanel}"> <Style x:Key="GridPanel_WrapPanel" TargetType="{x:Type WrapPanel}">
<Setter Property="Orientation" Value="Vertical"/> <Setter Property="Orientation" Value="Horizontal"/>
<Setter Property="HorizontalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Width" Value="Auto"/> <Setter Property="Width" Value="Auto"/>
</Style> </Style>
<Style x:Key="WrapScript_WrapPanel" TargetType="{x:Type WrapPanel}">
<Setter Property="Orientation" Value="Horizontal"/>
<Setter Property="Margin" Value="5"/>
</Style>
<!--#endregion WrapPanelStyle--> <!--#endregion WrapPanelStyle-->
<!-- ______________________________________________________________________________________________________________________________________________ --> <!-- ______________________________________________________________________________________________________________________________________________ -->
@@ -2907,6 +2973,22 @@
<Setter Property="Margin" Value="0,10,0,5"/> <Setter Property="Margin" Value="0,10,0,5"/>
</Style> </Style>
<Style x:Key="Script_Separator" TargetType="{x:Type Separator}">
<Setter Property="Background" Value="{DynamicResource Separator.Static.Background}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Height" Value="20"/>
<Setter Property="Width" Value="38.5"/>
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter Property="RenderTransform">
<Setter.Value>
<TransformGroup>
<RotateTransform Angle="90"/>
</TransformGroup>
</Setter.Value>
</Setter>
</Style>
<!--#endregion SeparatorStyle--> <!--#endregion SeparatorStyle-->
<!-- ______________________________________________________________________________________________________________________________________________ --> <!-- ______________________________________________________________________________________________________________________________________________ -->
@@ -2921,4 +3003,24 @@
<!-- ______________________________________________________________________________________________________________________________________________ --> <!-- ______________________________________________________________________________________________________________________________________________ -->
<!--#region RichTextBoxStyle-->
<Style x:Key="Script_RichTxBx" TargetType="{x:Type RichTextBox}">
<Setter Property="Background" Value="{StaticResource EgalwareTransparent}"/>
<Setter Property="Foreground" Value="{DynamicResource BaseTextBox.Static.Foreground}"/>
<Setter Property="AcceptsReturn" Value="True"/>
<Setter Property="AcceptsTab" Value="True"/>
<!--<Setter Property="FontFamily" Value="/Resources/Fonts/#Roboto"/>-->
<Setter Property="FontWeight" Value="Medium"/>
<Setter Property="Block.LineHeight" Value="1"/>
<Setter Property="Block.TextAlignment" Value="Left"/>
<Setter Property="TextOptions.TextFormattingMode" Value="Ideal"/>
<Setter Property="TextOptions.TextRenderingMode" Value="Aliased"/>
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
<!--<Setter Property="FontSize" Value="12"/>-->
<Setter Property="Margin" Value="10"/>
</Style>
<!--#endregion RichTextBoxStyle-->
</ResourceDictionary> </ResourceDictionary>
+24
View File
@@ -13,12 +13,14 @@ Module Map
Private m_refViewPanelProspectiveVM As ViewPanelProspectiveVM Private m_refViewPanelProspectiveVM As ViewPanelProspectiveVM
Private m_refGridPanelVM As GridPanelVM Private m_refGridPanelVM As GridPanelVM
Private m_refOptionWindowVM As OptionWindowVM Private m_refOptionWindowVM As OptionWindowVM
Private m_refScriptWindowVM As ScriptWindowVM
Private m_refMainWindowV As MainWindowV Private m_refMainWindowV As MainWindowV
Private m_refSecondaryWindowV As SecondaryWindowV Private m_refSecondaryWindowV As SecondaryWindowV
Private m_refSceneHostV As SceneHostV Private m_refSceneHostV As SceneHostV
Private m_refSceneButtonV As SceneButtonV Private m_refSceneButtonV As SceneButtonV
Private m_refSplashScreenV As SplashScreenV Private m_refSplashScreenV As SplashScreenV
Private m_refScriptWindowV As ScriptWindowV
#End Region ' Fields & Properties #End Region ' Fields & Properties
@@ -78,6 +80,12 @@ Module Map
End Get End Get
End Property End Property
Public ReadOnly Property refScriptWindowVM As ScriptWindowVM
Get
Return m_refScriptWindowVM
End Get
End Property
Public ReadOnly Property refSceneHostV As SceneHostV Public ReadOnly Property refSceneHostV As SceneHostV
Get Get
Return m_refSceneHostV Return m_refSceneHostV
@@ -96,6 +104,12 @@ Module Map
End Get End Get
End Property End Property
Public ReadOnly Property refScriptWindowV As ScriptWindowV
Get
Return m_refScriptWindowV
End Get
End Property
Public ReadOnly Property refSceneButtonVM As SceneButtonVM Public ReadOnly Property refSceneButtonVM As SceneButtonVM
Get Get
Return m_refSceneButtonVM Return m_refSceneButtonVM
@@ -163,6 +177,11 @@ Module Map
Return Not IsNothing(m_refOptionWindowVM) Return Not IsNothing(m_refOptionWindowVM)
End Function End Function
Friend Function SetRefScriptWindowVM(ScriptWindowVM As ScriptWindowVM) As Boolean
m_refScriptWindowVM = ScriptWindowVM
Return Not IsNothing(m_refScriptWindowVM)
End Function
Friend Function SetRefSceneHostV(SceneHostV As SceneHostV) As Boolean Friend Function SetRefSceneHostV(SceneHostV As SceneHostV) As Boolean
m_refSceneHostV = SceneHostV m_refSceneHostV = SceneHostV
Return Not IsNothing(m_refSceneHostV) Return Not IsNothing(m_refSceneHostV)
@@ -178,6 +197,11 @@ Module Map
Return Not IsNothing(m_refSplashScreenV) Return Not IsNothing(m_refSplashScreenV)
End Function End Function
Friend Function SetRefScriptWindowV(ScriptWindowV As ScriptWindowV) As Boolean
m_refScriptWindowV = ScriptWindowV
Return Not IsNothing(m_refScriptWindowV)
End Function
Friend Function SetRefSceneButtonVM(SceneButtonVM As SceneButtonVM) As Boolean Friend Function SetRefSceneButtonVM(SceneButtonVM As SceneButtonVM) As Boolean
m_refSceneButtonVM = SceneButtonVM m_refSceneButtonVM = SceneButtonVM
Return Not IsNothing(m_refSceneButtonVM) Return Not IsNothing(m_refSceneButtonVM)
+58 -6
View File
@@ -76,6 +76,7 @@ Module SolidManagerM
End Sub End Sub
Public Sub CreateSolidFromLoops(nPart As Integer) Public Sub CreateSolidFromLoops(nPart As Integer)
If nPart = GDB_ID.NULL Then Return
Dim nChild As Integer = GDB_ID.NULL Dim nChild As Integer = GDB_ID.NULL
EgtGetInfo(nPart, "Child", nChild) EgtGetInfo(nPart, "Child", nChild)
' proseguo solo nel caso in cui non sia già presente un solido associato al Part ' proseguo solo nel caso in cui non sia già presente un solido associato al Part
@@ -672,12 +673,48 @@ Module SolidManagerM
End While End While
End Sub End Sub
Public Sub RebuildPartFromInfo(nId As Integer)
If nId = GDB_ID.NULL Then Return
Dim PartSolidSel As PartSolidM = GetPartSolid(nId)
nId = PartSolidSel.PartId
' recupero le info salvate nel Part
EgtLuaExecLine("TOOL.FillInfoTableFromPart(" & nId.ToString() & ")")
' recupero l'id dell'edge che ha generato la paretina
Dim nParent As Integer = GDB_ID.NULL
EgtGetInfo(nId, "Parent", nParent)
Dim nIn As Integer = 0
EgtGetInfo(nId, "nInLoop", nIn)
Dim sLayName As String = "OutLoop"
Dim nLayId As Integer = GDB_ID.NULL
If nIn = 0 Then
nLayId = EgtGetFirstNameInGroup(nParent, sLayName)
Else
sLayName = "InLoop"
nLayId = EgtGetFirstNameInGroup(nParent, sLayName)
Dim nInLays = 1
While nInLays <> nIn
nLayId = EgtGetNextName(nLayId, sLayName)
nInLays += 1
End While
End If
Dim nEdge As Integer = 0
EgtGetInfo(nId, "ParentEdge", nEdge)
Dim sEdgeName As String = "A" & nEdge.ToString()
Dim nEdgeId As Integer = EgtGetFirstNameInGroup(nLayId, sEdgeName)
' recupero le info e ricreo il pezzo
If EgtLuaSetGlobIntVar("TOOL.nEdgeId", nEdgeId) Then AssLog("TOOL.nEdgeId = " & nEdgeId.ToString())
If EgtLuaCallFunction("TOOL.CreateParetinaFull") Then AssLog("TOOL.CreateParetinaFull()")
SolidManagerM.RefreshPartSolid(nId)
End Sub
Public Sub Delete(nPartId) Public Sub Delete(nPartId)
If nPartId = GDB_ID.NULL Then Return If nPartId = GDB_ID.NULL Then Return
Dim PartSolidSel As PartSolidM = GetPartSolid(nPartId)
' cancello tutte le info che riguardano il pezzo che sono in altri pezzi ' cancello tutte le info che riguardano il pezzo che sono in altri pezzi
Unpair(nPartId) Unpair(PartSolidSel.PartId)
Dim sPairToRef As String = String.Empty Dim sPairToRef As String = String.Empty
EgtGetInfo(nPartId, "PairToRef", sPairToRef) EgtGetInfo(PartSolidSel.PartId, "PairToRef", sPairToRef)
If sPairToRef <> String.Empty Then If sPairToRef <> String.Empty Then
Dim vPairToRef As Array = sPairToRef.Split(CChar(",")) Dim vPairToRef As Array = sPairToRef.Split(CChar(","))
Dim sPartToPair As String = vPairToRef(0) Dim sPartToPair As String = vPairToRef(0)
@@ -689,23 +726,38 @@ Module SolidManagerM
' elimino l'info nel parent ' elimino l'info nel parent
Dim nEdge As Integer = 0 Dim nEdge As Integer = 0
EgtGetInfo(nPartId, "ParentEdge", nEdge) EgtGetInfo(PartSolidSel.PartId, "ParentEdge", nEdge)
Dim nParentId As Integer = GDB_ID.NULL Dim nParentId As Integer = GDB_ID.NULL
EgtGetInfo(nPartId, "Parent", nParentId) EgtGetInfo(PartSolidSel.PartId, "Parent", nParentId)
Dim sEdgeName As String = "A" & nEdge.ToString() Dim sEdgeName As String = "A" & nEdge.ToString()
Dim nIn As Integer = 0 Dim nIn As Integer = 0
EgtGetInfo(nPartId, "nInLoop", nIn) EgtGetInfo(PartSolidSel.PartId, "nInLoop", nIn)
If nIn <> 0 Then sEdgeName = sEdgeName & "_I" & nIn.ToString() If nIn <> 0 Then sEdgeName = sEdgeName & "_I" & nIn.ToString()
EgtSetInfo(nParentId, sEdgeName, "") EgtSetInfo(nParentId, sEdgeName, "")
' recupero gli eventuali vicini
Dim sPrev As String = String.Empty
Dim sNext As String = String.Empty
EgtGetInfo(PartSolidSel.PartId, "Prev", sPrev)
EgtGetInfo(PartSolidSel.PartId, "Next", sNext)
Dim PrevId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, sPrev)
Dim NextId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, sNext)
' elimino il part e il suo solido ' elimino il part e il suo solido
Dim PartSolidSel As PartSolidM = GetPartSolid(nPartId)
PartSolidSel.DeselectPart() PartSolidSel.DeselectPart()
EgtErase(PartSolidSel.PartId) EgtErase(PartSolidSel.PartId)
EgtErase(PartSolidSel.PartSolidId) EgtErase(PartSolidSel.PartSolidId)
' elimino il PartSolid dalla lista ' elimino il PartSolid dalla lista
m_PartSolidList.Remove(PartSolidSel) m_PartSolidList.Remove(PartSolidSel)
' ricostruisco eventuali vicini e modifico le loro info
EgtSetInfo(PrevId, "Next", "")
EgtSetInfo(NextId, "Prev", "")
RebuildPartFromInfo(PrevId)
RebuildPartFromInfo(NextId)
EgtDraw()
End Sub End Sub
#End Region ' Methods #End Region ' Methods