lcl: formatting

git-svn-id: trunk@27757 -
This commit is contained in:
paul 2010-10-19 01:11:31 +00:00
parent 94ca121303
commit 9b70fb4a72

View File

@ -4083,75 +4083,81 @@ var
Node: TTreeNode; Node: TTreeNode;
InsertMarkRect: TRect; InsertMarkRect: TRect;
begin begin
if [tvsUpdating,tvsPainting]*FStates<>[] then exit; if [tvsUpdating,tvsPainting] * FStates <> [] then Exit;
Include(FStates,tvsPainting); Include(FStates, tvsPainting);
if (tvoAutoItemHeight in fOptions) then if (tvoAutoItemHeight in fOptions) then
UpdateDefaultItemHeight; UpdateDefaultItemHeight;
UpdateScrollbars; UpdateScrollbars;
with Canvas do begin with Canvas do
if Assigned(FOnCustomDraw) or Assigned(FOnAdvancedCustomDraw) then begin begin
DrawRect:=ClientRect; if Assigned(FOnCustomDraw) or Assigned(FOnAdvancedCustomDraw) then
if not CustomDraw(DrawRect,cdPrePaint) then exit; begin
DrawRect := ClientRect;
if not CustomDraw(DrawRect, cdPrePaint) then exit;
end; end;
// draw nodes // draw nodes
Node:=TopItem; Node := TopItem;
//write('[TCustomTreeView.DoPaint] A Node=',DbgS(Node)); //write('[TCustomTreeView.DoPaint] A Node=',DbgS(Node));
//if Node<>nil then DebugLn(' Node.Text=',Node.Text) else DebugLn(''); //if Node<>nil then DebugLn(' Node.Text=',Node.Text) else DebugLn('');
while Node<>nil do begin while Node <> nil do
begin
DoPaintNode(Node); DoPaintNode(Node);
Node:=Node.GetNextVisible; Node := Node.GetNextVisible;
//write('[TCustomTreeView.DoPaint] B Node=',DbgS(Node)); //write('[TCustomTreeView.DoPaint] B Node=',DbgS(Node));
//if Node<>nil then DebugLn(' Node.Text=',Node.Text) else DebugLn(''); //if Node<>nil then DebugLn(' Node.Text=',Node.Text) else DebugLn('');
end; end;
SpaceRect:=Rect(BorderWidth,BorderWidth, SpaceRect := Rect(BorderWidth, BorderWidth,
(ClientWidth-ScrollBarWidth)-BorderWidth, (ClientWidth - ScrollBarWidth) - BorderWidth,
(ClientHeight-ScrollBarWidth)-BorderWidth); (ClientHeight - ScrollBarWidth) - BorderWidth);
// draw insert mark for new root node // draw insert mark for new root node
if (InsertMarkType=tvimAsFirstChild) if (InsertMarkType = tvimAsFirstChild) and (Items.Count = 0) then
and (Items.Count=0) then begin begin
Pen.Color:=FTreeLineColor; Pen.Color := FTreeLineColor;
Brush.Color:=FSelectedColor; Brush.Color := FSelectedColor;
InsertMarkRect:=SpaceRect; InsertMarkRect := SpaceRect;
InsertMarkRect.Bottom:=InsertMarkRect.Top+2; InsertMarkRect.Bottom := InsertMarkRect.Top + 2;
Rectangle(InsertMarkRect); Rectangle(InsertMarkRect);
SpaceRect.Top:=InsertMarkRect.Bottom; SpaceRect.Top := InsertMarkRect.Bottom;
end; end;
// draw unused space below nodes // draw unused space below nodes
Node:=BottomItem; Node := BottomItem;
if Node<>nil then if Node <> nil then
SpaceRect.Top:=Node.Top+Node.Height-FScrolledTop+BorderWidth; SpaceRect.Top := Node.Top + Node.Height - FScrolledTop + BorderWidth;
//if Node<>nil then DebugLn('BottomItem=',BottomItem.text) else DebugLn('NO BOTTOMITEM!!!!!!!!!'); //if Node<>nil then DebugLn('BottomItem=',BottomItem.text) else DebugLn('NO BOTTOMITEM!!!!!!!!!');
// TWinControl(Parent).InvalidateRect(Self,SpaceRect,true); // TWinControl(Parent).InvalidateRect(Self,SpaceRect,true);
if (FBackgroundColor<>clNone) and (SpaceRect.Top<SpaceRect.Bottom) then if (FBackgroundColor <> clNone) and (SpaceRect.Top < SpaceRect.Bottom) then
begin begin
//DebugLn(' SpaceRect=',SpaceRect.Left,',',SpaceRect.Top,',',SpaceRect.Right,',',SpaceRect.Bottom); //DebugLn(' SpaceRect=',SpaceRect.Left,',',SpaceRect.Top,',',SpaceRect.Right,',',SpaceRect.Bottom);
Brush.Color:=FBackgroundColor; Brush.Color := FBackgroundColor;
FillRect(SpaceRect); FillRect(SpaceRect);
end; end;
// draw border // draw border
HalfBorderWidth:=BorderWidth shr 1; HalfBorderWidth := BorderWidth shr 1;
Pen.Color:=clGray; Pen.Color := clGray;
for a:=0 to BorderWidth-1 do begin for a := 0 to BorderWidth - 1 do
if a=HalfBorderWidth then begin
Pen.Color:=clBlack; if a = HalfBorderWidth then
MoveTo(a,(ClientHeight-ScrollBarWidth)-1-a); Pen.Color := clBlack;
LineTo(a,a); MoveTo(a, (ClientHeight-ScrollBarWidth) - 1 - a);
LineTo((ClientWidth-ScrollBarWidth)-1-a,a); LineTo(a, a);
LineTo((ClientWidth - ScrollBarWidth) - 1 - a, a);
end; end;
Pen.Color:=clWhite; Pen.Color := clWhite;
for a:=0 to BorderWidth-1 do begin for a := 0 to BorderWidth - 1 do
if a=HalfBorderWidth then begin
Pen.Color:=clLtGray; if a = HalfBorderWidth then
MoveTo((ClientWidth-ScrollBarWidth)-1-a,a); Pen.Color := clLtGray;
LineTo((ClientWidth-ScrollBarWidth)-1-a,(ClientHeight-ScrollBarWidth)-1-a); MoveTo((ClientWidth - ScrollBarWidth) - 1 - a, a);
LineTo(a,(ClientHeight-ScrollBarWidth)-1-a); LineTo((ClientWidth - ScrollBarWidth) - 1 - a, (ClientHeight - ScrollBarWidth) - 1 - a);
LineTo(a, (ClientHeight-ScrollBarWidth) - 1 - a);
end; end;
if Assigned(FOnCustomDraw) or Assigned(FOnAdvancedCustomDraw) then begin if Assigned(FOnCustomDraw) or Assigned(FOnAdvancedCustomDraw) then
DrawRect:=ClientRect; begin
if not CustomDraw(DrawRect,cdPostPaint) then exit; DrawRect := ClientRect;
if not CustomDraw(DrawRect, cdPostPaint) then exit;
end; end;
end; end;
Exclude(FStates,tvsPainting); Exclude(FStates, tvsPainting);
end; end;
procedure TCustomTreeView.DoPaintNode(Node: TTreeNode); procedure TCustomTreeView.DoPaintNode(Node: TTreeNode);