Changeset 432 for Common/UJobProgressView.pas
- Timestamp:
- Oct 25, 2012, 2:11:47 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/UJobProgressView.pas
r378 r432 111 111 Finished: Boolean; 112 112 FOnJobFinish: TJobProgressViewMethod; 113 FOnOwnerDraw: TNotifyEvent; 114 FOwnerDraw: Boolean; 113 115 FShowDelay: Integer; 114 116 FTerminate: Boolean; … … 116 118 TotalStartTime: TDateTime; 117 119 Log: TStringList; 118 Form: TFormJobProgressView;119 120 procedure SetTerminate(const AValue: Boolean); 120 121 procedure UpdateProgress; … … 122 123 procedure StartJobs; 123 124 procedure UpdateHeight; 125 procedure JobProgressChange(Sender: TObject); 124 126 public 127 Form: TFormJobProgressView; 125 128 Jobs: TObjectList; // TListObject<TJob> 126 129 CurrentJob: TJob; … … 136 139 property Terminate: Boolean read FTerminate write SetTerminate; 137 140 published 141 property OwnerDraw: Boolean read FOwnerDraw write FOwnerDraw; 138 142 property ShowDelay: Integer read FShowDelay write FShowDelay; 139 143 property AutoClose: Boolean read FAutoClose write FAutoClose; 140 144 property OnJobFinish: TJobProgressViewMethod read FOnJobFinish 141 145 write FOnJobFinish; 146 property OnOwnerDraw: TNotifyEvent read FOnOwnerDraw 147 write FOnOwnerDraw; 142 148 end; 143 149 … … 196 202 NewJob.Progress.Max := 100; 197 203 NewJob.Progress.Reset; 204 NewJob.Progress.OnChange := JobProgressChange; 198 205 Jobs.Add(NewJob); 199 206 //ReloadJobList; … … 212 219 Terminate := False; 213 220 214 Form.BringToFront;221 if not OwnerDraw then Form.BringToFront; 215 222 216 223 Finished := False; … … 244 251 CurrentJobIndex := I; 245 252 CurrentJob := TJob(Jobs[I]); 253 JobProgressChange(Self); 246 254 StartTime := Now; 247 255 Form.LabelEstimatedTimePart.Caption := Format(SEstimatedTime, ['']); … … 339 347 end; 340 348 349 procedure TJobProgressView.JobProgressChange(Sender: TObject); 350 begin 351 if Assigned(FOnOwnerDraw) then 352 FOnOwnerDraw(Self); 353 end; 354 341 355 procedure TFormJobProgressView.TimerUpdateTimer(Sender: TObject); 342 356 var … … 357 371 if not Visible then begin 358 372 TimerUpdate.Interval := UpdateInterval; 359 Show;373 if not JobProgressView.OwnerDraw then Show; 360 374 end; 361 375 end; … … 509 523 destructor TJobProgressView.Destroy; 510 524 begin 511 Log.Free;512 Jobs.Free;513 inherited Destroy;525 FreeAndNil(Log); 526 FreeAndNil(Jobs); 527 inherited; 514 528 end; 515 529 … … 519 533 FLock.Acquire; 520 534 FMax := AValue; 535 if FMax < 1 then FMax := 1; 521 536 if FValue >= FMax then FValue := FMax; 522 537 finally … … 610 625 begin 611 626 Progress.Free; 612 inherited Destroy;627 inherited; 613 628 end; 614 629
Note:
See TracChangeset
for help on using the changeset viewer.