home *** CD-ROM | disk | FTP | other *** search
/ PC Open 19 / pcopen19.iso / Zipped / CALMIR21.ZIP / SOURCE.ZIP / SRC / FSYSPROP.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-02-20  |  6.7 KB  |  213 lines

  1. {**************************************************************************}
  2. {                                                                          }
  3. {    Calmira shell for Microsoft« Windows(TM) 3.1                          }
  4. {    Source Release 2.1                                                    }
  5. {    Copyright (C) 1997-1998 Li-Hsin Huang                                 }
  6. {                                                                          }
  7. {    This program is free software; you can redistribute it and/or modify  }
  8. {    it under the terms of the GNU General Public License as published by  }
  9. {    the Free Software Foundation; either version 2 of the License, or     }
  10. {    (at your option) any later version.                                   }
  11. {                                                                          }
  12. {    This program is distributed in the hope that it will be useful,       }
  13. {    but WITHOUT ANY WARRANTY; without even the implied warranty of        }
  14. {    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         }
  15. {    GNU General Public License for more details.                          }
  16. {                                                                          }
  17. {    You should have received a copy of the GNU General Public License     }
  18. {    along with this program; if not, write to the Free Software           }
  19. {    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.             }
  20. {                                                                          }
  21. {**************************************************************************}
  22.  
  23. unit Fsysprop;
  24.  
  25. interface
  26.  
  27. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, Buttons,
  28.   StdCtrls, ExtCtrls, Chklist, TabNotBk, Dialogs, Settings;
  29.  
  30. type
  31.   TFileSysPropDlg = class(TForm)
  32.     OKBtn: TBitBtn;
  33.     CancelBtn: TBitBtn;
  34.     Notebook: TTabbedNotebook;
  35.     Sorting: TRadioGroup;
  36.     rbDOSFilenames: TRadioButton;
  37.     Bevel1: TBevel;
  38.     rb4DOSDesc: TRadioButton;
  39.     Label8: TLabel;
  40.     IconEdit: TEdit;
  41.     DescPanel: TPanel;
  42.     cbDescCaptions: TCheckBox;
  43.     cbSimul4DOS: TCheckBox;
  44.     Bevel2: TBevel;
  45.     cbFileHints: TCheckBox;
  46.     Label2: TLabel;
  47.     sbDelay: TScrollBar;
  48.     Label3: TLabel;
  49.     Label4: TLabel;
  50.     Label5: TLabel;
  51.     Label6: TLabel;
  52.     ConfirmList: TCheckList;
  53.     Label7: TLabel;
  54.     MiscList: TCheckList;
  55.     Label9: TLabel;
  56.     Label10: TLabel;
  57.     FilterEdit: TEdit;
  58.     Label11: TLabel;
  59.     Bevel3: TBevel;
  60.     Bevel4: TBevel;
  61.     InspectEdit: TEdit;
  62.     DefaultEdit: TEdit;
  63.     UndelEdit: TEdit;
  64.     DiskEdit: TEdit;
  65.     Label13: TLabel;
  66.     Label14: TLabel;
  67.     Label15: TLabel;
  68.     Label16: TLabel;
  69.     Label17: TLabel;
  70.     OpenDialog: TOpenDialog;
  71.     HelpBtn: TBitBtn;
  72.     Contents: TRadioGroup;
  73.     procedure FormCreate(Sender: TObject);
  74.     procedure OKBtnClick(Sender: TObject);
  75.     procedure rb4DOSDescClick(Sender: TObject);
  76.     procedure InspectEditDblClick(Sender: TObject);
  77.     procedure NotebookChange(Sender: TObject; NewTab: Integer;
  78.       var AllowChange: Boolean);
  79.   private
  80.     { Private declarations }
  81.     Changes : TSettingChanges;
  82.   public
  83.     { Public declarations }
  84.   end;
  85.  
  86. {
  87. var
  88.   FileSysPropDlg: TFileSysPropDlg;
  89. }
  90.  
  91. implementation
  92.  
  93. uses Strings, SysUtils, Tree, MiscUtil;
  94.  
  95. {$R *.DFM}
  96.  
  97. procedure TFileSysPropDlg.FormCreate(Sender: TObject);
  98. begin
  99.   Changes := [scFileSystem];
  100.   Notebook.PageIndex := 0;
  101.  
  102.   { General }
  103.   Contents.ItemIndex := Integer(DefaultDisplay);
  104.   Sorting.ItemIndex := Integer(DefaultSort);
  105.   IconEdit.Text := Trim(IconStrings);
  106.   FilterEdit.Text := DefaultFilter;
  107.  
  108.   { Details }
  109.   cbFileHints.Checked := FileHints;
  110.   sbDelay.Position := HintDelay;
  111.   rbDOSFilenames.Checked := not UseDescriptions;
  112.   rb4DOSDesc.Checked := UseDescriptions;
  113.   cbSimul4DOS.Checked := Simul4DOS;
  114.   cbDescCaptions.Checked := DescCaptions;
  115.  
  116.   { Options }
  117.   ConfirmList.SetData(
  118.     [ConfirmCopyStart, ConfirmMoveStart, ConfirmDelStart,
  119.      ConfirmCopyFile, ConfirmMoveFile, ConfirmDelFile,
  120.      ConfirmReplace, ConfirmProtect, ConfirmCopyFolder,
  121.      ConfirmMoveFolder, ConfirmDelFolder, ConfirmNewAlias]);
  122.  
  123.   MiscList.SetData(
  124.     [ShortWinCaptions, ShowHidSys, MiniIcons,
  125.      UpcaseFirstChar, NoRegExtensions, ProgDrop,
  126.      FindDlgIcons, AliasArrows,
  127.      DefDragCopy, HintDesc, HintBytes, HintDate, HintTime, HintAttrib,
  128.      fdSize in DefaultColumns, fdDate in DefaultColumns,
  129.      fdTime in DefaultColumns, fdAttr in DefaultColumns,
  130.      fdDesc in DefaultColumns]);
  131.  
  132.   { Utilities }
  133.   InspectEdit.Text := InspectProg;
  134.   DefaultEdit.Text := DefaultProg;
  135.   UndelEdit.Text := UndeleteProg;
  136.   DiskEdit.Text := DiskProg;
  137. end;
  138.  
  139.  
  140.  
  141. procedure TFileSysPropDlg.OKBtnClick(Sender: TObject);
  142. var
  143.   i: Integer;
  144.   b: array[0..4] of Boolean;
  145. begin
  146.   { General }
  147.   DefaultDisplay := TDisplayMode(Contents.ItemIndex);
  148.   DefaultSort := TSortOrder(Sorting.ItemIndex);
  149.   IconStrings := ' ' + Trim(Lowercase(IconEdit.Text)) + ' ';
  150.   DefaultFilter := RemoveSpaces(FilterEdit.Text);
  151.  
  152.   { Details }
  153.  
  154.   FileHints := cbFileHints.Checked;
  155.   HintDelay := sbDelay.Position;
  156.   UseDescriptions := rb4DOSDesc.Checked;
  157.   DescCaptions := cbDescCaptions.Checked;
  158.   Simul4DOS := cbSimul4DOS.Checked;
  159.  
  160.   { Options }
  161.   ConfirmList.GetData(
  162.     [@ConfirmCopyStart, @ConfirmMoveStart, @ConfirmDelStart,
  163.      @ConfirmCopyFile, @ConfirmMoveFile, @ConfirmDelFile,
  164.      @ConfirmReplace, @ConfirmProtect, @ConfirmCopyFolder,
  165.      @ConfirmMoveFolder, @ConfirmDelFolder, @ConfirmNewAlias]);
  166.  
  167.   MiscList.GetData(
  168.     [@ShortWinCaptions, @ShowHidSys, @MiniIcons,
  169.      @UpcaseFirstChar, @NoRegExtensions, @ProgDrop,
  170.      @FindDlgIcons, @AliasArrows,
  171.      @DefDragCopy, @HintDesc, @HintBytes, @HintDate, @HintTime, @HintAttrib,
  172.      @b[0], @b[1], @b[2], @b[3], @b[4]]);
  173.  
  174.   DefaultColumns := [];
  175.   for i := 0 to 4 do
  176.     if b[i] then Include(DefaultColumns, TFileDetail(i));
  177.  
  178.   InspectProg := InspectEdit.Text;
  179.   DefaultProg := DefaultEdit.Text;
  180.   UndeleteProg := UndelEdit.Text;
  181.   DiskProg := DiskEdit.Text;
  182.  
  183.   SaveFileSysProp;
  184.   AnnounceSettingsChanged(Changes);
  185. end;
  186.  
  187.  
  188.  
  189. procedure TFileSysPropDlg.rb4DOSDescClick(Sender: TObject);
  190. const
  191.   FontColors : array[Boolean] of TColor = (clGray, clBlack);
  192. begin
  193.   DescPanel.Enabled := rb4DOSDesc.Checked;
  194.   DescPanel.Font.Color := FontColors[rb4DOSDesc.Checked];
  195.   if Showing then Include(Changes, sc4DOS);
  196. end;
  197.  
  198.  
  199. procedure TFileSysPropDlg.InspectEditDblClick(Sender: TObject);
  200. begin
  201.   if OpenDialog.Execute then
  202.     (Sender as TEdit).Text := Lowercase(OpenDialog.Filename);
  203. end;
  204.  
  205.  
  206. procedure TFileSysPropDlg.NotebookChange(Sender: TObject; NewTab: Integer;
  207.   var AllowChange: Boolean);
  208. begin
  209.   FreePageHandles(Notebook);
  210. end;
  211.  
  212. end.
  213.