home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD9640952000.psc / Maker.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-09-05  |  32.6 KB  |  1,047 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Begin VB.Form Form1 
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Editor - []"
  6.    ClientHeight    =   6045
  7.    ClientLeft      =   45
  8.    ClientTop       =   615
  9.    ClientWidth     =   7515
  10.    ControlBox      =   0   'False
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   6045
  15.    ScaleWidth      =   7515
  16.    StartUpPosition =   2  'CenterScreen
  17.    WhatsThisHelp   =   -1  'True
  18.    Begin VB.Frame Frame2 
  19.       BorderStyle     =   0  'None
  20.       Caption         =   "Frame2"
  21.       Height          =   6015
  22.       Left            =   5280
  23.       TabIndex        =   6
  24.       Top             =   0
  25.       Width           =   2175
  26.       Begin VB.CommandButton Command1 
  27.          Caption         =   "Set name"
  28.          Height          =   375
  29.          Left            =   0
  30.          TabIndex        =   14
  31.          Top             =   3000
  32.          Width           =   2055
  33.       End
  34.       Begin VB.Frame Frame1 
  35.          Caption         =   "Stuff...?"
  36.          Height          =   2415
  37.          Left            =   120
  38.          TabIndex        =   9
  39.          Top             =   3480
  40.          Width           =   1815
  41.          Begin VB.OptionButton func 
  42.             Caption         =   "Move Face"
  43.             Height          =   255
  44.             Index           =   3
  45.             Left            =   120
  46.             TabIndex        =   17
  47.             Top             =   1080
  48.             Width           =   1335
  49.          End
  50.          Begin VB.OptionButton func 
  51.             Caption         =   "Reposition"
  52.             Height          =   255
  53.             Index           =   6
  54.             Left            =   120
  55.             TabIndex        =   16
  56.             Top             =   1800
  57.             Width           =   1455
  58.          End
  59.          Begin VB.OptionButton func 
  60.             Caption         =   "Select"
  61.             Height          =   255
  62.             Index           =   0
  63.             Left            =   120
  64.             TabIndex        =   15
  65.             Top             =   240
  66.             Value           =   -1  'True
  67.             Width           =   1095
  68.          End
  69.          Begin VB.OptionButton func 
  70.             Caption         =   "Move Vertex"
  71.             Height          =   255
  72.             Index           =   2
  73.             Left            =   120
  74.             TabIndex        =   13
  75.             Top             =   840
  76.             Width           =   1215
  77.          End
  78.          Begin VB.OptionButton func 
  79.             Caption         =   "Add Box"
  80.             Height          =   255
  81.             Index           =   1
  82.             Left            =   120
  83.             TabIndex        =   12
  84.             Top             =   600
  85.             Width           =   1215
  86.          End
  87.          Begin VB.OptionButton func 
  88.             Caption         =   "Move Box"
  89.             Height          =   255
  90.             Index           =   4
  91.             Left            =   120
  92.             TabIndex        =   11
  93.             Top             =   1320
  94.             Width           =   1335
  95.          End
  96.          Begin VB.OptionButton func 
  97.             Caption         =   "Spin"
  98.             Height          =   255
  99.             Index           =   5
  100.             Left            =   120
  101.             TabIndex        =   10
  102.             Top             =   1560
  103.             Width           =   855
  104.          End
  105.       End
  106.       Begin VB.ListBox Names 
  107.          Height          =   2595
  108.          Left            =   0
  109.          TabIndex        =   8
  110.          Tag             =   "0"
  111.          Top             =   0
  112.          Width           =   2055
  113.       End
  114.       Begin VB.TextBox NewName 
  115.          Height          =   375
  116.          Left            =   0
  117.          TabIndex        =   7
  118.          Top             =   2640
  119.          Width           =   2055
  120.       End
  121.    End
  122.    Begin VB.PictureBox Picture1 
  123.       Appearance      =   0  'Flat
  124.       BackColor       =   &H00C0C0C0&
  125.       ForeColor       =   &H80000008&
  126.       Height          =   135
  127.       Left            =   0
  128.       ScaleHeight     =   105
  129.       ScaleWidth      =   105
  130.       TabIndex        =   5
  131.       Top             =   0
  132.       Width           =   135
  133.    End
  134.    Begin VB.HScrollBar OfsHoris 
  135.       Height          =   255
  136.       LargeChange     =   200
  137.       Left            =   0
  138.       Max             =   2000
  139.       Min             =   -2000
  140.       SmallChange     =   20
  141.       TabIndex        =   1
  142.       Top             =   5760
  143.       Value           =   -175
  144.       Width           =   4935
  145.    End
  146.    Begin VB.VScrollBar ofVert 
  147.       Height          =   5775
  148.       LargeChange     =   200
  149.       Left            =   4920
  150.       Max             =   2000
  151.       Min             =   -2000
  152.       SmallChange     =   20
  153.       TabIndex        =   2
  154.       Top             =   0
  155.       Value           =   -175
  156.       Width           =   255
  157.    End
  158.    Begin VB.PictureBox RuleSide 
  159.       Appearance      =   0  'Flat
  160.       AutoRedraw      =   -1  'True
  161.       BackColor       =   &H00E0E0E0&
  162.       BorderStyle     =   0  'None
  163.       ForeColor       =   &H80000008&
  164.       Height          =   5655
  165.       Left            =   0
  166.       ScaleHeight     =   377
  167.       ScaleMode       =   3  'Pixel
  168.       ScaleWidth      =   9
  169.       TabIndex        =   4
  170.       Tag             =   "50"
  171.       Top             =   120
  172.       Width           =   135
  173.    End
  174.    Begin VB.PictureBox RuleTop 
  175.       Appearance      =   0  'Flat
  176.       AutoRedraw      =   -1  'True
  177.       BackColor       =   &H00E0E0E0&
  178.       BorderStyle     =   0  'None
  179.       ForeColor       =   &H80000008&
  180.       Height          =   135
  181.       Left            =   120
  182.       ScaleHeight     =   9
  183.       ScaleMode       =   3  'Pixel
  184.       ScaleWidth      =   329
  185.       TabIndex        =   3
  186.       Tag             =   "50"
  187.       Top             =   0
  188.       Width           =   4935
  189.    End
  190.    Begin MSComDlg.CommonDialog Load 
  191.       Left            =   240
  192.       Top             =   240
  193.       _ExtentX        =   847
  194.       _ExtentY        =   847
  195.       _Version        =   393216
  196.       FileName        =   "*.mdl"
  197.    End
  198.    Begin MSComDlg.CommonDialog Save 
  199.       Left            =   840
  200.       Top             =   240
  201.       _ExtentX        =   847
  202.       _ExtentY        =   847
  203.       _Version        =   393216
  204.       FileName        =   "*.mdl"
  205.    End
  206.    Begin VB.PictureBox View 
  207.       AutoRedraw      =   -1  'True
  208.       BackColor       =   &H00FFFFFF&
  209.       Height          =   5655
  210.       Left            =   120
  211.       ScaleHeight     =   373
  212.       ScaleMode       =   3  'Pixel
  213.       ScaleWidth      =   317
  214.       TabIndex        =   0
  215.       Top             =   120
  216.       Width           =   4815
  217.       Begin VB.Line Guide 
  218.          BorderStyle     =   2  'Dash
  219.          Visible         =   0   'False
  220.          X1              =   112
  221.          X2              =   192
  222.          Y1              =   160
  223.          Y2              =   248
  224.       End
  225.    End
  226.    Begin VB.Menu mnuFile 
  227.       Caption         =   "File"
  228.       Begin VB.Menu mnuFileOptions 
  229.          Caption         =   "New"
  230.          Index           =   1
  231.          Shortcut        =   ^N
  232.       End
  233.       Begin VB.Menu mnuFileOptions 
  234.          Caption         =   "Load..."
  235.          Index           =   2
  236.       End
  237.       Begin VB.Menu mnuFileOptions 
  238.          Caption         =   "Merge with..."
  239.          Index           =   3
  240.       End
  241.       Begin VB.Menu mnuFileOptions 
  242.          Caption         =   "Save"
  243.          Enabled         =   0   'False
  244.          Index           =   4
  245.          Shortcut        =   ^S
  246.       End
  247.       Begin VB.Menu mnuFileOptions 
  248.          Caption         =   "Save as..."
  249.          Index           =   5
  250.       End
  251.       Begin VB.Menu mnuFileOptions 
  252.          Caption         =   "-"
  253.          Index           =   6
  254.       End
  255.       Begin VB.Menu mnuFileOptions 
  256.          Caption         =   "Export..."
  257.          Index           =   7
  258.       End
  259.       Begin VB.Menu mnuFileOptions 
  260.          Caption         =   "-"
  261.          Index           =   8
  262.       End
  263.       Begin VB.Menu mnuFileOptions 
  264.          Caption         =   "Exit"
  265.          Index           =   9
  266.       End
  267.    End
  268.    Begin VB.Menu mnuEdit 
  269.       Caption         =   "Edit"
  270.       Begin VB.Menu mnuEditOptions 
  271.          Caption         =   "Undo"
  272.          Enabled         =   0   'False
  273.          Index           =   1
  274.          Shortcut        =   %{BKSP}
  275.       End
  276.       Begin VB.Menu mnuEditOptions 
  277.          Caption         =   "-"
  278.          Index           =   2
  279.       End
  280.       Begin VB.Menu mnuEditOptions 
  281.          Caption         =   "Copy"
  282.          Index           =   3
  283.          Shortcut        =   ^C
  284.       End
  285.       Begin VB.Menu mnuEditOptions 
  286.          Caption         =   "Paste"
  287.          Index           =   4
  288.          Shortcut        =   ^V
  289.       End
  290.       Begin VB.Menu mnuEditOptions 
  291.          Caption         =   "-"
  292.          Index           =   5
  293.       End
  294.       Begin VB.Menu mnuEditOptions 
  295.          Caption         =   "Delete"
  296.          Index           =   6
  297.          Shortcut        =   {DEL}
  298.       End
  299.    End
  300.    Begin VB.Menu mnuView 
  301.       Caption         =   "View"
  302.       Begin VB.Menu oView 
  303.          Caption         =   "View from top"
  304.          Checked         =   -1  'True
  305.          Index           =   1
  306.          Shortcut        =   {F1}
  307.       End
  308.       Begin VB.Menu oView 
  309.          Caption         =   "View from side"
  310.          Index           =   2
  311.          Shortcut        =   {F2}
  312.       End
  313.       Begin VB.Menu oView 
  314.          Caption         =   "View from front"
  315.          Index           =   3
  316.          Shortcut        =   {F3}
  317.       End
  318.       Begin VB.Menu Space 
  319.          Caption         =   "-"
  320.       End
  321.       Begin VB.Menu mnuViewTools 
  322.          Caption         =   "Views toolbar"
  323.          Index           =   1
  324.          Shortcut        =   ^{F1}
  325.       End
  326.    End
  327.    Begin VB.Menu mnuTools 
  328.       Caption         =   "Tools"
  329.       Begin VB.Menu mnuToolOptions 
  330.          Caption         =   "Set name"
  331.          Index           =   1
  332.          Shortcut        =   {F12}
  333.       End
  334.       Begin VB.Menu mnuToolOptions 
  335.          Caption         =   "Hide me"
  336.          Index           =   2
  337.       End
  338.       Begin VB.Menu mnuToolOptions 
  339.          Caption         =   "Get info..."
  340.          Index           =   3
  341.       End
  342.       Begin VB.Menu mnuToolOptions 
  343.          Caption         =   "Edit surface properties..."
  344.          Index           =   4
  345.       End
  346.       Begin VB.Menu mnuToolOptions 
  347.          Caption         =   "3D viewer..."
  348.          Index           =   5
  349.       End
  350.       Begin VB.Menu mnuToolOptions 
  351.          Caption         =   "Open file viewer"
  352.          Index           =   6
  353.          Begin VB.Menu OpenViewer 
  354.             Caption         =   "DirectX"
  355.             Index           =   1
  356.          End
  357.          Begin VB.Menu OpenViewer 
  358.             Caption         =   "Software (Texture mapping)"
  359.             Index           =   2
  360.          End
  361.       End
  362.    End
  363.    Begin VB.Menu mnuPopup1 
  364.       Caption         =   "PopUpMenu"
  365.       Visible         =   0   'False
  366.       Begin VB.Menu mnuPopup1Options 
  367.          Caption         =   "Edit surface propeties"
  368.          Index           =   1
  369.       End
  370.       Begin VB.Menu mnuPopup1Options 
  371.          Caption         =   "Change colour"
  372.          Index           =   2
  373.       End
  374.    End
  375. Attribute VB_Name = "Form1"
  376. Attribute VB_GlobalNameSpace = False
  377. Attribute VB_Creatable = False
  378. Attribute VB_PredeclaredId = True
  379. Attribute VB_Exposed = False
  380. Dim MakeBox As Boolean
  381. Dim startX, StartY
  382. Dim bMoveX, bMoveY
  383. Dim spinAngle As Integer
  384. Dim StnColour As Double
  385. Private Sub Command1_Click()
  386. SetName
  387. End Sub
  388. Private Sub SetName()
  389. Shape(Selected).Name = NewName.Text
  390. End Sub
  391. Private Sub Form_Load()
  392. Zoom = 1
  393. mnuViewTools(1).Checked = True
  394. Views.Visible = True
  395. Xofs = -OfsHoris.Value
  396. Yofs = -ofVert.Value
  397. RuleTop.Tag = Int(View.ScaleWidth / 2)
  398. RuleSide.Tag = Int(View.ScaleHeight / 2)
  399. Make_LookUp
  400. DrawBars
  401. End Sub
  402. Private Sub Form_Unload(Cancel As Integer)
  403. Unload Views
  404. End Sub
  405. Private Sub func_Click(Index As Integer)
  406. End Sub
  407. Private Sub FillUndoBoard()
  408.  UndoBoard.Colour = Shape(Selected).Colour
  409.  For n = 1 To 8
  410.   UndoBoard.Corners(n).X = Shape(Selected).Corners(n).X
  411.   UndoBoard.Corners(n).Y = Shape(Selected).Corners(n).Y
  412.   UndoBoard.Corners(n).z = Shape(Selected).Corners(n).z
  413.  Next n
  414.  For n = 1 To 6
  415.   For m = 1 To 4
  416.    UndoBoard.Face(n).Edge(m) = Shape(Selected).Face(n).Edge(m)
  417.   Next m
  418.  Next n
  419.   UndoBoard.Name = Shape(Selected).Name
  420.   UndoBoard.Used = True
  421.   For n = 1 To 6
  422.    UndoBoard.Face(n).Used = Shape(Selected).Face(n).Used
  423.    UndoBoard.Face(n).Reverse = Shape(Selected).Face(n).Reverse
  424.   Next n
  425. End Sub
  426. Private Sub mnuEditOptions_Click(Index As Integer)
  427. Select Case Index
  428. Case 1
  429.   If UndoBoard.Used = False Then
  430.    MsgBox "There is nothing to paste!", , "Wait..."
  431.    Exit Sub
  432.   End If
  433.   Add = FindBox
  434.   Shape(Add).Colour = UndoBoard.Colour
  435.   For n = 1 To 8
  436.    Shape(Add).Corners(n).X = UndoBoard.Corners(n).X - Ax
  437.    Shape(Add).Corners(n).Y = UndoBoard.Corners(n).Y - Ay
  438.    Shape(Add).Corners(n).z = UndoBoard.Corners(n).z - Az
  439.   Next n
  440.   For n = 1 To 6
  441.    For m = 1 To 4
  442.     Shape(Add).Face(n).Edge(m) = UndoBoard.Face(n).Edge(m)
  443.    Next m
  444.   Next n
  445.   Shape(Add).Name = UndoBoard.Name
  446.   Shape(Add).Used = True
  447.   For n = 1 To 6
  448.    Shape(Selected).Face(n).Used = UndoBoard.Face(n).Used
  449.    Shape(Selected).Face(n).Reverse = UndoBoard.Face(n).Reverse
  450.   Next n
  451.   Shape(Selected).Used = False
  452.   FillUndoBoard
  453.   Selected = Add
  454.   Draw
  455.   mnuEditOptions(1).Caption = "Redo"
  456. Case 3
  457.  CopyBoard.Colour = Shape(Selected).Colour
  458.  For n = 1 To 8
  459.   CopyBoard.Corners(n).X = Shape(Selected).Corners(n).X
  460.   CopyBoard.Corners(n).Y = Shape(Selected).Corners(n).Y
  461.   CopyBoard.Corners(n).z = Shape(Selected).Corners(n).z
  462.  Next n
  463.  For n = 1 To 6
  464.   For m = 1 To 4
  465.    CopyBoard.Face(n).Edge(m) = Shape(Selected).Face(n).Edge(m)
  466.   Next m
  467.  Next n
  468.   CopyBoard.Name = Shape(Selected).Name
  469.   CopyBoard.Used = True
  470.   For n = 1 To 6
  471.    CopyBoard.Face(n).Used = Shape(Selected).Face(n).Used
  472.    CopyBoard.Face(n).Reverse = Shape(Selected).Face(n).Reverse
  473.   Next n
  474. Case 4
  475.  If CopyBoard.Used = False Then
  476.   MsgBox "There is nothing to paste!", , "Wait..."
  477.   Exit Sub
  478.  End If
  479.    Add = FindBox
  480. If oView(1).Checked = True Then Ax = 10: Az = 10
  481. If oView(2).Checked = True Then Ax = 10: Ay = 10
  482. If oView(3).Checked = True Then Ay = 10: Az = 10
  483.   Shape(Add).Colour = CopyBoard.Colour
  484.  For n = 1 To 8
  485.     Shape(Add).Corners(n).X = CopyBoard.Corners(n).X - Ax
  486.     Shape(Add).Corners(n).Y = CopyBoard.Corners(n).Y - Ay
  487.     Shape(Add).Corners(n).z = CopyBoard.Corners(n).z - Az
  488.  Next n
  489.  For n = 1 To 6
  490.   For m = 1 To 4
  491.    Shape(Add).Face(n).Edge(m) = CopyBoard.Face(n).Edge(m)
  492.   Next m
  493.  Next n
  494.    Shape(Add).Name = CopyBoard.Name
  495.    Shape(Add).Used = True
  496.    Selected = Add
  497.   For n = 1 To 6
  498.    Shape(Selected).Face(n).Used = CopyBoard.Face(n).Used
  499.    Shape(Selected).Face(n).Reverse = CopyBoard.Face(n).Reverse
  500.   Next n
  501.    Draw
  502. Case 6
  503.  FillUndoBoard
  504.  mnuEditOptions(1).Caption = "Undo delete box"
  505.  mnuEditOptions(1).Enabled = True
  506.  Shape(Selected).Used = False
  507.  Draw
  508. End Select
  509. End Sub
  510. Private Sub mnuFileOptions_Click(Index As Integer)
  511. Selected = 0
  512. func(0).Value = True
  513. Select Case Index
  514.  Case 1 ' New!
  515.   X = MsgBox("Are you sure you want to start a new model?", vbYesNo, "Wait...")
  516.   If X = 7 Then Exit Sub
  517.   ClearShapes
  518.   Draw
  519.   Load.Tag = ""
  520.  Case 2 ' open
  521.   Load.FileName = "*.mdl"
  522.   Load.ShowOpen
  523.   ClearShapes
  524.   Call LoadNew(Load.FileName)
  525.   Load.Tag = Load.FileName
  526.  Case 3 ' merge - The same, but we don't clear memory first
  527.   Load.ShowOpen
  528.   Call LoadNew(Load.FileName)
  529.   Load.Tag = Load.FileName
  530.  Case 4 ' Save
  531.    Call SaveAll(Load.Tag, 0)
  532.    Form1.Tag = "Saved"
  533.  Case 5 ' SaveAs
  534.   Save.ShowSave
  535.   If Mid(Save.FileName, Len(Save.FileName) - 3, 1) <> "." Then
  536.    Save.FileName = Save.FileName + ".mdl"
  537.   End If
  538.   Call SaveAll(Save.FileName, 1)
  539.   Load.Tag = Save.FileName
  540.    Form1.Tag = "Saved"
  541.  Case 7
  542.   Form1.Visible = False
  543.   Views.Visible = False
  544.   ExportMe.Visible = True
  545.  Case 9 ' Quit!
  546.   If Form1.Tag = "Not Saved" Then
  547.    message = "Your work has been changed since you last saved it. Do you want to save it before you exit?"
  548.    X = MsgBox(message, vbYesNoCancel, "Wait...")
  549.    If X = 7 Then End
  550.    If X = 6 Then
  551.     If mnuFileOptions(4).Enabled = True Then Call SaveAll(Load.Tag, 0): End
  552.      
  553.      Save.ShowSave
  554.      Call SaveAll(Save.FileName, 1)
  555.      Load.Tag = Save.FileName
  556.      End
  557.    End If
  558.   Else
  559.   X = MsgBox("Are you sure you want to quit?", vbYesNo, "Wait...")
  560.   If X = 7 Then Exit Sub
  561.   End
  562.   End If
  563. End Select
  564. mnuFileOptions(4).Enabled = False
  565. If Load.Tag <> "" Then mnuFileOptions(4).Enabled = True
  566. Form1.Caption = "Editor - [" + Load.Tag + "]"
  567. End Sub
  568. Private Sub mnuPopup1Options_Click(Index As Integer)
  569. Select Case Index
  570.  Case 1
  571.   ReFace.Visible = True
  572.   ReFace.NowOn = Selected
  573.   Names.Tag = Selected
  574.   ReFace.start
  575.  Case 2
  576.   Load.ShowColor
  577.   Shape(Selected).Colour = Load.Color
  578.   StnColour = Load.Color
  579.   Draw
  580. End Select
  581. End Sub
  582. Private Sub mnuToolOptions_Click(Index As Integer)
  583. Select Case Index
  584.  Case 1
  585.   SetName
  586.  Case 2
  587.   Views.Visible = False
  588.   Form1.WindowState = 1
  589.  Case 3
  590.   GetData
  591.  Case 4
  592.   ReFace.Visible = True
  593.   ReFace.start
  594.  Case 5
  595.   Viewer3D.Visible = True
  596.   Form1.Visible = False
  597.   Views.Visible = False
  598. End Select
  599. End Sub
  600. Private Sub mnuViewTools_Click(Index As Integer)
  601. If mnuViewTools(1).Checked = False Then
  602.    mnuViewTools(1).Checked = True
  603.    Views.Visible = True
  604.   Else
  605.    mnuViewTools(1).Checked = False
  606.    Views.Visible = False
  607.  End If
  608. End Sub
  609. Private Sub Names_click()
  610.  If func(1) = True Then func(2).Value = True
  611.  Selected = Nifty(Names.ListIndex + 1)
  612.  NewName = Shape(Selected).Name
  613.  Draw
  614. End Sub
  615. Private Sub OfsHoris_Change()
  616. Xofs = -OfsHoris.Value
  617. End Sub
  618. Private Sub OfsHoris_Scroll()
  619. Xofs = -OfsHoris.Value
  620. End Sub
  621. Private Sub ofVert_Change()
  622. Yofs = -ofVert.Value
  623. End Sub
  624. Private Sub ofVert_Scroll()
  625. Yofs = -ofVert.Value
  626. End Sub
  627. Private Sub OpenViewer_Click(Index As Integer)
  628. Select Case Index
  629.  Case 1
  630.   s = App.Path + "\viewer.exe"
  631.   Shell s, vbNormalFoc
  632.  Case 2
  633.   s = App.Path + "\TextureMapper.exe"
  634.   Shell s, vbNormalFoc
  635. End Select
  636. End Sub
  637. Private Sub oView_Click(Index As Integer)
  638. For n = 1 To 3: oView(n).Checked = False: Next n
  639. oView(Index).Checked = True
  640. End Sub
  641. Sub DrawBars()
  642. RuleSide.Cls
  643. RuleTop.Cls
  644. For n = 2 - ((Yofs Mod 25) * 5.5) To RuleSide.ScaleHeight + ((Yofs Mod 25) * 4) Step 25
  645. RuleSide.Line (6, n)-(8, n)
  646. Next n
  647. For n = 2 - ((Xofs Mod 25) * 5) To RuleTop.ScaleWidth + ((Xofs Mod 25) * 4) Step 25
  648. RuleTop.Line (n, 6)-(n, 8)
  649. Next n
  650. Y = RuleSide.Tag
  651. RuleSide.Line (0, Y - 3)-(0, Y + 3)
  652. RuleSide.Line (1, Y - 2)-(1, Y + 2)
  653. RuleSide.Line (2, Y - 1)-(2, Y + 1)
  654. X = RuleTop.Tag
  655. RuleTop.Line (X - 3, 0)-(X + 3, 0)
  656. RuleTop.Line (X - 2, 1)-(X + 2, 1)
  657. RuleTop.Line (X - 1, 2)-(X + 1, 2)
  658. End Sub
  659. Private Sub RuleSide_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  660. RuleSide.Tag = Y
  661. View.DrawStyle = 2
  662. View.Line (0, Y)-(1000, Y)
  663. View.DrawStyle = 0
  664. DrawBars
  665. End Sub
  666. Private Sub RuleSide_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  667. End Sub
  668. Private Sub RuleTop_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  669. RuleTop.Tag = X
  670. View.DrawStyle = 2
  671. View.Line (X, 0)-(X, 1000)
  672. View.DrawStyle = 0
  673. DrawBars
  674. End Sub
  675. Private Sub RuleTop_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  676. End Sub
  677. Private Sub View_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  678. If func(1) <> True And func(6) <> True Then
  679.  FillUndoBoard
  680.  If func(2) = True Then mnuEditOptions(1).Caption = "Undo move vertex"
  681.  If func(3) = True Then mnuEditOptions(1).Caption = "Undo move face"
  682.  If func(4) = True Then mnuEditOptions(1).Caption = "Undo move box"
  683.  If func(5) = True Then mnuEditOptions(1).Caption = "Undo spin box"
  684.  mnuEditOptions(1).Enabled = True
  685.  mnuEditOptions(1).Enabled = False
  686. End If
  687. Dim n As Byte, xx As Integer, zz As Integer
  688. If Button = 2 Then
  689.  mnuPopup1Options(1).Caption = "Edit surface properties for " + Shape(Selected).Name
  690.  PopupMenu mnuPopup1
  691.  Exit Sub
  692. End If
  693. If func(3) = True Then
  694.   bMoveX = Xmouse
  695.   bMoveY = Ymouse
  696.  For n = 1 To 6
  697.   CenX = 0: CenY = 0
  698.   For m = 1 To 4
  699.   If oView(1).Checked = True Then
  700.    xx = Shape(Selected).Corners(Shape(Selected).Face(n).Edge(m)).X
  701.    zz = Shape(Selected).Corners(Shape(Selected).Face(n).Edge(m)).z
  702.   End If
  703.  If oView(2).Checked = True Then
  704.    xx = Shape(Selected).Corners(Shape(Selected).Face(n).Edge(m)).X
  705.    zz = Shape(Selected).Corners(Shape(Selected).Face(n).Edge(m)).Y
  706.  End If
  707.  If oView(3).Checked = True Then
  708.    xx = Shape(Selected).Corners(Shape(Selected).Face(n).Edge(m)).z
  709.    zz = Shape(Selected).Corners(Shape(Selected).Face(n).Edge(m)).Y
  710.  End If
  711.   CenX = CenX + xx + Xofs
  712.   CenY = CenY + zz + Yofs
  713.  Next m
  714.  CenX = CenX / 4
  715.  CenY = CenY / 4
  716.    If Xmouse > CenX - DisttoSelect Then
  717.    If Xmouse < CenX + DisttoSelect Then
  718.     If Ymouse > CenY - DisttoSelect Then
  719.      If Ymouse < CenY + DisttoSelect Then
  720.        Draw
  721.        View.Circle (CenX, CenY), 4
  722.        
  723.        For s = 1 To 4
  724.           Shape(Selected).Corners(Shape(Selected).Face(n).Edge(s)).MouseOver = True
  725.        Next s
  726.        If Shift = 1 Then Exit Sub
  727.      End If
  728.     End If
  729.    End If
  730.   End If
  731. Next n
  732.  Exit Sub
  733. End If
  734. '#######################################
  735. If func(0) = True Then
  736.   For m = 1 To 100
  737.    For n = 1 To 8
  738.   If oView(1).Checked = True Then
  739.    xx = Shape(m).Corners(n).X
  740.    zz = Shape(m).Corners(n).z
  741.   End If
  742.  If oView(2).Checked = True Then
  743.    xx = Shape(m).Corners(n).X
  744.    zz = Shape(m).Corners(n).Y
  745.  End If
  746.  If oView(3).Checked = True Then
  747.    xx = Shape(m).Corners(n).z
  748.    zz = Shape(m).Corners(n).Y
  749.  End If
  750.    xx = xx + Xofs
  751.   zz = zz + Yofs
  752.      
  753.    If Xmouse > xx - DisttoSelect Then
  754.    If Xmouse < xx + DisttoSelect Then
  755.     If Ymouse > zz - DisttoSelect Then
  756.      If Ymouse < zz + DisttoSelect Then
  757.        'View.Circle (xx, zz), 4
  758.        Selected = m
  759.        Draw
  760.        Exit Sub
  761.      End If
  762.     End If
  763.    End If
  764.   End If
  765.   Next n
  766.  Next m
  767. End If
  768. If func(5) = True Then
  769. '##########
  770.  For n = 1 To 8
  771.  Shape(Selected).Corners(n).MouseOver = False
  772.  If oView(1).Checked = True Then
  773.    xx = Shape(Selected).Corners(n).X
  774.    zz = Shape(Selected).Corners(n).z
  775.  End If
  776.  If oView(2).Checked = True Then
  777.    xx = Shape(Selected).Corners(n).X
  778.    zz = Shape(Selected).Corners(n).Y
  779.  End If
  780.  If oView(3).Checked = True Then
  781.    xx = Shape(Selected).Corners(n).z
  782.    zz = Shape(Selected).Corners(n).Y
  783.  End If
  784.   xx = xx + Xofs
  785.   zz = zz + Yofs
  786.   If Xmouse > xx - DisttoSelect Then
  787.    If Xmouse < xx + DisttoSelect Then
  788.     If Ymouse > zz - DisttoSelect Then
  789.      If Ymouse < zz + DisttoSelect Then
  790.        View.Circle (xx, zz), 4
  791.        Shape(Selected).Corners(n).MouseOver = True
  792.      End If
  793.     End If
  794.    End If
  795.   End If
  796.  Next n
  797. '###########
  798.  Guide.x1 = Xmouse
  799.  Guide.Y1 = Ymouse
  800.  Guide.Visible = True
  801.  Exit Sub
  802. End If
  803. If func(4) = True Or func(6) = True Then
  804.   bMoveX = Xmouse
  805.   bMoveY = Ymouse
  806.   Exit Sub
  807. End If
  808. If func(1) = True Then
  809.  MakeBox = True
  810.  startX = Xmouse
  811.  StartY = Ymouse
  812.  Guide.Visible = True
  813.  Guide.x1 = Xmouse
  814.  Guide.Y1 = Ymouse
  815. End If
  816. If func(2) = True Then
  817.  Draw
  818.  For n = 1 To 8
  819.  Shape(Selected).Corners(n).MouseOver = False
  820.  If oView(1).Checked = True Then
  821.    xx = Shape(Selected).Corners(n).X
  822.    zz = Shape(Selected).Corners(n).z
  823.  End If
  824.  If oView(2).Checked = True Then
  825.    xx = Shape(Selected).Corners(n).X
  826.    zz = Shape(Selected).Corners(n).Y
  827.  End If
  828.  If oView(3).Checked = True Then
  829.    xx = Shape(Selected).Corners(n).z
  830.    zz = Shape(Selected).Corners(n).Y
  831.  End If
  832.   xx = xx + Xofs
  833.   zz = zz + Yofs
  834.   If Xmouse > xx - DisttoSelect Then
  835.    If Xmouse < xx + DisttoSelect Then
  836.     If Ymouse > zz - DisttoSelect Then
  837.      If Ymouse < zz + DisttoSelect Then
  838.        View.Circle (xx, zz), 4
  839.        Shape(Selected).Corners(n).MouseOver = True
  840.        If Shift = 1 Then Exit Sub
  841.      End If
  842.     End If
  843.    End If
  844.   End If
  845.  Next n
  846. End If
  847. End Sub
  848. Private Sub View_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  849. Xmouse = (CInt(X / 5) * 5)
  850. Ymouse = (CInt(Y / 5) * 5)
  851. Guide.x2 = Xmouse
  852. Guide.Y2 = Ymouse
  853. If func(5) = True And Guide.Visible = True Then
  854.  Guide.x2 = Xmouse
  855.  Guide.Y2 = Ymouse
  856.  'Guide.Visible = False
  857.  TXX = Guide.x2 - Guide.x1
  858.  Tyy = Guide.Y2 - Guide.Y1
  859.  spinAngle = FindAngle(TXX, Tyy, 0)
  860.  View.Line (Guide.x1, Guide.Y1)-(Guide.x1 + 28, Guide.Y1 + 12), RGB(255, 255, 0), BF
  861.  View.Line (Guide.x1, Guide.Y1)-(Guide.x1 + 28, Guide.Y1 + 12), 0, B
  862.  View.PSet (Guide.x1, Guide.Y1)
  863.  View.Print spinAngle
  864.  Exit Sub
  865. End If
  866. End Sub
  867. Private Sub View_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  868. If Button = 2 Then
  869.  Exit Sub
  870. End If
  871. '##############################################################
  872. If func(5) = True Then
  873.  If spinAngle < 0 Or spinAngle > 359 Then Exit Sub
  874.  Guide.Visible = False
  875.  For n = 1 To 8
  876.   If Shape(Selected).Corners(n).MouseOver = True Then
  877.    mx = Shape(Selected).Corners(n).X
  878.    my = Shape(Selected).Corners(n).Y
  879.    mz = Shape(Selected).Corners(n).z
  880.   End If
  881.  Next n
  882. For n = 1 To 8
  883.  mx = mx + Shape(Selected).Corners(n).X
  884.  my = my + Shape(Selected).Corners(n).Y
  885.  mz = mz + Shape(Selected).Corners(n).z
  886. Next n
  887. mx = mx / 8: my = my / 8: mz = mz / 8
  888.  If oView(1).Checked = True Then Call Rotate(0, 360 - spinAngle, 0, Selected, mx, my, mz)
  889.  If oView(3).Checked = True Then Call Rotate(360 - spinAngle, 0, 0, Selected, mx, my, mz)
  890.  If oView(2).Checked = True Then Call Rotate(0, 0, 360 - spinAngle, Selected, mx, my, mz)
  891.  For n = 1 To 8
  892.   Shape(Selected).Corners(n).X = Rotated.Corners(n).X
  893.   Shape(Selected).Corners(n).Y = Rotated.Corners(n).Y
  894.   Shape(Selected).Corners(n).z = Rotated.Corners(n).z
  895.  Next n
  896. End If
  897. '##############################################################
  898. If func(6) = True Then
  899.  Form1.Tag = "Not Saved"
  900.  mx = Xmouse - bMoveX
  901.  my = Ymouse - bMoveY
  902. For m = 1 To 100
  903.  For n = 1 To 8
  904.   If oView(1).Checked = True Then
  905.   Shape(m).Corners(n).X = Shape(m).Corners(n).X + mx
  906.   Shape(m).Corners(n).z = Shape(m).Corners(n).z + my
  907.   End If
  908.  If oView(2).Checked = True Then
  909.   Shape(m).Corners(n).X = Shape(m).Corners(n).X + mx
  910.   Shape(m).Corners(n).Y = Shape(m).Corners(n).Y + my
  911.  End If
  912.  If oView(3).Checked = True Then
  913.   Shape(m).Corners(n).z = Shape(m).Corners(n).z + mx
  914.   Shape(m).Corners(n).Y = Shape(m).Corners(n).Y + my
  915.  End If
  916.  Next n
  917. Next m
  918.  Exit Sub
  919. End If
  920. If func(3) = True Then
  921.  Form1.Tag = "Not Saved"
  922.  mx = Xmouse - bMoveX
  923.  my = Ymouse - bMoveY
  924.  For n = 1 To 8
  925.   If Shape(Selected).Corners(n).MouseOver = True Then
  926.   If oView(1).Checked = True Then
  927.    Shape(Selected).Corners(n).X = Shape(Selected).Corners(n).X + mx
  928.    Shape(Selected).Corners(n).z = Shape(Selected).Corners(n).z + my
  929.    End If
  930.   If oView(2).Checked = True Then
  931.    Shape(Selected).Corners(n).X = Shape(Selected).Corners(n).X + mx
  932.    Shape(Selected).Corners(n).Y = Shape(Selected).Corners(n).Y + my
  933.   End If
  934.   If oView(3).Checked = True Then
  935.    Shape(Selected).Corners(n).z = Shape(Selected).Corners(n).z + mx
  936.    Shape(Selected).Corners(n).Y = Shape(Selected).Corners(n).Y + my
  937.   End If
  938.  End If
  939.  Shape(Selected).Corners(n).MouseOver = False
  940.  Next n
  941.  Draw
  942.  Exit Sub
  943. End If
  944. If func(4) = True Then
  945.  Form1.Tag = "Not Saved"
  946.  mx = Xmouse - bMoveX
  947.  my = Ymouse - bMoveY
  948.  For n = 1 To 8
  949.  If oView(1).Checked = True Then
  950.   Shape(Selected).Corners(n).X = Shape(Selected).Corners(n).X + mx
  951.   Shape(Selected).Corners(n).z = Shape(Selected).Corners(n).z + my
  952.   End If
  953.  If oView(2).Checked = True Then
  954.   Shape(Selected).Corners(n).X = Shape(Selected).Corners(n).X + mx
  955.   Shape(Selected).Corners(n).Y = Shape(Selected).Corners(n).Y + my
  956.  End If
  957.  If oView(3).Checked = True Then
  958.   Shape(Selected).Corners(n).z = Shape(Selected).Corners(n).z + mx
  959.   Shape(Selected).Corners(n).Y = Shape(Selected).Corners(n).Y + my
  960.  End If
  961.  Next n
  962.  Draw
  963.  Exit Sub
  964. End If
  965. If func(1) = True And MakeBox = True Then
  966.  Form1.Tag = "Not Saved"
  967.  startX = startX - CInt((Xofs / 5)) * 5
  968.  StartY = StartY - CInt((Yofs / 5)) * 5
  969.  Xmouse = Xmouse - CInt((Xofs / 5)) * 5
  970.  Ymouse = Ymouse - CInt((Yofs / 5)) * 5
  971.  Guide.Visible = False
  972.  Add = FindBox
  973.  Shape(Add).Used = True
  974.  Shape(Add).Colour = StnColour
  975. If oView(1).Checked = True Then
  976.  Shape(Add).Corners(1).X = startX: Shape(Add).Corners(1).Y = 50: Shape(Add).Corners(1).z = StartY
  977.  Shape(Add).Corners(2).X = Xmouse: Shape(Add).Corners(2).Y = 50: Shape(Add).Corners(2).z = StartY
  978.  Shape(Add).Corners(3).X = Xmouse: Shape(Add).Corners(3).Y = 50: Shape(Add).Corners(3).z = Ymouse
  979.  Shape(Add).Corners(4).X = startX: Shape(Add).Corners(4).Y = 50: Shape(Add).Corners(4).z = Ymouse
  980.  Shape(Add).Corners(5).X = startX: Shape(Add).Corners(5).Y = 150: Shape(Add).Corners(5).z = StartY
  981.  Shape(Add).Corners(6).X = Xmouse: Shape(Add).Corners(6).Y = 150: Shape(Add).Corners(6).z = StartY
  982.  Shape(Add).Corners(7).X = Xmouse: Shape(Add).Corners(7).Y = 150: Shape(Add).Corners(7).z = Ymouse
  983.  Shape(Add).Corners(8).X = startX: Shape(Add).Corners(8).Y = 150: Shape(Add).Corners(8).z = Ymouse
  984. End If
  985. If oView(2).Checked = True Then
  986.  Shape(Add).Corners(1).X = startX: Shape(Add).Corners(1).z = 150: Shape(Add).Corners(1).Y = StartY
  987.  Shape(Add).Corners(2).X = Xmouse: Shape(Add).Corners(2).z = 150: Shape(Add).Corners(2).Y = StartY
  988.  Shape(Add).Corners(3).X = Xmouse: Shape(Add).Corners(3).z = 150: Shape(Add).Corners(3).Y = Ymouse
  989.  Shape(Add).Corners(4).X = startX: Shape(Add).Corners(4).z = 150: Shape(Add).Corners(4).Y = Ymouse
  990.  Shape(Add).Corners(5).X = startX: Shape(Add).Corners(5).z = 50: Shape(Add).Corners(5).Y = StartY
  991.  Shape(Add).Corners(6).X = Xmouse: Shape(Add).Corners(6).z = 50: Shape(Add).Corners(6).Y = StartY
  992.  Shape(Add).Corners(7).X = Xmouse: Shape(Add).Corners(7).z = 50: Shape(Add).Corners(7).Y = Ymouse
  993.  Shape(Add).Corners(8).X = startX: Shape(Add).Corners(8).z = 50: Shape(Add).Corners(8).Y = Ymouse
  994. End If
  995. If oView(3).Checked = True Then
  996.  Shape(Add).Corners(1).z = startX: Shape(Add).Corners(1).X = 50: Shape(Add).Corners(1).Y = StartY
  997.  Shape(Add).Corners(2).z = Xmouse: Shape(Add).Corners(2).X = 50: Shape(Add).Corners(2).Y = StartY
  998.  Shape(Add).Corners(3).z = Xmouse: Shape(Add).Corners(3).X = 50: Shape(Add).Corners(3).Y = Ymouse
  999.  Shape(Add).Corners(4).z = startX: Shape(Add).Corners(4).X = 50: Shape(Add).Corners(4).Y = Ymouse
  1000.  Shape(Add).Corners(5).z = startX: Shape(Add).Corners(5).X = 150: Shape(Add).Corners(5).Y = StartY
  1001.  Shape(Add).Corners(6).z = Xmouse: Shape(Add).Corners(6).X = 150: Shape(Add).Corners(6).Y = StartY
  1002.  Shape(Add).Corners(7).z = Xmouse: Shape(Add).Corners(7).X = 150: Shape(Add).Corners(7).Y = Ymouse
  1003.  Shape(Add).Corners(8).z = startX: Shape(Add).Corners(8).X = 150: Shape(Add).Corners(8).Y = Ymouse
  1004. End If
  1005.  For n = 1 To 6
  1006.   Shape(Add).Face(n).Used = True
  1007.   Shape(Add).Face(n).Reverse = False
  1008.  Next n
  1009.  Shape(Add).Name = "Cube " & Add
  1010.  Selected = Add
  1011.  Call FillCube(Add)
  1012. End If
  1013. MakeBox = False
  1014. If func(2) = True Then
  1015.  Form1.Tag = "Not Saved"
  1016.  Xmouse = Xmouse - CInt((Xofs / 5)) * 5
  1017.  Ymouse = Ymouse - CInt((Yofs / 5)) * 5
  1018.   For n = 1 To 8
  1019.   If Shape(Selected).Corners(n).MouseOver = True Then
  1020.  Shape(Selected).Corners(n).MouseOver = False
  1021.  If oView(1).Checked = True Then
  1022.    Shape(Selected).Corners(n).X = Xmouse
  1023.    Shape(Selected).Corners(n).z = Ymouse
  1024.  End If
  1025.  If oView(2).Checked = True Then
  1026.    Shape(Selected).Corners(n).X = Xmouse
  1027.    Shape(Selected).Corners(n).Y = Ymouse
  1028.  End If
  1029.  If oView(3).Checked = True Then
  1030.    Shape(Selected).Corners(n).z = Xmouse
  1031.    Shape(Selected).Corners(n).Y = Ymouse
  1032.  End If
  1033.   End If
  1034.  Next n
  1035. End If
  1036. End Sub
  1037. Sub Draw()
  1038. View.Cls
  1039. NewName.Text = Shape(Selected).Name
  1040. DrawBars
  1041. View.Line (0, Yofs)-(1000, Yofs)
  1042. View.Line (Xofs, 0)-(Xofs, 1000)
  1043. If oView(1).Checked = True Then DrawFromTop
  1044. If oView(2).Checked = True Then DrawFromSide
  1045. If oView(3).Checked = True Then DrawFromFront
  1046. End Sub
  1047.