Commit b875e459 authored by BODARD Fabien's avatar BODARD Fabien

[GB.REPORT2]

* NEW: A new class ReportMargin that inherit ReportPadding
* BUG: Size parsing now support null value (set it internally to "0cm")
* OPT: Many code cleaning an reorganisation.
* NEW: ReportView is based on DocumentView now.
* NEW: ReportMargin and Spacing work together.
* OPT: A value without unit is a pixel value.
* NEW: Better support for shadows (css like)



git-svn-id: svn://localhost/gambas/trunk@6828 867c0c6c-44f3-4631-809d-bfa615b0a4ec
parent 65041158
......@@ -281,10 +281,6 @@ m
Layout
m
_Layout
m
[(iPage)i]
_Reset
m
......@@ -345,6 +341,10 @@ _Bottom
v
f
Style
v
i
Top
r
_ReportBorderSide
......@@ -373,10 +373,6 @@ Brush
p
ReportBrush
Style
v
i
_get
M
ReportBorder
......@@ -543,10 +539,6 @@ _NormalizeUnits
m
_GenerateClones
m
_GetSizeHints
m
TSizeHint
......@@ -577,7 +569,7 @@ b
_Properties
C
s
Left{ReportCoord},Top{ReportCoord},Width{ReportCoord},Height{ReportCoord},Brush{ReportBrush},Visible=True,Fixed,Font,Padding,Ignore,Expand,AutoResize,Tag,Range
Left{ReportCoord},Top{ReportCoord},Width{ReportCoord},Height{ReportCoord},Brush{ReportBrush},Visible=True,Fixed,Font,Padding,Margin,Ignore,Expand,AutoResize,Tag,Range
_Family
C
s
......@@ -594,10 +586,6 @@ _Finished
v
b
_DataIndex
p
i
Name
v
s
......@@ -610,10 +598,6 @@ _iCurPagePos
V
i
Font
p
Font
Id
r
i
......@@ -630,6 +614,10 @@ Padding
p
ReportPadding
Margin
p
ReportMargin
Brush
p
ReportBrush
......@@ -650,11 +638,6 @@ _Left
r
f
_Padding
r
f
'Padding of the control in cm
_RelativeLeft
r
b
......@@ -671,10 +654,6 @@ _RelativeHeight
r
b
_RelativePadding
r
b
_Index
p
i
......@@ -711,6 +690,10 @@ Visible
p
b
Font
p
Font
Expand
p
b
......@@ -743,6 +726,10 @@ ForceNewPage
p
b
_DataIndex
p
i
_New
m
......@@ -838,6 +825,49 @@ _Free
m
#ReportGridView
ReportFrame
C
_IsControl
C
b
T
_IsContainer
C
b
_Properties
C
s
*
Columns
r
_ReportGridView_Columns
Rows
r
_ReportGridView_Rows
_GetSizeHints
m
TSizeHint
(AvailableW)f(AvailableH)f(TotalWidth)f(TotalHeight)f(DataIndex)i
_SetChildGeometry
m
(X)f(Y)f(W)f(H)f(ContPage)i(TCont)TControl;(bInFixed)b
_PaintBeFore
m
(Page)i(X)f(Y)f(hControl)TControl;(DataIndex)i
_Paint
m
(Page)i(X)f(Y)f(hControl)TControl;(DataIndex)i
_PaintAfter
m
(Page)i(X)f(Y)f(hControl)TControl;(DataIndex)i
#ReportHBox
ReportContainer
C
......@@ -861,6 +891,9 @@ _Free
m
#ReportMargin
ReportPadding
C
#ReportPadding
C
......@@ -904,6 +937,10 @@ _Height
r
f
IsActive
m
b
_Get
M
ReportPadding
......@@ -957,7 +994,7 @@ GetFactorUnitToInch
M
f
(Unit)s[(Resolution)i]
ReportUnitsConverter
Convert
M
f
(Value)f(Unit1)s(Unit2)s
......@@ -1151,6 +1188,53 @@ View_MouseMove
m
#ReportView2
UserControl
C
_GrayScale
p
b
_IsControl
C
b
T
_IsContainer
C
b
_new
m
SetReport
m
(hReport)Report;
View_Draw
m
(Page)i(Width)i(Height)i
View_Zoom
m
View_Finished
m
Area_Scroll
m
Area_Draw
m
tmrLayout_Timer
m
#_ReportBorderSide
C
......@@ -1178,3 +1262,83 @@ _NormalizeUnits
m
#_ReportGridView_Column
C
_Column
v
i
Text
p
s
Width
p
s
_Width
v
f
Expand
p
b
Alignment
p
i
Background
p
ReportBrush
#_ReportGridView_Columns
C
Count
p
i
#_ReportGridView_Row
C
_Height
v
f
Height
p
s
Text
p
s
Title
p
s
:_Foo
:
#_ReportGridView_Rows
C
Count
p
i
Height
p
s
_get
m
_ReportGridView_Row
(Index)i
_SetRowHeight
m
(iRow)i(H)s
......@@ -7,11 +7,18 @@ ReportBrush
ReportContainer
ReportControl
ReportFrame
ReportGridView
ReportHBox
ReportMargin
ReportPadding
ReportPageBreak
ReportSection
ReportUnits
ReportVBox
ReportView
ReportView2
_ReportBorderSide
_ReportGridView_Column
_ReportGridView_Columns
_ReportGridView_Row
_ReportGridView_Rows
# Gambas Project File 3.0
# Compiled with Gambas 3.6.90
Title=ReportsEvolution
Startup=Report1
Startup=FPreview2
Version=0.0.1
Component=gb.image
Component=gb.gui
......
......@@ -2,8 +2,9 @@
Count=0
[DebugWindow]
Count=1
DebugWindow[1]="$aSections[0].Ctrl"
Count=2
DebugWindow[1]="hchild.Margin"
DebugWindow[2]="hReport"
[DebugWindow/$aSections]
Geometry=[-55,269,210,210]
......@@ -19,11 +20,15 @@ ShowHidden=True
Geometry=[0,0,210,210]
[DebugWindow/Me]
Geometry=[-7,-10,210,210]
Geometry=[-7,-10,294,210]
[DebugWindow/Parent]
Geometry=[-7,-10,210,210]
[DebugWindow/Report1]
ShowHidden=True
Geometry=[-7,-10,210,210]
[DebugWindow/_ObjectFromId]
Geometry=[-7,420,256,282]
......@@ -36,24 +41,34 @@ Geometry=[-7,-10,342,210]
[DebugWindow/hRep]
Geometry=[-7,247,210,210]
[DebugWindow/hReport]
Geometry=[-7,-10,210,210]
[DebugWindow/hchild.Margin]
Geometry=[1236,625,210,210]
[DebugWindow/hrc]
Geometry=[1133,212,210,210]
[FCommit]
LastCommit="[GB.REPORT2]\n* OPT: Set the name to gb.report2. Continue rewritting.\n---- Cette ligne et les suivantes seront ignorées ----\n\nA + .\n > déplacé de ../Reports2\nM + .info\nM + .list\nM + .settings\nM + .src/Report.class\nM + .src/ReportContainer.class\nM + .src/ReportControl.class\nA .src/ReportHBox.class\nM + .src/ReportSection.class\nM + .src/ReportVBox.class\nM + .src/Tests/Module1.module"
LastCommit="[GB.REPORT2]\n* OPT: Continue Report component reconstruction\n---- Cette ligne et les suivantes seront ignorées ----\n\nA .hidden/control\nA .hidden/control/reporthbox.png\nA .hidden/control/reportlabel.png\nA .hidden/control/reportpagebreak.png\nA .hidden/control/reportvbox.png\nM .info\nM .list\nM .project\nM .settings\nM .src/Report.class\nM .src/ReportContainer.class\nM .src/ReportControl.class\nA .src/ReportFrame.class\nA .src/ReportPageBreak.class\nR .src/Tests/FMain.class\nR .src/Tests/FMain.form\nM .src/Tests/Module1.module\nA .src/Tests/Report1.class\nA .src/Tests/Report1.report\nA .src/Tools/CPrint.class\nA .src/Types/Base\nA .src/Types/Base/ReportBrush.class\nA .src/Types/Base/ReportPadding.class\nA .src/Types/Border\nA .src/Types/Border/ReportBorder.class\nA .src/Types/Border/_ReportBorderSide.class\nA .src/Types/Border/_ReportRoundCorner.class\nA .src/Types/BoxShadow\nA .src/Types/BoxShadow/ReportBoxShadow.class\nA .src/Types/BoxShadow/_ReportBoxShadow.class\nD .src/Types/ReportPadding.class\nA .src/Viewer\nA .src/Viewer/FPreview.class\nA .src/Viewer/FPreview.form\nA .src/Viewer/ReportView.class\nA .src/Viewer/ReportViewTask.class\nM .startup"
[OpenFile]
Active=3
File[1]=".src/Viewer/FPreview.class:26.11"
Count=9
File[2]=".src/Tests/Report1.report"
File[3]=".src/Tests/Report1.class:9.35"
File[4]=".src/ReportFrame.class:236.26"
File[5]=".src/Types/TControl.class:74.0"
File[6]=".src/Types/Border/ReportBorder.class:183.0"
File[7]=".src/Viewer/FPreview.form"
File[8]=".src/Viewer/ReportView.class:0.0"
File[9]=".src/ReportControl.class:357.26"
File[1]=".src/Viewer/ReportView2.class:30.2"
Count=13
File[2]=".src/Viewer/ReportView.class:147.21"
File[3]=".src/Report.class:163.0"
File[4]=".src/Viewer/FPreview2.form"
File[5]=".src/Viewer/FPreview2.class:3.0"
File[6]=".src/Viewer/FPreview.form"
File[7]=".src/Viewer/ReportViewTask.class:26.2"
File[8]=".src/Tests/Report1.report"
File[9]=".src/Tests/Report1.class:17.19"
File[10]=".src/ReportContainer.class:287.0"
File[11]=".src/ReportControl.class:110.0"
File[12]=".src/Types/BoxShadow/ReportBoxShadow.class:23.0"
File[13]=".src/ReportVBox.class:12.0"
[VersionControl]
User="gambix"
......
......@@ -111,15 +111,8 @@ Public Sub _New()
'Me.Orientation = Printer.Landscape
End
Public Sub Layout()
Public Sub Layout(Optional iPage As Integer = -1)
_Layout()
End
Public Sub _Layout(Optional iPage As Integer = -1)
'Dim iCurPage As Integer
Dim TSection As TControl
......@@ -208,7 +201,7 @@ Public Sub Paint(Page As Integer)
Endif
ReportUnits._ReportWidth = $aSections[0].Ctrl._Width
'ReportUnits.Resolution = If($iResolution < 0, Paint.ResolutionX, $iResolution)
If $bLayoutIsDirty And $iPageCount = -1 Then Layout()
If $bLayoutIsDirty And $iPageCount = -1 Then Layout(Page)
Paint.Save
'Set execution Flag to true
_bInExec = True
......@@ -254,7 +247,7 @@ End
Private Function PageCount_Read() As Integer
If $bLayoutIsDirty And Not _LayoutNotFinished Then Layout() '$iCount = -1
If $bLayoutIsDirty And Not _LayoutNotFinished Then Layout(1) '$iCount = -1
Return $iPageCount
......
......@@ -5,13 +5,12 @@ Create Private
Public Const _IsControl As Boolean = True
Public Const _IsContainer As Boolean = False
Public Const _Properties As String = "Left{ReportCoord},Top{ReportCoord},Width{ReportCoord},Height{ReportCoord},Brush{ReportBrush},Visible=True,Fixed,Font,Padding,Ignore,Expand,AutoResize,Tag,Range"
Public Const _Properties As String = "Left{ReportCoord},Top{ReportCoord},Width{ReportCoord},Height{ReportCoord},Brush{ReportBrush},Visible=True,Fixed,Font,Padding,Margin,Ignore,Expand,AutoResize,Tag,Range"
Public Const _Family As String = "Report"
Public _SizeInt As TSizeHint
Public _Count As Integer = 1
Public _Finished As Boolean
Private $iDataindex As Integer
Property _DataIndex As Integer
Private $iIndex As Integer
......@@ -21,44 +20,11 @@ Static Public _ObjectFromId As New Collection
Static Public _iCurPagePos As Integer
Static Private $iLastId As Integer
Private $iMyId As Integer
Private $iParentId As Integer
Private $vTag As Variant
Private $fPadding As Float
Private $iReportId As Integer
Private $hBrush As ReportBrush
Private $iColor As Integer
Private $fLeft As Float = 0.0
Private $fTop As Float = 0.0
Private $fWidth As Float = 0.0
Private $fHeight As Float = 0.0
Private $sHeight As String = "0cm"
Private $sLeft As String = "0cm"
Private $sWidth As String = "0cm"
Private $sTop As String = "0cm"
Private $hPadding As New ReportPadding
'Private $sPadding As String = "0cm"
Private $iVisible As Boolean = True
Private $hFont As New Font
Private $bExpand As Boolean
Private $bFixed As Boolean
Private $bAutoresize As Boolean = False
Private $bRelativeLeft As Boolean
Private $bRelativeTop As Boolean
Private $bRelativeWidth As Boolean
Private $bRelativeHeight As Boolean
Private $bRelativePadding As Boolean
Private $bIgnore As Boolean = False
Private $sRange As String
Property Read Id As Integer
Property Read Parent As ReportContainer
Property Tag As Variant
Property Padding As ReportPadding
Property Margin As ReportMargin
Property Brush As ReportBrush
'Property {Color} As Integer
......@@ -66,34 +32,58 @@ Property Read _Top As Float ''Top of the control in cm
Property Read _Height As Float ''Height of the control in cm
Property Read _Width As Float ''Width of the control in cm
Property Read _Left As Float ''Left of the control in cm
Property Read _Padding As Float '' Padding of the control in cm
Property Read _RelativeLeft As Boolean ''Use percentage for Left pos?
Property Read _RelativeTop As Boolean ''Use percentage for Top Pos?
Property Read _RelativeWidth As Boolean ''Use percentage for width?
Property Read _RelativeHeight As Boolean ''Use percentage for height ?
Property Read _RelativePadding As Boolean ''Use percentage for padding ?
Property _Index As Integer
Property Range As String
Property Left As String
Property Top As String
Property X As String
Property Y As String
Property Width As String
Property Height As String
Property Visible As Boolean
Property {Font} As Font
Property Expand As Boolean
Property Ignore As Boolean
Property Fixed As Boolean
Property Autoresize As Boolean
Property Read {Report} As Report
Property _ReportId As Integer
Property Read DataIndex As Integer
Property ForceNewPage As Boolean
Property _DataIndex As Integer
Private $bForceNewPage As Boolean
Private $iMyId As Integer
Private $iParentId As Integer
Private $vTag As Variant
Private $iReportId As Integer
Private $hBrush As ReportBrush
Private $iColor As Integer
Private $fLeft As Float = 0.0
Private $fTop As Float = 0.0
Private $fWidth As Float = 0.0
Private $fHeight As Float = 0.0
Private $sHeight As String = "0cm"
Private $sLeft As String = "0cm"
Private $sWidth As String = "0cm"
Private $sTop As String = "0cm"
Private $hPadding As New ReportPadding
Private $hMargin As New ReportMargin
Private $iVisible As Boolean = True
Private $hFont As New Font
Private $bExpand As Boolean
Private $bFixed As Boolean
Private $bAutoresize As Boolean = False
Private $bRelativeLeft As Boolean
Private $bRelativeTop As Boolean
Private $bRelativeWidth As Boolean
Private $bRelativeHeight As Boolean
Private $bIgnore As Boolean = False
Private $sRange As String
Public Sub _New(Optional Parent As ReportContainer = Null)
......@@ -314,12 +304,6 @@ Private Function _Left_Read() As Float
End
Private Function _Padding_Read() As Float
Return $fPadding
End
Public Function _SetChildGeometry((X) As Float, (Y) As Float, (W) As Float, (H) As Float, (ContPage) As Integer, (TCont) As TControl, (bInFixed) As Boolean)
End
......@@ -348,11 +332,6 @@ Private Function _RelativeHeight_Read() As Boolean
End
Private Function _RelativePadding_Read() As Boolean
Return $bRelativePadding
End
''Convert recursively string values to unified values in cm
Public Sub _NormalizeUnits()
......@@ -396,6 +375,19 @@ Public Sub _NormalizeUnits()
hSizeParse = New TSizeParse($hPadding.Bottom, True)
$hPadding._Bottom = hSizeParse.GetValue()
hSizeParse = New TSizeParse($hMargin.Left, True)
$hMargin._Left = hSizeParse.GetValue()
hSizeParse = New TSizeParse($hMargin.Right, True)
$hMargin._Right = hSizeParse.GetValue()
hSizeParse = New TSizeParse($hMargin.Top, True)
$hMargin._Top = hSizeParse.GetValue()
hSizeParse = New TSizeParse($hMargin.Bottom, True)
$hMargin._Bottom = hSizeParse.GetValue()
'
End
......@@ -594,3 +586,15 @@ End
Public Sub _Free()
End
Private Function Margin_Read() As ReportMargin
Return $hMargin
End
Private Sub Margin_Write(Value As ReportMargin)
$hMargin = Value
End
' Gambas class file
Export
Inherits ReportFrame
'>>>>>>>>>>>>>>>>>>>>>> PUBLIC VARIABLES >>>>>>>>>>>>>>>>>>>>>>>>>
Public Const _IsControl As Boolean = True
Public Const _IsContainer As Boolean = False
Public Const _Properties As String = "*"
'Public Const _Family As String = "Report"
'>>>>>>>>>>>>>>>>>>>>>>>>>> PROPERTIES >>>>>>>>>>>>>>>>>>>>>>>>>>>
Property Read Columns As _ReportGridView_Columns
Property Read Rows As _ReportGridView_Rows
'>>>>>>>>>>>>>>>>>>>>>> PRIVATE VARIABLES >>>>>>>>>>>>>>>>>>>>>>>>
Private $hColumns As New _ReportGridView_Columns
Private $hRows As New _ReportGridView_Rows
'##################### PUBLIC PROCEDURES #########################
Public Sub _GetSizeHints((AvailableW) As Float, (AvailableH) As Float, TotalWidth As Float, TotalHeight As Float, DataIndex As Integer) As TSizeHint
End
Public Function _SetChildGeometry((X) As Float, (Y) As Float, (W) As Float, (H) As Float, (ContPage) As Integer, (TCont) As TControl, (bInFixed) As Boolean)
End
Public Sub _PaintBeFore((Page) As Integer, (X) As Float, (Y) As Float, (hControl) As TControl, (DataIndex) As Integer)
End
Public Sub _Paint(Page As Integer, X As Float, Y As Float, hControl As TControl, DataIndex As Integer)
End
Public Sub _PaintAfter((Page) As Integer, (X) As Float, (Y) As Float, (hControl) As TControl, (DataIndex) As Integer)
End
'##################### PRIVATE PROCEDURES ########################
'######################## PROPERTIES #############################
Private Function Columns_Read() As _ReportGridView_Columns
Return $hColumns
End
Private Function Rows_Read() As _ReportGridView_Rows
Return $hRows
End
......@@ -2,11 +2,42 @@
Public Sub Report_Open()
Dim hBox As ReportHBox
Dim i As Integer
'Me.Spacing = "1cm"
ReportHBox1.Margin.Bottom = "2cm"
'Report.Debug = True
ReportHBox1.BoxShadow.Blur = "2mm"
'ReportHBox1.BoxShadow.XOffset = "1mm"
'ReportHBox1.BoxShadow.YOffset = "1mm"
ReportHBox1.BoxShadow.Spread = "1mm"
'ReportHBox2.Margin.Top = "2cm"
ReportHBox1.BoxShadow.Blur = "0.5mm"
ReportHBox1.BoxShadow.XOffset = "1mm"
ReportHBox1.BoxShadow.YOffset = "1mm"
'ReportHBox1.BoxShadow.Spread = "0.5mm"
ReportHBox1.BoxShadow.Color = Color.Gray
For i = 0 To 1101
hbox = New Reporthbox(ReportVBox1)
HBox.Height = "1cm"
HBox.Border.Width = "2px"
HBox.Margin.Top = "5mm"
HBox.Margin.Bottom = "3mm"
HBox.Margin.Left = "1cm"
HBox.Margin.Right = "2mm"
Next
hBox = New ReportHBox(ReportVBox1)
HBox.BackGround = ReportBrush.Color(Color.Green)
HBox.Height = "3cm"
HBox.Margin.Top = "1cm"
For i = 0 To 4
hbox = New Reporthbox(ReportHBox2)
HBox.Width = "1cm"
HBox.Border.Width = "2px"
HBox.Margin.Left = "3mm"
HBox.Margin.Right = "8mm"
HBox.Expand = True
HBox.Margin.Top = "3mm"
HBox.Margin.Bottom = "3px"
Next
ReportHBox2.Padding = ReportPadding["2mm"]
End