home *** CD-ROM | disk | FTP | other *** search
- REM ************************************************************************
- REM Text template maker --- subroutine (tbmake.cdl)
-
- REM Purpose: To have the user define all the fields, then write
- REM the template description to an ASCII file
- REM ************************************************************************
-
-
-
- SET devout, $tplname
- count = 0
-
- :get_fldname
- $fldname = " "
- GETSTR "Enter field name:%s",$fldname,$fldname
- ON (@KEY + 3) GOTO exit,exit,
- CALL strlen, $fldname, lngth
- IF (lngth > 8)
- GOTO message3
- IF (lngth == 0)
- GOTO message4
- CALL strcmp,$defstr,$fldname,match
- IF (match == 0)
- GOTO get_fldname
-
- :ind_fldst
- GETPOS "Indicate field start position",def1
- ON (@KEY + 3) GOTO exit,get_fldname,ind_fldst,
- def1 = @KEY
- fstx = @XVIEW
- fsty = @YVIEW
- dx = fstx - bpx
- dy = fsty - bpy
-
- :ind_fldnd
- GETPOS "Indicate field end position",def1
- ON (@KEY + 3) GOTO exit,ind_fldst,ind_fldnd,
- def1 = @KEY
- fndx = @XVIEW
- fndy = @YVIEW
- IF (fndx < fstx)
- GOTO message1
- fldlngth = fndx - fstx
-
- :text_ht
- GETFLT "Enter text hight (%f):",txtht,txtht
- ON (@KEY + 3) GOTO exit,ind_fldnd,
-
- :asp_rat
- GETFLT "Enter text aspect ratio (%f):",asprat,asprat
- ON (@KEY + 3) GOTO exit,text_ht,
-
- :font
- GETINT "Enter text font number (%d):",font,font,
- ON (@KEY + 3) GOTO exit,asp_rat,
-
- :pen
- GETINT "Enter pen number (%d):",pen,pen,
- ON (@KEY + 3) GOTO exit,font,
-
- :get_deftxt
- nchar = floor((fndx - fstx) / (txtht * asprat))
- SPRINT $str1, "Enter field default text. Max. %d char.",nchar
- $str2 = ":%s"
- CALL strcat, $str1, $str2
-
- GETSTR $str1, $defstr, $deftxt
- ON (@KEY + 3) GOTO exit,pen,
- CALL strlen, $deftxt, lngth
- IF (lngth > nchar)
- GOTO message2
-
- count = count + 1
- PRINT "%d %s %d \"%s\" %.4f %.4f %.4f %.4f %.4f %d %d\n",count,$fldname,\
- nchar,$deftxt,dx,dy,fldlngth,txtht,asprat,font,pen,
- GOTO get_fldname
-
- :message1
- PROMPT "Field limits error... try again."
- WAIT 2
- GOTO ind_fldst
-
- :message2
- PROMPT "Too many characters ... try again."
- WAIT 2
- $deftxt = " "
- GOTO get_deftxt
-
- :message3
- PROMPT "Too many characters ... try again."
- WAIT 2
- $deftxt = " "
- GOTO get_fldname
-
- :message4
- PROMPT "Field must be named ... try again."
- WAIT 2
- $deftxt = " "
- GOTO get_fldname
-
- :exit
- PRINT "10000 end 3 \"end\" 0 0 0 0 0 1 1"
- CLOSE devout
- EXIT