- Timestamp:
- Oct 25, 2012, 2:11:47 PM (12 years ago)
- Location:
- Common
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/Common.lpk
r393 r432 22 22 <License Value="GNU/GPL"/> 23 23 <Version Minor="7"/> 24 <Files Count="1 5">24 <Files Count="17"> 25 25 <Item1> 26 26 <Filename Value="StopWatch.pas"/> … … 87 87 <UnitName Value="UApplicationInfo"/> 88 88 </Item15> 89 <Item16> 90 <Filename Value="USyncCounter.pas"/> 91 <UnitName Value="USyncCounter"/> 92 </Item16> 93 <Item17> 94 <Filename Value="UListViewSort.pas"/> 95 <UnitName Value="UListViewSort"/> 96 </Item17> 89 97 </Files> 90 98 <i18n> -
Common/Common.pas
r393 r432 10 10 StopWatch, UCommon, UDebugLog, UDelay, UPrefixMultiplier, UURI, UThreading, 11 11 UMemory, UResetableThread, UPool, ULastOpenedList, URegistry, 12 UJobProgressView, UXMLUtils, UApplicationInfo, LazarusPackageIntf; 12 UJobProgressView, UXMLUtils, UApplicationInfo, USyncCounter, UListViewSort, 13 LazarusPackageIntf; 13 14 14 15 implementation -
Common/UJobProgressView.lfm
r371 r432 28 28 object LabelOperation: TLabel 29 29 Left = 8 30 Height = 1 430 Height = 13 31 31 Top = 8 32 Width = 6 732 Width = 66 33 33 Caption = 'Operations:' 34 34 Font.Height = -11 … … 80 80 object LabelEstimatedTimePart: TLabel 81 81 Left = 8 82 Height = 1 482 Height = 13 83 83 Top = -2 84 Width = 7 284 Width = 71 85 85 Caption = 'Estimated time:' 86 86 ParentColor = False … … 132 132 object LabelEstimatedTimeTotal: TLabel 133 133 Left = 8 134 Height = 1 4134 Height = 13 135 135 Top = 0 136 Width = 9 8136 Width = 97 137 137 Caption = 'Total estimated time:' 138 138 ParentColor = False -
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 -
Common/ULastOpenedList.pas
r402 r432 18 18 procedure SetMaxCount(AValue: Integer); 19 19 procedure LimitMaxCount; 20 procedure ItemsChange(Sender: TObject); 21 procedure DoChange; 20 22 public 21 23 Items: TStringList; … … 58 60 end; 59 61 62 procedure TLastOpenedList.ItemsChange(Sender: TObject); 63 begin 64 DoChange; 65 end; 66 67 procedure TLastOpenedList.DoChange; 68 begin 69 if Assigned(FOnChange) then 70 FOnChange(Self); 71 end; 72 60 73 constructor TLastOpenedList.Create(AOwner: TComponent); 61 74 begin 62 75 inherited; 63 76 Items := TStringList.Create; 77 Items.OnChange := ItemsChange; 64 78 MaxCount := 10; 65 79 end; … … 134 148 Items.Insert(0, FileName); 135 149 LimitMaxCount; 136 if Assigned(FOnChange) then 137 FOnChange(Self); 150 DoChange; 138 151 end; 139 152 -
Common/UMemory.pas
r405 r432 24 24 constructor Create; 25 25 destructor Destroy; override; 26 procedure WriteMemory(Position: Integer; Memory: TMemory);27 procedure ReadMemory(Position: Integer; Memory: TMemory);28 26 property Data: PByte read FData; 29 27 property Size: Integer read FSize write SetSize; … … 110 108 end; 111 109 112 procedure TMemory.WriteMemory(Position: Integer; Memory: TMemory);113 begin114 Move(Memory.FData, PByte(@FData + Position)^, Memory.Size);115 end;116 117 procedure TMemory.ReadMemory(Position: Integer; Memory: TMemory);118 begin119 Move(PByte(@FData + Position)^, Memory.FData, Memory.Size);120 end;121 122 110 end. 123 111 -
Common/URegistry.pas
r404 r432 26 26 TRegistryEx = class(TRegistry) 27 27 private 28 function GetContext: TRegistryContext; 29 procedure SetContext(AValue: TRegistryContext); 28 30 public 29 31 function ReadBoolWithDefault(const Name: string; … … 35 37 function DeleteKeyRecursive(const Key: string): Boolean; 36 38 function OpenKey(const Key: string; CanCreate: Boolean): Boolean; 39 property Context: TRegistryContext read GetContext write SetContext; 37 40 end; 38 41 … … 106 109 end; 107 110 111 function TRegistryEx.GetContext: TRegistryContext; 112 begin 113 Result.Key := CurrentPath; 114 Result.RootKey := RootKey; 115 end; 116 117 procedure TRegistryEx.SetContext(AValue: TRegistryContext); 118 begin 119 RootKey := AValue.RootKey; 120 OpenKey(AValue.Key, True); 121 end; 122 108 123 function TRegistryEx.ReadBoolWithDefault(const Name: string; 109 124 DefaultValue: Boolean): Boolean; -
Common/UResetableThread.pas
r367 r432 104 104 105 105 procedure TResetableThread.WaitForStart; 106 var107 WaitResult: TWaitResult;106 //var 107 // WaitResult: TWaitResult; 108 108 begin 109 109 //try … … 127 127 128 128 procedure TResetableThread.WaitForStop; 129 var130 WaitState: TWaitResult;129 //var 130 // WaitState: TWaitResult; 131 131 begin 132 132 try
Note:
See TracChangeset
for help on using the changeset viewer.