2
0
Эх сурвалжийг харах

ADD: Show filename in status bar when nothing is selected (fixes #207)

Alexander Koblov 3 жил өмнө
parent
commit
09f989d4f7

+ 27 - 0
src/fileviews/ucolumnsfileview.pas

@@ -118,6 +118,8 @@ type
     procedure MakeVisible(iRow: Integer);
     procedure MakeActiveVisible;
 
+    procedure UpdateFooterDetails;
+
     {en
        Format and cache all columns strings.
     }
@@ -174,6 +176,7 @@ type
     procedure SetSorting(const NewSortings: TFileSortings); override;
     procedure ShowRenameFileEdit(var aFile: TFile); override;
     procedure UpdateRenameFileEditPosition; override;
+    procedure UpdateInfoPanel; override;
 
     procedure MouseScrollTimer(Sender: TObject); override;
 
@@ -429,6 +432,8 @@ begin
   dgPanel.Options := dgPanel.Options - [goDontScrollPartCell];
 {$ENDIF}
   DoFileIndexChanged(aRow - dgPanel.FixedRows, dgPanel.TopRow);
+
+  if (FSelectedCount = 0) then UpdateFooterDetails;
 end;
 
 procedure TColumnsFileView.dgPanelTopLeftChanged(Sender: TObject);
@@ -507,6 +512,12 @@ begin
   edtRename.SetBounds(ARect.Left, ARect.Top, ARect.Right - ARect.Left, ARect.Bottom - ARect.Top);
 end;
 
+procedure TColumnsFileView.UpdateInfoPanel;
+begin
+  inherited UpdateInfoPanel;
+  UpdateFooterDetails;
+end;
+
 procedure TColumnsFileView.MouseScrollTimer(Sender: TObject);
 var
   APoint: TPoint;
@@ -724,6 +735,22 @@ begin
     MakeVisible(dgPanel.Row);
 end;
 
+procedure TColumnsFileView.UpdateFooterDetails;
+var
+  AFile: TFile;
+begin
+  if gColumnsLongInStatus and (FSelectedCount = 0) and (not FlatView) then
+  begin
+    AFile:= CloneActiveFile;
+    if Assigned(AFile) then
+    try
+      lblInfo.Caption := AFile.Name;
+    finally
+      AFile.Free;
+    end;
+  end;
+end;
+
 procedure TColumnsFileView.SetActiveFile(FileIndex: PtrInt; ScrollTo: Boolean; aLastTopRowIndex: PtrInt = -1);
 begin
   if not ScrollTo then

+ 4 - 0
src/uglobs.pas

@@ -324,6 +324,7 @@ var
 
   gAutoFillColumns: Boolean;
   gAutoSizeColumn: Integer;
+  gColumnsLongInStatus : Boolean;
   gColumnsAutoSaveWidth: Boolean;
   gColumnsTitleStyle: TTitleStyle;
   gCustomColumnsChangeAllColumns: Boolean;
@@ -1653,6 +1654,7 @@ begin
   gWheelScrollLines:= Mouse.WheelScrollLines;
   gAutoFillColumns := False;
   gAutoSizeColumn := 1;
+  gColumnsLongInStatus := False;
   gColumnsAutoSaveWidth := True;
   gColumnsTitleStyle := tsNative;
   gCustomColumnsChangeAllColumns := False;
@@ -2846,6 +2848,7 @@ begin
       SubNode := FindNode(Node, 'ColumnsView');
       if Assigned(SubNode) then
       begin
+        gColumnsLongInStatus := GetValue(SubNode, 'LongInStatus', gColumnsLongInStatus);
         gColumnsAutoSaveWidth := GetValue(SubNode, 'AutoSaveWidth', gColumnsAutoSaveWidth);
         gColumnsTitleStyle := TTitleStyle(GetValue(SubNode, 'TitleStyle', Integer(gColumnsTitleStyle)));
       end;
@@ -3559,6 +3562,7 @@ begin
     SetValue(SubNode, 'NewFilesPosition', Integer(gNewFilesPosition));
     SetValue(SubNode, 'UpdatedFilesPosition', Integer(gUpdatedFilesPosition));
     SubNode := FindNode(Node, 'ColumnsView', True);
+    SetValue(SubNode, 'LongInStatus', gColumnsLongInStatus);
     SetValue(SubNode, 'AutoSaveWidth', gColumnsAutoSaveWidth);
     SetValue(SubNode, 'TitleStyle', Integer(gColumnsTitleStyle));
     SubNode := FindNode(Node, 'BriefView', True);