Ignore:
Timestamp:
Nov 25, 2017, 12:27:33 AM (7 years ago)
Author:
chronos
Message:
  • Modified: Improved New game window.
  • Modified: Used newer version of Common and CoolTranslator packages.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        33backup
        44tunneler.exe
         5tunneler.dbg
         6tunneler.lps
        57heaptrclog.trc
        6 tunneler.lps
         8Components/Common/Languages/*.mo
         9Components/CoolTranslator/Demo/lib
  • trunk/Components/Common/UJobProgressView.pas

    r31 r34  
    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
     
    160166  STotalEstimatedTime = 'Total estimated time: %s';
    161167  SFinished = 'Finished';
     168  SOperations = 'Operations';
    162169
    163170procedure Register;
    164171begin
    165   RegisterComponents('Samples', [TJobProgressView]);
     172  RegisterComponents('Common', [TJobProgressView]);
    166173end;
    167174
     
    196203  NewJob.Progress.Max := 100;
    197204  NewJob.Progress.Reset;
     205  NewJob.Progress.OnChange := JobProgressChange;
    198206  Jobs.Add(NewJob);
    199207  //ReloadJobList;
     
    212220  Terminate := False;
    213221
    214   Form.BringToFront;
     222  if not OwnerDraw then Form.BringToFront;
    215223
    216224  Finished := False;
     
    244252      CurrentJobIndex := I;
    245253      CurrentJob := TJob(Jobs[I]);
     254      JobProgressChange(Self);
    246255      StartTime := Now;
    247256      Form.LabelEstimatedTimePart.Caption := Format(SEstimatedTime, ['']);
     
    339348end;
    340349
     350procedure TJobProgressView.JobProgressChange(Sender: TObject);
     351begin
     352  if Assigned(FOnOwnerDraw) then
     353    FOnOwnerDraw(Self);
     354end;
     355
    341356procedure TFormJobProgressView.TimerUpdateTimer(Sender: TObject);
    342357var
     
    357372  if not Visible then begin
    358373    TimerUpdate.Interval := UpdateInterval;
    359     Show;
     374    if not JobProgressView.OwnerDraw then Show;
    360375  end;
    361376end;
     
    509524destructor TJobProgressView.Destroy;
    510525begin
    511   Log.Free;
    512   Jobs.Free;
    513   inherited Destroy;
     526  FreeAndNil(Log);
     527  FreeAndNil(Jobs);
     528  inherited;
    514529end;
    515530
     
    519534    FLock.Acquire;
    520535    FMax := AValue;
     536    if FMax < 1 then FMax := 1;
    521537    if FValue >= FMax then FValue := FMax;
    522538  finally
     
    610626begin
    611627  Progress.Free;
    612   inherited Destroy;
     628  inherited;
    613629end;
    614630
Note: See TracChangeset for help on using the changeset viewer.