diff --git a/DdfFile.vb b/DdfFile.vb index bd75529..cdf8aac 100644 --- a/DdfFile.vb +++ b/DdfFile.vb @@ -918,7 +918,12 @@ Friend Module DdfFile Dim TempList As New ObservableCollection(Of Compo) If Door.Count = 0 Then Return True ' se esiste un solo elemento lo carico - If Door.Count = 1 Then TempList.Add(Door(0)) : AscendingOrder(TempList, DdfFileContent, bIsDDF) : Return True + If Door.Count = 1 Then + TempList.Add(Door(0)) + AscendingOrder(TempList, DdfFileContent, bIsDDF) + GenerateCompoListReport(TempList) + Return True + End If For Index1 As Integer = 0 To Door.Count - 2 TempList = New ObservableCollection(Of Compo) TempList.Add(Door(Index1)) @@ -1251,13 +1256,17 @@ Friend Module DdfFile Private Sub GenerateCompoListReport(TempList As ObservableCollection(Of Compo)) For Each ItemCompo In TempList + Dim sImagePath As String = "Empty" + If File.Exists(ItemCompo.CompoType.Path & "\" & ItemCompo.SelBrandPart & "\" & ItemCompo.SelFile & ".png") Then + sImagePath = ItemCompo.CompoType.Path & "\" & ItemCompo.SelBrandPart & "\" & ItemCompo.SelFile & ".png" + End If If ItemCompo.CompoType.DDFName.Trim = "vision_cut_outs" OrElse ItemCompo.CompoType.DDFName.Trim = "louver_cut_outs" OrElse ItemCompo.CompoType.DDFName.Trim = "mail_slots" OrElse ItemCompo.CompoType.DDFName.Trim = "groove" OrElse ItemCompo.CompoType.DDFName.Trim = "rabbet" OrElse ItemCompo.CompoType.DDFName.Trim = "face_decoration" Then - ReportDoor.MachList.Add(New TableMach(ItemCompo.CompoType.Name, ItemCompo.SelFile)) + ReportDoor.MachList.Add(New TableMach(ItemCompo.CompoType.Name, ItemCompo.SelFile, sImagePath)) For Each ItemParameter In ItemCompo.CompoParamList Dim sValue As String = String.Empty Dim bIsActive As Boolean = True @@ -1277,7 +1286,7 @@ Friend Module DdfFile End If Next Else - ReportDoor.HardwareList.Add(New TableHardaware(ItemCompo.CompoType.Name, ItemCompo.SelBrandPart, ItemCompo.SelFile)) + ReportDoor.HardwareList.Add(New TableHardaware(ItemCompo.CompoType.Name, ItemCompo.SelBrandPart, ItemCompo.SelFile, sImagePath)) For Each ItemParameter In ItemCompo.CompoParamList Dim sValue As String = String.Empty Dim bIsActive As Boolean = True diff --git a/IniFile.vb b/IniFile.vb index d600c56..855b157 100644 --- a/IniFile.vb +++ b/IniFile.vb @@ -17,6 +17,9 @@ Friend Module IniFile Friend m_nKeyLevel As Integer = 0 ' Opzioni attive sulla chiave Friend m_nKeyOptions As UInteger = 0 + + Friend m_ProjectSceneContext As Integer = 0 + Friend Enum KEY_OPT As UInteger BASE = 1 DOORS = 2 diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index a952dab..e554d71 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -72,5 +72,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb index 3d0b742..c61a386 100644 --- a/OptionsWindow/OptionModule.vb +++ b/OptionsWindow/OptionModule.vb @@ -147,6 +147,14 @@ Friend Module OptionModule Friend m_CompoPaneOrder As List(Of String) = New List(Of String) + Friend m_ExtLineLen As Double + Friend m_ArrowLen As Double + Friend m_TextDist As Double + Friend m_LenIsMM As Integer + Friend m_DecDigit As Integer + Friend m_Font As String + Friend m_TextHeight As Double + ' iniziliazzo il la lettura dei messaggi Friend Sub ReadMessages() ' Leggo elenco lingue disponibili da file ini diff --git a/OptionsWindow/OptionsV.xaml b/OptionsWindow/OptionsV.xaml index d2609d9..e17494f 100644 --- a/OptionsWindow/OptionsV.xaml +++ b/OptionsWindow/OptionsV.xaml @@ -9,318 +9,381 @@ IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False" CloseCommand="{Binding CloseOptionsCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"> - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - + Margin="5,5,10,13" + IsEnabled="{Binding IsChecked, ElementName=Weight}" /> - + - - - - - - - - - - - - - - - - - - - - + + + - + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - - - - + - - - - - - + - - - - - - - - - - - + + + - - - - + + + + - - - - - - - - - + + + + - - - - + + + + - - - - - - - - + + + + - - - - - - - - - - - - + + + + + + + + + + + - - + + diff --git a/SceneManager/InstrumentPanel/InstrumentPanelVM.vb b/SceneManager/InstrumentPanel/InstrumentPanelVM.vb index 536e86a..b2896ae 100644 --- a/SceneManager/InstrumentPanel/InstrumentPanelVM.vb +++ b/SceneManager/InstrumentPanel/InstrumentPanelVM.vb @@ -1,9 +1,11 @@ Imports System.ComponentModel +Imports System.IO Imports EgtUILib Public Class InstrumentPanelVM + Inherits ViewBase + Implements INotifyPropertyChanged - 'riferimento alla scena #Region "FIELDS & PROPERTIES" @@ -15,6 +17,12 @@ Public Class InstrumentPanelVM End Get End Property + Public ReadOnly Property PrintHardwareToolTip As String + Get + Return "Save Image" + End Get + End Property + #End Region ' ToolTip Private m_GetDistIsChecked As Boolean = True @@ -38,18 +46,125 @@ Public Class InstrumentPanelVM Map.refSceneManagerVM.ProjectScene.SetStatusGetDistance() Else Map.refSceneManagerVM.ProjectScene.ResetStatusGetDistance() - Map.refSceneManagerVM.ProjectScene.SetStatusNull() + 'Map.refSceneManagerVM.ProjectScene.SetStatusNull() Dim rfStatusBarVM As StatusBarVM = Map.refStatusBarVM rfStatusBarVM.StatusOutput = String.Empty End If End Sub + Private m_PrintHardwareVisibility As Visibility = Visibility.Collapsed + Public Property PrintHardwareVisibility As Visibility + Get + Return m_PrintHardwareVisibility + End Get + Set(value As Visibility) + m_PrintHardwareVisibility = value + NotifyPropertyChanged("PrintHardwareVisibility") + End Set + End Property + +#Region "Button state" + + Private m_bLayerOk As Boolean = True + Public Property bLayerOk As Boolean + Get + Return m_bLayerOk + End Get + Set(value As Boolean) + m_bLayerOk = value + NotifyPropertyChanged("bLayerOk") + End Set + End Property + +#End Region ' Button state + + ' Definizione comandi + Private m_cmdLinDim As ICommand + Private m_cmdPrintHardware As ICommand + #End Region ' FIELDS & PROPERTIES +#Region "LinearDimensionCommand" + + Public ReadOnly Property LinearDimensionCommand As ICommand + Get + If m_cmdLinDim Is Nothing Then + m_cmdLinDim = New Command(AddressOf LinearDimension) + End If + Return m_cmdLinDim + End Get + End Property + + Private m_DimensioningLayer As Integer + + Public Sub LinearDimension(ByVal param As Object) + GetDistIsChecked = False + Dim x As Integer = EgtSetCurrPartLayer(EgtGetFirstPart(), m_DimensioningLayer) + If EgtSetCurrPartLayer(1, m_DimensioningLayer) = 0 Then + Map.refSceneManagerVM.GetController.ExecuteCommand(Controller.CMD.NEWLAYER) + m_DimensioningLayer = EgtGetCurrLayer() + 'EgtSetColor(m_DimensioningLayer, "BLACK") + End If + Map.refSceneManagerVM.ProjectScene.SetStatusSelPoint() + If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then + Map.refSceneManagerVM.GetController.ExecuteCommand(Controller.CMD.LINEARDIMENSION) + Else + Map.refSceneManagerVM.GetController.ExecuteCommand(Controller.CMD.ALIGNEDDIMENSION) + End If + End Sub + +#End Region ' LinearDimensionCommand + +#Region "PrintHardwareCommand" + + Public ReadOnly Property PrintHardwareCommand As ICommand + Get + If m_cmdPrintHardware Is Nothing Then + m_cmdPrintHardware = New Command(AddressOf PrintHardware) + End If + Return m_cmdPrintHardware + End Get + End Property + + Public Sub PrintHardware() + If Map.refProjectManagerHardwareVM.IsModified Then + ' Project must be saved before printing + MessageBox.Show(EgtMsg(50186), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning) + Return + End If + If IsNothing(Map.refHardwarePageVM.CurrHardware) OrElse IsNothing(Map.refHardwarePageVM.CurrHardware.SelTemplate) Then Return + Dim sCurrDir As String = Path.GetDirectoryName(Map.refHardwarePageVM.CurrHardware.CurrPath()) + Dim sImageFile As String = sCurrDir & "\" & Path.GetFileNameWithoutExtension(Map.refHardwarePageVM.CurrHardware.CurrPath) & ".png" + ExportPngFromNge(sImageFile) + End Sub + +#End Region + + Public Function ExportPngFromNge(ByRef SPathImage As String) As Boolean + ' Creo l'immagine da allegare + ' Nascondo la tavola ed eseguo zoom su quello che rimane + ' EgtZoom(ZM.ALL, True) + ' Prendo l'immagine per la stampa + Dim colWhite As New Color3d(255, 255, 255) + Dim nImgW As Integer = 3000 + Dim nImgH As Integer = 4000 + Dim sPath As String = SPathImage + EgtSetLineAttribs(3) + If Not EgtGetImage(SM.HIDDENLINE, colWhite, colWhite, nImgW, nImgH, sPath) Then + ' Error in creating the print image + EgtOutLog(EgtMsg(50181)) + Return False + End If + EgtSetLineAttribs(1) + SPathImage = sPath + Return True + End Function + #Region "CONSTRUCTOR" Sub New() - Map.SetRefInstrumentPanelVM(me) + Map.SetRefInstrumentPanelVM(Me) + IniFile.m_ProjectSceneContext = Map.refSceneManagerVM.ProjectScene.GetCtx End Sub #End Region ' CONSTRUCTOR diff --git a/SceneManager/SceneManagerVM.vb b/SceneManager/SceneManagerVM.vb index 464cf84..20542b3 100644 --- a/SceneManager/SceneManagerVM.vb +++ b/SceneManager/SceneManagerVM.vb @@ -161,6 +161,9 @@ Public Class SceneManagerVM ' Scene controller Private WithEvents m_Controller As New Controller + Friend Function GetController() As Controller + Return m_Controller + End Function ' definizione comando Private m_CmdRefreshBtn As ICommand @@ -168,6 +171,7 @@ Public Class SceneManagerVM Sub New() Map.SetRefSceneManagerVM(Me) + AddHandler Application.Current.MainWindow.KeyDown, AddressOf Scene_KeyDown End Sub Private Sub PreInitializeScene() @@ -199,14 +203,14 @@ Public Class SceneManagerVM GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor) m_ProjectScene.SetDistLineMaterial(DstLnColor) ' Imposto i parametri del disegno quote - Dim dExtLineLen As Double = GetMainPrivateProfileDouble(S_DIMENSIONSTYLE, K_EXTLINELEN, 5) - Dim dArrowLen As Double = GetMainPrivateProfileDouble(S_DIMENSIONSTYLE, K_ARROWLEN, 5) - Dim dTextDist As Double = GetMainPrivateProfileDouble(S_DIMENSIONSTYLE, K_TEXTDIST, 2) - Dim nLenIsMM As Integer = GetMainPrivateProfileInt(S_DIMENSIONSTYLE, K_LENISMM, 2) - Dim nDecDigit As Integer = GetMainPrivateProfileInt(S_DIMENSIONSTYLE, K_DECDIGIT, -2) - Dim sFont As String = "" : GetMainPrivateProfileString(S_DIMENSIONSTYLE, K_DIMFONT, "ModernPropS.Nfe", sFont) - Dim dTextHeight As Double = GetMainPrivateProfileDouble(S_DIMENSIONSTYLE, K_TEXTHEIGHT, 2) - EgtSetCurrDimensionStyle(dExtLineLen, dArrowLen, dTextDist, nLenIsMM, nDecDigit, sFont, dTextHeight) + OptionModule.m_ExtLineLen = GetMainPrivateProfileDouble(S_DIMENSIONSTYLE, K_EXTLINELEN, 5) + OptionModule.m_ArrowLen = GetMainPrivateProfileDouble(S_DIMENSIONSTYLE, K_ARROWLEN, 5) + OptionModule.m_TextDist = GetMainPrivateProfileDouble(S_DIMENSIONSTYLE, K_TEXTDIST, 2) + OptionModule.m_LenIsMM = GetMainPrivateProfileInt(S_DIMENSIONSTYLE, K_LENISMM, 2) + OptionModule.m_DecDigit = GetMainPrivateProfileInt(S_DIMENSIONSTYLE, K_DECDIGIT, -2) + OptionModule.m_Font = "" : GetMainPrivateProfileString(S_DIMENSIONSTYLE, K_DIMFONT, "ModernPropS.Nfe", OptionModule.m_Font) + OptionModule.m_TextHeight = GetMainPrivateProfileDouble(S_DIMENSIONSTYLE, K_TEXTHEIGHT, 2) + EgtSetCurrDimensionStyle(OptionModule.m_ExtLineLen, OptionModule.m_ArrowLen, OptionModule.m_TextDist, OptionModule.m_LenIsMM, OptionModule.m_DecDigit, OptionModule.m_Font, OptionModule.m_TextHeight) ' imposto parametri OpenGL Dim nDriver As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DRIVER, 3) Dim b2Buff As Boolean = (GetMainPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0) @@ -216,6 +220,8 @@ Public Class SceneManagerVM End Sub Private Sub PostInitializeScene() + ' Impostazioni Controller + m_Controller.SetScene(m_ProjectScene) ' imposto stile quotature Dim dExtLineLen As Double = GetMainPrivateProfileDouble(S_DIMENSIONSTYLE, K_EXTLINELEN, 5) Dim dArrowLen As Double = GetMainPrivateProfileDouble(S_DIMENSIONSTYLE, K_ARROWLEN, 5) @@ -439,6 +445,47 @@ Public Class SceneManagerVM rfStatusBarVM.StatusOutput = sDistance End Sub + Private Sub OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d, ByVal nSep As SEP, ByVal nId As Integer) Handles m_ProjectScene.OnMouseSelectedPoint + Dim bDone As Boolean = (Keyboard.Modifiers And ModifierKeys.Control) <> ModifierKeys.Control + m_Controller.MouseSelectedPoint(PtP, nSep, nId, bDone) + End Sub + + Private Sub OnMouseMoveSelPoint(ByVal sender As Object, ByVal PtP As Point3d) Handles m_ProjectScene.OnMouseMoveSelPoint + m_Controller.MouseMoveInSelectionPoint(PtP) + End Sub + + Private Sub OnMouseSelectingObj(ByVal sender As Object, ByVal nId As Integer, ByRef bOk As Boolean) Handles m_ProjectScene.OnMouseSelectingObj + bOk = (EgtGetType(nId) = GDB_TY.EXT_DIMENSION) + End Sub + + Private Sub OnMouseSelectedObj(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean) Handles m_ProjectScene.OnMouseSelectedObj + m_Controller.MouseSelectedObj(nId, bLast) + End Sub + + Private Sub OnSetInputBoxText(ByVal sText As String) Handles m_Controller.SetInputBoxText + If sText = "<>" Then + m_Controller.Done(sText) + 'm_ProjectScene.SetStatusNull() + End If + End Sub + + Private Sub Scene_KeyDown(ByVal sender As System.Object, ByVal e As KeyEventArgs) + ' Con ESC esco dall'azione corrente + If e.Key = Key.Escape Then + ' reset Azione corrente + m_Controller.ResetStatus() + ' reset Distanza + Map.refInstrumentPanelVM.GetDistIsChecked = False + End If + End Sub + + Private Sub OnSceneKeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles m_ProjectScene.KeyDown + ' Con DEL eseguo cancellazione delle entità selezionate + If e.KeyData = System.Windows.Forms.Keys.Delete Then + m_Controller.SetLastInteger(GDB_ID.SEL) + m_Controller.ExecuteCommand(Controller.CMD.DELETE) + End If + End Sub #End Region Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged diff --git a/SceneManager/ViewPanel/ViewPanelVM.vb b/SceneManager/ViewPanel/ViewPanelVM.vb index 37ad7a3..0020311 100644 --- a/SceneManager/ViewPanel/ViewPanelVM.vb +++ b/SceneManager/ViewPanel/ViewPanelVM.vb @@ -107,6 +107,8 @@ Public Class ViewPanelVM ''' Public Sub TopView(ByVal param As Object) m_rfScenemanagerVM.ProjectScene.TopView() + m_rfScenemanagerVM.GetController.SetLastInteger(Controller.GRID_TYPE.TOP) + Map.refSceneManagerVM.GetController.ExecuteCommand(Controller.CMD.GRID) End Sub #End Region ' TopViewCommand @@ -130,6 +132,8 @@ Public Class ViewPanelVM ''' Public Sub FrontView(ByVal param As Object) m_rfScenemanagerVM.ProjectScene.FrontView() + m_rfScenemanagerVM.GetController.SetLastInteger(Controller.GRID_TYPE.FRONT) + Map.refSceneManagerVM.GetController.ExecuteCommand(Controller.CMD.GRID) End Sub #End Region ' FrontViewCommand @@ -153,6 +157,8 @@ Public Class ViewPanelVM ''' Public Sub LeftView(ByVal param As Object) m_rfScenemanagerVM.ProjectScene.LeftView() + m_rfScenemanagerVM.GetController.SetLastInteger(Controller.GRID_TYPE.LEFT) + Map.refSceneManagerVM.GetController.ExecuteCommand(Controller.CMD.GRID) End Sub #End Region ' LeftViewCommand @@ -176,6 +182,8 @@ Public Class ViewPanelVM ''' Public Sub BackView(ByVal param As Object) m_rfScenemanagerVM.ProjectScene.BackView() + m_rfScenemanagerVM.GetController.SetLastInteger(Controller.GRID_TYPE.BACK) + Map.refSceneManagerVM.GetController.ExecuteCommand(Controller.CMD.GRID) End Sub #End Region ' BackViewCommand @@ -199,6 +207,8 @@ Public Class ViewPanelVM ''' Public Sub RightView(ByVal param As Object) m_rfScenemanagerVM.ProjectScene.RightView() + m_rfScenemanagerVM.GetController.SetLastInteger(Controller.GRID_TYPE.RIGHT) + Map.refSceneManagerVM.GetController.ExecuteCommand(Controller.CMD.GRID) End Sub #End Region ' RightViewCommand diff --git a/StatusBar/StatusBarVM.vb b/StatusBar/StatusBarVM.vb index fdd1391..7bc24a1 100644 --- a/StatusBar/StatusBarVM.vb +++ b/StatusBar/StatusBarVM.vb @@ -39,7 +39,7 @@ Public Class StatusBarVM End Set End Property - Private m_SnapPointTypeList As New List(Of SPItem)({New SPItem(SP.PT_END, EgtMsg(1105)), New SPItem(SP.PT_MID, EgtMsg(1107)), New SPItem(SP.CENTER, EgtMsg(1109)), New SPItem(SP.PT_INTERS, EgtMsg(1115)), New SPItem(SP.CENTROID, EgtMsg(1111))}) + Private m_SnapPointTypeList As New List(Of SPItem)({New SPItem(SP.PT_END, EgtMsg(1105)), New SPItem(SP.PT_SKETCH, EgtMsg(1102)), New SPItem(SP.PT_MID, EgtMsg(1107)), New SPItem(SP.CENTER, EgtMsg(1109)), New SPItem(SP.PT_INTERS, EgtMsg(1115)), New SPItem(SP.CENTROID, EgtMsg(1111))}) Public ReadOnly Property SnapPointTypeList As List(Of SPItem) Get Return m_SnapPointTypeList