UPD: Apply patch that added operations panel, drive free space indicator, extended operation control from Rustem

This commit is contained in:
Alexander Koblov 2010-03-20 19:19:19 +00:00
commit d18ebb2ed5
14 changed files with 1966 additions and 403 deletions

View file

@ -1,13 +1,13 @@
object frmFileOp: TfrmFileOp
Left = 278
Height = 166
Top = 234
Width = 522
Left = 523
Height = 180
Top = 259
Width = 539
ActiveControl = btnCancel
Caption = 'Process file(s)'
ChildSizing.TopBottomSpacing = 4
ClientHeight = 166
ClientWidth = 522
ClientHeight = 180
ClientWidth = 539
Constraints.MaxHeight = 180
Constraints.MinWidth = 500
OnClose = FormClose
@ -21,10 +21,10 @@ object frmFileOp: TfrmFileOp
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 56
Height = 20
Left = 45
Height = 14
Top = 8
Width = 454
Width = 482
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 8
@ -39,9 +39,9 @@ object frmFileOp: TfrmFileOp
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 22
Top = 112
Width = 510
Height = 14
Top = 100
Width = 527
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
@ -52,9 +52,9 @@ object frmFileOp: TfrmFileOp
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 10
Height = 20
Height = 14
Top = 8
Width = 40
Width = 29
BorderSpacing.Left = 10
BorderSpacing.Top = 8
Caption = 'From:'
@ -65,9 +65,9 @@ object frmFileOp: TfrmFileOp
AnchorSideTop.Control = lblFrom
AnchorSideTop.Side = asrBottom
Left = 10
Height = 20
Top = 30
Width = 24
Height = 14
Top = 24
Width = 17
BorderSpacing.Left = 10
BorderSpacing.Top = 2
Caption = 'To:'
@ -79,10 +79,10 @@ object frmFileOp: TfrmFileOp
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 56
Height = 20
Top = 30
Width = 456
Left = 45
Height = 14
Top = 24
Width = 484
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2
BorderSpacing.Right = 10
@ -97,8 +97,8 @@ object frmFileOp: TfrmFileOp
AnchorSideRight.Side = asrBottom
Left = 6
Height = 22
Top = 84
Width = 510
Top = 72
Width = 527
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
@ -115,8 +115,8 @@ object frmFileOp: TfrmFileOp
AnchorSideRight.Side = asrBottom
Left = 6
Height = 22
Top = 56
Width = 510
Top = 44
Width = 527
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
@ -129,9 +129,9 @@ object frmFileOp: TfrmFileOp
AnchorSideTop.Control = lblEstimated
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = btnPauseStart
Left = 346
Left = 363
Height = 32
Top = 140
Top = 120
Width = 89
Anchors = [akTop, akRight]
BorderSpacing.Top = 6
@ -151,9 +151,9 @@ object frmFileOp: TfrmFileOp
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = btnCancel
AnchorSideBottom.Side = asrBottom
Left = 441
Left = 458
Height = 32
Top = 140
Top = 120
Width = 75
Anchors = [akTop, akRight, akBottom]
Layout = blGlyphTop
@ -167,11 +167,61 @@ object frmFileOp: TfrmFileOp
AnchorSideTop.Control = btnCancel
Left = 6
Height = 32
Top = 140
Top = 120
Width = 149
BorderSpacing.Left = 6
Caption = 'Work in &background'
OnClick = btnWorkInBackgroundClick
TabOrder = 4
end
object btnToQueue: TSpeedButton
AnchorSideLeft.Control = btnWorkInBackground
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnWorkInBackground
AnchorSideBottom.Control = btnWorkInBackground
AnchorSideBottom.Side = asrBottom
Left = 160
Height = 32
Top = 120
Width = 58
Anchors = [akTop, akLeft, akBottom]
BorderSpacing.Left = 5
Caption = 'To Queue'
Color = clBtnFace
NumGlyphs = 0
OnClick = btnToQueueClick
end
object btnOpHome: TSpeedButton
AnchorSideLeft.Control = btnToQueue
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnToQueue
AnchorSideBottom.Control = btnToQueue
AnchorSideBottom.Side = asrBottom
Left = 221
Height = 32
Top = 120
Width = 41
Anchors = [akTop, akLeft, akBottom]
BorderSpacing.Left = 3
Caption = 'Home'
Color = clBtnFace
NumGlyphs = 0
OnClick = btnOpHomeClick
end
object bthOpEnd: TSpeedButton
AnchorSideLeft.Control = btnOpHome
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnOpHome
AnchorSideBottom.Control = btnOpHome
AnchorSideBottom.Side = asrBottom
Left = 262
Height = 32
Top = 120
Width = 42
Anchors = [akTop, akLeft, akBottom]
Caption = 'End'
Color = clBtnFace
NumGlyphs = 0
OnClick = bthOpEndClick
end
end

View file

@ -5,3 +5,6 @@ TFRMFILEOP.LBLTO.CAPTION=To:
TFRMFILEOP.LBLFILENAMETO.CAPTION=File name to
TFRMFILEOP.BTNCANCEL.CAPTION=Cancel
TFRMFILEOP.BTNWORKINBACKGROUND.CAPTION=Work in &background
TFRMFILEOP.BTNTOQUEUE.CAPTION=To Queue
TFRMFILEOP.BTNOPHOME.CAPTION=Home
TFRMFILEOP.BTHOPEND.CAPTION=End

View file

@ -20,7 +20,7 @@ interface
uses
LResources,
SysUtils, Classes, Controls, Forms, StdCtrls, ComCtrls, Buttons, ExtCtrls,
uOperationsManager, uFileSourceOperation, uFileSourceOperationUI;
uOperationsManager, uFileSourceOperation, uFileSourceOperationUI, fViewOperations;
type
@ -40,8 +40,14 @@ type
lblFileNameFrom: TLabel;
lblEstimated: TLabel;
btnCancel: TBitBtn;
btnToQueue: TSpeedButton;
btnOpHome: TSpeedButton;
bthOpEnd: TSpeedButton;
procedure bthOpEndClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure btnOpHomeClick(Sender: TObject);
procedure btnPauseStartClick(Sender: TObject);
procedure btnToQueueClick(Sender: TObject);
procedure btnWorkInBackgroundClick(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
@ -77,6 +83,8 @@ type
procedure UpdateTestArchiveOperation(Operation: TFileSourceOperation);
public
// Change to override later.
constructor Create(OperationHandle: TOperationHandle); overload;
destructor Destroy; override;
@ -84,6 +92,7 @@ type
function CloseQuery: Boolean; override;
procedure ToggleProgressBarStyle;
end;
implementation
@ -115,10 +124,21 @@ begin
begin
Operation.Stop;
end;
ModalResult:= mrCancel;
end;
procedure TfrmFileOp.bthOpEndClick(Sender: TObject);
begin
OperationsManager.MoveOperation(indexFocus, OperationsManager.OperationsCount-1);
indexFocus:= OperationsManager.OperationsCount-1;
end;
procedure TfrmFileOp.btnOpHomeClick(Sender: TObject);
begin
OperationsManager.MoveOperation(indexFocus, 0);
indexFocus:= 0;
end;
procedure TfrmFileOp.btnPauseStartClick(Sender: TObject);
var
Operation: TFileSourceOperation;
@ -135,14 +155,36 @@ begin
begin
Operation.Pause;
SetPlayGlyph;
OperationsManager.CheckQueuedOperations;
end;
end;
end;
procedure TfrmFileOp.btnWorkInBackgroundClick(Sender: TObject);
procedure TfrmFileOp.btnToQueueClick(Sender: TObject);
var
Operation: TFileSourceOperation;
begin
Operation := OperationsManager.GetOperationByHandle(FOperationHandle);
if Assigned(Operation) then
begin
OperationsManager.SetFormCreate (FOperationHandle, false);
OperationsManager.SetToQueue(FOperationHandle);
end;
FStopOperationOnClose := False;
Close;
OperationsManager.CheckQueuedOperations;
end;
procedure TfrmFileOp.btnWorkInBackgroundClick(Sender: TObject);
var
Operation: TFileSourceOperation;
begin
Operation := OperationsManager.GetOperationByHandle(FOperationHandle);
if Assigned(Operation) then OperationsManager.SetFormCreate (FOperationHandle, false);
FStopOperationOnClose := False;
Close;
OperationsManager.CheckQueuedOperations;
end;
procedure TfrmFileOp.FormClose(Sender: TObject; var CloseAction: TCloseAction);
@ -168,6 +210,7 @@ begin
Operation := OperationsManager.GetOperationByHandle(FOperationHandle);
if Assigned(Operation) then
begin
case Operation.ID of
fsoCopy, fsoCopyIn, fsoCopyOut:
@ -201,13 +244,21 @@ begin
FUpdateTimer.Interval := 100;
FUpdateTimer.OnTimer := @OnUpdateTimer;
FUpdateTimer.Enabled := True;
OperationsManager.SetFormCreate (FOperationHandle, true);
end;
constructor TfrmFileOp.Create(OperationHandle: TOperationHandle);
var
Operation: TFileSourceOperation;
begin
FOperationHandle := OperationHandle;
// if not Assigned(frmFileOp(FOperationHandle)) then
// begin
inherited Create(Application);
AutoSize := True;
@ -222,6 +273,7 @@ begin
end
else
FUserInterface := nil;
end;
destructor TfrmFileOp.Destroy;

File diff suppressed because it is too large Load diff

View file

@ -9,14 +9,17 @@ TFRMMAIN.BTNLEFTDIRECTORYHOTLIST.HINT=Directory hotlist
TFRMMAIN.BTNLEFTDIRECTORYHOTLIST.CAPTION=*
TFRMMAIN.BTNRIGHTEQUALLEFT.HINT=Show current directory of the left panel in the right panel
TFRMMAIN.BTNRIGHTEQUALLEFT.CAPTION=>
TFRMMAIN.LBLLEFTDRIVEINFO.CAPTION=lblLeftDriveInfo
TFRMMAIN.BTNRIGHTHOME.CAPTION=~
TFRMMAIN.BTNRIGHTUP.CAPTION=..
TFRMMAIN.BTNRIGHTROOT.CAPTION=/
TFRMMAIN.BTNRIGHTDIRECTORYHOTLIST.CAPTION=*
TFRMMAIN.BTNLEFTEQUALRIGHT.HINT=Show current directory of the right panel in the left panel
TFRMMAIN.BTNLEFTEQUALRIGHT.CAPTION=<
TFRMMAIN.LBLRIGHTDRIVEINFO.CAPTION=lblRightDriveInfo
TFRMMAIN.LBLCOMMANDPATH.CAPTION=Path
TFRMMAIN.BTNF9.CAPTION=Terminal F9
TFRMMAIN.BTNF10.CAPTION=Exit F10
TFRMMAIN.MNUFILES.CAPTION=&Files
TFRMMAIN.MILINE1.CAPTION=-
TFRMMAIN.MILINE2.CAPTION=-
@ -45,6 +48,11 @@ TFRMMAIN.MNUSHOWOPERATIONS.CAPTION=Operations viewer
TFRMMAIN.MNUCONFIG.CAPTION=C&onfiguration
TFRMMAIN.MNUHELP.CAPTION=&Help
TFRMMAIN.MILINE18.CAPTION=-
TFRMMAIN.ALLOPPCT.CAPTION=%
TFRMMAIN.ALLOPPROGRESSIND.CAPTION=||||||||||||||||||||
TFRMMAIN.ALLOPSTART.CAPTION=Start
TFRMMAIN.ALLOPPAUSE.CAPTION=||
TFRMMAIN.ALLOPCANCEL.CAPTION=Cancel
TFRMMAIN.ACTEXIT.CAPTION=E&xit
TFRMMAIN.ACTVIEW.CAPTION=View F3
TFRMMAIN.ACTEDIT.CAPTION=Edit F4

View file

@ -42,11 +42,11 @@ interface
uses
LResources,
Graphics, Forms, Menus, Controls, StdCtrls, ExtCtrls, ActnList,
Buttons, SysUtils, Classes, SynEdit, LCLType,
Buttons, SysUtils, Classes, SynEdit, LCLType, ComCtrls,
KASToolBar, KASBarMenu, KASBarFiles,
uCmdBox, uFileSystemWatcher, uFilePanelSelect,
uFileView, uColumnsFileView, uFileSource, uFileViewNotebook, uFile,
uOperationsManager, uDrivesList, uTerminal, uClassesEx, uXmlConfig
uOperationsManager, uFileSourceOperation, uDrivesList, uTerminal, uClassesEx, uXmlConfig
;
const
@ -139,7 +139,19 @@ type
dskLeft: TKAStoolBar;
dskRight: TKAStoolBar;
edtCommand: TComboBox;
lblRightDriveInfo: TLabel;
lblLeftDriveInfo: TLabel;
lblCommandPath: TLabel;
AllOpPause: TMenuItem;
AllOpProgressInd: TMenuItem;
AllOpCancel: TMenuItem;
AllOpStart: TMenuItem;
AllOpPct: TMenuItem;
Timer: TTimer;
PanelAllProgress: TPanel;
sboxRightDrive: TScrollBox;
sboxOperations: TScrollBox;
sboxLeftDrive: TScrollBox;
tbPaste: TMenuItem;
tbCopy: TMenuItem;
tbCut: TMenuItem;
@ -224,8 +236,6 @@ type
Panel1: TPanel;
MainSplitter: TPanel;
pmButtonMenu: TKASBarMenu;
lblRightDriveInfo: TLabel;
lblLeftDriveInfo: TLabel;
MainToolBar: TKASToolBar;
mnuOpenVFSList: TMenuItem;
mnuExtractFiles: TMenuItem;
@ -354,11 +364,18 @@ type
tmHAL: TTimer;
procedure actExecute(Sender: TObject);
procedure AllOpCancelClick(Sender: TObject);
procedure AllOpPauseClick(Sender: TObject);
procedure AllOpPctClick(Sender: TObject);
procedure AllOpStartClick(Sender: TObject);
procedure btnLeftClick(Sender: TObject);
procedure btnLeftDirectoryHotlistClick(Sender: TObject);
procedure btnRightClick(Sender: TObject);
procedure btnRightDirectoryHotlistClick(Sender: TObject);
procedure dskRightResize(Sender: TObject);
procedure lblAllProgressPctClick(Sender: TObject);
procedure miLogMenuClick(Sender: TObject);
procedure miTrayIconExitClick(Sender: TObject);
procedure miTrayIconRestoreClick(Sender: TObject);
@ -421,6 +438,10 @@ type
procedure pnlLeftResize(Sender: TObject);
procedure pnlLeftRightDblClick(Sender: TObject);
procedure sboxDrivePaint(Sender: TObject);
procedure sboxOperationsMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure sboxOperationsPaint(Sender: TObject);
procedure seLogWindowSpecialLineColors(Sender: TObject; Line: integer;
var Special: boolean; var FG, BG: TColor);
@ -439,6 +460,7 @@ type
procedure OnUniqueInstanceMessage(Sender: TObject; Params: array of UTF8String; ParamCount: Integer);
procedure tbPasteClick(Sender: TObject);
procedure tmHALTimer(Sender: TObject);
procedure AllProgressOnUpdateTimer(Sender: TObject);
private
{ Private declarations }
PanelSelected: TFilePanelSelect;
@ -701,6 +723,29 @@ begin
Actions.Execute(cmd);
end;
procedure TfrmMain.AllOpCancelClick(Sender: TObject);
begin
OperationsManager.CancelAll;
end;
procedure TfrmMain.AllOpPauseClick(Sender: TObject);
begin
OperationsManager.PauseRunning;
end;
procedure TfrmMain.AllOpPctClick(Sender: TObject);
begin
if not Assigned(frmViewOperations) then
Application.CreateForm(TfrmViewOperations, frmViewOperations);
frmViewOperations.ShowOnTop;
end;
procedure TfrmMain.AllOpStartClick(Sender: TObject);
begin
OperationsManager.StartRunning;
end;
procedure TfrmMain.btnLeftDirectoryHotlistClick(Sender: TObject);
Var P:TPoint;
begin
@ -731,6 +776,14 @@ begin
pnlSyncSize.Height:= dskRight.Height + pnlDisk.BevelWidth * 2;
end;
procedure TfrmMain.lblAllProgressPctClick(Sender: TObject);
begin
if not Assigned(frmViewOperations) then
Application.CreateForm(TfrmViewOperations, frmViewOperations);
frmViewOperations.ShowOnTop;
end;
procedure TfrmMain.miLogMenuClick(Sender: TObject);
begin
case (Sender as TMenuItem).Tag of
@ -2242,6 +2295,161 @@ begin
{$ENDIF}
end;
procedure TfrmMain.sboxDrivePaint(Sender: TObject);
var
sboxDrive: TScrollBox absolute Sender;
indexColor: Int64;
lightOfBusy: Integer;
col: TColor;
begin
if gDriveInd = True then
begin
indexColor:= sboxDrive.Tag;
lightOfBusy:= (sboxDrive.Width - 10) * indexColor div 100;
if IndexColor < 50 then col := clBlue;
if IndexColor in [50..75] then col:= clGreen;
if IndexColor in [76..85] then col := clYellow;
if IndexColor > 85 then col := clRed;
sboxDrive.Canvas.Brush.Color :=col;
sboxDrive.Canvas.FillRect (
2,
0,
sboxDrive.Width-2,
sboxDrive.Height-1);
sboxDrive.Canvas.Brush.Color := clBtnFace;
sboxDrive.Canvas.FillRect(
3,
1,
sboxDrive.Width-3,
sboxDrive.Height-2);
sboxDrive.Canvas.Brush.Color :=col;
sboxDrive.Canvas.FillRect(
4,
2,
lightOfBusy,
sboxDrive.Height-3);
end;
end;
procedure TfrmMain.sboxOperationsMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
OperationDialog: TfrmFileOp;
OperationNumber, widthOfItem: Integer;
CursorPos: TPoint;
begin
if (sboxOperations.Width / OperationsManager.OperationsCount) < 100 then
widthOfItem := Round(sboxOperations.Width/OperationsManager.OperationsCount)
else
widthOfItem := 100;
CursorPos := Mouse.CursorPos;
CursorPos := sboxOperations.ScreenToClient(CursorPos);
OperationNumber := CursorPos.X div widthOfItem;
if (OperationNumber < 0) or (OperationNumber > OperationsManager.OperationsCount) then Exit;
case Button of
mbMiddle:
begin
OperationsManager.MoveOperation(OperationNumber, OperationNumber - 1);
end;
mbRight:
begin
OperationsManager.MoveOperation(OperationNumber, OperationNumber + 1);
end;
mbLeft:
begin
if OperationsManager.GetFormCreate (OperationsManager.GetHandleById(OperationNumber)) = false then //проверяем наличие формы у указанной операции
begin
OperationDialog := TfrmFileOp.Create(OperationsManager.GetHandleById(OperationNumber)); // если нет то создаем
OperationDialog.Show;
OperationsManager.SetFormCreate (OperationsManager.GetHandleById(OperationNumber), True); // показываем что форма есть
end;
indexFocus:= OperationNumber;
end;
end;
end;
procedure TfrmMain.sboxOperationsPaint(Sender: TObject);
var
Operation: TFileSourceOperation;
OperationHandle: TOperationHandle;
StartingState: TOperationStartingState;
i, widthOfItem: Integer;
OutString: String;
begin
if OperationsManager.OperationsCount>0 then
begin
if (sboxOperations.Width / OperationsManager.OperationsCount) < 100 then
widthOfItem := Round(sboxOperations.Width / OperationsManager.OperationsCount)
else
widthOfItem := 100;
for i := 0 to OperationsManager.OperationsCount - 1 do
begin
Operation := OperationsManager.GetOperationByIndex(i);
if Assigned(Operation) then
begin
OperationHandle := OperationsManager.GetHandleById(i);
case Operation.ID of
fsoCopy, fsoCopyIn, fsoCopyOut:
OutString := 'Copying';
fsoMove:
OutString := 'Moving';
fsoDelete:
OutString := 'Delete';
fsoWipe:
OutString := 'Erasing';
fsoCalcChecksum:
OutString := 'Counting';
else
OutString := 'Unknown';
end;
OutString := IntToStr(OperationHandle) + ': '
+ OutString + ' - '
+ IntToStr(Operation.Progress) + ' %';
StartingState := OperationsManager.GetStartingState(OperationHandle);
// if not (StartingState in [ossInvalid, ossManualStart]) then
// OutString := OutString + ' [' + OperationStartingStateText[StartingState] + ']';
if OperationsManager.GetFormCreate (OperationHandle)=true then
sboxOperations.Canvas.Brush.Color := clBtnShadow
else
sboxOperations.Canvas.Brush.Color := Canvas.Brush.Color;
sboxOperations.Canvas.Rectangle(0 + (widthOfItem * i), 0, widthOfItem + (widthOfItem * i), sboxOperations.Height-1);
sboxOperations.Canvas.TextOut(3 + (widthOfItem * i), 2, OutString);
sboxOperations.Caption := OutString;
// изменение цвета полоски в зависи мости от состояния операции
sboxOperations.Canvas.Brush.Color := clRed; // если стоит по каким то причинам значит красная
if (StartingState in [ossQueueIn, ossQueueFirst, ossQueueLast]) then // если в очереди то желтая
sboxOperations.Canvas.Brush.Color := clYellow;
if Operation.State =fsosRunning then sboxOperations.Canvas.Brush.Color := clHighlight; //Если идет значит синяя
sboxOperations.Canvas.FillRect(
3 + (widthOfItem * i),
2 + sboxOperations.Canvas.TextHeight('Pg'),
5 + (widthOfItem * i) + (widthOfItem - 10) * Operation.Progress div 100,
10 + sboxOperations.Canvas.TextHeight('Pg'));
end;
end;
end;
end;
procedure TfrmMain.seLogWindowSpecialLineColors(Sender: TObject; Line: integer;
var Special: boolean; var FG, BG: TColor);
var
@ -3706,24 +3914,34 @@ end;
procedure TfrmMain.UpdateFreeSpace(Panel: TFilePanelSelect);
var
FreeSize, TotalSize: Int64;
lblDriveInfo: TLabel;
aFileView: TFileView;
sboxDrive: TScrollBox;
lblDriveInfo: TLabel;
begin
case Panel of
fpLeft :
begin
lblDriveInfo := lblLeftDriveInfo;
sboxDrive := sboxLeftDrive;
aFileView := FrameLeft;
lblDriveInfo:=lblLeftDriveInfo;
end;
fpRight:
begin
lblDriveInfo := lblRightDriveInfo;
sboxDrive := sboxRightDrive;
aFileView := FrameRight;
lblDriveInfo:=lblRightDriveInfo;
end;
end;
if aFileView.FileSource.GetFreeSpace(aFileView.CurrentPath, FreeSize, TotalSize) then
lblDriveInfo.Caption := Format(rsFreeMsg, [cnvFormatFileSize(FreeSize), cnvFormatFileSize(TotalSize)])
begin
if gDriveInd = True then
begin
sboxDrive.Tag:= 100 - Round((FreeSize / TotalSize) * 100); // Save busy percent
sboxDrive.Invalidate;
end;
lblDriveInfo.Caption := Format(rsFreeMsg, [cnvFormatFileSize(FreeSize), cnvFormatFileSize(TotalSize)]);
end
else
lblDriveInfo.Caption := '';
end;
@ -3754,6 +3972,69 @@ begin
SetActiveFrame(TDrivesListPopup(Sender).Panel);
end;
procedure TfrmMain.AllProgressOnUpdateTimer(Sender: TObject);
var
Pct: string;
i, AllProgressPoint: integer;
Operation: TFileSourceOperation;
visiblePanel: boolean;
begin
// Скрываем прогрессбар если нет операций в фоне
if OperationsManager.OperationsCount=0 then
begin
PanelAllProgress.Visible:=false;
AllOpPct.Visible:= false;
AllOpProgressInd.Visible:= false;
AllOpStart.Visible:= false;
AllOpPause.Visible:= false;
AllOpCancel.Visible:= false;
end
else
begin
if gPanelOfOp = True then
begin
for i := 0 to OperationsManager.OperationsCount - 1 do
begin
Operation := OperationsManager.GetOperationByIndex(i);
if Assigned(Operation) then
begin
sboxOperations.Invalidate; // force redraw
end;
end;
// Делаем все видимым если у хотя бы одной операции нет формы
visiblePanel:= False;
for i := 0 to OperationsManager.OperationsCount - 1 do
begin
if OperationsManager.GetFormCreate(OperationsManager.GetHandleById(i)) = False then
visiblePanel:= True;
end;
if visiblePanel = True then
PanelAllProgress.Visible:= True
else
PanelAllProgress.Visible:= False ;
end;
if gProgInMenuBar = true then
begin
AllProgressPoint:= OperationsManager.AllProgressPoint;
AllOpPct.Caption:=IntToStr(AllProgressPoint)+' %'; // Показываем в строке меню
Pct:='';
for i:=0 to 25 do
begin
if i <= AllProgressPoint/4 then
Pct:=Pct+'|' else Pct:= Pct+'.';
end;
AllOpProgressInd.Caption:='['+Pct+']';
AllOpPct.Visible:= true;
AllOpProgressInd.Visible:= true;
AllOpStart.Visible:= true;
AllOpPause.Visible:= true;
AllOpCancel.Visible:= true;
end;
end;
end;
procedure TfrmMain.SetPanelDrive(aPanel: TFilePanelSelect; aPath: UTF8String);
var
FileView, OtherFileView: TFileView;

View file

@ -1,7 +1,7 @@
object frmOptions: TfrmOptions
Left = 172
Left = 393
Height = 557
Top = -15
Top = 164
Width = 803
ActiveControl = tvTreeView
Caption = 'Options'
@ -130,7 +130,7 @@ object frmOptions: TfrmOptions
Width = 626
Align = alClient
OnPageChanged = nbNotebookPageChanged
PageIndex = 1
PageIndex = 5
ShowTabs = False
TabOrder = 0
object pgLng: TPage
@ -734,8 +734,8 @@ object frmOptions: TfrmOptions
AnchorSideRight.Control = fneToolsPath
AnchorSideRight.Side = asrBottom
Left = 150
Height = 27
Top = 137
Height = 21
Top = 113
Width = 428
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
@ -747,8 +747,8 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = lblToolsPath
AnchorSideTop.Side = asrBottom
Left = 150
Height = 27
Top = 76
Height = 21
Top = 64
Width = 428
DialogOptions = []
FilterIndex = 0
@ -766,9 +766,9 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = cbToolsUseExternalProgram
AnchorSideTop.Side = asrBottom
Left = 150
Height = 20
Top = 52
Width = 181
Height = 14
Top = 46
Width = 134
BorderSpacing.Top = 15
Caption = 'Path to program to execute'
ParentColor = False
@ -778,9 +778,9 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = fneToolsPath
AnchorSideTop.Side = asrBottom
Left = 150
Height = 20
Top = 113
Width = 150
Height = 14
Top = 95
Width = 106
BorderSpacing.Top = 10
Caption = 'Additional parameters'
ParentColor = False
@ -790,9 +790,9 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = cbToolsRunInTerminal
AnchorSideTop.Side = asrBottom
Left = 165
Height = 23
Top = 201
Width = 376
Height = 17
Top = 165
Width = 269
BorderSpacing.Left = 15
BorderSpacing.Top = 2
Caption = 'Keep terminal window open after executing program'
@ -804,9 +804,9 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = edtToolsParameters
AnchorSideTop.Side = asrBottom
Left = 150
Height = 23
Top = 176
Width = 149
Height = 17
Top = 146
Width = 109
BorderSpacing.Top = 12
Caption = 'Execute in terminal'
OnChange = cbToolsRunInTerminalChange
@ -814,9 +814,9 @@ object frmOptions: TfrmOptions
end
object cbToolsUseExternalProgram: TCheckBox
Left = 150
Height = 23
Height = 17
Top = 14
Width = 168
Width = 122
Caption = 'Use external program'
OnChange = cbToolsUseExternalProgramChange
TabOrder = 1
@ -838,7 +838,7 @@ object frmOptions: TfrmOptions
AnchorSideTop.Side = asrBottom
Left = 6
Height = 14
Top = 83
Top = 80
Width = 52
BorderSpacing.Top = 6
Caption = 'Editor font'
@ -849,7 +849,7 @@ object frmOptions: TfrmOptions
AnchorSideTop.Side = asrBottom
Left = 6
Height = 14
Top = 160
Top = 154
Width = 56
BorderSpacing.Top = 6
Caption = 'Viewer font'
@ -883,8 +883,8 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = edtTest1
AnchorSideTop.Side = asrCenter
Left = 540
Height = 23
Top = 54
Height = 21
Top = 53
Width = 55
Anchors = [akTop, akRight]
MaxValue = 25
@ -897,7 +897,7 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = cbMainFont
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Height = 21
Top = 53
Width = 525
Anchors = [akTop, akLeft, akRight]
@ -909,7 +909,7 @@ object frmOptions: TfrmOptions
AnchorSideTop.Side = asrBottom
Left = 6
Height = 21
Top = 103
Top = 100
Width = 525
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
@ -923,7 +923,7 @@ object frmOptions: TfrmOptions
AnchorSideBottom.Side = asrBottom
Left = 540
Height = 21
Top = 103
Top = 100
Width = 23
Anchors = [akTop, akRight, akBottom]
BorderSpacing.InnerBorder = 4
@ -935,8 +935,8 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = cbEditorFont
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 130
Height = 21
Top = 127
Width = 525
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
@ -946,8 +946,8 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = edtTest2
AnchorSideTop.Side = asrCenter
Left = 540
Height = 23
Top = 131
Height = 21
Top = 127
Width = 55
Anchors = [akTop, akRight]
MaxValue = 25
@ -961,7 +961,7 @@ object frmOptions: TfrmOptions
AnchorSideTop.Side = asrBottom
Left = 6
Height = 21
Top = 180
Top = 174
Width = 525
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
@ -975,7 +975,7 @@ object frmOptions: TfrmOptions
AnchorSideBottom.Side = asrBottom
Left = 540
Height = 21
Top = 180
Top = 174
Width = 23
Anchors = [akTop, akRight, akBottom]
BorderSpacing.InnerBorder = 4
@ -987,8 +987,8 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = cbViewerFont
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 207
Height = 21
Top = 201
Width = 525
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
@ -998,8 +998,8 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = edtTest3
AnchorSideTop.Side = asrCenter
Left = 540
Height = 23
Top = 208
Height = 21
Top = 201
Width = 56
Anchors = [akTop, akRight]
MaxValue = 25
@ -1354,9 +1354,9 @@ object frmOptions: TfrmOptions
AnchorSideLeft.Side = asrBottom
AnchorSideBottom.Control = edHotKey
Left = 281
Height = 18
Top = 390
Width = 46
Height = 14
Top = 406
Width = 43
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 8
Caption = 'Hot Key:'
@ -1364,9 +1364,9 @@ object frmOptions: TfrmOptions
end
object lbtypes: TLabel
Left = 8
Height = 18
Height = 14
Top = 0
Width = 63
Width = 57
Caption = 'Categories:'
ParentColor = False
end
@ -1375,9 +1375,9 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = lbxCategories
AnchorSideTop.Side = asrBottom
Left = 8
Height = 18
Height = 14
Top = 72
Width = 68
Width = 57
BorderSpacing.Top = 4
Caption = 'Commands:'
ParentColor = False
@ -1386,9 +1386,9 @@ object frmOptions: TfrmOptions
AnchorSideLeft.Control = lblHotKey
AnchorSideBottom.Control = edtParam
Left = 281
Height = 18
Top = 435
Width = 40
Height = 14
Top = 443
Width = 35
Anchors = [akLeft, akBottom]
Caption = 'Param:'
ParentColor = False
@ -1397,10 +1397,10 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = edtFilter
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edtFilter
Left = 461
Height = 18
Left = 465
Height = 14
Top = 327
Width = 29
Width = 25
Anchors = [akTop, akRight]
BorderSpacing.Top = 4
BorderSpacing.Right = 4
@ -1411,8 +1411,8 @@ object frmOptions: TfrmOptions
AnchorSideLeft.Control = lblHotKey
AnchorSideBottom.Control = lblHotKey
Left = 281
Height = 18
Top = 368
Height = 14
Top = 388
Width = 1
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 4
@ -1426,8 +1426,8 @@ object frmOptions: TfrmOptions
AnchorSideRight.Control = btSetHotKey
AnchorSideBottom.Control = lblParam
Left = 281
Height = 25
Top = 408
Height = 21
Top = 420
Width = 197
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Right = 8
@ -1442,7 +1442,7 @@ object frmOptions: TfrmOptions
AnchorSideRight.Side = asrBottom
Left = 486
Height = 24
Top = 408
Top = 420
Width = 111
Anchors = [akTop, akRight]
BorderSpacing.InnerBorder = 4
@ -1459,7 +1459,7 @@ object frmOptions: TfrmOptions
AnchorSideRight.Side = asrBottom
Left = 486
Height = 24
Top = 438
Top = 450
Width = 111
Anchors = [akTop, akRight]
BorderSpacing.Left = 8
@ -1491,8 +1491,8 @@ object frmOptions: TfrmOptions
AnchorSideBottom.Control = stgHotkeys
AnchorSideBottom.Side = asrBottom
Left = 281
Height = 25
Top = 453
Height = 21
Top = 457
Width = 197
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Bottom = 4
@ -1504,7 +1504,7 @@ object frmOptions: TfrmOptions
AnchorSideRight.Control = stgCommands
AnchorSideRight.Side = asrBottom
Left = 494
Height = 25
Height = 21
Top = 324
Width = 103
Anchors = [akTop, akRight]
@ -2196,138 +2196,162 @@ object frmOptions: TfrmOptions
ClientHeight = 481
object gbScreenLayout: TGroupBox
Left = 10
Height = 358
Height = 438
Top = 6
Width = 594
Anchors = [akTop, akLeft, akRight]
Caption = ' Screen layout '
ClientHeight = 340
ClientHeight = 420
ClientWidth = 590
TabOrder = 0
object cbShowMainToolBar: TCheckBox
Left = 10
Height = 19
Height = 17
Top = 8
Width = 106
Width = 98
Caption = 'Show &button bar'
TabOrder = 0
end
object cbShowDiskPanel: TCheckBox
Left = 10
Height = 19
Height = 17
Top = 50
Width = 119
Width = 111
Caption = 'Show &drive buttons'
OnChange = cbShowDiskPanelChange
TabOrder = 1
end
object cbShowDriveMenuButton: TCheckBox
Left = 10
Height = 19
Top = 113
Width = 143
Height = 17
Top = 110
Width = 135
Caption = 'Show d&rive menu button'
TabOrder = 4
end
object cbShowCurDir: TCheckBox
Left = 10
Height = 19
Top = 155
Width = 136
Height = 17
Top = 182
Width = 128
Caption = 'Show &current directory'
TabOrder = 6
end
object cbShowTabHeader: TCheckBox
Left = 10
Height = 19
Top = 176
Width = 129
Height = 17
Top = 206
Width = 121
Caption = 'Show &tabstop header'
TabOrder = 7
end
object cbShowStatusBar: TCheckBox
Left = 10
Height = 19
Top = 197
Width = 104
Height = 17
Top = 230
Width = 96
Caption = 'Show &status bar'
TabOrder = 8
end
object cbShowCmdLine: TCheckBox
Left = 10
Height = 19
Top = 218
Width = 119
Height = 17
Top = 254
Width = 111
Caption = 'Show command &line'
TabOrder = 9
end
object cbShowKeysPanel: TCheckBox
Left = 10
Height = 19
Top = 239
Width = 154
Height = 17
Top = 278
Width = 146
Caption = 'Show &function key buttons'
TabOrder = 10
end
object cbFlatDiskPanel: TCheckBox
Left = 26
Height = 19
Height = 17
Top = 92
Width = 84
Width = 76
Caption = 'Flat buttons'
Enabled = False
TabOrder = 3
end
object cbTwoDiskPanels: TCheckBox
Left = 26
Height = 19
Height = 17
Top = 71
Width = 321
Width = 313
Caption = 'Show two drive button bars (fixed width, above file windows)'
Enabled = False
TabOrder = 2
end
object cbShowTabs: TCheckBox
Left = 10
Height = 19
Top = 134
Width = 107
Height = 17
Top = 158
Width = 99
Caption = 'Sho&w folder tabs'
TabOrder = 5
end
object cbFlatInterface: TCheckBox
Left = 10
Height = 19
Top = 260
Width = 90
Height = 17
Top = 302
Width = 82
Caption = 'Flat interface'
TabOrder = 11
end
object cbFlatToolBar: TCheckBox
Left = 26
Height = 19
Height = 17
Top = 29
Width = 84
Width = 76
Caption = 'Flat buttons'
TabOrder = 12
end
object cbLogWindow: TCheckBox
Left = 10
Height = 19
Top = 280
Width = 108
Height = 17
Top = 326
Width = 100
Caption = 'Show log window'
TabOrder = 13
end
object cbTermWindow: TCheckBox
Left = 10
Height = 19
Top = 302
Width = 132
Height = 17
Top = 350
Width = 124
Caption = 'Show terminal window'
OnChange = cbTermWindowChange
TabOrder = 15
end
object cbFreespaceInd: TCheckBox
Left = 10
Height = 17
Top = 132
Width = 206
Caption = 'Show freespace indicator on drive label'
TabOrder = 14
end
object cbProgInMenuBar: TCheckBox
Left = 10
Height = 17
Top = 371
Width = 190
Caption = 'Show common progress in menu bar'
TabOrder = 16
end
object cbPanelOfOperations: TCheckBox
Left = 10
Height = 17
Top = 391
Width = 205
Caption = 'Show panel of operation in background'
TabOrder = 17
end
end
end
object pgFileOp: TPage

View file

@ -107,6 +107,9 @@ TFRMOPTIONS.CBFLATINTERFACE.CAPTION=Flat interface
TFRMOPTIONS.CBFLATTOOLBAR.CAPTION=Flat buttons
TFRMOPTIONS.CBLOGWINDOW.CAPTION=Show log window
TFRMOPTIONS.CBTERMWINDOW.CAPTION=Show terminal window
TFRMOPTIONS.CBFREESPACEIND.CAPTION=Show freespace indicator on drive label
TFRMOPTIONS.CBPROGINMENUBAR.CAPTION=Show common progress in menu bar
TFRMOPTIONS.CBPANELOFOPERATIONS.CAPTION=Show panel of operation in background
TFRMOPTIONS.GBCOPYBUFFERSIZE.CAPTION=&Buffer size for files:
TFRMOPTIONS.LBLCOPYBUFFERSIZE.CAPTION=Buffer size (Kb):
TFRMOPTIONS.GBGENERALOPTIONS.CAPTION=General options

View file

@ -135,6 +135,9 @@ type
cbToolsRunInTerminal: TCheckBox;
cbToolsKeepTerminalOpen: TCheckBox;
cbToolsUseExternalProgram: TCheckBox;
cbFreespaceInd: TCheckBox;
cbProgInMenuBar: TCheckBox;
cbPanelOfOperations: TCheckBox;
chkMultiArcEnabled: TCheckBox;
chkAutoFillColumns: TCheckBox;
chkIgnoreEnable: TCheckBox;
@ -2403,6 +2406,9 @@ begin
cbFlatInterface.Checked := gInterfaceFlat;
cbLogWindow.Checked := gLogWindow;
cbTermWindow.Checked := gTermWindow;
cbFreespaceInd.Checked := gDriveInd;
cbProgInMenuBar.Checked := gProgInMenuBar;
cbPanelOfOperations.Checked := gPanelOfOp;
{ Behaviours page }
edtRunInTerm.Text:= gRunInTerm;
@ -2608,6 +2614,9 @@ begin
gInterfaceFlat := cbFlatInterface.Checked;
gLogWindow := cbLogWindow.Checked;
gTermWindow := cbTermWindow.Checked;
gDriveInd := cbFreespaceInd.Checked;
gProgInMenuBar := cbProgInMenuBar.Checked;
gPanelOfOp := cbPanelOfOperations.Checked;
{ Behaviour page }
gRunInTerm:=edtRunInTerm.Text;

View file

@ -1,36 +1,20 @@
object frmViewOperations: TfrmViewOperations
Left = 192
Height = 221
Top = 192
Width = 656
Left = 476
Height = 333
Top = 272
Width = 559
Caption = 'File operations'
ClientHeight = 221
ClientWidth = 656
ClientHeight = 333
ClientWidth = 559
FormStyle = fsStayOnTop
OnCreate = FormCreate
OnDestroy = FormDestroy
LCLVersion = '0.9.29'
object lblOperationsCount: TLabel
Left = 24
Height = 18
Top = 16
Width = 99
Caption = 'Active operations:'
ParentColor = False
end
object lblCount: TLabel
Left = 224
Height = 18
Top = 16
Width = 47
Caption = 'lblCount'
ParentColor = False
end
object sboxOperations: TScrollBox
Left = 0
Height = 174
Top = 47
Width = 656
Height = 245
Top = 88
Width = 559
Align = alBottom
Anchors = [akTop, akLeft, akRight]
TabOrder = 0
@ -38,10 +22,359 @@ object frmViewOperations: TfrmViewOperations
OnMouseDown = sboxOperationsMouseDown
OnPaint = sboxOperationsPaint
end
object VOMainPanel: TPanel
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 88
Top = 0
Width = 559
Anchors = [akTop, akLeft, akRight]
ClientHeight = 88
ClientWidth = 559
TabOrder = 1
object lblCount: TLabel
Left = 128
Height = 14
Top = 24
Width = 40
Caption = 'lblCount'
ParentColor = False
end
object lblOperationsCount: TLabel
Left = 24
Height = 14
Top = 24
Width = 89
Caption = 'Active operations:'
ParentColor = False
end
object CurrentOperationPanel: TPanel
AnchorSideLeft.Control = lblCount
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = VOMainPanel
AnchorSideRight.Control = VOMainPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = VOMainPanel
AnchorSideBottom.Side = asrBottom
Left = 178
Height = 88
Top = 0
Width = 381
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 10
ClientHeight = 88
ClientWidth = 381
TabOrder = 0
object CancelCurOp: TSpeedButton
AnchorSideRight.Control = CurrentOperationPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CurrentOperationPanel
AnchorSideBottom.Side = asrBottom
Left = 327
Height = 21
Top = 64
Width = 54
Anchors = [akRight, akBottom]
BorderSpacing.Bottom = 3
Caption = 'Cancel'
Color = clBtnFace
NumGlyphs = 0
OnClick = CancelCurOpClick
end
object StartPauseCurOp: TSpeedButton
AnchorSideLeft.Control = CurrentOperationPanel
AnchorSideBottom.Control = CurrentOperationPanel
AnchorSideBottom.Side = asrBottom
Left = 3
Height = 21
Top = 64
Width = 45
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 3
BorderSpacing.Bottom = 3
Caption = 'Start'
Color = clBtnFace
NumGlyphs = 0
OnClick = StartPauseCurOpClick
end
object DnCurOp: TSpeedButton
AnchorSideLeft.Control = UpCurOp
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = CancelCurOp
AnchorSideBottom.Control = CurrentOperationPanel
AnchorSideBottom.Side = asrBottom
Left = 287
Height = 21
Top = 64
Width = 38
Anchors = [akRight, akBottom]
BorderSpacing.Left = 2
BorderSpacing.Right = 2
BorderSpacing.Bottom = 3
Caption = 'Down'
Color = clBtnFace
NumGlyphs = 0
OnClick = DnCurOpClick
end
object UpCurOp: TSpeedButton
AnchorSideLeft.Control = CurrentOperationPanel
AnchorSideRight.Control = DnCurOp
AnchorSideBottom.Control = CurrentOperationPanel
AnchorSideBottom.Side = asrBottom
Left = 245
Height = 21
Top = 64
Width = 40
Anchors = [akRight, akBottom]
BorderSpacing.Right = 2
BorderSpacing.Bottom = 3
Caption = 'Up'
Color = clBtnFace
NumGlyphs = 0
OnClick = UpCurOpClick
end
object CurrentOperationLabel: TLabel
AnchorSideLeft.Control = StartPauseCurOp
Left = 5
Height = 14
Top = 8
Width = 111
BorderSpacing.Left = 2
Caption = 'CurrentOperationLabel'
ParentColor = False
end
object CurOpQueueInOut: TSpeedButton
AnchorSideLeft.Control = Queue
AnchorSideLeft.Side = asrBottom
AnchorSideBottom.Control = CurrentOperationPanel
AnchorSideBottom.Side = asrBottom
Left = 97
Height = 21
Top = 64
Width = 34
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 2
BorderSpacing.Bottom = 3
Caption = 'In'
Color = clBtnFace
NumGlyphs = 0
OnClick = CurOpQueueInOutClick
end
object Queue: TLabel
AnchorSideLeft.Control = StartPauseCurOp
AnchorSideLeft.Side = asrBottom
AnchorSideBottom.Control = CurrentOperationPanel
AnchorSideBottom.Side = asrBottom
Left = 58
Height = 14
Top = 67
Width = 37
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 10
BorderSpacing.Bottom = 7
Caption = 'Queue:'
ParentColor = False
end
end
end
object AllOperationPanel: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = VOMainPanel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 90
Top = 243
Width = 559
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Top = 220
ClientHeight = 90
ClientWidth = 559
TabOrder = 2
object AllProgressLabel: TLabel
AnchorSideLeft.Control = AllProgressBar
AnchorSideRight.Control = AllOperationPanel
AnchorSideRight.Side = asrBottom
Left = 241
Height = 14
Top = 16
Width = 79
Caption = 'AllProgressLabel'
ParentColor = False
end
object AllProgressBar: TProgressBar
AnchorSideLeft.Control = AllCancel
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = AllOperationPanel
AnchorSideRight.Side = asrBottom
Left = 241
Height = 18
Top = 40
Width = 309
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 30
BorderSpacing.Right = 9
Smooth = True
TabOrder = 0
end
object AllCancel: TSpeedButton
AnchorSideLeft.Control = AllPause
AnchorSideLeft.Side = asrBottom
Left = 155
Height = 20
Top = 40
Width = 56
BorderSpacing.Left = 2
Caption = 'Cancel All'
Color = clBtnFace
NumGlyphs = 0
OnClick = AllCancelClick
end
object AllButtonsLable: TLabel
AnchorSideLeft.Control = AllOperationPanel
Left = 27
Height = 14
Top = 0
Width = 90
BorderSpacing.Left = 27
Caption = 'Operations control'
ParentColor = False
end
object Label2: TLabel
AnchorSideLeft.Control = AllPause
AnchorSideLeft.Side = asrCenter
Left = 128
Height = 14
Top = 16
Width = 28
Caption = 'for all'
ParentColor = False
end
object Cntr_running: TPanel
AnchorSideLeft.Control = AllOperationPanel
AnchorSideTop.Control = AllButtonsLable
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AllStart
AnchorSideBottom.Control = AllOperationPanel
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 74
Top = 16
Width = 77
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
ClientHeight = 74
ClientWidth = 77
TabOrder = 1
object Label1: TLabel
AnchorSideLeft.Control = Cntr_running
Left = 13
Height = 14
Top = 0
Width = 54
BorderSpacing.Left = 13
Caption = 'for running'
ParentColor = False
end
object RunAllStart: TBitBtn
AnchorSideLeft.Control = Cntr_running
Left = 7
Height = 20
Top = 21
Width = 60
BorderSpacing.Left = 7
Caption = 'Start'
OnClick = RunAllStartClick
TabOrder = 0
end
object RunAllPauseStart: TSpeedButton
AnchorSideLeft.Control = RunAllStart
Left = 7
Height = 20
Top = 45
Width = 60
Anchors = [akTop]
Caption = '||'
Color = clBtnFace
NumGlyphs = 0
OnClick = RunAllPauseStartClick
end
end
object AllPause: TSpeedButton
AnchorSideLeft.Control = AllStart
AnchorSideLeft.Side = asrBottom
Left = 131
Height = 20
Top = 40
Width = 22
BorderSpacing.Left = 2
Caption = '||'
Color = clBtnFace
NumGlyphs = 0
OnClick = AllPauseClick
end
object AllStart: TSpeedButton
AnchorSideLeft.Control = Cntr_running
AnchorSideLeft.Side = asrBottom
Left = 82
Height = 20
Top = 40
Width = 47
BorderSpacing.Left = 5
Caption = 'Start All'
Color = clBtnFace
NumGlyphs = 0
OnClick = AllStartClick
end
object CheckQueueBox: TCheckBox
AnchorSideLeft.Control = AllProgressBar
AnchorSideRight.Control = AllProgressBar
AnchorSideRight.Side = asrBottom
Left = 241
Height = 17
Top = 65
Width = 83
Caption = 'Enable queue'
Checked = True
State = cbChecked
TabOrder = 2
end
object AllInQueue: TSpeedButton
AnchorSideLeft.Control = AllStart
Left = 82
Height = 18
Top = 64
Width = 46
Caption = 'All In'
Color = clBtnFace
NumGlyphs = 0
OnClick = AllInQueueClick
end
object StartQueue: TSpeedButton
AnchorSideLeft.Control = AllInQueue
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = AllCancel
AnchorSideRight.Side = asrBottom
Left = 130
Height = 18
Top = 64
Width = 81
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 2
Caption = 'Start queue'
Color = clBtnFace
NumGlyphs = 0
OnClick = StartQueueClick
end
end
object UpdateTimer: TTimer
Interval = 100
OnTimer = OnUpdateTimer
left = 19
top = 212
left = 8
top = 176
end
end

View file

@ -1,3 +1,22 @@
TFRMVIEWOPERATIONS.CAPTION=File operations
TFRMVIEWOPERATIONS.LBLOPERATIONSCOUNT.CAPTION=Active operations:
TFRMVIEWOPERATIONS.LBLCOUNT.CAPTION=lblCount
TFRMVIEWOPERATIONS.LBLOPERATIONSCOUNT.CAPTION=Active operations:
TFRMVIEWOPERATIONS.CANCELCUROP.CAPTION=Cancel
TFRMVIEWOPERATIONS.STARTPAUSECUROP.CAPTION=Start
TFRMVIEWOPERATIONS.DNCUROP.CAPTION=Down
TFRMVIEWOPERATIONS.UPCUROP.CAPTION=Up
TFRMVIEWOPERATIONS.CURRENTOPERATIONLABEL.CAPTION=CurrentOperationLabel
TFRMVIEWOPERATIONS.CUROPQUEUEINOUT.CAPTION=In
TFRMVIEWOPERATIONS.QUEUE.CAPTION=Queue:
TFRMVIEWOPERATIONS.ALLPROGRESSLABEL.CAPTION=AllProgressLabel
TFRMVIEWOPERATIONS.ALLCANCEL.CAPTION=Cancel All
TFRMVIEWOPERATIONS.ALLBUTTONSLABLE.CAPTION=Operations control
TFRMVIEWOPERATIONS.LABEL2.CAPTION=for all
TFRMVIEWOPERATIONS.LABEL1.CAPTION=for running
TFRMVIEWOPERATIONS.RUNALLSTART.CAPTION=Start
TFRMVIEWOPERATIONS.RUNALLPAUSESTART.CAPTION=||
TFRMVIEWOPERATIONS.ALLPAUSE.CAPTION=||
TFRMVIEWOPERATIONS.ALLSTART.CAPTION=Start All
TFRMVIEWOPERATIONS.CHECKQUEUEBOX.CAPTION=Enable queue
TFRMVIEWOPERATIONS.ALLINQUEUE.CAPTION=All In
TFRMVIEWOPERATIONS.STARTQUEUE.CAPTION=Start queue

View file

@ -6,24 +6,61 @@ interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls,
uFileSourceOperation, uOperationsManager;
StdCtrls, ExtCtrls, ComCtrls, Buttons,
uFileSourceOperation, uOperationsManager, uFileSourceCopyOperation;
type
{ TfrmViewOperations }
TfrmViewOperations = class(TForm)
AllProgressLabel: TLabel;
CheckQueueBox: TCheckBox;
CurrentOperationPanel: TPanel;
CurrentOperationLabel: TLabel;
Queue: TLabel;
RunAllStart: TBitBtn;
AllButtonsLable: TLabel;
Label1: TLabel;
Label2: TLabel;
lblCount: TLabel;
lblOperationsCount: TLabel;
AllProgressBar: TProgressBar;
AllOperationPanel: TPanel;
Cntr_running: TPanel;
AllPause: TSpeedButton;
AllStart: TSpeedButton;
CurOpQueueInOut: TSpeedButton;
AllInQueue: TSpeedButton;
StartQueue: TSpeedButton;
UpCurOp: TSpeedButton;
DnCurOp: TSpeedButton;
StartPauseCurOp: TSpeedButton;
CancelCurOp: TSpeedButton;
VOMainPanel: TPanel;
sboxOperations: TScrollBox;
RunAllPauseStart: TSpeedButton;
AllCancel: TSpeedButton;
UpdateTimer: TTimer;
procedure AllInQueueClick(Sender: TObject);
procedure AllPauseClick(Sender: TObject);
procedure AllStartClick(Sender: TObject);
procedure CancelCurOpClick(Sender: TObject);
procedure DnCurOpClick(Sender: TObject);
procedure RunAllPauseStartClick(Sender: TObject);
procedure AllCancelClick(Sender: TObject);
procedure RunAllStartClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure OnUpdateTimer(Sender: TObject);
procedure sboxOperationsDblClick(Sender: TObject);
procedure sboxOperationsMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure sboxOperationsPaint(Sender: TObject);
procedure CurOpQueueInOutClick(Sender: TObject);
procedure StartPauseCurOpClick(Sender: TObject);
procedure StartQueueClick(Sender: TObject);
procedure UpCurOpClick(Sender: TObject);
private
procedure UpdateView(Operation: TFileSourceOperation; Event: TOperationManagerEvent);
@ -34,6 +71,7 @@ type
var
frmViewOperations: TfrmViewOperations = nil;
indexFocus: integer;
implementation
@ -48,8 +86,9 @@ const
procedure TfrmViewOperations.FormCreate(Sender: TObject);
begin
lblCount.Caption := '0';
lblCount.Caption := '0';
indexFocus := 0;
sboxOperations.AutoScroll := True;
sboxOperations.VertScrollBar.Visible := True;
@ -59,6 +98,53 @@ begin
sboxOperations.Invalidate; // force redraw
end;
procedure TfrmViewOperations.RunAllPauseStartClick(Sender: TObject);
begin
OperationsManager.PauseRunning;
end;
procedure TfrmViewOperations.AllPauseClick(Sender: TObject);
begin
OperationsManager.PauseAll;
end;
procedure TfrmViewOperations.AllInQueueClick(Sender: TObject);
var
i: integer;
begin
for i:=0 to OperationsManager.OperationsCount-1 do
OperationsManager.SetToQueue (OperationsManager.GetHandleById(i));
end;
procedure TfrmViewOperations.AllStartClick(Sender: TObject);
begin
OperationsManager.StartAll;
end;
procedure TfrmViewOperations.CancelCurOpClick(Sender: TObject);
begin
OperationsManager.GetOperationByIndex(indexFocus).Stop;
end;
procedure TfrmViewOperations.DnCurOpClick(Sender: TObject);
begin
if indexFocus < OperationsManager.OperationsCount-1 then
begin
OperationsManager.MoveOperation(indexFocus, indexFocus + 1);
indexFocus:= indexFocus+1;
end;
end;
procedure TfrmViewOperations.AllCancelClick(Sender: TObject);
begin
OperationsManager.CancelAll;
end;
procedure TfrmViewOperations.RunAllStartClick(Sender: TObject);
begin
OperationsManager.StartRunning;
end;
procedure TfrmViewOperations.FormDestroy(Sender: TObject);
begin
OperationsManager.RemoveEventsListener([omevOperationAdded, omevOperationRemoved], @UpdateView);
@ -69,6 +155,27 @@ var
Operation: TFileSourceOperation;
i: Integer;
begin
if indexFocus > OperationsManager.OperationsCount-1 then
indexFocus := OperationsManager.OperationsCount-1; //Åñëè ôîêóñ óøåë çà ïðåäåëû, òî äåëàåì åãî ïîñëåäíèì
if OperationsManager.OperationsCount=0 then
begin
CurrentOperationPanel.Enabled:=false;
AllOperationPanel.Enabled:=false;
end
else
begin
CurrentOperationPanel.Enabled:=true;
AllOperationPanel.Enabled:=true;
end;
AllProgressBar.Position:= OperationsManager.AllProgressPoint;
if AllProgressBar.Position <> 0 then
AllProgressLabel.Caption:= 'Progress all operation '+ IntToStr(AllProgressBar.Position)+' %'
else
AllProgressLabel.Caption:= 'All operation complete';
for i := 0 to OperationsManager.OperationsCount - 1 do
begin
// Timer is called from main thread, so it is safe
@ -94,6 +201,7 @@ begin
OperationDialog := TfrmFileOp.Create(OperationsManager.GetHandleById(OperationNumber));
OperationDialog.Show;
end;
procedure TfrmViewOperations.sboxOperationsMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
@ -106,14 +214,40 @@ begin
OperationNumber := CursorPos.Y div aRowHeight;
if OperationsManager.OperationsCount > 0 then
begin
case Button of
mbMiddle:
OperationsManager.MoveOperation(OperationNumber, OperationNumber - 1);
begin
if OperationNumber-1>=0 then //ïðîâåðêà, åñëè îïåðàöèÿ ñàìàÿ ïåðâàÿ, òî íàâåðõ óæå íå ñäâèíåøü(((
begin
if (OperationNumber = indexFocus) or (OperationNumber-1 = indexFocus) then // èçìåíÿåì ôîêóñ, åñëè íà îäíîé èç ôóíêöèé áûë ôîêóñ
begin
if OperationNumber=indexFocus then indexFocus:=indexFocus-1 else indexFocus:=indexFocus+1;
end;
OperationsManager.MoveOperation(OperationNumber, OperationNumber - 1);
end;
end;
mbRight:
OperationsManager.MoveOperation(OperationNumber, OperationNumber + 1);
begin
if OperationNumber<OperationsManager.OperationsCount-1 then //åñëè îïåðàöèÿ ïîñëåäíÿÿ, òî íè÷åãî óæå íå ñäåëàåøü(((
begin
if (OperationNumber = indexFocus) or (OperationNumber+1 = indexFocus) then // èçìåíÿåì ôîêóñ, åñëè íà îäíîé èç ôóíêöèé áûë ôîêóñ
begin
if OperationNumber=indexFocus then indexFocus:=indexFocus+1 else indexFocus:=indexFocus-1;
end;
OperationsManager.MoveOperation(OperationNumber, OperationNumber + 1);
end;
end;
mbLeft:
begin
if OperationNumber< OperationsManager.OperationsCount then indexFocus:=OperationNumber;
end;
end; // case
end;
end;
procedure TfrmViewOperations.sboxOperationsPaint(Sender: TObject);
var
Operation: TFileSourceOperation;
@ -126,6 +260,7 @@ begin
begin
// Timer is called from main thread, so it is safe
// to use reference to Operation from OperationsManager.
Operation := OperationsManager.GetOperationByIndex(i);
if Assigned(Operation) then
begin
@ -160,19 +295,84 @@ begin
sboxOperations.Canvas.TextOut(5, 5 + (aRowHeight * i), OutString);
sboxOperations.Caption := OutString;
sboxOperations.Canvas.Brush.Color := clHighlight;
if i<> indexFocus then sboxOperations.Canvas.Brush.Color := clMenu else
begin
sboxOperations.Canvas.Brush.Color := clHighlight; // èçìåíåíèå öâåòà ïîëîñêè åñëè íà íåé ôîêóñ
CurrentOperationLabel.Caption:=OutString; // çàãàëîâîê äëÿ òåêóùåé îïåðàöèè â CurrentOperation panel îïðåäåëÿåòñÿ èíäåêñîì
if (StartingState in [ossQueueFirst, ossQueueLast, ossQueueIn]) then
CurOpQueueInOut.Caption:='Out' else CurOpQueueInOut.Caption:='In';
if Operation.State=fsosRunning then
StartPauseCurOp.Caption:='||' else StartPauseCurOp.Caption:='Start';
end;
sboxOperations.Canvas.FillRect(
5,
5 + (aRowHeight * i) + sboxOperations.Canvas.TextHeight('Pg'),
5 + (sboxOperations.Width - 10) * Operation.Progress div 100,
aRowHeight * (i + 1) - 5);
end;
end;
end;
procedure TfrmViewOperations.CurOpQueueInOutClick(Sender: TObject);
var
Operation: TFileSourceOperation;
begin
if (OperationsManager.GetStartingState(OperationsManager.GetHandleById(indexFocus)) in [ossQueueFirst, ossQueueLast, ossQueueIn]) then
begin
CurOpQueueInOut.Caption:= 'In';
end
else
begin
OperationsManager.SetToQueue(OperationsManager.GetHandleById(indexFocus));
CurOpQueueInOut.Caption:= 'Out';
end;
end;
procedure TfrmViewOperations.StartPauseCurOpClick(Sender: TObject);
begin
if OperationsManager.GetOperationByIndex(indexFocus).State=fsosRunning then
begin
OperationsManager.GetOperationByIndex(indexFocus).pause;
StartPauseCurOp.Caption:= 'Start';
OperationsManager.CheckQueuedOperations;
end
else
begin
OperationsManager.GetOperationByIndex(indexFocus).Start;
StartPauseCurOp.Caption:= '||';
end;
end;
procedure TfrmViewOperations.StartQueueClick(Sender: TObject);
begin
OperationsManager.CheckQueuedOperations;
end;
procedure TfrmViewOperations.UpCurOpClick(Sender: TObject);
begin
if indexFocus>0 then
begin
OperationsManager.MoveOperation(indexFocus, indexFocus - 1);
indexFocus:= indexFocus-1;
end;
end;
procedure TfrmViewOperations.UpdateView(Operation: TFileSourceOperation;
Event: TOperationManagerEvent);
begin
if OperationsManager.OperationsCount=0 then
begin
indexFocus:=-1; //ñáðîñ èíäåêñà è
CurrentOperationLabel.Caption:='Caption of operation'; // çàãîëîâêà, åñëè íåò îïåðàöèé â ôîíå
end;
lblCount.Caption := IntToStr(OperationsManager.OperationsCount);
sboxOperations.Invalidate; // force redraw
end;

View file

@ -29,13 +29,14 @@ type
//<en unless there are no other operations working.
//<en Will be started when there are no operation running.
//<en This option will put the operation to the head of the queue.
ossQueueLast //<en Same as ossQueueFirst, but this option will put the
ossQueueLast, //<en Same as ossQueueFirst, but this option will put the
//<en operation to the back of the queue.
ossQueueIn //<en insert operation to queue.
);
const
OperationStartingStateText: array[TOperationStartingState] of string =
('', rsOperManualStart, rsOperAutoStart, rsOperQueue, rsOperQueue);
('', rsOperManualStart, rsOperAutoStart, rsOperQueue, rsOperQueue, rsOperQueue);
type
@ -45,6 +46,9 @@ type
Operation : TFileSourceOperation;
Handle : TOperationHandle;
StartingState: TOperationStartingState;
Form : Boolean;
PauseRunning : Boolean;
end;
TOperationManagerEvent =
@ -63,6 +67,9 @@ type
Executes them, stores threads, allows querying active operations
(meaning operations being executed).
}
{ TOperationsManager }
TOperationsManager = class
private
FOperations: TFPList; //<en List of TOperationsManagerEntry
@ -78,11 +85,7 @@ type
function GetEntryByHandle(Handle: TOperationHandle): POperationsManagerEntry;
function GetEntryByOperation(Operation: TFileSourceOperation): POperationsManagerEntry;
{en
Checks if there is any queued operation and if all other operations
are stopped, then the next queued operations is started.
}
procedure CheckQueuedOperations;
{en
Returns @true if there is at least one operation currently running.
@ -106,6 +109,23 @@ type
constructor Create;
destructor Destroy; override;
{en
Checks if there is any queued operation and if all other operations
are stopped, then the next queued operations is started.
}
procedure CheckQueuedOperations;
{ru
Äîáàâëÿåò îïåðàöèþ â î÷åðåäü ïî åå Handle
}
procedure SetToQueue (Handle: TOperationHandle);
procedure SetFormCreate (Handle: TOperationHandle; setForm: boolean);
procedure SetPauseRunning (Handle: TOperationHandle; setForm: boolean);
function AddOperation(Operation: TFileSourceOperation;
StartingState: TOperationStartingState): TOperationHandle;
@ -123,7 +143,8 @@ type
function GetOperationByHandle(Handle: TOperationHandle): TFileSourceOperation;
function GetHandleById(Index: Integer): TOperationHandle;
function GetStartingState(Handle: TOperationHandle): TOperationStartingState;
function GetFormCreate (Handle: TOperationHandle): boolean;
function GetPauseRunning (Handle: TOperationHandle): boolean;
{en
Changes the entry's (and thus operation's) position in the list.
It is used to change the order of execution of queued operations.
@ -132,6 +153,13 @@ type
}
procedure MoveOperation(FromIndex: Integer; ToIndex: Integer);
procedure CancelAll;
procedure StartAll;
procedure PauseAll;
procedure PauseRunning;
procedure StartRunning;
function AllProgressPoint: Integer;
{en
This function is used to check if the pointer to an operation is still
valid. If an operation is registered in OperationsManager the function
@ -229,6 +257,8 @@ begin
Entry^.Thread := Thread;
Entry^.Handle := GetNextUnusedHandle;
Entry^.StartingState := StartingState;
Entry^.Form := True;
Entry^.PauseRunning := False;
if StartingState = ossQueueFirst then
FOperations.Insert(0, Entry) // Insert at the top of the queue.
@ -252,7 +282,7 @@ begin
StartOperation(Entry);
end;
ossQueueFirst, ossQueueLast:
ossQueueFirst, ossQueueLast, ossQueueIn:
begin
if not AreOperationsRunning then
StartOperation(Entry)
@ -373,6 +403,53 @@ begin
Result := ossInvalid;
end;
function TOperationsManager.GetFormCreate (Handle: TOperationHandle): boolean;
var
Entry: POperationsManagerEntry = nil;
begin
Entry := GetEntryByHandle(Handle);
if Assigned(Entry) then
Result := Entry^.Form;
end;
function TOperationsManager.GetPauseRunning (Handle: TOperationHandle): boolean;
var
Entry: POperationsManagerEntry = nil;
begin
Entry := GetEntryByHandle(Handle);
if Assigned(Entry) then
Result := Entry^.PauseRunning;
end;
procedure TOperationsManager.SetPauseRunning (Handle: TOperationHandle; setForm: boolean);
var
Entry: POperationsManagerEntry = nil;
begin
Entry := GetEntryByHandle(Handle);
if Assigned(Entry) then
Entry^.PauseRunning := setForm;
end;
procedure TOperationsManager.SetFormCreate (Handle: TOperationHandle; setForm: boolean);
var
Entry: POperationsManagerEntry = nil;
begin
Entry := GetEntryByHandle(Handle);
if Assigned(Entry) then
Entry^.Form := setForm;
end;
procedure TOperationsManager.SetToQueue (Handle: TOperationHandle);
var
Entry: POperationsManagerEntry = nil;
begin
Entry := GetEntryByHandle(Handle);
if Assigned(Entry) then
Entry^.StartingState := ossQueueIn;
end;
function TOperationsManager.GetNextUnusedHandle: TOperationHandle;
begin
// Handles are consecutively incremented.
@ -437,8 +514,9 @@ begin
begin
Entry := POperationsManagerEntry(FOperations.Items[i]);
if (Entry^.StartingState in [ossQueueFirst, ossQueueLast]) and
(Entry^.Operation.State = fsosNotStarted) then
if (Entry^.StartingState in [ossQueueFirst, ossQueueLast, ossQueueIn]) then
// and (Entry^.Operation.State = fsosNotStarted)
begin
StartOperation(Entry);
Exit;
@ -456,8 +534,8 @@ begin
for Index := 0 to FOperations.Count - 1 do
begin
Entry := POperationsManagerEntry(FOperations.Items[Index]);
if not (Entry^.Operation.State in [fsosNotStarted, fsosStopped]) then
// (Entry^.Operation.State in [fsosNotStarted, fsosStopped])
if Entry^.Operation.State = fsosRunning then
Exit(True); // There is an operation running.
end;
Result := False;
@ -486,6 +564,116 @@ begin
end;
end;
procedure TOperationsManager.CancelAll;
var
Operation: TFileSourceOperation;
i: Integer;
begin
// Cancell all operations
for i := 0 to OperationsCount - 1 do
begin
Operation := OperationsManager.GetOperationByIndex(i);
if Assigned(Operation) then
begin
Operation.Stop;
end;
end;
end;
procedure TOperationsManager.StartAll;
var
Operation: TFileSourceOperation;
i: Integer;
begin
// Start all operations
for i := 0 to OperationsCount - 1 do
begin
Operation := OperationsManager.GetOperationByIndex(i);
if Assigned(Operation) then
begin
Operation.Start;
end;
end;
end;
procedure TOperationsManager.PauseAll;
var
Operation: TFileSourceOperation;
i: Integer;
begin
// Pause all operations
for i := 0 to OperationsCount do
begin
Operation := OperationsManager.GetOperationByIndex(i);
if Assigned(Operation) then
begin
Operation.Pause;
end;
end;
end;
procedure TOperationsManager.PauseRunning;
var
Operation: TFileSourceOperation;
i: Integer;
//true - operation was runnig
begin
for i := 0 to OperationsCount - 1 do
begin
Operation := OperationsManager.GetOperationByIndex(i);
if Assigned(Operation) then
begin
if Operation.State = fsosRunning then
begin
SetPauseRunning(OperationsManager.GetHandleById(i), True); //Çàïîìèíàåì ñòðîêó êîòîðóþ ïðèîñòàíîâèëè
Operation.Pause;
end;
end;
end;
end;
procedure TOperationsManager.StartRunning;
var
Operation: TFileSourceOperation;
I: Integer;
StartOp: Boolean = False;
begin
for I := 0 to OperationsCount - 1 do
begin
Operation := GetOperationByIndex(I);
if Assigned(Operation) then
begin
if GetPauseRunning (OperationsManager.GetHandleById(I)) = True then //Âñïîìèíàåì îñòàíîâëåííóþ ñòðîêó è çàïóñêàåì
begin
Operation.Start;
StartOp:= True; //Ïîìåòêà, ÷òî åñòü çàïóùåííàÿ îïåðàöèÿ
end;
end;
end;
if not StartOp then OperationsManager.GetOperationByIndex(0).Start; //åñëè íåò äî ýòîãî çàïóùåííûõ, òî çàïóñêàåì ïåðâóþ
end;
function TOperationsManager.AllProgressPoint: Integer;
var
Operation: TFileSourceOperation;
i, n, AllProgressCur: Integer;
begin
n:= 0;
for i := 0 to OperationsCount - 1 do
begin
Operation := OperationsManager.GetOperationByIndex(i);
if Assigned(Operation) then
n:= n + Operation.Progress // calculate allProgressBar
else
AllProgressCur:= 0 ; // åñëè ôîíîâûõ îïåðàöèé íåò, òî ïðîãðåññà òîæå íåò
end;
if OperationsManager.OperationsCount<>0 then
AllProgressCur:= Round(n / OperationsManager.OperationsCount); // Ïîêàçûâàåì ñðåäíèé ïðîãðåññ
Result := AllProgressCur;
end;
function TOperationsManager.OperationExists(Operation: TFileSourceOperation): Boolean;
var
Entry: POperationsManagerEntry = nil;

View file

@ -101,7 +101,10 @@ var
gLogWindow,
gTermWindow,
gKeyButtons,
gInterfaceFlat : Boolean;
gInterfaceFlat,
gDriveInd,
gProgInMenuBar,
gPanelOfOp: Boolean;
{ Toolbar }
gToolBarButtonSize,
@ -564,6 +567,9 @@ begin
gTermWindow := False;
gKeyButtons := True;
gInterfaceFlat := True;
gDriveInd := True;
gProgInMenuBar := False;
gPanelOfOp := True;
{ File operations page }
gCopyBlockSize := 65536;
@ -1325,6 +1331,9 @@ begin
gTermWindow := GetValue(Node, 'TermWindow', gTermWindow);
gKeyButtons := GetValue(Node, 'KeyButtons', gKeyButtons);
gInterfaceFlat := GetValue(Node, 'InterfaceFlat', gInterfaceFlat);
gDriveInd := GetValue(Node, 'DriveIndicator', gDriveInd);
gProgInMenuBar := GetValue(Node, 'ProgressInMenuBar', gProgInMenuBar);
gPanelOfOp := GetValue(Node, 'PanelOfOperationsInBackground', gPanelOfOp);
end;
{ File operations page }
@ -1553,7 +1562,9 @@ begin
SetValue(Node, 'TermWindow', gTermWindow);
SetValue(Node, 'KeyButtons', gKeyButtons);
SetValue(Node, 'InterfaceFlat', gInterfaceFlat);
SetValue(Node, 'DriveIndicator', gDriveInd);
SetValue(Node, 'ProgressInMenuBar', gProgInMenuBar);
SetValue(Node, 'PanelOfOperationsInBackground', gPanelOfOp);
{ File operations page }
Node := FindNode(Root, 'FileOperations', True);
SetValue(Node, 'BufferSize', gCopyBlockSize);