echo "*N     ****** Q-Blue 1.9 BETA (Evaluation) installation script ****** *N"
echo "   Using Mike Austin's clones of RequestFile and RequestChoice.*N"

if not exists "How-to-order.info"
  echo "*N !!!  THIS SCRIPT WILL WORK ONLY WHEN ITS CURRENT"
  echo " !!!  DIRECTORY IS WHERE THE Q-BLUE DISTRIBUTION EXISTS."
  echo " !!!  IT'S BEST TO JUST RUN IT USING THE WORKBENCH ICON."
  Quit 20    ; may leave a CLI window if IconX'd from wrong directory under v37
endif

resident RqFile c/RequestFile pure
resident RqChoice c/RequestChoice pure
resident c/IsADir pure
resident c/XSkip pure   ; version of Skip that doesn't gag on 500 char lines

failat 25
alias > nil: reqc RqChoice "Q-Blue 1.9 BETA Installation" []
if error
  alias reqc literal RqChoice "Q-Blue 1.9 BETA Installation" []
endif           ; that second version is for WShell

reqc "This script can install several fonts and other*Nfiles useful with Q-Blue.  You can select where*Neach will be installed, or skip any part.*NDo you want to go ahead with the installation?"
if $result eq 0
  echo "*N **** Installation cancelled"
  XSkip cleanup
endif

set filepath ""
reqc "The BBS messages that Q-Blue displays commonly use the*NIBM character set instead of the Amiga's normal ISO*Nset.  Q-Blue can handle this by using an IBM compatible*Nfont.  Several fonts, both IBM and ISO style, can be*Ninstalled now.  Normally they would go in the standard*NFONTS: directory.  Do you want to specify a different*Ndirectory before selecting which fonts to install?"
if $result eq 1
  LAB PICKFONTDIR
  RqFile "Select directory for fonts" "FONTS:" "" DIRS
  if not warn
    IsADir "$result"
    if not error
      if warn
        reqc "You have selected a filename instead of a*Ndirectory name.  Please pick a directory." "Okay"
        XSkip pickfontdir back
      else
        set filepath "$result"
      endif
    endif
  endif
else
  set filepath "FONTS:"
endif

if "$filepath" eq ""
  reqc "**** No valid directory selected*N**** fonts not installed" "Okay"
else
  echo "*N ===  Installing fonts in $filepath  ==="
  reqc "newcleanibm.font is a sans-serif 8 by 8 pixel font*Nusing the IBM character set, which is a good choice*Nfor using Q-Blue on a basic non-interlaced NTSC or*NPAL screen.  Do you want to install this font?"
  if $result eq 1
    Copy fonts/newcleanibm#? ALL "$filepath"
  endif
  reqc "tallibm.font is an IBM font in 8 by 11 and 8 by 14*Nsizes, which is recommended when using Q-Blue with*Ninterlaced or productivity screens (640 pixels wide*Nand 400 or more tall).  Do you want to install it?"
  if $result eq 1
    Copy fonts/tallibm#? ALL "$filepath"
  endif
  reqc "wideibm.font is an IBM font in 10 by 9, 10 by 12,*Nand 10 by 14 sizes, which is recommended for those*Nwho will use Q-Blue on a screen 800 pixels wide.*NIt is not useful with older Amigas that cannot*Ndisplay such screens.  Do you want to install it?"
  if $result eq 1
    Copy fonts/wideibm#? ALL "$filepath"
  endif
  reqc "stretchibm.font is a 9 by 12 pixel IBM*Nfont, suitable for NTSC or PAL screens*Nwith plenty of horizontal overscan, 720*Npixels wide.  Do you want to install it?"
  if $result eq 1
    Copy fonts/stretchibm#? ALL "$filepath"
  endif
  reqc "talliso.font is similar to the tallibm font, with 8*Nby 11 and 8 by 14 sizes, but uses the normal Amiga*NISO character set instead of IBM characters.  Like*Ntallibm, it is designed for interlaced screens, 640*Nby 400 or more pixels.  Do you want to install it?"
  if $result eq 1
    Copy fonts/talliso#? ALL "$filepath"
  endif
  reqc "wideiso.font is similar to the wideibm font, in*N10 by 12 and 10 by 14 sizes, but with the normal*NISO character set.  It is intended for screens*N800 pixels wide.  Do you want to install it?"
  if $result eq 1
    Copy fonts/wideiso#? ALL "$filepath"
  endif
  reqc "stretchiso.font is like the stretchibm font,*N9 by 12 pixels, but with the normal Amiga ISO*Ncharacter set.  It is suitable for NTSC or PAL*Nscreens with plenty of horizontal overscan,*N720 pixels wide.  Do you want to install it?"
  if $result eq 1
    Copy fonts/stretchiso#? ALL "$filepath"
  endif
  Wait 1
endif

reqc "Do you want to install the sample taglines file?  Use*Nthe file requester to select a filename that is not in*Nuse -- this script will not overwrite an existing file."
if $result eq 1
  LAB PICKATAG
  RqFile "Select Taglines directory" "S:" "Taglines"
  if not warn
    IsADir "$result"
    if not error
      if warn
	if exists "$result"
	  reqc "You have selected an existing file.  Please*Nselect a filename that is not currently in use." "Okay"
	  XSkip pickatag back
	endif
      else
	assign foobargoober: ""
	cd "$result"
	if exists "Taglines"
	  reqc "You have selected a directory where the file*N*"Taglines*" already exists.  Please select a*Nfilename that is not currently in use." "Okay"
	  cd foobargoober:
	  assign foobargoober:
	  XSkip pickatag back
	endif
	cd foobargoober:
	assign foobargoober:
      endif
      echo "Copying Taglines to *"$result*""
      copy Taglines "$result"                  ; use it whether dir or file
    else
      reqc "**** No valid filename selected*N**** Taglines not installed" "Okay"
    endif
  else
    reqc "**** No valid filename selected*N**** Taglines not installed" "Okay"
  endif
endif

reqc "That completes this script.  With a registered copy*Nof Q-Blue, this script could also install Zip and*NUnZip utilities and several documentation files.*NTo install the Q-Blue program itself, just drag*Nits icon to whatever drawer you want to keep it in." "Okay"
echo "*NInstallation completed."

LAB CLEANUP
resident RqFile remove
resident RqChoice remove
resident IsADir remove
resident XSkip remove
unset filepath
failat 21
unalias reqc
if error                ; for WShell:
  alias -kill reqc
endif
