ject; Index: Integer;
var TabWidth: Integer);
var
BitmapWidth: Integer;
begin
BitmapWidth := TBitmap(DriveTabSet.Tabs.Objects[Index]).Width;
Inc(TabWidth, 2 + BitmapWidth);
end;
procedure TFMForm.DriveTabSetDrawTab(Sender: TObject; TabCanvas: TCanvas;
R: TRect; Index: Integer; Selected: Boolean);
var
Bitmap: TBitmap;
begin
Bitmap := TBitmap(DriveTabSet.Tabs.Objects[Index]);
with TabCanvas do
begin
Draw(R.Left, R.Top + 4, Bitmap);
TextOut(R.Left + 2 + Bitmap.Width, R.Top + 2, DriveTabSet.Tabs[Index]);
end;
end;
procedure TFMForm.File1Click(Sender: TObject);
var
FileSelected: Boolean;
begin
FileSelected := FileList.ItemIndex >= 0;
Open1.Enabled := FileSelected;
Delete1.Enabled := FileSelected;
Copy1.Enabled := FileSelected;
Move1.Enabled := FileSelected;
Rename1.Enabled := FileSelected;
Properties1.Enabled := FileSelected;
end;
procedure TFMForm.Delete1Click(Sender: TObject);
begin
with FileList do
if MessageDlg('Delete ' + FileName + '?', mtConfirmation,
[mbYes, mbNo], 0) = mrYes then
if DeleteFile(FileName) then Update;
end;
procedure TFMForm.Properties1Click(Sender: TObject);
var
Attributes, NewAttributes: Word;
begin
with FileAttrForm do
begin
FileDirName.Caption := FileList.Items[FileList.ItemIndex];
FilePathName.Caption := FileList.Directory;
ChangeDate.Caption := DateTimeToStr(FileDateTime(FileList.FileName));
Attributes := FileGetAttr(FileDirName.Caption);
ReadOnly.Checked := (Attributes and faReadOnly) = faReadOnly;
Archive.Checked := (Attributes and faArchive) = faArchive;
System.Checked := (Attributes and faSysFile) = faSysFile;
Hidden.Checked := (Attributes and faHidden) = faHidden;
if ShowModal <> mrCancel then
begin
NewAttributes := Attributes;
if ReadOnly.Checked then NewAttributes := NewAttributes or faReadOnly
else NewAttributes := NewAttributes and not faReadOnly;
if Archive.Checked then NewAttributes := NewAttributes or faArchive
else NewAttributes := NewAttributes and not faArchive;
if System.Checked then NewAttributes := NewAttributes or faSysFile
else NewAttributes := NewAttributes and not faSysFile;
if Hidden.Checked then NewAttributes := NewAttributes or faHidden
else NewAttributes := NewAttributes and not faHidden;
if NewAttributes <> Attributes then
FileSetAttr(FileDirName.Caption, NewAttributes);
end;
end;
end;
procedure TFMForm.ConfirmChange(const ACaption, FromFile, ToFile: string);
begin
if MessageDlg(Format('%s %s to %s?', [ACaption, FromFile, ToFile]),
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
if ACaption = 'Move' then
MoveFile(FromFile, ToFile)
else if ACaption = 'Copy' then
CopyFile(FromFile, ToFile)
else if ACaption = 'Rename' then
RenameFile(FromFile, ToFile);
FileList.Update;
end;
end;
procedure TFMForm.FileChange(Sender: TObject);
begin
with ChangeDlg do
begin
if Sender = Move1 then Caption := 'Move'
else if Sender = Copy1 then Caption := 'Copy'
else if Sender = Rename1 then Caption := 'Rename'
else Exit;
CurrentDir.Caption := DirectoryOutline.Directory;
FromFileName.Text := FileList.FileName;
ToFileName.Text := '';
if (ShowModal <> mrCancel) and (ToFileName.Text <> '') then
ConfirmChange(Caption, FromFileName.Text, ToFileName.Text);
end;
end;
procedure TFMForm.Open1Click(Sender: TObject);
begin
with FileList do
begin
if HasAttr(FileName, faDirectory) then
DirectoryOutline.Directory := FileName
else ExecuteFile(FileName, '', Directory, SW_SHOW);
end;
end;
procedure TFMForm.FileListMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
with Sender as TFileListBox do
begin
if ItemAtPos(Point(X, Y), True) >= 0 then
BeginDrag(False);
end;
end;
procedure TFMForm.DirectoryOutlineDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
Accept := (Source is TFileListBo