bug1427.patch (10,676 bytes)
Index: src/fileviews/ubrieffileview.pas
===================================================================
--- src/fileviews/ubrieffileview.pas (revision 7615)
+++ src/fileviews/ubrieffileview.pas (working copy)
@@ -40,6 +40,7 @@
protected
function GetFileViewGridClass: TFileViewGridClass; override;
procedure ShowRenameFileEdit(aFile: TFile); override;
+ procedure UpdateRenameFileEditPosition; override;
function GetVisibleFilesIndexes: TRange; override;
public
function Clone(NewParent: TWinControl): TBriefFileView; override;
@@ -482,32 +483,35 @@
end;
procedure TBriefFileView.ShowRenameFileEdit(aFile: TFile);
-var
- ALeft, ATop, AWidth, AHeight: Integer;
begin
if not edtRename.Visible then
begin
edtRename.Font.Name := gFonts[dcfMain].Name;
- edtRename.Font.Size := gFonts[dcfMain].Size;;
+ edtRename.Font.Size := gFonts[dcfMain].Size;
edtRename.Font.Style := gFonts[dcfMain].Style;
dgPanel.LeftCol:= dgPanel.Col;
- ATop := dgPanel.CellRect(dgPanel.Col, dgPanel.Row).Top - 2;
- ALeft := dgPanel.CellRect(dgPanel.Col, dgPanel.Row).Left;
- AWidth := dgPanel.ColWidths[dgPanel.Col];
- if gShowIcons <> sim_none then
- begin
- Inc(ALeft, gIconsSize + 2);
- Dec(AWidth, gIconsSize + 2);
- end;
- AHeight := dgPanel.RowHeights[dgPanel.Row] + 4;
- edtRename.SetBounds(ALeft, ATop, AWidth, AHeight);
+ UpdateRenameFileEditPosition;
end;
inherited ShowRenameFileEdit(AFile);
end;
+procedure TBriefFileView.UpdateRenameFileEditPosition;
+var
+ ARect: TRect;
+begin
+ ARect := dgPanel.CellRect(dgPanel.Col, dgPanel.Row);
+ Dec(ARect.Top, 2);
+ Inc(ARect.Bottom, 2);
+
+ if gShowIcons <> sim_none then
+ Inc(ARect.Left, gIconsSize + 2);
+
+ edtRename.SetBounds(ARect.Left, ARect.Top, ARect.Width, ARect.Height);
+end;
+
function TBriefFileView.GetVisibleFilesIndexes: TRange;
begin
with dgPanel do
Index: src/fileviews/ucolumnsfileview.pas
===================================================================
--- src/fileviews/ucolumnsfileview.pas (revision 7615)
+++ src/fileviews/ucolumnsfileview.pas (working copy)
@@ -162,6 +162,7 @@
procedure SetActiveFile(FileIndex: PtrInt); override;
procedure SetSorting(const NewSortings: TFileSortings); override;
procedure ShowRenameFileEdit(aFile: TFile); override;
+ procedure UpdateRenameFileEditPosition; override;
procedure AfterChangePath; override;
@@ -434,8 +435,6 @@
end;
procedure TColumnsFileView.ShowRenameFileEdit(aFile: TFile);
-var
- ALeft, ATop, AWidth, AHeight: Integer;
begin
if FFileNameColumn <> -1 then
begin
@@ -445,21 +444,7 @@
edtRename.Font.Size := GetColumnsClass.GetColumnFontSize(FFileNameColumn);
edtRename.Font.Style := GetColumnsClass.GetColumnFontStyle(FFileNameColumn);
- ATop := dgPanel.CellRect(FFileNameColumn, dgPanel.Row).Top - 2;
- ALeft := dgPanel.CellRect(FFileNameColumn, dgPanel.Row).Left;
- AWidth := dgPanel.ColWidths[FFileNameColumn];
-
- if (gShowIcons <> sim_none) and (FFileNameColumn = 0) then
- begin
- Inc(ALeft, gIconsSize + 2);
- Dec(AWidth, gIconsSize + 2);
- end;
-
- if Succ(FFileNameColumn) = FExtensionColumn then
- Inc(AWidth, dgPanel.ColWidths[FExtensionColumn]);
- AHeight := dgPanel.RowHeights[dgPanel.Row] + 4;
-
- edtRename.SetBounds(ALeft, ATop, AWidth, AHeight);
+ UpdateRenameFileEditPosition;
end;
inherited ShowRenameFileEdit(AFile);
@@ -466,6 +451,23 @@
end;
end;
+procedure TColumnsFileView.UpdateRenameFileEditPosition;
+var
+ ARect: TRect;
+begin
+ ARect := dgPanel.CellRect(FFileNameColumn, dgPanel.Row);
+ Dec(ARect.Top, 2);
+ Inc(ARect.Bottom, 2);
+
+ if (gShowIcons <> sim_none) and (FFileNameColumn = 0) then
+ Inc(ARect.Left, gIconsSize + 2);
+
+ if Succ(FFileNameColumn) = FExtensionColumn then
+ Inc(ARect.Right, dgPanel.ColWidths[FExtensionColumn]);
+
+ edtRename.SetBounds(ARect.Left, ARect.Top, ARect.Width, ARect.Height);
+end;
+
procedure TColumnsFileView.RedrawFile(FileIndex: PtrInt);
begin
dgPanel.InvalidateRow(FileIndex + dgPanel.FixedRows);
Index: src/fileviews/ucolumnsfileviewvtv.pas
===================================================================
--- src/fileviews/ucolumnsfileviewvtv.pas (revision 7615)
+++ src/fileviews/ucolumnsfileviewvtv.pas (working copy)
@@ -168,6 +168,7 @@
procedure SetActiveFile(FileIndex: PtrInt); override;
procedure SetSorting(const NewSortings: TFileSortings); override;
procedure ShowRenameFileEdit(AFile: TFile); override;
+ procedure UpdateRenameFileEditPosition; override;
public
ActiveColm: String;
@@ -596,9 +597,6 @@
end;
procedure TColumnsFileViewVTV.ShowRenameFileEdit(AFile: TFile);
-var
- ALeft, ATop, AWidth, AHeight: Integer;
- aRect: TRect;
begin
if FFileNameColumn <> -1 then
begin
@@ -608,17 +606,7 @@
edtRename.Font.Size := GetColumnsClass.GetColumnFontSize(FFileNameColumn);
edtRename.Font.Style := GetColumnsClass.GetColumnFontStyle(FFileNameColumn);
- aRect := dgPanel.GetDisplayRect(dgPanel.FocusedNode, FFileNameColumn, False);
- ATop := aRect.Top - 2;
- ALeft := aRect.Left;
- if gShowIcons <> sim_none then
- Inc(ALeft, gIconsSize + 2);
- AWidth := aRect.Right - aRect.Left;
- if Succ(FFileNameColumn) = FExtensionColumn then
- Inc(AWidth, dgPanel.Header.Columns[FExtensionColumn].Width);
- AHeight := dgPanel.FocusedNode^.NodeHeight + 4;
-
- edtRename.SetBounds(ALeft, ATop, AWidth, AHeight);
+ UpdateRenameFileEditPosition;
end;
inherited ShowRenameFileEdit(AFile);
@@ -625,6 +613,23 @@
end;
end;
+procedure TColumnsFileViewVTV.UpdateRenameFileEditPosition;
+var
+ ARect: TRect;
+begin
+ ARect := dgPanel.GetDisplayRect(dgPanel.FocusedNode, FFileNameColumn, False);
+ Dec(ARect.Top, 2);
+ Inc(ARect.Bottom, 2);
+
+ if gShowIcons <> sim_none then
+ Inc(ARect.Left, gIconsSize + 2);
+
+ if Succ(FFileNameColumn) = FExtensionColumn then
+ Inc(ARect.Right, dgPanel.Header.Columns[FExtensionColumn].Width);
+
+ edtRename.SetBounds(ARect.Left, ARect.Top, ARect.Width, ARect.Height);
+end;
+
procedure TColumnsFileViewVTV.RedrawFile(FileIndex: PtrInt);
begin
dgPanel.InvalidateNode(PVirtualNode(FFiles[FileIndex].DisplayItem));
Index: src/fileviews/ufileviewwithgrid.pas
===================================================================
--- src/fileviews/ufileviewwithgrid.pas (revision 7615)
+++ src/fileviews/ufileviewwithgrid.pas (working copy)
@@ -164,9 +164,9 @@
procedure TFileViewGrid.DoOnResize;
begin
- inherited DoOnResize;
CalculateColRowCount;
CalculateColumnWidth;
+ inherited DoOnResize;
end;
procedure TFileViewGrid.KeyDown(var Key: Word; Shift: TShiftState);
Index: src/fileviews/ufileviewwithmainctrl.pas
===================================================================
--- src/fileviews/ufileviewwithmainctrl.pas (revision 7615)
+++ src/fileviews/ufileviewwithmainctrl.pas (working copy)
@@ -150,6 +150,7 @@
procedure MainControlMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure MainControlShowHint(Sender: TObject; HintInfo: PHintInfo);
procedure MainControlUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
+ procedure MainControlResize(Sender: TObject);
procedure MainControlWindowProc(var TheMessage: TLMessage);
{en
Updates the drop row index, which is used to draw a rectangle
@@ -161,6 +162,7 @@
// procedure ShowRenameFileEdit(AFile: TFile); virtual;
procedure ShowRenameFileEdit(AFile: TFile); virtual;
+ procedure UpdateRenameFileEditPosition; virtual;abstract;
procedure RenameSelectPart(AActionType:TRenameFileActionType); virtual;
property MainControl: TWinControl read FMainControl write SetMainControl;
@@ -949,6 +951,12 @@
Exit;
end;
+procedure TFileViewWithMainCtrl.MainControlResize(Sender: TObject);
+begin
+ if edtRename.Visible then
+ UpdateRenameFileEditPosition;
+end;
+
procedure TFileViewWithMainCtrl.MainControlWindowProc(var TheMessage: TLMessage);
begin
// Cancel rename if user scroll file list by mouse
@@ -1160,6 +1168,7 @@
FMainControl.OnKeyUp := @MainControlKeyUp;
FMainControl.OnShowHint := @MainControlShowHint;
FMainControl.OnUTF8KeyPress := @MainControlUTF8KeyPress;
+ FMainControl.AddHandlerOnResize(@MainControlResize);
TControlHandlersHack(FMainControl).OnDblClick := @MainControlDblClick;
TControlHandlersHack(FMainControl).OnQuadClick := @MainControlQuadClick;
Index: src/fileviews/uthumbfileview.pas
===================================================================
--- src/fileviews/uthumbfileview.pas (revision 7615)
+++ src/fileviews/uthumbfileview.pas (working copy)
@@ -80,6 +80,7 @@
function GetFileViewGridClass: TFileViewGridClass; override;
function GetVisibleFilesIndexes: TRange; override;
procedure ShowRenameFileEdit(aFile: TFile); override;
+ procedure UpdateRenameFileEditPosition(); override;
public
constructor Create(AOwner: TWinControl; AConfig: TXmlConfig; ANode: TXmlNode; AFlags: TFileViewFlags = []); override;
constructor Create(AOwner: TWinControl; AFileView: TFileView; AFlags: TFileViewFlags = []); override;
@@ -618,31 +619,29 @@
end;
procedure TThumbFileView.ShowRenameFileEdit(aFile: TFile);
-var
- ARect: TRect;
- ALeft, ATop, AWidth, AHeight: Integer;
begin
if not edtRename.Visible then
begin
edtRename.Font.Name := gFonts[dcfMain].Name;
- edtRename.Font.Size := gFonts[dcfMain].Size;;
+ edtRename.Font.Size := gFonts[dcfMain].Size;
edtRename.Font.Style := gFonts[dcfMain].Style;
- with dgPanel do
- begin
- ARect := CellRect(Col, Row);
- ATop := ARect.Bottom - Canvas.TextHeight('Wg') - 4;
- ALeft := ARect.Left;
- AWidth := ARect.Right - ALeft;
- AHeight := ARect.Bottom - ATop;
- end;
-
- edtRename.SetBounds(ALeft, ATop, AWidth, AHeight);
+ UpdateRenameFileEditPosition;
end;
inherited ShowRenameFileEdit(AFile);
end;
+procedure TThumbFileView.UpdateRenameFileEditPosition;
+var
+ ARect: TRect;
+begin
+ ARect := dgPanel.CellRect(dgPanel.Col, dgPanel.Row);
+ ARect.Top := ARect.Bottom - dgPanel.Canvas.TextHeight('Wg') - 4;
+
+ edtRename.SetBounds(ARect.Left, ARect.Top, ARect.Width, ARect.Height);
+end;
+
constructor TThumbFileView.Create(AOwner: TWinControl; AConfig: TXmlConfig;
ANode: TXmlNode; AFlags: TFileViewFlags);
begin