/* Open a requester in AmiPCB to select a pad type from a list
   Version 1.00 (© A. Greve, 01-Jan-2002)
   Version 1.01 (© A. Greve, 16-Jan-2002)
     Adaption to AmiPCB 1.05 (measuring exactness 1/1000 mm)
   Version 1.02: 14-Apr-2002
   Version 1.03: 31-May-2002 (bug correction of pad type)
   $VER: SelPadType.AmiPCB 1.03 (© A. Greve, 31-May-2002)
     If You select the topmost entry ("Enter manually" in English)
     from this list, some requesters appear where You can enter or
     select:
       1) the width for the pad,
       2) the height for the pad,
       3) the pad type (elliptical,rectangular, etc.),
       4) the drill diameter, and
       5) the board side (soldering, component, both, or seri-
	  graphy)
     If any of the requesters is cancelled by the Cancel button
     (or a value <= 0 at requesters 1 or 2) the complete action
     is cancelled.						   */

OPTIONS RESULTS     /* Turn on the returning of values */

SIGNAL ON error     /* For error handling */
SIGNAL ON syntax

lf = '0a'x

fr = 'ARexx/InitVars.AmiPCB'()

SELECT
    WHEN fr=1 THEN DO
	msg = "Type de pastille ?"
	msga = "Ellipse"
	msgb = "Rectangle"
	msgc = "Hexagone 1"
	msgd = "Hexagone 2"
	msge = "Octogone"
	msgx = "Entrez manuelle"
	msgy = "Entrez un nombre"
	msgy1 = "Largeur de pastille ?"
	msgy2 = "Hauteur de pastille ?"
	msgy3 = "Diamètre perçage ?"
	msgz = "Quelle côté ?"
	msgz1 = "Côté cuivre"
	msgz2 = "Côté composants"
	msgz3 = "Des deux côtés"
	msgz4 = "Sérigraphie"
    END
    WHEN fr=2 THEN DO
	msg = "Welcher Pad-Typ ?"
	msga = "Ellipse"
	msgb = "Rechteck"
	msgc = "Sechseck 1"
	msgd = "Sechseck 2"
	msge = "Achteck"
	msgx = "Manuelle Eingabe"
	msgy = "Zahl eingeben"
	msgy1 = "Breite des Pads ?"
	msgy2 = "Höhe des Pads ?"
	msgy3 = "Bohrdurchmesser ?"
	msgz = "Welche Seite ?"
	msgz1 = "Lötseite"
	msgz2 = "Bauteilseite"
	msgz3 = "Beidseitig"
	msgz4 = "Bestückungsdruck"
    END
    OTHERWISE DO
	msg = "Which pad type ?"
	msga = "Ellipse"
	msgb = "Rectangle"
	msgc = "Hexagone 1"
	msgd = "Hexagone 2"
	msge = "Octogone"
	msgx = "Enter manually"
	msgy = "Enter a number"
	msgy1 = "Pad width ?"
	msgy2 = "Pad height ?"
	msgy3 = "Drill diameter ?"
	msgz = "Which side ?"
	msgz1 = "Soldering side"
	msgz2 = "Component side"
	msgz3 = "Both sides"
	msgz4 = "Serigraphy"
    END
END
msgy1 = msgy||' > 0'||lf||' (2540 = 2,54mm)'||lf||msgy1
msgy2 = msgy||' > 0'||lf||' (2540 = 2,54mm)'||lf||msgy2
msgy3 = msgy||' >= 0'||lf||' (2540 = 2,54mm)'||lf||msgy3

msg0  = msgx
msg1  = "1,0 x 1,0 mm - 0,5 mm ø - "msga;  w.2  = 1000; h.2  = 1000; d.2  =  500; t.2  = 1
msg2  = "1,6 x 1,6 mm - 0,6 mm ø - "msga;  w.3  = 1600; h.3  = 1600; d.3  =  600; t.3  = 1
msg3  = "2,0 x 2,0 mm - 0,6 mm ø - "msga;  w.4  = 2000; h.4  = 2000; d.4  =  600; t.4  = 1
msg4  = "2,5 x 2,5 mm - 0,8 mm ø - "msga;  w.5  = 2500; h.5  = 2500; d.5  =  800; t.5  = 1
msg5  = "4,0 x 4,0 mm - 1,0 mm ø - "msge;  w.6  = 4000; h.6  = 4000; d.6  = 1000; t.6  = 5
msg6  = "1,2 x 0,4 mm - 0,0 mm ø - "msgb;  w.7  = 1200; h.7  =  400; d.7  =    0; t.7  = 2
msg7  = "0,4 x 1,2 mm - 0,0 mm ø - "msgb;  w.8  =  400; h.8  = 1200; d.8  =    0; t.8  = 2
msg8  = "2,5 x 2,5 mm - 0,6 mm ø - "msgb;  w.9  = 2500; h.9  = 2500; d.9  =  600; t.9  = 2
msg9  = "2,4 x 1,4 mm - 0,6 mm ø - "msge;  w.10 = 2400; h.10 = 1400; d.10 =  600; t.10 = 5
msg10 = "1,4 x 2,4 mm - 0,6 mm ø - "msge;  w.11 = 1400; h.11 = 2400; d.11 =  600; t.11 = 5
msg11 = "2,4 x 1,4 mm - 0,6 mm ø - "msgc;  w.12 = 2400; h.12 = 1400; d.12 =  600; t.12 = 3
msg12 = "1,4 x 2,4 mm - 0,6 mm ø - "msgd;  w.13 = 1400; h.13 = 2400; d.13 =  600; t.13 = 4

'REQLIST("'msg'","'msg0'","'msg1'","'msg2'","'msg3'","'msg4'","'msg5'","'msg6'","'msg7'","'msg8'","'msg9'","'msg10'","'msg11'","'msg12'")'
c = RESULT
IF c < 1 THEN EXIT    /* Cancelled */

dsided = ''
IF c = 1 THEN DO
    'REQNUM("'msgy1'",0,"VALIDE")'                                      /* width */
    IF valide = 1 THEN DO
	manualin = RESULT
	IF manualin > 0 THEN w.c = manualin
	ELSE EXIT
    END
    ELSE EXIT
    'REQNUM("'msgy2'",0,"VALIDE")'                                      /* height */
    IF valide = 1 THEN DO
	manualin = RESULT
	IF manualin > 0 THEN h.c = manualin
	ELSE EXIT
    END
    ELSE EXIT
    'SELECT("'msg'","'msga'","'msgb'","'msgc'","'msgd'","'msge'")'      /* pad type */
    manualin = RESULT
    IF manualin > 0 THEN t.c = manualin
    ELSE EXIT
    'REQNUM("'msgy3'",0,"VALIDE")'                                      /* drill diameter */
    IF valide = 1 THEN DO
	manualin = RESULT
	d.c = manualin
    END
    ELSE EXIT
    'SELECT("'msgz'","'msgz1'","'msgz2'","'msgz3'","'msgz4'")'          /* board side */
    manualin = RESULT
    IF manualin = 0 THEN EXIT
    IF manualin = 3 THEN dsided = '-'
END

IF c = 1 THEN 'SETSIDE(0,'manualin')'
'SETPAD(0,'dsided''t.c','w.c','h.c','d.c'):MENU("Place pad")' /* The space in the menu call is a no-break 'a0'x !!! */
EXIT

/* Error handling  */
syntax:
erreur=RC
CALL 'ARexx/_Syntax.rexx'(fr,'SelPadType.AmiPCB',SIGL,erreur)
EXIT

error:
CALL 'ARexx/_Error.rexx'(fr,'SelPadType.AmiPCB',SIGL)
EXIT
