home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form SaveFileDlg
- BorderStyle = 3 'Fixed Double
- Caption = "Save Icon"
- ClipControls = 0 'False
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 3975
- HelpContextID = 1
- Icon = SAVEDLG.FRX:0000
- Left = 1110
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3570
- ScaleWidth = 5400
- Top = 1155
- Width = 5520
- Begin TextBox Txt_FileName
- Height = 345
- Left = 1080
- TabIndex = 1
- Top = 90
- Width = 4230
- End
- Begin FileListBox File_FileList
- Height = 1785
- Left = 135
- Pattern = "*.ico"
- TabIndex = 3
- Top = 1050
- Width = 1800
- End
- Begin DirListBox Dir_DirectoryList
- Height = 1785
- Left = 2010
- TabIndex = 5
- Top = 1050
- Width = 1800
- End
- Begin CommandButton Cmd_Save
- Caption = "&Save"
- Default = -1 'True
- Height = 375
- Left = 3960
- TabIndex = 11
- Top = 1410
- Width = 1275
- End
- Begin CommandButton Cmd_Cancel
- Cancel = -1 'True
- Caption = "&Cancel"
- Height = 375
- Left = 3960
- TabIndex = 12
- Top = 2190
- Width = 1275
- End
- Begin DriveListBox Drv_DriveList
- Height = 1530
- Left = 120
- TabIndex = 7
- Top = 3120
- Width = 3705
- End
- Begin Label Lbl_FileName
- Caption = "File &Name:"
- Height = 240
- Left = 120
- TabIndex = 0
- Top = 150
- Width = 960
- End
- Begin Label Lbl_Directory
- Caption = "Directory:"
- Height = 240
- Left = 120
- TabIndex = 13
- Top = 480
- Width = 960
- End
- Begin Label Lbl_CurrentDirectory
- Height = 240
- Left = 1110
- TabIndex = 8
- Top = 480
- Width = 4200
- End
- Begin Label Lbl_Files
- Caption = "&Files:"
- Height = 240
- Left = 120
- TabIndex = 2
- Top = 810
- Width = 1800
- End
- Begin Label Lbl_Directories
- Caption = "&Directories:"
- Height = 240
- Left = 2010
- TabIndex = 4
- Top = 810
- Width = 1800
- End
- Begin Label Lbl_Drives
- Caption = "Dri&ves:"
- Height = 240
- Left = 120
- TabIndex = 6
- Top = 2880
- Width = 1800
- End
- DefInt A-Z
- Dim SaveDlgLoaded
- Sub Cmd_Cancel_Click ()
- Unload SaveFileDlg
- End Sub
- Sub Cmd_Save_Click ()
- Select Case SLastChanged
- Case FILENAME_CHANGED
- '
- ' A filename has been entered directly into the FileName TextBox
- '
- If Validate_FileSpec(SaveFileDlg, False) Then
- '
- ' A valid new filename has been entered. Attach a extension of .ICO if
- ' an extension was not given.
- '
- If InStr(Txt_FileName.Text, ".") = 0 Then Txt_FileName.Text = Txt_FileName.Text + ".ico"
- Write_Icon_To_File (File_FileList.Path), (Txt_FileName.Text)
- Unload SaveFileDlg
- End If
-
- Case FILE_CHANGED
- '
- ' An existing filename has been selected from the File ListBox, so ask
- ' the user if the existing file should be over written.
- '
- If MsgBox("Overwrite file: " + File_FileList.FileName + "?", 36, "IconWorks") = MBYES Then
- '
- ' User wants to overwrite existing file.
- '
- Write_Icon_To_File (File_FileList.Path), (File_FileList.FileName)
- Unload SaveFileDlg
- End If
- Case DIR_CHANGED
- '
- ' The last control to changed was the Directory list, so simply
- ' set is Path to is current selection.
- '
- Dir_DirectoryList.Path = Dir_DirectoryList.List(Dir_DirectoryList.ListIndex)
- End Select
- If SaveDlgLoaded And (SLastChanged <> DIR_CHANGED) Then
- ChDir File_FileList.Path
- Drv_DriveList.Drive = Left$(File_FileList.Path, 2)
- Dir_DirectoryList.Path = File_FileList.Path
- End If
- End Sub
- Sub Dir_DirectoryList_Change ()
- ' Make the current directory that of Dir_DirectoryList.path
- '
- ChDir Dir_DirectoryList.Path
- ' Display the new path
- '
- Lbl_CurrentDirectory.Caption = Dir_DirectoryList.Path
- ' Notifiy the File Listbox of the path change
- '
- File_FileList.Path = Dir_DirectoryList.Path
- UpDate_FileSpec SaveFileDlg
-
- End Sub
- Sub Dir_DirectoryList_Click ()
- ' The actual path has not changed, since the Directory ListBox was
- ' only single clicked, however, the FileName TextBox should be updated
- ' to reflect what will be the result if Enter is now pressed or the
- ' Save button is clicked
- '
- UpDate_FileSpec SaveFileDlg
- SLastChanged = DIR_CHANGED
- End Sub
- Sub Drv_DriveList_Change ()
- Validate_And_Change_Drives SaveFileDlg
- End Sub
- Sub File_FileList_Click ()
- ' An existing file has been selected but not commited, so only display
- ' the selected filename.
- '
- Txt_FileName.Text = File_FileList.FileName
- SLastChanged = FILE_CHANGED
- End Sub
- Sub File_FileList_DblClick ()
- ' An existing file has been selected, so attempt to save the Icon out to
- ' the selected file
- '
- SLastChanged = FILE_CHANGED
- Cmd_Save_Click
- End Sub
- Sub Form_Load ()
- ' Dialog Boxes should only have Move and Close items
- ' in their System menus', so remove the others.
- '
- Remove_Items_From_Sysmenu SaveFileDlg
- If IconInfo(CurrentIcon).FileName = UNTITLED Then
- ' Icon is a newly created Icon so display current directory
- ' and *.ICO in the FileName TextBox
- '
- Lbl_CurrentDirectory.Caption = Dir_DirectoryList.Path
- UpDate_FileSpec SaveFileDlg
- Else
- ' Icon is a previously loaded Icon, so initialize controls to
- ' the icons Directory, Path, and Filename
- '
- Drv_DriveList.Drive = Left$(IconInfo(CurrentIcon).FullPath, 2)
- Dir_DirectoryList.Path = IconInfo(CurrentIcon).FullPath
- Txt_FileName.Text = IconInfo(CurrentIcon).FileName
- End If
- Highlight_FileName
- SaveDlgLoaded = True
- End Sub
- Sub Form_Unload (Cancel As Integer)
- ' Since the Current directory and drive affects all loaded forms, we must
- ' reset the Current Drive back to what it was before the SaveFileDlg
- ' was loaded, since the Viewer could be active and be displaying icons
- ' located on another drive and in another directory.
- '
- If ViewerLoaded Then
- ChDrive Viewer.Drv_DriveList.Drive
- ChDir Viewer.Dir_DirectoryList.Path
- End If
- SaveDlgLoaded = False
- End Sub
- ' Sets the selection of the FileName textbox to the
- ' entire contents.
- Sub Highlight_FileName ()
- Txt_FileName.SelStart = 0
- Txt_FileName.SelLength = Len(Txt_FileName.Text)
- End Sub
- Sub Txt_FileName_Change ()
- SLastChanged = FILENAME_CHANGED
- End Sub
- Sub Txt_FileName_GotFocus ()
- Highlight_FileName
- End Sub
-