Ignore:
Timestamp:
Jun 21, 2007, 12:24:04 AM (17 years ago)
Author:
alloc
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • oup/current/Tools/_TemplateFileList.pas

    r230 r231  
    99
    1010type
     11  TNewFileSelectingEvent = procedure(FileInfo: TFileInfo; var allowed: Boolean) of object;
     12
    1113  TForm_TemplateFileList = class(TForm_TemplateFile)
    1214    panel_files: TPanel;
     
    6264      const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
    6365      TextType: TVSTTextType);
     66    procedure filelist_metaFocusChanging(Sender: TBaseVirtualTree; OldNode,
     67      NewNode: PVirtualNode; OldColumn, NewColumn: TColumnIndex;
     68      var Allowed: Boolean);
     69    procedure filelist_metaFocusChanged(Sender: TBaseVirtualTree;
     70      Node: PVirtualNode; Column: TColumnIndex);
    6471  private
    6572    FSortBy: TSortType;
    6673    FAllowedExts: String;
    6774    FAllowMultiSelect: Boolean;
     75    FOnNewFileSelecting: TNewFileSelectingEvent;
    6876    procedure SetAllowedExts(exts: String);
    6977    procedure SetMultiSelect(allow: Boolean);
     
    7583    property AllowedExts: String read FAllowedExts write SetAllowedExts;
    7684    property AllowMultiSelect: Boolean read FAllowMultiSelect write SetMultiSelect;
     85    property OnNewFileSelecting: TNewFileSelectingEvent read FOnNewFileSelecting write FOnNewFileSelecting;
    7786  end;
    7887
     
    404413
    405414
     415procedure TForm_TemplateFileList.filelist_metaFocusChanged(
     416  Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex);
     417var
     418  data: PNodeData;
     419begin
     420  inherited;
     421  data := Sender.GetNodeData(Node);
     422  if data.Field is TFile then
     423  begin
     424    if Assigned(FOnNewFileSelected) then
     425    begin
     426      FOnNewFileSelected(TFile(data.Field).FileInfo);
     427    end;
     428  end;
     429end;
     430
     431procedure TForm_TemplateFileList.filelist_metaFocusChanging(
     432  Sender: TBaseVirtualTree; OldNode, NewNode: PVirtualNode; OldColumn,
     433  NewColumn: TColumnIndex; var Allowed: Boolean);
     434var
     435  data: PNodeData;
     436begin
     437  inherited;
     438  data := Sender.GetNodeData(NewNode);
     439  if data.Field is TFile then
     440  begin
     441    if Assigned(FOnNewFileSelecting) then
     442    begin
     443      FOnNewFileSelecting(TFile(data.Field).FileInfo, Allowed);
     444    end;
     445  end;
     446end;
     447
    406448procedure TForm_TemplateFileList.filelist_metaGetText(Sender: TBaseVirtualTree;
    407449  Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
     
    418460  if data.Field is TFile then
    419461  begin
    420     if TFile(data.Field).FileName = '' then
    421       CellText := TFile(data.Field).FileExt + ' (unnamed)'
     462    if TFile(data.Field).FileInfo.Name = '' then
     463      CellText := TFile(data.Field).FileInfo.Extension + ' (unnamed)'
    422464    else
    423       CellText := TFile(data.Field).FileExt + ': ' + TFile(data.Field).FileName;
     465      CellText := TFile(data.Field).FileInfo.Extension + ': ' + TFile(data.Field).FileInfo.Name;
    424466  end;
    425467end;
     
    479521  if Data.Field is TFile then
    480522  begin
    481     if Length(TFile(Data.Field).FileName) = 0 then
     523    if Length(TFile(Data.Field).FileInfo.Name) = 0 then
    482524      TargetCanvas.Font.Color := $C06060;
    483     if TFile(Data.Field).FileSize = 0 then
     525    if TFile(Data.Field).FileInfo.Size = 0 then
    484526      TargetCanvas.Font.Color := $2020A0;
    485527  end;
Note: See TracChangeset for help on using the changeset viewer.