1 #include <aros/oldprograms.h>
2 #include <intuition/intuition.h>
4 #include <exec/memory.h>
20 #define ReqSizeX 50*COL
21 #define ReqSizeY 6*ROW
24 #define CodeCancel 101
27 * declarations for a cancel button to be used by both
30 static struct IntuiText TextCancel
= {
31 1,-1,JAM1
, 2, 1, NULL
,(UBYTE
*) "Cancel", NULL
};
33 static short S_Cancel
[] = {
34 -2,-1, -2,ROW
+1, 6*COL
+2,ROW
+1, 6*COL
+2,-1, -2,-1
37 static struct Border B_Cancel
= { 0, 0, 1, 0, JAM1
, 5, S_Cancel
, NULL
};
39 static struct Gadget G_Cancel
= {
41 10*COL
, ROW
*4, 6*COL
, ROW
, /* loc and size of hit box */
42 GADGHBOX
, /* complemented when pressed */
43 RELVERIFY
, /* just get gadget up messages */
44 BOOLGADGET
| REQGADGET
,
45 (APTR
)&B_Cancel
, NULL
,
53 * String gadget to get ilbm filename
55 static char OutTitle
[] = { "output filename:" };
56 static char InTitle
[] = { "input filename:" };
58 static struct IntuiText TextOutFile
= {
59 1,1,JAM1
, TextX
, TextY
, NULL
,
60 (UBYTE
*)OutTitle
, NULL
62 static struct IntuiText TextInFile
= {
63 1,1,JAM1
, TextX
, TextY
, NULL
,
64 (UBYTE
*)InTitle
, NULL
68 static char OutNameBuff
[StringSize
] = { "out.ilbm" };
69 static char InNameBuff
[StringSize
] = { "in.ilbm" };
70 static char undo
[StringSize
];
72 static struct StringInfo S_OutFile
= {
84 static struct StringInfo S_InFile
= {
96 static short BD_InOut
[] = {
97 -2,-1, -2, ROW
, (StringSize
-1)*COL
+1,ROW
,
98 (StringSize
-1)*COL
+1,-1, -2, -1
101 static struct Border B_InOut
= { 0, 0, 1, 0, JAM1
, 5, BD_InOut
, NULL
};
103 static struct Gadget G_OutFile
= {
105 StringX
, StringY
, /* loc */
106 sizeof(OutNameBuff
)*COL
, ROW
, /* size */
108 RELVERIFY
/* | STRINGCENTER */,
109 STRGADGET
| REQGADGET
,
110 (APTR
)&B_InOut
, /* border */
111 NULL
, /* high lighted */
120 static struct Gadget G_InFile
= {
122 StringX
, StringY
, /* loc */
123 sizeof(InNameBuff
)*COL
, ROW
, /* size */
125 RELVERIFY
/* | STRINGCENTER */,
126 STRGADGET
| REQGADGET
,
127 (APTR
)&B_InOut
, /* border */
128 NULL
, /* high lighted */
136 static struct Requester R_InFile
= {
138 COL
*10, ROW
*4, ReqSizeX
, ReqSizeY
,
155 static struct Requester R_OutFile
= {
157 COL
*10, ROW
*4, ReqSizeX
, ReqSizeY
,
173 struct IntuiMessage mycopy
,
176 Wait( 1<< CntrlWin
->UserPort
->mp_SigBit
);
179 * handle messages for the control window
182 while( (orig
=(struct IntuiMessage
*) GetMsg( CntrlWin
->UserPort
)) ) {
185 ReplyMsg( (struct Message
*)orig
);
187 if( mycopy
.Class
== GADGETUP
) {
190 code
= ((struct Gadget
*)mycopy
.IAddress
)->GadgetID
;
191 if( code
== CodeGo
) return( true );
192 if( code
== CodeCancel
) return(false);
203 Request( &R_InFile
, CntrlWin
);
204 answer
= WaitForUser();
205 EndRequest( &R_InFile
, CntrlWin
);
206 return( answer
?InNameBuff
: NULL
);
213 Request( &R_OutFile
, CntrlWin
);
214 answer
= WaitForUser();
215 EndRequest( &R_OutFile
, CntrlWin
);
216 return( answer
?OutNameBuff
: NULL
);