home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / sightmap / frmmain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-02-24  |  6.0 KB  |  193 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  4. Begin VB.MDIForm frmMain 
  5.    BackColor       =   &H8000000C&
  6.    Caption         =   "Sight Map"
  7.    ClientHeight    =   5115
  8.    ClientLeft      =   165
  9.    ClientTop       =   735
  10.    ClientWidth     =   7890
  11.    Icon            =   "frmMain.frx":0000
  12.    LinkTopic       =   "MDIForm1"
  13.    StartUpPosition =   3  'Windows Default
  14.    WindowState     =   2  'Maximized
  15.    Begin MSComDlg.CommonDialog cdlg 
  16.       Left            =   2640
  17.       Top             =   2040
  18.       _ExtentX        =   847
  19.       _ExtentY        =   847
  20.       _Version        =   393216
  21.    End
  22.    Begin MSComctlLib.StatusBar sbMain 
  23.       Align           =   2  'Align Bottom
  24.       Height          =   375
  25.       Left            =   0
  26.       TabIndex        =   0
  27.       Top             =   4740
  28.       Width           =   7890
  29.       _ExtentX        =   13917
  30.       _ExtentY        =   661
  31.       Style           =   1
  32.       _Version        =   393216
  33.       BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
  34.          NumPanels       =   1
  35.          BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  36.          EndProperty
  37.       EndProperty
  38.    End
  39.    Begin VB.Menu mnuFile 
  40.       Caption         =   "&File"
  41.       Begin VB.Menu mnuFileNew 
  42.          Caption         =   "&New"
  43.       End
  44.       Begin VB.Menu mnuFileOpen 
  45.          Caption         =   "&Open"
  46.       End
  47.       Begin VB.Menu mnuFileSave 
  48.          Caption         =   "&Save"
  49.       End
  50.       Begin VB.Menu mnuFileQuit 
  51.          Caption         =   "&Quit"
  52.       End
  53.    End
  54.    Begin VB.Menu mnuSite 
  55.       Caption         =   "&Site"
  56.       Begin VB.Menu mnuSiteShow 
  57.          Caption         =   "&Show Hierarchy"
  58.       End
  59.    End
  60.    Begin VB.Menu mnuWindow 
  61.       Caption         =   "&Window"
  62.       WindowList      =   -1  'True
  63.    End
  64. Attribute VB_Name = "frmMain"
  65. Attribute VB_GlobalNameSpace = False
  66. Attribute VB_Creatable = False
  67. Attribute VB_PredeclaredId = True
  68. Attribute VB_Exposed = False
  69. Option Explicit
  70. 'frmMain.frm
  71. '--------------------------------------------------------------------------
  72. '<Purpose>
  73. '   Handles menu selections.  Loads MDI child windows depending on
  74. '   function requested.
  75. '<Revision>
  76. '       $Revision: $
  77. '<Mod Log>
  78. '       $Log: $
  79. '--------------------------------------------------------------------------
  80. '--------------------------------------------------------------------------
  81. '<Purpose>
  82. '<Syntax>
  83. '<Assumptions>
  84. '<Returns>
  85. '<Author>
  86. '   HBW
  87. '--------------------------------------------------------------------------
  88. Private Sub MDIForm_Load()
  89.     'Seed the random number generator
  90.     Randomize Now
  91. End Sub
  92. '--------------------------------------------------------------------------
  93. '<Purpose>
  94. '<Syntax>
  95. '<Assumptions>
  96. '<Returns>
  97. '<Author>
  98. '   HBW
  99. '--------------------------------------------------------------------------
  100. Private Sub mnuFileNew_Click()
  101.     Dim frm As New frmSiteDefinition
  102.     frm.Show
  103. End Sub
  104. '--------------------------------------------------------------------------
  105. '<Purpose>
  106. '<Syntax>
  107. '<Assumptions>
  108. '<Returns>
  109. '<Author>
  110. '   HBW
  111. '--------------------------------------------------------------------------
  112. Private Sub mnuFileOpen_Click()
  113. On Error GoTo mnuFileOpen_Click_Error
  114.     cdlg.CancelError = True
  115.     cdlg.Filter = "Site Files (*.st)|*.st"
  116.     cdlg.ShowOpen
  117.     gLoadingSite = True
  118.     Dim NewSite As New Site
  119.     NewSite.OpenSite cdlg.FileName
  120.     gSites.Add NewSite, NewSite.SiteID
  121.     Dim frm As New frmSiteDefinition
  122.     Call LoadSiteForm(frm, NewSite)
  123.     frm.fraOperations.Visible = False
  124.     gLoadingSite = False
  125.     frm.Show
  126. Exit Sub
  127. mnuFileOpen_Click_Error:
  128.     If Err.Number <> cdlCancel Then
  129.         Select Case Err.Number
  130.         Case 457 'duplicate key
  131.             MsgBox "You already have that one open, silly!"
  132.         Case Else
  133.             MsgBox "Open Failed: " & CStr(Err.Number) & " -- " & Err.Description
  134.         End Select
  135.     End If
  136. End Sub
  137. '--------------------------------------------------------------------------
  138. '<Purpose>
  139. '<Syntax>
  140. '<Assumptions>
  141. '<Returns>
  142. '<Author>
  143. '   HBW
  144. '--------------------------------------------------------------------------
  145. Private Sub mnuFileQuit_Click()
  146.     Unload Me
  147. End Sub
  148. Private Sub mnuFileSave_Click()
  149. '--------------------------------------------------------------------------
  150. '<Purpose>
  151. '<Syntax>
  152. '<Assumptions>
  153. '<Returns>
  154. '<Author>
  155. '   HBW
  156. '--------------------------------------------------------------------------
  157. Dim strSiteID As String
  158.     If Not Me.ActiveForm Is Nothing Then
  159.         If Me.ActiveForm.Name = "frmSiteDefinition" Then
  160.             strSiteID = Me.ActiveForm.mSiteID
  161.             cdlg.Filter = "Site Files (*.st)|*.st"
  162.             cdlg.ShowSave
  163.             gSites(strSiteID).SaveSite cdlg.FileName
  164.             
  165.         Else
  166.             MsgBox "Active window must be a site definition form."
  167.         End If
  168.     Else
  169.         MsgBox "Active window must be a site definition form."
  170.     End If
  171. End Sub
  172. Private Sub mnuSiteShow_Click()
  173. '--------------------------------------------------------------------------
  174. '<Purpose>
  175. '<Syntax>
  176. '<Assumptions>
  177. '<Returns>
  178. '<Author>
  179. '   HBW
  180. '--------------------------------------------------------------------------
  181. Dim strSiteID As String
  182.     If Not Me.ActiveForm Is Nothing Then
  183.         If Me.ActiveForm.Name = "frmSiteDefinition" Then
  184.             strSiteID = Me.ActiveForm.mSiteID
  185.             Dim frm As New frmMap
  186.             frmMap.SiteHandle = Me.ActiveForm
  187.             Call gSites(strSiteID).DrawTree(frmMap.tvMap)
  188.             frmMap.lblRoot = gSites(strSiteID).Root
  189.             frmMap.Show
  190.         End If
  191.     End If
  192. End Sub
  193.