View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002268 | Double Commander | Graphical user interface | public | 2019-03-19 10:09 | 2019-03-19 12:05 |
Reporter | CryHam | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | always |
Status | new | Resolution | open | ||
Projection | none | ETA | none | ||
Product Version | 1.0.0 (trunk) | Product Build | r8738 | ||
Summary | 0002268: [Patch] Find Files results - color by file types | ||||
Description | Made 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. | ||||
Tags | No 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); | ||||
Fixed in Revision | |||||
Operating system | Windows | ||||
Widgetset | |||||
Architecture | |||||
|
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. |