View Issue Details

IDProjectCategoryView StatusLast Update
0000194Double CommanderGraphical user interfacepublic2017-04-30 15:38
ReporterAssigned ToAlexx2000  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
ProjectionnoneETAnone 
Target Version0.8.0Fixed in Version0.8.0 
Summary0000194: Extend filenames without extension to the max
DescriptionIt's annoying that DC trims the filename just before the extension column - even if there is no extension.
IMO it would be better if the extensionless filename would be trimmed just after the extension column.
Additional Informationhttp://sourceforge.net/support/tracker.php?aid=3411786
TagsNo tags attached.
Attached Files
extend-cell-width.diff (12,209 bytes)   
Index: src/fileviews/ucolumnsfileview.pas
===================================================================
--- src/fileviews/ucolumnsfileview.pas	(revision 7417)
+++ src/fileviews/ucolumnsfileview.pas	(working copy)
@@ -1262,6 +1262,9 @@
 
 procedure TDrawGridEx.DrawCell(aCol, aRow: Integer; aRect: TRect;
               aState: TGridDrawState);
+const
+  CELL_PADDING = 2;
+
 var
   //shared variables
   s:   string;
@@ -1309,7 +1312,7 @@
       // Draw icon for a file
       PixMapManager.DrawBitmap(IconID,
                                Canvas,
-                               aRect.Left + 1,
+                               aRect.Left + CELL_PADDING,
                                Y
                                );
 
@@ -1319,7 +1322,7 @@
         PixMapManager.DrawBitmapOverlay(AFile,
                                         FileSourceDirectAccess,
                                         Canvas,
-                                        aRect.Left + 1,
+                                        aRect.Left + CELL_PADDING,
                                         Y
                                         );
       end;
@@ -1326,21 +1329,19 @@
 
     end;
 
-    if AFile.DisplayStrings.Count = 0 then
-      ColumnsView.MakeColumnsStrings(AFile, ColumnsSet);
     s := AFile.DisplayStrings.Strings[ACol];
 
     if gCutTextToColWidth then
     begin
-      Y:= ((aRect.Right - aRect.Left) - Canvas.TextWidth('V'));
-      if (gShowIcons <> sim_none) then Y:= Y - gIconsSize;
+      Y:= (aRect.Right - aRect.Left) - 2*CELL_PADDING;
+      if (gShowIcons <> sim_none) then Y:= Y - gIconsSize - 2;
       s:= FitFileName(s, Canvas, AFile.FSFile, Y);
     end;
 
     if (gShowIcons <> sim_none) then
-      Canvas.TextOut(aRect.Left + gIconsSize + 4, iTextTop, s)
+      Canvas.TextOut(aRect.Left + CELL_PADDING + gIconsSize + 2, iTextTop, s)
     else
-      Canvas.TextOut(aRect.Left + 2, iTextTop, s);
+      Canvas.TextOut(aRect.Left + CELL_PADDING, iTextTop, s);
   end; //of DrawIconCell
   //------------------------------------------------------
 
@@ -1347,34 +1348,30 @@
   procedure DrawOtherCell;
   //------------------------------------------------------
   var
-    tw, cw: Integer;
+    tw: Integer;
   begin
-    if AFile.DisplayStrings.Count = 0 then
-      ColumnsView.MakeColumnsStrings(AFile, ColumnsSet);
     s := AFile.DisplayStrings.Strings[ACol];
 
     if gCutTextToColWidth then
-      s := FitOtherCellText(s, Canvas, ((ARect.Right-ARect.Left)-4));
+      s := FitOtherCellText(s, Canvas, ARect.Right - ARect.Left - 2*CELL_PADDING);
 
     case ColumnsSet.GetColumnAlign(ACol) of
 
       taRightJustify:
         begin
-          cw := ColWidths[ACol];
           tw := Canvas.TextWidth(s);
-          Canvas.TextOut(aRect.Left + cw - tw - 3, iTextTop, s);
+          Canvas.TextOut(aRect.Right - tw - CELL_PADDING, iTextTop, s);
         end;
 
       taLeftJustify:
         begin
-          Canvas.TextOut(aRect.Left + 3, iTextTop, s);
+          Canvas.TextOut(aRect.Left + CELL_PADDING, iTextTop, s);
         end;
 
       taCenter:
         begin
-          cw := ColWidths[ACol];
           tw := Canvas.TextWidth(s);
-          Canvas.TextOut(aRect.Left + ((cw - tw - 3) div 2), iTextTop, s);
+          Canvas.TextOut((aRect.Left + aRect.Right - tw) div 2, iTextTop, s);
         end;
 
     end; //of case
@@ -1462,6 +1459,7 @@
     Canvas.Brush.Color := BackgroundColor;
     Canvas.FillRect(aRect);
     Canvas.Font.Color := TextColor;
+    Canvas.Brush.Style := bsClear;
   end;// of PrepareColors;
 
   procedure DrawLines;
@@ -1563,6 +1561,144 @@
         }
     end;
   end;
+
+  procedure DrawExtendedCells;
+  type
+    TCell = record
+      Col: Integer;         // column index
+      Rect: TRect;          // initial rect
+      LeftBound,            // new left bound
+      RightBound: Integer;  // new right bound
+    end;
+
+    procedure GetCellBounds(var ACell: TCell);
+    var
+      CellText: string;
+      CellWidth: Integer;
+      ColAlign: TAlignment;
+    begin
+      CellText := AFile.DisplayStrings[ACell.Col];
+      CellWidth := Canvas.TextWidth(CellText) + 2*CELL_PADDING;
+      if (ACell.Col = 0) and (gShowIcons <> sim_none) then
+        CellWidth := CellWidth + gIconsSize + 2;
+
+      ColAlign := ColumnsSet.GetColumnAlign(ACell.Col);
+      if (ColAlign = taLeftJustify) or (ACell.Col = 0) then
+      begin
+        ACell.LeftBound := ACell.Rect.Left;
+        ACell.RightBound := ACell.LeftBound + CellWidth;
+      end
+      else if ColAlign = taRightJustify then
+      begin
+        ACell.RightBound := ACell.Rect.Right;
+        ACell.LeftBound := ACell.RightBound - CellWidth;
+      end
+      else
+      begin
+        ACell.LeftBound := (ACell.Rect.Left + ACell.Rect.Right - CellWidth) div 2;
+        if (ACell.Rect.Left <= ACell.LeftBound) or (not gCutTextToColWidth) then
+          ACell.RightBound := ACell.LeftBound + CellWidth
+        else begin
+          ACell.LeftBound := ACell.Rect.Left;
+          ACell.RightBound := ACell.Rect.Right;
+        end;
+      end;
+    end;
+
+    procedure FindNextCell(ACurrentCol, ADirection: Integer; out ACell: TCell);
+    var
+      C: Integer;
+    begin
+      C := ACurrentCol + ADirection;
+      while (C >= 0) and (C < ColCount) do
+      begin
+        if (AFile.DisplayStrings[C] <> '') and (ColWidths[C] <> 0) then
+        begin
+          ACell.Col := C;
+          ACell.Rect := CellRect(C, aRow);
+          GetCellBounds(ACell);
+          Exit;
+        end;
+        C := C + ADirection;
+      end;
+      ACell.Col := -1;
+    end;
+
+    procedure ReconcileBounds(var LCell, RCell: TCell);
+    var
+      LeftEdge: Integer absolute LCell.RightBound;
+      RightEdge: Integer absolute RCell.LeftBound;
+      LeftColEdge: Integer absolute LCell.Rect.Right;
+    begin
+      if (LeftEdge <= RightEdge) or (not gCutTextToColWidth) then
+        Exit;
+
+      if (RightEdge < LeftColEdge) and (LeftColEdge < LeftEdge) then
+      begin
+        LeftEdge := LeftColEdge;
+        RightEdge := LeftColEdge;
+      end
+      else if LeftEdge <= LeftColEdge then
+        RightEdge := LeftEdge
+      else
+        LeftEdge := RightEdge;
+    end;
+
+    procedure DrawCell(const ACell: TCell);
+    begin
+      aCol := ACell.Col;
+      aRect.Left := ACell.LeftBound;
+      aRect.Right := ACell.RightBound;
+      if aCol = 0 then
+        DrawIconCell
+      else
+        DrawOtherCell;
+    end;
+
+  var
+    CCell, LCell, RCell: TCell;
+  begin
+    CCell.Col := aCol;
+    CCell.Rect := aRect;
+
+    FindNextCell(CCell.Col, -1, LCell);
+    FindNextCell(CCell.Col, +1, RCell);
+
+    if AFile.DisplayStrings[CCell.Col] = '' then
+    begin
+      if (LCell.Col <> -1) and (RCell.Col <> -1) then
+        ReconcileBounds(LCell, RCell);
+
+      if (LCell.Col <> -1) and (CCell.Rect.Left < LCell.RightBound) then
+        DrawCell(LCell);
+
+      if (RCell.Col <> -1) and (RCell.LeftBound < CCell.Rect.Right) then
+        DrawCell(RCell);
+    end
+    else
+    begin
+      GetCellBounds(CCell);
+
+      if LCell.Col <> -1 then
+      begin
+        ReconcileBounds(LCell, CCell);
+        if CCell.Rect.Left < LCell.RightBound then
+          DrawCell(LCell);
+      end;
+
+      if RCell.Col <> -1 then
+      begin
+        ReconcileBounds(CCell, RCell);
+        if RCell.LeftBound < CCell.Rect.Right then
+          DrawCell(RCell);
+      end;
+
+      DrawCell(CCell);
+    end;
+
+    aCol := CCell.Col;
+    aRect := CCell.Rect;
+  end;
   //------------------------------------------------------
   //end of subprocedures
   //------------------------------------------------------
@@ -1580,14 +1716,22 @@
     AFile := ColumnsView.FFiles[ARow - FixedRows]; // substract fixed rows (header)
     FileSourceDirectAccess := fspDirectAccess in ColumnsView.FileSource.Properties;
 
+    if AFile.DisplayStrings.Count = 0 then
+      ColumnsView.MakeColumnsStrings(AFile, ColumnsSet);
+
     PrepareColors;
 
     iTextTop := aRect.Top + (RowHeights[aRow] - Canvas.TextHeight('Wg')) div 2;
 
-    if ACol = 0 then
-      DrawIconCell  // Draw icon in the first column
+    if gExtendCellWidth then
+      DrawExtendedCells
     else
-      DrawOtherCell;
+    begin
+      if ACol = 0 then
+        DrawIconCell  // Draw icon in the first column
+      else
+        DrawOtherCell;
+    end;
 
     DrawCellGrid(aCol,aRow,aRect,aState);
     DrawLines;
Index: src/frames/foptionscolumnsview.lfm
===================================================================
--- src/frames/foptionscolumnsview.lfm	(revision 7417)
+++ src/frames/foptionscolumnsview.lfm	(working copy)
@@ -130,6 +130,8 @@
     ClientWidth = 643
     TabOrder = 2
     object cbCutTextToColWidth: TCheckBox
+      AnchorSideLeft.Control = grpMisc
+      AnchorSideTop.Control = grpMisc
       Left = 12
       Height = 29
       Top = 6
@@ -137,5 +139,17 @@
       Caption = 'Cut &text to column width'
       TabOrder = 0
     end
+    object cbExtendCellWidth: TCheckBox
+      AnchorSideLeft.Control = grpMisc
+      AnchorSideTop.Control = cbCutTextToColWidth
+      AnchorSideTop.Side = asrBottom
+      Left = 12
+      Height = 21
+      Top = 33
+      Width = 286
+      BorderSpacing.Top = 6
+      Caption = '&Extend cell width if text is not fitting into column'
+      TabOrder = 1
+    end
   end
 end
Index: src/frames/foptionscolumnsview.pas
===================================================================
--- src/frames/foptionscolumnsview.pas	(revision 7417)
+++ src/frames/foptionscolumnsview.pas	(working copy)
@@ -36,6 +36,7 @@
 
   TfrmOptionsColumnsView = class(TOptionsEditor)
     cbCutTextToColWidth: TCheckBox;
+    cbExtendCellWidth: TCheckBox;
     cbGridHorzLine: TCheckBox;
     cbGridVertLine: TCheckBox;
     chkAutoFillColumns: TCheckBox;
@@ -74,6 +75,7 @@
   chkAutoFillColumns.Checked  := gAutoFillColumns;
   cmbAutoSizeColumn.ItemIndex := gAutoSizeColumn;
   cbCutTextToColWidth.Checked := gCutTextToColWidth;
+  cbExtendCellWidth.Checked   := gExtendCellWidth;
 end;
 
 function TfrmOptionsColumnsView.Save: TOptionsEditorSaveFlags;
@@ -83,6 +85,7 @@
   gAutoFillColumns   := chkAutoFillColumns.Checked;
   gAutoSizeColumn    := cmbAutoSizeColumn.ItemIndex;
   gCutTextToColWidth := cbCutTextToColWidth.Checked;
+  gExtendCellWidth   := cbExtendCellWidth.Checked;
 
   Result := [];
 end;
@@ -98,4 +101,4 @@
 end;
 
 end.
-
+
Index: src/uglobs.pas
===================================================================
--- src/uglobs.pas	(revision 7417)
+++ src/uglobs.pas	(working copy)
@@ -282,6 +282,7 @@
   glsIgnoreList : TStringListEx;
   gOnlyOneAppInstance,
   gCutTextToColWidth : Boolean;
+  gExtendCellWidth : Boolean;
   gSpaceMovesDown: Boolean;
   gScrollMode: TScrollMode;
   gWheelScrollLines: Integer;
@@ -1312,6 +1313,7 @@
   gCustomColumnsChangeAllColumns := False;
   gDateTimeFormat := DefaultDateTimeFormat;
   gCutTextToColWidth := True;
+  gExtendCellWidth := True;
   gShowSystemFiles := False;
   // Under Mac OS X loading file list in separate thread are very very slow
   // so disable and hide this option under Mac OS X Carbon
@@ -2139,6 +2141,7 @@
       gAutoSizeColumn := GetValue(Node, 'AutoSizeColumn', gAutoSizeColumn);
       gDateTimeFormat := GetValidDateTimeFormat(GetValue(Node, 'DateTimeFormat', gDateTimeFormat), DefaultDateTimeFormat);
       gCutTextToColWidth := GetValue(Node, 'CutTextToColumnWidth', gCutTextToColWidth);
+      gExtendCellWidth := GetValue(Node, 'ExtendCellWidth', gExtendCellWidth);
       gShowSystemFiles := GetValue(Node, 'ShowSystemFiles', gShowSystemFiles);
       {$IFNDEF LCLCARBON}
       // Under Mac OS X loading file list in separate thread are very very slow
@@ -2741,6 +2744,7 @@
     SetValue(Node, 'BriefViewFileExtAligned', gBriefViewFileExtAligned);
     SetValue(Node, 'DateTimeFormat', gDateTimeFormat);
     SetValue(Node, 'CutTextToColumnWidth', gCutTextToColWidth);
+    SetValue(Node, 'ExtendCellWidth', gExtendCellWidth);
     SetValue(Node, 'ShowSystemFiles', gShowSystemFiles);
     {$IFNDEF LCLCARBON}
     // Under Mac OS X loading file list in separate thread are very very slow
extend-cell-width.diff (12,209 bytes)   
extend-cell-width-fix.diff (12,168 bytes)   
Index: src/fileviews/ucolumnsfileview.pas
===================================================================
--- src/fileviews/ucolumnsfileview.pas	(revision 7417)
+++ src/fileviews/ucolumnsfileview.pas	(working copy)
@@ -1262,6 +1262,9 @@
 
 procedure TDrawGridEx.DrawCell(aCol, aRow: Integer; aRect: TRect;
               aState: TGridDrawState);
+const
+  CELL_PADDING = 2;
+
 var
   //shared variables
   s:   string;
@@ -1309,7 +1312,7 @@
       // Draw icon for a file
       PixMapManager.DrawBitmap(IconID,
                                Canvas,
-                               aRect.Left + 1,
+                               aRect.Left + CELL_PADDING,
                                Y
                                );
 
@@ -1319,7 +1322,7 @@
         PixMapManager.DrawBitmapOverlay(AFile,
                                         FileSourceDirectAccess,
                                         Canvas,
-                                        aRect.Left + 1,
+                                        aRect.Left + CELL_PADDING,
                                         Y
                                         );
       end;
@@ -1326,21 +1329,19 @@
 
     end;
 
-    if AFile.DisplayStrings.Count = 0 then
-      ColumnsView.MakeColumnsStrings(AFile, ColumnsSet);
     s := AFile.DisplayStrings.Strings[ACol];
 
     if gCutTextToColWidth then
     begin
-      Y:= ((aRect.Right - aRect.Left) - Canvas.TextWidth('V'));
-      if (gShowIcons <> sim_none) then Y:= Y - gIconsSize;
+      Y:= (aRect.Right - aRect.Left) - 2*CELL_PADDING;
+      if (gShowIcons <> sim_none) then Y:= Y - gIconsSize - 2;
       s:= FitFileName(s, Canvas, AFile.FSFile, Y);
     end;
 
     if (gShowIcons <> sim_none) then
-      Canvas.TextOut(aRect.Left + gIconsSize + 4, iTextTop, s)
+      Canvas.TextOut(aRect.Left + CELL_PADDING + gIconsSize + 2, iTextTop, s)
     else
-      Canvas.TextOut(aRect.Left + 2, iTextTop, s);
+      Canvas.TextOut(aRect.Left + CELL_PADDING, iTextTop, s);
   end; //of DrawIconCell
   //------------------------------------------------------
 
@@ -1347,34 +1348,30 @@
   procedure DrawOtherCell;
   //------------------------------------------------------
   var
-    tw, cw: Integer;
+    tw: Integer;
   begin
-    if AFile.DisplayStrings.Count = 0 then
-      ColumnsView.MakeColumnsStrings(AFile, ColumnsSet);
     s := AFile.DisplayStrings.Strings[ACol];
 
     if gCutTextToColWidth then
-      s := FitOtherCellText(s, Canvas, ((ARect.Right-ARect.Left)-4));
+      s := FitOtherCellText(s, Canvas, ARect.Right - ARect.Left - 2*CELL_PADDING);
 
     case ColumnsSet.GetColumnAlign(ACol) of
 
       taRightJustify:
         begin
-          cw := ColWidths[ACol];
           tw := Canvas.TextWidth(s);
-          Canvas.TextOut(aRect.Left + cw - tw - 3, iTextTop, s);
+          Canvas.TextOut(aRect.Right - tw - CELL_PADDING, iTextTop, s);
         end;
 
       taLeftJustify:
         begin
-          Canvas.TextOut(aRect.Left + 3, iTextTop, s);
+          Canvas.TextOut(aRect.Left + CELL_PADDING, iTextTop, s);
         end;
 
       taCenter:
         begin
-          cw := ColWidths[ACol];
           tw := Canvas.TextWidth(s);
-          Canvas.TextOut(aRect.Left + ((cw - tw - 3) div 2), iTextTop, s);
+          Canvas.TextOut((aRect.Left + aRect.Right - tw) div 2, iTextTop, s);
         end;
 
     end; //of case
@@ -1462,6 +1459,7 @@
     Canvas.Brush.Color := BackgroundColor;
     Canvas.FillRect(aRect);
     Canvas.Font.Color := TextColor;
+    Canvas.Brush.Style := bsClear;
   end;// of PrepareColors;
 
   procedure DrawLines;
@@ -1563,6 +1561,144 @@
         }
     end;
   end;
+
+  procedure DrawExtendedCells;
+  type
+    TCell = record
+      Col: Integer;         // column index
+      Rect: TRect;          // initial rect
+      LeftBound,            // new left bound
+      RightBound: Integer;  // new right bound
+    end;
+
+    procedure GetCellBounds(var ACell: TCell);
+    var
+      CellText: string;
+      CellWidth: Integer;
+      ColAlign: TAlignment;
+    begin
+      CellText := AFile.DisplayStrings[ACell.Col];
+      CellWidth := Canvas.TextWidth(CellText) + 2*CELL_PADDING;
+      if (ACell.Col = 0) and (gShowIcons <> sim_none) then
+        CellWidth := CellWidth + gIconsSize + 2;
+
+      ColAlign := ColumnsSet.GetColumnAlign(ACell.Col);
+      if (ColAlign = taLeftJustify) or (ACell.Col = 0) then
+      begin
+        ACell.LeftBound := ACell.Rect.Left;
+        ACell.RightBound := ACell.LeftBound + CellWidth;
+      end
+      else if ColAlign = taRightJustify then
+      begin
+        ACell.RightBound := ACell.Rect.Right;
+        ACell.LeftBound := ACell.RightBound - CellWidth;
+      end
+      else
+      begin
+        ACell.LeftBound := (ACell.Rect.Left + ACell.Rect.Right - CellWidth) div 2;
+        if (ACell.Rect.Left <= ACell.LeftBound) or (not gCutTextToColWidth) then
+          ACell.RightBound := ACell.LeftBound + CellWidth
+        else begin
+          ACell.LeftBound := ACell.Rect.Left;
+          ACell.RightBound := ACell.Rect.Right;
+        end;
+      end;
+    end;
+
+    procedure FindNextCell(ACurrentCol, ADirection: Integer; out ACell: TCell);
+    var
+      C: Integer;
+    begin
+      C := ACurrentCol + ADirection;
+      while (C >= 0) and (C < ColCount) do
+      begin
+        if (AFile.DisplayStrings[C] <> '') and (ColWidths[C] <> 0) then
+        begin
+          ACell.Col := C;
+          ACell.Rect := CellRect(C, aRow);
+          GetCellBounds(ACell);
+          Exit;
+        end;
+        C := C + ADirection;
+      end;
+      ACell.Col := -1;
+    end;
+
+    procedure ReconcileBounds(var LCell, RCell: TCell);
+    var
+      LeftEdge: Integer absolute LCell.RightBound;
+      RightEdge: Integer absolute RCell.LeftBound;
+      LeftColEdge: Integer absolute LCell.Rect.Right;
+    begin
+      if (LeftEdge <= RightEdge) or (not gCutTextToColWidth) then
+        Exit;
+
+      if (RightEdge < LeftColEdge) and (LeftColEdge < LeftEdge) then
+      begin
+        LeftEdge := LeftColEdge;
+        RightEdge := LeftColEdge;
+      end
+      else if LeftEdge <= LeftColEdge then
+        RightEdge := LeftEdge
+      else
+        LeftEdge := RightEdge;
+    end;
+
+    procedure DrawCell(const ACell: TCell);
+    begin
+      aCol := ACell.Col;
+      aRect.Left := ACell.LeftBound;
+      aRect.Right := ACell.RightBound;
+      if aCol = 0 then
+        DrawIconCell
+      else
+        DrawOtherCell;
+    end;
+
+  var
+    CCell, LCell, RCell: TCell;
+  begin
+    CCell.Col := aCol;
+    CCell.Rect := aRect;
+
+    FindNextCell(CCell.Col, -1, LCell);
+    FindNextCell(CCell.Col, +1, RCell);
+
+    if AFile.DisplayStrings[CCell.Col] = '' then
+    begin
+      if (LCell.Col <> -1) and (RCell.Col <> -1) then
+        ReconcileBounds(LCell, RCell);
+
+      if (LCell.Col <> -1) and (CCell.Rect.Left < LCell.RightBound) then
+        DrawCell(LCell);
+
+      if (RCell.Col <> -1) and (RCell.LeftBound < CCell.Rect.Right) then
+        DrawCell(RCell);
+    end
+    else
+    begin
+      GetCellBounds(CCell);
+
+      if LCell.Col <> -1 then
+      begin
+        ReconcileBounds(LCell, CCell);
+        if CCell.Rect.Left < LCell.RightBound then
+          DrawCell(LCell);
+      end;
+
+      if RCell.Col <> -1 then
+      begin
+        ReconcileBounds(CCell, RCell);
+        if RCell.LeftBound < CCell.Rect.Right then
+          DrawCell(RCell);
+      end;
+
+      DrawCell(CCell);
+    end;
+
+    aCol := CCell.Col;
+    aRect := CCell.Rect;
+  end;
   //------------------------------------------------------
   //end of subprocedures
   //------------------------------------------------------
@@ -1580,14 +1716,22 @@
     AFile := ColumnsView.FFiles[ARow - FixedRows]; // substract fixed rows (header)
     FileSourceDirectAccess := fspDirectAccess in ColumnsView.FileSource.Properties;
 
+    if AFile.DisplayStrings.Count = 0 then
+      ColumnsView.MakeColumnsStrings(AFile, ColumnsSet);
+
     PrepareColors;
 
     iTextTop := aRect.Top + (RowHeights[aRow] - Canvas.TextHeight('Wg')) div 2;
 
-    if ACol = 0 then
-      DrawIconCell  // Draw icon in the first column
+    if gExtendCellWidth then
+      DrawExtendedCells
     else
-      DrawOtherCell;
+    begin
+      if ACol = 0 then
+        DrawIconCell  // Draw icon in the first column
+      else
+        DrawOtherCell;
+    end;
 
     DrawCellGrid(aCol,aRow,aRect,aState);
     DrawLines;
Index: src/frames/foptionscolumnsview.lfm
===================================================================
--- src/frames/foptionscolumnsview.lfm	(revision 7417)
+++ src/frames/foptionscolumnsview.lfm	(working copy)
@@ -130,6 +130,8 @@
     ClientWidth = 643
     TabOrder = 2
     object cbCutTextToColWidth: TCheckBox
+      AnchorSideLeft.Control = grpMisc
+      AnchorSideTop.Control = grpMisc
       Left = 12
       Height = 29
       Top = 6
@@ -137,5 +139,17 @@
       Caption = 'Cut &text to column width'
       TabOrder = 0
     end
+    object cbExtendCellWidth: TCheckBox
+      AnchorSideLeft.Control = grpMisc
+      AnchorSideTop.Control = cbCutTextToColWidth
+      AnchorSideTop.Side = asrBottom
+      Left = 12
+      Height = 21
+      Top = 33
+      Width = 286
+      BorderSpacing.Top = 6
+      Caption = '&Extend cell width if text is not fitting into column'
+      TabOrder = 1
+    end
   end
 end
Index: src/frames/foptionscolumnsview.pas
===================================================================
--- src/frames/foptionscolumnsview.pas	(revision 7417)
+++ src/frames/foptionscolumnsview.pas	(working copy)
@@ -36,6 +36,7 @@
 
   TfrmOptionsColumnsView = class(TOptionsEditor)
     cbCutTextToColWidth: TCheckBox;
+    cbExtendCellWidth: TCheckBox;
     cbGridHorzLine: TCheckBox;
     cbGridVertLine: TCheckBox;
     chkAutoFillColumns: TCheckBox;
@@ -74,6 +75,7 @@
   chkAutoFillColumns.Checked  := gAutoFillColumns;
   cmbAutoSizeColumn.ItemIndex := gAutoSizeColumn;
   cbCutTextToColWidth.Checked := gCutTextToColWidth;
+  cbExtendCellWidth.Checked   := gExtendCellWidth;
 end;
 
 function TfrmOptionsColumnsView.Save: TOptionsEditorSaveFlags;
@@ -83,6 +85,7 @@
   gAutoFillColumns   := chkAutoFillColumns.Checked;
   gAutoSizeColumn    := cmbAutoSizeColumn.ItemIndex;
   gCutTextToColWidth := cbCutTextToColWidth.Checked;
+  gExtendCellWidth   := cbExtendCellWidth.Checked;
 
   Result := [];
 end;
Index: src/uglobs.pas
===================================================================
--- src/uglobs.pas	(revision 7417)
+++ src/uglobs.pas	(working copy)
@@ -282,6 +282,7 @@
   glsIgnoreList : TStringListEx;
   gOnlyOneAppInstance,
   gCutTextToColWidth : Boolean;
+  gExtendCellWidth : Boolean;
   gSpaceMovesDown: Boolean;
   gScrollMode: TScrollMode;
   gWheelScrollLines: Integer;
@@ -1312,6 +1313,7 @@
   gCustomColumnsChangeAllColumns := False;
   gDateTimeFormat := DefaultDateTimeFormat;
   gCutTextToColWidth := True;
+  gExtendCellWidth := True;
   gShowSystemFiles := False;
   // Under Mac OS X loading file list in separate thread are very very slow
   // so disable and hide this option under Mac OS X Carbon
@@ -2139,6 +2141,7 @@
       gAutoSizeColumn := GetValue(Node, 'AutoSizeColumn', gAutoSizeColumn);
       gDateTimeFormat := GetValidDateTimeFormat(GetValue(Node, 'DateTimeFormat', gDateTimeFormat), DefaultDateTimeFormat);
       gCutTextToColWidth := GetValue(Node, 'CutTextToColumnWidth', gCutTextToColWidth);
+      gExtendCellWidth := GetValue(Node, 'ExtendCellWidth', gExtendCellWidth);
       gShowSystemFiles := GetValue(Node, 'ShowSystemFiles', gShowSystemFiles);
       {$IFNDEF LCLCARBON}
       // Under Mac OS X loading file list in separate thread are very very slow
@@ -2741,6 +2744,7 @@
     SetValue(Node, 'BriefViewFileExtAligned', gBriefViewFileExtAligned);
     SetValue(Node, 'DateTimeFormat', gDateTimeFormat);
     SetValue(Node, 'CutTextToColumnWidth', gCutTextToColWidth);
+    SetValue(Node, 'ExtendCellWidth', gExtendCellWidth);
     SetValue(Node, 'ShowSystemFiles', gShowSystemFiles);
     {$IFNDEF LCLCARBON}
     // Under Mac OS X loading file list in separate thread are very very slow
extend-cell-width-fix.diff (12,168 bytes)   
Fixed in Revision7498
Operating system
Widgetset
Architecture

Relationships

has duplicate 0000195 closedAlexx2000 Extend filenames without extension to the max ++ 

Activities

accorp

2017-03-03 10:39

reporter   ~0002113

Please review attached patch. It adds new option "Extend cell width if text is not fitting into column". This is working in conjunction with "Cut text to column width".

If cutting is disabled, then two intersected cells are drawing overlapped.
If enabled - cells are extending into free space, ending with ellipsis if not fit.
For blank cell, right neighbor has advantage to extend to it over left.

accorp

2017-03-05 12:11

reporter   ~0002117

foptionscolumnsview.pas has mixed line ending, lazarus resaved it with cr/lf changes, svn generates bad diff GNU patch does not want to import (malformed patch at line 342).

Added fixed patch.

Issue History

Date Modified Username Field Change
2011-10-23 12:04 Alexx2000 New Issue
2011-10-23 12:22 Alexx2000 Relationship added has duplicate 0000195
2017-03-03 10:34 accorp File Added: extend-cell-width.diff
2017-03-03 10:39 accorp Note Added: 0002113
2017-03-05 12:03 accorp File Added: extend-cell-width-fix.diff
2017-03-05 12:11 accorp Note Added: 0002117
2017-03-05 14:02 Alexx2000 Status new => acknowledged
2017-03-05 14:02 Alexx2000 Target Version => 0.8.0
2017-03-05 14:02 Alexx2000 Description Updated
2017-04-16 14:30 Alexx2000 Fixed in Revision => 7498
2017-04-16 14:30 Alexx2000 Status acknowledged => resolved
2017-04-16 14:30 Alexx2000 Fixed in Version => 0.8.0
2017-04-16 14:30 Alexx2000 Resolution open => fixed
2017-04-16 14:30 Alexx2000 Assigned To => Alexx2000
2017-04-30 15:38 accorp Status resolved => closed