From bd1ca260d04a5ed11308e08db5ef03d08b313c73 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sun, 6 Sep 2015 17:06:42 +0000 Subject: [PATCH] TestEIn : - modifiche e correzioni a Scene per touch - modifiche a dialogo input variabili componenti. --- Component.vb | 2 +- My Project/AssemblyInfo.vb | 4 +- Scene.vb | 96 +++++++++++++++++++++++++++----------- VarInput.Designer.vb | 30 ++++++++---- 4 files changed, 93 insertions(+), 39 deletions(-) diff --git a/Component.vb b/Component.vb index c238971..27dccf7 100644 --- a/Component.vb +++ b/Component.vb @@ -202,7 +202,7 @@ Public Class Component Dim ptScreen As Point = Scene2.PointToScreen(e.Location) ptScreen.Offset(0, 0) VarInDlg.Location = ptScreen - If VarInDlg.ShowDialog() = System.Windows.Forms.DialogResult.Cancel Then + If VarInDlg.ShowDialog(Me) = System.Windows.Forms.DialogResult.Cancel Then Return End If ' Applico il nuovo valore diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index a0b96ee..a45435d 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 8dbb069..e7cda3a 100644 --- a/Scene.vb +++ b/Scene.vb @@ -23,8 +23,8 @@ Public Class Scene '---- Members --------- Private m_nGseContext As Integer - Private m_nStatus As ST - Private m_nOldStatus As ST + Private m_nStatus As ST = ST.NULL + Private m_nOldStatus As ST = ST.NULL Private Enum ST As Integer NULL = 0 SEL @@ -42,14 +42,14 @@ Public Class Scene SELPOINT SELPOINTZ End Enum - Private m_nSnapType As SP ' tipo di snap in selezione punto - Private m_bAlsoSelDir As Boolean ' abilita anche selezione direzione quando selezione punto - Private m_bAlsoDragIntersForSnap As Boolean ' abilita intersezione con drag per snap a punto - Private m_bAlsoSurfForSnap As Boolean ' abilita anche le superfici come sorgenti per snap a punto + Private m_nSnapType As SP = SP.PT_GRID ' tipo di snap in selezione punto + Private m_bAlsoSelDir As Boolean = False ' abilita anche selezione direzione quando selezione punto + Private m_bAlsoDragIntersForSnap As Boolean = False ' abilita intersezione con drag per snap a punto + Private m_bAlsoSurfForSnap As Boolean = False ' abilita anche le superfici come sorgenti per snap a punto Private m_PrevPoint As Point Private m_ptPrev As Point3d Private m_ptGrid As Point3d - Private m_bGridCursorPos As Boolean + Private m_bGridCursorPos As Boolean = False Private m_nDriver As Integer Private m_b2Buff As Boolean Private m_nColorBits As Integer @@ -214,6 +214,7 @@ Public Class Scene 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, e As System.Windows.Forms.MouseEventArgs) + Public Event OnMouseUpScene(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) @@ -233,7 +234,7 @@ Public Class Scene End Sub Protected Overrides Sub OnMouseDown(e As System.Windows.Forms.MouseEventArgs) - ' Imposto il contesto della scena come corrente + ' Imposto il contesto della scena EgtSetCurrentContext(m_nGseContext) ' --- Pressione tasto sinistro --- If e.Button = Windows.Forms.MouseButtons.Left Then @@ -281,6 +282,21 @@ Public Class Scene End If m_nStatus = ST.SEL End If + ' se stato PAN + ElseIf m_nStatus = ST.PAN Then + Cursor = New Cursor(Me.GetType(), "Pan.cur") + ' salvo il punto in coordinate finestra + m_PrevPoint = e.Location + ' se stato ROT + ElseIf m_nStatus = ST.ROT Then + Cursor = New Cursor(Me.GetType(), "Rotate.cur") + ' salvo il punto in coordinate finestra + m_PrevPoint = e.Location + ' se stato ZOOMWIN + ElseIf m_nStatus = ST.ZOOMWIN Then + Cursor = New Cursor(Me.GetType(), "ZoomWin.cur") + ' salvo il punto in coordinate finestra + m_PrevPoint = e.Location ' se stato ANALYZE ElseIf m_nStatus = ST.ANALYZE Then EgtSetObjFilterForSelect(True, True, True, True, True) @@ -426,8 +442,9 @@ Public Class Scene If nOldGseCtx <> m_nGseContext Then EgtSetCurrentContext(m_nGseContext) End If - ' --- Rilascio tasto sinistro --- - If e.Button = Windows.Forms.MouseButtons.Left Then + ' --- Rilascio tasto sinistro o tasto medio (rotella) --- + If e.Button = Windows.Forms.MouseButtons.Left Or + e.Button = Windows.Forms.MouseButtons.Middle Then If m_nStatus = ST.WINSEL Then EgtResetWinRect(True) ' determino entità selezionate @@ -456,20 +473,20 @@ Public Class Scene ' ritorno allo stato SEL m_nStatus = ST.SEL Cursor = New Cursor(Me.GetType(), "Select.cur") - End If - ' --- Rilascio tasto medio (rotella) --- - ElseIf e.Button = Windows.Forms.MouseButtons.Middle Then - If m_nStatus = ST.ZOOMWIN Then + ElseIf m_nStatus = ST.ZOOMWIN Then EgtResetWinRect(False) EgtZoomWin(m_PrevPoint, e.Location, True) End If - ' eventuale ripristino vecchio stato - If RestoreStatus() Then - ' non devo fare alcunché - ' reset dello stato se non SEL - ElseIf m_nStatus <> ST.SEL Then - m_nStatus = ST.SEL - Cursor = New Cursor(Me.GetType(), "Select.cur") + ' Per solo bottone medio... + If e.Button = Windows.Forms.MouseButtons.Middle Then + ' eventuale ripristino vecchio stato + If RestoreStatus() Then + ' non devo fare alcunché + ' reset dello stato se non SEL + ElseIf m_nStatus <> ST.SEL Then + m_nStatus = ST.SEL + Cursor = New Cursor(Me.GetType(), "Select.cur") + End If End If ' --- Rilascio tasto destro --- ElseIf e.Button = Windows.Forms.MouseButtons.Right Then @@ -479,6 +496,7 @@ Public Class Scene Else MyBase.OnMouseUp(e) End If + RaiseEvent OnMouseUpScene(Me, e) ' Ripristino il contesto originale If nOldGseCtx <> m_nGseContext Then EgtSetCurrentContext(nOldGseCtx) @@ -501,15 +519,13 @@ Public Class Scene End If ' Visualizzo le coordinate del mouse ShowCursorPos(e.Location) - ' --- Premuto tasto sinistro --- - If e.Button = Windows.Forms.MouseButtons.Left Then + ' --- Premuto tasto sinistro o centrale (rotella) --- + If e.Button = Windows.Forms.MouseButtons.Left Or + e.Button = Windows.Forms.MouseButtons.Middle Then If m_nStatus = ST.WINSEL Then Cursor = New Cursor(Me.GetType(), "WinSelect.cur") EgtSetWinRect(m_PrevPoint, e.Location, True) - End If - ' --- Premuto tasto centrale (rotella) --- - ElseIf e.Button = Windows.Forms.MouseButtons.Middle Then - If m_nStatus = ST.ZOOMWIN Then + ElseIf m_nStatus = ST.ZOOMWIN Then Cursor = New Cursor(Me.GetType(), "ZoomWin.cur") EgtSetWinRect(m_PrevPoint, e.Location, True) 'Il punto di riferimento deve rimanere quello originale @@ -521,7 +537,8 @@ Public Class Scene Cursor = New Cursor(Me.GetType(), "Pan.cur") EgtPanView(m_PrevPoint, e.Location, True) m_PrevPoint = e.Location - Else + ElseIf m_nStatus <> ST.NULL And + e.Button = Windows.Forms.MouseButtons.Middle Then m_nStatus = ST.SEL End If ' --- Altri casi dipendenti dallo stato --- @@ -1034,18 +1051,41 @@ Public Class Scene Public Sub SetStatusNull() m_nStatus = ST.NULL + m_nOldStatus = ST.NULL + End Sub + + Public Function IsStatusNull() As Boolean + Return (m_nStatus = ST.NULL) + End Function + + Public Sub SetStatusPan() + SaveCurrStatus() + m_nStatus = ST.PAN + End Sub + + Public Sub SetStatusRot() + SaveCurrStatus() + m_nStatus = ST.ROT + End Sub + + Public Sub SetStatusZoomWin() + SaveCurrStatus() + m_nStatus = ST.ZOOMWIN End Sub Public Sub SetStatusAnalyze() m_nStatus = ST.ANALYZE + m_nOldStatus = ST.ANALYZE End Sub Public Sub SetStatusGetDistance() m_nStatus = ST.GETDIST + m_nOldStatus = ST.GETDIST End Sub Public Sub SetStatusSelPoint(Optional ByVal bAlsoDir As Boolean = False) m_nStatus = ST.SELPOINT + m_nOldStatus = ST.SELPOINT m_bAlsoSelDir = bAlsoDir End Sub diff --git a/VarInput.Designer.vb b/VarInput.Designer.vb index a4d4d0d..6a3106a 100644 --- a/VarInput.Designer.vb +++ b/VarInput.Designer.vb @@ -25,12 +25,15 @@ Partial Class VarInput Me.tbVariable = New System.Windows.Forms.TextBox() Me.btnCancel = New System.Windows.Forms.Button() Me.btnOk = New System.Windows.Forms.Button() + Me.Panel1 = New System.Windows.Forms.Panel() + Me.Panel1.SuspendLayout() Me.SuspendLayout() ' 'tbVariable ' + Me.tbVariable.Dock = System.Windows.Forms.DockStyle.Top 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.Location = New System.Drawing.Point(0, 0) Me.tbVariable.Margin = New System.Windows.Forms.Padding(0) Me.tbVariable.Name = "tbVariable" Me.tbVariable.Size = New System.Drawing.Size(156, 22) @@ -39,7 +42,7 @@ Partial Class VarInput 'btnCancel ' Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.btnCancel.Location = New System.Drawing.Point(89, 28) + Me.btnCancel.Location = New System.Drawing.Point(84, 31) Me.btnCancel.Name = "btnCancel" Me.btnCancel.Size = New System.Drawing.Size(60, 22) Me.btnCancel.TabIndex = 2 @@ -48,24 +51,33 @@ Partial Class VarInput ' 'btnOk ' - Me.btnOk.Location = New System.Drawing.Point(12, 28) + Me.btnOk.Location = New System.Drawing.Point(12, 31) 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 ' + 'Panel1 + ' + Me.Panel1.Controls.Add(Me.tbVariable) + Me.Panel1.Controls.Add(Me.btnCancel) + Me.Panel1.Controls.Add(Me.btnOk) + Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill + Me.Panel1.Location = New System.Drawing.Point(0, 0) + Me.Panel1.Name = "Panel1" + Me.Panel1.Size = New System.Drawing.Size(156, 58) + Me.Panel1.TabIndex = 3 + ' '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.ClientSize = New System.Drawing.Size(156, 58) Me.ControlBox = False - Me.Controls.Add(Me.btnOk) - Me.Controls.Add(Me.btnCancel) - Me.Controls.Add(Me.tbVariable) + Me.Controls.Add(Me.Panel1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D Me.KeyPreview = True Me.Name = "VarInput" @@ -73,11 +85,13 @@ Partial Class VarInput Me.ShowIcon = False Me.ShowInTaskbar = False Me.TopMost = True + Me.Panel1.ResumeLayout(False) + Me.Panel1.PerformLayout() 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 + Friend WithEvents Panel1 As System.Windows.Forms.Panel End Class