Itrap On 
INIT
NAME$="" : NAMEOUT$=""
OUT=False
OLDIMEN=0
Repeat 
   IMEN=Ichoice(1)
   If IMEN<>OLDIMEN
      If IMEN=1
         IMEN2=Ichoice(2)
         If IMEN2=5
            QUIT
            OUT=Param
         End If 
      End If 
   End If 
   If Igadget Read(1)
      NAME$=Irequest File Multi$("Selecteer invoerbestand(en).")
      If NAME$<>""
         Set Igadget Value$ 2,NAME$
      End If 
   End If 
   'If NAME$<>Igadget Read$(2) Then NAME$=Igadget Read$(2)
   If ITEST<>Rnd(1) Then ITEST=Rnd(1)
   If Igadget Read(3)
      NAMEOUT$=Irequest File$("Selecteer het uitvoerbestand.")
      If NAMEOUT$<>""
         Set Igadget Value$ 4,NAMEOUT$
      End If 
   End If 
   'If NAMEOUT$<>Igadget Read$(4) Then NAMEOUT$=Igadget Read$(4)
   If Igadget Read(5)
      CONVERT[NAME$,NAMEOUT$,DR]
   End If 
   If Igadget Read(6)
      HELP
   End If 
   If Igadget Read(7)
      QUIT
      OUT=Param
   End If 
   If Igadget Read(8)
      DR=Abs(DR-1)
      ARROW[DR]
   End If 
Until OUT
'
Imenu Off 
Iwindow Close Wb 1
Amos To Front 
Itrap Off 
End 
'
' Main procedures
'
Procedure INIT
   Global TH,TB,DR
   Amos To Back 
   Iwindow_open Wb 1,50,25,520,100,"Amiga Magazine test"
   Set Ifont "topaz",8
   Wait Vbl 
   TB=Itext Base
   TH=Fonti Height
   '
   Set Imenu "Project ",1
   Set Imenu "Open ",1,1
   Set Imenu "Bewaar ",1,2
   Set Imenu "Doe iets ",1,3
   Set Imenu "Over... ",1,4
   Set Imenu "Sluit ",1,5
   Set Imenu "Kijk ",2
   Set Imenu "eens ",2,1
   Set Imenu "hier! ",2,1,1
   Imenu On 
   Reserve Igadget 10
   '
   Itext 10,3+TB,"Invoerbestand: "
   Set Igadget Hit 1,130,1,TH+6,12
   F_IKON[132,3]
   Set Igadget String 2,148,1,320,,128,""
   '
   Itext 10,9+TB+TH,"Uitvoerbestand:"
   Set Igadget Hit 3,130,7+TH,TH+6,12
   F_IKON[132,9+TH]
   Set Igadget String 4,148,7+TH,320,,128,""
   '
   Set Igadget Hit 5,10,70,76,TH+6
   Itext 12,73+TB," Doe iets "
   '
   Set Igadget Hit 6,96,70,52,TH+6
   Itext 98,73+TB," Help "
   '
   Set Igadget Hit 7,158,70,52,TH+6
   Itext 160,73+TB," Stop "
   '
   DR=0
   Itext 250,50,"PC      AMIGA"
   Set Igadget Hit 8,246,40,114,15
   ARROW[DR]
   '
   Igadget On 
End Proc
Procedure F_IKON[X,Y]
   Idraw X,Y To X+4,Y
   Idraw X+4,Y To X+8,Y+3
   Idraw X+8,Y+3 To X+8,Y+7
   Idraw X,Y+7 To X+8,Y+7
   Idraw X,Y To X,Y+7
   Idraw X+4,Y To X+4,Y+3
   Idraw X+4,Y+3 To X+8,Y+3
End Proc
Procedure ARROW[D]
   Iink 0
   Ibar 270,43 To 306,52
   Iink 1
   Itext 250,50,"PC      AMIGA"
   If D=0
      Idraw 270,45 To 290,45
      Idraw To 290,43
      Idraw To 306,47
      Idraw To 306,48
      Idraw To 290,52
      Idraw To 290,50
      Idraw To 270,50
      Idraw To 270,45
   Else 
      Itext 250,50,"PC      AMIGA"
      Idraw 270,47 To 270,48
      Idraw To 286,52
      Idraw To 286,50
      Idraw To 306,50
      Idraw To 306,45
      Idraw To 286,45
      Idraw To 286,43
      Idraw To 270,47
   End If 
End Proc
'
Procedure CONVERT[A$,B$,D]
   If A$=""
      Bell 
      Pop Proc
   End If 
   If Not Exist(A$)
      Bell 
      Pop Proc
   End If 
   If D=0
      IN$=Chr$(13)+Chr$(10)
      OUT$=Chr$(10)
      INL=2
   Else 
      IN$=Chr$(10)
      OUT$=Chr$(13)+Chr$(10)
      INL=1
   End If 
   C$=""
   BUF=1024
   Open In 1,A$
   FL=Lof(1)
   If FL<BUF Then BUF=FL
   Open Out 2,B$
   Repeat 
      D$=""
      C$=C$+Input$(1,BUF)
      FL=FL-BUF
      ST=1
      Repeat 
         C=Instr(C$,IN$,ST)
         If C<>0
            D$=D$+Left$(C$,C-1)+OUT$
            ST=ST+INL
         End If 
         If D$="" Then D$=D$+C$
      Until C=0
      Print #2,D$
      If((D=0) and(Right$(C$,1)=Chr$(13))) Then C$=Chr$(13) Else C$=""
   Until FL<=0
   Close 2
   Close 1
   Bell 
End Proc
'
Procedure HELP
   HELPTEKST$="Amiga Magazine Test is een eenvoudig |programma om pc-teksten om |"
   HELPTEKST$=HELPTEKST$+"te zetten naar het Amiga formaat |en omgekeerd.||"
   RESULT=Irequest Message("Help...",HELPTEKST$,"Okidoki")
End Proc
'
Procedure QUIT
   Z=False
   TEKST$="Weet U zeker dat U wilt stoppen?"
   RESULT=Irequest Message("Stop...",TEKST$,"Ja|Nee")
   Z=(RESULT=1)
End Proc[Z]
