Changeset 509


Ignore:
Timestamp:
Apr 3, 2018, 6:03:19 PM (6 years ago)
Author:
chronos
Message:
  • Modified: Better color themning.
  • Added: Files search function with filtering.
Location:
Common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Common/UCommon.pas

    r502 r509  
    2828    unfDNSDomainName = 11);
    2929
     30  TFilterMethodMethod = function (FileName: string): Boolean of object;
    3031var
    3132  ExceptionHandler: TExceptionEvent;
     
    7172function MergeArray(A, B: array of string): TArrayOfString;
    7273function LoadFileToStr(const FileName: TFileName): AnsiString;
     74procedure SearchFiles(AList: TStrings; Dir: string;
     75  FilterMethod: TFilterMethodMethod);
    7376
    7477
     
    514517end;
    515518
     519function DefaultSearchFilter(const FileName: string): Boolean;
     520begin
     521  Result := True;
     522end;
     523
     524procedure SearchFiles(AList: TStrings; Dir: string;
     525  FilterMethod: TFilterMethodMethod);
     526var
     527  SR: TSearchRec;
     528begin
     529  Dir := IncludeTrailingPathDelimiter(Dir);
     530  if FindFirst(Dir + '*', faAnyFile, SR) = 0 then
     531    try
     532      repeat
     533        if (SR.Name = '.') or (SR.Name = '..') or not FilterMethod(SR.Name) then Continue;
     534        AList.Add(Dir + SR.Name);
     535        if (SR.Attr and faDirectory) <> 0 then
     536          SearchFiles(AList, Dir + SR.Name, FilterMethod);
     537      until FindNext(SR) <> 0;
     538    finally
     539      FindClose(SR);
     540    end;
     541end;
    516542
    517543
  • Common/UTheme.pas

    r506 r509  
    132132  I: Integer;
    133133begin
    134   for I := 0 to Component.ComponentCount - 1 do
    135     ApplyTheme(Component.Components[I]);
     134  if Component is TWinControl then begin
     135    for I := 0 to TWinControl(Component).ControlCount - 1 do
     136      ApplyTheme(TWinControl(Component).Controls[I]);
     137  end;
    136138
    137139  if Component is TControl then begin
     
    139141    if (Control is TEdit) or (Control is TSpinEdit) or (Control is TComboBox) and
    140142    (Control is TMemo) or (Control is TListView) or (Control is TCustomDrawGrid) or
    141     (Control is TCheckBox) then begin
     143    (Control is TCheckBox) or (Control is TPageControl) or (Control is TRadioButton) then begin
    142144      Control.Color := FTheme.ColorWindow;
    143145      Control.Font.Color := FTheme.ColorWindowText;
     
    150152      (Control as TCustomDrawGrid).Editor.Color := FTheme.ColorWindow;
    151153      (Control as TCustomDrawGrid).Editor.Font.Color := FTheme.ColorWindowText;
     154    end;
     155
     156    if Control is TPageControl then begin
     157      for I := 0 to TPageControl(Component).PageCount - 1 do
     158        ApplyTheme(TPageControl(Component).Pages[I]);
    152159    end;
    153160  end;
Note: See TracChangeset for help on using the changeset viewer.