home *** CD-ROM | disk | FTP | other *** search
- REM ************************************************************************
- REM Text template maker --- subroutine (tbmod.cdl)
-
- REM Purpose: To allow the user to modify the fields, then write
- REM the template description to an ASCII file
- REM ************************************************************************
-
-
- :ind_screen
- DOSUB tbdisp
- IF (retrn == 0)
- GOTO redrw
- GOTO set_devin
-
- :redrw
- REDRAW
- GOTO exit
-
- :set_devin
- SET devin, $tplname
- SET devout, tpf
-
- :read_fld
- INPUT "%d %s %d",sqnum,$tmp,nchar
-
- CLEAR $fldtxt
- ARRAY $fldtxt[nchar+1]
-
- REM *** dummy read two characters
- INPUT "%c %c",$fldtxt[0],$fldtxt[1]
-
- i = 0
- :txtloop
- INPUT "%c",$fldtxt[i]
- IF ($fldtxt[i] == 34)
- GOTO read_more
- i = i + 1
- goto txtloop
-
- :read_more
- $fldtxt[i] = 0
- INPUT "%f %f %f %f %f %d %d\n",dx,dy,fldlngth,txtht,asprat,font,pen
-
- :screen
- IF (sqnum == pnum)
- GOTO mod_fld
- IF (sqnum != 10000)
- GOTO write_fld
- GOTO last_line
-
- :mod_fld
- foundit = 1
- GETMENU "Select option.",\
- "NAME",\
- "LIMITS",\
- "TXT HGT",\
- "ASP RAT",\
- "FONT",\
- "PEN",\
- "DONE"
- ON (@KEY + 3) GOTO exit,ind_screen,mod_fld,mod_fld,new_name,limits,\
- txt_ht,asp_rat,font,pen,get_deftxt,
-
- :new_name
- $tmp = " "
- GETSTR "Enter new field name:%s",$tmp,$tmp
- ON (@KEY + 3) GOTO exit,mod_fld,new_name,
- CALL strlen, $tmp, lngth
- IF (lngth > 8)
- GOTO message3
- IF (lngth == 0)
- GOTO message4
- CALL strcmp,$defstr,$tmp,match
- IF (match == 0)
- GOTO new_name
- GOTO mod_fld
-
- :limits
- GETPOS "Indicate new start position",def1
- ON (@KEY + 3) GOTO exit,mod_fld,limits,
- def1 = @KEY
- fstx = @XVIEW
- fsty = @YVIEW
- dx = fstx - bpx
- dy = fsty - bpy
-
- :ind_fldnd
- GETPOS "Indicate new end position",def1
- ON (@KEY + 3) GOTO exit,limits,ind_fldnd,
- def1 = @KEY
- fndx = @XVIEW
- fndy = @YVIEW
- IF (fndx < fstx)
- GOTO message1
- fldlngth = fndx - fstx
- GOTO mod_fld
-
- :txt_ht
- GETFLT "Enter new text hight (%f):",txtht,txtht
- ON (@KEY + 3) GOTO exit,mod_fld,
- GOTO mod_fld
-
- :asp_rat
- GETFLT "Enter new aspect ratio (%f):",asprat,asprat
- ON (@KEY + 3) GOTO exit,mod_fld,
- GOTO mod_fld
-
- :font
- GETINT "Enter text font number (%d):",font,font,
- ON (@KEY + 3) GOTO exit,mod_fld,
- GOTO mod_fld
-
- :pen
- GETINT "Enter new pen number (%d):",pen,pen,
- ON (@KEY + 3) GOTO exit,mod_fld,
- GOTO mod_fld
-
- :get_deftxt
- nchar = floor(fldlngth / (txtht * asprat))
- SPRINT $str1, "Enter new def. text. Max. %d ch.",nchar
- $str2 = "(%s):"
- CALL strcat, $str1, $str2
- GETSTR $str1, $fldtxt, $fldtxt
- ON (@KEY + 3) GOTO exit,mod_fld,
- CALL strlen, $fldtxt, lngth
- IF (lngth > nchar)
- GOTO message2
- GOTO write_fld
-
- :write_fld
- PRINT "%d %s %d \"%s\" %.4f %.4f %.4f %.4f %.4f %d %d\n",sqnum,$tmp,\
- nchar,$fldtxt,dx,dy,fldlngth,txtht,asprat,font,pen
- GOTO read_fld
-
- :message1
- PROMPT "Field limits error, try again..."
- WAIT 2
- GOTO limits
-
- :message2
- PROMPT "Too many characters for this field, try again..."
- WAIT 2
- $fldtxt = " "
- GOTO get_deftxt
-
- :message3
- PROMPT "Too many characters ... try again."
- WAIT 2
- GOTO new_name
-
- :message4
- PROMPT "Field must be named ... try again."
- WAIT 2
- GOTO new_name
-
- :last_line
- PRINT "10000 end 3 \"end\" 0 0 0 0 0 1 1"
- CLOSE devout
- CLOSE devin
- SPRINT $cmd,"copy tpf %s",$tplname
- EXEC 1, $cmd
- EXEC 1, "del tpf"
- GOTO ind_screen
-
- :exit
- EXIT
-