home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / 3ctrls / browser.frm next >
Text File  |  1994-05-17  |  14KB  |  449 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Code Browser using VideoSoft VSAWK"
  4.    ClientHeight    =   5640
  5.    ClientLeft      =   345
  6.    ClientTop       =   750
  7.    ClientWidth     =   7545
  8.    Height          =   6105
  9.    Left            =   255
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5640
  12.    ScaleWidth      =   7545
  13.    Top             =   375
  14.    Width           =   7725
  15.    Begin VideoSoftElastic Tooltip 
  16.       BackColor       =   &H0080FFFF&
  17.       BevelInner      =   0  'None
  18.       BevelOuterWidth =   0
  19.       BorderWidth     =   4
  20.       ChildSpacing    =   0
  21.       FloodColor      =   &H0080FFFF&
  22.       FloodDirection  =   1  'Right
  23.       FloodPercent    =   100
  24.       FontBold        =   -1  'True
  25.       FontItalic      =   0   'False
  26.       FontName        =   "Arial"
  27.       FontSize        =   8.25
  28.       FontStrikethru  =   0   'False
  29.       FontUnderline   =   0   'False
  30.       Height          =   315
  31.       IntBkg          =   &H0080FFFF&
  32.       Left            =   3870
  33.       TabIndex        =   12
  34.       Top             =   5220
  35.       Visible         =   0   'False
  36.       Width           =   1785
  37.    End
  38.    Begin VideoSoftAwk VSAwk3 
  39.       FS              =   " ,    "
  40.       Left            =   2025
  41.       Top             =   4500
  42.    End
  43.    Begin VideoSoftAwk VSAwk2 
  44.       FS              =   " ,    "
  45.       Left            =   1530
  46.       Top             =   4500
  47.    End
  48.    Begin VideoSoftAwk VSAwk1 
  49.       FS              =   " ,    "
  50.       Left            =   990
  51.       Top             =   4500
  52.    End
  53.    Begin CommonDialog CMDialog 
  54.       Left            =   450
  55.       Top             =   4455
  56.    End
  57.    Begin VideoSoftElastic VSElastic1 
  58.       Align           =   5  'Fill Container
  59.       AutoSizeChildren=   4  'Uneven Vertical
  60.       BackColor       =   &H0000FF00&
  61.       BorderWidth     =   -1
  62.       Height          =   4350
  63.       Index           =   5
  64.       IntBkg          =   &H0000FF00&
  65.       Left            =   0
  66.       Splitter        =   1  'Yes (with uneven spacing)
  67.       TabIndex        =   5
  68.       Top             =   795
  69.       Width           =   7545
  70.       Begin VideoSoftElastic VSElastic1 
  71.          AutoSizeChildren=   4  'Uneven Vertical
  72.          BackColor       =   &H00C0C0C0&
  73.          BorderWidth     =   0
  74.          Height          =   1620
  75.          Index           =   1
  76.          IntBkg          =   &H00C0C0C0&
  77.          Left            =   -15
  78.          Splitter        =   1  'Yes (with uneven spacing)
  79.          TabIndex        =   9
  80.          Top             =   2745
  81.          Width           =   7575
  82.          Begin ListBox List1 
  83.             FontBold        =   0   'False
  84.             FontItalic      =   0   'False
  85.             FontName        =   "Courier New"
  86.             FontSize        =   9
  87.             FontStrikethru  =   0   'False
  88.             FontUnderline   =   0   'False
  89.             Height          =   255
  90.             Left            =   3150
  91.             Sorted          =   -1  'True
  92.             TabIndex        =   10
  93.             Top             =   120
  94.             Visible         =   0   'False
  95.             Width           =   1545
  96.          End
  97.          Begin ListBox List2 
  98.             BackColor       =   &H00FFFFFF&
  99.             FontBold        =   0   'False
  100.             FontItalic      =   0   'False
  101.             FontName        =   "Courier New"
  102.             FontSize        =   9
  103.             FontStrikethru  =   0   'False
  104.             FontUnderline   =   0   'False
  105.             Height          =   1605
  106.             Left            =   0
  107.             Sorted          =   -1  'True
  108.             TabIndex        =   11
  109.             Top             =   0
  110.             Width           =   7575
  111.          End
  112.       End
  113.       Begin VideoSoftElastic VSElastic1 
  114.          AutoSizeChildren=   4  'Uneven Vertical
  115.          BackColor       =   &H00C0C0C0&
  116.          BevelInner      =   7  'Shadow
  117.          BevelInnerWidth =   4
  118.          BevelOuter      =   1  'Raised
  119.          BevelOuterWidth =   1
  120.          BorderWidth     =   18
  121.          ChildSpacing    =   -1
  122.          Height          =   2670
  123.          Index           =   4
  124.          IntBkg          =   &H00C0C0C0&
  125.          Left            =   -15
  126.          ShadowColor     =   &H00404040&
  127.          TabIndex        =   6
  128.          Top             =   -15
  129.          Width           =   7575
  130.          Begin TextBox Text1 
  131.             BackColor       =   &H00000080&
  132.             FontBold        =   -1  'True
  133.             FontItalic      =   0   'False
  134.             FontName        =   "Courier New"
  135.             FontSize        =   9.75
  136.             FontStrikethru  =   0   'False
  137.             FontUnderline   =   0   'False
  138.             ForeColor       =   &H0000FFFF&
  139.             Height          =   1680
  140.             Left            =   270
  141.             MultiLine       =   -1  'True
  142.             ScrollBars      =   3  'Both
  143.             TabIndex        =   7
  144.             Top             =   720
  145.             Width           =   7035
  146.          End
  147.          Begin VideoSoftElastic VSElastic1 
  148.             BackColor       =   &H00000000&
  149.             BevelInnerWidth =   0
  150.             BevelOuterWidth =   0
  151.             Caption         =   "Visual Basic Code"
  152.             CaptionPos      =   4  'Center Center
  153.             FontBold        =   -1  'True
  154.             FontItalic      =   0   'False
  155.             FontName        =   "Arial"
  156.             FontSize        =   13.5
  157.             FontStrikethru  =   0   'False
  158.             FontUnderline   =   0   'False
  159.             ForeColor       =   &H0000FFFF&
  160.             Height          =   465
  161.             Index           =   3
  162.             Left            =   270
  163.             TabIndex        =   8
  164.             Top             =   270
  165.             Width           =   7035
  166.          End
  167.       End
  168.    End
  169.    Begin VideoSoftElastic VSElastic3 
  170.       Align           =   2  'Align Bottom
  171.       BackColor       =   &H00C0C0C0&
  172.       BevelOuter      =   1  'Raised
  173.       BevelOuterWidth =   1
  174.       CaptionPos      =   4  'Center Center
  175.       FloodColor      =   &H0080FFFF&
  176.       FloodDirection  =   1  'Right
  177.       FontBold        =   -1  'True
  178.       FontItalic      =   0   'False
  179.       FontName        =   "System"
  180.       FontSize        =   9.75
  181.       FontStrikethru  =   0   'False
  182.       FontUnderline   =   0   'False
  183.       Height          =   495
  184.       IntBkg          =   &H00C0C0C0&
  185.       Left            =   0
  186.       TabIndex        =   4
  187.       Top             =   5145
  188.       Width           =   7545
  189.    End
  190.    Begin VideoSoftElastic VSElastic1 
  191.       Align           =   1  'Align Top
  192.       AutoSizeChildren=   1  'Even Horizontal
  193.       BackColor       =   &H00C0C0C0&
  194.       BevelInner      =   0  'None
  195.       BevelInnerWidth =   2
  196.       BevelOuter      =   6  'Groove
  197.       BorderWidth     =   12
  198.       Height          =   795
  199.       Index           =   0
  200.       IntBkg          =   &H00C0C0C0&
  201.       Left            =   0
  202.       TabIndex        =   3
  203.       Top             =   0
  204.       Width           =   7545
  205.       Begin CommandButton Command1 
  206.          BackColor       =   &H00C0C0C0&
  207.          Caption         =   "&Open.."
  208.          Default         =   -1  'True
  209.          FontBold        =   -1  'True
  210.          FontItalic      =   0   'False
  211.          FontName        =   "System"
  212.          FontSize        =   9.75
  213.          FontStrikethru  =   0   'False
  214.          FontUnderline   =   0   'False
  215.          Height          =   435
  216.          Index           =   0
  217.          Left            =   180
  218.          TabIndex        =   0
  219.          Tag             =   "Open VB file"
  220.          Top             =   180
  221.          Width           =   2340
  222.       End
  223.       Begin CommandButton Command1 
  224.          BackColor       =   &H00C0C0C0&
  225.          Caption         =   "&Print..."
  226.          FontBold        =   -1  'True
  227.          FontItalic      =   0   'False
  228.          FontName        =   "System"
  229.          FontSize        =   9.75
  230.          FontStrikethru  =   0   'False
  231.          FontUnderline   =   0   'False
  232.          Height          =   435
  233.          Index           =   2
  234.          Left            =   5040
  235.          TabIndex        =   2
  236.          Tag             =   "Print selected code"
  237.          Top             =   180
  238.          Width           =   2325
  239.       End
  240.       Begin CommandButton Command1 
  241.          BackColor       =   &H00C0C0C0&
  242.          Caption         =   "&Copy"
  243.          FontBold        =   -1  'True
  244.          FontItalic      =   0   'False
  245.          FontName        =   "System"
  246.          FontSize        =   9.75
  247.          FontStrikethru  =   0   'False
  248.          FontUnderline   =   0   'False
  249.          Height          =   435
  250.          Index           =   1
  251.          Left            =   2610
  252.          TabIndex        =   1
  253.          Tag             =   "Copy to Clipboard"
  254.          Top             =   180
  255.          Width           =   2340
  256.       End
  257.    End
  258. End
  259. Option Explicit
  260.  
  261. Dim subtext$
  262. Dim OldTip
  263.  
  264. ' Example using nested VideoSoft VSAWK
  265. ' Projects need to be saved as TEXT be parsed by VSAWK.
  266. ' Once the project is loaded, just click on the desired
  267. ' subroutine name on list2 and the code will be place on
  268. ' the text box.
  269.  
  270. ' VSElastic is used to automatically resize the form and
  271. ' for flooding status when parsing the file.
  272.  
  273. ' CMDialog is used to open the file.
  274.  
  275. Sub Command1_Click (Index%)
  276.   Select Case Index
  277.  
  278.     Case 0 'Open Button
  279.       ' get file name
  280.       cmdialog.DialogTitle = "Open VB Project"
  281.       cmdialog.Filename = ""
  282.       cmdialog.DefaultExt = "MAK"
  283.       cmdialog.Filter = "VB Projects (*.mak)|*.MAK|All Files (*.*)|*.*"
  284.       cmdialog.Flags = &H1800&
  285.       cmdialog.Action = 1
  286.       If cmdialog.Filename = "" Then Exit Sub
  287.     
  288.       ' read project
  289.       text1 = ""
  290.       vsawk1.FileName = cmdialog.Filename
  291.       vsawk1.Tag = Left(cmdialog.Filename, Len(cmdialog.Filename) - Len(cmdialog.Filetitle))
  292.       vsawk1.Action = 0
  293.       vselastic3.FloodPercent = 0
  294.       vselastic3 = "Ready"
  295.  
  296.  
  297.     Case 1 ' Clipboard
  298.       If text1 = "" Then MsgBox "Sorry, no code selected.", 16: Exit Sub
  299.       clipboard.SetText text1, 1
  300.       vselastic3 = "Code copied to clipboard"
  301.  
  302.     Case 2 'Print
  303.       MsgBox "Print routine not implemented", 64
  304.  
  305.   End Select
  306. End Sub
  307.  
  308. Sub Command1_MouseMove (Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  309.   
  310.   If OldTip = Index Then Exit Sub
  311.   ToolTip.Caption = Command1(Index).Tag
  312.   ToolTip.Width = TextWidth(Command1(Index).Tag)
  313.   ToolTip.Move Command1(Index).Left + Command1(Index).Height * .75, Command1(Index).Top + Command1(Index).Height * 1.1
  314.   ToolTip.Visible = True
  315.  
  316.   OldTip = Index
  317.  
  318. End Sub
  319.  
  320. Sub List2_DblClick ()
  321.   
  322.   vsawk3 = list2
  323.   vsawk3.FileName = vsawk3.F(3)
  324.   vsawk3.Tag = Val(vsawk3.F(4))
  325.   vsawk3.Action = 0
  326.  
  327. End Sub
  328.  
  329. Sub VSAwk1_Begin ()
  330.   mousepointer = 11
  331.   list1.Clear
  332. End Sub
  333.  
  334. Sub VSAwk1_End ()
  335.   Dim i%
  336.  
  337.   list2.Clear
  338.   For i = 0 To list1.ListCount - 1
  339.     list1.ListIndex = i
  340.     vsawk2.FileName = list1.List(i)
  341.     vselastic3 = vsawk2.FileName
  342.     vsawk2.Action = 0
  343.     list2.Refresh
  344.   Next
  345.  
  346. End Sub
  347.  
  348. Sub VSAwk1_Scan ()
  349.   'add .FRM files to List1
  350.   If InStr(vsawk1, "=") > 0 Or InStr(vsawk1, "VBX") > 0 Then Exit Sub
  351.   If InStr(vsawk1, "\") > 0 Then
  352.     list1.AddItem vsawk1
  353.   Else
  354.     list1.AddItem vsawk1.Tag + vsawk1
  355.   End If
  356.  
  357. End Sub
  358.  
  359. Sub VSAwk2_End ()
  360.   mousepointer = 0
  361. End Sub
  362.  
  363. Sub VSAwk2_Scan ()
  364.   Static insub%, a$, lp%
  365.  
  366.   If vsawk2.PercentDone <> lp Then
  367.     lp = vsawk2.PercentDone
  368.     vselastic3.FloodPercent = lp
  369.     DoEvents
  370.   End If
  371.  
  372.   '=====================================================
  373.   'Search for subroutines/Functions/Variable definitions
  374.   '=====================================================
  375.   If vsawk2.F(1) = "Sub" Then
  376.     insub = True
  377.     a = vsawk2.F(2) + Chr(9) + "(sub)" + Chr(9) + vsawk2.FileName + Chr(9) + Format(vsawk2.CurrPos)
  378.     list2.AddItem a
  379.     Exit Sub
  380.   End If
  381.  
  382.   If vsawk2.F(1) = "Function" Then
  383.     insub = True
  384.     a = vsawk2.F(2) + Chr(9) + "(fun)" + Chr(9) + vsawk2.FileName + Chr(9) + Format(vsawk2.CurrPos)
  385.     list2.AddItem a
  386.     Exit Sub
  387.   End If
  388.  
  389.   If vsawk2.F(1) = "Global" And vsawk2.F(2) <> "Const" Then
  390.     a = vsawk2.F(2) + Chr(9) + "(gvar)" + Chr(9) + vsawk2.FileName + Chr(9) + Format(vsawk2.CurrPos)
  391.     list2.AddItem a
  392.     Exit Sub
  393.   End If
  394.  
  395.   If vsawk2.F(1) = "Dim" And Not insub Then
  396.     a = vsawk2.F(2) + Chr(9) + "(fvar)" + Chr(9) + vsawk2.FileName + Chr(9) + Format(vsawk2.CurrPos)
  397.     list2.AddItem a
  398.     Exit Sub
  399.   End If
  400.  
  401.   If vsawk2.F(1) = "End" And (vsawk2.F(2) = "Sub" Or vsawk2.F(2) = "Function") Then
  402.     insub = False
  403.     Exit Sub
  404.   End If
  405.  
  406. End Sub
  407.  
  408. Sub VSAwk3_Begin ()
  409.  
  410.   mousepointer = 11
  411.   vsawk3.CurrPos = Val(vsawk3.Tag)
  412.   subtext = ""
  413.  
  414. End Sub
  415.  
  416. Sub VSAwk3_End ()
  417.   
  418.   text1 = subtext
  419.   mousepointer = 0
  420. End Sub
  421.  
  422. Sub VSAwk3_Scan ()
  423.   
  424.   ' accumulate text
  425.   If subtext = "" Then
  426.     subtext = vsawk3
  427.   Else
  428.     subtext = subtext + Chr(13) + Chr(10) + vsawk3
  429.   End If
  430.   
  431.   ' stop if only a var
  432.   If vsawk3.RN = 0 Then
  433.     If vsawk3.F(1) <> "Sub" And vsawk3.F(1) <> "Function" Then vsawk3.Action = 2
  434.   End If
  435.  
  436.   ' stop at end of functions and subs
  437.   If vsawk3.F(1) = "End" Then
  438.     If vsawk3.F(2) = "Sub" Then vsawk3.Action = 2
  439.     If vsawk3.F(2) = "Function" Then vsawk3.Action = 2
  440.   End If
  441.  
  442. End Sub
  443.  
  444. Sub VSElastic1_MouseMove (Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  445.   OldTip = -1
  446.   ToolTip.Visible = False
  447. End Sub
  448.  
  449.