Screen Open 0,320,256,16,Lowres : Rem especially for RAMOS 
Rem ******************************************** 
Rem ***** ConvFormat is at Version 1.0a ******** 
Rem ******************************************** 
Rem ** see about **
Rem ***************
INMEM=False
REQON=True
QUIT=False
Print "Use Menus"
Global QUIT,INMEM,REQON
MENUDEF
Do 
   If QUIT Then Exit 
Loop 
Edit 
Procedure ABOUT
   Rem ******************************************** 
   Rem ** This program is `Diskware' send me a   ** 
   Rem ** with some PD on it, I'll return it ASAP** 
   Rem ** and I'll return it with some of my PD  ** 
   Rem ** NO PIRATES !!! You may modify this prog** 
   Rem ** on condition that these REM statements ** 
   Rem ** are left intact. If anyone improves    **   
   Rem ** this version, update the version number** 
   Rem ** accordingly. V1.1-> V1.1 a-> V1.1 b etc.* 
   Rem ** and please send me a listing, and add  ** 
   Rem ** your name below. (Any disks returned)  ** 
   Rem ** ConvFormat V1.0a does not display      ** 
   Rem ** interlace pics properly.               ** 
   Rem ** Please detail any improvements in the  ** 
   Rem ** Rem statements ************************** 
   Rem ******************************************** 
   Rem ** Mark Burbidge          I released      ** 
   Rem ** 107 Heron Road,          V1.0          ** 
   Rem ** Larkfield,                             ** 
   Rem ** Kent,                                  ** 
   Rem ** ENGLAND.                               ** 
   Rem ** Features of V1.0.  Menu Control        ** 
   Rem **                    IFF format          ** 
   Rem **                    PCK format  (AMOS)  ** 
   Rem **                    Auto File suffix    ** 
   Rem **                    Friendly Requesters ** 
   Rem ** Requester routine crashes, if the box  ** 
   Rem ** must be longer than the screen to      ** 
   Rem ** accomodate the text. Beware!!          ** 
   Rem ******************************************** 
   Rem ******************************************** 
   Rem ********* Authors who updated this ********* 
   Rem *************** program are **************** 
   Rem ******************************************** 
End Proc
Procedure MENUDEF
   Menu$(1)="Files"
   Menu$(1,1)="Load Files"
   Menu$(1,2)="Save Files"
   Menu$(1,1,1)="Load .PCK"
   Menu$(1,1,2)="Load .IFF"
   Menu$(1,2,1)="Save as .PCK"
   Menu$(1,2,2)="Save as .IFF"
   If INMEM
      Menu Active(1,2)
      Menu Active(1,2,1)
      Menu Active(1,2,2)
   Else 
      Menu Inactive(1,2)
      Menu Inactive(1,2,1)
      Menu Inactive(1,2,2)
   End If 
   Menu$(1,3)="Clear screen"
   Menu$(1,4)="Quit"
   On Menu Proc ACTION
   On Menu On 
   Menu On 
End Proc
Procedure LODEPCK
   F$=Fsel$("*.PCK","","Choose a picture","to unpack")
   If Not F$=""
      Print "Loading..."
      Load F$,5
      Cls 
      Print "Loaded."
      Unpack 5 To 0
      INMEM=True
      Erase 5
      MENUDEF
   End If 
End Proc
Procedure LODEIFF
   F$=Fsel$("*.IFF","","Choose a picture","to load")
   If Not F$=""
      Load Iff F$,0
      INMEM=True
      MENUDEF
   End If 
End Proc
Procedure SAVPCK
   REQ["Will you wait whilst I compress data?","Yes","No"]
   If Param$="Yes"
      Change Mouse 3
      Spack 0 To 5
      Change Mouse 1
      F$=Fsel$("*.PCK","","Pick a filename","Any filename")
      If Not(F$="")
         If Not(Right$(F$,4)=".PCK")
            F$=F$+".PCK"
         End If 
         Save F$,5
      End If 
      Erase 5
   End If 
End Proc
Procedure SAVIFF
   REQ["IFF Compression technique?","Yes","No"]
   If Param$="Yes" Then COMP=True Else COMP=False
   F$=Fsel$("*.IFF","","Pick a filename","Any Filename")
   If Not F$=""
      If Not(Right$(F$,4)=".IFF")
         F$=F$+".IFF"
      End If 
      If COMP
         Save Iff F$
      Else 
         Save Iff F$,0
      End If 
   End If 
End Proc
Procedure ACTION
   If Choice
      If Choice(1)=1
         If Choice(2)=1
            If Choice(3)=1
               LODEPCK
            End If 
            If Choice(3)=2
               LODEIFF
            End If 
         End If 
         If Choice(2)=2
            If Choice(3)=1
               SAVPCK
            End If 
            If Choice(3)=2
               SAVIFF
            End If 
         End If 
         If Choice(2)=3
            REQ["Positive?","Go for it!!","Leave it"]
            If Left$(Param$,1)="G"
               Cls 
               INMEM=False
               MENUDEF
            End If 
         End If 
         If Choice(2)=4
            REQ["Are you sure?","Yes","No"]
            If Param$="Yes"
               QUIT=True
            End If 
         End If 
      End If 
      On Menu On 
   End If 
End Proc
Procedure REQ[MS$,V1$,V2$]
   Rem *************************************
   Rem **      REQUEST BOX CONTROLLER     **  
   Rem *************************************
   Rem **   PLEASE MAKE V1$ YOUR DEFAULT  **
   Rem **   This will be returned if the  **
   Rem **      boxes are turned off,      **
   Rem **   MS$ is the box message, the   **          
   Rem **         two are gadgets         **
   Rem *************************************
   If REQON
      REQBOX[MS$,V1$,V2$]
      V$=Param$
   Else 
      V$=V1$
   End If 
End Proc[V$]
Procedure REQBOX[MES$,G1$,G2$]
   Rem *********************************
   Rem ***    Do that Request Box    ***
   Rem *********************************
   C1=Colour(1)
   Colour 1,$A40
   C2=Colour(2)
   Colour 2,$FFF
   A$=Left$(G1$,1) : Rem **** Work out first letters **** 
   B$=Left$(G2$,1) : Rem **** in gadgets ***
   If Asc(A$)>96 Then A$=Chr$(Asc(A$)-32) : Rem ***Convert case ***
   If Asc(B$)>96 Then B$=Chr$(Asc(B$)-32) : Rem *** myself *** 
   I=Len(MES$)+6 : Rem *** Work out title length ***
   If I<(Len(G1$+G2$)+9) Then I=(Len(G1$+G2$)+9) : Rem ** see if it's **
   Rem ******* Longer than the gadget lengths ******
   J=I*8 : Rem Hash together a block save 
   K=J/16
   If Not(J=K*16)
      J=J+8
   End If 
   J=J+16 : Rem to be sure of size 
   Rem *********************************************************
   Rem ** I used the blocks as they are quicker than windsave **
   Rem ** I know on page 101 it says to create a Dummy window **
   Rem ** But how? and if you could open the dummy window,    **
   Rem ** without affecting the screen why didn't it do that  **
   Rem **                     anyway?                         **
   Rem *********************************************************
   Get Block 1,0,0,J,80
   Wind Open 1,0,0,I,8,1 : Rem ***Save background open box ***
   Curs Off 
   Flash Off 
   Reserve Zone 2 : Rem ****reserve two Zones***** 
   Window 1
   Title Top MES$ : Rem ****Put in the box title***
   Locate 2,3
   Print Border$(Zone$(G1$,1),1) : Rem **** Add the gadgets *** 
   T=I-Len(G2$)-4 : Rem *** Find posn of right gadget ***
   Locate T,3
   Print Border$(Zone$(G2$,2),1)
   Repeat : Rem ***Wait for a response or a keypress ****
      I=Mouse Key : Rem *** Keypress only works if first letters *** 
      OK=((I=1) or(I=3)) : Rem *** are different ***
      A=Mouse Zone
      INZ=((1=A) or(2=A))
      If Not(A$=B$)
         X$=Inkey$
         If Asc(X$)>96
            X$=Chr$(Asc(X$)-32)
         End If 
         LETT=((X$=A$) or(X$=B$))
         If LETT
            If X$=A$
               A=1
            Else 
               A=2
            End If 
         End If 
      End If 
   Until LETT or(OK and INZ)
   Wind Close 
   Rem *************************
   Rem ** Put Background Back **
   Rem *************************
   Put Block 1
   Del Block 1
   Reset Zone 1
   Reset Zone 2
   If A=1
      A$=G1$
   Else 
      A$=G2$
   End If 
   Colour 1,C1
   Colour 2,C2
   Rem ***** Return the selected variable ***** 
End Proc[A$]
