mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-29 18:42:56 +01:00
* Update selection and report tree when adding bands or elements
git-svn-id: trunk@57393 -
This commit is contained in:
parent
108231f841
commit
ac1bff1365
@ -190,6 +190,8 @@ begin
|
|||||||
Parent:= AOwner as TWinControl;
|
Parent:= AOwner as TWinControl;
|
||||||
Color:=clWhite;
|
Color:=clWhite;
|
||||||
FSnapResolution := 8;
|
FSnapResolution := 8;
|
||||||
|
FMinControlHeight:=FSnapResolution*2;
|
||||||
|
FMinControlWidth:=FSnapResolution*2;
|
||||||
FCanvasExport:=CreateExportCanvas;
|
FCanvasExport:=CreateExportCanvas;
|
||||||
FCanvasExport.Canvas:=Self.Canvas;
|
FCanvasExport.Canvas:=Self.Canvas;
|
||||||
FCanvasExport.HDPI:=CurrentDPI;
|
FCanvasExport.HDPI:=CurrentDPI;
|
||||||
@ -579,9 +581,17 @@ end;
|
|||||||
|
|
||||||
function TFPReportDesignerControl.DoAddControl(ABand: TFPReportCustomBand; AElement : TFPReportElement; ARect: TRect; IsMulti: Boolean) : TReportObject;
|
function TFPReportDesignerControl.DoAddControl(ABand: TFPReportCustomBand; AElement : TFPReportElement; ARect: TRect; IsMulti: Boolean) : TReportObject;
|
||||||
|
|
||||||
|
Function MinSize (aSize : Integer) : Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:=ASize; // Should be handled in calling routine, actually
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
Var
|
Var
|
||||||
ERect,BRect : TRect;
|
ERect,BRect : TRect;
|
||||||
RRect : TFPReportRect;
|
RRect : TFPReportRect;
|
||||||
|
W,H : Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
AElement.Parent:=ABand;
|
AElement.Parent:=ABand;
|
||||||
@ -590,10 +600,12 @@ begin
|
|||||||
ERect.Top:=ARect.Top-BRect.Top;
|
ERect.Top:=ARect.Top-BRect.Top;
|
||||||
ERect.Right:=ARect.Right-BRect.Left;
|
ERect.Right:=ARect.Right-BRect.Left;
|
||||||
ERect.Bottom:=ARect.Bottom-BRect.Top;
|
ERect.Bottom:=ARect.Bottom-BRect.Top;
|
||||||
|
W:=MinSize(ERect.Right-ERect.Left);
|
||||||
|
H:=MinSize(ERect.Bottom-ERect.Top);
|
||||||
RRect.SetRect(PixelsToMM(ERect.Left,CurrentDPI),
|
RRect.SetRect(PixelsToMM(ERect.Left,CurrentDPI),
|
||||||
PixelsToMM(ERect.Top,CurrentDPI),
|
PixelsToMM(ERect.Top,CurrentDPI),
|
||||||
PixelsToMM(ERect.Right-ERect.Left,CurrentDPI),
|
PixelsToMM(W,CurrentDPI),
|
||||||
PixelsToMM(ERect.Bottom-ERect.Top,CurrentDPI));
|
PixelsToMM(W,CurrentDPI));
|
||||||
{$IFDEF DEBUGRD} Writeln('Adding,',AElement.ClassName,' at absolute rect:',RectToStr(ARect),', band rect: ',RectToStr(BRect),' -> Relative rect ',RectToStr(ERect),' natural units: ',RRect.AsString);{$ENDIF}
|
{$IFDEF DEBUGRD} Writeln('Adding,',AElement.ClassName,' at absolute rect:',RectToStr(ARect),', band rect: ',RectToStr(BRect),' -> Relative rect ',RectToStr(ERect),' natural units: ',RRect.AsString);{$ENDIF}
|
||||||
AElement.Layout.SetPosition(RRect);
|
AElement.Layout.SetPosition(RRect);
|
||||||
Result:=FObjects.AddElement(AElement);
|
Result:=FObjects.AddElement(AElement);
|
||||||
@ -1194,11 +1206,17 @@ end;
|
|||||||
|
|
||||||
function TFPReportDesignerControl.AddBand(ABandClass: TFPReportBandClass
|
function TFPReportDesignerControl.AddBand(ABandClass: TFPReportBandClass
|
||||||
): TFPReportCustomBand;
|
): TFPReportCustomBand;
|
||||||
|
|
||||||
|
Var
|
||||||
|
O : TReportObject;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=ABandClass.Create(Page);
|
Result:=ABandClass.Create(Page);
|
||||||
Result.Layout.Height:=2;
|
Result.Layout.Height:=2;
|
||||||
FObjects.AddBand(Result);
|
O:=FObjects.AddBand(Result);
|
||||||
|
If Assigned(FOnElementCreated) then
|
||||||
|
FOnElementCreated(Self,Result);
|
||||||
|
O.Selected:=True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPReportDesignerControl.AddElement(
|
procedure TFPReportDesignerControl.AddElement(
|
||||||
|
|||||||
@ -1363,7 +1363,9 @@ begin
|
|||||||
TFPReportMemo(AElement).Font.Name := 'LiberationSans';
|
TFPReportMemo(AElement).Font.Name := 'LiberationSans';
|
||||||
if TFPReportMemo(AElement).Text='' then
|
if TFPReportMemo(AElement).Text='' then
|
||||||
TFPReportMemo(AElement).Text:='New memo';
|
TFPReportMemo(AElement).Text:='New memo';
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
FOI.RefreshReportTree;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF USEDEMOREPORT}
|
{$IFDEF USEDEMOREPORT}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user