/
YakuninAV
/
Convertors
Обзор
Документация
Войти
/
YakuninAV
/
Convertors
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Core/dbdImpExpMonitorForm.pas
182 строки
5 KB
YakuninAV
begin with gitflick
31 июл 2026, 15:21
31 июл 2026, 15:21
1dc0fc6
Код
Авторство
О чём код?
unit dbdImpExpMonitorForm; interface uses {$IFDEF ISDELPHIXE2} Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls {$ELSE} Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls {$ENDIF} ; type TdbdMonitorForm = class(TForm) pbImpOrExp: TProgressBar; lChar: TLabel; lblFileName: TLabel; lblFiles: TLabel; private FActiveFile: TFileName; FCount: Integer; FPosNo: Integer; FCharNo: Integer; FFilesCount: Integer; FCurFileNo: Integer; procedure SetActiveFile(const Value: TFileName); procedure SetCount(const Value: Integer); procedure SetPosNo(const Value: Integer); { Private declarations } procedure ShowChar; procedure SetCharNo(const Value: Integer); procedure SetFilesCount(const Value: Integer); public { Public declarations } property ActiveFile: TFileName read FActiveFile write SetActiveFile; property Count: Integer read FCount write SetCount; property FilesCount: Integer read FFilesCount write SetFilesCount; property PosNo: Integer read FPosNo write SetPosNo; property CharNo: Integer read FCharNo write SetCharNo; end; var dbdMonitorForm: TdbdMonitorForm; procedure ShowImpExpMonitor(const ACaption: string; const AFileName: TFileName); procedure CloseImpExpMonitor; /// установить количество обрабатываемых файлов procedure SetFilesCountImpExpMonitor(const ACount: Integer=1); /// переход к следующему файлу procedure NextFileImpExpMonitor(const AFileName: TFileName); /// переход к следующему куску (неизвестно количество позиций =0) procedure NextChunkImpExpMonitor; /// установить количиство позиций procedure SetCountImpExpMonitor(const ACount: Integer); /// установить текущую позицию (в случае отображения не каждой позиции) procedure SetPosNoImpExpMonitor(const APosNo: Integer); /// переход к следующей позиции procedure NextPositionImpExpMonitor; implementation const Chars: array[0..3] of Char = ('|','/','-','\'); {$R *.dfm} procedure ShowImpExpMonitor(const ACaption: string; const AFileName: TFileName); begin dbdMonitorForm:=TdbdMonitorForm.Create(nil); dbdMonitorForm.Caption:=ACaption; dbdMonitorForm.lblFileName.Caption:=AFileName; dbdMonitorForm.FilesCount:=1; dbdMonitorForm.Count:=0; dbdMonitorForm.PosNo:=0; dbdMonitorForm.Show; end; procedure CloseImpExpMonitor; begin dbdMonitorForm.Hide; dbdMonitorForm.Close; FreeAndNil(dbdMonitorForm); end; procedure NextFileImpExpMonitor(const AFileName: TFileName); begin if dbdMonitorForm<>nil then begin dbdMonitorForm.ActiveFile:=AFileName; end; end; procedure NextPositionImpExpMonitor; begin if dbdMonitorForm<>nil then begin dbdMonitorForm.PosNo:=dbdMonitorForm.PosNo+1; end; end; procedure NextChunkImpExpMonitor; begin if dbdMonitorForm<>nil then begin dbdMonitorForm.CharNo:=dbdMonitorForm.CharNo+1; end; end; procedure SetFilesCountImpExpMonitor(const ACount: Integer); begin if dbdMonitorForm<>nil then begin dbdMonitorForm.FilesCount:=ACount; end; end; procedure SetCountImpExpMonitor(const ACount: Integer); begin if dbdMonitorForm<>nil then begin dbdMonitorForm.Count:=ACount; dbdMonitorForm.PosNo:=0; end; end; procedure SetPosNoImpExpMonitor(const APosNo: Integer); begin if dbdMonitorForm<>nil then begin dbdMonitorForm.PosNo:=APosNo; end; end; { TdbdMonitorForm } procedure TdbdMonitorForm.SetActiveFile(const Value: TFileName); begin FActiveFile := Value; lblFileName.Caption:=Value; Inc(FCurFileNo); FCharNo:=0; lblFiles.Caption:='Файлов' + IntToStr(FCurFileNo) + ' из ' + IntToStr(FFilesCount); end; procedure TdbdMonitorForm.SetCharNo(const Value: Integer); begin FCharNo := (Value mod 4); ShowChar; end; procedure TdbdMonitorForm.SetCount(const Value: Integer); begin FCount := Value; if FCount<0 then FCount:=0; pbImpOrExp.Max:=Value; pbImpOrExp.Position:=0; pbImpOrExp.Visible:=(FCount>0); lChar.Visible:=(FCount<=0); end; procedure TdbdMonitorForm.SetFilesCount(const Value: Integer); begin FFilesCount := Value; FCurFileNo:=1; lblFiles.Caption:='Файлов' + IntToStr(FCurFileNo) + ' из ' + IntToStr(FFilesCount); Refresh; end; procedure TdbdMonitorForm.SetPosNo(const Value: Integer); begin FPosNo := Value; pbImpOrExp.Position:=Value; end; procedure TdbdMonitorForm.ShowChar; begin try lChar.Caption:=Chars[(FCharNo mod 4)]; except FCharNo:=0; lChar.Caption:=Chars[FCharNo]; end; end; end.