open-insight/LSL2/STPROC/SET_PRINTER_OBJECT.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

129 lines
3.3 KiB
Plaintext

Subroutine Set_Printer_Object(Type, Data, Font1, Font2, Fill)
/********************************************************************************************************
This program is proprietary and is not to be used by or disclosed to others, nor is it to
be copied without written permission from SRP Computer Solutions, Inc.
Name : Set Printer Object
Description :
Tags : [SRP]
Parameters :
History (Date, Initials, Notes)
12/14/06 fjt Initial development
********************************************************************************************************/
$insert SRP_APP_INSERTS
$insert OIPI_FONTS
$insert OIPRINT_EQUATES
If Assigned(Type) else Type = ""
If Assigned(Data) else Data = ""
If Assigned(Font1) else Font1 = ""
If Assigned(Font2) else Font2 = ""
If Assigned(Fill) else Fill = ""
xAdj = 0
yAdj = 0
rv = ""
If (Font1 EQ "") then Font1 = Tahoma(6,1)
If (Font1 EQ No$) then Font1 = ""
Cnt = Count(Data, @FM) + (Data NE "")
Begin Case
Case Type EQ "T" ; GoSub TEXT
Case Type EQ "R" ; GoSub RECT
Case Type EQ "L" ; GoSub LINE
End Case
Data = ""
Cancel = Get_Printer("CANCEL")
Return Cancel
!----- INTERNAL ROUTINES ------------------------------------------------------------------------------
TEXT:
For i = 1 to Cnt
Xpos1 = Data<i,1>
Ypos1 = Data<i,2>
Inches = Data<i,3>
Text = Data<i,4>
Justif = Text[1,1]
NoWrap = "~"
Twips = NoWrap:Justif:(Abs(Inches) * 1440)
Text[1,1] = ""
If (Font1 NE "") then rv<-1> = Set_Printer("FONT", Font1)
rv<-1> = Set_Printer("POS", 0.00:@FM:Ypos1)
rv<-1> = Set_Printer("ADDTABLE", Twips, "", Text, "", "", 0, 0:@FM:Xpos1 + 0.050)
Next i
Data = ""
return
RECT:
If Assigned(Font2) then
DataPos = 0.150
end else
DataPos = 0.150
Font2 = Tahoma(10,1)
end
For i = 1 to Cnt
Xpos1 = (Data<i, 1> + xAdj)
Ypos1 = (Data<i, 2> + yAdj)
Xpos2 = (Data<i, 3> + xAdj)
Ypos2 = (Data<i, 4> + yAdj)
RectLabel = (Data<i, 5>)
RectVar = (Data<i, 6>)
Align = (Data<i, 7>)
Twips = "<":( (Abs(Xpos2 - Xpos1)) * 1440 )
If (Fill) then
rv = Set_Printer("FILLSTYLE", BS_SOLID:@FM:Fill)
end
rv = Set_Printer("RECT", Xpos1:@FM:Ypos1:@FM:Xpos2:@FM:Ypos2, No$)
If (Fill) then rv = Set_Printer("FILLSTYLE", BS_HOLLOW:@FM:White$)
If (RectLabel GT "") then
rv<-1> = Set_Printer("FONT", Font1)
rv<-1> = Set_Printer("POS", 0.00:@FM:Ypos1 + 0.025)
rv<-1> = Set_Printer("ADDTABLE", Twips, "", RectLabel, "", "", 0, 0:@FM:Xpos1 + 0.025)
end
If (RectVar GT "") then
Adj = 0.10
If Align then
Twips[1,1] = Align
Adj = 0
end
rv<-1> = Set_Printer("FONT", Font2)
rv<-1> = Set_Printer("POS", 0.00:@FM:Ypos1 + DataPos)
rv<-1> = Set_Printer("ADDTABLE", Twips, "", RectVar, "", "", 0, 0:@FM:Xpos1 + Adj)
end
Next i
return
LINE:
For i = 1 to Cnt
Xpos1 = (Data<i, 1> + xAdj)
Ypos1 = (Data<i, 2> + yAdj)
Xpos2 = (Data<i, 3> + xAdj)
Ypos2 = (Data<i, 4> + yAdj)
Until Xpos1 EQ ""
If (Fill GT "") then rv<-1> = Set_Printer("LINESTYLE", 0:@FM:1/2:@FM:Fill)
rv<-1> = Set_Printer("LINE", Xpos1:@FM:Ypos1:@FM:Xpos2:@FM:Ypos2, No$)
If (Fill GT "") then rv<-1> = Set_Printer("LINESTYLE", 0:@FM:1/2:@FM:0)
Next i
return