From bb6c67caaf5c073ff864b0ce996c9c861f2c9dc0 Mon Sep 17 00:00:00 2001 From: Fabien Bodard Date: Sat, 30 Apr 2011 22:34:54 +0000 Subject: [PATCH] [GB.REPORT] * BUG: Correct the Size int procedure of images * NEW: Add a button to compute all the page on Preview form git-svn-id: svn://localhost/gambas/trunk@3819 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- comp/src/gb.report/.info | 4 +- .../src/gb.report/.src/Preview/FPreview.class | 10 ++++- comp/src/gb.report/.src/Preview/FPreview.form | 7 ++- comp/src/gb.report/.src/Report.class | 1 + comp/src/gb.report/.src/ReportImage.class | 33 +++++++------- comp/src/gb.report/.src/ReportSvgImage.class | 44 ++++++------------- 6 files changed, 47 insertions(+), 52 deletions(-) diff --git a/comp/src/gb.report/.info b/comp/src/gb.report/.info index 9de5f937b..b126d83eb 100644 --- a/comp/src/gb.report/.info +++ b/comp/src/gb.report/.info @@ -781,7 +781,7 @@ C _Properties C s -*,Image{Image} +*,Stretch,Image{Image} _Similar C s @@ -936,7 +936,7 @@ C _Properties C s -*,Image{SvgImage} +*,Stretch,Image{SvgImage} _Similar C s diff --git a/comp/src/gb.report/.src/Preview/FPreview.class b/comp/src/gb.report/.src/Preview/FPreview.class index f4adcc67b..36a4e0ef0 100644 --- a/comp/src/gb.report/.src/Preview/FPreview.class +++ b/comp/src/gb.report/.src/Preview/FPreview.class @@ -29,7 +29,7 @@ Public Sub DrawingArea1_Draw() '$hreport.Layout $hReport.Scale = $fScale - $hreport._Layout(SpinBox1.Value - 1) + $hreport._Layout(IIf(ToolButton1.Tag, -1, SpinBox1.Value - 1)) $hReport.Paint($iPage) Label2.Text = " / " & IIf($hreport._LayoutNotFinished, "Computing...", $hreport.PageCount) SpinBox1.MaxValue = IIf($hreport._LayoutNotFinished, $hReport.PageCount + 1, $hReport.PageCount) @@ -194,4 +194,12 @@ Public Sub SpinBox1_Enter() +End + +Public Sub ToolButton1_Click() + + Last.Tag = True + DrawingArea1.Refresh + ToolButton1.Enabled = False + End diff --git a/comp/src/gb.report/.src/Preview/FPreview.form b/comp/src/gb.report/.src/Preview/FPreview.form index 05a8484fa..030c5cc3d 100644 --- a/comp/src/gb.report/.src/Preview/FPreview.form +++ b/comp/src/gb.report/.src/Preview/FPreview.form @@ -82,8 +82,13 @@ MoveScaled(51,0,8,4) AutoResize = True } + { ToolButton1 ToolButton + MoveScaled(58,0,4,4) + ToolTip = ("Compute all") + Picture = Picture["icon:/22/last"] + } { HBox1 HBox - MoveScaled(59,0,12,3) + MoveScaled(62,0,12,3) Expand = True } } diff --git a/comp/src/gb.report/.src/Report.class b/comp/src/gb.report/.src/Report.class index 38357b794..b4aef5dcc 100644 --- a/comp/src/gb.report/.src/Report.class +++ b/comp/src/gb.report/.src/Report.class @@ -113,6 +113,7 @@ Public Sub _Layout(Optional iPage As Integer = -1) Dim CBaseSection As ReportContainer Dim i As Integer 'If iPage < 0 Then Return + If Not $bLayoutIsDirty Then Return If iPage > -1 Then If iPage <= $iCurPage Then Return Else diff --git a/comp/src/gb.report/.src/ReportImage.class b/comp/src/gb.report/.src/ReportImage.class index 8e2b087ab..546a266d6 100644 --- a/comp/src/gb.report/.src/ReportImage.class +++ b/comp/src/gb.report/.src/ReportImage.class @@ -18,26 +18,25 @@ Public Sub _GetSizeHints(AvailableW As Float, AvailableH As Float, TotalWidth As Dim w As Float = IIf(Me._Width > AvailableW, AvailableW, Me._Width) Dim Scale As Float - If h > 0 Or w > 0 Then + If h = 0 Then H = AvailableH + If w = 0 Then w = AvailableW - If $bStretch Then - hMyHints.Width = w + Me.Padding._Top + Me.Padding._Bottom - hMyHints.Height = h + AvailableW + Me.Padding._Left + Me.Padding._Right - Else - If h > w Then - Scale = $hpic.Width / $hpic.Height - hMyHints.Width = (h * Scale) + Me.Padding._Left + Me.Padding._Right - hMyHints.Height = h + Me.Padding._Top + Me.Padding._Bottom - Else - Scale = $hpic.Height / $hpic.Width - hMyHints.Height = (w * Scale) + Me.Padding._Top + Me.Padding._Bottom - hMyHints.Width = w + Me.Padding._Left + Me.Padding._Right - Endif - Endif + If $bStretch Then + hMyHints.Width = w + Me.Padding._Top + Me.Padding._Bottom + hMyHints.Height = h + AvailableW + Me.Padding._Left + Me.Padding._Right Else - hMyHints.Height = AvailableH + Me.Padding._Top + Me.Padding._Bottom - hMyHints.Width = AvailableW + Me.Padding._Left + Me.Padding._Right + If h < w Then + Scale = $hpic.Width / $hpic.Height + hMyHints.Width = (h * Scale) + Me.Padding._Left + Me.Padding._Right + hMyHints.Height = h + Me.Padding._Top + Me.Padding._Bottom + Else + Scale = $hpic.Height / $hpic.Width + hMyHints.Height = (w * Scale) + Me.Padding._Top + Me.Padding._Bottom + hMyHints.Width = w + Me.Padding._Left + Me.Padding._Right + Endif Endif + + Return hMyHints End diff --git a/comp/src/gb.report/.src/ReportSvgImage.class b/comp/src/gb.report/.src/ReportSvgImage.class index 9f20b0567..2d104f147 100644 --- a/comp/src/gb.report/.src/ReportSvgImage.class +++ b/comp/src/gb.report/.src/ReportSvgImage.class @@ -18,13 +18,15 @@ Public Sub _GetSizeHints(AvailableW As Float, AvailableH As Float, TotalWidth As Dim h As Float = IIf(Me._Height > AvailableH, AvailableH, Me._Height) Dim w As Float = IIf(Me._Width > AvailableW, AvailableW, Me._Width) Dim Scale As Float - If h > 0 Or w > 0 Then - + + If h = 0 Then H = AvailableH + If w = 0 Then w = AvailableW + If $bStretch Then - hMyHints.Width = w + Me.Padding._Top + Me.Padding._Bottom - hMyHints.Height = h + AvailableW + Me.Padding._Left + Me.Padding._Right + hMyHints.Height = h + Me.Padding._Top + Me.Padding._Bottom + hMyHints.Width = w + Me.Padding._Left + Me.Padding._Right Else - If h > w Then + If h < w Then Scale = $hSvgImage.Width / $hSvgImage.Height hMyHints.Width = (h * Scale) + Me.Padding._Left + Me.Padding._Right hMyHints.Height = h + Me.Padding._Top + Me.Padding._Bottom @@ -34,34 +36,14 @@ Public Sub _GetSizeHints(AvailableW As Float, AvailableH As Float, TotalWidth As hMyHints.Width = w + Me.Padding._Left + Me.Padding._Right Endif Endif -Else - hMyHints.Height = AvailableH + Me.Padding._Top + Me.Padding._Bottom - hMyHints.Width = AvailableW + Me.Padding._Left + Me.Padding._Right -Endif - - - ' If h > 0 Or w > 0 Then - ' - ' If h > w Then - ' Scale = $hSvgImage.Width / $hSvgImage.Height - ' hMyHints.Width = (h * Scale) + Me.Padding._Left + Me.Padding._Right - ' hMyHints.Height = h + Me.Padding._Top + Me.Padding._Bottom - ' Else - ' Scale = $hSvgImage.Height / $hSvgImage.Width - ' hMyHints.Height = (w * Scale) + Me.Padding._Top + Me.Padding._Bottom - ' hMyHints.Width = w + Me.Padding._Left + Me.Padding._Right - ' Endif - ' Else - ' hMyHints.Height = AvailableH + Me.Padding._Top + Me.Padding._Bottom - ' hMyHints.Width = AvailableW + Me.Padding._Left + Me.Padding._Right - ' Endif + Return hMyHints End Public Sub _Paint(Page As Integer, X As Float, Y As Float, hControl As TControl, VirtualId As Integer) - + Dim iX, iY, iW, iH As Integer iX = (x + hControl.RealLeft + MTools.UnitsToPixels(Me.Padding._Left + Me.Border._Left)) @@ -94,13 +76,13 @@ Private Sub Image_Write(Value As SvgImage) End Private Function Stretch_Read() As Boolean - + Return $bStretch - + End Private Sub Stretch_Write(Value As Boolean) - + $bStretch = Value - + End