home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Scripting 2882110132001.psc / frmDev.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-10-13  |  8.3 KB  |  279 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
  4. Begin VB.Form frmSexIDE 
  5.    Caption         =   "SEX Editor 1.0"
  6.    ClientHeight    =   5670
  7.    ClientLeft      =   3750
  8.    ClientTop       =   4290
  9.    ClientWidth     =   8385
  10.    Icon            =   "frmDev.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   378
  13.    ScaleMode       =   3  'Pixel
  14.    ScaleWidth      =   559
  15.    Begin RichTextLib.RichTextBox txtCode 
  16.       Height          =   5685
  17.       Left            =   -15
  18.       TabIndex        =   0
  19.       Top             =   -15
  20.       Width           =   8400
  21.       _ExtentX        =   14817
  22.       _ExtentY        =   10028
  23.       _Version        =   393217
  24.       HideSelection   =   0   'False
  25.       ScrollBars      =   2
  26.       TextRTF         =   $"frmDev.frx":1042
  27.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  28.          Name            =   "IBMPC"
  29.          Size            =   9
  30.          Charset         =   255
  31.          Weight          =   400
  32.          Underline       =   0   'False
  33.          Italic          =   0   'False
  34.          Strikethrough   =   0   'False
  35.       EndProperty
  36.    End
  37.    Begin MSComDlg.CommonDialog cmDialog 
  38.       Left            =   7740
  39.       Top             =   105
  40.       _ExtentX        =   847
  41.       _ExtentY        =   847
  42.       _Version        =   393216
  43.       CancelError     =   -1  'True
  44.    End
  45.    Begin VB.Menu mnu_File 
  46.       Caption         =   "&File"
  47.       Begin VB.Menu mnu_File_New 
  48.          Caption         =   "&New"
  49.          Shortcut        =   ^N
  50.       End
  51.       Begin VB.Menu mnu_File_Open 
  52.          Caption         =   "&Open..."
  53.          Shortcut        =   ^O
  54.       End
  55.       Begin VB.Menu mnu_File_Save 
  56.          Caption         =   "&Save"
  57.          Shortcut        =   ^S
  58.       End
  59.       Begin VB.Menu mnu_File_SaveAs 
  60.          Caption         =   "Save &As..."
  61.       End
  62.       Begin VB.Menu mnu_File_LB01 
  63.          Caption         =   "-"
  64.       End
  65.       Begin VB.Menu mnu_File_Print 
  66.          Caption         =   "&Print"
  67.          Shortcut        =   ^P
  68.       End
  69.       Begin VB.Menu mnu_File_LB02 
  70.          Caption         =   "-"
  71.       End
  72.       Begin VB.Menu mnu_File_Exit 
  73.          Caption         =   "E&xit"
  74.       End
  75.    End
  76.    Begin VB.Menu frm_Edit 
  77.       Caption         =   "&Edit"
  78.       Begin VB.Menu mnu_Edit_Undo 
  79.          Caption         =   "&Undo"
  80.          Shortcut        =   ^Z
  81.       End
  82.       Begin VB.Menu mnu_Edit_LB01 
  83.          Caption         =   "-"
  84.       End
  85.       Begin VB.Menu mnu_Edit_Cut 
  86.          Caption         =   "Cu&t"
  87.          Shortcut        =   ^X
  88.       End
  89.       Begin VB.Menu mnu_Edit_Copy 
  90.          Caption         =   "&Copy"
  91.          Shortcut        =   ^C
  92.       End
  93.       Begin VB.Menu mnu_Edit_Paste 
  94.          Caption         =   "&Paste"
  95.          Shortcut        =   ^V
  96.       End
  97.       Begin VB.Menu mnu_Edit_Delete 
  98.          Caption         =   "&Delete"
  99.          Shortcut        =   {DEL}
  100.       End
  101.       Begin VB.Menu mnu_Edit_LB02 
  102.          Caption         =   "-"
  103.       End
  104.       Begin VB.Menu mnu_Edit_Find 
  105.          Caption         =   "&Find"
  106.          Shortcut        =   ^F
  107.       End
  108.       Begin VB.Menu mnu_Edit_FindNext 
  109.          Caption         =   "Find &Next"
  110.          Shortcut        =   {F3}
  111.       End
  112.       Begin VB.Menu mnu_Edit_LB03 
  113.          Caption         =   "-"
  114.       End
  115.       Begin VB.Menu mnu_Edit_SelectAll 
  116.          Caption         =   "Select &All"
  117.          Shortcut        =   ^A
  118.       End
  119.    End
  120.    Begin VB.Menu mnu_Run 
  121.       Caption         =   "&Run"
  122.       Begin VB.Menu mnu_Run_Start 
  123.          Caption         =   "&Start"
  124.          Enabled         =   0   'False
  125.          Shortcut        =   {F5}
  126.       End
  127.       Begin VB.Menu mnu_Run_Break 
  128.          Caption         =   "&Break"
  129.          Enabled         =   0   'False
  130.          Shortcut        =   +^{F5}
  131.       End
  132.    End
  133. Attribute VB_Name = "frmSexIDE"
  134. Attribute VB_GlobalNameSpace = False
  135. Attribute VB_Creatable = False
  136. Attribute VB_PredeclaredId = True
  137. Attribute VB_Exposed = False
  138. Private bHasChanged     As Boolean
  139. Private strFileName     As String
  140. Private Sub Command2_Click()
  141. MsgBox vbInformation
  142. End Sub
  143. Sub OpenFile(strFileName As String)
  144.     On Error GoTo noLoad
  145.     Dim strFileData As String
  146.     Open strFileName For Binary As #1
  147.         strFileData = String(LOF(1), 0)
  148.         Get #1, 1, strFileData
  149.     Close #1
  150.     mnu_Run_Start.Enabled = True
  151.     txtCode.Text = strFileData
  152.     strFileData = ""
  153. '    Delete strFileData
  154.     Exit Sub
  155. noLoad:
  156. End Sub
  157. Sub SaveFile(strFileName As String)
  158.     On Error GoTo noSaveAs
  159.     Me.MousePointer = 11
  160.     Open strFileName For Output As #1
  161.         Print #1, txtCode.Text
  162.     Close #1
  163.     Me.MousePointer = 0
  164.     mnu_Run_Start.Enabled = True
  165.     Exit Sub
  166. noSaveAs:
  167.     Me.MousePointer = 0
  168.     MsgBox "An error has occured while trying to save the file, [" & Err & "]:" & vbCrLf & vbCrLf & Error, vbExclamation
  169. End Sub
  170. Private Sub Form_Load()
  171.     txtCode.Text = _
  172.         "alias main" & vbCrLf & _
  173.         "   ; main body code goes here" & vbCrLf & _
  174.         "   " & vbCrLf & _
  175.         "end alias"
  176.         
  177.     txtCode.SelStart = 0
  178.     txtCode.SelLength = 5
  179.     txtCode.SelBold = True
  180.     txtCode.SelStart = 48
  181.     txtCode.SelLength = 9
  182.     txtCode.SelBold = True
  183.     txtCode.SelStart = 46
  184. End Sub
  185. Private Sub Form_Resize()
  186.     txtCode.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
  187. End Sub
  188. Private Sub mnu_Edit_Copy_Click()
  189.     Clipboard.SetText txtCode.SelText
  190. End Sub
  191. Private Sub mnu_Edit_Cut_Click()
  192.     Clipboard.SetText txtCode.SelText
  193.     txtCode.SelText = ""
  194. End Sub
  195. Private Sub mnu_Edit_Delete_Click()
  196.     If txtCode.SelLength > 0 Then
  197.         txtCode.SelText = ""
  198.     Else
  199.         txtCode.SelLength = 1
  200.         txtCode.SelText = ""
  201.     End If
  202. End Sub
  203. Private Sub mnu_Edit_Paste_Click()
  204.     txtCode.SelText = Clipboard.GetText()
  205. End Sub
  206. Private Sub mnu_Edit_SelectAll_Click()
  207.     txtCode.SelStart = 0
  208.     txtCode.SelLength = Len(txtCode.Text)
  209. End Sub
  210. Private Sub mnu_File_New_Click()
  211.     If bHasChanged = False Then
  212.         txtCode.Text = ""
  213.         strFileName = ""
  214.         mnu_Run_Start.Enabled = False
  215.     End If
  216. End Sub
  217. Private Sub mnu_File_Open_Click()
  218.     If bHasChanged Then
  219.     Else
  220.         On Error GoTo noopen
  221.         cmDialog.DialogTitle = "Open Script"
  222.         cmDialog.Filter = "SEX Script (*.sex)|*.sex|"
  223.         cmDialog.FilterIndex = 0
  224.         cmDialog.ShowOpen
  225.         strFileName = cmDialog.FileName
  226.         Me.MousePointer = 11
  227.         OpenFile strFileName
  228.         Me.MousePointer = 0
  229.         Exit Sub
  230. noopen:
  231.         If Err = 32755 Then Exit Sub
  232.         MsgBox "An error has occured while trying to access the file [" & Err & "]:" & vbCrLf & vbCrLf & Error, vbExclamation
  233.     End If
  234. End Sub
  235. Private Sub mnu_File_Save_Click()
  236.     If strFileName = "" Then
  237.         Call mnu_File_SaveAs_Click
  238.     Else
  239.         SaveFile strFileName
  240.     End If
  241.     mnu_File_Save.Enabled = False
  242. End Sub
  243. Private Sub mnu_File_SaveAs_Click()
  244.     On Error GoTo noSaveAs
  245.     cmDialog.DialogTitle = "Save Script"
  246.     cmDialog.Filter = "SEX Script (*.sex)|*.sex|"
  247.     cmDialog.FilterIndex = 0
  248.     cmDialog.FileName = strFileName
  249.     cmDialog.ShowSave
  250.     strFileName = cmDialog.FileName
  251.     SaveFile strFileName
  252.     mnu_File_Save.Enabled = False
  253.     Exit Sub
  254. noSaveAs:
  255.     If Err = 32755 Then Exit Sub
  256.     MsgBox "An error has occured while trying to access the file [" & Err & "]:" & vbCrLf & vbCrLf & Error, vbExclamation
  257. End Sub
  258. Private Sub mnu_Run_Break_Click()
  259.     Stop
  260. End Sub
  261. Private Sub mnu_Run_Start_Click()
  262.     On Error GoTo errorHandler
  263.     Me.MousePointer = 11
  264.     mnu_Run_Break.Enabled = True
  265.     Dim engine  As New clsSSE_Main
  266.     engine.NewScript
  267.     engine.LoadScript engine.ScriptCount, strFileName
  268.     Dim paramlist(0)
  269.     engine.ExecuteAlias "main", paramlist()
  270.     Me.MousePointer = 0
  271.     Exit Sub
  272. errorHandler:
  273.     MsgBox "An error has occured while trying to run the script, [" & Err & "]:" & vbCrLf & vbCrLf & Error
  274. End Sub
  275. Private Sub txtCode_Change()
  276.     bHasChanged = True
  277.     mnu_File_Save.Enabled = True
  278. End Sub
  279.