SBP '************************************************************ '* Scalable Forms Generator Program * '* Copyright (c) 1993 Information Management Services * '* PO Box 1471, Cary NC 27511 * '* (919) 481-9009[B] 380-7534[Fax] * '* by Robert Geiger, President. CIS: 70134,1723 * '* This program should be run from Superbase 2.0 * '* Written based on Keith Remmes Excellent TechJournal * '* Article on Scalable Forms. Who wants to do all that * '* editing by hand, anyway! Thanks Keith. * '************************************************************ main() t _werrproc * Declare Global Vars InFile$,OutFile$,l$,lTrans$ NumPars%%,stime% Para$(11) AboutBox() Init() ConvertFile(InFile$,OutFile$) CloseUp()  Init() InFile$"*.sbp":OutFile$"SCALEOUT.SBP" "REMINDER: SBP file MUST be saved as TEXT","Command: SAVE "(34)"yourfile.sbp"(34)", TEXT",0 "Select SBP form file to convert","",26,a%%,InFile$ a%%0p"Scalable Forms Generator CANCELED","Information Management Services, Inc.",0: "Default output file saved as SCALEOUT.SBP","Rename it as needed...",27,a%%,OutFile$ a%%0p"Scalable Forms Generator CANCELED","Information Management Services, Inc.",0: stime%R {:{:{:{:{:{ {" Running Scalable Form Generator..." {" Observe Status Line below for Progress"  ConvertFile(inf$,outf$) ln%%,Foundit%% inf$ outf$ ln%%0 OB("*") cl$:ln%%ln%%1 B("*")p  // * 1=ADD FORM, 2=SET FORM TEXT, 3=ADD FORM REPLICATE * // Foundit%%0 Foundit%%(?(l$,"ADD FORM "),1,Foundit%%) Foundit%%(?(l$,"SET FORM TEXT "),2,Foundit%%) Foundit%%(?(l$,"ADD FORM REPLICATE "),3,Foundit%%) Foundit%%0p"Transforming line number "(ln%%,"999999") Foundit%% 0:lTrans$l$ 1' *** Do not put calls on same line as CASE like CASE 0 above!  DoAddForm(l$) 2  DoSetText(l$) 3  DoAddFormRep(l$)  {lTrans$ ?(lTrans$,"SUB main()")0pFactors() "Completed Scalable Form in "7(Rstime%,"hh mm:ss.sss") "Successfully Generated Scalable Form File","to output file: "OutFile$,0  CloseUp() : "Loading "OutFile$ oOutFile$ o  errproc: "Error Encountered...Closing files" ((&),"Errno: "(&,"999")". Cancelling operation",0 "" : '************************************************* '* Conversion Procedures * '************************************************* ' ' Convert ADD FORM... ' Includes image scaling conversion for ADD FORM 4 type ' DoAddForm(s$) ExtractChar(s$,",",Para$()) s0$,p%% s0$"" p%%0qNumPars%% F(Para$(p%%))""p p%%  0:s0$Para$(p%%)  1,3:s0$s0$","Para$(p%%)" * wr#%"  2,4:s0$s0$","Para$(p%%)" * hr#%"  6  ?(Para$(0),"4")p' if adding an image... Para$(p%%)"s"Para$(p%%)' then make it scalable   s0$s0$","Para$(p%%)  ^:s0$s0$","Para$(p%%)   p%% lTrans$s0$ ClearA(Para$())  ' Convert SET FORM TEXT... ' DoSetText(s$) ExtractChar(s$,",",Para$()) s0$,p%% s0$"" p%%0qNumPars%% F(Para$(p%%))""p p%%  0  s0$Stuff$(Para$(p%%),"~",17,0)","(34)  1:s0$s0$" + STR$ ( INT("Para$(p%%)" * hr#%),"(34)"999"(34)") + "(34)  ^:s0$s0$","Para$(p%%)   p%% lTrans$s0$ ClearA(Para$())  ' Convert SET FORM REPLICATE... ' DoAddFormRep(s$) ExtractChar(s$,",",Para$()) s0$,p%% s0$"" p%%0qNumPars%% F(Para$(p%%))""p p%%  0:s0$Para$(p%%)  CASE 1,2:s0$ = s0$ + "," + Para$(p%%)  3:s0$s0$", INT ("Para$(p%%)" * hr#%)"  4:s0$s0$", INT ("Para$(p%%)" * wr#%)"  ^:s0$s0$","Para$(p%%)   p%% lTrans$s0$ ClearA(Para$())  ClearA(A$()) i%%0q11:A$(i%%)"":i%%  Factors() {" REM **********************************************" {" REM This Code initializes the scaling factors" {" REM FILE: "OutFile$ {" REM DATE: "(Q,"mmm dd, yyyy") {" REM **********************************************" {" GLOBAL wr#%,hr#%' <- MUST GLOBALIZE THESE TWO VARIABLES" {" REM * Only need to run the next 6 lines once in your program *" {" OrigWidth%% = 640" {" OrigHeight%% = 480" {" PixelWidth%% = FN sys (6)" {" PixelHeight%% = FN sys (7)" {" wr#% = PixelWidth%% / OrigWidth%%' width ratio" {" hr#% = PixelHeight%% / OrigHeight%%' height ratio" {" REM * End of Inserted Code {" REM **********************************************  '***************************** '* Functions for this program '***************************** ' * From the SB Extension Library... ' ************************************************************************* ' * Stuff$() - This function can be used to place one string inside ' * another, optionally replacing a certain number of characters ' * String1$ - Source string ' * String2$ - String to insert ' * Pos%% - Position to insert at (starting at position 1) ' * Replace%% - Number of characters to replace ' * ' * Example: ? Stuff$("Superbase Windows"," 4 ",10,1) ' * Result : Superbase 4 Windows ' * ' * NOTE : If you specify Position as zero, then the string to insert ' * will be added to the end of the source string. ' ************************************************************************ Stuff$(String1$,String2$,Pos%%,Replace%%) Pos%%(Pos%%0,/(String1$)1,Pos%%) Replace%%(Replace%%0,Replace%%,0) Stuff$(Pos%%0,+(String1$,Pos%%1),"")String2$,(String1$,Pos%%Replace%%)  ' ************************************************************************* ' * ExtractChar() - Extract all characters between a character and assign ' * those strings to an array. Return NumPars%% number of ' * strings assigned to the array ' * String$ - String to evaluate ' * Char$ - Character to look for ' * Array$() - Pre-dimensioned array to receive characters ' * NOTE - This is a modified version of the Proc in the SB Extended library ' ************************************************************************* ExtractChar(String$,Char$,Array$()) Pointer%%,Loop%%,s1$ ?(String$,Char$)0p  Pointer%%0:s1$""  Loop%%1q/(String$)  ,(String$,Loop%%,1)Char$p Array$(Pointer%%)s1$ Pointer%%Pointer%%1:s1$""  ^ s1$s1$,(String$,Loop%%,1)   Loop%%  Array$(Pointer%%)s1$  NumPars%%Pointer%%   AboutBox() about$"About" _et about$ _t LicensedTo$"All Rights Reserved" /(LicensedTo$)65pLicensedTo$+(LicensedTo$,65) MidLic%%100(/(LicensedTo$)32) about$,25,40,215,92,"About Scalable Form Generator","Helv",10 |about$,5,58,7,130,10,0,"IMS Scalable Forms Generator" |about$,5,18,17,200,10,0,"Information Management Services, Inc.- A Superbase Partner" |about$,5,63,28,190,10,0," With Thanks to Keith Remmes" |about$,5,63,39,190,10,0,"Version 1.0 - July 20, 1993" |about$,5,25,50,209,10,0,"(c)Copyright 1993 Information Management Services Inc." |about$,5,75,61,215,10,0,LicensedTo$ |about$,1,86,75,40,14,1,"&Run",1,1 about$,dialbutton%% about$