home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l407 / 1.ddi / NOTEPAD.FR_ / NOTEPAD.bin (.txt)
Encoding:
Visual Basic Form  |  1993-04-28  |  8.3 KB  |  318 lines

  1. VERSION 2.00
  2. Begin Form frmNotePad 
  3.    Caption         =   "Untitled"
  4.    ClientHeight    =   3975
  5.    ClientLeft      =   885
  6.    ClientTop       =   2910
  7.    ClientWidth     =   5610
  8.    Height          =   4665
  9.    Left            =   825
  10.    LinkTopic       =   "Form1"
  11.    MDIChild        =   -1  'True
  12.    ScaleHeight     =   3975
  13.    ScaleWidth      =   5610
  14.    Top             =   2280
  15.    Visible         =   0   'False
  16.    Width           =   5730
  17.    Begin TextBox Text1 
  18.       Height          =   3855
  19.       HideSelection   =   0   'False
  20.       Left            =   0
  21.       MultiLine       =   -1  'True
  22.       ScrollBars      =   3  'Both
  23.       TabIndex        =   0
  24.       Top             =   0
  25.       Width           =   5655
  26.    End
  27.    Begin Menu mnuFile 
  28.       Caption         =   "&File"
  29.       Begin Menu mnuFNew 
  30.      Caption         =   "&New"
  31.       End
  32.       Begin Menu mnuFOpen 
  33.      Caption         =   "&Open..."
  34.       End
  35.       Begin Menu mnuFClose 
  36.      Caption         =   "&Close"
  37.       End
  38.       Begin Menu mnuFSave 
  39.      Caption         =   "&Save"
  40.       End
  41.       Begin Menu mnuFSaveAs 
  42.      Caption         =   "Save &As..."
  43.       End
  44.       Begin Menu mnuFSep 
  45.      Caption         =   "-"
  46.       End
  47.       Begin Menu mnuFExit 
  48.      Caption         =   "E&xit"
  49.       End
  50.       Begin Menu mnuRecentFile 
  51.      Caption         =   "-"
  52.      Index           =   0
  53.      Visible         =   0   'False
  54.       End
  55.       Begin Menu mnuRecentFile 
  56.      Caption         =   "RecentFile1"
  57.      Index           =   1
  58.      Visible         =   0   'False
  59.       End
  60.       Begin Menu mnuRecentFile 
  61.      Caption         =   "RecentFile2"
  62.      Index           =   2
  63.      Visible         =   0   'False
  64.       End
  65.       Begin Menu mnuRecentFile 
  66.      Caption         =   "RecentFile3"
  67.      Index           =   3
  68.      Visible         =   0   'False
  69.       End
  70.       Begin Menu mnuRecentFile 
  71.      Caption         =   "RecentFile4"
  72.      Index           =   4
  73.      Visible         =   0   'False
  74.       End
  75.    End
  76.    Begin Menu mnuEdit 
  77.       Caption         =   "&Edit"
  78.       Begin Menu mnuECut 
  79.      Caption         =   "Cu&t"
  80.      Shortcut        =   ^X
  81.       End
  82.       Begin Menu mnuECopy 
  83.      Caption         =   "&Copy"
  84.      Shortcut        =   ^C
  85.       End
  86.       Begin Menu mnuEPaste 
  87.      Caption         =   "&Paste"
  88.      Shortcut        =   ^V
  89.       End
  90.       Begin Menu mnuEDelete 
  91.      Caption         =   "De&lete"
  92.      Shortcut        =   {DEL}
  93.       End
  94.       Begin Menu mnuESep1 
  95.      Caption         =   "-"
  96.       End
  97.       Begin Menu mnuESelectAll 
  98.      Caption         =   "Select &All"
  99.       End
  100.       Begin Menu mnuETime 
  101.      Caption         =   "Time/&Date"
  102.       End
  103.    End
  104.    Begin Menu mnuSearch 
  105.       Caption         =   "&Search"
  106.       Begin Menu mnuSFind 
  107.      Caption         =   "&Find"
  108.       End
  109.       Begin Menu mnuSFindNext 
  110.      Caption         =   "Find &Next"
  111.      Shortcut        =   {F3}
  112.       End
  113.    End
  114.    Begin Menu mnuOptions 
  115.       Caption         =   "&Options"
  116.       Begin Menu mnuOToolbar 
  117.      Caption         =   "&Toolbar"
  118.       End
  119.       Begin Menu mnuFont 
  120.      Caption         =   "&Font"
  121.      Begin Menu mnuFontName 
  122.         Caption         =   "FontName"
  123.         Index           =   0
  124.      End
  125.       End
  126.    End
  127.    Begin Menu mnuWindow 
  128.       Caption         =   "&Window"
  129.       WindowList      =   -1  'True
  130.       Begin Menu mnuWCascade 
  131.      Caption         =   "&Cascade"
  132.       End
  133.       Begin Menu mnuWTile 
  134.      Caption         =   "&Tile"
  135.       End
  136.       Begin Menu mnuWArrange 
  137.      Caption         =   "&Arrange Icons"
  138.       End
  139.    End
  140. Sub Form_Load ()
  141.     Dim i As Integer
  142.     mnuFontName(0).Caption = screen.Fonts(0)
  143.     For i = 1 To screen.FontCount - 1
  144.     Load mnuFontName(i)
  145.     mnuFontName(0).Caption = screen.Fonts(i)
  146.     Next
  147. End Sub
  148. Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
  149.     Dim Msg, Filename, NL
  150.     Dim Response As Integer
  151.     If FState(Me.Tag).Dirty Then
  152.     Filename = Me.Caption
  153.     NL = Chr$(10) & Chr$(13)
  154.     Msg = "The text in [" & Filename & "] has changed."
  155.     Msg = Msg & NL
  156.     Msg = Msg & "Do you want to save the changes?"
  157.     Response = MsgBox(Msg, 51, frmMDI.Caption)
  158.     Select Case Response
  159.     ' User selects Yes
  160.     Case 6
  161.         'Get the filename to save the file
  162.         Filename = GetFileName()
  163.         'If the user did notspecify a file name,
  164.         'cancel the unload; otherwise, save it.
  165.         If Filename = "" Then
  166.         Cancel = True
  167.         Else
  168.         SaveFileAs (Filename)
  169.         End If
  170.     ' User selects No
  171.     ' Ok to unload
  172.     Case 7
  173.         Cancel = False
  174.     ' User selects Cancel
  175.     ' Cancel the unload
  176.     Case 2
  177.         Cancel = True
  178.     End Select
  179.     End If
  180. End Sub
  181. Sub Form_Resize ()
  182.     If windowstate <> 1 And ScaleHeight <> 0 Then
  183.     Text1.Visible = False
  184.     Text1.Height = ScaleHeight
  185.     Text1.Width = ScaleWidth
  186.     Text1.Visible = True
  187.     End If
  188. End Sub
  189. Sub Form_Unload (Cancel As Integer)
  190.     FState(Me.Tag).Deleted = True
  191. 'Hide toolbar edit buttons if no notepad windows
  192.     If Not AnyPadsLeft() Then
  193.     frmMDI!imgCutButton.Visible = False
  194.     frmMDI!imgCopyButton.Visible = False
  195.     frmMDI!imgPasteButton.Visible = False
  196.     End If
  197. End Sub
  198. Sub mnuECopy_Click ()
  199.     EditCopyProc
  200. End Sub
  201. Sub mnuECut_Click ()
  202.     EditCutProc
  203. End Sub
  204. Sub mnuEDelete_Click ()
  205.   ' If cursor is not at the end of the notepad.
  206.   If screen.ActiveControl.SelStart <> Len(screen.ActiveControl.Text) Then
  207.     ' If nothing is selected, extend selection by one.
  208.     If screen.ActiveControl.SelLength = 0 Then
  209.       screen.ActiveControl.SelLength = 1
  210.       ' If cursor is on a blank line, extend selection by two.
  211.       If Asc(screen.ActiveControl.SelText) = 13 Then
  212.     screen.ActiveControl.SelLength = 2
  213.       End If
  214.     End If
  215.     ' Delete selected text.
  216.     screen.ActiveControl.SelText = ""
  217.   End If
  218. End Sub
  219. Sub mnuEPaste_Click ()
  220.     EditPasteProc
  221. End Sub
  222. Sub mnuESelectAll_Click ()
  223.     frmMDI.ActiveForm.Text1.SelStart = 0
  224.     frmMDI.ActiveForm.Text1.SelLength = Len(frmMDI.ActiveForm.Text1.Text)
  225. End Sub
  226. Sub mnuETime_Click ()
  227.     Dim TimeStr As String, DateStr As String
  228.     Text1.SelText = Now
  229. End Sub
  230. Sub mnuFClose_Click ()
  231.     Unload Me
  232. End Sub
  233. Sub mnuFExit_Click ()
  234.     ' Unloading the MDI form invokes the QueryUnload event
  235.     ' for each child form, then the MDI form - before unloading
  236.     ' the MDI form. Setting the Cancel argument to True in any of the
  237.     ' QueryUnload events aborts the unload.
  238.     Unload frmMDI
  239. End Sub
  240. Sub mnuFNew_Click ()
  241.     FileNew
  242. End Sub
  243. Sub mnuFontName_Click (index As Integer)
  244.     Text1.FontName = mnuFontName(index).Caption
  245. End Sub
  246. Sub mnuFOpen_Click ()
  247.     FOpenProc
  248. End Sub
  249. Sub mnuFSave_Click ()
  250.     Dim Filename As String
  251.     If Left(Me.Caption, 8) = "Untitled" Then
  252.     ' The file hasn't been saved yet,
  253.     ' get the filename, then call the
  254.     ' save procedure
  255.     Filename = GetFileName()
  256.     Else
  257.     ' The caption contains the name of the open file
  258.     Filename = Me.Caption
  259.     End If
  260.     ' call the save procedure, if Filename = Empty then
  261.     ' the user selected Cancel in the Save As dialog, otherwise
  262.     ' save the file
  263.     If Filename <> "" Then
  264.     SaveFileAs Filename
  265.     End If
  266. End Sub
  267. Sub mnuFSaveAs_Click ()
  268.     Dim SaveFileName As String
  269.     SaveFileName = GetFileName()
  270.     If SaveFileName <> "" Then SaveFileAs (SaveFileName)
  271.     ' Update the recent files menu
  272.     UpdateFileMenu (SaveFileName)
  273. End Sub
  274. Sub mnuOptions_Click ()
  275.     mnuOToolbar.Checked = frmMDI!picToolbar.Visible
  276. End Sub
  277. Sub mnuOToolbar_Click ()
  278.     OptionsToolbarProc Me
  279. End Sub
  280. Sub mnuRecentFile_Click (index As Integer)
  281.   OpenFile (mnuRecentFile(index).Caption)
  282.   ' Update recent files list for new notepad.
  283.   GetRecentFiles
  284. End Sub
  285. Sub mnuSFind_Click ()
  286.     If Me!Text1.SelText <> "" Then
  287.     frmFind!Text1.Text = Me!Text1.SelText
  288.     Else
  289.     frmFind!Text1.Text = FindString
  290.     End If
  291.     gFirstTime = True
  292.     frmFind.Show
  293. End Sub
  294. Sub mnuSFindNext_Click ()
  295.     If Len(gFindString) > 0 Then
  296.     FindIt
  297.     Else
  298.     mnuSFind_Click
  299.     End If
  300. End Sub
  301. Sub mnuWArrange_Click ()
  302.     frmMDI.Arrange ARRANGE_ICONS
  303. End Sub
  304. Sub mnuWCascade_Click ()
  305.     frmMDI.Arrange CASCADE
  306. End Sub
  307. Sub mnuWTile_Click ()
  308.     frmMDI.Arrange TILE_HORIZONTAL
  309. End Sub
  310. Sub Text1_Change ()
  311.     FState(Me.Tag).Dirty = True
  312. End Sub
  313. Sub Text1_GotFocus ()
  314.     If frmFind.Visible Then
  315.     frmFind.ZOrder 0
  316.     End If
  317. End Sub
  318.