Changeset 34 for trunk/Components/Common/UJobProgressView.pas
- Timestamp:
- Nov 25, 2017, 12:27:33 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 3 3 backup 4 4 tunneler.exe 5 tunneler.dbg 6 tunneler.lps 5 7 heaptrclog.trc 6 tunneler.lps 8 Components/Common/Languages/*.mo 9 Components/CoolTranslator/Demo/lib
-
- Property svn:ignore
-
trunk/Components/Common/UJobProgressView.pas
r31 r34 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 … … 160 166 STotalEstimatedTime = 'Total estimated time: %s'; 161 167 SFinished = 'Finished'; 168 SOperations = 'Operations'; 162 169 163 170 procedure Register; 164 171 begin 165 RegisterComponents(' Samples', [TJobProgressView]);172 RegisterComponents('Common', [TJobProgressView]); 166 173 end; 167 174 … … 196 203 NewJob.Progress.Max := 100; 197 204 NewJob.Progress.Reset; 205 NewJob.Progress.OnChange := JobProgressChange; 198 206 Jobs.Add(NewJob); 199 207 //ReloadJobList; … … 212 220 Terminate := False; 213 221 214 Form.BringToFront;222 if not OwnerDraw then Form.BringToFront; 215 223 216 224 Finished := False; … … 244 252 CurrentJobIndex := I; 245 253 CurrentJob := TJob(Jobs[I]); 254 JobProgressChange(Self); 246 255 StartTime := Now; 247 256 Form.LabelEstimatedTimePart.Caption := Format(SEstimatedTime, ['']); … … 339 348 end; 340 349 350 procedure TJobProgressView.JobProgressChange(Sender: TObject); 351 begin 352 if Assigned(FOnOwnerDraw) then 353 FOnOwnerDraw(Self); 354 end; 355 341 356 procedure TFormJobProgressView.TimerUpdateTimer(Sender: TObject); 342 357 var … … 357 372 if not Visible then begin 358 373 TimerUpdate.Interval := UpdateInterval; 359 Show;374 if not JobProgressView.OwnerDraw then Show; 360 375 end; 361 376 end; … … 509 524 destructor TJobProgressView.Destroy; 510 525 begin 511 Log.Free;512 Jobs.Free;513 inherited Destroy;526 FreeAndNil(Log); 527 FreeAndNil(Jobs); 528 inherited; 514 529 end; 515 530 … … 519 534 FLock.Acquire; 520 535 FMax := AValue; 536 if FMax < 1 then FMax := 1; 521 537 if FValue >= FMax then FValue := FMax; 522 538 finally … … 610 626 begin 611 627 Progress.Free; 612 inherited Destroy;628 inherited; 613 629 end; 614 630
Note:
See TracChangeset
for help on using the changeset viewer.