From ad8ed0628ee0569ce5727fdcc5a6212be84f1cba Mon Sep 17 00:00:00 2001 From: Fabien Bodard Date: Sun, 28 Feb 2010 20:03:01 +0000 Subject: [PATCH] [GB.REPORT] * OPT: the size, orientation properties are removed, now the page size is defined by the painting device. git-svn-id: svn://localhost/gambas/trunk@2727 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- comp/src/gb.report/.info | 18 +---- comp/src/gb.report/.src/Report.class | 76 +++----------------- comp/src/gb.report/.src/Tests/FExample.class | 6 +- 3 files changed, 12 insertions(+), 88 deletions(-) diff --git a/comp/src/gb.report/.info b/comp/src/gb.report/.info index fa8395890..62a49c6a3 100644 --- a/comp/src/gb.report/.info +++ b/comp/src/gb.report/.info @@ -82,7 +82,7 @@ CA _Properties C s -*,Orientation{Report.Portrait;Landscape},Size +* _HiddenControls C s @@ -91,14 +91,6 @@ _IsForm C b -1 -Portrait -C -i -0 -Landscape -C -i -1 Count r i @@ -115,14 +107,6 @@ Scale p f -Orientation -p -i - -Size -p -s - _New m diff --git a/comp/src/gb.report/.src/Report.class b/comp/src/gb.report/.src/Report.class index 7f03311ce..53de3c481 100644 --- a/comp/src/gb.report/.src/Report.class +++ b/comp/src/gb.report/.src/Report.class @@ -4,21 +4,17 @@ Create Static Export Inherits ReportVBox -Public Const _Properties As String = "*,Orientation{Report.Portrait;Landscape},Size" +Public Const _Properties As String = "*" Public Const _HiddenControls As String = "Report,ReportControl,ReportContainer" Public Const _IsForm As Boolean = True 'Public Constants -Public Const Portrait As Integer = 0 -Public Const Landscape As Integer = 1 Public {Debug} As Boolean = False Private iCurPage As Integer = 0 Private $iCount As Integer = -1 Private $bLayoutIsDirty As Boolean = True Private $fScale As Float = 1.0 -Private $iOrientation As Integer = Portrait -Private $sSize As String = "A4" Private $hReportTControl As New TControl Private hData As Object @@ -26,15 +22,13 @@ Property Read Count As Integer Property Height As String Property Width As String Property Scale As Float -Property Orientation As Integer -Property Size As String 'EVENT Data() Public Sub _New() object.Attach(Me, Me, "Report") - SetReportSize + $hReportTControl.RelPage = 0 ReportControl._ObjectFromId[Me.id] = Me @@ -43,9 +37,11 @@ End Public Sub Layout() If Not $bLayoutIsDirty Then Return - MTools.ReportResolution = Paint.ResolutionX - SetReportSize() + Me.Width = MTools.PixelsToUnits(Paint.Width) & " cm" + Me.Height = MTools.PixelsToUnits(Paint.Height) & " cm" + + $hReportTControl.ctrl = Me $iCount = $hReportTControl._SetGeometry(0, 0, Me.Width, Me.Height) + 1 MTools.PageCount = $iCount @@ -148,62 +144,6 @@ End ' ' End - -Private Function Size_Read() As String - - Return $sSize - -End - -Private Sub Size_Write(Value As String) - - $sSize = Value - -End - -Private Sub SetReportSize() - Dim w As Float - Dim h As Float - If $sSize = "Custom" Then Return - Select Case $sSize - Case "A4" - w = 21 - h = 29.7 - Case "A3" - w = 29.7 - h = 42 - - Case "A5" - - Case "A6" - Case "Letter" - Case Else - End Select - - If Me.Orientation = Portrait Then - Me.Width = w & " cm" - Me.Height = h & " cm" - Else - Me.Width = h & " cm" - Me.Height = w & " cm" - - Endif - -End - - -Private Function Orientation_Read() As Integer - - Return $iOrientation - -End - -Private Sub Orientation_Write(Value As Integer) - - $iOrientation = Value - -End - Public Sub Clear() Super._Free @@ -212,8 +152,8 @@ Public Sub Clear() '$iResolution = Desktop.Resolution $bLayoutIsDirty = True $fScale = 1.0 - $iOrientation = Portrait - $sSize = "A4" + + Me.Spacing = "0 cm" Me.Padding = "0 cm" End diff --git a/comp/src/gb.report/.src/Tests/FExample.class b/comp/src/gb.report/.src/Tests/FExample.class index abce44884..28d75141d 100644 --- a/comp/src/gb.report/.src/Tests/FExample.class +++ b/comp/src/gb.report/.src/Tests/FExample.class @@ -221,8 +221,8 @@ Public Sub Test4() 'Report.Resolution = Desktop.Resolution - report.size = "A4" - report.orientation = report.Portrait + 'report.size = "A4" + 'report.orientation = report.Portrait 'Report.Units = Units.cm Report.Padding = "1 cm" Object.Attach(report, Me, "Report") @@ -449,7 +449,7 @@ Public Sub Slider1_Change() 'Report.Debug = True - DrawingArea1.Resize(UnitsToPixels(Report._Width) * Slider1.Value / 100, UnitsToPixels(Report._Height) * Slider1.Value / 100) + DrawingArea1.Resize((21 * Desktop.Resolution / 2.54) * Slider1.Value / 100, (29.7 * Desktop.Resolution / 2.54) * Slider1.Value / 100) DrawingArea1.Refresh