- introdotto form di sistema
- aggiunti CustomButton per LUA
This commit is contained in:
Emmanuele Sassi
2015-05-11 16:41:15 +00:00
parent 8d407110bd
commit 7a61ff80d8
6 changed files with 3808 additions and 2680 deletions
+3
View File
@@ -35,6 +35,9 @@ Module ConstGen
' Sottodirettorio temporaneo
Public Const TEMP_DIR As String = "Temp"
' Sottodirettorio per comandi Lua
Public Const LUACMD_DIR As String = "LuaCmd"
' Sottodirettorio di default per le macchine
Public Const MACHINES_DFL_DIR As String = "Machines"
+3
View File
@@ -420,6 +420,9 @@
<ItemGroup>
<None Include="Resources\Part.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\CircleDiameter.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) C:\EgtProg\EgtCam\EgtCamR32.exe
+1581 -1235
View File
File diff suppressed because it is too large Load Diff
+1973 -1392
View File
File diff suppressed because it is too large Load Diff
+248 -53
View File
@@ -1,4 +1,4 @@
'----------------------------------------------------------------------------
'----------------------------------------------------------------------------
' EgalTech 2014-2015
'----------------------------------------------------------------------------
' File : MainForm.vb Data : 07.05.15 Versione : 1.6a6
@@ -16,6 +16,7 @@ Imports System.Threading
Imports System.Text
Imports System.Math
Imports System.IO
Imports System.Reflection
Imports System.Globalization
Imports EgtUILib.EgtInterface
Imports EgtUILib.GenInterface
@@ -41,6 +42,8 @@ Public Class MainForm
Private WithEvents m_Controller As New Controller
Private m_MruFiles As New MruList
Private m_MruScripts As New MruList
Private m_OpenedPopUp As ButtonItem
Private m_OpenedPopUpMenu As ButtonItem
Public Function GetInstance() As Integer
Return m_nInstance
@@ -72,14 +75,17 @@ Public Class MainForm
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
QatCustomizeItem1.Visible = False
'QatCustomizeItem1.Visible = False
MetroAppButton1.Visible = False
BarRendering.DockSide = DevComponents.DotNetBar.eDockSide.Left
BarZoom.DockSide = DevComponents.DotNetBar.eDockSide.Left
BarView.DockSide = DevComponents.DotNetBar.eDockSide.Left
BarTools.DockSide = DevComponents.DotNetBar.eDockSide.Left
' Seleziono la Modalità Disegna
'Imposta dimensione e posizione delle Bar nella MetroShell
BarRendering.SetBounds(0, 0, 122, 40)
BarZoom.SetBounds(122, 0, 122, 40)
BarView.SetBounds(244, 0, 403, 40)
BarTools.SetBounds(647, 0, 122, 40)
MetroBarCplane.SetBounds(769, 1, 314, 80)
' Seleziono la Modalità Disegna
MetroTabModDisegna.Select()
SuperTabDisegna.Visible = True
SuperTabCostruisci.Visible = True
@@ -87,9 +93,14 @@ Public Class MainForm
SuperTabTrasforma.Visible = True
SuperTabLavorazioni.Visible = False
SuperTabSottopezzi.Visible = False
SuperTabLua.Visible = False
'SuperTabStripSinistra.SelectedTab('.SubItems("SuperTabDisegna") per essere sicuro che esca disegna come prima tab selezionata(da correggere)
ExpPanelGeometryTree.Visible = True
InputBox.Visible = False
'Disattivo tutti i CustomButton prima di eseguire il Form_Load
For Each CustomButton As ButtonItem In BarTabLua.Items
CustomButton.Visible = False
Next
End Sub
@@ -133,12 +144,18 @@ Public Class MainForm
BarTabSottopezzi.Visible = False
End If
If SuperTabLua.IsSelected Then
BarTabLua.Visible = True
Else
BarTabLua.Visible = False
End If
End Sub
Private Sub MetroShell1_SelectedTabChanged(sender As Object, e As EventArgs) Handles MetroShell1.SelectedTabChanged
Private Sub MetroShell1_SelectedTabChanged(sender As Object, e As EventArgs) Handles MainMetroShell.SelectedTabChanged
If MetroShell1.SelectedTab.Name = "MetroTabModDisegna" Then
'Aggiungo le barre alla Modalità Disegna
If MainMetroShell.SelectedTab.Name = "MetroTabModDisegna" Then
'Aggiungo le barre alla Modalità Disegna
MetroTabPanelModDisegna.Controls.Add(BarRendering)
MetroTabPanelModDisegna.Controls.Add(BarZoom)
btnCPlane.Enabled = True
@@ -152,6 +169,7 @@ Public Class MainForm
SuperTabTrasforma.Visible = True
SuperTabLavorazioni.Visible = False
SuperTabSottopezzi.Visible = False
SuperTabLua.Visible = False
'Seleziono gli ExpPanel visibili del PanelExDestra
ExpPanelGeometryTree.Visible = True
InputBox.Visible = True
@@ -159,8 +177,8 @@ Public Class MainForm
ExpPanelInfo.Visible = True
End If
If MetroShell1.SelectedTab.Name = "MetroTabModLavora" Then
'Aggiungo le barre alla Modalità Lavora
If MainMetroShell.SelectedTab.Name = "MetroTabModLavora" Then
'Aggiungo le barre alla Modalità Lavora
MetroTabPanelModLavora.Controls.Add(BarRendering)
MetroTabPanelModLavora.Controls.Add(BarZoom)
btnCPlane.Enabled = False
@@ -174,6 +192,7 @@ Public Class MainForm
SuperTabCostruisci.Visible = False
SuperTabModifica.Visible = False
SuperTabTrasforma.Visible = False
SuperTabLua.Visible = True
'Seleziono gli ExpPanel visibili del PanelExDestra
ExpPanelGeometryTree.Visible = False
InputBox.Visible = False
@@ -183,8 +202,55 @@ Public Class MainForm
End Sub
'Private Sub MetroShell1_MouseMove(sender As Object, e As EventArgs) Handles MainMetroShell.MouseMove NON FUNZIONA! chiedi in support perchè non attiva l'evento
' If ContextMenuMruFiles.Expanded Then
' For Each Element As ButtonItem In MainMetroShell.Items
' If Element.Name <> btnOpen.Name And Element.IsMouseOver Then
' ContextMenuMruFiles.Expanded = False
' End If
' Next
' End If
' If ContextMenuMruScripts.Expanded Then
' For Each Element As ButtonItem In MainMetroShell.Items
' If Element.Name <> btnExec.Name And Element.IsMouseOver Then
' ContextMenuMruScripts.Expanded = False
' End If
' Next
' End If
'End Sub
'-------------------------------- Form ------------------------------------------------------------
Private Sub Scene1_MouseMove(sender As Object, e As EventArgs) Handles Scene1.MouseMove
If Not IsNothing(m_OpenedPopUpMenu) Then
If m_OpenedPopUpMenu.Name = "btnOpen" Then
If m_OpenedPopUpMenu.IsMouseOver Or ContextMenuMruFiles.IsMouseOverExpand Then
Else
ContextMenuMruFiles.Expanded = False
End If
End If
If m_OpenedPopUpMenu.Name = "btnExec" Then
If m_OpenedPopUpMenu.IsMouseOver Or ContextMenuMruScripts.IsMouseOverExpand Then
Else
ContextMenuMruScripts.Expanded = False
End If
End If
End If
If Not IsNothing(m_OpenedPopUp) Then
If m_OpenedPopUp.IsMouseOver Or m_OpenedPopUp.IsMouseOverExpand Then
Else
m_OpenedPopUp.ClosePopup()
End If
End If
End Sub
'-------------------------------- Form ------------------------------------------------------------
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
' Installo aggiornamento interfaccia
AddHandler System.Windows.Forms.Application.Idle, AddressOf Application_Idle
' Title
@@ -316,7 +382,7 @@ Public Class MainForm
m_nObjTreeOldId = GDB_ID.NULL
' nascondo input box
ResetInputBox()
' aggiungo voce per about box nel menù di sistema
' aggiungo voce per about box nel menù di sistema
Dim hSysMenu As IntPtr = GetSystemMenu(Handle, False)
If hSysMenu <> IntPtr.Zero Then
AppendMenu(hSysMenu, MF_SEPARATOR, 0, "")
@@ -358,6 +424,27 @@ Public Class MainForm
m_Controller.NewProject(True)
' Impostazione Testi e ToolTips
SetMessages()
'CustomButtons
For I As Integer = 0 To 10
Dim CustomButton As String = String.Empty
GetPrivateProfileString("CustomButtons", "Button" & I + 1, "", CustomButton, m_sIniFile)
Dim CustomButtonStruct() As String = CustomButton.Split(",".ToCharArray)
If CustomButtonStruct.Count = 3 Then
BarTabLua.Items(I).Text = CustomButtonStruct(0)
If CustomButtonStruct(1) <> "" Then
Dim sPath As String = m_sDataRoot & "\" & LUACMD_DIR & "\" & CustomButtonStruct(1)
If File.Exists(sPath) Then
Dim TempButton As ButtonItem = BarTabLua.Items(I)
TempButton.Image = System.Drawing.Image.FromFile(sPath)
End If
End If
BarTabLua.Items(I).Tag = CustomButtonStruct(2)
BarTabLua.Items(I).Visible = True
ElseIf CustomButtonStruct.Count = 1 Then
Else
MessageBoxEx.Show("Errore nella lettura del file .ini: [CustomButtons]", "Errore", MessageBoxButtons.OK)
End If
Next
End Sub
Private Sub ManageIstance()
@@ -421,7 +508,7 @@ Public Class MainForm
FormTimer.Start()
End Sub
Private Sub FormTickEvent(source As Object, e As EventArgs) Handles FormTimer.Tick
Private Sub FormTickEvent(source As Object, e As EventArgs)
FormTimer.Stop()
' Recupero eventuali parametri da linea di comando
Dim bOpen As Boolean = False
@@ -469,17 +556,21 @@ Public Class MainForm
RemoveHandler Application.Idle, AddressOf Application_Idle
End Sub
'Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
' MyBase.WndProc(m)
' If m.Msg = WM_SYSCOMMAND Then
' If m.WParam.ToInt32 = IDM_ABOUTBOX Then
' AboutBox1.ShowDialog()
' End If
' End If
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
MyBase.WndProc(m)
If m.Msg = WM_SYSCOMMAND Then
If m.WParam.ToInt32 = IDM_ABOUTBOX Then
'AboutBox1.ShowDialog()
End If
End If
End Sub
'Private Sub ciao(sender As Object, e As System.EventArgs) Handles Scene1.MouseLeave
'End Sub
'-------------------------------- Events management ----------------------------------------------
Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Handles Scene1.OnCursorPos
'tsStatusCursorPos.Text = sCursorPos
End Sub
@@ -826,13 +917,19 @@ Public Class MainForm
End Sub
Private Sub btnOpen_Click(sender As System.Object, e As System.EventArgs) Handles btnOpen.Click
'If (ModifierKeys And Keys.Shift) <> Keys.Shift Then
Dim sDir As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sDir, m_sIniFile)
m_Controller.OpenProject(sDir)
'Else
'ShowMenuMruFiles(btnOpen, New Point(0, btnOpen.Size.Height))
'End If
End Sub
Private Sub btnOpen_MouseHover(sender As System.Object, e As System.EventArgs) Handles btnOpen.MouseHover
If ContextMenuMruFiles.Expanded = True Then
Return
End If
Dim p As Point = PointToScreen(btnOpen.DisplayRectangle.Location)
p.Y += btnOpen.Size.Height
ShowMenuMruFiles(btnOpen, p)
m_OpenedPopUpMenu = btnOpen
End Sub
Private Sub btnInsert_Click(sender As System.Object, e As System.EventArgs) Handles btnInsert.Click
@@ -877,13 +974,19 @@ Public Class MainForm
End Sub
Private Sub btnExec_Click(sender As System.Object, e As System.EventArgs) Handles btnExec.Click
'If (ModifierKeys And Keys.Shift) <> Keys.Shift Then
' Dim sDir As String = String.Empty
' GetPrivateProfileString(S_GENERAL, K_LASTLUADIR, "", sDir, m_sIniFile)
' m_Controller.Exec(sDir)
'Else
' ShowMenuMruScripts(btnExec, New Point(0, btnExec.Height))
'End If
Dim sDir As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTLUADIR, "", sDir, m_sIniFile)
m_Controller.Exec(sDir)
End Sub
Private Sub btnExec_MouseHover(sender As System.Object, e As System.EventArgs) Handles btnExec.MouseHover
If ContextMenuMruScripts.Expanded = True Then
Return
End If
Dim p As Point = PointToScreen(btnExec.DisplayRectangle.Location)
p.Y += btnExec.Size.Height
ShowMenuMruScripts(btnExec, p)
m_OpenedPopUpMenu = btnExec
End Sub
Private Sub btnWireFrame_Click(sender As System.Object, e As System.EventArgs) Handles btnWireFrame.Click
@@ -1073,15 +1176,27 @@ Public Class MainForm
End If
End Sub
Private Sub btnCircleCP_Click(sender As System.Object, e As System.EventArgs) Handles btnCircle.Click
If (ModifierKeys And Keys.Shift) <> Keys.Shift Then
m_Controller.ExecuteCommand(CMD.CIRCLECP)
Else
m_Controller.ExecuteCommand(CMD.CIRCLECD)
End If
Private Sub btnLinePDL_MouseHover(sender As System.Object, e As System.EventArgs) Handles btnLinePDL.MouseHover
Dim p As Point = BarTabDisegna.PointToScreen(btnLinePDL.DisplayRectangle.Location)
p.Offset(-2, -3)
btnLinePDL.PopupBar(p)
m_OpenedPopUp = btnLinePDL
End Sub
Private Sub btnCircleCD_Click(sender As System.Object, e As System.EventArgs)
Private Sub btnCircleCP_Click(sender As System.Object, e As System.EventArgs) Handles btnCircle.Click
'If (ModifierKeys And Keys.Shift) <> Keys.Shift Then
m_Controller.ExecuteCommand(CMD.CIRCLECP)
'Else
'm_Controller.ExecuteCommand(CMD.CIRCLECD)
'End If
End Sub
Private Sub btnCircleCP_MouseHover(sender As System.Object, e As System.EventArgs) Handles btnCircle.MouseHover
btnCircle.Expanded = True
m_OpenedPopUp = btnCircle
End Sub
Private Sub btnCircleDiameter_Click(sender As System.Object, e As System.EventArgs) Handles btnCircleDiameter.Click
m_Controller.ExecuteCommand(CMD.CIRCLECD)
End Sub
@@ -1253,6 +1368,82 @@ Public Class MainForm
m_Controller.ExecuteCommand(CMD.OFFSET)
End Sub
Private Sub btnCustom1_Click(sender As System.Object, e As System.EventArgs) Handles btnCustom1.Click
If btnCustom1.Tag <> "" Then
Dim sPath As String = m_sDataRoot & "\" & LUACMD_DIR & "\" & btnCustom1.Tag
m_Controller.Exec(sPath, False)
End If
End Sub
Private Sub btnCustom2_Click(sender As System.Object, e As System.EventArgs) Handles btnCustom2.Click
If btnCustom2.Tag <> "" Then
Dim sPath As String = m_sDataRoot & "\" & LUACMD_DIR & "\" & btnCustom2.Tag
m_Controller.Exec(sPath, False)
End If
End Sub
Private Sub btnCustom3_Click(sender As System.Object, e As System.EventArgs) Handles btnCustom3.Click
If btnCustom3.Tag <> "" Then
Dim sPath As String = m_sDataRoot & "\" & LUACMD_DIR & "\" & btnCustom3.Tag
m_Controller.Exec(sPath, False)
End If
End Sub
Private Sub btnCustom4_Click(sender As System.Object, e As System.EventArgs) Handles btnCustom4.Click
If btnCustom4.Tag <> "" Then
Dim sPath As String = m_sDataRoot & "\" & LUACMD_DIR & "\" & btnCustom4.Tag
m_Controller.Exec(sPath, False)
End If
End Sub
Private Sub btnCustom5_Click(sender As System.Object, e As System.EventArgs) Handles btnCustom5.Click
If btnCustom5.Tag <> "" Then
Dim sPath As String = m_sDataRoot & "\" & LUACMD_DIR & "\" & btnCustom5.Tag
m_Controller.Exec(sPath, False)
End If
End Sub
Private Sub btnCustom6_Click(sender As System.Object, e As System.EventArgs) Handles btnCustom6.Click
If btnCustom6.Tag <> "" Then
Dim sPath As String = m_sDataRoot & "\" & LUACMD_DIR & "\" & btnCustom6.Tag
m_Controller.Exec(sPath, False)
End If
End Sub
Private Sub btnCustom7_Click(sender As System.Object, e As System.EventArgs) Handles btnCustom7.Click
If btnCustom7.Tag <> "" Then
Dim sPath As String = m_sDataRoot & "\" & LUACMD_DIR & "\" & btnCustom7.Tag
m_Controller.Exec(sPath, False)
End If
End Sub
Private Sub btnCustom8_Click(sender As System.Object, e As System.EventArgs) Handles btnCustom8.Click
If btnCustom8.Tag <> "" Then
Dim sPath As String = m_sDataRoot & "\" & LUACMD_DIR & "\" & btnCustom8.Tag
m_Controller.Exec(sPath, False)
End If
End Sub
Private Sub btnCustom9_Click(sender As System.Object, e As System.EventArgs) Handles btnCustom9.Click
If btnCustom9.Tag <> "" Then
Dim sPath As String = m_sDataRoot & "\" & LUACMD_DIR & "\" & btnCustom9.Tag
m_Controller.Exec(sPath, False)
End If
End Sub
Private Sub btnCustom10_Click(sender As System.Object, e As System.EventArgs) Handles btnCustom10.Click
If btnCustom10.Tag <> "" Then
Dim sPath As String = m_sDataRoot & "\" & LUACMD_DIR & "\" & btnCustom10.Tag
m_Controller.Exec(sPath, False)
End If
End Sub
Private Sub btnCustom11_Click(sender As System.Object, e As System.EventArgs) Handles btnCustom11.Click
If btnCustom11.Tag <> "" Then
Dim sPath As String = m_sDataRoot & "\" & LUACMD_DIR & "\" & btnCustom11.Tag
m_Controller.Exec(sPath, False)
End If
End Sub
'-------------------------------- KeyDown --------------------------------------------------------
Private Sub MainForm_KeyDown(ByVal sender As System.Object, ByVal e As KeyEventArgs) Handles MyBase.KeyDown
@@ -1270,17 +1461,17 @@ Public Class MainForm
End Sub
Private Sub Scene1_KeyDown(ByVal sender As System.Object, ByVal e As KeyEventArgs) Handles Scene1.KeyDown
' Con DEL eseguo cancellazione delle entità selezionate
' Con DEL eseguo cancellazione delle entità selezionate
If e.KeyData = Keys.Delete Then
m_Controller.SetLastInteger(GDB_ID.SEL)
m_Controller.ExecuteCommand(CMD.DELETE)
' Con SPAZIO ripeto l'ultimo comando
ElseIf e.KeyData = Keys.Space Then
m_Controller.RepeatLastCommand()
' Con 'A' e in modalità continuazione, forzo il passaggio ad arco
' Con 'A' e in modalità continuazione, forzo il passaggio ad arco
ElseIf e.KeyData = Keys.A And m_Controller.GetContinue() Then
m_Controller.ContinueArcPDP()
' Con 'L' e in modalità continuazione, forzo il passaggio a retta
' Con 'L' e in modalità continuazione, forzo il passaggio a retta
ElseIf e.KeyData = Keys.L And m_Controller.GetContinue() Then
m_Controller.ContinueLine2P()
' Con 'V' cambio lo stato del check
@@ -1433,7 +1624,7 @@ Public Class MainForm
Private m_nObjTreeOldId As Integer = GDB_ID.NULL
Private m_nObjTreeMenuId As Integer = GDB_ID.NULL
Private Sub ObjTreeTickEvent(source As Object, e As EventArgs) Handles ObjTreeTimer.Tick
Private Sub ObjTreeTickEvent(source As Object, e As EventArgs)
If m_nObjTreeOldId <> GDB_ID.NULL Then
EgtResetMark(m_nObjTreeOldId)
EgtDraw()
@@ -1562,7 +1753,7 @@ Public Class MainForm
Private Sub UpdateObjTree()
' per aggiornare l'albero senza ricostruirlo da capo
' se c'è una entità corrente, ne aggiorno i dati
' se c'è una entità corrente, ne aggiorno i dati
If m_nObjTreeOldId <> GDB_ID.NULL Then
UpdateObjDataInObjTree(m_nObjTreeOldId)
End If
@@ -1652,7 +1843,7 @@ Public Class MainForm
If e.Button = Windows.Forms.MouseButtons.Right Then
' Id pezzo sotto il mouse
m_nObjTreeMenuId = nId
' verifico stato visualizzazione per abilitare voci menù
' verifico stato visualizzazione per abilitare voci menù
Dim nStat As GDB_ST = GDB_ST.ON_
Dim bOn As Boolean = EgtGetCalcStatus(m_nObjTreeMenuId, nStat) And nStat <> GDB_ST.OFF
For Each Item As ButtonItem In ContextMenuTreeView1.SubItems
@@ -1862,12 +2053,12 @@ Public Class MainForm
'-------------------------------- MRU Files Menu -------------------------------------------------
Private Sub ShowMenuMruFiles(ByVal control As Control, ByVal Pos As Point)
Private Sub ShowMenuMruFiles(ByVal control As ButtonItem, ByVal Pos As Point)
Dim sFileName As String = String.Empty
For Each Item As ToolStripItem In ContextMenuMruFiles.SubItems
For Each Item As BaseItem In ContextMenuMruFiles.SubItems
Dim nInd As Integer
If Item.Name = "MruTitle" Then
Item.Text = EgtMsg(19) ' Recent files
Item.Text = "<b>" & EgtMsg(19) & "</b>" ' Recent files"
Item.Visible = True
ElseIf Item.Name = "MruSep" Then
Item.Visible = True
@@ -1890,12 +2081,12 @@ Public Class MainForm
End Sub
'-------------------------------- MRU Scripts Menu -----------------------------------------------
Private Sub ShowMenuMruScripts(ByVal control As Control, ByVal Pos As Point)
Private Sub ShowMenuMruScripts(ByVal control As ButtonItem, ByVal Pos As Point)
Dim sFileName As String = String.Empty
For Each Item As ToolStripItem In ContextMenuMruScripts.SubItems
For Each Item As BaseItem In ContextMenuMruScripts.SubItems
Dim nInd As Integer
If Item.Name = "MruSTitle" Then
Item.Text = EgtMsg(20) ' Recent scripts
Item.Text = "<b>" & EgtMsg(20) & "</b>" ' Recent scripts
Item.Visible = True
ElseIf Item.Name = "MruSSep" Then
Item.Visible = True
@@ -1908,6 +2099,7 @@ Public Class MainForm
End If
Next
ContextMenuMruScripts.PopupMenu(Pos.X, Pos.Y, True)
ContextMenuMruScripts.Expanded = True
End Sub
Private Sub OnMenuMruScripts_ItemClick(sender As Object, e As ToolStripItemClickedEventArgs) Handles ContextMenuMruScripts.Click
@@ -1917,4 +2109,7 @@ Public Class MainForm
End If
End Sub
End Class
Private Sub OnMenuMruScripts_ItemClick(sender As Object, e As EventArgs) Handles ContextMenuMruScripts.Click
End Sub
End Class
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB