diff --git a/comp/src/gb.report/.info b/comp/src/gb.report/.info index e6513b920..1f22356a3 100644 --- a/comp/src/gb.report/.info +++ b/comp/src/gb.report/.info @@ -373,6 +373,10 @@ ToString m s +_SetUnifiedValues +m + + #ReportBrush C @@ -817,6 +821,10 @@ Border p ReportBorder +BoxShadow +p +ReportBoxShadow + BackGround p ReportBrush @@ -1085,6 +1093,21 @@ Text p s +#ReportShadowStyle + +C +None +C +i +0 +Solid +C +i +1 +Gradient +C +i +2 #ReportSvgImage ReportFrame C @@ -1386,3 +1409,11 @@ Round2 v s +_Width +v +f + +_SetUnifiedValues +m + + diff --git a/comp/src/gb.report/.list b/comp/src/gb.report/.list index c4d8e79a8..390008211 100644 --- a/comp/src/gb.report/.list +++ b/comp/src/gb.report/.list @@ -16,6 +16,7 @@ ReportPadding ReportPageBreak ReportPanel ReportSection +ReportShadowStyle ReportSvgImage ReportTextLabel ReportUnits diff --git a/comp/src/gb.report/.project b/comp/src/gb.report/.project index 43c114e11..f07a5bedf 100644 --- a/comp/src/gb.report/.project +++ b/comp/src/gb.report/.project @@ -1,7 +1,7 @@ # Gambas Project File 3.0 # Compiled with Gambas 3.5.90 Title=Report designer -Startup=Report9 +Startup=myReport1 Icon=printer1.png Version=3.5.90 VersionFile=1 @@ -15,6 +15,7 @@ Component=gb.map Component=gb.report Description="Report engine for gambas" Authors="Fabien Bodard" +Environment="GB_GUI=gb.gtk3" TabSize=2 Translate=1 Language=fr diff --git a/comp/src/gb.report/.src/Preview/FPreview.class b/comp/src/gb.report/.src/Preview/FPreview.class index 9548289fc..a6006a095 100644 --- a/comp/src/gb.report/.src/Preview/FPreview.class +++ b/comp/src/gb.report/.src/Preview/FPreview.class @@ -4,20 +4,21 @@ Private $aModeButtons As New ToolButton[] 'Static Private $hReport As Report Private bFlag As Boolean Private $hPrinter As New Printer As "Printer" +Private $iCurPrinterResolution As Integer + Static Public Function Run(hReport As Report) - - Dim hFPreview As FPreview - - + Dim hFPreview As FPreview + hFpreview = New FPreview hFPreview.SetReport(hReport) hFpreview.ShowModal() - + End Public Sub _new() + Dim s As String 'View.Report = New MyReport1 'SetReport(View.Report) @@ -29,8 +30,9 @@ Public Sub _new() Next SelectPrinter Button1.Tag = False -' Panel4.Layout = [7, 2] + ' Panel4.Layout = [7, 2] 'ToggleButton1_Click + End Private Sub SelectPrinter(Optional sName As String) @@ -54,30 +56,27 @@ Private Sub SelectPrinter(Optional sName As String) End - - - - Public Sub SetReport(hReport As Report) -'View.Report = hReport -View.Report = hReport -GetValuesFromReport() + 'View.Report = hReport + + View.Report = hReport + GetValuesFromReport() + End Private Sub GetValuesFromReport() + cmbPaper.Index = View.Report.Paper $hPrinter.Orientation = View.Report.Orientation If View.Report.Paper = Printer.Custom Then - pnlCustom.Enabled = True - $hPrinter.PaperWidth = TSizeParse[View.Report.Width].ToCm() * 10 - $hPrinter.PaperHeight = TSizeParse[View.Report.Height].ToCm() * 10 + pnlCustom.Enabled = True + $hPrinter.PaperWidth = TSizeParse[View.Report.Width].ToCm() * 10 + $hPrinter.PaperHeight = TSizeParse[View.Report.Height].ToCm() * 10 Else $hPrinter.Paper = View.Report.Paper Endif - - cmbOrientation.Index = $hPrinter.Orientation cmbDuplex.Index = $hPrinter.Duplex cmbPaper.Index = $hPrinter.Paper @@ -87,101 +86,107 @@ Private Sub GetValuesFromReport() Object.Lock(spHeight) spHeight.Value = $hPrinter.PaperHeight Object.Unlock(spHeight) + End Public Sub Slider1_Change() -Dim hButton As ToolButton + + Dim hButton As ToolButton + View.Scale = Slider1.Value / 100 lblZoom.Text = Str(Slider1.Value) & " %" - bFlag = True + bFlag = True For Each hButton In $aModeButtons hButton.Value = False Next bFlag = False - + End Public Sub View_Change() - + Object.Lock(Slider1) - Slider1.Value = View.Scale * 100 + Slider1.Value = View.Scale * 100 Object.Unlock(Slider1) - lblZoom.Text = Str(Slider1.Value) & " %" + lblZoom.Text = Str(Slider1.Value) & " %" + End Public Sub Mode_Click() - - Dim hButton As ToolButton - Dim hCurButton As ToolButton - If bFlag Then Return - bFlag = True - hCurButton = Last - For Each hButton In $aModeButtons - 'Object.Lock(hButton) - 'Print hButton, hCurButton, hButton = hCurButton - If hButton = hCurButton Then - hButton.Value = True - Else - hButton.Value = False - Endif - 'Object.Unlock(hButton) - Next -bFlag = False - -View.ScaleMode = hCurButton.Tag - + + Dim hButton As ToolButton + Dim hCurButton As ToolButton + + If bFlag Then Return + bFlag = True + hCurButton = Last + For Each hButton In $aModeButtons + 'Object.Lock(hButton) + 'Print hButton, hCurButton, hButton = hCurButton + If hButton = hCurButton Then + hButton.Value = True + Else + hButton.Value = False + Endif + 'Object.Unlock(hButton) + Next + bFlag = False + + View.ScaleMode = hCurButton.Tag + End - Public Sub tgbGrayScale_Click() - + Last.Background = IIf(Last.Value, Color.Gray, Color.Default) $hPrinter.GrayScale = Last.Value View._GrayScale = Last.Value - + End -Public Sub tgbFullPage_Click() +Public Sub tgbFullPage_Click() + Last.Background = IIf(Last.Value, Color.Gray, Color.Default) $hPrinter.FullPage = Last.Value - + End Public Sub tgbReverseCopies_Click() - + Last.Background = IIf(Last.Value, Color.Gray, Color.Default) $hPrinter.ReverseOrder = Last.value + End Public Sub tgbCollateCopies_Click() - + Last.Background = IIf(Last.Value, Color.Gray, Color.Default) $hPrinter.CollateCopies = Last.Value + End Public Sub PictureBox2_MouseDown() - - End Public Sub cmbOrientation_Change() - + End Public Sub cmbOrientation_Click() + If View.Report.Orientation = Last.Index Then Return View.Report.Orientation = Last.Index 'View.Report.Refresh View.Refresh GetValuesFromReport - End Public Sub cmbPaper_Click() -Dim i As Integer = Last.Index + + Dim i As Integer = Last.Index 'Print "id "; View.Report.paper If View.Report.Paper = i Then Return View.Report.Paper = i @@ -189,111 +194,134 @@ Dim i As Integer = Last.Index pnlCustom.Enabled = True Else pnlCustom.Enabled = False - View.Refresh - GetValuesFromReport + View.Refresh + GetValuesFromReport Endif - + End Public Sub cmbDuplex_Click() - + $hPrinter.Duplex = Last.index - + End Public Sub ButtonBox1_Click() - + Dialog.Path = User.Home Dialog.Filter = ["*.pdf", "Pdf", "*.ps", "Postscript"] If Not Dialog.OpenFile() Then - Last.Text = Dialog.Path + ButtonBox1.Text = Dialog.Path $hPrinter.OutputFile = Dialog.Path Endif - + End Public Sub Form_Activate() - - + End Public Sub TabPanel1_Click() - + If TabPanel1.Index = 0 Then $hPrinter.OutputFile = "" + $hPrinter.Name = cmbPrinter.Text + $iCurPrinterResolution = $hPrinter.Resolution Else $hPrinter.OutputFile = ButtonBox1.Text + $hPrinter.Resolution = 600 Endif - + End Public Sub TextBox1_Change() - + View.Range = Last.Text - + End Public Sub TextBox1_Click() - + Last.Text = "" - + End Public Sub spWidth_Change() - - View.Report.Width = Str(Last.Value) & "mm" - View.Refresh - + + View.Report.Width = Str(Last.Value) & "mm" + View.Refresh + End Public Sub spHeight_Change() - - View.Report.Height = Str(Last.Value) & "mm" - View.Refresh - + + View.Report.Height = Str(Last.Value) & "mm" + View.Refresh + End Public Sub Button2_Click() - + View._ForceLayout - + End Public Sub cmbPrinter_Click() - + SelectPrinter(Last.Text) - End Public Sub Button1_Click() + Dim iReturn As Integer + If Button1.Tag Then - 'Button1.Picture = Picture["icon:/22/exec"] + 'Button1.Picture = Picture["icon:/22/exec"] $hPrinter.Cancel Button1.Tag = False Else If Not View.Report Then Return + If TabPanel1.Index = 1 Then + If $hPrinter.OutputFile Then + If Exist($hPrinter.OutputFile) Then + iReturn = Message.Warning("This file already exist.\nDo you want to replace it ?", "Yes", "No") + If iReturn = 2 Then + ButtonBox1.SetFocus + 'ButtonBox1.se + Return + Endif + Endif + Else + ButtonBox1_Click + Return + Endif + + Endif Button1.Tag = True Button1.Picture = Picture["icon:/22/cancel"] Button1.Text = ("Cancel") + Print $hPrinter.Resolution $hPrinter.Print Endif + End - Public Sub Printer_Begin() + hbZoom.Hide hbPrinting.Show Inc Application.Busy ProgressBar1.Value = 0 ProgressBar1.Pulse = True lblPrint.Text = ("Layout...") + End Public Sub Printer_Paginate() 'View._ForceLayout + If View.Report._LayoutNotFinished Then View.LockLayout View.Report._Layout(View.Report.PageCount) @@ -303,22 +331,23 @@ Public Sub Printer_Paginate() lblPrint.Text = ("Printing...") View.UnlockLayout Endif -'View.LockLayout + 'View.LockLayout End Public Sub Printer_Draw() + If View._RangePages.Count = 0 Then View.Report.Paint($hPrinter.Page) Else View.Report.Paint(View._RangePages[$hPrinter.Page - 1]) Endif ProgressBar1.Value = $hPrinter.Page / View.PageCount + End - Public Sub Printer_End() - + 'View.UnlockLayout hbPrinting.Hide hbZoom.Show @@ -326,19 +355,21 @@ Public Sub Printer_End() Button1.Picture = Picture["icon:/22/print"] Button1.Text = ("Print") Button1.Tag = False + End - - - Public Sub View_Layout(LayoutInProgress As Boolean) - + 'Button1.Enabled = Not LayoutInProgress - + End Public Sub Panel12_MouseDown() - - +End + +Public Sub ButtonBox1_Change() + + $hPrinter.OutputFile = Last.Text + End diff --git a/comp/src/gb.report/.src/Report.class b/comp/src/gb.report/.src/Report.class index c17da9671..658a87175 100644 --- a/comp/src/gb.report/.src/Report.class +++ b/comp/src/gb.report/.src/Report.class @@ -121,6 +121,7 @@ Public Sub _Layout(Optional iPage As Integer = -1) Dim CSection As ReportContainer Dim CBaseSection As ReportContainer Dim i As Integer + 'Print Paint.ResolutionX 'If iPage < 0 Then Return If Not $bLayoutIsDirty Then Return If _bInExec Then Return @@ -208,6 +209,9 @@ Public Sub Paint(Page As Integer) 'ReportUnits.DrawCount = 0 'Paint.Reset + ' If Paint.Device Is Printer Then + ' Paint.Scale(Paint.ResolutionX / 1200, Paint.ResolutionY / 1200) + ' Endif Paint.Scale($fScale, $fScale) ' With Paint.ClipExtents diff --git a/comp/src/gb.report/.src/ReportBorder.class b/comp/src/gb.report/.src/ReportBorder.class index 5b544f521..16ec671b6 100644 --- a/comp/src/gb.report/.src/ReportBorder.class +++ b/comp/src/gb.report/.src/ReportBorder.class @@ -4,12 +4,15 @@ Export Static Public Const None As Integer = 0 Static Public Const Solid As Integer = 1 - +Static Private $aShadowStyle As String[] = ["none", "solid", "gradiant"] +Static Private $aAlign As String[] = Classes["Align"].Symbols Private hTop As New _ReportBorderSide Private hBottom As New _ReportBorderSide Private hLeft As New _ReportBorderSide Private hRight As New _ReportBorderSide Private hRCorner As New _ReportRoundCorner + + Public _Left As Float Public _Right As Float Public _Top As Float @@ -30,6 +33,7 @@ Property Brush As ReportBrush Public Style As Integer + ' Static Private Sub ResetBorder(hReportBorder As ReportBorder) As Boolean ' ' With hReportBorder @@ -44,18 +48,17 @@ Public Style As Integer ' End Static Public Function _get(sValue As String) As ReportBorder - Dim hReportBorder As New ReportBorder Dim sBorder As String Dim aScan As String[] - + If Not sValue Then Return hReportBorder hReportBorder.Style = ReportBorder.Solid hReportBorder.RoundCorner._Active = False For Each sBorder In Split(sValue, ";") - + aScan = Scan(sBorder, "*:*") Select Case LCase(Trim(aScan[0])) Case "border" @@ -77,21 +80,23 @@ Static Public Function _get(sValue As String) As ReportBorder Case "bottomrightcorner" hReportBorder.RoundCorner.BottomRight = aScan[1] + + End Select - + Next - + Finally Return hReportBorder - + End Static Private Sub FillObject(hObj As Object, sValue As String) - + Dim sBrush As String - + For Each sBrush In Split(sValue, " ") - + If IsDigit(Left(sBrush)) Then Try hObj.Width = sBrush Else @@ -99,13 +104,15 @@ Static Private Sub FillObject(hObj As Object, sValue As String) If hObj.Brush = Null Then hObj.Brush = ReportBrush["&H0"] Endif Next - + End + + Public Function ToString() As String - + Dim aValue As New String[] - + If Me.Style = ReportBorder.None Then Return 'aValue.Add("None") 'If Me.Style = ReportBorder.Solid Then aValue.Add("Solid") aValue.Add(Me.Width) @@ -115,65 +122,88 @@ Public Function ToString() As String If Me.Right Then aValue.Add("Right") aValue.Add("#" & Hex(Me.Color, 6)) Return aValue.Join() - + End Private Function Top_Read() As _ReportBorderSide - + Return hTop - + End Private Function Left_Read() As _ReportBorderSide - + Return hLeft - + End Private Function bottom_Read() As _ReportBorderSide - + Return hBottom - + End Private Function Width_Read() As String - + Return hLeft.Width - + End Private Sub Width_Write(Value As String) - + hLeft.Width = Value hTop.Width = Value hBottom.Width = Value hRight.Width = Value - + End Private Function Brush_Read() As ReportBrush - + Return hLeft.Brush - + End Private Sub Brush_Write(Value As ReportBrush) - + hLeft.Brush = Value hTop.Brush = Value hBottom.Brush = Value hRight.Brush = Value - + End Private Function Right_Read() As _ReportBorderSide - + Return hRight - + End Private Function RoundCorner_Read() As _ReportRoundCorner - + Return hRCorner - + End + + + +Public Sub _SetUnifiedValues() + + Dim hSizeParse As TSizeParse + + hSizeParse = New TSizeParse(hLeft.Width) + _Left = hSizeParse.GetValue() + hSizeParse = New TSizeParse(hRight.Width) + _Right = hSizeParse.GetValue() + hSizeParse = New TSizeParse(hTop.Width) + _Top = hSizeParse.GetValue() + hSizeParse = New TSizeParse(hBottom.Width) + _Bottom = hSizeParse.GetValue() + + hRCorner._SetUnifiedValues() + + + +End + + diff --git a/comp/src/gb.report/.src/ReportBoxShadow.class b/comp/src/gb.report/.src/ReportBoxShadow.class new file mode 100644 index 000000000..8312c86e2 --- /dev/null +++ b/comp/src/gb.report/.src/ReportBoxShadow.class @@ -0,0 +1,213 @@ +' Gambas class file + +Private $aBoxShadow As New _ReportBoxShadow[] + +Property RelX As String +Property RelY As String +'Property Blur As String +Property Spread As String +Property Inset As Boolean +Property Color As Integer +Property Read Count As Integer +Property Read Max As Integer + + +Property Read _RelX As Integer +Property Read _RelY As Integer +'Property Read _Blur As Integer +Property Read _Spread As Integer + + +Public Sub _new() + + Dim hBoxShadow As New _ReportBoxShadow + $aBoxShadow.Add(hBoxShadow) + +End + +Static Public Function _get(sValue As String) As ReportBoxShadow + + Dim hBoxShadow As New ReportBoxShadow + Dim s As String + Dim i As Integer + For Each s In Split(sValue, " ") + If IsDigit(Left(s)) Then + + Select Case i + Case 0 + hBoxShadow.RelX = s + Case 1 + hBoxShadow.RelY = s + Case 2 + hBoxShadow.Blur = s + Case 3 + hBoxShadow.Spread = s + End Select + Inc i + Continue + Endif + If LCase(s) = "inset" Then + hBoxShadow.Inset = True + Continue + Endif + Try hBoxShadow.Color = Val(s) + + Next + Return hBoxShadow + +End + + + +' Public Function _get(Index As Integer) As _ReportBoxShadow +' +' Return $aBoxShadow[Index] +' +' End + +Public Sub Add(Optional RelX As String, RelY As String, iColor As Integer, Spread As String, Blur As String, Inset As Boolean) + + Dim hBoxShadow As New _ReportBoxShadow + + If RelX Then hBoxShadow.RelX = RelX + If RelY Then hBoxShadow.RelY = RelY + If iColor Then hBoxShadow.Color = iColor + If SPread Then hBoxShadow.Spread = Spread + If Blur Then hBoxShadow.Blur = Blur + hBoxShadow.Inset = Inset + $aBoxShadow.Add(hBoxShadow) + +End + +Public Sub Remove(Index As Integer) + + $aBoxShadow.Remove(Index) + +End + + + +Private Function RelX_Read() As String + + Return $aBoxShadow[0].RelX + +End + +Private Sub RelX_Write(Value As String) + + $aBoxShadow[0].RelX = Value + +End + +Private Function RelY_Read() As String + + Return $aBoxShadow[0].RelY + +End + +Private Sub RelY_Write(Value As String) + + $aBoxShadow[0].RelY = Value + +End + +Private Function Blur_Read() As String + + Return $aBoxShadow[0].Blur + +End + +Private Sub Blur_Write(Value As String) + + $aBoxShadow[0].Blur = Value + +End + +Private Function Spread_Read() As String + + Return $aBoxShadow[0].Spread + +End + +Private Sub Spread_Write(Value As String) + + $aBoxShadow[0].Spread = Value + +End + +Private Function Inset_Read() As Boolean + + Return $aBoxShadow[0].Inset + +End + +Private Sub Inset_Write(Value As Boolean) + + $aBoxShadow[0].Inset = Value + +End + +Private Function Color_Read() As Integer + + Return $aBoxShadow[0].Color + +End + +Private Sub Color_Write(Value As Integer) + + $aBoxShadow[0].Color = Value + +End + +Private Function Count_Read() As Integer + + Return $aBoxShadow.Count + +End + +Private Function Max_Read() As Integer + + Return $aBoxShadow.Max + +End + +Public Sub _SetUnifiedValues() + + Dim i As Integer + Dim SizeParse As TSizeParse + For i = 0 To $aBoxShadow.Max + With $aBoxShadow[i] + ._Relx = TSizeParse[.RelX].GetValue() + ._RelY = TSizeParse[.RelY].GetValue() + ._Spread = TSizeParse[.Spread].GetValue() + '._Blur = TSizeParse[.Blur].GetValue() + End With + + + Next + +End + +Private Function _RelX_Read() As Integer + + Return $aBoxShadow[0]._Relx + +End + +Private Function _RelY_Read() As Integer + + Return $aBoxShadow[0]._RelY + +End + +Private Function _Blur_Read() As Integer + + Return $aBoxShadow[0]._Blur + +End + +Private Function _Spread_Read() As Integer + + Return $aBoxShadow[0]._Spread + +End diff --git a/comp/src/gb.report/.src/ReportContainer.class b/comp/src/gb.report/.src/ReportContainer.class index dc53aaab8..55788dd3b 100644 --- a/comp/src/gb.report/.src/ReportContainer.class +++ b/comp/src/gb.report/.src/ReportContainer.class @@ -289,7 +289,7 @@ Private Function GetHSizeInt((AvailableW) As Float, (AvailableH) As Float, (Tota hMyHints = Super._GetSizeHints(AvailableW, AvailableH, TotalWidth, TotalHeight, DataIndex) 'Puis si besoins voir le besoin des enfants - If Me.Autoresize Then + If Me.Autoresize Or If (Me._Width = 0 And Me._Height = 0) Then fSpacing = IIf(Me._RelativeSpacing, TotalWidth * Me._Spacing / 100, Me._Spacing) For Each hChild In Me.Children hChildHints = hchild._GetSizeHints(AvailableW - fWidth, AvailableH, AvailableW, AvailableH, DataIndex) @@ -339,7 +339,7 @@ Private Function GetVSizeInt((AvailableW) As Float, (AvailableH) As Float, (Tota 'On ajoute la taille des objets fixes précédents fHeight = $fFixedSize - If Me.Autoresize Then + If Me.Autoresize Or If (Me._Width = 0 And Me._Height = 0) Then 'On définit la taille au besoins des enfants For i = Me._CurItem To Me.Children.Max hChild = Me.Children[i] diff --git a/comp/src/gb.report/.src/ReportFrame.class b/comp/src/gb.report/.src/ReportFrame.class index 3c1268df5..a30eb28a4 100644 --- a/comp/src/gb.report/.src/ReportFrame.class +++ b/comp/src/gb.report/.src/ReportFrame.class @@ -16,7 +16,9 @@ Private $hBorder As New ReportBorder Private $hBackGround As ReportBrush Property Border As ReportBorder +Property BoxShadow As ReportBoxShadow +Private $hBoxShadow As New ReportBoxShadow Property BackGround As ReportBrush 'Property Read _BorderWidth As Float @@ -59,9 +61,10 @@ Public Sub _PaintBefore((Page) As Integer, (X) As Float, (Y) As Float, (hControl Paint.Stroke Else - + 'If $hBorder.Shadow.Style > ReportShadowStyle.None Then PaintShadow(X1, Y1, hControl.RealWidth, hControl.RealHeight, $hBorder.RoundCorner._Active) If $hBorder.RoundCorner._Active Then - RoundRect(X1, Y1, hControl.RealWidth, hControl.RealHeight, + + RoundRect(X1, Y1, hControl.RealWidth, hControl.RealHeight, [ReportUnits._ReportUnitsToPixels($hBorder.RoundCorner._TopLeft1), ReportUnits._ReportUnitsToPixels($hBorder.RoundCorner._TopRight1), ReportUnits._ReportUnitsToPixels($hBorder.RoundCorner._BottomRight1), @@ -70,8 +73,13 @@ Public Sub _PaintBefore((Page) As Integer, (X) As Float, (Y) As Float, (hControl ReportUnits._ReportUnitsToPixels($hBorder.RoundCorner._TopRight2), ReportUnits._ReportUnitsToPixels($hBorder.RoundCorner._BottomRight2), ReportUnits._ReportUnitsToPixels($hBorder.RoundCorner._BottomRight2)]) + Else - Paint.Rectangle(X1, Y1, X2 - X1, Y2 - Y1) + If $hBoxShadow._RelX <> 0 Then + + Endif + Paint.Rectangle(X1, Y1, X2 - X1, Y2 - Y1) + Endif If Me.BackGround = Null Then @@ -87,6 +95,15 @@ Public Sub _PaintBefore((Page) As Integer, (X) As Float, (Y) As Float, (hControl Endif End +Private Sub PaintBoxShadow(X As Integer, Y As Integer, Width As Integer, Height As Integer) + + + +End + + + + Public Sub _PaintFrame((Page) As Integer, (X) As Float, (Y) As Float, (hControl) As TControl, (DataIndex) As Integer) @@ -112,6 +129,7 @@ Public Sub _PaintAfter((Page) As Integer, (X) As Float, (Y) As Float, (hControl) Y2 = (y + hControl.RealTop + hControl.RealHeight) 'If Me.Tag = "**" Then Stop If $hBorder.RoundCorner._Active Then + Paint.AntiAlias = True fLeftWidth = ReportUnits._ReportUnitsToPixels($hBorder._Left) / 2 paint.LineWidth = fLeftWidth * 2 paint.Brush = $hBorder.Left.Brush._PaintBrush(X1, Y1, X2, Y2) @@ -128,6 +146,7 @@ Public Sub _PaintAfter((Page) As Integer, (X) As Float, (Y) As Float, (hControl) paint.Stroke Else + 'Paint.AntiAlias = False fLeftWidth = ReportUnits._ReportUnitsToPixels($hBorder._Left) fRighWidth = ReportUnits._ReportUnitsToPixels($hBorder._Right) fTopWidth = ReportUnits._ReportUnitsToPixels($hBorder._Top) @@ -159,6 +178,7 @@ Public Sub _PaintAfter((Page) As Integer, (X) As Float, (Y) As Float, (hControl) paint.Rectangle(X1, Y1, fLeftWidth, Y2 - Y1) paint.Fill Endif + 'Paint.AntiAlias = True Endif 'Dec iLevel 'Print String(iLevel, " ") & "restoré" @@ -181,22 +201,9 @@ End Public Sub _SetUnifiedValues() - Dim hSizeParse As TSizeParse - - - - Super._SetUnifiedValues() - - hSizeParse = New TSizeParse($hBorder.Left.Width) - $hBorder._Left = hSizeParse.GetValue() - hSizeParse = New TSizeParse($hBorder.Right.Width) - $hBorder._Right = hSizeParse.GetValue() - hSizeParse = New TSizeParse($hBorder.Top.Width) - $hBorder._Top = hSizeParse.GetValue() - hSizeParse = New TSizeParse($hBorder.Bottom.Width) - $hBorder._Bottom = hSizeParse.GetValue() - $hBorder.RoundCorner._SetUnifiedValues() - +Super._SetUnifiedValues() +$hBorder._SetUnifiedValues +$hBoxShadow._SetUnifiedValues End Public Sub _GetSizeHints((AvailableW) As Float, (AvailableH) As Float, (TotalWidth) As Float, (TotalHeight) As Float, DataIndex As Integer) As TSizeHint @@ -280,3 +287,16 @@ Static Private Sub RoundRect(x As Float, y As Float, w As Float, h As Float, Rad 'Paint.closepath() End + + +Private Function BoxShadow_Read() As ReportBoxShadow + + Return $hBoxShadow + +End + +Private Sub BoxShadow_Write(Value As ReportBoxShadow) + + $hBoxShadow = Value + +End diff --git a/comp/src/gb.report/.src/ReportImage.class b/comp/src/gb.report/.src/ReportImage.class index 3bd79ff7d..3259acd59 100644 --- a/comp/src/gb.report/.src/ReportImage.class +++ b/comp/src/gb.report/.src/ReportImage.class @@ -30,7 +30,7 @@ Public Sub _GetSizeHints((AvailableW) As Float, (AvailableH) As Float, (TotalWid hMyHints = Super._GetSizeHints(AvailableW, AvailableH, TotalWidth, TotalHeight, DataIndex) - If Me.Autoresize Then + If Me.Autoresize Or If (Me._Width = 0 And Me._Height = 0) Then If $hpic Then hpic = $hpic Else diff --git a/comp/src/gb.report/.src/ReportLabel.class b/comp/src/gb.report/.src/ReportLabel.class index a4993818c..f034e5e6e 100644 --- a/comp/src/gb.report/.src/ReportLabel.class +++ b/comp/src/gb.report/.src/ReportLabel.class @@ -65,7 +65,7 @@ Public Sub _GetSizeHints((AvailableW) As Float, (AvailableH) As Float, (TotalWid 'if the size choosed by the user is less than the font height, set the object to the font height - If Me.Autoresize Then + If Me.Autoresize Or If (Me._Width = 0 And Me._Height = 0) Then If Not IsNull(Me.Font) Then Paint.Font = Me.Font If Not $sText Then Raise Data(DataIndex) diff --git a/comp/src/gb.report/.src/ReportShadowStyle.class b/comp/src/gb.report/.src/ReportShadowStyle.class new file mode 100644 index 000000000..fe43c48ca --- /dev/null +++ b/comp/src/gb.report/.src/ReportShadowStyle.class @@ -0,0 +1,4 @@ +' Gambas class file + +Export +Public Enum None, Solid, Gradient \ No newline at end of file diff --git a/comp/src/gb.report/.src/ReportSvgImage.class b/comp/src/gb.report/.src/ReportSvgImage.class index e64028ff1..b23114db2 100644 --- a/comp/src/gb.report/.src/ReportSvgImage.class +++ b/comp/src/gb.report/.src/ReportSvgImage.class @@ -25,7 +25,7 @@ Public Sub _GetSizeHints((AvailableW) As Float, (AvailableH) As Float, (TotalWid hMyHints = Super._GetSizeHints(AvailableW, AvailableH, TotalWidth, TotalWidth, DataIndex) - If Me.Autoresize Then + If Me.Autoresize Or If (Me._Width = 0 And Me._Height = 0) Then If $hpic Then hpic = $hpic Else diff --git a/comp/src/gb.report/.src/ReportTextLabel.class b/comp/src/gb.report/.src/ReportTextLabel.class index 82875bab9..f237f17b4 100644 --- a/comp/src/gb.report/.src/ReportTextLabel.class +++ b/comp/src/gb.report/.src/ReportTextLabel.class @@ -48,7 +48,7 @@ Public Sub _GetSizeHints((AvailableW) As Float, (AvailableH) As Float, (TotalWid hMyHints = Super._GetSizeHints(AvailableW, AvailableH, TotalWidth, TotalWidth, DataIndex) - If Me.Autoresize Then + If Me.Autoresize Or If (Me._Width = 0 And Me._Height = 0) Then If Not $sText Then Raise Data(DataIndex) sTmp = Data diff --git a/comp/src/gb.report/.src/TSizeParse.class b/comp/src/gb.report/.src/TSizeParse.class index 41dffc7fb..6f4051e43 100644 --- a/comp/src/gb.report/.src/TSizeParse.class +++ b/comp/src/gb.report/.src/TSizeParse.class @@ -1,6 +1,6 @@ ' Gambas class file -Fast +'Fast Public Value As Float Public Unit As String @@ -10,7 +10,7 @@ Public Sub _new(Size As String, Optional bAllowRelative As Boolean) Dim I As Integer Dim sCar As String - + Size = Trim(Size) If Not Size Then @@ -25,7 +25,7 @@ Public Sub _new(Size As String, Optional bAllowRelative As Boolean) Value = CFloat(Left$(Size, I - 1)) Unit = Trim(Mid$(Size, I)) - + If Not Unit Then Unit = "%" If Not ReportUnits.AllowedUnits.Exist(Unit) Then @@ -49,7 +49,8 @@ Public Sub IsRelative() As Boolean End Public Sub GetValue() As Float - + + If IsRelative() Then Return Value Else diff --git a/comp/src/gb.report/.src/Tests/Old/Report6.class b/comp/src/gb.report/.src/Tests/Old/Report6.class index d6e1c6191..0a5fa73ac 100644 --- a/comp/src/gb.report/.src/Tests/Old/Report6.class +++ b/comp/src/gb.report/.src/Tests/Old/Report6.class @@ -1,13 +1,2 @@ ' Gambas class file -Public Sub ReportLabel1_Data() - -End - -Public Sub ReportDrawingArea1_Draw() - - Paint.MoveTo(0, 0) - Paint.LineTo(Paint.Width, Paint.Height) - Paint.Stroke - -End diff --git a/comp/src/gb.report/.src/Tests/Old/Report6.report b/comp/src/gb.report/.src/Tests/Old/Report6.report index 4b0ffde6f..e4975fe7a 100644 --- a/comp/src/gb.report/.src/Tests/Old/Report6.report +++ b/comp/src/gb.report/.src/Tests/Old/Report6.report @@ -4,11 +4,14 @@ #MoveScaled(0,0,64,64) Index = 0 Text = ("") - { ReportLabel1 ReportLabel - #MoveScaled(2,2,58,9) - AutoResize = True - Border = ReportBorder["Top:1mm #000000;Bottom:1mm #000000;Left:1mm #000000;Right:1mm #000000"] - Text = ("coucou") + { ReportPanel1 ReportPanel + #MoveScaled(4,5,59,31) + Padding = ReportPadding["Top:1mm;Bottom:1mm;Left:1mm;Right:1mm"] + { ReportLabel1 ReportLabel + #MoveScaled(2,4,53,20) + Padding = ReportPadding["Top:2cm;Bottom:2cm;Left:2cm;Right:2cm"] + Text = ("ReportLabel1") + } } Index = 0 } diff --git a/comp/src/gb.report/.src/Tests/Old/rpTestShadow.class b/comp/src/gb.report/.src/Tests/Old/rpTestShadow.class new file mode 100644 index 000000000..596b9542a --- /dev/null +++ b/comp/src/gb.report/.src/Tests/Old/rpTestShadow.class @@ -0,0 +1,11 @@ +' Gambas class file + + + +Public Sub ReportDrawingArea1_Draw() + + Paint.MoveTo(0, 0) + Paint.LineTo(Paint.Width, Paint.Height) + Paint.Stroke + +End diff --git a/comp/src/gb.report/.src/Tests/Old/rpTestShadow.report b/comp/src/gb.report/.src/Tests/Old/rpTestShadow.report new file mode 100644 index 000000000..6d447f794 --- /dev/null +++ b/comp/src/gb.report/.src/Tests/Old/rpTestShadow.report @@ -0,0 +1,16 @@ +# Gambas Form File 3.0 + +{ Report Report + #MoveScaled(0,0,64,64) + Padding = ReportPadding["Top:6cm;Bottom:6cm;Left:6cm;Right:6cm"] + Index = 0 + Text = ("") + { ReportLabel1 ReportLabel + #MoveScaled(2,2,58,9) + Height = "7cm" + AutoResize = True + Border = ReportBorder["Top:2px #000000;Bottom:2px #000000;Left:2mm LinearGradient(0.74,0.7,0,0,[#000000,#FFFFFF],[0,1]);Right:2px #000000"] + Text = ("coucou") + } + Index = 0 +} diff --git a/comp/src/gb.report/.src/Tests/Report11.class b/comp/src/gb.report/.src/Tests/Report11.class index 0f2e12473..adc0818ae 100644 --- a/comp/src/gb.report/.src/Tests/Report11.class +++ b/comp/src/gb.report/.src/Tests/Report11.class @@ -7,7 +7,7 @@ Public Sub _new() hMap.AddTile("gg", "https://khms{s}.google.fr/kh/v={version}&src=app&x={x}&y={y}&z={z}&s=Galile", ["version": "145"]).SubDomains = ["0", "1", "2"] hmap.Zoom = 17 - ReportPanel1.DataCount = 200 + 'ReportPanel1.DataCount = 200 End @@ -16,9 +16,10 @@ Public Sub ReportDrawingArea1_Draw(width As Integer, Height As Integer, Index As 'Print width, Height 'hMap.Resize(Width, Height) 'If Paint.Device Is Printer Then Stop - hMap.Center = MapPoint(Geo.SexToDec(Str(CInt(Rnd(30, 45))) & "°31'33,33''N"), Geo.SexToDec("0°18'43,50''W")) + hMap.Center = MapPoint(Geo.SexToDec("45°31'33,33''N"), Geo.SexToDec("0°18'43,50''W")) + 'hMap.Center = MapPoint(Geo.SexToDec(Str(CInt(Rnd(30, 45))) & "°31'33,33''N"), Geo.SexToDec("0°18'43,50''W")) 'If Not hImgCache Then - hImgCache = hMap.Grab(hMap.Bounds, width / ReportUnits.DesktopScale, Height / ReportUnits.DesktopScale, 0, 12) + hImgCache = hMap.Grab(hMap.Bounds, width / ReportUnits.DesktopScale, Height / ReportUnits.DesktopScale, 0, 18) Draw.Image(hImgCache, 0, 0, width, Height) End diff --git a/comp/src/gb.report/.src/Tests/Report11.report b/comp/src/gb.report/.src/Tests/Report11.report index 112ccc792..12ab963a9 100644 --- a/comp/src/gb.report/.src/Tests/Report11.report +++ b/comp/src/gb.report/.src/Tests/Report11.report @@ -17,10 +17,10 @@ #MoveScaled(6,12,53,31) AutoResize = True { ReportDrawingArea1 ReportDrawingArea - #MoveScaled(0,0,52,30) + #MoveScaled(2,0,52,30) Width = "7mm" Height = "6cm" - Border = ReportBorder["Top:2mm #000000;Bottom:2mm #000000;Left:2mm #000000;Right:2mm #000000;TopLeftCorner:16mm;TopRightCorner:16mm;BottomRightCorner:16mm;BottomLeftCorner:16mm"] + Border = ReportBorder["Top:2mm LinearGradient(0.84,0.67,0,0,[#000000,#FFFFFF],[0,1]);Bottom:2mm LinearGradient(0.84,0.67,0,0,[#000000,#FFFFFF],[0,1]);Left:2mm LinearGradient(0.84,0.67,0,0,[#000000,#FFFFFF],[0,1]);Right:2mm LinearGradient(0.84,0.67,0,0,[#000000,#FFFFFF],[0,1])"] Cached = True } } diff --git a/comp/src/gb.report/.src/_ReportBorderSide.class b/comp/src/gb.report/.src/_ReportBorderSide.class index ad95988e4..968e7c3c2 100644 --- a/comp/src/gb.report/.src/_ReportBorderSide.class +++ b/comp/src/gb.report/.src/_ReportBorderSide.class @@ -5,5 +5,12 @@ Public Width As String Public Brush As New ReportBrush Public Round1 As String Public Round2 As String +Public _Width As Float - +Public Sub _SetUnifiedValues() + Dim hSizeParse As New TSizeParse(Width) + + _Width = hSizeParse.GetValue() + + +End diff --git a/comp/src/gb.report/.src/_ReportBoxShadow.class b/comp/src/gb.report/.src/_ReportBoxShadow.class new file mode 100644 index 000000000..1bf84a7de --- /dev/null +++ b/comp/src/gb.report/.src/_ReportBoxShadow.class @@ -0,0 +1,13 @@ +' Gambas class file + +Public RelX As String = "2mm" +Public RelY As String = "2mm" +Public Spread As String +Public Inset As Boolean +Public Color As Integer +'Public Blur As String + +Public _Relx As Integer +Public _RelY As Integer +Public _Spread As Integer +'Public _Blur As Integer