.bra {

.ket }

FailAt 25

;
; $VER: StartMosaic 1.1 (23.6.94)
;
; Starter for AMosaic
;
; (C) 1994 by Bernhard Möllemann
;
; You may use it for any purpose,
; but this Copyright notice must be included and left intact
;
;
; Modified by Øyvind Falch for use in MagicSelector Mosaic
;
; This what not easy to get right ! :-| !

; make sure we have the config

assign MS: ""

If NOT EXISTS ENV:Mosaic
  MakeDir ENV:Mosaic
  SetEnv Mosaic/HomeDocument file://localhost/ms:mosaic/main.html ; mosaic seems to ignore Set
Else
  SetEnv Mosaic/HomeDocument file://localhost/ms:mosaic/main.html ; mosaic seems to ignore Set
EndIf

; adjust image cache on small Amiga

Avail TOTAL >ENV:__freespace
If NOT VAL ${__freespace} GT 1000000
  SetEnv Mosaic/ImageCacheSize 200
EndIf
Delete >NIL: ENV:__freespace

; on 68000/10 delay the image loads
 
CPU >NIL: CHECK 68020
If WARN
  SetEnv Mosaic/DelayImageLoads true
EndIf

; set initial window position

If NOT EXISTS ENV:MUI/AMOSAIC.1.wini
  If NOT EXISTS ENV:MUI
    MakeDir ENV:MUI
  EndIf
  Copy ENVARC/MUI/AMOSAIC.1.wini ENV:MUI CLONE QUIET
EndIf

; add some settings

; IconX does not copy Workbenchs path, so we have to handcraft a minimal path
; "${Mosaic/SetPath}" is a hook for you!
If NOT "${Mosaic/SetPath}" EQ "*${Mosaic/SetPath}"
  Execute "${Mosaic/SetPath}"
Else
  Path C: Rexx: S:
  If EXISTS SYS:Rexxc
    Path SYS:Rexxc
  EndIf
  If EXISTS SYS:System
    Path SYS:System
  EndIf
  If EXISTS SYS:Utilities
    Path SYS:Utilities
  EndIf
  If EXISTS SYS:Tools
    Path SYS:Tools
  EndIf
  If EXISTS SYS:WBStartup
    Path SYS:WBStartup
  EndIf
  If EXISTS SYS:Tools/Commodities
    Path SYS:Tools/Commodities
  EndIf
EndIf

Stack 8192

;
; Try to find the right Mosaic version for yor System
;

; ${Moasic/Binary} is a hook in case of the script guesses the wrong Version
; or an update arrives before Meeting-Pearls Volume 2 is released 8-)

If NOT "${Mosaic/Binary}" EQ "*${Mosaic/Binary}"
  "${Mosaic/Binary}"
  Skip MosaicDone
EndIf

; check for AmiTCP
; Note, that Mosaic 1.2 wants AmiTCP 3.0beta
; I try to ensure this with the check or the usergroup.library

Status >NIL: COMMAND=AmiTCP:bin/inetd
If NOT WARN
  Version >NIL: AmiTCP:libs/usergroup.library 4
  If NOT WARN
;    :Installed_Progs/comm/Mosaic1.2/Mosaic-AmiTCP
	Mosaic:mosaic
    Skip MosaicDone
  EndIf
EndIf

; check for AS225

Status >NIL: COMMAND=INet:bin/inetd
If NOT Warn
;  :Installed_Progs/comm/Mosaic1.2/Mosaic-AS225
	Mosaic:mosaic
  Skip MosaicDone
EndIf

; else use plain version

;:Installed_Progs/comm/Mosaic1.2/Mosaic-NoNet

Mosaic:mosaic

LAB Mosaic/Done

; clean up

rx  "if GetClip('__Mosaic_started_DT2')='TRUE' then do ; Address DELITRACKER QUIT; Call SetClip('__Mosaic_started_DT2',''); end;"

EndCLI
