OmagCUT 1.6o3 :

- aggiunta gestione cornici (per ora solo disegno)
- migliorie varie.
This commit is contained in:
Dario Sassi
2016-03-29 09:10:43 +00:00
parent bff95d7eb2
commit a8cd99ebb4
29 changed files with 955 additions and 332 deletions
+64 -19
View File
@@ -3,32 +3,32 @@ Imports EgtWPFLib
Imports System.IO
Public Class CurrentProjectPageUC
' Dichiarazione eventi
Friend Event OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
Friend Event OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
Friend Event OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Riferimento alla MainWindow
Private m_MainWindow As MainWindow = Application.Current.MainWindow
' Dichiarazione delle Page UserControl
Friend m_SceneButtons As SceneButtonsUC
' Properties
Private m_bFirst As Boolean = True
' Dichiarazione Scene
Friend WithEvents CurrentProjectScene As New Scene
Private CurrentProjectSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
' Identificativo progetto corrente
Private m_nCurrProj As Integer = 0
' Dati del grezzo
Friend m_nRawId As Integer = GDB_ID.NULL
Friend m_dRawHeight As Double
' Costanti tipo progetto
Friend Enum PRJ_TYPE As Integer
EMPTY = 0
FLATS = 1
FRAMES = 2
End Enum
Private Sub CurrentProjectPage_Initialized(sender As Object, e As EventArgs)
'Creazione delle Page UserControl
@@ -119,12 +119,18 @@ Public Class CurrentProjectPageUC
m_nCurrProj = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 0, m_MainWindow.GetIniFile())
NewProject()
End If
' Imposto utensile e lavorazione correnti
Dim sCurrSaw As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, "", sCurrSaw, m_MainWindow.GetMachIniFile())
ToolTxBx.Text = sCurrSaw
' Nascondo progress per fotografia
PhotoProgress.Visibility = Windows.Visibility.Hidden
' Carico sottopagina opportuna
If GetProjectType() <> PRJ_TYPE.FRAMES Then
CurrentProjectPageGrid.Children.Add(m_MainWindow.m_CadCutPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
m_MainWindow.CadCutBtn.IsChecked = True
Else
CurrentProjectPageGrid.Children.Add(m_MainWindow.m_FrameCutPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.FrameCut
m_MainWindow.FrameCutBtn.IsChecked = True
End If
Else
EgtSetCurrentContext(CurrentProjectScene.GetCtx())
End If
@@ -134,12 +140,11 @@ Public Class CurrentProjectPageUC
If Not IsNothing(m_MainWindow.m_CurrentMachine.CurrMat) Then
MaterialTxBx.Text = m_MainWindow.m_CurrentMachine.CurrMat.sName
Else
MaterialTxBx.Text = "Non definito"
MaterialTxBx.Text = "-----"
End If
Dim sCurrMach As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAWING, "", sCurrMach, m_MainWindow.GetMachIniFile())
MachiningTxBx.Text = sCurrMach
' Visualizzo lama e lavorazione correnti
ToolTxBx.Text = m_MainWindow.m_CurrentMachine.sCurrSaw
MachiningTxBx.Text = m_MainWindow.m_CurrentMachine.sCurrSawing
End Sub
@@ -355,7 +360,7 @@ Public Class CurrentProjectPageUC
Return bOk
End Function
Friend Function SaveNameProject() As Boolean
Friend Function SaveNamedProject() As Boolean
' Determino nome del progetto
Dim CurrProjName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, "", CurrProjName, m_MainWindow.GetIniFile())
@@ -394,6 +399,46 @@ Public Class CurrentProjectPageUC
Return True
End Function
Friend Function GetCurrentProjectName() As String
Dim CurrProjName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, "", CurrProjName, m_MainWindow.GetIniFile())
If String.IsNullOrEmpty(CurrProjName) Then
CurrProjName = Math.Abs(m_nCurrProj).ToString("D4")
End If
Return CurrProjName & ".nge"
End Function
Private Function GetProjectType() As Integer
' Se non c'è grezzo, è vuoto
Dim nRawId As Integer = EgtGetFirstRawPart()
If nRawId = GDB_ID.NULL Then Return PRJ_TYPE.EMPTY
' Cerco un pezzo parcheggiato o nel grezzo
Dim nPartId As Integer = EgtGetFirstPart()
If nPartId = GDB_ID.NULL Then nPartId = EgtGetFirstPartInRawPart(nRawId)
' Se non ci sono pezzi, è vuoto
If nPartId = GDB_ID.NULL Then Return PRJ_TYPE.EMPTY
' Verifico il tipo di pezzo
Dim sName As String = String.Empty
If EgtGetName(nPartId, sName) AndAlso sName = NAME_FRAME Then
Return PRJ_TYPE.FRAMES
Else
Return PRJ_TYPE.FLATS
End If
End Function
Friend Function GetCurrentProjectType() As Integer
' Imposto contesto del progetto corrente
Dim nOldCtx As Integer = EgtGetCurrentContext()
Dim nNewCtx As Integer = CurrentProjectScene.GetCtx()
If nOldCtx <> nNewCtx Then EgtSetCurrentContext(nNewCtx)
' Recupero il tipo di progetto
Dim nPrjType As Integer = GetProjectType()
' Reimposto contesto originale
If nOldCtx <> nNewCtx Then EgtSetCurrentContext(nOldCtx)
' Restituisco il risultato
Return nPrjType
End Function
Friend Function RemovePreviewFromParts() As Boolean
' Processo i sottogruppi, se di livello System li rimuovo
Dim nGrpId As Integer = EgtGetFirstGroupInGroup(GDB_ID.ROOT)