home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l406 / 4.ddi / SAVEDLG.FR_ / SAVEDLG.bin (.txt)
Encoding:
Visual Basic Form  |  1992-10-21  |  8.2 KB  |  249 lines

  1. VERSION 2.00
  2. Begin Form SaveFileDlg 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Save Icon"
  5.    ClipControls    =   0   'False
  6.    FontBold        =   -1  'True
  7.    FontItalic      =   0   'False
  8.    FontName        =   "System"
  9.    FontSize        =   9.75
  10.    FontStrikethru  =   0   'False
  11.    FontUnderline   =   0   'False
  12.    Height          =   3975
  13.    HelpContextID   =   1
  14.    Icon            =   SAVEDLG.FRX:0000
  15.    Left            =   1110
  16.    LinkMode        =   1  'Source
  17.    LinkTopic       =   "Form1"
  18.    MaxButton       =   0   'False
  19.    MinButton       =   0   'False
  20.    ScaleHeight     =   3570
  21.    ScaleWidth      =   5400
  22.    Top             =   1155
  23.    Width           =   5520
  24.    Begin TextBox Txt_FileName 
  25.       Height          =   345
  26.       Left            =   1080
  27.       TabIndex        =   1
  28.       Top             =   90
  29.       Width           =   4230
  30.    End
  31.    Begin FileListBox File_FileList 
  32.       Height          =   1785
  33.       Left            =   135
  34.       Pattern         =   "*.ico"
  35.       TabIndex        =   3
  36.       Top             =   1050
  37.       Width           =   1800
  38.    End
  39.    Begin DirListBox Dir_DirectoryList 
  40.       Height          =   1785
  41.       Left            =   2010
  42.       TabIndex        =   5
  43.       Top             =   1050
  44.       Width           =   1800
  45.    End
  46.    Begin CommandButton Cmd_Save 
  47.       Caption         =   "&Save"
  48.       Default         =   -1  'True
  49.       Height          =   375
  50.       Left            =   3960
  51.       TabIndex        =   11
  52.       Top             =   1410
  53.       Width           =   1275
  54.    End
  55.    Begin CommandButton Cmd_Cancel 
  56.       Cancel          =   -1  'True
  57.       Caption         =   "&Cancel"
  58.       Height          =   375
  59.       Left            =   3960
  60.       TabIndex        =   12
  61.       Top             =   2190
  62.       Width           =   1275
  63.    End
  64.    Begin DriveListBox Drv_DriveList 
  65.       Height          =   1530
  66.       Left            =   120
  67.       TabIndex        =   7
  68.       Top             =   3120
  69.       Width           =   3705
  70.    End
  71.    Begin Label Lbl_FileName 
  72.       Caption         =   "File &Name:"
  73.       Height          =   240
  74.       Left            =   120
  75.       TabIndex        =   0
  76.       Top             =   150
  77.       Width           =   960
  78.    End
  79.    Begin Label Lbl_Directory 
  80.       Caption         =   "Directory:"
  81.       Height          =   240
  82.       Left            =   120
  83.       TabIndex        =   13
  84.       Top             =   480
  85.       Width           =   960
  86.    End
  87.    Begin Label Lbl_CurrentDirectory 
  88.       Height          =   240
  89.       Left            =   1110
  90.       TabIndex        =   8
  91.       Top             =   480
  92.       Width           =   4200
  93.    End
  94.    Begin Label Lbl_Files 
  95.       Caption         =   "&Files:"
  96.       Height          =   240
  97.       Left            =   120
  98.       TabIndex        =   2
  99.       Top             =   810
  100.       Width           =   1800
  101.    End
  102.    Begin Label Lbl_Directories 
  103.       Caption         =   "&Directories:"
  104.       Height          =   240
  105.       Left            =   2010
  106.       TabIndex        =   4
  107.       Top             =   810
  108.       Width           =   1800
  109.    End
  110.    Begin Label Lbl_Drives 
  111.       Caption         =   "Dri&ves:"
  112.       Height          =   240
  113.       Left            =   120
  114.       TabIndex        =   6
  115.       Top             =   2880
  116.       Width           =   1800
  117.    End
  118. DefInt A-Z
  119. Dim SaveDlgLoaded
  120. Sub Cmd_Cancel_Click ()
  121.     Unload SaveFileDlg
  122. End Sub
  123. Sub Cmd_Save_Click ()
  124.     Select Case SLastChanged
  125.         Case FILENAME_CHANGED
  126.             '
  127.             ' A filename has been entered directly into the FileName TextBox
  128.             '
  129.             If Validate_FileSpec(SaveFileDlg, False) Then
  130.                 '
  131.                 ' A valid new filename has been entered.  Attach a extension of .ICO if
  132.                 ' an extension was not given.
  133.                 '
  134.                 If InStr(Txt_FileName.Text, ".") = 0 Then Txt_FileName.Text = Txt_FileName.Text + ".ico"
  135.                 Write_Icon_To_File (File_FileList.Path), (Txt_FileName.Text)
  136.                 Unload SaveFileDlg
  137.             End If
  138.         
  139.         Case FILE_CHANGED
  140.             '
  141.             ' An existing filename has been selected from the File ListBox, so ask
  142.             ' the user if the existing file should be over written.
  143.             '
  144.             If MsgBox("Overwrite file: " + File_FileList.FileName + "?", 36, "IconWorks") = MBYES Then
  145.                 '
  146.                 ' User wants to overwrite existing file.
  147.                 '
  148.                 Write_Icon_To_File (File_FileList.Path), (File_FileList.FileName)
  149.                 Unload SaveFileDlg
  150.             End If
  151.         Case DIR_CHANGED
  152.             '
  153.             ' The last control to changed was the Directory list, so simply
  154.             ' set is Path to is current selection.
  155.             '
  156.             Dir_DirectoryList.Path = Dir_DirectoryList.List(Dir_DirectoryList.ListIndex)
  157.     End Select
  158.     If SaveDlgLoaded And (SLastChanged <> DIR_CHANGED) Then
  159.         ChDir File_FileList.Path
  160.         Drv_DriveList.Drive = Left$(File_FileList.Path, 2)
  161.         Dir_DirectoryList.Path = File_FileList.Path
  162.     End If
  163. End Sub
  164. Sub Dir_DirectoryList_Change ()
  165.     ' Make the current directory that of Dir_DirectoryList.path
  166.     '
  167.     ChDir Dir_DirectoryList.Path
  168.     ' Display the new path
  169.     '
  170.     Lbl_CurrentDirectory.Caption = Dir_DirectoryList.Path
  171.     ' Notifiy the File Listbox of the path change
  172.     '
  173.     File_FileList.Path = Dir_DirectoryList.Path
  174.     UpDate_FileSpec SaveFileDlg
  175.                                                        
  176. End Sub
  177. Sub Dir_DirectoryList_Click ()
  178.     ' The actual path has not changed, since the Directory ListBox was
  179.     ' only single clicked, however, the FileName TextBox should be updated
  180.     ' to reflect what will be the result if Enter is now pressed or the
  181.     ' Save button is clicked
  182.     '
  183.     UpDate_FileSpec SaveFileDlg
  184.     SLastChanged = DIR_CHANGED
  185. End Sub
  186. Sub Drv_DriveList_Change ()
  187.     Validate_And_Change_Drives SaveFileDlg
  188. End Sub
  189. Sub File_FileList_Click ()
  190.     ' An existing file has been selected but not commited, so only display
  191.     ' the selected filename.
  192.     '
  193.     Txt_FileName.Text = File_FileList.FileName
  194.     SLastChanged = FILE_CHANGED
  195. End Sub
  196. Sub File_FileList_DblClick ()
  197.     ' An existing file has been selected, so attempt to save the Icon out to
  198.     ' the selected file
  199.     '
  200.     SLastChanged = FILE_CHANGED
  201.     Cmd_Save_Click
  202. End Sub
  203. Sub Form_Load ()
  204.     ' Dialog Boxes should only have Move and Close items
  205.     ' in their System menus', so remove the others.
  206.     '
  207.     Remove_Items_From_Sysmenu SaveFileDlg
  208.     If IconInfo(CurrentIcon).FileName = UNTITLED Then
  209.         ' Icon is a newly created Icon so display current directory
  210.         ' and *.ICO in the FileName TextBox
  211.         '
  212.         Lbl_CurrentDirectory.Caption = Dir_DirectoryList.Path
  213.         UpDate_FileSpec SaveFileDlg
  214.     Else
  215.         ' Icon is a previously loaded Icon, so initialize controls to
  216.         ' the icons Directory, Path, and Filename
  217.         '
  218.         Drv_DriveList.Drive = Left$(IconInfo(CurrentIcon).FullPath, 2)
  219.         Dir_DirectoryList.Path = IconInfo(CurrentIcon).FullPath
  220.         Txt_FileName.Text = IconInfo(CurrentIcon).FileName
  221.     End If
  222.     Highlight_FileName
  223.     SaveDlgLoaded = True
  224. End Sub
  225. Sub Form_Unload (Cancel As Integer)
  226.     ' Since the Current directory and drive affects all loaded forms, we must
  227.     ' reset the Current Drive back to what it was before the SaveFileDlg
  228.     ' was loaded, since the Viewer could be active and be displaying icons
  229.     ' located on another drive and in another directory.
  230.     '
  231.     If ViewerLoaded Then
  232.         ChDrive Viewer.Drv_DriveList.Drive
  233.         ChDir Viewer.Dir_DirectoryList.Path
  234.     End If
  235.     SaveDlgLoaded = False
  236. End Sub
  237. ' Sets the selection of the FileName textbox to the
  238. ' entire contents.
  239. Sub Highlight_FileName ()
  240.     Txt_FileName.SelStart = 0
  241.     Txt_FileName.SelLength = Len(Txt_FileName.Text)
  242. End Sub
  243. Sub Txt_FileName_Change ()
  244.     SLastChanged = FILENAME_CHANGED
  245. End Sub
  246. Sub Txt_FileName_GotFocus ()
  247.     Highlight_FileName
  248. End Sub
  249.