home *** CD-ROM | disk | FTP | other *** search
/ PC Open 19 / pcopen19.iso / Zipped / CALMIR21.ZIP / SOURCE.ZIP / SRC / BINPROP.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-02-20  |  4.0 KB  |  124 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 Binprop;
  24.  
  25. interface
  26.  
  27. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, Buttons,
  28.   StdCtrls, Spin, TabNotBk, ExtCtrls, Chklist;
  29.  
  30. type
  31.   TBinPropDlg = class(TForm)
  32.     OKBtn: TBitBtn;
  33.     CancelBtn: TBitBtn;
  34.     Notebook: TTabbedNotebook;
  35.     Label2: TLabel;
  36.     CapEdit: TEdit;
  37.     HelpBtn: TBitBtn;
  38.     cbIcons: TCheckBox;
  39.     Bevel1: TBevel;
  40.     Label4: TLabel;
  41.     rbUseBin: TRadioButton;
  42.     rbDelete: TRadioButton;
  43.     TrashPanel: TPanel;
  44.     rbLeave: TRadioButton;
  45.     rbEmpty: TRadioButton;
  46.     rbCollect: TRadioButton;
  47.     cbDeleteToBin: TCheckBox;
  48.     SizeEdit: TSpinEdit;
  49.     Label1: TLabel;
  50.     Bevel2: TBevel;
  51.     Label3: TLabel;
  52.     procedure rbCollectClick(Sender: TObject);
  53.     procedure FormCreate(Sender: TObject);
  54.     procedure OKBtnClick(Sender: TObject);
  55.     procedure rbUseBinClick(Sender: TObject);
  56.   private
  57.     { Private declarations }
  58.   public
  59.     { Public declarations }
  60.   end;
  61.  
  62. {
  63. var
  64.   BinPropDlg: TBinPropDlg;
  65. }
  66.  
  67. implementation
  68.  
  69. uses WasteBin, MiscUtil, Settings;
  70.  
  71. {$R *.DFM}
  72.  
  73. procedure TBinPropDlg.rbCollectClick(Sender: TObject);
  74. begin
  75.   SizeEdit.Enabled := rbCollect.Checked;
  76. end;
  77.  
  78. procedure TBinPropDlg.FormCreate(Sender: TObject);
  79. begin
  80.   Notebook.PageIndex := 0;
  81.   CapEdit.Text := BinCaption;
  82.  
  83.   if BinAction = baDelete then rbDelete.Checked := True
  84.   else begin
  85.     rbUseBin.Checked := True;
  86.     case BinAction of
  87.       baLeave   : rbLeave.Checked := True;
  88.       baEmpty   : rbEmpty.Checked := True;
  89.       baCollect : rbCollect.Checked := True;
  90.     end;
  91.   end;
  92.  
  93.   SizeEdit.Value := BinCapacity;
  94.   cbDeleteToBin.Checked := DeleteToBin;
  95.   cbIcons.Checked := BinIcons;
  96. end;
  97.  
  98. procedure TBinPropDlg.OKBtnClick(Sender: TObject);
  99. const
  100.   Actions : array[0..2] of TBinAction = (baLeave, baEmpty, baCollect);
  101. begin
  102.   BinCaption := CapEdit.Text;
  103.   if rbDelete.Checked then BinAction := baDelete
  104.   else BinAction := Actions[GetRadioIndex([rbLeave, rbEmpty, rbCollect])];
  105.   BinCapacity := SizeEdit.Value;
  106.   DeleteToBin := cbDeleteToBin.Checked;
  107.   BinIcons := cbIcons.Checked;
  108.   SaveBinProp;
  109.   Bin.Configure;
  110.   AnnounceSettingsChanged([scBin]);
  111. end;
  112.  
  113.  
  114.  
  115. procedure TBinPropDlg.rbUseBinClick(Sender: TObject);
  116. const
  117.   TextColours : array[Boolean] of TColor = (clGray, clBlack);
  118. begin
  119.   TrashPanel.Enabled := rbUseBin.Checked;
  120.   TrashPanel.Font.Color := TextColours[rbUseBin.Checked];
  121. end;
  122.  
  123. end.
  124.