Changeset 432


Ignore:
Timestamp:
Oct 25, 2012, 2:11:47 PM (12 years ago)
Author:
chronos
Message:
Location:
Common
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • Common/Common.lpk

    r393 r432  
    2222    <License Value="GNU/GPL"/>
    2323    <Version Minor="7"/>
    24     <Files Count="15">
     24    <Files Count="17">
    2525      <Item1>
    2626        <Filename Value="StopWatch.pas"/>
     
    8787        <UnitName Value="UApplicationInfo"/>
    8888      </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>
    8997    </Files>
    9098    <i18n>
  • Common/Common.pas

    r393 r432  
    1010  StopWatch, UCommon, UDebugLog, UDelay, UPrefixMultiplier, UURI, UThreading,
    1111  UMemory, UResetableThread, UPool, ULastOpenedList, URegistry,
    12   UJobProgressView, UXMLUtils, UApplicationInfo, LazarusPackageIntf;
     12  UJobProgressView, UXMLUtils, UApplicationInfo, USyncCounter, UListViewSort,
     13  LazarusPackageIntf;
    1314
    1415implementation
  • Common/UJobProgressView.lfm

    r371 r432  
    2828    object LabelOperation: TLabel
    2929      Left = 8
    30       Height = 14
     30      Height = 13
    3131      Top = 8
    32       Width = 67
     32      Width = 66
    3333      Caption = 'Operations:'
    3434      Font.Height = -11
     
    8080    object LabelEstimatedTimePart: TLabel
    8181      Left = 8
    82       Height = 14
     82      Height = 13
    8383      Top = -2
    84       Width = 72
     84      Width = 71
    8585      Caption = 'Estimated time:'
    8686      ParentColor = False
     
    132132    object LabelEstimatedTimeTotal: TLabel
    133133      Left = 8
    134       Height = 14
     134      Height = 13
    135135      Top = 0
    136       Width = 98
     136      Width = 97
    137137      Caption = 'Total estimated time:'
    138138      ParentColor = False
  • Common/UJobProgressView.pas

    r378 r432  
    111111    Finished: Boolean;
    112112    FOnJobFinish: TJobProgressViewMethod;
     113    FOnOwnerDraw: TNotifyEvent;
     114    FOwnerDraw: Boolean;
    113115    FShowDelay: Integer;
    114116    FTerminate: Boolean;
     
    116118    TotalStartTime: TDateTime;
    117119    Log: TStringList;
    118     Form: TFormJobProgressView;
    119120    procedure SetTerminate(const AValue: Boolean);
    120121    procedure UpdateProgress;
     
    122123    procedure StartJobs;
    123124    procedure UpdateHeight;
     125    procedure JobProgressChange(Sender: TObject);
    124126  public
     127    Form: TFormJobProgressView;
    125128    Jobs: TObjectList; // TListObject<TJob>
    126129    CurrentJob: TJob;
     
    136139    property Terminate: Boolean read FTerminate write SetTerminate;
    137140  published
     141    property OwnerDraw: Boolean read FOwnerDraw write FOwnerDraw;
    138142    property ShowDelay: Integer read FShowDelay write FShowDelay;
    139143    property AutoClose: Boolean read FAutoClose write FAutoClose;
    140144    property OnJobFinish: TJobProgressViewMethod read FOnJobFinish
    141145      write FOnJobFinish;
     146    property OnOwnerDraw: TNotifyEvent read FOnOwnerDraw
     147      write FOnOwnerDraw;
    142148  end;
    143149
     
    196202  NewJob.Progress.Max := 100;
    197203  NewJob.Progress.Reset;
     204  NewJob.Progress.OnChange := JobProgressChange;
    198205  Jobs.Add(NewJob);
    199206  //ReloadJobList;
     
    212219  Terminate := False;
    213220
    214   Form.BringToFront;
     221  if not OwnerDraw then Form.BringToFront;
    215222
    216223  Finished := False;
     
    244251      CurrentJobIndex := I;
    245252      CurrentJob := TJob(Jobs[I]);
     253      JobProgressChange(Self);
    246254      StartTime := Now;
    247255      Form.LabelEstimatedTimePart.Caption := Format(SEstimatedTime, ['']);
     
    339347end;
    340348
     349procedure TJobProgressView.JobProgressChange(Sender: TObject);
     350begin
     351  if Assigned(FOnOwnerDraw) then
     352    FOnOwnerDraw(Self);
     353end;
     354
    341355procedure TFormJobProgressView.TimerUpdateTimer(Sender: TObject);
    342356var
     
    357371  if not Visible then begin
    358372    TimerUpdate.Interval := UpdateInterval;
    359     Show;
     373    if not JobProgressView.OwnerDraw then Show;
    360374  end;
    361375end;
     
    509523destructor TJobProgressView.Destroy;
    510524begin
    511   Log.Free;
    512   Jobs.Free;
    513   inherited Destroy;
     525  FreeAndNil(Log);
     526  FreeAndNil(Jobs);
     527  inherited;
    514528end;
    515529
     
    519533    FLock.Acquire;
    520534    FMax := AValue;
     535    if FMax < 1 then FMax := 1;
    521536    if FValue >= FMax then FValue := FMax;
    522537  finally
     
    610625begin
    611626  Progress.Free;
    612   inherited Destroy;
     627  inherited;
    613628end;
    614629
  • Common/ULastOpenedList.pas

    r402 r432  
    1818    procedure SetMaxCount(AValue: Integer);
    1919    procedure LimitMaxCount;
     20    procedure ItemsChange(Sender: TObject);
     21    procedure DoChange;
    2022  public
    2123    Items: TStringList;
     
    5860end;
    5961
     62procedure TLastOpenedList.ItemsChange(Sender: TObject);
     63begin
     64  DoChange;
     65end;
     66
     67procedure TLastOpenedList.DoChange;
     68begin
     69  if Assigned(FOnChange) then
     70    FOnChange(Self);
     71end;
     72
    6073constructor TLastOpenedList.Create(AOwner: TComponent);
    6174begin
    6275  inherited;
    6376  Items := TStringList.Create;
     77  Items.OnChange := ItemsChange;
    6478  MaxCount := 10;
    6579end;
     
    134148  Items.Insert(0, FileName);
    135149  LimitMaxCount;
    136   if Assigned(FOnChange) then
    137     FOnChange(Self);
     150  DoChange;
    138151end;
    139152
  • Common/UMemory.pas

    r405 r432  
    2424    constructor Create;
    2525    destructor Destroy; override;
    26     procedure WriteMemory(Position: Integer; Memory: TMemory);
    27     procedure ReadMemory(Position: Integer; Memory: TMemory);
    2826    property Data: PByte read FData;
    2927    property Size: Integer read FSize write SetSize;
     
    110108end;
    111109
    112 procedure TMemory.WriteMemory(Position: Integer; Memory: TMemory);
    113 begin
    114   Move(Memory.FData, PByte(@FData + Position)^, Memory.Size);
    115 end;
    116 
    117 procedure TMemory.ReadMemory(Position: Integer; Memory: TMemory);
    118 begin
    119   Move(PByte(@FData + Position)^, Memory.FData, Memory.Size);
    120 end;
    121 
    122110end.
    123111
  • Common/URegistry.pas

    r404 r432  
    2626  TRegistryEx = class(TRegistry)
    2727  private
     28    function GetContext: TRegistryContext;
     29    procedure SetContext(AValue: TRegistryContext);
    2830  public
    2931    function ReadBoolWithDefault(const Name: string;
     
    3537    function DeleteKeyRecursive(const Key: string): Boolean;
    3638    function OpenKey(const Key: string; CanCreate: Boolean): Boolean;
     39    property Context: TRegistryContext read GetContext write SetContext;
    3740  end;
    3841
     
    106109end;
    107110
     111function TRegistryEx.GetContext: TRegistryContext;
     112begin
     113  Result.Key := CurrentPath;
     114  Result.RootKey := RootKey;
     115end;
     116
     117procedure TRegistryEx.SetContext(AValue: TRegistryContext);
     118begin
     119  RootKey := AValue.RootKey;
     120  OpenKey(AValue.Key, True);
     121end;
     122
    108123function TRegistryEx.ReadBoolWithDefault(const Name: string;
    109124  DefaultValue: Boolean): Boolean;
  • Common/UResetableThread.pas

    r367 r432  
    104104
    105105procedure TResetableThread.WaitForStart;
    106 var
    107   WaitResult: TWaitResult;
     106//var
     107//  WaitResult: TWaitResult;
    108108begin
    109109  //try
     
    127127
    128128procedure TResetableThread.WaitForStop;
    129 var
    130   WaitState: TWaitResult;
     129//var
     130//  WaitState: TWaitResult;
    131131begin
    132132  try
Note: See TracChangeset for help on using the changeset viewer.