From fa6fd311524ee515bfab7a428ac9cbae518e1b12 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 18 Aug 2015 07:42:39 +0000 Subject: [PATCH] TestEIn 1.6h3 : - adattamenti vari - aggiunto input diretto parametri a componenti. --- Component.Designer.vb | 112 +++++++++++++++++++--------------- Component.vb | 106 +++++++++++++++++++++++--------- Controller.vb | 24 +++++--- EgtInterface.vb | 47 ++++++++++----- FlatParts.vb | 12 ++-- My Project/AssemblyInfo.vb | 4 +- Scene.vb | 4 +- TestEIn.vbproj | 9 +++ VarInput.Designer.vb | 83 +++++++++++++++++++++++++ VarInput.resx | 120 +++++++++++++++++++++++++++++++++++++ VarInput.vb | 34 +++++++++++ 11 files changed, 451 insertions(+), 104 deletions(-) create mode 100644 VarInput.Designer.vb create mode 100644 VarInput.resx create mode 100644 VarInput.vb diff --git a/Component.Designer.vb b/Component.Designer.vb index 20d25bb..f60beb0 100644 --- a/Component.Designer.vb +++ b/Component.Designer.vb @@ -25,7 +25,6 @@ Partial Class Component Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Component)) Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() - Me.Scene2 = New TestEIn.Scene() Me.ListBox1 = New System.Windows.Forms.ListBox() Me.TableLayoutPanel2 = New System.Windows.Forms.TableLayoutPanel() Me.tbName1 = New System.Windows.Forms.TextBox() @@ -51,9 +50,13 @@ Partial Class Component Me.btnView = New System.Windows.Forms.Button() Me.tbMsg = New System.Windows.Forms.TextBox() Me.btnInsert = New System.Windows.Forms.Button() - Me.tbNbr = New System.Windows.Forms.TextBox() + Me.tbNbr = New System.Windows.Forms.NumericUpDown() + Me.Panel1 = New System.Windows.Forms.Panel() + Me.Scene2 = New TestEIn.Scene() Me.TableLayoutPanel1.SuspendLayout() Me.TableLayoutPanel2.SuspendLayout() + CType(Me.tbNbr, System.ComponentModel.ISupportInitialize).BeginInit() + Me.Panel1.SuspendLayout() Me.SuspendLayout() ' 'TableLayoutPanel1 @@ -74,17 +77,6 @@ Partial Class Component Me.TableLayoutPanel1.Size = New System.Drawing.Size(744, 414) Me.TableLayoutPanel1.TabIndex = 3 ' - 'Scene2 - ' - Me.Scene2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D - Me.Scene2.Cursor = System.Windows.Forms.Cursors.Default - Me.Scene2.Dock = System.Windows.Forms.DockStyle.Fill - Me.Scene2.Location = New System.Drawing.Point(200, 0) - Me.Scene2.Margin = New System.Windows.Forms.Padding(0) - Me.Scene2.Name = "Scene2" - Me.Scene2.Size = New System.Drawing.Size(544, 154) - Me.Scene2.TabIndex = 3 - ' 'ListBox1 ' Me.ListBox1.Dock = System.Windows.Forms.DockStyle.Fill @@ -101,11 +93,11 @@ Partial Class Component 'TableLayoutPanel2 ' Me.TableLayoutPanel2.ColumnCount = 5 - Me.TableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0!)) Me.TableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 97.0!)) Me.TableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 97.0!)) Me.TableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60.0!)) - Me.TableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 80.0!)) Me.TableLayoutPanel2.Controls.Add(Me.tbName1, 1, 0) Me.TableLayoutPanel2.Controls.Add(Me.tbName2, 1, 1) Me.TableLayoutPanel2.Controls.Add(Me.tbName3, 1, 2) @@ -126,10 +118,8 @@ Partial Class Component Me.TableLayoutPanel2.Controls.Add(Me.tbValue8, 2, 7) Me.TableLayoutPanel2.Controls.Add(Me.tbValue9, 2, 8) Me.TableLayoutPanel2.Controls.Add(Me.tbValue10, 2, 9) - Me.TableLayoutPanel2.Controls.Add(Me.btnView, 4, 1) Me.TableLayoutPanel2.Controls.Add(Me.tbMsg, 0, 10) - Me.TableLayoutPanel2.Controls.Add(Me.btnInsert, 4, 3) - Me.TableLayoutPanel2.Controls.Add(Me.tbNbr, 4, 4) + Me.TableLayoutPanel2.Controls.Add(Me.Panel1, 4, 0) Me.TableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill Me.TableLayoutPanel2.Location = New System.Drawing.Point(203, 157) Me.TableLayoutPanel2.Name = "TableLayoutPanel2" @@ -151,7 +141,7 @@ Partial Class Component 'tbName1 ' Me.tbName1.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbName1.Location = New System.Drawing.Point(142, 0) + Me.tbName1.Location = New System.Drawing.Point(56, 0) Me.tbName1.Margin = New System.Windows.Forms.Padding(0) Me.tbName1.Name = "tbName1" Me.tbName1.ReadOnly = True @@ -163,7 +153,7 @@ Partial Class Component 'tbName2 ' Me.tbName2.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbName2.Location = New System.Drawing.Point(142, 23) + Me.tbName2.Location = New System.Drawing.Point(56, 23) Me.tbName2.Margin = New System.Windows.Forms.Padding(0) Me.tbName2.Name = "tbName2" Me.tbName2.ReadOnly = True @@ -175,7 +165,7 @@ Partial Class Component 'tbName3 ' Me.tbName3.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbName3.Location = New System.Drawing.Point(142, 46) + Me.tbName3.Location = New System.Drawing.Point(56, 46) Me.tbName3.Margin = New System.Windows.Forms.Padding(0) Me.tbName3.Name = "tbName3" Me.tbName3.ReadOnly = True @@ -187,7 +177,7 @@ Partial Class Component 'tbName4 ' Me.tbName4.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbName4.Location = New System.Drawing.Point(142, 69) + Me.tbName4.Location = New System.Drawing.Point(56, 69) Me.tbName4.Margin = New System.Windows.Forms.Padding(0) Me.tbName4.Name = "tbName4" Me.tbName4.ReadOnly = True @@ -199,7 +189,7 @@ Partial Class Component 'tbName7 ' Me.tbName7.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbName7.Location = New System.Drawing.Point(142, 138) + Me.tbName7.Location = New System.Drawing.Point(56, 138) Me.tbName7.Margin = New System.Windows.Forms.Padding(0) Me.tbName7.Name = "tbName7" Me.tbName7.ReadOnly = True @@ -211,7 +201,7 @@ Partial Class Component 'tbName8 ' Me.tbName8.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbName8.Location = New System.Drawing.Point(142, 161) + Me.tbName8.Location = New System.Drawing.Point(56, 161) Me.tbName8.Margin = New System.Windows.Forms.Padding(0) Me.tbName8.Name = "tbName8" Me.tbName8.ReadOnly = True @@ -223,7 +213,7 @@ Partial Class Component 'tbName9 ' Me.tbName9.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbName9.Location = New System.Drawing.Point(142, 184) + Me.tbName9.Location = New System.Drawing.Point(56, 184) Me.tbName9.Margin = New System.Windows.Forms.Padding(0) Me.tbName9.Name = "tbName9" Me.tbName9.ReadOnly = True @@ -235,7 +225,7 @@ Partial Class Component 'tbName10 ' Me.tbName10.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbName10.Location = New System.Drawing.Point(142, 207) + Me.tbName10.Location = New System.Drawing.Point(56, 207) Me.tbName10.Margin = New System.Windows.Forms.Padding(0) Me.tbName10.Name = "tbName10" Me.tbName10.ReadOnly = True @@ -247,7 +237,7 @@ Partial Class Component 'tbName6 ' Me.tbName6.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbName6.Location = New System.Drawing.Point(142, 115) + Me.tbName6.Location = New System.Drawing.Point(56, 115) Me.tbName6.Margin = New System.Windows.Forms.Padding(0) Me.tbName6.Name = "tbName6" Me.tbName6.ReadOnly = True @@ -259,7 +249,7 @@ Partial Class Component 'tbName5 ' Me.tbName5.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbName5.Location = New System.Drawing.Point(142, 92) + Me.tbName5.Location = New System.Drawing.Point(56, 92) Me.tbName5.Margin = New System.Windows.Forms.Padding(0) Me.tbName5.Name = "tbName5" Me.tbName5.ReadOnly = True @@ -271,7 +261,7 @@ Partial Class Component 'tbValue1 ' Me.tbValue1.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbValue1.Location = New System.Drawing.Point(239, 0) + Me.tbValue1.Location = New System.Drawing.Point(153, 0) Me.tbValue1.Margin = New System.Windows.Forms.Padding(0) Me.tbValue1.Name = "tbValue1" Me.tbValue1.Size = New System.Drawing.Size(97, 24) @@ -281,7 +271,7 @@ Partial Class Component 'tbValue2 ' Me.tbValue2.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbValue2.Location = New System.Drawing.Point(239, 23) + Me.tbValue2.Location = New System.Drawing.Point(153, 23) Me.tbValue2.Margin = New System.Windows.Forms.Padding(0) Me.tbValue2.Name = "tbValue2" Me.tbValue2.Size = New System.Drawing.Size(97, 24) @@ -291,7 +281,7 @@ Partial Class Component 'tbValue3 ' Me.tbValue3.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbValue3.Location = New System.Drawing.Point(239, 46) + Me.tbValue3.Location = New System.Drawing.Point(153, 46) Me.tbValue3.Margin = New System.Windows.Forms.Padding(0) Me.tbValue3.Name = "tbValue3" Me.tbValue3.Size = New System.Drawing.Size(97, 24) @@ -301,7 +291,7 @@ Partial Class Component 'tbValue4 ' Me.tbValue4.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbValue4.Location = New System.Drawing.Point(239, 69) + Me.tbValue4.Location = New System.Drawing.Point(153, 69) Me.tbValue4.Margin = New System.Windows.Forms.Padding(0) Me.tbValue4.Name = "tbValue4" Me.tbValue4.Size = New System.Drawing.Size(97, 24) @@ -311,7 +301,7 @@ Partial Class Component 'tbValue5 ' Me.tbValue5.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbValue5.Location = New System.Drawing.Point(239, 92) + Me.tbValue5.Location = New System.Drawing.Point(153, 92) Me.tbValue5.Margin = New System.Windows.Forms.Padding(0) Me.tbValue5.Name = "tbValue5" Me.tbValue5.Size = New System.Drawing.Size(97, 24) @@ -321,7 +311,7 @@ Partial Class Component 'tbValue6 ' Me.tbValue6.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbValue6.Location = New System.Drawing.Point(239, 115) + Me.tbValue6.Location = New System.Drawing.Point(153, 115) Me.tbValue6.Margin = New System.Windows.Forms.Padding(0) Me.tbValue6.Name = "tbValue6" Me.tbValue6.Size = New System.Drawing.Size(97, 24) @@ -331,7 +321,7 @@ Partial Class Component 'tbValue7 ' Me.tbValue7.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbValue7.Location = New System.Drawing.Point(239, 138) + Me.tbValue7.Location = New System.Drawing.Point(153, 138) Me.tbValue7.Margin = New System.Windows.Forms.Padding(0) Me.tbValue7.Name = "tbValue7" Me.tbValue7.Size = New System.Drawing.Size(97, 24) @@ -341,7 +331,7 @@ Partial Class Component 'tbValue8 ' Me.tbValue8.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbValue8.Location = New System.Drawing.Point(239, 161) + Me.tbValue8.Location = New System.Drawing.Point(153, 161) Me.tbValue8.Margin = New System.Windows.Forms.Padding(0) Me.tbValue8.Name = "tbValue8" Me.tbValue8.Size = New System.Drawing.Size(97, 24) @@ -351,7 +341,7 @@ Partial Class Component 'tbValue9 ' Me.tbValue9.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbValue9.Location = New System.Drawing.Point(239, 184) + Me.tbValue9.Location = New System.Drawing.Point(153, 184) Me.tbValue9.Margin = New System.Windows.Forms.Padding(0) Me.tbValue9.Name = "tbValue9" Me.tbValue9.Size = New System.Drawing.Size(97, 24) @@ -361,7 +351,7 @@ Partial Class Component 'tbValue10 ' Me.tbValue10.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbValue10.Location = New System.Drawing.Point(239, 207) + Me.tbValue10.Location = New System.Drawing.Point(153, 207) Me.tbValue10.Margin = New System.Windows.Forms.Padding(0) Me.tbValue10.Name = "tbValue10" Me.tbValue10.Size = New System.Drawing.Size(97, 24) @@ -370,15 +360,15 @@ Partial Class Component ' 'btnView ' - Me.btnView.Dock = System.Windows.Forms.DockStyle.Left Me.btnView.Enabled = False Me.btnView.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.btnView.Location = New System.Drawing.Point(396, 23) + Me.btnView.Location = New System.Drawing.Point(0, 20) Me.btnView.Margin = New System.Windows.Forms.Padding(0) Me.btnView.Name = "btnView" Me.btnView.Size = New System.Drawing.Size(75, 23) Me.btnView.TabIndex = 20 Me.btnView.Text = "View" + Me.btnView.UseCompatibleTextRendering = True Me.btnView.UseVisualStyleBackColor = True ' 'tbMsg @@ -398,23 +388,48 @@ Partial Class Component ' Me.btnInsert.Enabled = False Me.btnInsert.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.btnInsert.Location = New System.Drawing.Point(396, 69) + Me.btnInsert.Location = New System.Drawing.Point(92, 20) Me.btnInsert.Margin = New System.Windows.Forms.Padding(0) Me.btnInsert.Name = "btnInsert" Me.btnInsert.Size = New System.Drawing.Size(75, 23) Me.btnInsert.TabIndex = 21 Me.btnInsert.Text = "Insert" + Me.btnInsert.UseCompatibleTextRendering = True + Me.btnInsert.UseMnemonic = False Me.btnInsert.UseVisualStyleBackColor = True ' 'tbNbr ' - Me.tbNbr.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.tbNbr.Location = New System.Drawing.Point(396, 92) - Me.tbNbr.Margin = New System.Windows.Forms.Padding(0) + Me.tbNbr.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.tbNbr.Location = New System.Drawing.Point(169, 20) Me.tbNbr.Name = "tbNbr" - Me.tbNbr.Size = New System.Drawing.Size(75, 24) - Me.tbNbr.TabIndex = 23 + Me.tbNbr.Size = New System.Drawing.Size(35, 22) + Me.tbNbr.TabIndex = 24 Me.tbNbr.TextAlign = System.Windows.Forms.HorizontalAlignment.Center + Me.tbNbr.Value = New Decimal(New Integer() {1, 0, 0, 0}) + ' + 'Panel1 + ' + Me.Panel1.Controls.Add(Me.btnView) + Me.Panel1.Controls.Add(Me.btnInsert) + Me.Panel1.Controls.Add(Me.tbNbr) + Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill + Me.Panel1.Location = New System.Drawing.Point(313, 3) + Me.Panel1.Name = "Panel1" + Me.TableLayoutPanel2.SetRowSpan(Me.Panel1, 4) + Me.Panel1.Size = New System.Drawing.Size(222, 86) + Me.Panel1.TabIndex = 25 + ' + 'Scene2 + ' + Me.Scene2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D + Me.Scene2.Cursor = System.Windows.Forms.Cursors.Default + Me.Scene2.Dock = System.Windows.Forms.DockStyle.Fill + Me.Scene2.Location = New System.Drawing.Point(200, 0) + Me.Scene2.Margin = New System.Windows.Forms.Padding(0) + Me.Scene2.Name = "Scene2" + Me.Scene2.Size = New System.Drawing.Size(544, 154) + Me.Scene2.TabIndex = 3 ' 'Component ' @@ -434,6 +449,8 @@ Partial Class Component Me.TableLayoutPanel1.ResumeLayout(False) Me.TableLayoutPanel2.ResumeLayout(False) Me.TableLayoutPanel2.PerformLayout() + CType(Me.tbNbr, System.ComponentModel.ISupportInitialize).EndInit() + Me.Panel1.ResumeLayout(False) Me.ResumeLayout(False) End Sub @@ -464,6 +481,7 @@ End Sub Friend WithEvents btnView As System.Windows.Forms.Button Friend WithEvents btnInsert As System.Windows.Forms.Button Friend WithEvents tbMsg As System.Windows.Forms.TextBox - Friend WithEvents tbNbr As System.Windows.Forms.TextBox + Friend WithEvents tbNbr As System.Windows.Forms.NumericUpDown + Friend WithEvents Panel1 As System.Windows.Forms.Panel End Class diff --git a/Component.vb b/Component.vb index 0aecb17..c238971 100644 --- a/Component.vb +++ b/Component.vb @@ -20,6 +20,7 @@ Public Class Component Private Const NUM_VAR As Integer = 10 Private Const LUA_CMP_VARS As String = "CMP" Private Const LUA_CMP_DRAW As String = "CMP_Draw" + Private Const INFO_VAR As String = "Var" ' Properties Private m_sCompoDir As String = String.Empty @@ -63,6 +64,8 @@ Public Class Component Scene2.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits) ' inizializzo la scena (DB geometrico + visualizzazione) Scene2.Init() + ' inibisco selezione diretta da Scene + Scene2.SetStatusNull() ' assegno posizione e dimensioni finestra Dim nFlag As Integer Dim nLeft As Integer @@ -70,10 +73,14 @@ Public Class Component Dim nWidth As Integer Dim nHeight As Integer GetPrivateProfileWinPos(S_COMPO, K_CMPWINPLACE, nFlag, nLeft, nTop, nWidth, nHeight, Form1.GetIniFile()) - Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual - Me.Location = New Point(nLeft, nTop) - Me.Size = New Size(nWidth, nHeight) - WindowState = If(nFlag = 1, FormWindowState.Maximized, FormWindowState.Normal) + Dim PtTL = New Point(nLeft, nTop) + Dim s As Screen = Screen.FromPoint(PtTL) + If s.Bounds.Contains(PtTL) Then + Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual + Me.Location = New Point(nLeft, nTop) + Me.Size = New Size(nWidth, nHeight) + WindowState = If(nFlag = 1, FormWindowState.Maximized, FormWindowState.Normal) + End If ' leggo direttorio componenti GetPrivateProfileString(S_COMPO, K_COMPODIR, "", m_sCompoDir, Form1.GetIniFile()) ' recupero i file lua del direttorio e li inserisco nella lista dei componenti @@ -83,11 +90,8 @@ Public Class Component For Each Fi In vFi ListBox1.Items.Add(IO.Path.GetFileNameWithoutExtension(Fi.Name)) Next - ' imposto selezione sul primo + ' Imposto selezione sul primo -> viene caricato il relativo componente ListBox1.SelectedIndex = 0 - ' Carico componente - Dim sCompo As String = ListBox1.SelectedItem.ToString() - LoadCurrentCompo(sCompo) End Sub Private Sub Component_FormClosing(sender As System.Object, e As FormClosingEventArgs) Handles MyBase.FormClosing @@ -115,12 +119,12 @@ Public Class Component End Sub Private Sub LoadCurrentCompo(ByVal sCompo As String) - ' verifico se cambiato + ' Verifico se cambiato If sCompo = m_sCompoName Then Return End If m_sCompoName = sCompo - 'Pulisco l'ambiente lua + ' Pulisco l'ambiente lua ResetLuaVariables() ' Carico il file ed eseguo in modalità anteprima Dim bOk As Boolean = ExecCompoFile() @@ -175,6 +179,46 @@ Public Class Component Me.Close() End Sub + Protected Sub OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Scene2.OnMouseDownScene + ' Verifico se selezionata variabile + EgtSetObjFilterForSelect(True, True, True, True, True) + Dim nSel As Integer + EgtSelect(e.Location, 2 * DIM_SEL, 2 * DIM_SEL, nSel) + Dim nVarInd As Integer = 0 + Dim nId As Integer = EgtGetFirstObjInSelWin() + While nId <> GDB_ID.NULL + If EgtGetInfo(nId, INFO_VAR, nVarInd) Then + Exit While + End If + nId = EgtGetNextObjInSelWin() + End While + If nVarInd = 0 Then + Return + End If + ' Dialogo modifica diretta variabile + Dim VarInDlg As New VarInput + VarInDlg.m_sVarVal = m_CVars(nVarInd - 1).ToString() + VarInDlg.StartPosition = System.Windows.Forms.FormStartPosition.Manual + Dim ptScreen As Point = Scene2.PointToScreen(e.Location) + ptScreen.Offset(0, 0) + VarInDlg.Location = ptScreen + If VarInDlg.ShowDialog() = System.Windows.Forms.DialogResult.Cancel Then + Return + End If + ' Applico il nuovo valore + m_CVars(nVarInd - 1).FromString(VarInDlg.m_sVarVal) + GetValueEdit(nVarInd).Text = m_CVars(nVarInd - 1).ToString() + m_CVars(nVarInd - 1).ToLua() + ' Ricalcolo il disegno + Dim sMsg As String = String.Empty + MakePreview(sMsg) + tbMsg.Text = sMsg + tbMsg.BackColor = If(m_bDrawOk, Color.White, Color.Tomato) + ' aggiorno visualizzazione + EgtSetView(VT.TOP, False) + EgtZoom(ZM.ALL) + End Sub + Private Function ExecCompoFile() As Boolean ' Costruisco path completa del componente Dim sPath = m_sCompoDir & "\" & m_sCompoName & ".lua" @@ -183,16 +227,17 @@ Public Class Component End Function Private Function ReadAndShowVariables() As Boolean - ' recupero nome, tipo e valore delle variabili globali + ' Recupero nome, tipo e valore delle variabili globali For i As Integer = 1 To NUM_VAR Dim CVar = New CompoVar - If CVar.NameTypeValueFromLua(i) Then + CVar.m_nInd = i + If CVar.NameTypeValueFromLua() Then m_CVars(i - 1) = CVar Else m_CVars(i - 1) = Nothing End If Next - ' aggiorno la griglia dalle variabili + ' Aggiorno la griglia dalle variabili For i As Integer = 1 To NUM_VAR If m_CVars(i - 1) IsNot Nothing Then GetNameEdit(i).Text = m_CVars(i - 1).m_sName @@ -216,7 +261,7 @@ Public Class Component GetValueEdit(i).Text = m_CVars(i - 1).ToString() End If ' aggiorno la corrispondente variabile lua - If Not m_CVars(i - 1).ToLua(i) Then + If Not m_CVars(i - 1).ToLua() Then Dim sErr As String = String.Empty EgtLuaGetLastError(sErr) EgtOutLog(sErr) @@ -323,9 +368,11 @@ Public Class Component End Select End Function + ' --------------------------------------------------------------------------- Private Class CompoVar ' Public Members + Public m_nInd As Integer Public m_sName As String Public m_nType As Integer Public m_bVal As Boolean @@ -339,6 +386,7 @@ Public Class Component Const LUA_VALUE As String = LUA_CMP_VARS & ".V" Public Sub New() + m_nInd = 0 m_nType = 0 End Sub @@ -391,37 +439,41 @@ Public Class Component Return False End Function - Public Function ToLua(ByVal nInd As Integer) As Boolean + Public Function ToLua() As Boolean Select Case m_nType Case 1 - Return EgtLuaSetGlobBoolVar(LUA_VALUE & nInd.ToString(), m_bVal) + Return EgtLuaSetGlobBoolVar(LUA_VALUE & m_nInd.ToString(), m_bVal) Case 2 - Return EgtLuaSetGlobIntVar(LUA_VALUE & nInd.ToString(), m_nVal) + Return EgtLuaSetGlobIntVar(LUA_VALUE & m_nInd.ToString(), m_nVal) Case 3, 4 - Return EgtLuaSetGlobNumVar(LUA_VALUE & nInd.ToString(), m_dVal) + Return EgtLuaSetGlobNumVar(LUA_VALUE & m_nInd.ToString(), m_dVal) Case 5 - Return EgtLuaSetGlobStringVar(LUA_VALUE & nInd.ToString(), m_sVal) + Return EgtLuaSetGlobStringVar(LUA_VALUE & m_nInd.ToString(), m_sVal) End Select Return False End Function - Public Function NameTypeValueFromLua(ByVal nInd As Integer) As Boolean - Dim bOk As Boolean = True - bOk = bOk AndAlso EgtLuaGetGlobStringVar(LUA_NAME & nInd.ToString(), m_sName) - bOk = bOk AndAlso EgtLuaGetGlobIntVar(LUA_TYPE & nInd.ToString(), m_nType) + Public Function FromLua() As Boolean Select Case m_nType Case 1 - Return bOk AndAlso EgtLuaGetGlobBoolVar(LUA_VALUE & nInd.ToString(), m_bVal) + Return EgtLuaGetGlobBoolVar(LUA_VALUE & m_nInd.ToString(), m_bVal) Case 2 - Return bOk AndAlso EgtLuaGetGlobIntVar(LUA_VALUE & nInd.ToString(), m_nVal) + Return EgtLuaGetGlobIntVar(LUA_VALUE & m_nInd.ToString(), m_nVal) Case 3, 4 - Return bOk AndAlso EgtLuaGetGlobNumVar(LUA_VALUE & nInd.ToString(), m_dVal) + Return EgtLuaGetGlobNumVar(LUA_VALUE & m_nInd.ToString(), m_dVal) Case 5 - Return bOk AndAlso EgtLuaGetGlobStringVar(LUA_VALUE & nInd.ToString(), m_sVal) + Return EgtLuaGetGlobStringVar(LUA_VALUE & m_nInd.ToString(), m_sVal) End Select Return False End Function + Public Function NameTypeValueFromLua() As Boolean + Dim bOk As Boolean = True + bOk = bOk AndAlso EgtLuaGetGlobStringVar(LUA_NAME & m_nInd.ToString(), m_sName) + bOk = bOk AndAlso EgtLuaGetGlobIntVar(LUA_TYPE & m_nInd.ToString(), m_nType) + Return bOk AndAlso FromLua() + End Function + End Class End Class diff --git a/Controller.vb b/Controller.vb index 938860a..a8b2552 100644 --- a/Controller.vb +++ b/Controller.vb @@ -1590,6 +1590,16 @@ Public Class Controller DisableCommandLog() End If End If + Case GDB_TY.SRF_FRGN + Dim ptOrig As Point3d + Dim vtZ As Vector3d + If EgtCenterPoint(nId, ptOrig) AndAlso EgtSurfFrNormVersor(nId, vtZ) Then + Dim frNew As New Frame3d + frNew.Setup(ptOrig.Glob(nId), vtZ.Glob(nId)) + EnableCommandLog() + EgtSetGridFrame(frNew) + DisableCommandLog() + End If Case GDB_TY.EXT_TEXT Dim vtX As Vector3d Dim vtZ As Vector3d @@ -1888,7 +1898,7 @@ Public Class Controller Return False End If ' se non ci sono oggetti selezionati copio ed esco subito - If EgtGetSelectedObjNbr() = 0 Then + If EgtGetSelectedObjCount() = 0 Then EnableCommandLog() Dim nNewId = DoCopyPartLayerObj(m_nLast) DisableCommandLog() @@ -3452,12 +3462,12 @@ Public Class Controller End If ' creo la superficie piana (a partire da un contorno selezionato) EnableCommandLog() - If EgtGetSelectedObjNbr() = 1 Then + If EgtGetSelectedObjCount() = 1 Then EgtCreateSurfTmByFlatContour(GetCurrLayer(), EgtGetLastSelectedObj(), EPS_STM) Else ' creo vettore di entità selezionate Dim nCrvNum As Integer = 0 - Dim nCrvIds(EgtGetSelectedObjNbr() - 1) As Integer + Dim nCrvIds(EgtGetSelectedObjCount() - 1) As Integer Dim nId As Integer = EgtGetFirstSelectedObj() While nId <> GDB_ID.NULL Select Case EgtGetType(nId) @@ -3505,7 +3515,7 @@ Public Class Controller Dim VtExtr As Vector3d = Vector3d.Z_AX * m_dLast ' creo vettore di entità selezionate Dim nCrvNum As Integer = 0 - Dim nCrvIds(EgtGetSelectedObjNbr() - 1) As Integer + Dim nCrvIds(EgtGetSelectedObjCount() - 1) As Integer Dim nId As Integer = EgtGetFirstSelectedObj() While nId <> GDB_ID.NULL Select Case EgtGetType(nId) @@ -3543,7 +3553,7 @@ Public Class Controller ' creo la superficie di estrusione (a partire da uno o più contorni selezionati) Dim VtExtr As Vector3d = EgtGetGridVersZ() * m_dLast Dim nCrvNum As Integer = 0 - Dim nCrvIds(EgtGetSelectedObjNbr() - 1) As Integer + Dim nCrvIds(EgtGetSelectedObjCount() - 1) As Integer Dim nId As Integer = EgtGetFirstSelectedObj() While nId <> GDB_ID.NULL Select Case EgtGetType(nId) @@ -3731,7 +3741,7 @@ Public Class Controller End If ' creo vettore di superfici selezionate Dim nSurfNum As Integer = 0 - Dim nSurfIds(EgtGetSelectedObjNbr() - 1) As Integer + Dim nSurfIds(EgtGetSelectedObjCount() - 1) As Integer Dim nId As Integer = EgtGetFirstSelectedObj() While nId <> GDB_ID.NULL Select Case EgtGetType(nId) @@ -3768,7 +3778,7 @@ Public Class Controller Dim nNextId = EgtGetNextSelectedObj() ' eseguo esplosione Dim nCount As Integer - Dim nFirstId As Integer = EgtExplodeSurfTm(nId, nCount) + Dim nFirstId As Integer = EgtExplodeSurface(nId, nCount) ' passo al successivo nId = nNextId End While diff --git a/EgtInterface.vb b/EgtInterface.vb index 91ad95b..bdfe6e4 100644 --- a/EgtInterface.vb +++ b/EgtInterface.vb @@ -2678,17 +2678,17 @@ Public Function EgtInvertSurface(ByVal nId As Integer) As Boolean End If End Function - -Private Function EgtExplodeSurfTm_32(ByVal nId As Integer, ByRef nCount As Integer) As Integer + +Private Function EgtExplodeSurface_32(ByVal nId As Integer, ByRef nCount As Integer) As Integer End Function - -Private Function EgtExplodeSurfTm_64(ByVal nId As Integer, ByRef nCount As Integer) As Integer + +Private Function EgtExplodeSurface_64(ByVal nId As Integer, ByRef nCount As Integer) As Integer End Function -Public Function EgtExplodeSurfTm(ByVal nId As Integer, ByRef nCount As Integer) As Integer +Public Function EgtExplodeSurface(ByVal nId As Integer, ByRef nCount As Integer) As Integer If IntPtr.Size = 4 Then - Return EgtExplodeSurfTm_32(nId, nCount) + Return EgtExplodeSurface_32(nId, nCount) Else - Return EgtExplodeSurfTm_64(nId, nCount) + Return EgtExplodeSurface_64(nId, nCount) End If End Function @@ -2890,7 +2890,6 @@ Public Function EgtGetPrevLayer(ByVal nLayerId As Integer, Optional ByVal bOnlyV End If End Function - Private Function EgtEraseEmptyParts_32() As Boolean End Function @@ -2975,6 +2974,7 @@ Public Function EgtSelectPathObjs(ByVal nId As Integer, ByVal bHaltOnFork As Boo End If End Function + '---------- GeomDb Objects ----------------------------------------------------- Private Function EgtExistsObj_32(ByVal nId As Integer) As Boolean @@ -3900,17 +3900,17 @@ Public Function EgtIsSelectedObj(ByVal nId As Integer) As Boolean End If End Function - -Private Function EgtGetSelectedObjNbr_32() As Integer + +Private Function EgtGetSelectedObjCount_32() As Integer End Function - -Private Function EgtGetSelectedObjNbr_64() As Integer + +Private Function EgtGetSelectedObjCount_64() As Integer End Function -Public Function EgtGetSelectedObjNbr() As Integer +Public Function EgtGetSelectedObjCount() As Integer If IntPtr.Size = 4 Then - Return EgtGetSelectedObjNbr_32() + Return EgtGetSelectedObjCount_32() Else - Return EgtGetSelectedObjNbr_64() + Return EgtGetSelectedObjCount_64() End If End Function @@ -4501,6 +4501,23 @@ Public Function EgtArcNormVersor(ByVal nId As Integer, ByRef VtNorm As Vector3d) Return EgtArcNormVersor(nId, nId, VtNorm) End Function + +Private Function EgtSurfFrNormVersor_32(ByVal nId As Integer, ByVal nRefId As Integer, ByRef VtNorm As Vector3d) As Boolean +End Function + +Private Function EgtSurfFrNormVersor_64(ByVal nId As Integer, ByVal nRefId As Integer, ByRef VtNorm As Vector3d) As Boolean +End Function +Public Function EgtSurfFrNormVersor(ByVal nId As Integer, ByVal nRefId As Integer, ByRef VtNorm As Vector3d) As Boolean + If IntPtr.Size = 4 Then + Return EgtSurfFrNormVersor_32(nId, nRefId, VtNorm) + Else + Return EgtSurfFrNormVersor_64(nId, nRefId, VtNorm) + End If +End Function +Public Function EgtSurfFrNormVersor(ByVal nId As Integer, ByRef VtNorm As Vector3d) As Boolean + Return EgtSurfFrNormVersor(nId, nId, VtNorm) +End Function + Private Function EgtSurfTmFacetFromTria_32(ByVal nId As Integer, ByVal nT As Integer) As Integer End Function diff --git a/FlatParts.vb b/FlatParts.vb index e7a97d1..c2fc5b8 100644 --- a/FlatParts.vb +++ b/FlatParts.vb @@ -53,10 +53,14 @@ Public Class FlatParts Dim nWidth As Integer Dim nHeight As Integer GetPrivateProfileWinPos(S_FLATPARTS, K_FLPWINPLACE, nFlag, nLeft, nTop, nWidth, nHeight, Form1.GetIniFile()) - Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual - Me.Location = New Point(nLeft, nTop) - Me.Size = New Size(nWidth, nHeight) - WindowState = If(nFlag = 1, FormWindowState.Maximized, FormWindowState.Normal) + Dim PtTL = New Point(nLeft, nTop) + Dim s As Screen = Screen.FromPoint(PtTL) + If s.Bounds.Contains(PtTL) Then + Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual + Me.Location = New Point(nLeft, nTop) + Me.Size = New Size(nWidth, nHeight) + WindowState = If(nFlag = 1, FormWindowState.Maximized, FormWindowState.Normal) + End If ' leggo direttorio corrente GetPrivateProfileString(S_FLATPARTS, K_FLPCURRDIR, "", m_sCurrDir, Form1.GetIniFile()) ' lo carico diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 02d3a4f..e8619ee 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -46,5 +46,5 @@ Imports System.Runtime.InteropServices ' utilizzando l'asterisco (*) come descritto di seguito: ' - - + + diff --git a/Scene.vb b/Scene.vb index 6939a0f..5d98d40 100644 --- a/Scene.vb +++ b/Scene.vb @@ -213,7 +213,7 @@ Public Class Scene Public Event OnMouseSelectedPath(ByVal sender As Object, ByVal nId As Integer, ByVal bHaltOnFork As Boolean) Public Event OnMouseAnalyzed(ByVal sender As Object, ByVal nId As Integer) Public Event OnMousePointFromSelection(ByVal sender As Object, ByVal nId As Integer, ByVal PtP As Point3d, ByVal nAux As Integer) - Public Event OnMouseDownScene(ByVal sender As Object) + Public Event OnMouseDownScene(ByVal sender As Object, e As System.Windows.Forms.MouseEventArgs) Public Event OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Public Event OnShowDistance(ByVal sender As Object, ByVal sDistance As String) Public Event OnCloseGetDist(ByVal sender As Object) @@ -411,7 +411,7 @@ Public Class Scene MyBase.OnMouseDown(e) End If Focus() - RaiseEvent OnMouseDownScene(Me) + RaiseEvent OnMouseDownScene(Me, e) End Sub Protected Overrides Sub OnMouseUp(e As System.Windows.Forms.MouseEventArgs) diff --git a/TestEIn.vbproj b/TestEIn.vbproj index 6143c26..3168587 100644 --- a/TestEIn.vbproj +++ b/TestEIn.vbproj @@ -187,6 +187,12 @@ True Resources.resx + + VarInput.vb + + + Form + SelectMulti.vb @@ -239,6 +245,9 @@ Designer Resources.Designer.vb + + VarInput.vb + Scene.vb diff --git a/VarInput.Designer.vb b/VarInput.Designer.vb new file mode 100644 index 0000000..a4d4d0d --- /dev/null +++ b/VarInput.Designer.vb @@ -0,0 +1,83 @@ + _ +Partial Class VarInput + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.tbVariable = New System.Windows.Forms.TextBox() + Me.btnCancel = New System.Windows.Forms.Button() + Me.btnOk = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'tbVariable + ' + Me.tbVariable.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.tbVariable.Location = New System.Drawing.Point(3, 2) + Me.tbVariable.Margin = New System.Windows.Forms.Padding(0) + Me.tbVariable.Name = "tbVariable" + Me.tbVariable.Size = New System.Drawing.Size(156, 22) + Me.tbVariable.TabIndex = 0 + ' + 'btnCancel + ' + Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.btnCancel.Location = New System.Drawing.Point(89, 28) + Me.btnCancel.Name = "btnCancel" + Me.btnCancel.Size = New System.Drawing.Size(60, 22) + Me.btnCancel.TabIndex = 2 + Me.btnCancel.Text = "Cancel" + Me.btnCancel.UseVisualStyleBackColor = True + ' + 'btnOk + ' + Me.btnOk.Location = New System.Drawing.Point(12, 28) + Me.btnOk.Name = "btnOk" + Me.btnOk.Size = New System.Drawing.Size(60, 22) + Me.btnOk.TabIndex = 1 + Me.btnOk.Text = "Ok" + Me.btnOk.UseVisualStyleBackColor = True + ' + 'VarInput + ' + Me.AcceptButton = Me.btnOk + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.CancelButton = Me.btnCancel + Me.ClientSize = New System.Drawing.Size(164, 55) + Me.ControlBox = False + Me.Controls.Add(Me.btnOk) + Me.Controls.Add(Me.btnCancel) + Me.Controls.Add(Me.tbVariable) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D + Me.KeyPreview = True + Me.Name = "VarInput" + Me.RightToLeftLayout = True + Me.ShowIcon = False + Me.ShowInTaskbar = False + Me.TopMost = True + Me.ResumeLayout(False) + Me.PerformLayout() + +End Sub + Friend WithEvents tbVariable As System.Windows.Forms.TextBox + Friend WithEvents btnCancel As System.Windows.Forms.Button + Friend WithEvents btnOk As System.Windows.Forms.Button +End Class diff --git a/VarInput.resx b/VarInput.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/VarInput.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/VarInput.vb b/VarInput.vb new file mode 100644 index 0000000..2efd12a --- /dev/null +++ b/VarInput.vb @@ -0,0 +1,34 @@ +'---------------------------------------------------------------------------- +' EgalTech 2015-2015 +'---------------------------------------------------------------------------- +' File : VarInput.vb Data : 09.08.15 Versione : 1.6h3 +' Contenuto : Classe VarInput (input variabile per componenti). +' +' +' +' Modifiche : 09.08.15 DS Creazione modulo. +' +' +'---------------------------------------------------------------------------- + + +Public Class VarInput + + Public m_sVarVal As String = String.Empty + + Private Sub VarInput_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load + tbVariable.Text = m_sVarVal + End Sub + + Private Sub btnOk_Click(sender As Object, e As EventArgs) Handles btnOk.Click + m_sVarVal = tbVariable.Text + Me.DialogResult = System.Windows.Forms.DialogResult.OK + Me.Close() + End Sub + + Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click + Me.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.Close() + End Sub + +End Class \ No newline at end of file