mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
UPD: refactoring to eliminate duplicate doFileSourceDrawCell() in FileView
(cherry picked from commit cc00605fa5)
This commit is contained in:
parent
5015b769f5
commit
25dd8763f7
4 changed files with 15 additions and 36 deletions
|
|
@ -495,17 +495,6 @@ var
|
|||
Canvas.TextOut(aRect.Left + 2, iTextTop, s);
|
||||
end; //of DrawIconCell
|
||||
|
||||
procedure callFileSourceDrawCell;
|
||||
var
|
||||
handler: TFileSourceUIHandler;
|
||||
begin
|
||||
handler:= FBriefView.FileSource.GetUIHandler;
|
||||
if handler = nil then
|
||||
Exit;
|
||||
|
||||
handler.draw( params );
|
||||
end;
|
||||
|
||||
//------------------------------------------------------
|
||||
//end of subprocedures
|
||||
//------------------------------------------------------
|
||||
|
|
@ -537,7 +526,7 @@ begin
|
|||
params.drawingRect:= aRect;
|
||||
params.decorationRect:= self.ConvertToDecorationRect( params.drawingRect );
|
||||
params.focused:= (gdSelected in aState) and FBriefView.Active;
|
||||
callFileSourceDrawCell;
|
||||
self.doFileSourceDrawCell( params );
|
||||
self.doOnDrawCell( params );
|
||||
end
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1938,17 +1938,6 @@ var
|
|||
aRect := CCell.Rect;
|
||||
end;
|
||||
|
||||
procedure callFileSourceDrawCell;
|
||||
var
|
||||
handler: TFileSourceUIHandler;
|
||||
begin
|
||||
handler:= ColumnsView.FileSource.GetUIHandler;
|
||||
if handler = nil then
|
||||
Exit;
|
||||
|
||||
handler.draw( params );
|
||||
end;
|
||||
|
||||
//------------------------------------------------------
|
||||
//end of subprocedures
|
||||
//------------------------------------------------------
|
||||
|
|
@ -1998,7 +1987,7 @@ begin
|
|||
params.drawingRect:= aRect;
|
||||
params.decorationRect:= self.ConvertToDecorationRect( params.drawingRect );
|
||||
params.focused:= (gdSelected in aState) and ColumnsView.Active;
|
||||
callFileSourceDrawCell;
|
||||
self.doFileSourceDrawCell( params );
|
||||
self.doOnDrawCell( params );
|
||||
|
||||
DrawCellGrid(aCol,aRow,aRect,aState);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ type
|
|||
property OnDrawCell: TFileViewOnDrawCell read _onDrawCell write _onDrawCell;
|
||||
protected
|
||||
function doCellClick( const Shift: TShiftState; const X, Y: Integer ): Boolean;
|
||||
procedure doFileSourceDrawCell( var params: TFileSourceUIParams );
|
||||
procedure doOnDrawCell( var params: TFileSourceUIParams );
|
||||
function getFileView: TFileView; virtual; abstract;
|
||||
public
|
||||
|
|
@ -68,6 +69,17 @@ begin
|
|||
Result:= handler.click( params );
|
||||
end;
|
||||
|
||||
procedure TFileViewBaseGrid.doFileSourceDrawCell( var params: TFileSourceUIParams );
|
||||
var
|
||||
handler: TFileSourceUIHandler;
|
||||
begin
|
||||
handler:= params.fs.GetUIHandler;
|
||||
if handler = nil then
|
||||
Exit;
|
||||
|
||||
handler.draw( params );
|
||||
end;
|
||||
|
||||
procedure TFileViewBaseGrid.doOnDrawCell( var params: TFileSourceUIParams );
|
||||
begin
|
||||
if Assigned(_onDrawCell) and not(CsDesigning in self.ComponentState) then
|
||||
|
|
|
|||
|
|
@ -550,17 +550,6 @@ var
|
|||
Canvas.Frame(aRect.Left + 1, aRect.Top + 1, aRect.Right - 1, aRect.Bottom - Canvas.TextHeight('Pp') - 1);
|
||||
end; //of DrawIconCell
|
||||
|
||||
procedure callFileSourceDrawCell;
|
||||
var
|
||||
handler: TFileSourceUIHandler;
|
||||
begin
|
||||
handler:= FThumbView.FileSource.GetUIHandler;
|
||||
if handler = nil then
|
||||
Exit;
|
||||
|
||||
handler.draw( params );
|
||||
end;
|
||||
|
||||
//------------------------------------------------------
|
||||
//end of subprocedures
|
||||
//------------------------------------------------------
|
||||
|
|
@ -597,7 +586,7 @@ begin
|
|||
DrawIconCell;
|
||||
|
||||
params.focused:= (gdSelected in aState) and FThumbView.Active;
|
||||
callFileSourceDrawCell;
|
||||
self.doFileSourceDrawCell( params );
|
||||
self.doOnDrawCell( params );
|
||||
end
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue