From b947d1f8f9e3cc0d0a067bd32c576c2f3cbdf7ce Mon Sep 17 00:00:00 2001 From: Fabien Bodard Date: Fri, 15 Apr 2011 23:10:01 +0000 Subject: [PATCH] [GB.REPORT] * OPT: Continue to modify the preview dialog * NEW: _Similar property is filled git-svn-id: svn://localhost/gambas/trunk@3769 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- comp/src/gb.report/.info | 44 ++++++--- .../src/gb.report/.src/Preview/FPreview.class | 3 + comp/src/gb.report/.src/Preview/FPreview.form | 31 ++++-- comp/src/gb.report/.src/Report.class | 4 +- comp/src/gb.report/.src/ReportBrush.class | 1 + comp/src/gb.report/.src/ReportHBox.class | 2 +- comp/src/gb.report/.src/ReportImage.class | 2 +- comp/src/gb.report/.src/ReportLabel.class | 2 +- comp/src/gb.report/.src/ReportLine.class | 2 +- comp/src/gb.report/.src/ReportSvgImage.class | 2 +- comp/src/gb.report/.src/ReportTextLabel.class | 2 +- comp/src/gb.report/.src/ReportVBox.class | 2 +- comp/src/gb.report/.src/Tests/Paint.class | 58 +++++------ comp/src/gb.report/.src/Tests/Report2.report | 99 +++++++++---------- 14 files changed, 142 insertions(+), 112 deletions(-) diff --git a/comp/src/gb.report/.info b/comp/src/gb.report/.info index 0c992c00f..c36752f6e 100644 --- a/comp/src/gb.report/.info +++ b/comp/src/gb.report/.info @@ -98,22 +98,6 @@ i #Paint C -Begin -M - -(Device)o -End -M - -(Device)o -Rectangle -M - -(X)f(Y)f(W)f(H)f -Text -M - -(Text)s[(X)f(Y)f(Width)f(Height)f(Alignment)i] #Report ReportSection CA @@ -759,6 +743,10 @@ _Properties C s * +_Similar +C +s +ReportVBox _new m @@ -782,6 +770,10 @@ _Properties C s *,Image{Image} +_Similar +C +s +ReportTextLabel Image p Image @@ -801,6 +793,10 @@ _Properties C s *,Text,Key,Format,Alignment{Align.*},UseField +_Similar +C +s +ReportTextLabel Text p s @@ -840,6 +836,10 @@ _Properties C s *,Direction{Align.TopLeft;Top;TopRight;Left;Right;BottomLeft;Bottom;BottomRight}=BottomRight,LineWidth{ReportCoord}=2 px +_Similar +C +s +ReportTextLabel Direction p i @@ -878,6 +878,10 @@ s #ReportSvgImage ReportControl C +_Similar +C +s +ReportTextLabel Path p s @@ -897,6 +901,10 @@ _Properties C s *,Text,Alignment{Align.*} +_Similar +C +s +ReportControl Text p s @@ -924,6 +932,10 @@ _Properties C s * +_Similar +C +s +ReportVBox _new m diff --git a/comp/src/gb.report/.src/Preview/FPreview.class b/comp/src/gb.report/.src/Preview/FPreview.class index e5baab4ba..9388b951e 100644 --- a/comp/src/gb.report/.src/Preview/FPreview.class +++ b/comp/src/gb.report/.src/Preview/FPreview.class @@ -26,8 +26,10 @@ Public Sub DrawingArea1_Draw() 'Debug $fScale 'Paint.Scale($fScale, $fScale) '$hreport.Layout + $hReport.Scale = $fScale $hReport.Paint($iPage) + Label2.Text = "/" & $hreport.PageCount SpinBox1.MaxValue = $hReport.PageCount End @@ -38,6 +40,7 @@ Public Sub Form_Open() 'Report.Debug = True + btnAdjust.Value = True 'Resize Printer1.OutputFile = User.Home &/ "output.pdf" diff --git a/comp/src/gb.report/.src/Preview/FPreview.form b/comp/src/gb.report/.src/Preview/FPreview.form index e7b0d13cd..722028219 100644 --- a/comp/src/gb.report/.src/Preview/FPreview.form +++ b/comp/src/gb.report/.src/Preview/FPreview.form @@ -16,12 +16,8 @@ Text = ("Print") Picture = Picture["icon:/22/printer"] } - { SpinBox1 SpinBox - MoveScaled(6,0,6,4) - MinValue = 1 - } { HBox3 HBox - MoveScaled(12,1,20,2) + MoveScaled(32,1,20,2) Expand = True } { btnAdjust ToolButton @@ -54,11 +50,11 @@ } } { HBox2 HBox - MoveScaled(3,7,128,50) + MoveScaled(2,5,128,36) Expand = True Padding = 5 { ScrollView1 ScrollView - MoveScaled(1,1,82,38) + MoveScaled(1,1,82,32) Background = Color.Background Expand = True { DrawingArea1 DrawingArea @@ -69,6 +65,27 @@ } } } + { Panel2 Panel + MoveScaled(4,49,90,4) + Arrangement = Arrange.Horizontal + Border = Border.Plain + { HBox1 HBox + MoveScaled(8,0,36,3) + Expand = True + } + { Label1 Label + MoveScaled(55,0,5,4) + AutoResize = True + Text = ("Page : ") + } + { SpinBox1 SpinBox + MoveScaled(64,0,6,4) + MinValue = 1 + } + { Label2 Label + MoveScaled(70,0,6,4) + } + } { Printer1 #Printer #MoveScaled(111,58) FullPage = True diff --git a/comp/src/gb.report/.src/Report.class b/comp/src/gb.report/.src/Report.class index 7137e2908..3d889401f 100644 --- a/comp/src/gb.report/.src/Report.class +++ b/comp/src/gb.report/.src/Report.class @@ -122,7 +122,7 @@ Public Sub Layout() 'Me._SetUnifiedValues() 'Me._GenerateClones() '$hReportTControl.ctrl = Me - Debug "Page Size W/H: " & Round(Me._Width, -2) & "/" & Round(Me._Height, -2) + 'Debug "Page Size W/H: " & Round(Me._Width, -2) & "/" & Round(Me._Height, -2) iCurPage = -1 For Each Tsection In $aSections CSection = TSection.Ctrl @@ -141,7 +141,7 @@ Public Sub Layout() 'Inc iCurPage Next - Debug Me._PageChildren.Count + 'Debug Me._PageChildren.Count $iPageCount = iCurPage + 1 'MTools.PageCount = $iCount $bLayoutIsDirty = False diff --git a/comp/src/gb.report/.src/ReportBrush.class b/comp/src/gb.report/.src/ReportBrush.class index d1f8a7ecd..bdcd6f79b 100644 --- a/comp/src/gb.report/.src/ReportBrush.class +++ b/comp/src/gb.report/.src/ReportBrush.class @@ -30,6 +30,7 @@ Public Function _PaintBrush(X1 As Integer, Y1 As Integer, X2 As Integer, Y2 As I fradius = Width * _radius hBrush = paint.RadialGradient(Width * _X, Height * _Y, fradius, Width * _X2, Height * _Y2, _Color, _Pos) End Select + hBrush.Translate(x1, Y1) Return hBrush End diff --git a/comp/src/gb.report/.src/ReportHBox.class b/comp/src/gb.report/.src/ReportHBox.class index 7456972a3..0e5981443 100644 --- a/comp/src/gb.report/.src/ReportHBox.class +++ b/comp/src/gb.report/.src/ReportHBox.class @@ -5,7 +5,7 @@ Export Inherits ReportContainer Public Const _Properties As String = "*" - +Public Const _Similar As String = "ReportVBox" Public Sub _new() Super._Arrangement = Arrange.Horizontal diff --git a/comp/src/gb.report/.src/ReportImage.class b/comp/src/gb.report/.src/ReportImage.class index 51e9b8998..c48cc23a0 100644 --- a/comp/src/gb.report/.src/ReportImage.class +++ b/comp/src/gb.report/.src/ReportImage.class @@ -3,7 +3,7 @@ Export Inherits ReportControl Public Const _Properties As String = "*,Image{Image}" - +Public Const _Similar As String = "ReportTextLabel" Private $hPic As Image Property Image As Image diff --git a/comp/src/gb.report/.src/ReportLabel.class b/comp/src/gb.report/.src/ReportLabel.class index b96715900..a5dec2b20 100644 --- a/comp/src/gb.report/.src/ReportLabel.class +++ b/comp/src/gb.report/.src/ReportLabel.class @@ -4,7 +4,7 @@ Export Inherits ReportFrame Public Const _Properties As String = "*,Text,Key,Format,Alignment{Align.*},UseField" - +Public Const _Similar As String = "ReportTextLabel" Private $sText As String Private $iAlignment As Integer = Align.Normal Private $bIsSpecial As Boolean diff --git a/comp/src/gb.report/.src/ReportLine.class b/comp/src/gb.report/.src/ReportLine.class index 1ca2f2fb3..dea14e78c 100644 --- a/comp/src/gb.report/.src/ReportLine.class +++ b/comp/src/gb.report/.src/ReportLine.class @@ -4,7 +4,7 @@ Export Inherits ReportControl Public Const _Properties As String = "*,Direction{Align.TopLeft;Top;TopRight;Left;Right;BottomLeft;Bottom;BottomRight}=BottomRight,LineWidth{ReportCoord}=2 px" - +Public Const _Similar As String = "ReportTextLabel" Property Direction As Integer Private $fLineWidth As Float = 1.0 diff --git a/comp/src/gb.report/.src/ReportSvgImage.class b/comp/src/gb.report/.src/ReportSvgImage.class index 72fc62c38..6d37ae5ef 100644 --- a/comp/src/gb.report/.src/ReportSvgImage.class +++ b/comp/src/gb.report/.src/ReportSvgImage.class @@ -5,7 +5,7 @@ Inherits ReportControl Private $hSvgImage As SvgImage Private $sPath As String - +Public Const _Similar As String = "ReportTextLabel" Property Path As String diff --git a/comp/src/gb.report/.src/ReportTextLabel.class b/comp/src/gb.report/.src/ReportTextLabel.class index e08d533c1..11aac902c 100644 --- a/comp/src/gb.report/.src/ReportTextLabel.class +++ b/comp/src/gb.report/.src/ReportTextLabel.class @@ -4,7 +4,7 @@ Export Inherits ReportFrame Public Const _Properties As String = "*,Text,Alignment{Align.*}" - +Public Const _Similar As String = "ReportControl" Property Text As String Property Alignment As Integer Property WordWrap As Boolean diff --git a/comp/src/gb.report/.src/ReportVBox.class b/comp/src/gb.report/.src/ReportVBox.class index b0695fa75..9f942ec1d 100644 --- a/comp/src/gb.report/.src/ReportVBox.class +++ b/comp/src/gb.report/.src/ReportVBox.class @@ -3,7 +3,7 @@ Export Inherits ReportContainer Public Const _Properties As String = "*" - +Public Const _Similar As String = "ReportVBox" Public Sub _new() Super._Arrangement = Arrange.Vertical diff --git a/comp/src/gb.report/.src/Tests/Paint.class b/comp/src/gb.report/.src/Tests/Paint.class index ef63f97b6..f1faf0af0 100644 --- a/comp/src/gb.report/.src/Tests/Paint.class +++ b/comp/src/gb.report/.src/Tests/Paint.class @@ -2,32 +2,32 @@ Export -Static Public Sub Begin(Device As Object) - - Debug - Super.Begin(Device) - -End - -Static Public Sub End(Device As Object) - - Debug - Super.End(Device) - -End - - -Static Public Sub Rectangle(X As Float, Y As Float, W As Float, H As Float) - - 'Debug CStr(X); ", "; CStr(Y); ", "; CStr(W); ", "; CStr(H) - Super.Rectangle(X, Y, W, H) - -End - - -Static Public Sub Text(Text As String, Optional X As Float, Y As Float, Width As Float, Height As Float, Alignment As Integer) - - 'Debug Paint.Font.Size - Super.Text(Text, X, Y, Width, Height, Alignment) - -End +' Static Public Sub Begin(Device As Object) +' +' Debug +' Super.Begin(Device) +' +' End +' +' Static Public Sub End(Device As Object) +' +' Debug +' Super.End(Device) +' +' End +' +' +' Static Public Sub Rectangle(X As Float, Y As Float, W As Float, H As Float) +' +' 'Debug CStr(X); ", "; CStr(Y); ", "; CStr(W); ", "; CStr(H) +' Super.Rectangle(X, Y, W, H) +' +' End +' +' +' Static Public Sub Text(Text As String, Optional X As Float, Y As Float, Width As Float, Height As Float, Alignment As Integer) +' +' 'Debug Paint.Font.Size +' Super.Text(Text, X, Y, Width, Height, Alignment) +' +' End diff --git a/comp/src/gb.report/.src/Tests/Report2.report b/comp/src/gb.report/.src/Tests/Report2.report index e2c94b4ea..97d12063c 100644 --- a/comp/src/gb.report/.src/Tests/Report2.report +++ b/comp/src/gb.report/.src/Tests/Report2.report @@ -6,60 +6,57 @@ Spacing = "2cm" Index = 0 Text = ("Section 1") - { ReportHBox1 ReportHBox - #MoveScaled(4,2,90,40) - Fixed = True - AutoResize = True - Spacing = "4cm" - { ReportVBox2 ReportVBox - #MoveScaled(32,2,56,36) + { ReportVBox2 ReportVBox + #MoveScaled(4,4,80,42) + { ReportLabel9 ReportLabel + #MoveScaled(0,0,68,7) Fixed = True + Font = Font["Bitstream Charter,+11"] + Border = ReportBorder["Top:1mm #000000;Bottom:1mm #000000;Left:1mm #000000;Right:1mm #000000"] + Background = ReportBrush["#007FFF"] + Text = ("Facture") + Alignment = Align.Center + } + { ReportHBox1 ReportHBox + #MoveScaled(1,9,72,25) + Height = "2cm" + Padding = "1mm" Expand = True - Background = ReportBrush["RadialGradient(0.52,0.54,0.28,0.52,0.54,[#FF00FF,#FFFFFF],[0,1])"] - { ReportLabel9 ReportLabel - #MoveScaled(1,1,54,18) - Font = Font["Bitstream Charter,+8"] - Padding = "2mm" - Border = ReportBorder["Top:0.5mm #000000;Bottom:0.5mm #000000;Left:0.5mm #000000;Right:0.5mm #000000"] - Background = ReportBrush["#E07FFF00"] - Text = ("FACTURE") - Alignment = Align.Center - } + Border = ReportBorder["Bottom:1mm #000000;Left:1mm #000000;Right:1mm #000000"] { ReportHBox5 ReportHBox - #MoveScaled(13,22,5,2) - Height = "5mm" + #MoveScaled(2,1,34,15) + Expand = True } - { ReportLabel10 ReportLabel - #MoveScaled(4,26,31,3) - Key = "nom" - } - { ReportLabel11 ReportLabel - #MoveScaled(4,29,32,3) - Key = "adresse" - } - { ReportHBox6 ReportHBox - #MoveScaled(4,29,41,5) + { ReportVBox3 ReportVBox + #MoveScaled(37,2,34,16) + Expand = True AutoResize = True - Tag = "*" - Spacing = "2mm" - { ReportLabel12 ReportLabel - #MoveScaled(2,0,12,3) - Width = "3cm" - AutoResize = True - Border = ReportBorder["Right= &H00000000&; "] - Key = "CP" + { Nom ReportLabel + #MoveScaled(2,1,28,3) + Key = "nom" } - { ReportLabel13 ReportLabel - #MoveScaled(19,1,18,3) - Width = "3cm" - AutoResize = True - Key = "ville" + { Adresse ReportLabel + #MoveScaled(2,6,28,3) + Key = "adresse" + } + { ReportHBox6 ReportHBox + #MoveScaled(1,9,30,5) + Expand = True + Spacing = "2mm" + { CP ReportLabel + #MoveScaled(2,1,10,2) + Key = "CP" + } + { ville ReportLabel + #MoveScaled(13,1,16,3) + Key = "ville" + } } } } } { ReportVBox1 ReportVBox - #MoveScaled(6,48,90,42) + #MoveScaled(9,48,90,42) Expand = True { ReportHBox2 ReportHBox #MoveScaled(2,0,86,5) @@ -79,7 +76,7 @@ #MoveScaled(22,1,13,4) Width = "3cm" Font = Font["Bitstream Charter,Bold"] - Border = ReportBorder["Top=1mm &H00000000&; Right= &H00000000&; Bottom=1mm &H00000000&; Left=1mm &H00000000&; "] + Border = ReportBorder["Left:1mm #000000"] Text = ("PU HT") Alignment = Align.Center } @@ -88,7 +85,7 @@ Width = "3cm" Font = Font["Bitstream Charter,Bold"] Tag = "*" - Border = ReportBorder["Top=1mm &H00000000&; Right= &H00000000&; Bottom=1mm &H00000000&; Left=1mm &H00000000&; "] + Border = ReportBorder["Left:1mm #000000"] Text = ("Quantité") Alignment = Align.Center } @@ -96,7 +93,7 @@ #MoveScaled(52,1,13,4) Width = "3cm" Font = Font["Bitstream Charter,Bold"] - Border = ReportBorder["Border=1mm &H00000000&;"] + Border = ReportBorder["Left:1mm #000000"] Text = ("Total HT") Alignment = Align.Center } @@ -109,14 +106,14 @@ Width = "40%" Padding = "1mm" Expand = True - Border = ReportBorder["Bottom= &H00000000&; Left=1mm &H00000000&; "] + Border = ReportBorder["Left:1mm #000000"] Key = "designation" } { ReportLabel6 ReportLabel #MoveScaled(22,1,13,4) Width = "3cm" Padding = "1mm" - Border = ReportBorder["Right= &H00000000&; Left=1mm &H00000000&; "] + Border = ReportBorder["Left:1mm #000000"] Key = "PU" Alignment = Align.Right } @@ -124,14 +121,14 @@ #MoveScaled(35,1,13,4) Width = "3cm" Padding = "1mm" - Border = ReportBorder["Right= &H00000000&; Left=1mm &H00000000&; "] + Border = ReportBorder["Left:1mm #000000"] Key = "Q" Alignment = Align.Right } { ReportLabel8 ReportLabel #MoveScaled(52,1,13,4) Width = "3cm" - Border = ReportBorder["Right=1mm &H00000000&; Left=1mm &H00000000&; "] + Border = ReportBorder["Left:1mm #000000;Right:1mm #000000"] Key = "THT" Alignment = Align.Right } @@ -139,7 +136,7 @@ { ReportHBox8 ReportHBox #MoveScaled(3,13,83,2) Fixed = True - Border = ReportBorder["Top=1mm &H00000000&; "] + Border = ReportBorder["Top:1mm #000000"] } { ReportHBox4 ReportHBox #MoveScaled(4,17,81,5)