home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / xceedzip / FRMOPTIO.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-04-26  |  13.5 KB  |  334 lines

  1. VERSION 5.00
  2. Begin VB.Form frmOptions 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Zip Manager Options"
  5.    ClientHeight    =   4470
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   4605
  9.    ClipControls    =   0   'False
  10.    ControlBox      =   0   'False
  11.    Icon            =   "frmOptions.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   4470
  16.    ScaleWidth      =   4605
  17.    StartUpPosition =   1  'CenterOwner
  18.    Begin VB.Frame fraExtraHeaders 
  19.       Caption         =   "Store extra information in the zip file"
  20.       BeginProperty Font 
  21.          Name            =   "MS Sans Serif"
  22.          Size            =   8.25
  23.          Charset         =   0
  24.          Weight          =   700
  25.          Underline       =   0   'False
  26.          Italic          =   0   'False
  27.          Strikethrough   =   0   'False
  28.       EndProperty
  29.       Height          =   1335
  30.       Left            =   120
  31.       TabIndex        =   14
  32.       Top             =   2520
  33.       Width           =   4335
  34.       Begin VB.CheckBox chkExtraSecurityDsc 
  35.          Caption         =   "Windows NT file security and permissions"
  36.          Height          =   255
  37.          Left            =   120
  38.          TabIndex        =   9
  39.          Top             =   960
  40.          Width           =   3615
  41.       End
  42.       Begin VB.CheckBox chkExtraUnicode 
  43.          Caption         =   "Unicode filenames"
  44.          Height          =   255
  45.          Left            =   120
  46.          TabIndex        =   8
  47.          Top             =   720
  48.          Width           =   2775
  49.       End
  50.       Begin VB.CheckBox chkExtraFileTimes 
  51.          Caption         =   "All time stamps (PKWare data format)"
  52.          Height          =   255
  53.          Left            =   120
  54.          TabIndex        =   7
  55.          Top             =   480
  56.          Width           =   3015
  57.       End
  58.       Begin VB.CheckBox chkExtraExtTimeStamp 
  59.          Caption         =   "All time stamps (Info-Zip data format)"
  60.          Height          =   255
  61.          Left            =   120
  62.          TabIndex        =   6
  63.          Top             =   240
  64.          Width           =   3495
  65.       End
  66.    End
  67.    Begin VB.Frame fraTempFolder 
  68.       Caption         =   "Temporary files"
  69.       BeginProperty Font 
  70.          Name            =   "MS Sans Serif"
  71.          Size            =   8.25
  72.          Charset         =   0
  73.          Weight          =   700
  74.          Underline       =   0   'False
  75.          Italic          =   0   'False
  76.          Strikethrough   =   0   'False
  77.       EndProperty
  78.       Height          =   1050
  79.       Left            =   120
  80.       TabIndex        =   13
  81.       Top             =   1350
  82.       Width           =   4335
  83.       Begin VB.CheckBox chkUseTempFolder 
  84.          Caption         =   "Work with temporary zip files for maximum safety"
  85.          Height          =   255
  86.          Left            =   120
  87.          TabIndex        =   3
  88.          Top             =   240
  89.          Width           =   3975
  90.       End
  91.       Begin VB.TextBox txtTempFolder 
  92.          BackColor       =   &H80000004&
  93.          Enabled         =   0   'False
  94.          Height          =   285
  95.          Left            =   120
  96.          TabIndex        =   4
  97.          ToolTipText     =   "If no path is specified, the default Windows temp directory will be used."
  98.          Top             =   600
  99.          Width           =   3135
  100.       End
  101.       Begin VB.CommandButton cmdBrowseTempFolder 
  102.          Caption         =   "&Browse"
  103.          Enabled         =   0   'False
  104.          Height          =   285
  105.          Left            =   3360
  106.          TabIndex        =   5
  107.          Top             =   600
  108.          Width           =   855
  109.       End
  110.    End
  111.    Begin VB.Frame fraDiskSpanning 
  112.       Caption         =   "If the disk gets full, span disks..."
  113.       BeginProperty Font 
  114.          Name            =   "MS Sans Serif"
  115.          Size            =   8.25
  116.          Charset         =   0
  117.          Weight          =   700
  118.          Underline       =   0   'False
  119.          Italic          =   0   'False
  120.          Strikethrough   =   0   'False
  121.       EndProperty
  122.       Height          =   1095
  123.       Left            =   120
  124.       TabIndex        =   12
  125.       Top             =   120
  126.       Width           =   4335
  127.       Begin VB.OptionButton optNever 
  128.          Caption         =   "Never"
  129.          Height          =   255
  130.          Left            =   120
  131.          TabIndex        =   2
  132.          Top             =   720
  133.          Width           =   1935
  134.       End
  135.       Begin VB.OptionButton optAlways 
  136.          Caption         =   "Always"
  137.          Height          =   255
  138.          Left            =   120
  139.          TabIndex        =   1
  140.          Top             =   480
  141.          Width           =   1935
  142.       End
  143.       Begin VB.OptionButton optRemovableDrives 
  144.          Caption         =   "Only when writing to removable media"
  145.          Height          =   255
  146.          Left            =   120
  147.          TabIndex        =   0
  148.          Top             =   240
  149.          Width           =   3255
  150.       End
  151.    End
  152.    Begin VB.CommandButton cmdOk 
  153.       Caption         =   "&OK"
  154.       Height          =   375
  155.       Left            =   2160
  156.       TabIndex        =   10
  157.       Top             =   3990
  158.       Width           =   1095
  159.    End
  160.    Begin VB.CommandButton cmdCancel 
  161.       Cancel          =   -1  'True
  162.       Caption         =   "&Cancel"
  163.       Height          =   375
  164.       Left            =   3360
  165.       TabIndex        =   11
  166.       Top             =   3990
  167.       Width           =   1095
  168.    End
  169. Attribute VB_Name = "frmOptions"
  170. Attribute VB_GlobalNameSpace = False
  171. Attribute VB_Creatable = False
  172. Attribute VB_PredeclaredId = True
  173. Attribute VB_Exposed = False
  174. Option Explicit
  175. '=============================================================================
  176. ' Description: The frmOptions form allows the user to set some of the
  177. '              more advanced Xceed Zip's settings:
  178. '              - Disk spanning options
  179. '              - Use of temp files
  180. '              - Which extra headers and file information is stored
  181. '=============================================================================
  182. '------------------------------------------------------------------------------------
  183. 'Calls data loading functions
  184. '------------------------------------------------------------------------------------
  185. Private Sub LoadDataToForm(xZip As XceedZip)
  186.     Call LoadDiskSpanningSettings(xZip)
  187.     Call LoadTempFolderSettings(xZip)
  188.     Call LoadExtraHeadersSettings(xZip)
  189. End Sub
  190. '------------------------------------------------------------------------------------
  191. ' Loads the Option button corresponding to xZip's Span mode
  192. '------------------------------------------------------------------------------------
  193. Private Sub LoadDiskSpanningSettings(xZip As XceedZip)
  194.     optAlways.Value = (xZip.SpanMultipleDisks = xdsAlways)
  195.     optNever.Value = (xZip.SpanMultipleDisks = xdsNever)
  196.     optRemovableDrives.Value = (xZip.SpanMultipleDisks = xdsRemovableDrivesOnly)
  197. End Sub
  198. '------------------------------------------------------------------------------------
  199. 'Loads the Extra Hearder Settings from the xZip object into the forms controls
  200. '------------------------------------------------------------------------------------
  201. Private Sub LoadExtraHeadersSettings(xZip As XceedZip)
  202.     If (xZip.ExtraHeaders And xehExtTimeStamp) Then
  203.         chkExtraExtTimeStamp.Value = Checked
  204.     Else
  205.         chkExtraExtTimeStamp.Value = Unchecked
  206.     End If
  207.     If (xZip.ExtraHeaders And xehFileTimes) Then
  208.         chkExtraFileTimes.Value = Checked
  209.     Else
  210.         chkExtraFileTimes.Value = Unchecked
  211.     End If
  212.     If (xZip.ExtraHeaders And xehSecurityDescriptor) Then
  213.         chkExtraSecurityDsc.Value = Checked
  214.     Else
  215.         chkExtraSecurityDsc.Value = Unchecked
  216.     End If
  217.     If (xZip.ExtraHeaders And xehUnicode) Then
  218.         chkExtraUnicode.Value = Checked
  219.     Else
  220.         chkExtraUnicode.Value = Unchecked
  221.     End If
  222. End Sub
  223. '------------------------------------------------------------------------------------
  224. ' Grays the temp folder textbox if the "work with temp files" checkbox is unchecked
  225. '------------------------------------------------------------------------------------
  226. Private Sub LoadTempFolderColor()
  227.     If txtTempFolder.Enabled Then
  228.        txtTempFolder.BackColor = &H80000005
  229.     Else
  230.        txtTempFolder.BackColor = &H8000000F
  231.     End If
  232. End Sub
  233. '------------------------------------------------------------------------------------
  234. ' Loads the temp folder settings. The default windows temporary folder is used if
  235. ' no particular folder is specified.
  236. '------------------------------------------------------------------------------------
  237. Private Sub LoadTempFolderSettings(xZip As XceedZip)
  238.     chkUseTempFolder.Value = IIf(xZip.UseTempFile, vbChecked, vbUnchecked)
  239.     cmdBrowseTempFolder.Enabled = IIf(xZip.UseTempFile, vbChecked, vbUnchecked)
  240.     txtTempFolder.Text = xZip.TempFolder
  241.     Call LoadTempFolderColor
  242. End Sub
  243. '------------------------------------------------------------------------------------
  244. ' Shows the Options window
  245. '------------------------------------------------------------------------------------
  246. Public Function ShowForm(xZip As XceedZip) As Boolean
  247.     frmOptions.Tag = "0"
  248.     'Load xZip's properties into the form's controls.
  249.     Call LoadDataToForm(xZip)
  250.     'Shows the Options form
  251.     frmOptions.Show vbModal
  252.     ' If tag = "1" then the user clicked on Ok and the form's controls
  253.     ' values are copied in the xZip properties
  254.     If frmOptions.Tag = "1" Then
  255.         Call UpdatexZipSettings(xZip)
  256.     End If
  257.     ShowForm = (frmOptions.Tag = "1")
  258. End Function
  259. '------------------------------------------------------------------------------------
  260. ' Updates xZip's Disk Spanning mode according to the user's
  261. ' choice.
  262. '------------------------------------------------------------------------------------
  263. Private Sub UpdateDiskSpanningSettings(xZip As XceedZip)
  264.     If optAlways Then xZip.SpanMultipleDisks = xdsAlways
  265.     If optNever Then xZip.SpanMultipleDisks = xdsNever
  266.     If optRemovableDrives Then xZip.SpanMultipleDisks = xdsRemovableDrivesOnly
  267. End Sub
  268. '------------------------------------------------------------------------------------
  269. 'Updates xZip's Extra Headers properties based on the data in the
  270. 'form's controls / checkboxes
  271. '------------------------------------------------------------------------------------
  272. Private Sub UpdateExtraHeadersSettings(xZip As XceedZip)
  273.     xZip.ExtraHeaders = 0
  274.     If chkExtraExtTimeStamp.Value = Checked Then
  275.         xZip.ExtraHeaders = xZip.ExtraHeaders + xehExtTimeStamp
  276.     End If
  277.     If chkExtraFileTimes.Value = Checked Then
  278.         xZip.ExtraHeaders = xZip.ExtraHeaders + xehFileTimes
  279.     End If
  280.     If chkExtraSecurityDsc.Value = Checked Then
  281.         xZip.ExtraHeaders = xZip.ExtraHeaders + xehSecurityDescriptor
  282.     End If
  283.     If chkExtraUnicode.Value = Checked Then
  284.         xZip.ExtraHeaders = xZip.ExtraHeaders + xehUnicode
  285.     End If
  286. End Sub
  287. '------------------------------------------------------------------------------------
  288. ' Updates xZip's Temp file / folder settings based on the settings
  289. ' indicated by the form's controls.
  290. '------------------------------------------------------------------------------------
  291. Private Sub UpdateTempFolderSettings(xZip As XceedZip)
  292.     xZip.UseTempFile = (chkUseTempFolder.Value = vbChecked)
  293.     xZip.TempFolder = txtTempFolder.Text
  294. End Sub
  295. '------------------------------------------------------------------------------------
  296. ' Calls updating functions
  297. '------------------------------------------------------------------------------------
  298. Private Sub UpdatexZipSettings(xZip As XceedZip)
  299.      Call UpdateDiskSpanningSettings(xZip)
  300.      Call UpdateTempFolderSettings(xZip)
  301.      Call UpdateExtraHeadersSettings(xZip)
  302. End Sub
  303. '------------------------------------------------------------------------------------
  304. ' If the browse button is clicked, the default directory window is shown.
  305. '------------------------------------------------------------------------------------
  306. Private Sub cmdBrowseTempFolder_Click()
  307.     Dim PathName As String
  308.     If BrowseForFolder(PathName, "Please select the temp directory") Then
  309.         txtTempFolder.Text = PathName
  310.     End If
  311. End Sub
  312. '------------------------------------------------------------------------------------
  313. 'Enables or disables the tempfolder textbox.
  314. '------------------------------------------------------------------------------------
  315. Private Sub chkUseTempFolder_Click()
  316.     txtTempFolder.Enabled = Not txtTempFolder.Enabled
  317.     'Enables or disables the browse button
  318.     cmdBrowseTempFolder.Enabled = Not cmdBrowseTempFolder.Enabled
  319.     Call LoadTempFolderColor
  320. End Sub
  321. '------------------------------------------------------------------------------------
  322. ' If Cancel is pressed, tag stays at "0" and the window is hidden
  323. '------------------------------------------------------------------------------------
  324. Private Sub cmdCancel_Click()
  325.     Me.Hide
  326. End Sub
  327. '------------------------------------------------------------------------------------
  328. ' If OK is pressed, the window is hidden and Tag receives the "1" value
  329. '------------------------------------------------------------------------------------
  330. Private Sub cmdOk_Click()
  331.     Tag = "1"
  332.     Me.Hide
  333. End Sub
  334.