* Fix update of designer at change of page orientation (bugID 32470)

git-svn-id: trunk@55936 -
This commit is contained in:
michael 2017-09-27 19:37:53 +00:00
parent 91c3879a87
commit ac938407f0
6 changed files with 76 additions and 26 deletions

View File

@ -128,13 +128,14 @@ Type
procedure PaintBackGround; virtual;
procedure PaintObjects(ObjectSelection : TObjectSelection = osAll);virtual;
procedure PaintSelection;virtual;
Procedure PaintRulers;
Procedure PaintRulers; virtual;
procedure Paint; override;
Property VRuler : TDrawRuler Read FVRuler;
Property HRuler : TDrawRuler Read FHRuler;
public
constructor Create(AOwner: TComponent); override;
destructor destroy; override;
procedure UpdatePageParams; virtual;
procedure Reset;
procedure CancelOperation;
Function AddBand(ABandClass : TFPReportBandClass) : TFPReportCustomBand;
@ -269,17 +270,23 @@ begin
Result:=Objects.GetObjectAt(P,AOPtions);
end;
procedure TFPReportDesignerControl.SetPage(AValue: TFPReportCustomPage);
procedure TFPReportDesignerControl.UpdatePageParams;
Var
W,H : Integer;
begin
If AValue=FPage then exit;
FPage:=AValue;
// Top left is default set
W:=mmToPixels(FPage.PageSize.Width,CurrentDPI);
H:=mmToPixels(FPage.PageSize.Height,CurrentDPI);
if FPage.Orientation=poPortrait then
begin
W:=mmToPixels(FPage.PageSize.Width,CurrentDPI);
H:=mmToPixels(FPage.PageSize.Height,CurrentDPI);
end
else
begin
W:=mmToPixels(FPage.PageSize.Height,CurrentDPI);
H:=mmToPixels(FPage.PageSize.Width,CurrentDPI);
end;
FPageRect.Right:=FPageRect.Left+W;
FPageRect.Bottom:=FPageRect.Top+H;
{$IFDEF DEBUGRD} Writeln('Page width',FPage.Layout.Width,' at ',CurrentDPI,' : ',FPageRect.Right);{$ENDIF}
@ -302,6 +309,15 @@ begin
end;
SetCanvasExportCoordinates;
SetRulerParams;
end;
procedure TFPReportDesignerControl.SetPage(AValue: TFPReportCustomPage);
begin
If AValue=FPage then exit;
FPage:=AValue;
UpdatePageParams;
FObjects.LoadFromPage(AValue);
FObjects.OrderBands(Canvas,CurrentDPI);
Invalidate;

View File

@ -6,7 +6,6 @@ object ObjectInspectorFrame: TObjectInspectorFrame
Align = alTop
ClientHeight = 240
ClientWidth = 320
LCLVersion = '1.9.0.0'
TabOrder = 0
DesignLeft = 577
DesignTop = 218
@ -66,6 +65,7 @@ object ObjectInspectorFrame: TObjectInspectorFrame
Filter = [tkInteger, tkChar, tkEnumeration, tkFloat, tkSet, tkSString, tkLString, tkAString, tkWString, tkVariant, tkRecord, tkObject, tkWChar, tkBool, tkInt64, tkQWord, tkUString, tkUChar]
Indent = 10
NameFont.Color = clWindowText
OnModified = PGReportModified
ValueFont.Color = clMaroon
end
object LPropertyGrid: TLabel

View File

@ -34,10 +34,12 @@ type
PGReport: TTIPropertyGrid;
Splitter1: TSplitter;
TVReport: TTreeView;
procedure PGReportModified(Sender: TObject);
procedure TVReportSelectionChanged(Sender: TObject);
private
FISC: Boolean;
FList: TReportObjectList;
FOnModified: TNotifyEvent;
FOnSelectElement: TSelectElementEvent;
FReport: TFPReport;
procedure AddElementChildren(AParentNode: TTreeNode; AParent: TFPReportElementWithChildren);
@ -57,6 +59,7 @@ type
Property ShowReportTree : Boolean Read GetSRT Write SetSRT;
Property Report : TFPReport Read FReport Write SetReport;
Property OnSelectElement : TSelectElementEvent Read FOnSelectElement Write FOnSelectElement;
Property OnModified : TNotifyEvent Read FOnModified Write FOnModified;
end;
implementation
@ -153,6 +156,12 @@ begin
OnSelectElement(Self,C);
end;
procedure TObjectInspectorFrame.PGReportModified(Sender: TObject);
begin
If Assigned(FOnModified) then
FOnModified(Self);
end;
procedure TObjectInspectorFrame.AddElementChildren(AParentNode : TTreeNode; AParent : TFPReportElementWithChildren);
Var

View File

@ -22,7 +22,7 @@ object FPReportDesignerForm: TFPReportDesignerForm
LCLVersion = '1.9.0.0'
object PCReport: TPageControl
Left = 240
Height = 678
Height = 655
Top = 22
Width = 395
ActivePage = TSDesign
@ -251,11 +251,11 @@ object FPReportDesignerForm: TFPReportDesignerForm
end
end
inline FOI: TObjectInspectorFrame
Height = 678
Height = 655
Top = 22
Width = 235
Align = alLeft
ClientHeight = 678
ClientHeight = 655
ClientWidth = 235
TabOrder = 2
DesignLeft = 408
@ -270,13 +270,13 @@ object FPReportDesignerForm: TFPReportDesignerForm
Width = 235
end
inherited Panel2: TPanel
Height = 508
Height = 485
Width = 235
ClientHeight = 508
ClientHeight = 485
ClientWidth = 235
inherited PGReport: TTIPropertyGrid
Height = 480
Width = 231
Height = 461
Width = 235
end
inherited LPropertyGrid: TLabel
Width = 144
@ -285,14 +285,14 @@ object FPReportDesignerForm: TFPReportDesignerForm
end
object SObjectInspector: TSplitter
Left = 235
Height = 678
Height = 655
Top = 22
Width = 5
end
object SBReport: TStatusBar
Left = 0
Height = 25
Top = 700
Top = 677
Width = 890
Panels = <
item
@ -311,28 +311,28 @@ object FPReportDesignerForm: TFPReportDesignerForm
end
inline FReportData: TReportDataDisplay
Left = 640
Height = 678
Height = 655
Top = 22
Width = 250
Align = alRight
ClientHeight = 678
ClientHeight = 655
ClientWidth = 250
TabOrder = 5
inherited PCData: TPageControl
Height = 678
Height = 655
Width = 250
ActivePage = FReportData.TSData
TabIndex = 0
inherited TSData: TTabSheet
ClientHeight = 643
ClientHeight = 620
ClientWidth = 244
inherited TVData: TTreeView
Height = 643
Height = 620
Width = 244
end
end
inherited TSVariables: TTabSheet
ClientHeight = 643
ClientHeight = 620
ClientWidth = 244
inherited LBVariables: TListBox
Height = 643
@ -344,7 +344,7 @@ object FPReportDesignerForm: TFPReportDesignerForm
end
object Splitter1: TSplitter
Left = 635
Height = 678
Height = 655
Top = 22
Width = 5
Align = alRight

View File

@ -270,6 +270,7 @@ type
procedure GetReportDataNames(Sender: TObject; List: TStrings);
procedure InitialiseData;
{$ENDIF}
procedure DoSelectionModifiedByOI(Sender: TObject);
function GetModified: boolean;
procedure ActivateDesignerForElement(AElement: TFPReportElement);
procedure SetBandActionTags;
@ -407,6 +408,7 @@ begin
// END OF DEMO
SetFileCaption('');
FOI.OnSelectElement:=@DoSelectComponent;
FOI.OnModified:=@DoSelectionModifiedByOI;
end;
procedure TFPReportDesignerForm.FormCloseQuery(Sender: TObject;
@ -791,6 +793,22 @@ begin
end;
end;
procedure TFPReportDesignerForm.DoSelectionModifiedByOI(Sender: TObject);
begin
if Assigned(CurrentDesigner) then
begin
if (FOI.ObjectList.Count=1) and
(FOI.ObjectList.Elements[0]=CurrentDesigner.Page) then
begin
CurrentDesigner.UpdatePageParams;
CurrentDesigner.Reset;
CurrentDesigner.Objects.SelectElement(CurrentDesigner.Page)
end
else
CurrentDesigner.Invalidate;
end;
end;
function TFPReportDesignerForm.SaveReport: Boolean;
begin
Result:=Assigned(OnSaveReport);

View File

@ -853,9 +853,16 @@ end;
procedure TFPReportExportCanvas.GetPageRenderSize(APage: TFPReportCustomPage;
out AWidth, AHeight: Integer);
begin
AWidth := HmmToPixels(APage.PageSize.Width);
AHeight := VmmToPixels(APage.PageSize.Height);
if (APage.Orientation=poPortrait) then
begin
AWidth := HmmToPixels(APage.PageSize.Width);
AHeight := VmmToPixels(APage.PageSize.Height);
end
else
begin
AWidth := VmmToPixels(APage.PageSize.Height);
AHeight := HmmToPixels(APage.PageSize.Width);
end;
end;
procedure TFPReportExportCanvas.RenderElement(ABand : TFPReportCustomBand; Element : TFPReportElement);