home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2002 March / PCWMAR02.iso / software / turbocad / v8trial / TurboCADv8ProfessionalNoReg.exe / Data.Cab / F42172_clsTCEventHandler.cls < prev    next >
Encoding:
Visual Basic class definition  |  2001-10-16  |  3.6 KB  |  114 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "clsTCEventHandler"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = False
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = True
  10. '******************************************************************'
  11. '*                                                                *'
  12. '*                      TurboCAD for Windows                      *'
  13. '*                   Copyright (c) 1993 - 2001                    *'
  14. '*             International Microcomputer Software, Inc.         *'
  15. '*                            (IMSI)                              *'
  16. '*                      All rights reserved.                      *'
  17. '*                                                                *'
  18. '******************************************************************'
  19.  
  20. Public Enum stateEnum
  21.      enStart = 0
  22.      enSelFirst = 1
  23.      enSelSecond = 2
  24.      enFinish = 3
  25. End Enum
  26.  
  27. Public state As stateEnum
  28.  
  29. Private xdbToolEvents As IToolEvents
  30. Private gxGrSbj As Graphic
  31. Private gxGrSbd As Graphic
  32.  
  33. Public Function MouseDown(WhichDrawing As Object, WhichView As Object, WhichWindow As Object, Button As ImsiMouseButton, Shift As Long, X As Long, Y As Long, Cancel As IMSI_BOOL)
  34.     
  35.     Dim gxView As View
  36.     Dim xView As Double
  37.     Dim yView As Double
  38.     Dim XScr As Double
  39.     Dim YScr As Double
  40.     Dim gxPResult As PickResult
  41.     
  42.     Dim gxGr As Graphic
  43.     Dim gxVrt As Vertex
  44.     
  45.     Set gxView = WhichView
  46.     If (Button = imsiLeftButton) Then
  47.         XScr = X
  48.         YScr = Y
  49.         WhichView.ScreenToView XScr, YScr, xView, yView
  50.         Set gxPResult = WhichView.PickPoint(xView, yView, , , False, False, True, False, False)
  51.         If (gxPResult.Count > 0) Then
  52.             Set gxGr = gxPResult(0).Graphic
  53.             ProcesNextPoint WhichDrawing, WhichView, gxGr
  54.         Else
  55.             Beep
  56.         End If
  57.         
  58.         Cancel = True
  59.     Else
  60.         Cancel = False
  61.     End If
  62.  
  63. End Function
  64.  
  65. Public Function RunTool(WhichTool As Tool)
  66.     DoLMCommand 0
  67. End Function
  68.  
  69. Public Function DrawingDeactivate(WhichDrawing As IDrawing)
  70.     DoLMCommand 0
  71. End Function
  72.  
  73. Public Function ProcesNextPoint(Optional gxDwg As IDrawing, Optional gxView As View, Optional gxGr As Graphic)
  74.     Dim gxTSets As TieSets
  75.     
  76.     Select Case state
  77.     Case enBegin
  78.         xdbToolEvents.ToolChangePrompt Me, "Select subject graphic for Vertex Tie", False
  79.         xdbToolEvents.ToolChangeCommands Me, 1, "Finish", "Finish AddVertexTie macro", True, False, True
  80.         state = enSelFirst
  81.     Case enSelFirst
  82.         xdbToolEvents.ToolChangePrompt Me, "Select subordinate graphic for Vertex Tie", False
  83.         Set gxGrSbj = gxGr
  84.         state = enSelSecond
  85.     Case enSelSecond
  86.         xdbToolEvents.ToolChangePrompt Me, "Select subject graphic for Vertex Tie", False
  87.         Set gxGrSbd = gxGr
  88.         Set gxTSets = gxDwg.TieSets
  89.         gxTSets.Add "VertexTie.clsVertexTie", gxGrSbj, gxGrSbd, 0, 0
  90.         gxTSets.Add "VertexTie.clsVertexTie", gxGrSbj, gxGrSbd, 1, 0
  91.         
  92.         state = enSelFirst
  93.         Set gxGrSbj = Nothing
  94.         Set gxGrSbd = Nothing
  95.         gxView.Refresh
  96.     End Select
  97.  
  98. End Function
  99.  
  100. Public Function DoLMCommand(idLMCmd As Long)
  101.     xdbToolEvents.ToolChangePrompt Me, "", True
  102.     xdbToolEvents.ToolChangeCommands Me, 0, , , , , False
  103.     Application.DisconnectEvents idConnection
  104.     state = enFinish
  105.     Set gxGrSbj = Nothing
  106.     Set gxGrSbd = Nothing
  107.     tcEventsHandler = Nothing
  108. End Function
  109.  
  110. Private Sub Class_Initialize()
  111.     Set xdbToolEvents = Application
  112.     state = enStart
  113. End Sub
  114.