[GB.REPORT]

* BUG: Now ReportLabel take multiline text into account
  for it height computing.


git-svn-id: svn://localhost/gambas/trunk@6075 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Fabien Bodard 2014-01-08 20:52:23 +00:00
parent e28bd14ae3
commit 7c5aecff77
7 changed files with 497 additions and 4 deletions

View file

@ -1,2 +1,9 @@
[Desktop Entry] [Desktop Entry]
Icon=./.icon.png Icon=./.icon.png
[Dolphin]
Timestamp=2014,1,4,21,13,1
Version=3
[Settings]
HiddenFilesShown=true

View file

@ -1,9 +1,9 @@
# Gambas Project File 3.0 # Gambas Project File 3.0
# Compiled with Gambas 3.5.0 # Compiled with Gambas 3.5.90
Title=Report designer Title=Report designer
Startup=myReport1 Startup=Report1
Icon=printer1.png Icon=printer1.png
Version=3.5.0 Version=3.5.90
VersionFile=1 VersionFile=1
Component=gb.image Component=gb.image
Component=gb.gui Component=gb.gui

View file

@ -76,7 +76,7 @@ Public Sub _GetSizeHints((AvailableW) As Float, (AvailableH) As Float, (TotalWid
If $fAngle = 0.0 Then If $fAngle = 0.0 Then
hExt = Paint.TextExtents(sText) hExt = Paint.TextExtents(sText)
fTextWidth = Me.Padding._Left + Me.Border._Left + MTools.PixelsToUnitspaint(hExt.Width) + Me.Padding._Right + Me.Border._Right fTextWidth = Me.Padding._Left + Me.Border._Left + MTools.PixelsToUnitspaint(hExt.Width) + Me.Padding._Right + Me.Border._Right
fTextHeight = MTools.PixelsToUnitsPaint(Paint.Font.Height) + Me.Padding._Top + Me.Padding._Bottom + Me.Border._Top + Me.Border._Bottom fTextHeight = MTools.PixelsToUnitsPaint(hext.Height) + Me.Padding._Top + Me.Padding._Bottom + Me.Border._Top + Me.Border._Bottom
'Debug Paint.Font.Height * Paint.ResolutionX / Desktop.Resolution 'Debug Paint.Font.Height * Paint.ResolutionX / Desktop.Resolution
Else Else

View file

@ -1,2 +1,8 @@
' Gambas class file ' Gambas class file
Public Sub ReportLabel2_Data(Index As Integer)
Last.data = "coucou\n c'est <br> moi"
End

View file

@ -5,6 +5,11 @@
Count = 3 Count = 3
Index = 0 Index = 0
Text = ("#3") Text = ("#3")
{ ReportLabel2 ReportLabel
#MoveScaled(3,4,33,8)
AutoResize = True
Background = ReportBrush["#FFFF00"]
}
Index = 1 Index = 1
Text = ("#1") Text = ("#1")
{ ReportHBox1 ReportHBox { ReportHBox1 ReportHBox

View file

@ -0,0 +1,166 @@
' Gambas class file
Public nnoderows As Integer
Public nanchorrows As Integer
Public Sub _new()
'Report.Debug = True
'enter current date on the header
ReportLabel2.Text = Date
'enter the project information in the header on the print out page
'With FMain.Project
ReportLabel3.Text = "Project Title: " ' & .JobTitle
ReportLabel4.Text = "Project No.: '" '& .Number
ReportLabel5.Text = "Company: " '& .Company
ReportLabel6.Text = "Designer: " '& .Designer
ReportLabel7.Text = "Base Plate ID: " ' & .BasePlateID
'End With
'set count to four to display the results for qmax. Tmax, L, and phi
ReportHBox9.DataCount = 4
'set the number of plate nodes to display in print out tables
' nnoderows = Module1.RoundUpInt(FMain.ConcreteSection.cNodes.Count / 2)
ReportHBox5.DataCount = 11 'nnoderows
'set the number of anchor rods to display in print out tables
'nanchorrows = Module1.RoundUpInt(FMain.cAnchorRods.Count / 2)
ReportHBox7.DataCount = 6 'nanchorrows
'set the number of report panels - one for each load combination result
ReportPanel1.DataCount = 6 'FMain.AnalysisResults.Count
End
Public Sub ReportImage2_Data(Index As Integer)
'Dim current_results As Results
Dim pSection As Picture
'create a new picture object for drawing the base plate
pSection = New Picture(300, 300, False)
'get the results for first load case
'current_results = FMain.AnalysisResults[Str$(ReportHBox3.DataIndex)]
'refresh base plate drawing with results
'Module1.DrawBasePlate(pSection, 1, current_results)
'add the picture of the base plate to the page
ReportImage2.Image = pSection.Image
End
Public Sub ReportLabel9_Data(Index As Integer)
Last.Data = "Load Case: " '& FMain.cLoads[Str$(ReportHBox3.DataIndex)].label
End
Public Sub ReportLabel14_Data(Index As Integer)
Dim $value As String
Select Case Index
Case 0
'$value = Module1.AdvFormat(FMain.AnalysisResults[Str$(ReportHBox3.DataIndex)].Tmax, 2)
Last.Data = "T(max) = " & 3 & " lbs"
Case 1
'$value = Module1.AdvFormat(FMain.AnalysisResults[Str$(ReportHBox3.DataIndex)].maxstress, 2)
Last.Data = "q(max) = " & 3 & " psi"
Case 2
'$value = Module1.AdvFormat(FMain.AnalysisResults[Str$(ReportHBox3.DataIndex)].L, 2)
Last.Data = "L = " & 3 & " in"
Case 3
'$value = Module1.AdvFormat(FMain.AnalysisResults[Str$(ReportHBox3.DataIndex)].phi, 2)
Last.Data = "phi = " & 3 & " degrees"
Case Else
End Select
End
Public Sub ReportLabel25_Data(Index As Integer)
Last.Data = Index + 1
End
Public Sub ReportLabel29_Data(Index As Integer)
' Dim current_results As Results
'current_results = FMain.AnalysisResults[Str$(ReportPanel1.DataIndex)]
'If nnoderows + Index < current_results.stress.Count Then
Last.Data = nnoderows + Index + 1
'Else
' Last.Data = Null
' Endif
End
Public Sub ReportLabel26_Data(Index As Integer)
Dim value As Float
'value = FMain.AnalysisResults[Str$(ReportPanel1.DataIndex)].stress[Index]
Last.Data = "tt" 'Module1.AdvFormat(value, 2)
End
Public Sub ReportLabel30_Data(Index As Integer)
Dim value As Float
'Dim current_results As Results
'current_results = FMain.AnalysisResults[Str$(ReportPanel1.DataIndex)]
' If nnoderows + Index < current_results.stress.Count Then
'value = current_results.stress[nnoderows + Index]
Last.Data = "mm" 'Module1.AdvFormat(value, 2)
' Else
Last.Data = Null
'Endif
End
Public Sub ReportLabel49_Data(Index As Integer)
Last.Data = Index + 1
End
Public Sub ReportLabel52_Data(Index As Integer)
'Dim current_results As Results
'current_results = FMain.AnalysisResults[Str$(ReportPanel1.DataIndex)]
'If nanchorrows + Index < current_results.T.Count Then
Last.Data = nanchorrows + Index + 1
'Else
' Last.Data = Null
' Endif
End
Public Sub ReportLabel50_Data(Index As Integer)
Dim value As Float
'value = FMain.AnalysisResults[Str$(ReportPanel1.DataIndex)].T[Index]
Last.Data = "kkkk" 'Module1.AdvFormat(value, 2)
End
Public Sub ReportLabel53_Data(Index As Integer)
Dim value As Float
'Dim current_results As Results
' current_results = FMain.AnalysisResults[Str$(ReportPanel1.DataIndex)]
' If nanchorrows + Index < current_results.T.Count Then
' value = current_results.T[nanchorrows + Index]
Last.Data = "qqqqqq" 'Module1.AdvFormat(value, 2)
' Else
' Last.Data = Null
'Endif
End

View file

@ -0,0 +1,309 @@
# Gambas Form File 3.0
{ Report Report
#MoveScaled(0,0,76,88)
Fixed = True
Padding = ReportPadding["Top:20mm;Bottom:10mm;Left:20mm;Right:20mm"]
Ignore = True
AutoResize = True
Paper = Printer.Letter
Index = 0
Text = ("")
{ ReportHBox1 ReportHBox
#MoveScaled(2,0,62,11)
Height = "25mm"
Fixed = True
Padding = ReportPadding["Top:1mm;Bottom:1mm;Left:1mm;Right:1mm"]
Border = ReportBorder["Bottom:2px #000000"]
{ ReportImage1 ReportImage
#MoveScaled(1,1,18,9)
Width = "51mm"
AutoResize = True
}
{ ReportLabel1 ReportLabel
#MoveScaled(21,1,10,9)
Width = "25mm"
AutoResize = True
Text = ("Version 1.0")
Alignment = Align.BottomLeft
}
{ ReportLabel2 ReportLabel
#MoveScaled(31,1,30,9)
Expand = True
AutoResize = True
Text = ("Date")
Alignment = Align.BottomRight
UseField = True
}
}
{ ReportVBox1 ReportVBox
#MoveScaled(2,11,62,9)
Height = "28.01mm"
Fixed = True
Padding = ReportPadding["Top:1mm;Bottom:1mm;Left:1mm;Right:1mm"]
Border = ReportBorder["Bottom:2px #000000"]
{ ReportLabel3 ReportLabel
#MoveScaled(0,0,12,2)
Height = "6mm"
AutoResize = True
Text = ("Project Title:")
Alignment = Align.TopLeft
}
{ ReportLabel4 ReportLabel
#MoveScaled(0,2,12,2)
Height = "6mm"
AutoResize = True
Text = ("Project No.:")
Alignment = Align.TopLeft
}
{ ReportLabel5 ReportLabel
#MoveScaled(0,4,12,2)
Height = "6mm"
AutoResize = True
Text = ("Company:")
Alignment = Align.TopLeft
}
{ ReportLabel6 ReportLabel
#MoveScaled(0,6,12,2)
Height = "6mm"
AutoResize = True
Text = ("Designer:")
Alignment = Align.TopLeft
}
}
{ ReportHBox2 ReportHBox
#MoveScaled(2,20,62,3)
Height = "8mm"
Fixed = True
Padding = ReportPadding["Top:1mm;Bottom:1mm;Left:1mm;Right:1mm"]
Border = ReportBorder["Bottom:2px #000000"]
{ ReportLabel7 ReportLabel
#MoveScaled(0,0,12,2)
Height = "6mm"
AutoResize = True
Text = ("Base Plate ID:")
Alignment = Align.TopLeft
}
}
{ ReportPanel1 ReportPanel
#MoveScaled(2,25,67,52)
AutoResize = True
ForceNewPage = True
{ ReportHBox3 ReportHBox
#MoveScaled(1,1,62,17)
Height = "61mm"
Expand = True
{ ReportVBox3 ReportVBox
#MoveScaled(1,1,18,14)
AutoResize = True
{ ReportHBox8 ReportHBox
#MoveScaled(1,2,15,4)
Width = "51mm"
Height = "12mm"
{ ReportLabel9 ReportLabel
#MoveScaled(1,1,13,2)
Font = Font["+1"]
Expand = True
}
}
{ ReportHBox9 ReportHBox
#MoveScaled(1,8,15,4)
Width = "51mm"
Height = "6mm"
{ ReportLabel14 ReportLabel
#MoveScaled(1,1,13,2)
Expand = True
}
}
}
{ ReportImage2 ReportImage
#MoveScaled(31,1,17,15)
Padding = ReportPadding["Top:5mm;Bottom:5mm;Left:5mm;Right:5mm"]
Expand = True
Alignment = Align.Center
}
}
{ ReportVBox4 ReportVBox
#MoveScaled(1,20,62,14)
AutoResize = True
{ ReportLabel19 ReportLabel
#MoveScaled(2,0,16,4)
Fixed = True
Font = Font["+1"]
Padding = ReportPadding["Top:3mm"]
AutoResize = True
Text = ("Bearing Pressue")
}
{ ReportHBox4 ReportHBox
#MoveScaled(1,3,60,4)
Height = "6mm"
Fixed = True
{ ReportLabel20 ReportLabel
#MoveScaled(1,1,13,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Text = ("Node #")
Alignment = Align.Center
}
{ ReportLabel21 ReportLabel
#MoveScaled(14,1,14,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Text = ("Brg. Press., psi")
Alignment = Align.Center
}
{ ReportLabel22 ReportLabel
#MoveScaled(28,1,4,2)
Width = "5mm"
}
{ ReportLabel23 ReportLabel
#MoveScaled(32,1,12,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Text = ("Node #")
Alignment = Align.Center
}
{ ReportLabel24 ReportLabel
#MoveScaled(44,1,15,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Text = ("Brg. Press., psi")
Alignment = Align.Center
}
}
{ ReportHBox5 ReportHBox
#MoveScaled(1,8,60,4)
Height = "6mm"
{ ReportLabel25 ReportLabel
#MoveScaled(1,1,13,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Alignment = Align.Center
}
{ ReportLabel26 ReportLabel
#MoveScaled(14,1,14,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Alignment = Align.Center
}
{ ReportLabel27 ReportLabel
#MoveScaled(28,1,4,2)
Width = "5mm"
}
{ ReportLabel29 ReportLabel
#MoveScaled(32,1,12,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Alignment = Align.Center
}
{ ReportLabel30 ReportLabel
#MoveScaled(44,1,15,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Alignment = Align.Center
}
}
}
{ ReportVBox6 ReportVBox
#MoveScaled(1,36,62,14)
AutoResize = True
{ ReportLabel31 ReportLabel
#MoveScaled(2,0,19,4)
Fixed = True
Font = Font["+1"]
Padding = ReportPadding["Top:3mm"]
AutoResize = True
Text = ("Anchor Rod Tension")
}
{ ReportHBox6 ReportHBox
#MoveScaled(1,3,60,4)
Height = "6mm"
Fixed = True
{ ReportLabel44 ReportLabel
#MoveScaled(1,1,13,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Text = ("Rod #")
Alignment = Align.Center
}
{ ReportLabel45 ReportLabel
#MoveScaled(14,1,14,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Text = ("Tension, lbs")
Alignment = Align.Center
}
{ ReportLabel46 ReportLabel
#MoveScaled(28,1,4,2)
Width = "5mm"
}
{ ReportLabel47 ReportLabel
#MoveScaled(32,1,12,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Text = ("Rod #")
Alignment = Align.Center
}
{ ReportLabel48 ReportLabel
#MoveScaled(44,1,15,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Text = ("Tension, lbs")
Alignment = Align.Center
}
}
{ ReportHBox7 ReportHBox
#MoveScaled(1,8,60,4)
Height = "6mm"
{ ReportLabel49 ReportLabel
#MoveScaled(1,1,13,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Alignment = Align.Center
}
{ ReportLabel50 ReportLabel
#MoveScaled(14,1,14,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Alignment = Align.Center
}
{ ReportLabel51 ReportLabel
#MoveScaled(28,1,4,2)
Width = "5mm"
}
{ ReportLabel52 ReportLabel
#MoveScaled(32,1,12,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Alignment = Align.Center
}
{ ReportLabel53 ReportLabel
#MoveScaled(44,1,15,2)
Expand = True
Border = ReportBorder["Top:1px #000000;Bottom:1px #000000;Left:1px #000000;Right:1px #000000"]
Alignment = Align.Center
}
}
}
}
{ ReportPanel2 ReportPanel
#MoveScaled(2,77,69,1)
Fixed = True
Background = ReportBrush["#FFFF00"]
}
{ ReportHBox10 ReportHBox
#MoveScaled(2,79,62,4)
Height = "1cm"
Fixed = True
AutoResize = True
{ ReportLabel8 ReportLabel
#MoveScaled(22,1,21,2)
Expand = True
AutoResize = True
Text = ("Page $PAGE of $NPAGE")
Alignment = Align.Bottom
UseField = True
}
}
Index = 0
}