Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / system / Wanderer / iconwindow_iconlist.c
blobac10900c723b23bcf03fcd512a00705195596bcd
1 /*
2 Copyright 2004-2009, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #if (0)
8 #include "portable_macros.h"
10 #ifdef __AROS__
11 #define MUIMASTER_YES_INLINE_STDARG
12 #endif
14 //#define DEBUG_NETWORKBROWSER
15 //#define DEBUG_SHOWUSERFILES
16 #define TXTBUFF_LEN 1024
18 #ifdef __AROS__
19 #define DEBUG 0
20 #include <aros/debug.h>
21 #endif
23 #include <exec/types.h>
24 #include <libraries/mui.h>
26 #ifdef __AROS__
27 #include <zune/customclasses.h>
28 #else
29 #include <zune_AROS/customclasses.h>
30 #endif
33 #include <proto/utility.h>
35 #include <proto/graphics.h>
36 #include <proto/exec.h>
37 #include <proto/datatypes.h>
38 #include <proto/icon.h>
40 #include <dos/dos.h>
41 #include <proto/dos.h>
43 #include <stdio.h>
44 #include <string.h>
46 #include <intuition/screens.h>
47 #include <datatypes/pictureclass.h>
48 #include <clib/macros.h>
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>
58 #include "Classes/iconlist.h"
59 #include "Classes/iconlist_attributes.h"
60 #include "Classes/icon_attributes.h"
62 #include "wanderer.h"
63 #include "wandererprefs.h"
64 #include "iconwindow.h"
65 #include "iconwindow_iconlist.h"
68 #ifndef __AROS__
69 #define DEBUG 1
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
83 extern struct IconWindow_BackFill_Descriptor *iconwindow_BackFill_Active;
85 #define BG_DRAWFLAG 0xf00dd00f
87 /*** Instance Data **********************************************************/
89 struct IconWindowIconList_DATA
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
100 IPTR iwcd_ViewPrefs_ID;
101 Object *iwcd_ViewPrefs_NotificationObject;
104 static char __icwc_intern_TxtBuff[TXTBUFF_LEN];
106 /*** Macros *****************************************************************/
107 #define SETUP_INST_DATA struct IconWindowIconList_DATA *data = INST_DATA(CLASS, self)
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)
119 #else
120 HOOKPROTO(IconWindowIconList__HookFunc_ProcessIconListPrefsFunc, void, APTR *obj, IPTR *param)
122 #endif
123 AROS_USERFUNC_INIT
125 /* Get our private data */
126 Object *self = ( Object *)obj;
127 IPTR CHANGED_ATTRIB = *param;
128 Class *CLASS = OCLASS(self);
130 SETUP_INST_DATA;
132 Object *prefs = NULL;
134 D(bug("[IconWindowIconList] %s()\n", __PRETTY_FUNCTION__));
136 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
138 if (prefs)
140 IPTR attrib_Current, attrib_Prefs, prefs_Processing = 0;
141 BOOL options_changed = FALSE;
143 D(bug("[IconWindowIconList] %s: Setting IconList options ..\n", __PRETTY_FUNCTION__));
145 GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
147 switch (CHANGED_ATTRIB)
149 case MUIA_IconList_IconListMode:
150 GET(self, MUIA_IconList_IconListMode, &attrib_Current);
152 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_IconListMode)) != -1) &&
153 (attrib_Current != attrib_Prefs))
155 D(bug("[IconWindowIconList] %s: IconList ListMode changed - updating ..\n", __PRETTY_FUNCTION__));
156 options_changed = TRUE;
157 if (prefs_Processing)
159 NNSET(self, MUIA_IconList_IconListMode, attrib_Prefs);
161 else
163 SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
166 break;
168 case MUIA_IconList_LabelText_Mode:
169 GET(self, MUIA_IconList_LabelText_Mode, &attrib_Current);
171 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_Mode)) != -1) &&
172 (attrib_Current != attrib_Prefs))
174 D(bug("[IconWindowIconList] %s: IconList TextRenderMode changed - updating ..\n", __PRETTY_FUNCTION__));
175 options_changed = TRUE;
176 if (prefs_Processing)
178 NNSET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
180 else
182 SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
185 break;
187 case MUIA_IconList_LabelText_MaxLineLen:
188 GET(self, MUIA_IconList_LabelText_MaxLineLen, &attrib_Current);
190 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen)) != -1) &&
191 (attrib_Current != attrib_Prefs))
193 D(bug("[IconWindowIconList] %s: IconList Max Text Length changed - updating ..\n", __PRETTY_FUNCTION__));
194 options_changed = TRUE;
195 if (prefs_Processing)
197 NNSET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
199 else
201 SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
204 break;
206 case MUIA_IconList_LabelText_MultiLine:
207 GET(self, MUIA_IconList_LabelText_MultiLine, &attrib_Current);
209 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine)) != -1) &&
210 (attrib_Current != attrib_Prefs))
212 D(bug("[IconWindowIconList] %s: IconList Multi-Line changed - updating ..\n", __PRETTY_FUNCTION__));
213 options_changed = TRUE;
214 if (prefs_Processing)
216 NNSET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
218 else
220 SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
223 break;
225 case MUIA_IconList_LabelText_MultiLineOnFocus:
226 GET(self, MUIA_IconList_LabelText_MultiLineOnFocus, &attrib_Current);
228 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus)) != -1) &&
229 (attrib_Current != attrib_Prefs))
231 D(bug("[IconWindowIconList] %s: Multi-Line on Focus changed - updating ..\n", __PRETTY_FUNCTION__));
232 options_changed = TRUE;
233 if (prefs_Processing)
235 NNSET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
237 else
239 SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
242 break;
244 case MUIA_IconList_Icon_HorizontalSpacing:
245 GET(self, MUIA_IconList_Icon_HorizontalSpacing, &attrib_Current);
247 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing)) != -1) &&
248 (attrib_Current != attrib_Prefs))
250 D(bug("[IconWindowIconList] %s: Icon Horizontal Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
251 options_changed = TRUE;
252 if (prefs_Processing)
254 NNSET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
256 else
258 SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
261 break;
263 case MUIA_IconList_Icon_VerticalSpacing:
264 GET(self, MUIA_IconList_Icon_VerticalSpacing, &attrib_Current);
266 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing)) != -1) &&
267 (attrib_Current != attrib_Prefs))
269 D(bug("[IconWindowIconList] %s: Icon Vertical Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
270 options_changed = TRUE;
271 if (prefs_Processing)
273 NNSET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
275 else
277 SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
280 break;
282 case MUIA_IconList_Icon_ImageSpacing:
283 GET(self, MUIA_IconList_Icon_ImageSpacing, &attrib_Current);
285 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing)) != -1) &&
286 (attrib_Current != attrib_Prefs))
288 D(bug("[IconWindowIconList] %s: Icon Label Image Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
289 options_changed = TRUE;
290 if (prefs_Processing)
292 NNSET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
294 else
296 SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
299 break;
301 case MUIA_IconList_LabelText_HorizontalPadding:
302 GET(self, MUIA_IconList_LabelText_HorizontalPadding, &attrib_Current);
304 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding)) != -1) &&
305 (attrib_Current != attrib_Prefs))
307 D(bug("[IconWindowIconList] %s: Icon Label Horizontal Padding changed - updating ..\n", __PRETTY_FUNCTION__));
308 options_changed = TRUE;
309 if (prefs_Processing)
311 NNSET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
313 else
315 SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
318 break;
320 case MUIA_IconList_LabelText_VerticalPadding:
321 GET(self, MUIA_IconList_LabelText_VerticalPadding, &attrib_Current);
323 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding)) != -1) &&
324 (attrib_Current != attrib_Prefs))
326 D(bug("[IconWindowIconList] %s: Icon Label Vertical Padding changed - updating ..\n", __PRETTY_FUNCTION__));
327 options_changed = TRUE;
328 if (prefs_Processing)
330 NNSET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
332 else
334 SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
337 break;
339 case MUIA_IconList_LabelText_BorderWidth:
340 GET(self, MUIA_IconList_LabelText_BorderWidth, &attrib_Current);
342 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth)) != -1) &&
343 (attrib_Current != attrib_Prefs))
345 D(bug("[IconWindowIconList] %s: Icon Label Border Width changed - updating ..\n", __PRETTY_FUNCTION__));
346 options_changed = TRUE;
347 if (prefs_Processing)
349 NNSET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
351 else
353 SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
356 break;
358 case MUIA_IconList_LabelText_BorderHeight:
359 GET(self, MUIA_IconList_LabelText_BorderHeight, &attrib_Current);
361 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight)) != -1) &&
362 (attrib_Current != attrib_Prefs))
364 D(bug("[IconWindowIconList] %s: Icon Label Border Height changed - updating ..\n", __PRETTY_FUNCTION__));
365 options_changed = TRUE;
366 if (prefs_Processing)
368 NNSET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
370 else
372 SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
375 break;
377 default:
378 D(bug("[IconWindowIconList] %s: Unhandled change\n", __PRETTY_FUNCTION__));
379 break;
382 if (options_changed)
384 if (!(prefs_Processing))
386 D(bug("[IconWindowIconList] %s: IconList Options have changed, causing an update ..\n", __PRETTY_FUNCTION__));
387 DoMethod(self, MUIM_IconList_Update);
389 else if (data->iwcd_IconWindow)
391 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
395 AROS_USERFUNC_EXIT
397 #ifndef __AROS__
398 MakeStaticHook(Hook_ProcessIconListPrefsFunc,IconWindowIconList__HookFunc_ProcessIconListPrefsFunc);
399 #endif
402 ///IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc()
403 #ifdef __AROS__
404 AROS_UFH3(
405 void, IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc,
406 AROS_UFHA(struct Hook *, hook, A0),
407 AROS_UFHA(APTR *, obj, A2),
408 AROS_UFHA(APTR, param, A1)
411 #else
412 HOOKPROTO(IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc, void, APTR *obj, APTR param)
414 #endif
415 AROS_USERFUNC_INIT
417 /* Get our private data */
418 Object *self = ( Object *)obj;
419 Object *prefs = NULL;
420 Class *CLASS = *( Class **)param;
422 SETUP_INST_DATA;
424 D(bug("[IconWindowIconList] %s()\n", __PRETTY_FUNCTION__));
426 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
428 if (prefs)
430 BOOL options_changed = FALSE;
431 IPTR prefs_Processing = 0;
433 GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
435 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
437 IPTR current_ShowNetwork = 0;
438 IPTR prefs_ShowNetwork = 0;
440 D(bug("[IconWindowIconList] %s: Setting ROOT view Network options ..\n", __PRETTY_FUNCTION__));
442 GET(self, MUIA_IconWindowExt_NetworkBrowser_Show, &current_ShowNetwork);
444 D(bug("[IconWindowIconList] %s: Current = %d\n", __PRETTY_FUNCTION__, current_ShowNetwork));
446 GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &prefs_ShowNetwork);
448 D(bug("[IconWindowIconList] %s: Prefs = %d\n", __PRETTY_FUNCTION__, prefs_ShowNetwork));
450 if ((BOOL)current_ShowNetwork != (BOOL)prefs_ShowNetwork)
452 D(bug("[IconWindowIconList] %s: ROOT view Network prefs changed - updating ..\n", __PRETTY_FUNCTION__));
453 options_changed = TRUE;
454 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_ShowNetworkBrowser = prefs_ShowNetwork;
457 if ((options_changed) && !(prefs_Processing))
459 D(bug("[IconWindowIconList] %s: Network prefs changed, causing an update ..\n", __PRETTY_FUNCTION__));
460 DoMethod(self, MUIM_IconList_Update);
462 else if (data->iwcd_IconWindow)
464 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
467 AROS_USERFUNC_EXIT
469 #ifndef __AROS__
470 MakeStaticHook(Hook_UpdateNetworkPrefsFunc,IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc);
471 #endif
473 #define BDRPLINELEN_MAX 1024
474 BOOL IconWindowIconList__Func_ParseBackdrop(Class *CLASS, Object *self, char *bdrp_dir)
476 BPTR bdrp_lock = (BPTR)NULL;
477 char *bdrp_file = NULL, *linebuf = NULL, *bdrp_fullfile = NULL, *bdrp_namepart = NULL;
478 struct DiskObject *bdrp_currfile_dob = NULL;
479 BOOL retVal = FALSE;
481 if ((bdrp_dir == NULL) || (bdrp_dir[strlen(bdrp_dir) - 1] != ':'))
482 return retVal;
484 if ((bdrp_file = AllocVec(strlen(bdrp_dir) + 9 + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
486 sprintf(bdrp_file, "%s.backdrop", bdrp_dir);
487 if ((bdrp_lock = Open(bdrp_file, MODE_OLDFILE)))
489 D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: Loading backdrop file: '%s'\n", bdrp_file));
491 if ((linebuf = AllocMem(BDRPLINELEN_MAX, MEMF_PUBLIC)) != NULL)
493 while (FGets(bdrp_lock, linebuf, BDRPLINELEN_MAX))
495 int linelen = 0;
496 if (*linebuf != ':')
497 continue;
499 linelen = strlen(linebuf) - 1; /* drop the newline char */
500 linebuf[linelen] = '\0';
502 if ((bdrp_fullfile = AllocVec(linelen + strlen(bdrp_dir), MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
504 sprintf(bdrp_fullfile, "%s%s", bdrp_dir, &linebuf[1]);
505 bdrp_namepart = FilePart(bdrp_fullfile);
506 bdrp_currfile_dob = GetIconTags
508 bdrp_fullfile,
509 ICONGETA_FailIfUnavailable, FALSE,
510 ICONGETA_Label, bdrp_namepart,
511 TAG_DONE
514 D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: LEAVEOUT Icon '%s' ('%s') DOB @ 0x%p\n", bdrp_fullfile, bdrp_namepart, bdrp_currfile_dob));
516 if (bdrp_currfile_dob)
518 struct IconEntry *this_entry = NULL;
519 if ((this_entry = (struct IconEntry *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)bdrp_fullfile, (IPTR)bdrp_namepart, (IPTR)NULL, (IPTR)bdrp_currfile_dob, 0)))
521 struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
522 if (fib)
524 BPTR fib_lock = (BPTR)NULL;
525 if ((fib_lock = Lock(bdrp_fullfile, SHARED_LOCK)) != NULL)
527 if (Examine(fib_lock, fib))
529 if (fib->fib_DirEntryType == ST_FILE)
531 this_entry->ie_IconListEntry.type = ST_LINKFILE;
532 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKFILE Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
534 else if (fib->fib_DirEntryType == ST_USERDIR)
536 this_entry->ie_IconListEntry.type = ST_LINKDIR;
537 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKDIR Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
539 else
541 D(bug("[IconWindowIconList] %s: LEAVEOUT Unknown Entry Type @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
544 UnLock(fib_lock);
546 FreeDosObject(DOS_FIB, fib);
548 retVal = TRUE;
553 FreeMem(linebuf, BDRPLINELEN_MAX);
555 Close(bdrp_lock);
557 FreeVec(bdrp_file);
559 return retVal;
563 /*** Methods ****************************************************************/
564 ///OM_NEW()
565 Object *IconWindowIconList__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
567 IPTR _newIconList__FSNotifyPort = 0;
569 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW()\n"));
571 _newIconList__FSNotifyPort = GetTagData(MUIA_Wanderer_FileSysNotifyPort, (IPTR) NULL, message->ops_AttrList);
573 self = (Object *) DoSuperNewTags
575 CLASS, self, NULL,
576 MUIA_CycleChain, 1,
577 TAG_MORE, (IPTR) message->ops_AttrList
580 if (self != NULL)
582 SETUP_INST_DATA;
583 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW: SELF = 0x%p\n", self));
585 #ifdef __AROS__
586 data->iwcd_ProcessIconListPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowIconList__HookFunc_ProcessIconListPrefsFunc;
587 #else
588 data->iwcd_ProcessIconListPrefs_hook = &Hook_ProcessIconListPrefsFunc;
589 #endif
591 if (_newIconList__FSNotifyPort != 0)
593 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
594 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port = _newIconList__FSNotifyPort;
595 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW: FS Notify Port @ 0x%p\n", _newIconList__FSNotifyPort));
598 D(bug("[IconWindowIconList] obj = %ld\n", self));
600 return self;
604 ///OM_SET()
605 IPTR IconWindowIconList__OM_SET(Class *CLASS, Object *self, struct opSet *message)
607 SETUP_INST_DATA;
609 struct TagItem *tstate = message->ops_AttrList, *tag;
611 while ((tag = NextTagItem((const struct TagItem**)&tstate)) != NULL)
613 switch (tag->ti_Tag)
615 case MUIA_Background:
617 D(bug("[IconWindowIconList] %s: MUIA_Background\n", __PRETTY_FUNCTION__));
618 break;
620 case MUIA_IconWindow_Window:
622 D(bug("[IconWindowIconList] %s: MUIA_IconWindow_Window @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
623 data->iwcd_IconWindow = (Object *)tag->ti_Data;
624 break;
626 case MUIA_IconList_BufferRastport:
628 D(bug("[IconWindowIconList] %s: MUIA_IconList_BufferRastport @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
629 data->iwcd_RastPort = (struct RastPort *)tag->ti_Data;
630 break;
634 return DoSuperMethodA(CLASS, self, (Msg) message);
638 ///OM_GET()
639 IPTR IconWindowIconList__OM_GET(Class *CLASS, Object *self, struct opGet *message)
641 //SETUP_INST_DATA;
642 //IPTR *store = message->opg_Storage;
643 IPTR rv = TRUE;
645 switch (message->opg_AttrID)
647 default:
648 rv = DoSuperMethodA(CLASS, self, (Msg) message);
651 return rv;
655 ///IconWindowIconList__MUIM_Setup()
656 IPTR IconWindowIconList__MUIM_Setup
658 Class *CLASS, Object *self, Msg message
661 SETUP_INST_DATA;
663 Object *prefs = NULL;
665 if (!DoSuperMethodA(CLASS, self, message)) return FALSE;
667 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
669 if (prefs)
671 /* Set our initial options */
672 IPTR attrib_Prefs;
674 GET(_win(self), MUIA_IconWindow_BackgroundAttrib, &data->iwcd_ViewPrefs_ID);
675 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Setup: Window Background = '%s'\n", data->iwcd_ViewPrefs_ID));
676 data->iwcd_ViewPrefs_NotificationObject = (Object *)DoMethod(prefs,
677 MUIM_WandererPrefs_ViewSettings_GetNotifyObject,
678 data->iwcd_ViewPrefs_ID);
680 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Setup: Background Notification Obj @ 0x%p\n", data->iwcd_ViewPrefs_NotificationObject));
682 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_IconListMode);
683 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_IconListMode))) SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
685 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_Mode);
686 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_Mode))) SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
688 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen);
689 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MaxLineLen))) SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
691 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine);
692 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLine))) SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
694 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus);
695 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLineOnFocus))) SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
697 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing);
698 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_HorizontalSpacing))) SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
700 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing);
701 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_VerticalSpacing))) SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
703 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing);
704 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_ImageSpacing))) SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
706 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding);
707 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_HorizontalPadding))) SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
709 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding);
710 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_VerticalPadding))) SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
712 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth);
713 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderWidth))) SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
715 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight);
716 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderHeight))) SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
718 /* Configure notifications incase they get updated =) */
719 DoMethod
721 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_IconListMode, MUIV_EveryTime,
722 (IPTR) self, 3,
723 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_IconListMode
726 DoMethod
728 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_Mode, MUIV_EveryTime,
729 (IPTR) self, 3,
730 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_Mode
733 DoMethod
735 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MaxLineLen, MUIV_EveryTime,
736 (IPTR) self, 3,
737 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MaxLineLen
740 DoMethod
742 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLine, MUIV_EveryTime,
743 (IPTR) self, 3,
744 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLine
747 DoMethod
749 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLineOnFocus, MUIV_EveryTime,
750 (IPTR) self, 3,
751 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLineOnFocus
754 DoMethod
756 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_HorizontalSpacing, MUIV_EveryTime,
757 (IPTR) self, 3,
758 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_HorizontalSpacing
761 DoMethod
763 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_VerticalSpacing, MUIV_EveryTime,
764 (IPTR) self, 3,
765 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_VerticalSpacing
768 DoMethod
770 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_ImageSpacing, MUIV_EveryTime,
771 (IPTR) self, 3,
772 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_ImageSpacing
775 DoMethod
777 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_HorizontalPadding, MUIV_EveryTime,
778 (IPTR) self, 3,
779 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_HorizontalPadding
782 DoMethod
784 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_VerticalPadding, MUIV_EveryTime,
785 (IPTR) self, 3,
786 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_VerticalPadding
789 DoMethod
791 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderWidth, MUIV_EveryTime,
792 (IPTR) self, 3,
793 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderWidth
796 DoMethod
798 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderHeight, MUIV_EveryTime,
799 (IPTR) self, 3,
800 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderHeight
804 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
806 if (prefs)
808 #ifdef __AROS__
809 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc;
810 #else
811 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook = &Hook_UpdateNetworkPrefsFunc;
812 #endif
814 DoMethod
816 prefs, MUIM_Notify, MUIA_IconWindowExt_NetworkBrowser_Show, MUIV_EveryTime,
817 (IPTR) self, 3,
818 MUIM_CallHook, &((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook, (IPTR)CLASS
822 if (muiRenderInfo(self))
824 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Setting up EventHandler for (IDCMP_DISKINSERTED | IDCMP_DISKREMOVED)\n"));
826 data->iwcd_EventHandlerNode.ehn_Priority = 1;
827 data->iwcd_EventHandlerNode.ehn_Flags = MUI_EHF_GUIMODE;
828 data->iwcd_EventHandlerNode.ehn_Object = self;
829 data->iwcd_EventHandlerNode.ehn_Class = CLASS;
830 data->iwcd_EventHandlerNode.ehn_Events = IDCMP_DISKINSERTED | IDCMP_DISKREMOVED;
832 DoMethod(_win(self), MUIM_Window_AddEventHandler, &data->iwcd_EventHandlerNode);
834 else
836 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Couldnt add IDCMP EventHandler!\n"));
839 else
841 /* Setup notification on the directory -------------------------------- */
842 STRPTR directory_path = NULL;
843 GET(self, MUIA_IconDrawerList_Drawer, &directory_path);
845 if (directory_path != NULL)
847 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
849 if (drawerlist_data->iwdcd_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port != NULL)
851 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name = directory_path;
852 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Flags = NRF_SEND_MESSAGE;
853 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_UserData = self;
855 if (StartNotify(&drawerlist_data->iwdcd_DrawerNotifyRequest))
857 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Drawer-notification setup on '%s'\n", drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name));
859 else
861 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: FAILED to setup Drawer-notification!\n"));
862 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name = NULL;
868 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Setup complete!\n"));
870 return TRUE;
874 ///IconWindowIconList__MUIM_Cleanup()
875 IPTR IconWindowIconList__MUIM_Cleanup
877 Class *CLASS, Object *self, Msg message
880 SETUP_INST_DATA;
882 Object *prefs = NULL;
884 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup()\n"));
885 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
887 if (prefs)
889 DoMethod
891 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_IconListMode, (IPTR)self
894 DoMethod
896 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_Mode, (IPTR)self
899 DoMethod
901 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MaxLineLen, (IPTR)self
904 DoMethod
906 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLine, (IPTR)self
909 DoMethod
911 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLineOnFocus, (IPTR)self
914 DoMethod
916 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_HorizontalSpacing, (IPTR)self
919 DoMethod
921 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_VerticalSpacing, (IPTR)self
924 DoMethod
926 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_ImageSpacing, (IPTR)self
929 DoMethod
931 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_HorizontalPadding, (IPTR)self
934 DoMethod
936 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_VerticalPadding, (IPTR)self
939 DoMethod
941 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderWidth, (IPTR)self
944 DoMethod
946 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderHeight, (IPTR)self
950 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
952 if (prefs)
954 DoMethod
956 prefs,
957 MUIM_KillNotifyObj, MUIA_IconWindowExt_NetworkBrowser_Show, (IPTR) self
960 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup: (ROOT WINDOW) Removing our Disk Event Handler\n"));
961 DoMethod(_win(self), MUIM_Window_RemEventHandler, &data->iwcd_EventHandlerNode);
963 else
965 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
966 if (drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name != NULL)
968 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup: (DRAWER WINDOW) Removing our Drawer Notification Request\n"));
969 EndNotify(&drawerlist_data->iwdcd_DrawerNotifyRequest);
973 return DoSuperMethodA(CLASS, self, message);
977 ///IconWindowIconList__MUIM_HandleEvent()
978 IPTR IconWindowIconList__MUIM_HandleEvent
980 Class *CLASS, Object *self, struct MUIP_HandleEvent *message
983 //SETUP_INST_DATA;
985 struct IntuiMessage *imsg = message->imsg;
987 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent()\n"));
989 if(imsg->Class == IDCMP_DISKINSERTED)
991 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent: IDCMP_DISKINSERTED\n"));
992 DoMethod(self, MUIM_IconList_Update);
993 return(MUI_EventHandlerRC_Eat);
995 else if (imsg->Class == IDCMP_DISKREMOVED)
997 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent: IDCMP_DISKREMOVED\n"));
998 DoMethod(self, MUIM_IconList_Update);
999 return(MUI_EventHandlerRC_Eat);
1001 return 0;
1005 ///IconWindowIconList__MUIM_DrawBackground()
1006 IPTR IconWindowIconList__MUIM_DrawBackground
1008 Class *CLASS, Object *self, struct MUIP_DrawBackground *message
1011 SETUP_INST_DATA;
1013 IPTR retVal = (IPTR)TRUE;
1014 IPTR clip = 0;
1015 struct RastPort *DrawBackGround_RastPort;
1016 struct IconWindowBackFillMsg DrawBackGround_BackFillMsg;
1018 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground()\n"));
1020 if ((iconwindow_BackFill_Active == NULL) ||
1021 (data->iwcd_IconWindow == NULL))
1023 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: No Backfill support/Window not set .. causing parent class to render\n"));
1024 goto iwc_ParentBackground;
1027 DrawBackGround_RastPort = _rp(self);
1029 if ((data->iwcd_RastPort != NULL) && (DrawBackGround_RastPort != data->iwcd_RastPort))
1031 DrawBackGround_RastPort = data->iwcd_RastPort;
1033 DrawBackGround_BackFillMsg.AreaBounds.MinX = 0;
1034 DrawBackGround_BackFillMsg.AreaBounds.MinY = 0;
1035 DrawBackGround_BackFillMsg.AreaBounds.MaxX = _mwidth(self);
1036 DrawBackGround_BackFillMsg.AreaBounds.MaxY = _mheight(self);
1038 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left - _mleft(self);
1039 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top - _mtop(self);
1040 DrawBackGround_BackFillMsg.DrawBounds.MaxX = message->width;
1041 DrawBackGround_BackFillMsg.DrawBounds.MaxY = message->height;
1043 else
1045 DrawBackGround_BackFillMsg.AreaBounds.MinX = _mleft(self);
1046 DrawBackGround_BackFillMsg.AreaBounds.MinY = _mtop(self);
1047 DrawBackGround_BackFillMsg.AreaBounds.MaxX = (_mleft(self) + _mwidth(self));
1048 DrawBackGround_BackFillMsg.AreaBounds.MaxY = (_mtop(self) + _mheight(self));
1050 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left;
1051 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top;
1052 DrawBackGround_BackFillMsg.DrawBounds.MaxX = (message->left + message->width);
1053 DrawBackGround_BackFillMsg.DrawBounds.MaxY = (message->top + message->height);
1056 DrawBackGround_BackFillMsg.Layer = DrawBackGround_RastPort->Layer;
1058 /* Offset into source image (ala scroll bar position) */
1059 DrawBackGround_BackFillMsg.OffsetX = message->xoffset;
1060 DrawBackGround_BackFillMsg.OffsetY = message->yoffset;
1062 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: RastPort @ 0x%p\n", DrawBackGround_RastPort));
1064 if ((retVal = DoMethod(data->iwcd_IconWindow, MUIM_IconWindow_BackFill_DrawBackground, XGET(data->iwcd_IconWindow, MUIA_IconWindow_BackFillData), &DrawBackGround_BackFillMsg, DrawBackGround_RastPort)) == (IPTR)TRUE)
1066 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: Backfill module rendered background ..\n"));
1067 return retVal;
1069 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: Backfill module failed to render background ..\n"));
1071 iwc_ParentBackground:
1073 clip = (IPTR)MUI_AddClipping(muiRenderInfo(self), message->left, message->top, message->width, message->height);
1075 message->width = _mwidth(self);
1076 message->height = _mheight(self);
1077 message->left = _mleft(self);
1078 message->top = _mtop(self);
1080 retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1082 MUI_RemoveClipping(muiRenderInfo(self), (APTR)clip);
1084 return retVal;
1088 ///IconWindowIconList__MUIM_IconList_Update()
1089 IPTR IconWindowIconList__MUIM_IconList_Update
1091 Class *CLASS, Object *self, struct MUIP_IconList_Update *message
1094 SETUP_INST_DATA;
1096 IPTR retVal = (IPTR)TRUE;
1098 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
1100 struct IconList_Entry *icon_entry = (IPTR)MUIV_IconList_NextIcon_Start;
1101 Object *prefs = NULL;
1102 BOOL sort_list = FALSE;
1104 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: (ROOT WINDOW) Causing parent to update\n"));
1105 retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1107 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: Checking for '.backdrop' files\n"));
1110 DoMethod(self, MUIM_IconList_NextIcon, MUIV_IconList_NextIcon_Visible, (IPTR)&icon_entry);
1111 if (
1112 ((IPTR)icon_entry != MUIV_IconList_NextIcon_End) &&
1113 ((icon_entry->type == ST_ROOT) && !(icon_entry->flags & ICONENTRY_VOL_OFFLINE))
1116 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: checking entry '%s'\n", icon_entry->label));
1117 if (IconWindowIconList__Func_ParseBackdrop(CLASS, self, icon_entry->label))
1118 sort_list = TRUE;
1120 else
1122 break;
1124 } while (TRUE);
1126 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: Check if we should show NetworkBrowser Icon ..\n"));
1128 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
1130 if (prefs)
1132 struct IconWindowIconVolumeList_DATA *volumel_data = (struct IconWindowIconVolumeList_DATA *)data;
1134 GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &volumel_data->iwvcd_ShowNetworkBrowser);
1136 #if defined(DEBUG_NETWORKBROWSER)
1137 volumel_data->iwvcd_ShowNetworkBrowser = TRUE;
1138 #endif
1140 if (volumel_data->iwvcd_ShowNetworkBrowser)
1142 struct DiskObject *_nb_dob = NULL;
1143 _nb_dob = GetIconTags
1145 "ENV:SYS/def_NetworkHost",
1146 ICONGETA_FailIfUnavailable, FALSE,
1147 ICONGETA_Label, (IPTR)"Network Access..",
1148 TAG_DONE
1151 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: NetworkBrowser Icon DOB @ 0x%p\n", _nb_dob));
1153 if (_nb_dob)
1155 struct Node *this_entry = NULL;
1156 if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)"?wanderer.networkbrowse?", (IPTR)"Network Access..", (IPTR)NULL, (IPTR)_nb_dob, 0)))
1158 this_entry->ln_Pri = 3; /// Network Access gets Priority 3 so its displayed after special dirs
1159 sort_list = TRUE;
1160 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: NetworkBrowser Icon Entry @ 0x%p\n", this_entry));
1165 GET(prefs, MUIA_IconWindowExt_UserFiles_ShowFilesFolder, &volumel_data->iwvcd_ShowUserFolder);
1167 #if defined(DEBUG_SHOWUSERFILES)
1168 volumel_data->iwvcd_ShowUserFolder = TRUE;
1169 #endif
1170 if (volumel_data->iwvcd_ShowUserFolder)
1172 if (GetVar("SYS/Wanderer/userfiles.prefs", __icwc_intern_TxtBuff, TXTBUFF_LEN, GVF_GLOBAL_ONLY) != -1)
1174 char * userfiles_path = NULL;
1176 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: SYS/UserFilesLocation = '%s'\n", __icwc_intern_TxtBuff));
1178 if ((userfiles_path = AllocVec(strlen(__icwc_intern_TxtBuff) + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
1180 struct DiskObject *_nb_dob = NULL;
1182 volumel_data->iwvcd_UserFolderPath = userfiles_path;
1184 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage @ 0x%p\n", userfiles_path));
1186 strcpy(userfiles_path, __icwc_intern_TxtBuff);
1188 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage contains '%s'\n", userfiles_path));
1190 _nb_dob = GetIconTags
1192 "ENV:SYS/def_UserHome",
1193 ICONGETA_FailIfUnavailable, FALSE,
1194 ICONGETA_Label, (IPTR)"User Files..",
1195 TAG_DONE
1198 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: UserFiles Icon DOB @ 0x%p\n", _nb_dob));
1200 if (_nb_dob)
1202 struct Node *this_entry = NULL;
1203 if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, userfiles_path, (IPTR)"User Files..", (IPTR)NULL, (IPTR)_nb_dob, 0)))
1205 this_entry->ln_Pri = 5; /// Special dirs get Priority 5
1206 sort_list = TRUE;
1212 if (sort_list) DoMethod(self, MUIM_IconList_Sort);
1215 else
1217 retVal = TRUE;
1218 DoMethod(self, MUIM_IconList_Clear);
1221 return retVal;
1224 /*** Setup ******************************************************************/
1225 #endif