home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 31
/
CDASC_31_1996_juillet_aout.iso
/
index
/
source
/
option.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-05-03
|
5KB
|
198 lines
unit Option;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, TabNotBk, StdCtrls, Buttons, ExtCtrls, FileCtrl, ComCtrls;
type
TOptionForm = class(TForm)
Onglet: TTabbedNotebook;
ListBox: TListBox;
FileList: TFileListBox;
DirectoryList: TDirectoryListBox;
DriveBox: TDriveComboBox;
AjouteBtn: TButton;
SupBtn: TButton;
OkBtn: TButton;
GroupBox1: TGroupBox;
GroupBox3: TGroupBox;
Ok2Btn: TButton;
AnnuleBtn: TButton;
RepEdit: TEdit;
ParcoursBtn: TButton;
TotalCheck: TCheckBox;
DifCheck: TCheckBox;
AnnexeCheck: TCheckBox;
Bevel1: TBevel;
Annule2Btn: TButton;
procedure DriveBoxChange(Sender: TObject);
procedure DirectoryListChange(Sender: TObject);
procedure AjouteBtnClick(Sender: TObject);
procedure SupBtnClick(Sender: TObject);
procedure OkBtnClick(Sender: TObject);
procedure Ok2BtnClick(Sender: TObject);
procedure AnnuleBtnClick(Sender: TObject);
procedure ParcoursBtnClick(Sender: TObject);
procedure Annule2BtnClick(Sender: TObject);
procedure FileListDblClick(Sender: TObject);
procedure ListBoxDblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
OptionForm: TOptionForm;
implementation
{$R *.DFM}
uses main, directo ;
{ Lorsque l'on ajoute un fichier dans la liste des fichiers annexes, il serait prΘfΘrable de ne
pas mettre deux fois le mΩme fichier. Il faut tout prΘvoir avec des utilisateurs imprudents. }
procedure ElimineDoublons ;
var i, j : integer ;
begin
i := 0 ;
while i < OptionForm. ListBox. Items. Count do
begin
j := 0 ;
while j < OptionForm. ListBox. Items. Count do
begin
if (OptionForm. ListBox. Items[j] = OptionForm. ListBox. Items[i]) and
(i<>j) then
OptionForm. ListBox. Items. Delete(j) ;
inc(j) ;
end ;
inc(i) ;
end ;
end ;
procedure ajouter ;
var i : integer ;
begin
for i := 0 to OptionForm.FileList. Items. Count - 1 do
if OptionForm.FileList. Selected[i] then
OptionForm.ListBox. Items. Add(OptionForm.DirectoryList. Directory+'\'+OptionForm.FileList. Items[i]) ;
ElimineDoublons ;
end;
procedure supprimer ;
var i : integer ;
begin
i := OptionForm.ListBox. Items. Count - 1 ;
While i >= 0 do
begin
if OptionForm.ListBox. Selected[i] then
OptionForm.ListBox. Items. Delete(i) ;
Dec(i) ;
end ;
end;
{ Cette procΘdure transfert toutes les informations contenues dans la boεte de
dialogue vers la configuration courante. }
procedure SauvegardeConfiguration ;
var i : Integer ;
begin
with Configuration do
begin
RepertoireDefaut := OptionForm. RepEdit. Text;
IgnoreMAJmin := OptionForm. DifCheck. Checked;
ChargeTotal := OptionForm. TotalCheck. Checked;
AnnexeDAbord := OptionForm. AnnexeCheck. Checked;
Fichiers. Clear ;
for i := 0 to OptionForm. ListBox. Items. Count - 1 do
Fichiers. Add(OptionForm. ListBox. Items[i]) ;
end ;
end ;
procedure TOptionForm.DriveBoxChange(Sender: TObject);
begin
DirectoryList. Drive := DriveBox. Drive ;
end;
procedure TOptionForm.DirectoryListChange(Sender: TObject);
begin
FileList. Directory := DirectoryList. Directory ;
end;
procedure TOptionForm.AjouteBtnClick(Sender: TObject);
begin
ajouter ;
end ;
procedure TOptionForm.SupBtnClick(Sender: TObject);
begin
supprimer ;
end ;
procedure TOptionForm.OkBtnClick(Sender: TObject);
begin
SauvegardeConfiguration ;
Close ;
end;
procedure TOptionForm.Ok2BtnClick(Sender: TObject);
begin
SauvegardeConfiguration ;
Close ;
end;
procedure TOptionForm.AnnuleBtnClick(Sender: TObject);
begin
Close ;
end;
procedure TOptionForm.ParcoursBtnClick(Sender: TObject);
begin
RepForm. DirectoryBox. Directory := RepEdit. Text ;
RepForm. ShowModal ;
if RepForm. ModalResult = 1 then
RepEdit. Text := RepForm. DirectoryBox. Directory ;
end;
procedure TOptionForm.Annule2BtnClick(Sender: TObject);
begin
Close ;
end;
procedure TOptionForm.FileListDblClick(Sender: TObject);
begin
ajouter ;
end;
procedure TOptionForm.ListBoxDblClick(Sender: TObject);
begin
Supprimer ;
end;
end.