disable the unrecognized nls flag
[AROS-Contrib.git] / fish / shuffle / shuffle_files.c
blobb889e7be4663e02e3d1a8f8020c6d2e2f4baf0f9
1 #define chip
2 #include "shuffle.h"
4 #define SHUFFLE_HEADER "*Shuffle*"
6 /* sc:src/shuffle/sh_icon.c --- Data for Shell icon
8 */
10 UWORD chip ShellI1Data[] =
12 /* Plane 0 */
13 0x0000,0x0000,0x0000,0x0400,0x0800,0x0000,0x0041,0x0400,
14 0x0800,0x0000,0x0041,0x0400,0x7FFF,0xFFFF,0xFFFF,0xFC00,
15 0x2000,0x0000,0x0000,0x0400,0x2000,0x0000,0x0000,0x0400,
16 0x2330,0x0000,0x0000,0x0400,0x270C,0x0000,0x0000,0x0400,
17 0x2303,0x0000,0x0000,0x0400,0x230C,0x0000,0x0000,0x0400,
18 0x2330,0x0000,0x0000,0x0400,0x2000,0x0000,0x0000,0x0400,
19 0x2000,0x0000,0x0000,0x0400,0x2000,0x0000,0x0000,0x0400,
20 0x2000,0x0000,0x0000,0x0400,0x2000,0x0000,0x0000,0x0400,
21 0x2000,0x0000,0x0000,0x0400,0x2000,0x0000,0x0000,0x0400,
22 0x2000,0x0000,0x0000,0x0400,0x2000,0x0000,0x0000,0x0400,
23 0x2000,0x0000,0x0000,0x0400,0x7FFF,0xFFFF,0xFFFF,0xFC00,
24 /* Plane 1 */
25 0xFFFF,0xFFFF,0xFFFF,0xF800,0x8400,0x0000,0x0020,0x8000,
26 0x8400,0x0000,0x0020,0x8000,0x8000,0x0000,0x0000,0x0000,
27 0x8000,0x0000,0x0000,0x8000,0x8000,0x0000,0x0000,0x8000,
28 0x8000,0x0000,0x0000,0x8000,0x8000,0x0000,0x0000,0x8000,
29 0x8000,0x0000,0x0000,0x8000,0x8000,0x0000,0x0000,0x8000,
30 0x8000,0x0000,0x0000,0x8000,0x8000,0x0000,0x0000,0x8000,
31 0x8000,0x0000,0x0000,0x8000,0x8000,0x0000,0x0000,0x8000,
32 0x8000,0x0000,0x0000,0x8000,0x8000,0x0000,0x0000,0x8000,
33 0x8000,0x0000,0x0000,0x8000,0x8000,0x0000,0x0000,0x8000,
34 0x8000,0x0000,0x0000,0x8000,0x8000,0x0000,0x0000,0x8000,
35 0x8000,0x0000,0x0000,0x8000,0x8000,0x0000,0x0000,0x0000,
38 struct Image ShellI1 =
40 0, 0, /* Upper left corner */
41 54, 22, 2, /* Width, Height, Depth */
42 ShellI1Data, /* Image data */
43 0x0003, 0x0000, /* PlanePick, PlaneOnOff */
44 NULL /* Next image */
47 UWORD chip ShellI2Data[] =
49 /* Plane 0 */
50 0x0000,0x0000,0x0000,0x0400,0x7BEF,0x7DEF,0xBDCF,0x7C00,
51 0x7BEF,0x7DEF,0xBDCF,0x7C00,0x7BEF,0x7DEF,0xBDEF,0xFC00,
52 0x6000,0x0000,0x0000,0x7C00,0x0000,0x0000,0x0000,0x0400,
53 0x6320,0x0000,0x0000,0x7C00,0x630C,0x0000,0x0000,0x7C00,
54 0x6303,0x0000,0x0000,0x7C00,0x630C,0x0000,0x0000,0x7C00,
55 0x6320,0x0000,0x0000,0x7C00,0x4000,0x0000,0x0000,0x0400,
56 0x6000,0x0000,0x0000,0x7C00,0x6000,0x0000,0x0000,0x7C00,
57 0x6000,0x0000,0x0000,0x7C00,0x6000,0x0000,0x0000,0x7C00,
58 0x6000,0x0000,0x0000,0x7C00,0x4000,0x0000,0x0000,0x0C00,
59 0x6000,0x0000,0x0000,0x7C00,0x6000,0x0000,0x0000,0x7C00,
60 0x6000,0x0000,0x0000,0x7C00,0x7BEF,0x7DEF,0xBDEF,0xFC00,
61 /* Plane 1 */
62 0xFFFF,0xFFFF,0xFFFF,0xF800,0xF7FF,0xFFFF,0xFFBE,0xF800,
63 0xF7FF,0xFFFF,0xFFBE,0xF800,0x8410,0x8210,0x4210,0x0000,
64 0xC410,0x8210,0x4210,0xF800,0xFFFF,0xFFFF,0xFFFF,0xF800,
65 0xC410,0xBE10,0x4210,0xF800,0xC410,0xBE10,0x4210,0xF800,
66 0xC410,0xBE10,0x4210,0xF800,0xC410,0xBE10,0x4210,0xF800,
67 0xC410,0xBE10,0x4210,0xF800,0xFFFF,0xFFFF,0xFFFF,0xF800,
68 0xC410,0x8210,0x4210,0xF800,0xC410,0x8210,0x4210,0xF800,
69 0xC410,0x8210,0x4210,0xF800,0xC410,0x8210,0x4210,0xF800,
70 0xC410,0x8210,0x4210,0xF800,0xFFFF,0xFFFF,0xFFFF,0xF800,
71 0xC410,0x8210,0x4210,0xF800,0xC410,0x8210,0x4210,0xF800,
72 0xC410,0x8210,0x4210,0xF800,0x8410,0x8210,0x4210,0x0000,
75 struct Image ShellI2 =
77 0, 0, /* Upper left corner */
78 54, 22, 2, /* Width, Height, Depth */
79 ShellI2Data, /* Image data */
80 0x0003, 0x0000, /* PlanePick, PlaneOnOff */
81 NULL /* Next image */
84 struct DiskObject Shell =
86 WB_DISKMAGIC, /* Magic Number */
87 WB_DISKVERSION, /* Version */
88 { /* Embedded Gadget Structure */
89 NULL, /* Next Gadget Pointer */
90 0, 0, 54, 23, /* Left,Top,Width,Height */
91 GADGIMAGE | GADGHIMAGE, /* Flags */
92 RELVERIFY, /* Activation Flags */
93 BOOLGADGET, /* Gadget Type */
94 (APTR)&ShellI1, /* Render Image */
95 (APTR)&ShellI2, /* Select Image */
96 NULL, /* Gadget Text */
97 0L, /* Mutual Exclude */
98 NULL, /* Special Info */
99 100, /* Gadget ID */
100 (APTR) 0x0001, /* User Data (Revision) */
102 WBPROJECT, /* Icon Type */
103 (char *)"Shuffle", /* Default Tool */
104 NULL, /* Tool Type Array */
105 NO_ICON_POSITION, /* Current X */
106 NO_ICON_POSITION, /* Current Y */
107 NULL, /* Drawer Structure */
108 NULL, /* Tool Window */
113 struct TagItem FRTags[] =
115 { ASL_Hail,(IPTR)NULL, },
116 { ASL_FuncFlags,0L, },
117 { ASL_LeftEdge,0L, },
118 { ASL_TopEdge,0L, },
119 { ASL_Dir,0L, },
120 { ASL_Pattern,(IPTR)"~(#?.info)", },
121 { ASL_File,0L, },
122 { TAG_DONE,0L },
125 struct EasyStruct ExistsReq =
127 0L,0L,(UBYTE *)"Shuffle... Error",
128 (UBYTE *)"The File\n%s\nalready exists !",
129 (UBYTE *)" Overwrite | CANCEL",
134 void save_config(ULONG mode)
136 struct FileRequester *FileReq;
137 UBYTE fname[256];
138 int save = FALSE;
139 FILE *f;
140 switch(mode)
142 case SAVE_NAME : strcpy(fname,info.f_dir);
143 AddPart(fname,info.f_file,256);
144 save = TRUE;
145 break;
146 case SAVE_AS : FRTags[0].ti_Data = (IPTR)"Save Shuffle Configuration";
147 FRTags[1].ti_Data = FILF_SAVE;
148 FRTags[4].ti_Data = (IPTR)info.f_dir;
149 FRTags[6].ti_Data = (IPTR)info.f_file;
150 if((FileReq = (struct FileRequester *)AllocAslRequest(ASL_FileRequest,FRTags)))
152 if(RequestFile(FileReq))
154 strcpy(info.f_dir,FileReq->rf_Dir);
155 strcpy(info.f_file,FileReq->rf_File);
156 strcpy(fname,FileReq->rf_Dir);
157 AddPart(fname,FileReq->rf_File,256);
158 save = TRUE;
160 FreeAslRequest((APTR)FileReq);
162 break;
163 case SAVE_DEF_ENVARC :
164 strcpy(fname,"ENVARC:");
165 AddPart(fname,"shuffle.config",256);
166 save = TRUE;
167 break;
168 case SAVE_DEF_ENV :
169 strcpy(fname,"ENV:");
170 AddPart(fname,"shuffle.config",256);
171 save = TRUE;
172 break;
175 if(save)
177 if((f = fopen(fname,"w")))
179 fprintf(f,"%s\n",SHUFFLE_HEADER);
180 fprintf(f,"%ld\n",(long)info.res);
181 fprintf(f,"%ld\n",(long)info.numbers);
182 fprintf(f,"%ld\n",(long)info.mode);
183 fprintf(f,"%ld\n",(long)info.m_shuffles);
184 fclose(f);
185 if(info.writeicon)
187 PutDiskObject(fname,&Shell);
193 void load_config(UBYTE *name)
195 struct FileRequester *FileReq;
196 UBYTE fname[256];
197 int load = FALSE;
198 FILE *f;
199 if(name != NULL)
201 strcpy(fname,name);
202 load = TRUE;
204 else
206 FRTags[0].ti_Data = (IPTR)"Load Shuffle Configuration";
207 FRTags[1].ti_Data = 0L;
208 if((FileReq = (struct FileRequester *)AllocAslRequest(ASL_FileRequest,FRTags)))
210 if(RequestFile(FileReq))
212 strcpy(fname,FileReq->rf_Dir);
213 AddPart(fname,FileReq->rf_File,256);
214 load = TRUE;
216 FreeAslRequest((APTR)FileReq);
219 if(load)
221 if((f = fopen(fname,"r")))
223 fgets(fname,256,f);
224 if(!strncmp(fname,SHUFFLE_HEADER,strlen(SHUFFLE_HEADER)))
226 fgets(fname,256,f);info.res = atol(fname);
227 GT_SetGadgetAttrs(Project0Gadgets[GDX_tiles],Project0Wnd,NULL,
228 GTCY_Active,info.res,TAG_DONE);
229 fgets(fname,256,f);info.numbers = atol(fname);
230 GT_SetGadgetAttrs(Project0Gadgets[GDX_numbers],Project0Wnd,NULL,
231 GTCB_Checked,info.numbers,TAG_DONE);
232 fgets(fname,256,f);info.mode = atol(fname);
233 GT_SetGadgetAttrs(Project0Gadgets[GDX_mode],Project0Wnd,NULL,
234 GTCY_Active,info.mode,TAG_DONE);
235 fgets(fname,256,f);info.m_shuffles = atol(fname);
236 info.shuffle = atol(shuffle0Labels[info.m_shuffles]);
237 GT_SetGadgetAttrs(Project0Gadgets[GDX_shuffle],Project0Wnd,NULL,
238 GTCY_Active,info.m_shuffles,TAG_DONE);
240 fclose(f);