2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
5 Read an icon from an .info file
12 /****************************************************************************************/
18 #include <exec/memory.h>
19 #include <aros/bigendianio.h>
20 #include <aros/asmcall.h>
21 #include <aros/macros.h>
22 #include <workbench/workbench.h>
24 #include <proto/alib.h>
25 #include <proto/exec.h>
26 #include <proto/dos.h>
27 #include <proto/arossupport.h>
28 #include <proto/intuition.h>
30 #include "icon_intern.h"
32 # include <aros/debug.h>
34 /****************************************************************************************/
36 AROS_UFP3S(ULONG
, ProcessClearMem
,
37 AROS_UFPA(struct Hook
*, hook
, A0
),
38 AROS_UFPA(struct Hook
*, streamhook
, A2
),
39 AROS_UFPA(struct SDData
*, data
, A1
)
42 AROS_UFP3S(ULONG
, ProcessCheckFileType
,
43 AROS_UFPA(struct Hook
*, hook
, A0
),
44 AROS_UFPA(struct Hook
*, streamhook
, A2
),
45 AROS_UFPA(struct SDData
*, data
, A1
)
48 AROS_UFP3S(ULONG
, ProcessOldDrawerData
,
49 AROS_UFPA(struct Hook
*, hook
, A0
),
50 AROS_UFPA(struct Hook
*, streamhook
, A2
),
51 AROS_UFPA(struct SDData
*, data
, A1
)
54 AROS_UFP3S(ULONG
, ProcessNewDrawerData
,
55 AROS_UFPA(struct Hook
*, hook
, A0
),
56 AROS_UFPA(struct Hook
*, streamhook
, A2
),
57 AROS_UFPA(struct SDData
*, data
, A1
)
60 AROS_UFP3S(ULONG
, ProcessGadgetRender
,
61 AROS_UFPA(struct Hook
*, hook
, A0
),
62 AROS_UFPA(struct Hook
*, streamhook
, A2
),
63 AROS_UFPA(struct SDData
*, data
, A1
)
66 AROS_UFP3S(ULONG
, ProcessSelectRender
,
67 AROS_UFPA(struct Hook
*, hook
, A0
),
68 AROS_UFPA(struct Hook
*, streamhook
, A2
),
69 AROS_UFPA(struct SDData
*, data
, A1
)
72 AROS_UFP3S(ULONG
, ProcessDefaultTool
,
73 AROS_UFPA(struct Hook
*, hook
, A0
),
74 AROS_UFPA(struct Hook
*, streamhook
, A2
),
75 AROS_UFPA(struct SDData
*, data
, A1
)
78 AROS_UFP3S(ULONG
, ProcessToolWindow
,
79 AROS_UFPA(struct Hook
*, hook
, A0
),
80 AROS_UFPA(struct Hook
*, streamhook
, A2
),
81 AROS_UFPA(struct SDData
*, data
, A1
)
84 AROS_UFP3S(ULONG
, ProcessToolTypes
,
85 AROS_UFPA(struct Hook
*, hook
, A0
),
86 AROS_UFPA(struct Hook
*, streamhook
, A2
),
87 AROS_UFPA(struct SDData
*, data
, A1
)
90 AROS_UFP3S(ULONG
, ProcessFlagPtr
,
91 AROS_UFPA(struct Hook
*, hook
, A0
),
92 AROS_UFPA(struct Hook
*, streamhook
, A2
),
93 AROS_UFPA(struct SDData
*, data
, A1
)
96 AROS_UFP3S(ULONG
, ProcessIcon35
,
97 AROS_UFPA(struct Hook
*, hook
, A0
),
98 AROS_UFPA(struct Hook
*, streamhook
, A2
),
99 AROS_UFPA(struct SDData
*, data
, A1
)
102 AROS_UFP3S(ULONG
, ProcessIconNI
,
103 AROS_UFPA(struct Hook
*, hook
, A0
),
104 AROS_UFPA(struct Hook
*, streamhook
, A2
),
105 AROS_UFPA(struct SDData
*, data
, A1
)
108 static const struct Hook ProcessClearMemHook
=
110 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessClearMem
), NULL
, NULL
112 ProcessCheckFileTypeHook
=
114 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessCheckFileType
), NULL
, NULL
116 ProcessOldDrawerDataHook
=
118 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessOldDrawerData
), NULL
, NULL
120 ProcessNewDrawerDataHook
=
122 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessNewDrawerData
), NULL
, NULL
124 ProcessGadgetRenderHook
=
126 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessGadgetRender
), NULL
, NULL
128 ProcessSelectRenderHook
=
130 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessSelectRender
), NULL
, NULL
134 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessFlagPtr
), NULL
, NULL
136 ProcessDefaultToolHook
=
138 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessDefaultTool
), NULL
, NULL
140 ProcessToolWindowHook
=
142 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessToolWindow
), NULL
, NULL
144 ProcessToolTypesHook
=
146 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessToolTypes
), NULL
, NULL
150 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessIcon35
), NULL
, NULL
154 { NULL
, NULL
}, (HOOKFUNC
)AROS_ASMSYMNAME(ProcessIconNI
), NULL
, NULL
157 /****************************************************************************************/
160 #define O(x) (offsetof (struct Gadget,x))
162 /****************************************************************************************/
164 static const IPTR GadgetDesc
[] =
166 sizeof (struct Gadget
),
167 SDM_IGNORE(4), /* NextGadget */
168 SDM_WORD(O(LeftEdge
)),
169 SDM_WORD(O(TopEdge
)),
173 SDM_UWORD(O(Activation
)),
174 SDM_UWORD(O(GadgetType
)),
175 SDM_SPECIAL(O(GadgetRender
),&ProcessFlagPtrHook
),
176 SDM_SPECIAL(O(SelectRender
),&ProcessFlagPtrHook
),
177 SDM_SPECIAL(O(GadgetText
),&ProcessFlagPtrHook
),
178 SDM_LONG(O(MutualExclude
)),
179 SDM_SPECIAL(O(SpecialInfo
),&ProcessFlagPtrHook
),
180 SDM_UWORD(O(GadgetID
)),
181 SDM_ULONG(O(UserData
)),
185 /****************************************************************************************/
188 #define O(x) (offsetof (struct DiskObject,x))
190 /****************************************************************************************/
192 static const IPTR DiskObjectDesc
[] =
194 sizeof (struct DiskObject
),
195 SDM_UWORD(O(do_Magic
)),
196 SDM_UWORD(O(do_Version
)),
197 SDM_STRUCT(O(do_Gadget
),GadgetDesc
),
198 SDM_UBYTE(O(do_Type
)),
199 SDM_IGNORE(1), /* Pad */
200 SDM_SPECIAL(O(do_DefaultTool
),&ProcessFlagPtrHook
),
201 SDM_SPECIAL(O(do_ToolTypes
),&ProcessFlagPtrHook
),
202 SDM_LONG(O(do_CurrentX
)),
203 SDM_LONG(O(do_CurrentY
)),
204 SDM_SPECIAL(O(do_DrawerData
),&ProcessFlagPtrHook
),
205 SDM_SPECIAL(O(do_ToolWindow
),&ProcessFlagPtrHook
),
206 SDM_LONG(O(do_StackSize
)),
210 /****************************************************************************************/
213 #define O(x) (offsetof (struct Image,x))
215 /****************************************************************************************/
217 static const IPTR ImageDesc
[] =
219 sizeof (struct Image
),
220 SDM_WORD(O(LeftEdge
)),
221 SDM_WORD(O(TopEdge
)),
225 SDM_SPECIAL(O(ImageData
),&ProcessFlagPtrHook
),
226 SDM_UBYTE(O(PlanePick
)),
227 SDM_UBYTE(O(PlaneOnOff
)),
228 SDM_SPECIAL(O(NextImage
),&ProcessFlagPtrHook
),
232 /****************************************************************************************/
234 const IPTR IconDesc
[] =
236 sizeof (struct NativeIcon
),
237 SDM_SPECIAL(0,&ProcessClearMemHook
),
238 SDM_STRUCT(0,DiskObjectDesc
),
239 SDM_SPECIAL(0,&ProcessCheckFileTypeHook
),
240 SDM_SPECIAL(0,&ProcessOldDrawerDataHook
),
241 SDM_SPECIAL(0,&ProcessGadgetRenderHook
),
242 SDM_SPECIAL(0,&ProcessSelectRenderHook
),
243 SDM_SPECIAL(0,&ProcessDefaultToolHook
),
244 SDM_SPECIAL(0,&ProcessToolTypesHook
),
245 SDM_SPECIAL(0,&ProcessToolWindowHook
),
246 SDM_SPECIAL(0,&ProcessNewDrawerDataHook
),
247 SDM_SPECIAL(0,&ProcessIcon35Hook
),
248 SDM_SPECIAL(0,&ProcessIconNIHook
),
252 /****************************************************************************************/
255 #define O(x) (offsetof (struct NewWindow,x))
257 /****************************************************************************************/
259 const IPTR NewWindowDesc
[] =
261 sizeof (struct NewWindow
),
262 SDM_WORD(O(LeftEdge
)),
263 SDM_WORD(O(TopEdge
)),
266 SDM_UBYTE(O(DetailPen
)),
267 SDM_UBYTE(O(BlockPen
)),
268 SDM_ULONG(O(IDCMPFlags
)),
270 SDM_IGNORE(4+4+4+4+4), /* FirstGadget
276 SDM_WORD(O(MinWidth
)),
277 SDM_WORD(O(MinHeight
)),
278 SDM_UWORD(O(MaxWidth
)),
279 SDM_UWORD(O(MaxHeight
)),
284 /****************************************************************************************/
287 #define O(x) (offsetof (struct DrawerData,x))
289 /****************************************************************************************/
291 const IPTR OldDrawerDataDesc
[] =
293 sizeof (struct DrawerData
),
294 SDM_STRUCT(O(dd_NewWindow
),NewWindowDesc
),
295 SDM_LONG(O(dd_CurrentX
)),
296 SDM_LONG(O(dd_CurrentY
)),
300 /****************************************************************************************/
302 AROS_UFH3(LONG
, dosstreamhook
,
303 AROS_UFHA(struct Hook
*, hook
, A0
),
304 AROS_UFHA(BPTR
, fh
, A2
),
305 AROS_UFHA(ULONG
*, msg
, A1
)
317 kprintf ("dsh: Read: %02X\n", rc
);
322 rc
= FPutC (fh
, ((struct BEIOM_Write
*)msg
)->Data
);
328 rc
= Seek (fh
, ((struct BEIOM_Ignore
*)msg
)->Count
, OFFSET_CURRENT
);
330 kprintf ("dsh: Skip %d\n", ((struct BEIOM_Ignore
*)msg
)->Count
);
339 } /* dosstreamhook */
341 /****************************************************************************************/
343 #define DO(x) ((struct DiskObject *)x)
345 /****************************************************************************************/
347 AROS_UFH3S(ULONG
, ProcessClearMem
,
348 AROS_UFHA(struct Hook
*, hook
, A0
),
349 AROS_UFHA(struct Hook
*, streamhook
, A2
),
350 AROS_UFHA(struct SDData
*, data
, A1
)
355 if (data
->sdd_Mode
== SDV_SPECIALMODE_READ
)
357 memset(data
->sdd_Dest
, 0, sizeof(struct NativeIcon
));
359 NATIVEICON(DO(data
->sdd_Dest
))->iconbase
= (struct IconBase
*)streamhook
->h_Data
;
368 /****************************************************************************************/
370 AROS_UFH3S(ULONG
, ProcessCheckFileType
,
371 AROS_UFHA(struct Hook
*, hook
, A0
),
372 AROS_UFHA(struct Hook
*, streamhook
, A2
),
373 AROS_UFHA(struct SDData
*, data
, A1
)
378 if (data
->sdd_Mode
== SDV_SPECIALMODE_READ
)
380 if ((DO(data
->sdd_Dest
)->do_Magic
!= WB_DISKMAGIC
))
392 /****************************************************************************************/
394 AROS_UFH3S(ULONG
, ProcessOldDrawerData
,
395 AROS_UFHA(struct Hook
*, hook
, A0
),
396 AROS_UFHA(struct Hook
*, streamhook
, A2
),
397 AROS_UFHA(struct SDData
*, data
, A1
)
402 kprintf ("ProcessOldDrawerData\n");
405 /* if (DO(data->sdd_Dest)->do_Type == WBDRAWER)
407 /* sba: all icons which have do_DrawerData set actually contain
408 * also the drawer data */
410 if (DO(data
->sdd_Dest
)->do_DrawerData
)
412 switch (data
->sdd_Mode
)
414 case SDV_SPECIALMODE_READ
:
415 if (ReadStruct (streamhook
416 , (APTR
*)&(DO(data
->sdd_Dest
)->do_DrawerData
)
421 NATIVEICON(data
->sdd_Dest
)->readstruct_state
|= RSS_OLDDRAWERDATA_READ
;
426 case SDV_SPECIALMODE_WRITE
:
427 return WriteStruct (streamhook
428 , DO(data
->sdd_Dest
)->do_DrawerData
433 case SDV_SPECIALMODE_FREE
:
434 if (NATIVEICON(data
->sdd_Dest
)->readstruct_state
& RSS_OLDDRAWERDATA_READ
)
436 FreeStruct (DO(data
->sdd_Dest
)->do_DrawerData
447 } /* ProcessOldDrawerData */
449 /****************************************************************************************/
451 static struct Image
* ReadImage (struct Hook
* streamhook
, BPTR file
)
453 struct Image
* image
;
457 if (!ReadStruct (streamhook
, (APTR
*)&image
, file
, ImageDesc
))
460 /* Size of imagedata in bytes */
461 size
= ((image
->Width
+ 15) >> 4) * image
->Height
* image
->Depth
* 2;
464 kprintf ("ReadImage: %dx%dx%d (%d bytes)\n"
474 if (!(image
->ImageData
= AllocMem (size
, MEMF_CHIP
)) )
476 FreeStruct (image
, ImageDesc
);
482 for (t
=0; t
<size
; t
++)
486 if (!ReadWord (streamhook
, &data
, file
))
489 image
->ImageData
[t
] = AROS_WORD2BE(data
);
494 FreeStruct (image
, ImageDesc
);
502 /****************************************************************************************/
504 static int WriteImage (struct Hook
* streamhook
, BPTR file
,
505 struct Image
* image
)
510 if (!WriteStruct (streamhook
, image
, file
, ImageDesc
) )
513 /* Get size in words */
514 size
= ((image
->Width
+ 15) >> 4) * image
->Height
* image
->Depth
;
517 kprintf ("WriteImage: %dx%dx%d (%d bytes)\n"
525 for (t
=0; t
<size
; t
++)
527 UWORD data
= image
->ImageData
[t
];
529 if (!WriteWord (streamhook
, AROS_WORD2BE(data
), file
))
536 /****************************************************************************************/
538 static void FreeImage (struct Image
* image
)
542 /* Get size in bytes */
543 size
= ((image
->Width
+ 15) >> 4) * image
->Height
* image
->Depth
* 2;
547 FreeMem (image
->ImageData
, size
);
550 FreeStruct (image
, ImageDesc
);
553 /****************************************************************************************/
555 AROS_UFH3S(ULONG
, ProcessGadgetRender
,
556 AROS_UFHA(struct Hook
*, hook
, A0
),
557 AROS_UFHA(struct Hook
*, streamhook
, A2
),
558 AROS_UFHA(struct SDData
*, data
, A1
)
563 struct Image
* image
;
566 kprintf ("ProcessGadgetRender\n");
569 switch (data
->sdd_Mode
)
571 case SDV_SPECIALMODE_READ
:
572 image
= ReadImage (streamhook
, data
->sdd_Stream
);
577 DO(data
->sdd_Dest
)->do_Gadget
.GadgetRender
= image
;
578 NATIVEICON(data
->sdd_Dest
)->readstruct_state
|= RSS_GADGETIMAGE_READ
;
581 case SDV_SPECIALMODE_WRITE
:
582 image
= DO(data
->sdd_Dest
)->do_Gadget
.GadgetRender
;
584 return WriteImage (streamhook
, data
->sdd_Stream
, image
);
586 case SDV_SPECIALMODE_FREE
:
587 image
= DO(data
->sdd_Dest
)->do_Gadget
.GadgetRender
;
588 if (NATIVEICON(data
->sdd_Dest
)->readstruct_state
& RSS_GADGETIMAGE_READ
)
598 } /* ProcessGadgetRender */
600 /****************************************************************************************/
602 AROS_UFH3S(ULONG
, ProcessSelectRender
,
603 AROS_UFHA(struct Hook
*, hook
, A0
),
604 AROS_UFHA(struct Hook
*, streamhook
, A2
),
605 AROS_UFHA(struct SDData
*, data
, A1
)
610 struct Image
* image
;
613 kprintf ("ProcessSelectRender\n");
616 if (DO(data
->sdd_Dest
)->do_Gadget
.Flags
& GFLG_GADGHIMAGE
)
618 switch (data
->sdd_Mode
)
620 case SDV_SPECIALMODE_READ
:
621 image
= ReadImage (streamhook
, data
->sdd_Stream
);
626 DO(data
->sdd_Dest
)->do_Gadget
.SelectRender
= image
;
627 NATIVEICON(data
->sdd_Dest
)->readstruct_state
|= RSS_SELECTIMAGE_READ
;
630 case SDV_SPECIALMODE_WRITE
:
631 image
= DO(data
->sdd_Dest
)->do_Gadget
.SelectRender
;
633 return WriteImage (streamhook
, data
->sdd_Stream
, image
);
635 case SDV_SPECIALMODE_FREE
:
636 image
= DO(data
->sdd_Dest
)->do_Gadget
.SelectRender
;
637 if (NATIVEICON(data
->sdd_Dest
)->readstruct_state
& RSS_SELECTIMAGE_READ
)
648 } /* ProcessSelectRender */
650 /****************************************************************************************/
652 AROS_UFH3S(ULONG
, ProcessFlagPtr
,
653 AROS_UFHA(struct Hook
*, hook
, A0
),
654 AROS_UFHA(struct Hook
*, streamhook
, A2
),
655 AROS_UFHA(struct SDData
*, data
, A1
)
662 switch (data
->sdd_Mode
)
664 case SDV_SPECIALMODE_READ
:
665 if (FRead (data
->sdd_Stream
, &ptr
, 1, 4) != 4)
669 kprintf ("ProcessFlagPtr: %08lx %ld\n", ptr
);
672 *((APTR
*)data
->sdd_Dest
) = (APTR
)(ptr
!= 0L);
676 case SDV_SPECIALMODE_WRITE
:
677 if (*((APTR
*)data
->sdd_Dest
))
682 if (FWrite (data
->sdd_Stream
, &ptr
, 1, 4) != 4)
687 case SDV_SPECIALMODE_FREE
:
695 } /* ProcessFlagPtr */
697 /****************************************************************************************/
699 static STRPTR
ReadIconString (struct Hook
* streamhook
, BPTR file
)
704 if (!ReadLong (streamhook
, &len
, file
))
707 str
= AllocVec (len
, MEMF_ANY
);
712 if (FRead (file
, str
, len
, 1) == EOF
)
719 kprintf ("ReadIconString: \"%s\"\n", str
);
723 } /* ReadIconString */
725 /****************************************************************************************/
727 static int WriteIconString (struct Hook
* streamhook
, BPTR file
, STRPTR str
)
731 len
= strlen (str
) + 1;
733 if (!WriteLong (streamhook
, len
, file
))
736 return FWrite (file
, str
, len
, 1) != EOF
;
737 } /* WriteIconString */
739 /****************************************************************************************/
741 AROS_UFH3S(ULONG
, ProcessDefaultTool
,
742 AROS_UFHA(struct Hook
*, hook
, A0
),
743 AROS_UFHA(struct Hook
*, streamhook
, A2
),
744 AROS_UFHA(struct SDData
*, data
, A1
)
752 kprintf ("ProcessDefaultTool\n");
755 if (DO(data
->sdd_Dest
)->do_DefaultTool
)
757 switch (data
->sdd_Mode
)
759 case SDV_SPECIALMODE_READ
:
760 str
= ReadIconString (streamhook
, data
->sdd_Stream
);
765 DO(data
->sdd_Dest
)->do_DefaultTool
= str
;
766 NATIVEICON(data
->sdd_Dest
)->readstruct_state
|= RSS_DEFAULTTOOL_READ
;
769 case SDV_SPECIALMODE_WRITE
: {
770 str
= DO(data
->sdd_Dest
)->do_DefaultTool
;
772 WriteIconString (streamhook
, data
->sdd_Stream
, str
);
776 case SDV_SPECIALMODE_FREE
:
777 str
= DO(data
->sdd_Dest
)->do_DefaultTool
;
778 if (NATIVEICON(data
->sdd_Dest
)->readstruct_state
& RSS_DEFAULTTOOL_READ
)
789 } /* ProcessDefaultTool */
791 /****************************************************************************************/
793 AROS_UFH3S(ULONG
, ProcessToolWindow
,
794 AROS_UFHA(struct Hook
*, hook
, A0
),
795 AROS_UFHA(struct Hook
*, streamhook
, A2
),
796 AROS_UFHA(struct SDData
*, data
, A1
)
804 kprintf ("ProcessToolWindow\n");
807 if (DO(data
->sdd_Dest
)->do_ToolWindow
)
809 switch (data
->sdd_Mode
)
811 case SDV_SPECIALMODE_READ
:
812 str
= ReadIconString (streamhook
, data
->sdd_Stream
);
817 DO(data
->sdd_Dest
)->do_ToolWindow
= str
;
818 NATIVEICON(data
->sdd_Dest
)->readstruct_state
|= RSS_TOOLWINDOW_READ
;
821 case SDV_SPECIALMODE_WRITE
: {
822 str
= DO(data
->sdd_Dest
)->do_ToolWindow
;
824 WriteIconString (streamhook
, data
->sdd_Stream
, str
);
828 case SDV_SPECIALMODE_FREE
:
829 str
= DO(data
->sdd_Dest
)->do_ToolWindow
;
830 if (NATIVEICON(data
->sdd_Dest
)->readstruct_state
& RSS_TOOLWINDOW_READ
)
841 } /* ProcessToolWindow */
843 /****************************************************************************************/
845 AROS_UFH3S(ULONG
, ProcessToolTypes
,
846 AROS_UFHA(struct Hook
*, hook
, A0
),
847 AROS_UFHA(struct Hook
*, streamhook
, A2
),
848 AROS_UFHA(struct SDData
*, data
, A1
)
854 kprintf ("ProcessToolTypes\n");
857 if (DO(data
->sdd_Dest
)->do_ToolTypes
)
863 switch (data
->sdd_Mode
)
865 case SDV_SPECIALMODE_READ
:
866 /* Read size of ToolTypes array (each entry is 4 bytes and the
868 if (!ReadLong (streamhook
, &count
, data
->sdd_Stream
))
871 count
= (count
>> 2) - 1; /* How many entries */
873 ttarray
= AllocVec ((count
+1)*sizeof(STRPTR
), MEMF_ANY
);
874 if (!ttarray
) return FALSE
;
877 kprintf ("Read %d tooltypes (tt=%p)\n", count
, ttarray
);
880 for (t
=0; t
<count
; t
++)
882 ttarray
[t
] = ReadIconString (streamhook
, data
->sdd_Stream
);
884 kprintf ("String %d=%p=%s\n", t
, ttarray
[t
], ttarray
[t
]);
904 DO(data
->sdd_Dest
)->do_ToolTypes
= (STRPTR
*)ttarray
;
905 NATIVEICON(data
->sdd_Dest
)->readstruct_state
|= RSS_TOOLTYPES_READ
;
908 case SDV_SPECIALMODE_WRITE
: {
911 ttarray
= (STRPTR
*)DO(data
->sdd_Dest
)->do_ToolTypes
;
913 for (count
=0; ttarray
[count
]; count
++);
916 kprintf ("Write %d tooltypes (%p)\n", count
, ttarray
);
921 if (!WriteLong (streamhook
, size
, data
->sdd_Stream
))
924 for (t
=0; t
<count
; t
++)
927 kprintf ("String %d=%p=%s\n", t
, ttarray
[t
], ttarray
[t
]);
929 if (!WriteIconString (streamhook
, data
->sdd_Stream
, ttarray
[t
]))
935 case SDV_SPECIALMODE_FREE
:
936 ttarray
= (STRPTR
*)DO(data
->sdd_Dest
)->do_ToolTypes
;
938 if (!(NATIVEICON(data
->sdd_Dest
)->readstruct_state
& RSS_TOOLTYPES_READ
))
944 kprintf ("Free tooltypes (%p)\n", count
, ttarray
);
947 for (t
=0; ttarray
[t
]; t
++)
950 kprintf ("String %d=%p=%s\n", t
, ttarray
[t
], ttarray
[t
]);
961 kprintf ("No tool types\n");
967 } /* ProcessToolTypes */
969 /****************************************************************************************/
971 AROS_UFH3S(ULONG
, ProcessNewDrawerData
,
972 AROS_UFHA(struct Hook
*, hook
, A0
),
973 AROS_UFHA(struct Hook
*, streamhook
, A2
),
974 AROS_UFHA(struct SDData
*, data
, A1
)
979 IPTR rev
= (IPTR
)DO(data
->sdd_Dest
)->do_Gadget
.UserData
& WB_DISKREVISIONMASK
;
981 kprintf ("ProcessNewDrawerData\n");
984 if (DO(data
->sdd_Dest
)->do_DrawerData
&& (rev
> 0) && (rev
<= WB_DISKREVISION
))
986 switch (data
->sdd_Mode
)
988 case SDV_SPECIALMODE_READ
:
989 if (!ReadLong(streamhook
, &DO(data
->sdd_Dest
)->do_DrawerData
->dd_Flags
, data
->sdd_Stream
))
992 if (!ReadWord(streamhook
, &DO(data
->sdd_Dest
)->do_DrawerData
->dd_ViewModes
, data
->sdd_Stream
))
997 case SDV_SPECIALMODE_WRITE
:
998 if (!WriteLong(streamhook
, DO(data
->sdd_Dest
)->do_DrawerData
->dd_Flags
, data
->sdd_Stream
))
1001 if (!WriteWord(streamhook
, DO(data
->sdd_Dest
)->do_DrawerData
->dd_ViewModes
, data
->sdd_Stream
))
1010 } /* ProcessNewDrawerData */
1012 /****************************************************************************************/
1014 #define IconBase ((IconBase_T *)(streamhook->h_Data))
1016 /****************************************************************************************/
1018 AROS_UFH3S(ULONG
, ProcessIcon35
,
1019 AROS_UFHA(struct Hook
*, hook
, A0
),
1020 AROS_UFHA(struct Hook
*, streamhook
, A2
),
1021 AROS_UFHA(struct SDData
*, data
, A1
)
1029 kprintf ("ProcessIcon35\n");
1032 switch (data
->sdd_Mode
)
1034 case SDV_SPECIALMODE_READ
:
1035 ReadIcon35(NATIVEICON(DO(data
->sdd_Dest
)), streamhook
, data
->sdd_Stream
, IconBase
);
1038 case SDV_SPECIALMODE_FREE
:
1039 FreeIcon35(NATIVEICON(DO(data
->sdd_Dest
)), (IconBase_T
*)NATIVEICON(DO(data
->sdd_Dest
))->iconbase
);
1042 case SDV_SPECIALMODE_WRITE
:
1043 retval
= WriteIcon35(NATIVEICON(DO(data
->sdd_Dest
)), streamhook
, data
->sdd_Stream
, IconBase
);
1051 } /* ProcessIcon35 */
1053 /****************************************************************************************/
1055 AROS_UFH3S(ULONG
, ProcessIconNI
,
1056 AROS_UFHA(struct Hook
*, hook
, A0
),
1057 AROS_UFHA(struct Hook
*, streamhook
, A2
),
1058 AROS_UFHA(struct SDData
*, data
, A1
)
1066 kprintf ("ProcessIconNI\n");
1069 switch (data
->sdd_Mode
)
1071 case SDV_SPECIALMODE_READ
:
1072 ReadIconNI(NATIVEICON(DO(data
->sdd_Dest
)), streamhook
, data
->sdd_Stream
, IconBase
);
1075 case SDV_SPECIALMODE_FREE
:
1076 FreeIconNI(NATIVEICON(DO(data
->sdd_Dest
)), (IconBase_T
*)NATIVEICON(DO(data
->sdd_Dest
))->iconbase
);
1079 case SDV_SPECIALMODE_WRITE
:
1080 retval
= WriteIconNI(NATIVEICON(DO(data
->sdd_Dest
)), streamhook
, data
->sdd_Stream
, IconBase
);
1088 } /* ProcessIconNI */
1090 /****************************************************************************************/