View Issue Details

IDProjectCategoryView StatusLast Update
0002268Double CommanderGraphical user interfacepublic2019-03-19 12:05
ReporterCryHam Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
ProjectionnoneETAnone 
Product Version1.0.0 (trunk)Product Buildr8738 
Summary0002268: [Patch] Find Files results - color by file types
DescriptionMade the Results list color files by type.
(I have lots of entries there, so this is very useful for me).
Included a screenshot and patch for svn 8738.

This is unfinished. There is still an issue here.
I don't know how to read or get file attributes for AFile, before gColorExt.GetColorBy. Would be great to add it too (for dirs, exe, links).
I didn't notice any issue with speed, seems working fast.
TagsNo tags attached.
Attached Files
fFindDlg.patch (2,822 bytes)   
Index: src/fFindDlg.lfm
===================================================================
--- src/fFindDlg.lfm	(revision 8738)
+++ src/fFindDlg.lfm	(working copy)
@@ -1201,6 +1201,7 @@
             ItemHeight = 0
             MultiSelect = True
             OnDblClick = lsFoundedFilesDblClick
+            OnDrawItem = lsFoundedFilesDrawItem
             OnKeyDown = lsFoundedFilesKeyDown
             OnMouseDown = lsFoundedFilesMouseDown
             OnMouseUp = lsFoundedFilesMouseUp
@@ -1207,6 +1208,7 @@
             OnMouseWheelDown = lsFoundedFilesMouseWheelDown
             OnMouseWheelUp = lsFoundedFilesMouseWheelUp
             ScrollWidth = 735
+            Style = lbOwnerDrawFixed
             TabOrder = 1
           end
           object pnlResultsBottom: TPanel
Index: src/fFindDlg.pas
===================================================================
--- src/fFindDlg.pas	(revision 8738)
+++ src/fFindDlg.pas	(working copy)
@@ -234,6 +234,8 @@
     procedure lbSearchTemplatesDblClick(Sender: TObject);
     procedure lbSearchTemplatesSelectionChange(Sender: TObject; {%H-}User: boolean);
     procedure lsFoundedFilesDblClick(Sender: TObject);
+    procedure lsFoundedFilesDrawItem(Control: TWinControl; Index: Integer;
+      ARect: TRect; State: TOwnerDrawState);
     procedure lsFoundedFilesKeyDown(Sender: TObject;
       var Key: word; Shift: TShiftState);
     procedure lsFoundedFilesMouseDown(Sender: TObject; Button: TMouseButton;
@@ -628,6 +630,7 @@
   FAtLeastOneSearchWasDone := False;
   FSearchWithDSXPluginInProgress := False;
   FSearchWithWDXPluginInProgress := False;
+  lsFoundedFiles.Color := gBackColor;
 
   // load language
   cmbNotOlderThanUnit.Items.Add(rsTimeUnitSecond);
@@ -2081,6 +2084,36 @@
   cm_GoToFile([]);
 end;
 
+procedure TfrmFindDlg.lsFoundedFilesDrawItem(Control: TWinControl;
+  Index: Integer; ARect: TRect; State: TOwnerDrawState);
+var
+  aColor: TColor;
+  path: String;
+  AFile: TFile;
+  FileSource: IFileSource;
+begin
+  aColor:= gBackColor;
+  lsFoundedFiles.Canvas.Brush.Color:= aColor;
+  lsFoundedFiles.Canvas.FillRect(ARect);
+  lsFoundedFiles.Canvas.Pen.Color:= gCursorColor;
+  lsFoundedFiles.Canvas.Pen.Style:= psSolid;
+  lsFoundedFiles.Canvas.FrameRect(ARect);
+
+  path:= lsFoundedFiles.Items[Index];
+  AFile:= TFile.Create(path);
+  AFile.FullPath:= path;
+
+  aColor:= gColorExt.GetColorBy(AFile);
+  if aColor = clDefault then  aColor:= gForeColor;
+  AFile.Free;
+
+  //if odSelected in State then aColor:=$F0F8FF;
+  lsFoundedFiles.Canvas.Font.Color:= aColor;
+  lsFoundedFiles.Canvas.Font.Bold:= True;
+  lsFoundedFiles.Canvas.TextRect(ARect, 2, ARect.Top, path);
+end;
+
+
 { TfrmFindDlg.lsFoundedFilesKeyDown }
 procedure TfrmFindDlg.lsFoundedFilesKeyDown(Sender: TObject;
   var Key: word; Shift: TShiftState);
fFindDlg.patch (2,822 bytes)   
fFindDlg.png (47,410 bytes)   
fFindDlg.png (47,410 bytes)   
Fixed in Revision
Operating systemWindows
Widgetset
Architecture

Activities

CryHam

2019-03-19 10:12

reporter   ~0003106

Last edited: 2019-03-19 12:05

I'm not sure if it works well with white theme. I use only black background.
BTW. How can I customize the cursor drawing? it's a dotted frame with current file color, which is sometimes bad. Should I draw a rectangle with cursor color over it?

I think it'd also be great to separate directories, i.e. have first line with directory/path and next lines with only filenames inside it. Same like in Synchronize Directories.

Issue History

Date Modified Username Field Change
2019-03-19 10:09 CryHam New Issue
2019-03-19 10:09 CryHam File Added: fFindDlg.patch
2019-03-19 10:09 CryHam File Added: fFindDlg.png
2019-03-19 10:12 CryHam Note Added: 0003106
2019-03-19 12:05 CryHam Note Edited: 0003106