| !AWViewer.!InstMods
|
| Run this obey file to install the ArtWorks rendering modules to the relevant
| places. This is only necessary under RISC OS 4 or earlier systems and RISC OS 6,
| but not under RISC OS 5. Please read !AWViewer.!ReadMeMW for further details.
|
RMEnsure UtilityModule 3.50 Error "This copy of AWViewer is suitable for RISC OS 3.5 or higher only"

Set InstMods$Dir <Obey$Dir>
| If the modules are already in memory, then load the latest versions
| Do not load ImageExtend and FontDraw as they are dummy modules only
Set AWRender$Loaded "True"
RMEnsure ArtWorksRenderer 0.00 Set AWRender$Loaded "False"
Set GDraw$Loaded "True"
RMEnsure GDraw 0.00 Set GDraw$Loaded "False"
if "<AWRender$Loaded>" = "True" Then Set GDraw$Loaded "True"
if "<AWRender$Loaded>" = "True" Then RMLoad <InstMods$Dir>.RMStore.AWRender
if "<AWRender$Loaded>" = "True" Then RMLoad <InstMods$Dir>.RMStore.SpriteExt
if "<GDraw$Loaded>" = "True" Then RMLoad <InstMods$Dir>.RMStore.GDraw
if "<GDraw$Loaded>" = "True" Then RMLoad <InstMods$Dir>.RMStore.DitherExt
Unset AWRender$Loaded
Unset GDraw$Loaded

Set OS6$Present "True"
RMEnsure UtilityModule 6.00 Set OS6$Present "False"

Set OS5$Present "True"
RMEnsure UtilityModule 5.00 Set OS5$Present "False"
If "<OS5$Present>" = "True" AND "<OS6$Present>" = "False" Then Error "This script is not suitable for RISC OS 5 - simply copy !AWViewer to !Boot.Resources instead"
Unset OS5$Present
Unset OS6$Present

If "<CCShared$Dir>" = "" Then IfThere System:!CCShared.!Boot Then Obey System:!CCShared.!Boot

if "<ImpressionPublisher$Resources>" <> "" Then copy <InstMods$Dir>.RMStore.* <ImpressionPublisher$Resources>.RMStore.* A~C~DF~L~N~P~Q~R~S~T~V
if "<ImpressionPublisherOPI$Resources>" <> "" Then copy <InstMods$Dir>.RMStore.* <ImpressionPublisherOPI$Resources>.RMStore.* A~C~DF~L~N~P~Q~R~S~T~V
if "<ImpressionPublisher+$Resources>" <> "" Then copy <InstMods$Dir>.RMStore.* <ImpressionPublisher+$Resources>.RMStore.* A~C~DF~L~N~P~Q~R~S~T~V
if "<ImpressionPublisherPlus$Resources>" <> "" Then copy <InstMods$Dir>.RMStore.* <ImpressionPublisherPlus$Resources>.RMStore.* A~C~DF~L~N~P~Q~R~S~T~V
if "<ImpressionStyle$Resources>" <> "" Then copy <InstMods$Dir>.RMStore.* <ImpressionStyle$Resources>.RMStore.* A~C~DF~L~N~P~Q~R~S~T~V
if "<CCShared$Dir>" <> "" Then copy <InstMods$Dir>.RMStore.* <CCShared$Dir>.RMStore.* A~C~DF~L~N~P~Q~R~S~T~V
if "<ArtWorks$Dir>" <> "" Then copy <InstMods$Dir>.RMStore.GDraw <ArtWorks$Dir>.RMStore.GDraw A~C~DF~L~N~P~Q~R~S~T~V
if "<ArtWorks$Dir>" <> "" Then copy <InstMods$Dir>.RMStore.DitherExt <ArtWorks$Dir>.RMStore.DitherExt A~C~DF~L~N~P~Q~R~S~T~V
if "<ArtWorks$Dir>" <> "" Then copy <InstMods$Dir>.RMStore.SpriteExt <ArtWorks$Dir>.RMStore.SpriteExt A~C~DF~L~N~P~Q~R~S~T~V
if "<OHP$Dir>" <> "" Then IfThere <OHP$Dir>.Resources.AWRender Then copy <InstMods$Dir>.RMStore.* <OHP$Dir>.Resources.* A~C~DF~L~N~P~Q~R~S~T~V
if "<Thump$Dir>" <> "" Then IfThere <Thump$Dir>.Modules.ArtWorks.AWRender Then copy <InstMods$Dir>.RMStore.* <Thump$Dir>.Modules.ArtWorks.* A~C~DF~L~N~P~Q~R~S~T~V
if "<ThumbNail$Dir>" <> "" Then IfThere <ThumbNail$Dir>.ArtSprite.AWRender Then copy <InstMods$Dir>.RMStore.* <ThumbNail$Dir>.ArtSprite.* A~C~DF~L~N~P~Q~R~S~T~V

Set AWVUpdated$Apps ""
Set Alias$AWVAddComma If "|<AWVUpdated$Apps>" <> "" Then SetEval AWVUpdated$Apps "|<AWVUpdated$Apps>" + ", "
Set Alias$AWVAddApp SetEval AWVUpdated$Apps "|<AWVUpdated$Apps>" + "%%0"

if "<ImpressionPublisher$Resources>" <> "" Then Set AWVUpdated$Apps "Publisher"

if ("<ImpressionPublisher+$Resources>" <> "" OR "<ImpressionPublisherOPI$Resources>" <> "" OR "<ImpressionPublisherPlus$Resources>" <> "") Then AWVAddComma
if "<ImpressionPublisher+$Resources>" <> "" OR "<ImpressionPublisherOPI$Resources>" <> "" OR "<ImpressionPublisherPlus$Resources>" <> "" Then SetEval AWVUpdated$Apps "<AWVUpdated$Apps>" + "Publisher+"

if "<ImpressionStyle$Resources>" <> "" Then AWVAddComma
if "<ImpressionStyle$Resources>" <> "" Then AWVAddApp Style
if "<CCShared$Dir>" <> "" Then AWVAddComma
if "<CCShared$Dir>" <> "" Then AWVAddApp CCShared
if "<ArtWorks$Dir>" <> "" Then AWVAddComma
if "<ArtWorks$Dir>" <> "" Then AWVAddApp ArtWorks
if "<OHP$Dir>" <> "" then IfThere <OHP$Dir>.Resources.AWRender Then AWVAddComma
if "<OHP$Dir>" <> "" then IfThere <OHP$Dir>.Resources.AWRender Then AWVAddApp OHP
| Unfortunately, OHP_SHOW does not define a variable in its !Boot file, so we are unlikely to find it
if "<Thump$Dir>" <> "" Then IfThere <Thump$Dir>.Modules.ArtWorks.AWRender Then AWVAddComma
if "<Thump$Dir>" <> "" Then IfThere <Thump$Dir>.Modules.ArtWorks.AWRender Then AWVAddApp Thump
if "<ThumbNail$Dir>" <> "" Then IfThere <ThumbNail$Dir>.ArtSprite.AWRender Then AWVAddComma
if "<ThumbNail$Dir>" <> "" Then IfThere <ThumbNail$Dir>.ArtSprite.AWRender Then AWVAddApp Thumbnail

| If !AWViewer is in Boot:Resources, we need to update it. However, the user could have started
| this script from a copy of !AWViewer in Boot:Resources in which case we cannot and need not copy
| this application there! Therefore, a small BASIC program checks whether this is the case.
Set AWViewer$BootResNeedsUpdate "False"
IfThere Boot:Resources.!AWViewer.!Boot AND "<BootResources$Dir>" <> "" Then Run <Instmods$Dir>.Utils.CheckBoot
If "<AWViewer$BootResNeedsUpdate>" = "True" Then copy <InstMods$Dir>.^.!AWViewer <BootResources$Dir>.!AWViewer A~C~DF~L~N~P~QR~S~T~V
If "<AWViewer$BootResNeedsUpdate>" = "True" AND "<AWVUpdated$Apps>" <> "" Then AWVAddComma
If "<AWViewer$BootResNeedsUpdate>" = "True" Then SetEval AWVUpdated$Apps "<AWVUpdated$Apps>" + "AWViewer (in Boot:Resources)"
Unset AWViewer$BootResNeedsUpdate

if "<AWVUpdated$Apps>" = "" Then Set AWVUpdated$Apps "No applications"
SetEval AWVUpdated$Apps "<AWVUpdated$Apps>" + " updated"
Unset InstMods$Dir
Unset Alias$AWVAddComma
Unset Alias$AWVAddApp
if "<InstallMW$Dir>" = "" AND "<InstCryst$Dir>" = "" THEN Error "<AWVUpdated$Apps>"
echo <AWVUpdated$Apps>