mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
UPD: Operations panel: Show operations viewer or progress window with left mouse button. Pause/unpause queue or operation with middle button.
This commit is contained in:
parent
b768b36b44
commit
1b4c7fbfdd
2 changed files with 48 additions and 11 deletions
|
|
@ -134,13 +134,16 @@ type
|
|||
function GetFocusedItem: TViewBaseItem;
|
||||
procedure MoveWithinQueue(MoveToTop: Boolean);
|
||||
procedure SetFocusItem(AOperationHandle: TOperationHandle);
|
||||
procedure SetFocusItem(AQueueIdentifier: TOperationsManagerQueueIdentifier);
|
||||
procedure SetNewQueue(Item: TViewOperationItem; NewQueue: TOperationsManagerQueueIdentifier);
|
||||
procedure SetStartPauseCaption(SetPause: Boolean);
|
||||
procedure UpdateView(Item: TOperationsManagerItem; Event: TOperationManagerEvent);
|
||||
procedure UpdateItems;
|
||||
end;
|
||||
|
||||
procedure ShowOperationsViewer(AOperationHandle: TOperationHandle = InvalidOperationHandle);
|
||||
procedure ShowOperationsViewer;
|
||||
procedure ShowOperationsViewer(AOperationHandle: TOperationHandle);
|
||||
procedure ShowOperationsViewer(AQueueIdentifier: TOperationsManagerQueueIdentifier);
|
||||
|
||||
implementation
|
||||
|
||||
|
|
@ -172,15 +175,26 @@ var
|
|||
frmViewOperations: TfrmViewOperations = nil;
|
||||
ProgressRight: Integer;
|
||||
|
||||
procedure ShowOperationsViewer(AOperationHandle: TOperationHandle);
|
||||
procedure ShowOperationsViewer;
|
||||
begin
|
||||
if not Assigned(frmViewOperations) then
|
||||
frmViewOperations := TfrmViewOperations.Create(Application);
|
||||
frmViewOperations.ShowOnTop;
|
||||
end;
|
||||
|
||||
procedure ShowOperationsViewer(AOperationHandle: TOperationHandle);
|
||||
begin
|
||||
ShowOperationsViewer;
|
||||
if AOperationHandle <> InvalidOperationHandle then
|
||||
frmViewOperations.SetFocusItem(AOperationHandle);
|
||||
end;
|
||||
|
||||
procedure ShowOperationsViewer(AQueueIdentifier: TOperationsManagerQueueIdentifier);
|
||||
begin
|
||||
ShowOperationsViewer;
|
||||
frmViewOperations.SetFocusItem(AQueueIdentifier);
|
||||
end;
|
||||
|
||||
procedure ApplyProgress(var ARect: TRect; Progress: Double);
|
||||
begin
|
||||
ARect.Right := ARect.Left + Round((ARect.Right - ARect.Left) * Progress);
|
||||
|
|
@ -984,6 +998,21 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmViewOperations.SetFocusItem(AQueueIdentifier: TOperationsManagerQueueIdentifier);
|
||||
var
|
||||
Node: TTreeNode;
|
||||
begin
|
||||
for Node in tvOperations.Items do
|
||||
begin
|
||||
if (TViewBaseItem(Node.Data) is TViewQueueItem) and
|
||||
(TViewQueueItem(Node.Data).FQueueIdentifier = AQueueIdentifier) then
|
||||
begin
|
||||
Node.Selected := True;
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmViewOperations.SetNewQueue(Item: TViewOperationItem; NewQueue: TOperationsManagerQueueIdentifier);
|
||||
var
|
||||
OpManItem: TOperationsManagerItem;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ type
|
|||
procedure ProgressWindowEvent(OperationHandle: TOperationHandle;
|
||||
Event: TOperationProgressWindowEvent);
|
||||
procedure StartPauseOperation(Operation: TFileSourceOperation);
|
||||
procedure StartPauseQueue(Queue: TOperationsManagerQueue);
|
||||
procedure UpdateItems;
|
||||
procedure UpdateVisibility;
|
||||
public
|
||||
|
|
@ -62,6 +63,7 @@ implementation
|
|||
|
||||
uses
|
||||
LCLIntf, LCLType, Math,
|
||||
fViewOperations,
|
||||
uDCUtils, uLng;
|
||||
|
||||
const
|
||||
|
|
@ -303,13 +305,11 @@ var
|
|||
begin
|
||||
if Item^.OperationHandle = InvalidOperationHandle then
|
||||
begin
|
||||
OpManItem := Queue.Items[0];
|
||||
if Assigned(OpManItem) then
|
||||
begin
|
||||
case Button of
|
||||
mbLeft:
|
||||
StartPauseOperation(OpManItem.Operation);
|
||||
end;
|
||||
case Button of
|
||||
mbLeft:
|
||||
ShowOperationsViewer(Item^.QueueId);
|
||||
mbMiddle:
|
||||
StartPauseQueue(Queue);
|
||||
end;
|
||||
end
|
||||
else
|
||||
|
|
@ -319,9 +319,9 @@ var
|
|||
begin
|
||||
case Button of
|
||||
mbLeft:
|
||||
StartPauseOperation(OpManItem.Operation);
|
||||
mbMiddle:
|
||||
TfrmFileOp.ShowFor(OpManItem.Handle);
|
||||
mbMiddle:
|
||||
StartPauseOperation(OpManItem.Operation);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
|
@ -479,6 +479,14 @@ begin
|
|||
Operation.Start;
|
||||
end;
|
||||
|
||||
procedure TOperationsPanel.StartPauseQueue(Queue: TOperationsManagerQueue);
|
||||
begin
|
||||
if Queue.Paused then
|
||||
Queue.UnPause
|
||||
else
|
||||
Queue.Pause;
|
||||
end;
|
||||
|
||||
procedure TOperationsPanel.UpdateView;
|
||||
begin
|
||||
Invalidate;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue