mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 01:59:08 +02:00
designer: formatting, + add misc debugLn
git-svn-id: trunk@16858 -
This commit is contained in:
parent
1ea08777de
commit
942fc72cd3
@ -2409,6 +2409,7 @@ begin
|
|||||||
AComponent:=FLookupRoot.Components[i];
|
AComponent:=FLookupRoot.Components[i];
|
||||||
if ComponentIsNonVisual(AComponent) then begin
|
if ComponentIsNonVisual(AComponent) then begin
|
||||||
Diff:=aDDC.FormOrigin;
|
Diff:=aDDC.FormOrigin;
|
||||||
|
//DebugLn(['aDDC.FormOrigin - ', Diff.X, ' : ' ,Diff.Y]);
|
||||||
// non-visual component
|
// non-visual component
|
||||||
ItemLeftTop:=NonVisualComponentLeftTop(AComponent);
|
ItemLeftTop:=NonVisualComponentLeftTop(AComponent);
|
||||||
ItemLeft:=ItemLeftTop.X-Diff.X;
|
ItemLeft:=ItemLeftTop.X-Diff.X;
|
||||||
|
@ -37,8 +37,12 @@ uses
|
|||||||
Graphics, FormEditingIntf;
|
Graphics, FormEditingIntf;
|
||||||
|
|
||||||
type
|
type
|
||||||
TDesignerDCFlag = (ddcDCOriginValid, ddcFormOriginValid,
|
TDesignerDCFlag = (
|
||||||
ddcFormClientOriginValid, ddcSizeValid);
|
ddcDCOriginValid, // please comment
|
||||||
|
ddcFormOriginValid, //
|
||||||
|
ddcFormClientOriginValid, //
|
||||||
|
ddcSizeValid //
|
||||||
|
);
|
||||||
TDesignerDCFlags = set of TDesignerDCFlag;
|
TDesignerDCFlags = set of TDesignerDCFlag;
|
||||||
|
|
||||||
TDesignerDeviceContext = class
|
TDesignerDeviceContext = class
|
||||||
@ -356,11 +360,13 @@ function TDesignerDeviceContext.GetFormOrigin: TPoint;
|
|||||||
// returns the DC origin relative to the form client origin
|
// returns the DC origin relative to the form client origin
|
||||||
// For example: The DC of the client area of the form itself will return 0,0
|
// For example: The DC of the client area of the form itself will return 0,0
|
||||||
begin
|
begin
|
||||||
if not (ddcFormOriginValid in FFlags) then begin
|
if not (ddcFormOriginValid in FFlags) then
|
||||||
GetDCOriginRelativeToWindow(FDC,FForm.Handle,FFormOrigin);
|
begin
|
||||||
Include(FFlags,ddcFormOriginValid);
|
GetDCOriginRelativeToWindow(FDC, FForm.Handle, FFormOrigin);
|
||||||
|
Include(FFlags, ddcFormOriginValid);
|
||||||
|
// DebugLn(['New origin: ', FFormOrigin.X, ':', FFormOrigin.Y]);
|
||||||
end;
|
end;
|
||||||
Result:=FFormOrigin;
|
Result := FFormOrigin;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TDesignerDeviceContext.Create;
|
constructor TDesignerDeviceContext.Create;
|
||||||
@ -385,25 +391,26 @@ end;
|
|||||||
procedure TDesignerDeviceContext.Clear;
|
procedure TDesignerDeviceContext.Clear;
|
||||||
begin
|
begin
|
||||||
Restore;
|
Restore;
|
||||||
FDC:=0;
|
FDC := 0;
|
||||||
FFlags:=FFlags-[ddcFormOriginValid,ddcFormClientOriginValid,ddcDCOriginValid,
|
FFlags := FFlags - [ddcFormOriginValid, ddcFormClientOriginValid, ddcDCOriginValid, ddcSizeValid];
|
||||||
ddcSizeValid];
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDesignerDeviceContext.Save;
|
procedure TDesignerDeviceContext.Save;
|
||||||
begin
|
begin
|
||||||
if FSavedDC=0 then begin
|
if FSavedDC = 0 then
|
||||||
FSavedDC:=SaveDC(DC);
|
begin
|
||||||
FCanvas.Handle:=FDC;
|
FSavedDC := SaveDC(DC);
|
||||||
|
FCanvas.Handle := FDC;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDesignerDeviceContext.Restore;
|
procedure TDesignerDeviceContext.Restore;
|
||||||
begin
|
begin
|
||||||
if FSavedDC<>0 then begin
|
if FSavedDC <> 0 then
|
||||||
FCanvas.Handle:=0;
|
begin
|
||||||
RestoreDC(DC,FSavedDC);
|
FCanvas.Handle := 0;
|
||||||
FSavedDC:=0;
|
RestoreDC(DC, FSavedDC);
|
||||||
|
FSavedDC := 0;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -413,14 +420,14 @@ function TDesignerDeviceContext.RectVisible(ALeft, ATop, ARight,
|
|||||||
var
|
var
|
||||||
ASize: TPoint;
|
ASize: TPoint;
|
||||||
begin
|
begin
|
||||||
if (ARight<0) or (ABottom<0) then
|
if (ARight < 0) or (ABottom < 0) then
|
||||||
Result:=false
|
Result := False
|
||||||
else begin
|
else begin
|
||||||
ASize:=DCSize;
|
ASize := DCSize;
|
||||||
if (ALeft>=ASize.X) or (ATop>=ASize.Y) then
|
if (ALeft >= ASize.X) or (ATop >= ASize.Y) then
|
||||||
Result:=false
|
Result := False
|
||||||
else
|
else
|
||||||
Result:=true;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user