- Removed unused functions and fields.
[aros:aros.git] / AROS / workbench / system / Wanderer / iconwindow_iconlist.c
1 /*
2   Copyright  2004-2013, The AROS Development Team. All rights reserved.
3   $Id$
4 */
5
6 #if (0)
7
8 #include "portable_macros.h"
9
10 #ifdef __AROS__
11 #define MUIMASTER_YES_INLINE_STDARG
12 #endif
13
14 //#define DEBUG_NETWORKBROWSER
15 //#define DEBUG_SHOWUSERFILES
16 #define TXTBUFF_LEN 1024
17
18 #ifdef __AROS__
19 #define DEBUG 0
20 #include <aros/debug.h>
21 #endif
22
23 #include <exec/types.h>
24 #include <libraries/mui.h>
25
26 #ifdef __AROS__
27 #include <zune/customclasses.h>
28 #else
29 #include <zune_AROS/customclasses.h>
30 #endif
31
32
33 #include <proto/utility.h>
34
35 #include <proto/graphics.h>
36 #include <proto/exec.h>
37 #include <proto/datatypes.h>
38 #include <proto/icon.h>
39
40 #include <dos/dos.h>
41 #include <proto/dos.h>
42
43 #include <stdio.h>
44 #include <string.h>
45
46 #include <intuition/screens.h>
47 #include <datatypes/pictureclass.h>
48 #include <clib/macros.h>
49
50 #if defined(__AMIGA__) && !defined(__PPC__)
51 #define NO_INLINE_STDARG
52 #endif
53 #ifndef _PROTO_INTUITION_H
54 #include <proto/intuition.h>
55 #endif
56 #include <proto/muimaster.h>
57
58 #include "Classes/iconlist.h"
59 #include "Classes/iconlist_attributes.h"
60 #include "Classes/icon_attributes.h"
61
62 #include "wanderer.h"
63 #include "wandererprefs.h"
64 #include "iconwindow.h"
65 #include "iconwindow_iconlist.h"
66
67
68 #ifndef __AROS__
69 #define DEBUG 1
70
71 #ifdef DEBUG
72   #define D(x) if (DEBUG) x
73   #ifdef __amigaos4__
74   #define bug DebugPrintF
75   #else
76   #define bug kprintf
77   #endif
78 #else
79   #define  D(...)
80 #endif
81 #endif
82
83 extern struct IconWindow_BackFill_Descriptor  *iconwindow_BackFill_Active;
84
85 #define BG_DRAWFLAG   0xf00dd00f
86
87 /*** Instance Data **********************************************************/
88
89 struct IconWindowIconList_DATA
90 {
91     Object                      *iwcd_IconWindow;
92     struct RastPort             *iwcd_RastPort;
93     struct MUI_EventHandlerNode iwcd_EventHandlerNode;
94 #ifdef __AROS__
95     struct Hook                 iwcd_ProcessIconListPrefs_hook;
96 #else
97     struct Hook                 *iwcd_ProcessIconListPrefs_hook;
98 #endif
99
100     IPTR                        iwcd_ViewPrefs_ID;
101     Object                      *iwcd_ViewPrefs_NotificationObject;
102 };
103
104 static char __icwc_intern_TxtBuff[TXTBUFF_LEN];
105
106 /*** Macros *****************************************************************/
107 #define SETUP_INST_DATA struct IconWindowIconList_DATA *data = INST_DATA(CLASS, self)
108
109 /*** Hook functions *********************************************************/
110 ///IconWindowIconList__HookFunc_ProcessIconListPrefsFunc()
111 #ifdef __AROS__
112 AROS_UFH3(
113     void, IconWindowIconList__HookFunc_ProcessIconListPrefsFunc,
114     AROS_UFHA(struct Hook *,    hook,   A0),
115     AROS_UFHA(APTR *,           obj,    A2),
116     AROS_UFHA(IPTR *,             param,  A1)
117 )
118 {
119 #else
120 HOOKPROTO(IconWindowIconList__HookFunc_ProcessIconListPrefsFunc, void, APTR *obj, IPTR *param)
121 {
122 #endif
123     AROS_USERFUNC_INIT
124
125     /* Get our private data */
126     Object *self = ( Object *)obj;
127     IPTR CHANGED_ATTRIB = *param;
128     Class *CLASS = OCLASS(self);
129
130     SETUP_INST_DATA;
131
132     Object *prefs = NULL;
133
134     D(bug("[IconWindowIconList] %s()\n", __PRETTY_FUNCTION__));
135
136     GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
137
138     if (prefs)
139     {
140         IPTR attrib_Current, attrib_Prefs, prefs_Processing = 0;
141         BOOL options_changed = FALSE;
142
143         D(bug("[IconWindowIconList] %s: Setting IconList options ..\n", __PRETTY_FUNCTION__));
144
145         GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
146
147         switch (CHANGED_ATTRIB)
148         {
149         case MUIA_IconList_IconListMode:
150             GET(self, MUIA_IconList_IconListMode, &attrib_Current);
151
152             if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_IconListMode)) != -1) &&
153                 (attrib_Current != attrib_Prefs))
154             {
155                 D(bug("[IconWindowIconList] %s: IconList ListMode changed - updating ..\n", __PRETTY_FUNCTION__));
156                 options_changed = TRUE;
157                 if (prefs_Processing)
158                 {
159                     NNSET(self, MUIA_IconList_IconListMode, attrib_Prefs);
160                 }
161                 else
162                 {
163                     SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
164                 }
165             }
166             break;
167
168         case MUIA_IconList_LabelText_Mode:
169             GET(self, MUIA_IconList_LabelText_Mode, &attrib_Current);
170
171             if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_Mode)) != -1) &&
172                 (attrib_Current != attrib_Prefs))
173             {
174                 D(bug("[IconWindowIconList] %s: IconList TextRenderMode changed - updating ..\n", __PRETTY_FUNCTION__));
175                 options_changed = TRUE;
176                 if (prefs_Processing)
177                 {
178                     NNSET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
179                 }
180                 else
181                 {
182                     SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
183                 }
184             }
185             break;
186
187         case MUIA_IconList_LabelText_MaxLineLen:
188             GET(self, MUIA_IconList_LabelText_MaxLineLen, &attrib_Current);
189
190             if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen)) != -1) &&
191                 (attrib_Current != attrib_Prefs))
192             {
193                 D(bug("[IconWindowIconList] %s: IconList Max Text Length changed - updating ..\n", __PRETTY_FUNCTION__));
194                 options_changed = TRUE;
195                 if (prefs_Processing)
196                 {
197                     NNSET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
198                 }
199                 else
200                 {
201                     SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
202                 }
203             }
204             break;
205
206         case MUIA_IconList_LabelText_MultiLine:
207             GET(self, MUIA_IconList_LabelText_MultiLine, &attrib_Current);
208
209             if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine)) != -1) &&
210                 (attrib_Current != attrib_Prefs))
211             {
212                 D(bug("[IconWindowIconList] %s: IconList Multi-Line changed - updating ..\n", __PRETTY_FUNCTION__));
213                 options_changed = TRUE;
214                 if (prefs_Processing)
215                 {
216                     NNSET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
217                 }
218                 else
219                 {
220                     SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
221                 }
222             }
223             break;
224
225         case MUIA_IconList_LabelText_MultiLineOnFocus:
226             GET(self, MUIA_IconList_LabelText_MultiLineOnFocus, &attrib_Current);
227
228             if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus)) != -1) &&
229                 (attrib_Current != attrib_Prefs))
230             {
231                 D(bug("[IconWindowIconList] %s: Multi-Line on Focus changed - updating ..\n", __PRETTY_FUNCTION__));
232                 options_changed = TRUE;
233                 if (prefs_Processing)
234                 {
235                     NNSET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
236                 }
237                 else
238                 {
239                     SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
240                 }
241             }
242             break;
243
244         case MUIA_IconList_Icon_HorizontalSpacing:
245             GET(self, MUIA_IconList_Icon_HorizontalSpacing, &attrib_Current);
246
247             if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing)) != -1) &&
248                 (attrib_Current != attrib_Prefs))
249             {
250                 D(bug("[IconWindowIconList] %s: Icon Horizontal Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
251                 options_changed = TRUE;
252                 if (prefs_Processing)
253                 {
254                     NNSET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
255                 }
256                 else
257                 {
258                     SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
259                 }
260             }
261             break;
262
263         case MUIA_IconList_Icon_VerticalSpacing:
264             GET(self, MUIA_IconList_Icon_VerticalSpacing, &attrib_Current);
265
266             if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing)) != -1) &&
267                 (attrib_Current != attrib_Prefs))
268             {
269                 D(bug("[IconWindowIconList] %s: Icon Vertical Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
270                 options_changed = TRUE;
271                 if (prefs_Processing)
272                 {
273                     NNSET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
274                 }
275                 else
276                 {
277                     SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
278                 }
279             }
280             break;
281
282         case MUIA_IconList_Icon_ImageSpacing:
283             GET(self, MUIA_IconList_Icon_ImageSpacing, &attrib_Current);
284
285             if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing)) != -1) &&
286                 (attrib_Current != attrib_Prefs))
287             {
288                 D(bug("[IconWindowIconList] %s: Icon Label Image Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
289                 options_changed = TRUE;
290                 if (prefs_Processing)
291                 {
292                     NNSET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
293                 }
294                 else
295                 {
296                     SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
297                 }
298             }
299             break;
300
301         case MUIA_IconList_LabelText_HorizontalPadding:
302             GET(self, MUIA_IconList_LabelText_HorizontalPadding, &attrib_Current);
303
304             if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding)) != -1) &&
305                 (attrib_Current != attrib_Prefs))
306             {
307                 D(bug("[IconWindowIconList] %s: Icon Label Horizontal Padding changed - updating ..\n", __PRETTY_FUNCTION__));
308                 options_changed = TRUE;
309                 if (prefs_Processing)
310                 {
311                     NNSET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
312                 }
313                 else
314                 {
315                     SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
316                 }
317             }
318             break;
319
320         case MUIA_IconList_LabelText_VerticalPadding:
321             GET(self, MUIA_IconList_LabelText_VerticalPadding, &attrib_Current);
322
323             if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding)) != -1) &&
324                 (attrib_Current != attrib_Prefs))
325             {
326                 D(bug("[IconWindowIconList] %s: Icon Label Vertical Padding changed - updating ..\n", __PRETTY_FUNCTION__));
327                 options_changed = TRUE;
328                 if (prefs_Processing)
329                 {
330                     NNSET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
331                 }
332                 else
333                 {
334                     SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
335                 }
336             }
337             break;
338
339         case MUIA_IconList_LabelText_BorderWidth:
340             GET(self, MUIA_IconList_LabelText_BorderWidth, &attrib_Current);
341
342             if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth)) != -1) &&
343                 (attrib_Current != attrib_Prefs))
344             {
345                 D(bug("[IconWindowIconList] %s: Icon Label Border Width changed - updating ..\n", __PRETTY_FUNCTION__));
346                 options_changed = TRUE;
347                 if (prefs_Processing)
348                 {
349                     NNSET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
350                 }
351                 else
352                 {
353                     SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
354                 }
355             }
356             break;
357
358         case MUIA_IconList_LabelText_BorderHeight:
359             GET(self, MUIA_IconList_LabelText_BorderHeight, &attrib_Current);
360
361             if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight)) != -1) &&
362                 (attrib_Current != attrib_Prefs))
363             {
364                 D(bug("[IconWindowIconList] %s: Icon Label Border Height changed - updating ..\n", __PRETTY_FUNCTION__));
365                 options_changed = TRUE;
366                 if (prefs_Processing)
367                 {
368                     NNSET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
369                 }
370                 else
371                 {
372                     SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
373                 }
374             }
375             break;
376
377         default:
378             D(bug("[IconWindowIconList] %s: Unhandled change\n", __PRETTY_FUNCTION__));
379             break;
380         }
381
382         if (options_changed)
383         {
384             if (!(prefs_Processing))
385             {
386                 D(bug("[IconWindowIconList] %s: IconList Options have changed, causing an update ..\n", __PRETTY_FUNCTION__));
387                 DoMethod(self, MUIM_IconList_Update);
388         DoMethod(self, MUIM_IconList_Sort);
389             }
390             else if (data->iwcd_IconWindow)
391             {
392                 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
393             }
394         }
395     }
396     AROS_USERFUNC_EXIT
397 }
398 #ifndef __AROS__
399 MakeStaticHook(Hook_ProcessIconListPrefsFunc,IconWindowIconList__HookFunc_ProcessIconListPrefsFunc);
400 #endif
401 ///
402
403 ///IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc()
404 #ifdef __AROS__
405 AROS_UFH3(
406     void, IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc,
407     AROS_UFHA(struct Hook *,    hook,   A0),
408     AROS_UFHA(APTR *,           obj,    A2),
409     AROS_UFHA(APTR,             param,  A1)
410 )
411 {
412 #else
413 HOOKPROTO(IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc, void, APTR *obj, APTR param)
414 {
415 #endif
416     AROS_USERFUNC_INIT
417
418     /* Get our private data */
419     Object *self = ( Object *)obj;
420     Object *prefs = NULL;
421     Class *CLASS = *( Class **)param;
422
423     SETUP_INST_DATA;
424
425     D(bug("[IconWindowIconList] %s()\n", __PRETTY_FUNCTION__));
426
427     GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
428
429     if (prefs)
430     {
431         BOOL    options_changed = FALSE;
432         IPTR  prefs_Processing = 0;
433
434         GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
435
436         if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
437         {
438             IPTR   current_ShowNetwork = 0;
439             IPTR   prefs_ShowNetwork = 0;
440
441             D(bug("[IconWindowIconList] %s: Setting ROOT view Network options ..\n", __PRETTY_FUNCTION__));
442
443             GET(self, MUIA_IconWindowExt_NetworkBrowser_Show, &current_ShowNetwork);
444
445             D(bug("[IconWindowIconList] %s: Current = %d\n", __PRETTY_FUNCTION__, current_ShowNetwork));
446
447             GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &prefs_ShowNetwork);
448
449             D(bug("[IconWindowIconList] %s: Prefs = %d\n", __PRETTY_FUNCTION__, prefs_ShowNetwork));
450
451             if ((BOOL)current_ShowNetwork != (BOOL)prefs_ShowNetwork)
452             {
453                 D(bug("[IconWindowIconList] %s: ROOT view Network prefs changed - updating ..\n", __PRETTY_FUNCTION__));
454                 options_changed = TRUE;
455                 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_ShowNetworkBrowser = prefs_ShowNetwork;
456             }
457         }
458         if ((options_changed) && !(prefs_Processing))
459         {
460             D(bug("[IconWindowIconList] %s: Network prefs changed, causing an update ..\n", __PRETTY_FUNCTION__));
461             DoMethod(self, MUIM_IconList_Update);
462         DoMethod(self, MUIM_IconList_Sort);
463         }
464         else if (data->iwcd_IconWindow)
465         {
466             SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
467         }
468     }
469     AROS_USERFUNC_EXIT
470 }
471 #ifndef __AROS__
472 MakeStaticHook(Hook_UpdateNetworkPrefsFunc,IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc);
473 #endif
474
475 #define BDRPLINELEN_MAX 1024
476 BOOL IconWindowIconList__Func_ParseBackdrop(Class *CLASS, Object *self, char *bdrp_dir)
477 {
478     BPTR                bdrp_lock = (BPTR)NULL;
479     char                *bdrp_file = NULL, *linebuf = NULL, *bdrp_fullfile = NULL, *bdrp_namepart = NULL;
480     struct DiskObject   *bdrp_currfile_dob = NULL;
481     BOOL                retVal = FALSE;
482
483     if ((bdrp_dir == NULL) || (bdrp_dir[strlen(bdrp_dir) - 1] != ':'))
484         return retVal;
485
486     if ((bdrp_file = AllocVec(strlen(bdrp_dir) + 9 + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
487     {
488         sprintf(bdrp_file, "%s.backdrop", bdrp_dir);
489         if ((bdrp_lock = Open(bdrp_file, MODE_OLDFILE)))
490         {
491             D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: Loading backdrop file: '%s'\n", bdrp_file));
492
493             if ((linebuf = AllocMem(BDRPLINELEN_MAX, MEMF_PUBLIC)) != NULL)
494             {
495                 while (FGets(bdrp_lock, linebuf, BDRPLINELEN_MAX))
496                 {
497                     int linelen = 0;
498                     if (*linebuf != ':')
499                         continue;
500
501                     linelen = strlen(linebuf) - 1; /* drop the newline char */
502                     linebuf[linelen] = '\0';
503
504                     if ((bdrp_fullfile = AllocVec(linelen + strlen(bdrp_dir), MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
505                     {
506                         sprintf(bdrp_fullfile, "%s%s", bdrp_dir, &linebuf[1]);
507                         bdrp_namepart = FilePart(bdrp_fullfile);
508                         bdrp_currfile_dob = GetIconTags
509                           (
510                             bdrp_fullfile, 
511                             ICONGETA_FailIfUnavailable, FALSE,
512                             ICONGETA_Label,             bdrp_namepart,
513                             TAG_DONE
514                           );
515
516                         D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: LEAVEOUT Icon '%s' ('%s') DOB @ 0x%p\n", bdrp_fullfile, bdrp_namepart, bdrp_currfile_dob));
517
518                         if (bdrp_currfile_dob)
519                         {
520                             struct IconEntry *this_entry = NULL;
521                             if ((this_entry = (struct IconEntry *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)bdrp_fullfile, (IPTR)bdrp_namepart, (IPTR)NULL, (IPTR)bdrp_currfile_dob, 0)))
522                             {
523                                 struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
524                                 if (fib)
525                                 {
526                                     BPTR                 fib_lock = (BPTR)NULL;
527                                     if ((fib_lock = Lock(bdrp_fullfile, SHARED_LOCK)) != NULL)
528                                     {
529                                         if (Examine(fib_lock, fib))
530                                         {
531                                             if (fib->fib_DirEntryType == ST_FILE)
532                                             {
533                                                 this_entry->ie_IconListEntry.type = ST_LINKFILE;
534                                                 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKFILE Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
535                                             }
536                                             else if (fib->fib_DirEntryType == ST_USERDIR)
537                                             {
538                                                 this_entry->ie_IconListEntry.type = ST_LINKDIR;
539                                                 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKDIR Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
540                                             }
541                                             else
542                                             {
543                                                 D(bug("[IconWindowIconList] %s: LEAVEOUT Unknown Entry Type @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
544                                             }
545                                         }
546                                         UnLock(fib_lock);
547                                     }
548                                     FreeDosObject(DOS_FIB, fib);
549                                 }
550                                 retVal = TRUE;
551                             }
552                         }
553                         FreeVec(bdrp_fullfile);
554                     }
555                 }
556                 FreeMem(linebuf, BDRPLINELEN_MAX);
557             }
558             Close(bdrp_lock);
559         }
560         FreeVec(bdrp_file);
561     }
562     return retVal;
563 }
564
565 ///
566 /*** Methods ****************************************************************/
567 ///OM_NEW()
568 Object *IconWindowIconList__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
569 {
570     IPTR                            _newIconList__FSNotifyPort = 0;
571
572     D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW()\n"));
573
574     _newIconList__FSNotifyPort = GetTagData(MUIA_Wanderer_FileSysNotifyPort, (IPTR) NULL, message->ops_AttrList);
575
576     self = (Object *) DoSuperNewTags
577       (
578         CLASS, self, NULL,
579         MUIA_CycleChain, 1,
580         TAG_MORE, (IPTR) message->ops_AttrList
581       );
582
583     if (self != NULL)
584     {
585         SETUP_INST_DATA;
586         D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW: SELF = 0x%p\n", self));
587
588 #ifdef __AROS__
589         data->iwcd_ProcessIconListPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowIconList__HookFunc_ProcessIconListPrefsFunc;
590 #else
591         data->iwcd_ProcessIconListPrefs_hook = &Hook_ProcessIconListPrefsFunc;
592 #endif
593
594         if (_newIconList__FSNotifyPort != 0)
595         {
596             struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
597             drawerlist_data->iwdcd_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port = _newIconList__FSNotifyPort;
598             D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW: FS Notify Port @ 0x%p\n", _newIconList__FSNotifyPort));
599         }
600     }
601     D(bug("[IconWindowIconList] obj = %ld\n", self));
602
603     return self;
604 }
605 ///
606
607 ///OM_SET()
608 IPTR IconWindowIconList__OM_SET(Class *CLASS, Object *self, struct opSet *message)
609 {
610     SETUP_INST_DATA;
611
612     struct TagItem *tstate = message->ops_AttrList, *tag;
613
614     while ((tag = NextTagItem(&tstate)) != NULL)
615     {
616         switch (tag->ti_Tag)
617         {
618         case MUIA_Background:
619             {
620                 D(bug("[IconWindowIconList] %s: MUIA_Background\n", __PRETTY_FUNCTION__));
621                 break;
622             }
623         case MUIA_IconWindow_Window:
624             {
625                 D(bug("[IconWindowIconList] %s: MUIA_IconWindow_Window @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
626                 data->iwcd_IconWindow = (Object *)tag->ti_Data;
627                 break;
628             }
629         case MUIA_IconList_BufferRastport:
630             {
631                 D(bug("[IconWindowIconList] %s: MUIA_IconList_BufferRastport @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
632                 data->iwcd_RastPort = (struct RastPort *)tag->ti_Data;
633                 break;
634             }
635         }
636     }
637     return DoSuperMethodA(CLASS, self, (Msg) message);
638 }
639 ///
640
641 ///OM_GET()
642 IPTR IconWindowIconList__OM_GET(Class *CLASS, Object *self, struct opGet *message)
643 {
644     //SETUP_INST_DATA;
645     //IPTR *store = message->opg_Storage;
646     IPTR  rv    = TRUE;
647
648     switch (message->opg_AttrID)
649     {
650     default:
651         rv = DoSuperMethodA(CLASS, self, (Msg) message);
652     }
653
654     return rv;
655 }
656 ///
657
658 ///IconWindowIconList__MUIM_Setup()
659 IPTR IconWindowIconList__MUIM_Setup
660 (
661     Class *CLASS, Object *self, Msg message
662 )
663 {
664     SETUP_INST_DATA;
665   
666     Object *prefs = NULL;
667
668     if (!DoSuperMethodA(CLASS, self, message)) return FALSE;
669
670     GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
671
672     if (prefs)
673     {
674         /* Set our initial options */
675         IPTR    attrib_Prefs;
676
677         GET(_win(self), MUIA_IconWindow_BackgroundAttrib, &data->iwcd_ViewPrefs_ID);
678         D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Setup: Window Background = '%s'\n", data->iwcd_ViewPrefs_ID));
679         data->iwcd_ViewPrefs_NotificationObject = (Object *)DoMethod(prefs,
680                                 MUIM_WandererPrefs_ViewSettings_GetNotifyObject,
681                                 data->iwcd_ViewPrefs_ID);
682
683 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Setup: Background Notification Obj @ 0x%p\n", data->iwcd_ViewPrefs_NotificationObject));
684
685         attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_IconListMode);
686         if ((attrib_Prefs != (IPTR)-1)  && (attrib_Prefs != XGET(self, MUIA_IconList_IconListMode))) SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
687
688         attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_Mode);
689         if ((attrib_Prefs != (IPTR)-1)  && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_Mode)))  SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
690
691         attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen);
692         if ((attrib_Prefs != (IPTR)-1)  && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MaxLineLen)))  SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
693
694         attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine);
695         if ((attrib_Prefs != (IPTR)-1)  && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLine)))  SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
696
697         attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus);
698         if ((attrib_Prefs != (IPTR)-1)  && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLineOnFocus)))  SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
699
700         attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing);
701         if ((attrib_Prefs != (IPTR)-1)  && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_HorizontalSpacing)))  SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
702
703         attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing);
704         if ((attrib_Prefs != (IPTR)-1)  && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_VerticalSpacing)))  SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
705
706         attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing);
707         if ((attrib_Prefs != (IPTR)-1)  && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_ImageSpacing)))  SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
708
709         attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding);
710         if ((attrib_Prefs != (IPTR)-1)  && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_HorizontalPadding)))  SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
711
712         attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding);
713         if ((attrib_Prefs != (IPTR)-1)  && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_VerticalPadding)))  SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
714
715         attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth);
716         if ((attrib_Prefs != (IPTR)-1)  && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderWidth)))  SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
717
718         attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight);
719         if ((attrib_Prefs != (IPTR)-1)  && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderHeight)))  SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
720
721         /* Configure notifications incase they get updated =) */
722         DoMethod
723           (
724             data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_IconListMode, MUIV_EveryTime,
725             (IPTR) self, 3, 
726             MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_IconListMode
727           );
728
729         DoMethod
730           (
731             data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_Mode, MUIV_EveryTime,
732             (IPTR) self, 3, 
733             MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_Mode
734           );
735
736         DoMethod
737           (
738             data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MaxLineLen, MUIV_EveryTime,
739             (IPTR) self, 3, 
740             MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MaxLineLen
741           );
742
743         DoMethod
744           (
745             data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLine, MUIV_EveryTime,
746             (IPTR) self, 3, 
747             MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLine
748           );
749
750         DoMethod
751           (
752             data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLineOnFocus, MUIV_EveryTime,
753             (IPTR) self, 3, 
754             MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLineOnFocus
755           );
756
757         DoMethod
758           (
759             data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_HorizontalSpacing, MUIV_EveryTime,
760             (IPTR) self, 3, 
761             MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_HorizontalSpacing
762           );
763
764         DoMethod
765           (
766             data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_VerticalSpacing, MUIV_EveryTime,
767             (IPTR) self, 3, 
768             MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_VerticalSpacing
769           );
770
771         DoMethod
772           (
773             data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_ImageSpacing, MUIV_EveryTime,
774             (IPTR) self, 3, 
775             MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_ImageSpacing
776           );
777
778         DoMethod
779           (
780             data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_HorizontalPadding, MUIV_EveryTime,
781             (IPTR) self, 3, 
782             MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_HorizontalPadding
783           );
784
785         DoMethod
786           (
787             data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_VerticalPadding, MUIV_EveryTime,
788             (IPTR) self, 3, 
789             MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_VerticalPadding
790           );
791
792         DoMethod
793           (
794             data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderWidth, MUIV_EveryTime,
795             (IPTR) self, 3, 
796             MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderWidth
797           );
798
799         DoMethod
800           (
801             data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderHeight, MUIV_EveryTime,
802             (IPTR) self, 3, 
803             MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderHeight
804           );
805     }
806   
807     if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
808     {
809         if (prefs)
810         {
811 #ifdef __AROS__
812             ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc;
813 #else
814             ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook = &Hook_UpdateNetworkPrefsFunc;
815 #endif
816
817             DoMethod
818               (
819                 prefs, MUIM_Notify, MUIA_IconWindowExt_NetworkBrowser_Show, MUIV_EveryTime,
820                 (IPTR) self, 3, 
821                 MUIM_CallHook, &((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook, (IPTR)CLASS
822               );
823         }
824
825         if (muiRenderInfo(self))
826         {
827             D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Setting up EventHandler for (IDCMP_DISKINSERTED | IDCMP_DISKREMOVED)\n"));
828
829             data->iwcd_EventHandlerNode.ehn_Priority = 1;
830             data->iwcd_EventHandlerNode.ehn_Flags    = MUI_EHF_GUIMODE;
831             data->iwcd_EventHandlerNode.ehn_Object   = self;
832             data->iwcd_EventHandlerNode.ehn_Class    = CLASS;
833             data->iwcd_EventHandlerNode.ehn_Events   = IDCMP_DISKINSERTED | IDCMP_DISKREMOVED;
834
835             DoMethod(_win(self), MUIM_Window_AddEventHandler, &data->iwcd_EventHandlerNode);
836         }
837         else
838         {
839             D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Couldnt add IDCMP EventHandler!\n"));
840         }
841     }
842     else
843     {
844         /* Setup notification on the directory -------------------------------- */
845         STRPTR directory_path = NULL;
846         GET(self, MUIA_IconDrawerList_Drawer, &directory_path);
847
848         if (directory_path != NULL)
849         {
850             struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
851
852             if (drawerlist_data->iwdcd_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port != NULL)
853             {
854                 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name                 = directory_path;
855                 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Flags                = NRF_SEND_MESSAGE;
856                 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_UserData             = self;
857
858                 if (StartNotify(&drawerlist_data->iwdcd_DrawerNotifyRequest))
859                 {
860 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Drawer-notification setup on '%s'\n", drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name));
861                 }
862                 else
863                 {
864 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: FAILED to setup Drawer-notification!\n"));
865                     drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name = NULL;
866                 }
867             }
868         }
869     }
870
871     D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Setup complete!\n"));
872   
873     return TRUE;
874 }
875 ///
876
877 ///IconWindowIconList__MUIM_Cleanup()
878 IPTR IconWindowIconList__MUIM_Cleanup
879 (
880     Class *CLASS, Object *self, Msg message
881 )
882 {
883     SETUP_INST_DATA;
884
885     Object *prefs = NULL;
886
887     D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup()\n"));
888     GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
889
890     if (prefs)
891     {
892         DoMethod
893           (
894             data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_IconListMode, (IPTR)self
895           );
896
897         DoMethod
898           (
899             data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_Mode, (IPTR)self
900           );
901
902         DoMethod
903           (
904             data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MaxLineLen, (IPTR)self
905           );
906
907         DoMethod
908           (
909             data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLine, (IPTR)self
910           );
911
912         DoMethod
913           (
914             data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLineOnFocus, (IPTR)self
915           );
916
917         DoMethod
918           (
919             data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_HorizontalSpacing, (IPTR)self
920           );
921
922         DoMethod
923           (
924             data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_VerticalSpacing, (IPTR)self
925           );
926
927         DoMethod
928           (
929             data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_ImageSpacing, (IPTR)self
930           );
931
932         DoMethod
933           (
934             data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_HorizontalPadding, (IPTR)self
935           );
936
937         DoMethod
938           (
939             data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_VerticalPadding, (IPTR)self
940           );
941
942         DoMethod
943           (
944             data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderWidth, (IPTR)self
945           );
946
947         DoMethod
948           (
949             data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderHeight, (IPTR)self
950           );
951     }
952
953     if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
954     {
955         if (prefs)
956         {
957             DoMethod
958               (
959                 prefs,
960                 MUIM_KillNotifyObj, MUIA_IconWindowExt_NetworkBrowser_Show, (IPTR) self
961               );
962         }
963         D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup: (ROOT WINDOW) Removing our Disk Event Handler\n"));
964         DoMethod(_win(self), MUIM_Window_RemEventHandler, &data->iwcd_EventHandlerNode);
965     }
966     else
967     {
968         struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
969         if (drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name != NULL)
970         {
971 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup: (DRAWER WINDOW) Removing our Drawer Notification Request\n"));
972             EndNotify(&drawerlist_data->iwdcd_DrawerNotifyRequest);
973         }
974     }
975
976     return DoSuperMethodA(CLASS, self, message);
977 }
978 ///
979
980 ///IconWindowIconList__MUIM_HandleEvent()
981 IPTR IconWindowIconList__MUIM_HandleEvent
982 (
983     Class *CLASS, Object *self, struct MUIP_HandleEvent *message
984 )
985 {
986     //SETUP_INST_DATA;
987
988     struct IntuiMessage *imsg = message->imsg;
989
990     D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent()\n"));
991
992     if(imsg->Class == IDCMP_DISKINSERTED) 
993     {
994         D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent: IDCMP_DISKINSERTED\n"));
995         DoMethod(self, MUIM_IconList_Update);
996     DoMethod(self, MUIM_IconList_Sort);
997         return(MUI_EventHandlerRC_Eat);
998     }
999     else if (imsg->Class == IDCMP_DISKREMOVED) 
1000     {
1001         D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent: IDCMP_DISKREMOVED\n"));
1002         DoMethod(self, MUIM_IconList_Update);
1003     DoMethod(self, MUIM_IconList_Sort);
1004         return(MUI_EventHandlerRC_Eat);
1005     }
1006     return 0;
1007 }
1008 ///
1009
1010 ///IconWindowIconList__MUIM_DrawBackground()
1011 IPTR IconWindowIconList__MUIM_DrawBackground
1012 (
1013   Class *CLASS, Object *self, struct MUIP_DrawBackground *message
1014 )
1015 {
1016     SETUP_INST_DATA;
1017
1018     IPTR        retVal = (IPTR)TRUE;
1019     IPTR                clip = 0;
1020     struct RastPort           *DrawBackGround_RastPort;
1021     struct IconWindowBackFillMsg  DrawBackGround_BackFillMsg;
1022
1023     D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground()\n"));
1024
1025     if ((iconwindow_BackFill_Active == NULL) ||
1026       (data->iwcd_IconWindow == NULL))
1027     {
1028         D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: No Backfill support/Window not set .. causing parent class to render\n"));
1029         goto iwc_ParentBackground;
1030     }
1031
1032     DrawBackGround_RastPort = _rp(self);
1033
1034     if ((data->iwcd_RastPort != NULL) && (DrawBackGround_RastPort != data->iwcd_RastPort))
1035     {
1036         DrawBackGround_RastPort = data->iwcd_RastPort;
1037
1038         DrawBackGround_BackFillMsg.AreaBounds.MinX = 0;
1039         DrawBackGround_BackFillMsg.AreaBounds.MinY = 0;
1040         DrawBackGround_BackFillMsg.AreaBounds.MaxX = _mwidth(self);
1041         DrawBackGround_BackFillMsg.AreaBounds.MaxY = _mheight(self);
1042
1043         DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left - _mleft(self);
1044         DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top - _mtop(self);
1045         DrawBackGround_BackFillMsg.DrawBounds.MaxX = message->width;
1046         DrawBackGround_BackFillMsg.DrawBounds.MaxY = message->height;
1047     }
1048     else
1049     {
1050         DrawBackGround_BackFillMsg.AreaBounds.MinX = _mleft(self);
1051         DrawBackGround_BackFillMsg.AreaBounds.MinY = _mtop(self);
1052         DrawBackGround_BackFillMsg.AreaBounds.MaxX = (_mleft(self) + _mwidth(self));
1053         DrawBackGround_BackFillMsg.AreaBounds.MaxY = (_mtop(self) + _mheight(self));
1054
1055         DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left;
1056         DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top;
1057         DrawBackGround_BackFillMsg.DrawBounds.MaxX = (message->left + message->width);
1058         DrawBackGround_BackFillMsg.DrawBounds.MaxY = (message->top + message->height);
1059     }
1060
1061     DrawBackGround_BackFillMsg.Layer = DrawBackGround_RastPort->Layer;
1062
1063     /* Offset into source image (ala scroll bar position) */
1064     DrawBackGround_BackFillMsg.OffsetX = message->xoffset;
1065     DrawBackGround_BackFillMsg.OffsetY = message->yoffset;
1066
1067     D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: RastPort @ 0x%p\n", DrawBackGround_RastPort));
1068   
1069     if ((retVal = DoMethod(data->iwcd_IconWindow, MUIM_IconWindow_BackFill_DrawBackground, XGET(data->iwcd_IconWindow, MUIA_IconWindow_BackFillData), &DrawBackGround_BackFillMsg, DrawBackGround_RastPort)) == (IPTR)TRUE)
1070     {
1071         D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: Backfill module rendered background ..\n"));
1072         return retVal;
1073     }
1074     D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: Backfill module failed to render background ..\n"));
1075
1076 iwc_ParentBackground:
1077
1078     clip = (IPTR)MUI_AddClipping(muiRenderInfo(self), message->left, message->top, message->width, message->height);
1079
1080     message->width = _mwidth(self);
1081     message->height = _mheight(self);
1082     message->left = _mleft(self);
1083     message->top = _mtop(self);
1084
1085     retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1086
1087     MUI_RemoveClipping(muiRenderInfo(self), (APTR)clip);
1088
1089     return retVal;
1090 }
1091 ///
1092
1093 ///IconWindowIconList__MUIM_IconList_Update()
1094 IPTR IconWindowIconList__MUIM_IconList_Update
1095 (
1096     Class *CLASS, Object *self, struct MUIP_IconList_Update *message
1097 )
1098 {
1099     SETUP_INST_DATA;
1100
1101     IPTR        retVal = (IPTR)TRUE;
1102
1103     if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
1104     {
1105     struct IconList_Entry *icon_entry    = (IPTR)MUIV_IconList_NextIcon_Start;
1106         Object *prefs = NULL;
1107         BOOL    sort_list = FALSE;
1108
1109         D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: (ROOT WINDOW) Causing parent to update\n"));
1110         retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1111
1112         D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: Checking for '.backdrop' files\n"));
1113         do
1114         {
1115             DoMethod(self, MUIM_IconList_NextIcon, MUIV_IconList_NextIcon_Visible, (IPTR)&icon_entry);
1116             if (
1117                 ((IPTR)icon_entry != MUIV_IconList_NextIcon_End) &&
1118                 ((icon_entry->type == ST_ROOT) && !(icon_entry->flags & ICONENTRY_VOL_OFFLINE))
1119               )
1120             {
1121                 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: checking entry '%s'\n", icon_entry->label));
1122                 if (IconWindowIconList__Func_ParseBackdrop(CLASS, self, icon_entry->label))
1123                     sort_list = TRUE;
1124             }
1125             else
1126             {
1127                 break;
1128             }
1129         } while (TRUE);
1130
1131         D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: Check if we should show NetworkBrowser Icon ..\n"));
1132
1133         GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
1134
1135         if (prefs)
1136         {
1137             struct IconWindowIconVolumeList_DATA *volumel_data = (struct IconWindowIconVolumeList_DATA *)data;
1138
1139             GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &volumel_data->iwvcd_ShowNetworkBrowser);
1140
1141 #if defined(DEBUG_NETWORKBROWSER)
1142             volumel_data->iwvcd_ShowNetworkBrowser = TRUE;
1143 #endif
1144
1145             if (volumel_data->iwvcd_ShowNetworkBrowser)
1146             {
1147                 struct DiskObject    *_nb_dob = NULL;
1148                 _nb_dob = GetIconTags
1149                   (
1150                     "ENV:SYS/def_NetworkHost", 
1151                     ICONGETA_FailIfUnavailable, FALSE,
1152                     ICONGETA_Label,             (IPTR)"Network Access..",
1153                     TAG_DONE
1154                   );
1155
1156                 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: NetworkBrowser Icon DOB @ 0x%p\n", _nb_dob));
1157
1158                 if (_nb_dob)
1159                 {
1160                     struct Node *this_entry = NULL;
1161                     if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)"?wanderer.networkbrowse?", (IPTR)"Network Access..", (IPTR)NULL, (IPTR)_nb_dob, 0)))
1162                     {
1163                         this_entry->ln_Pri = 3;   /// Network Access gets Priority 3 so its displayed after special dirs
1164                         sort_list = TRUE;
1165                         D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: NetworkBrowser Icon Entry @ 0x%p\n", this_entry));
1166                     }
1167                 }
1168             }
1169
1170             GET(prefs, MUIA_IconWindowExt_UserFiles_ShowFilesFolder, &volumel_data->iwvcd_ShowUserFolder);
1171
1172 #if defined(DEBUG_SHOWUSERFILES)
1173             volumel_data->iwvcd_ShowUserFolder = TRUE;
1174 #endif
1175             if (volumel_data->iwvcd_ShowUserFolder)
1176             {
1177                 if (GetVar("SYS/Wanderer/userfiles.prefs", __icwc_intern_TxtBuff, TXTBUFF_LEN, GVF_GLOBAL_ONLY) != -1)
1178                 {
1179                     char * userfiles_path = NULL;
1180
1181                     D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: SYS/UserFilesLocation = '%s'\n", __icwc_intern_TxtBuff));
1182
1183                     if ((userfiles_path = AllocVec(strlen(__icwc_intern_TxtBuff) + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
1184                     {
1185                         struct DiskObject    *_nb_dob = NULL;
1186
1187                         D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage @ 0x%p\n", userfiles_path));
1188
1189                         strcpy(userfiles_path, __icwc_intern_TxtBuff);
1190
1191                         D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage contains '%s'\n", userfiles_path));
1192
1193                         _nb_dob = GetIconTags
1194                           (
1195                             "ENV:SYS/def_UserHome", 
1196                             ICONGETA_FailIfUnavailable, FALSE,
1197                             ICONGETA_Label,             (IPTR)"User Files..",
1198                             TAG_DONE
1199                           );
1200
1201                         D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: UserFiles Icon DOB @ 0x%p\n", _nb_dob));
1202
1203                         if (_nb_dob)
1204                         {
1205                             struct Node *this_entry = NULL;
1206                             if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, userfiles_path, (IPTR)"User Files..", (IPTR)NULL, (IPTR)_nb_dob, 0)))
1207                             {
1208                                 this_entry->ln_Pri = 5;   /// Special dirs get Priority 5
1209                                 sort_list = TRUE;
1210                             }
1211                         }
1212                         FreeVec(userfiles_path);
1213                     }
1214                 }
1215             }
1216             if (sort_list) DoMethod(self, MUIM_IconList_Sort);
1217         }
1218     }
1219     else
1220     {
1221         retVal = TRUE;
1222         DoMethod(self, MUIM_IconList_Clear);
1223     }
1224
1225     return retVal;
1226 }
1227 ///
1228 /*** Setup ******************************************************************/
1229 #endif