Fixed warnings about missing newline at EOF.
[AROS.git] / workbench / system / Wanderer / iconwindow_iconlist.c
blob8b7fb819e0d7f58bb25392edc489740398892a03
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);
388 DoMethod(self, MUIM_IconList_Sort);
390 else if (data->iwcd_IconWindow)
392 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
396 AROS_USERFUNC_EXIT
398 #ifndef __AROS__
399 MakeStaticHook(Hook_ProcessIconListPrefsFunc,IconWindowIconList__HookFunc_ProcessIconListPrefsFunc);
400 #endif
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)
412 #else
413 HOOKPROTO(IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc, void, APTR *obj, APTR param)
415 #endif
416 AROS_USERFUNC_INIT
418 /* Get our private data */
419 Object *self = ( Object *)obj;
420 Object *prefs = NULL;
421 Class *CLASS = *( Class **)param;
423 SETUP_INST_DATA;
425 D(bug("[IconWindowIconList] %s()\n", __PRETTY_FUNCTION__));
427 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
429 if (prefs)
431 BOOL options_changed = FALSE;
432 IPTR prefs_Processing = 0;
434 GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
436 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
438 IPTR current_ShowNetwork = 0;
439 IPTR prefs_ShowNetwork = 0;
441 D(bug("[IconWindowIconList] %s: Setting ROOT view Network options ..\n", __PRETTY_FUNCTION__));
443 GET(self, MUIA_IconWindowExt_NetworkBrowser_Show, &current_ShowNetwork);
445 D(bug("[IconWindowIconList] %s: Current = %d\n", __PRETTY_FUNCTION__, current_ShowNetwork));
447 GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &prefs_ShowNetwork);
449 D(bug("[IconWindowIconList] %s: Prefs = %d\n", __PRETTY_FUNCTION__, prefs_ShowNetwork));
451 if ((BOOL)current_ShowNetwork != (BOOL)prefs_ShowNetwork)
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;
458 if ((options_changed) && !(prefs_Processing))
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);
464 else if (data->iwcd_IconWindow)
466 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
469 AROS_USERFUNC_EXIT
471 #ifndef __AROS__
472 MakeStaticHook(Hook_UpdateNetworkPrefsFunc,IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc);
473 #endif
475 #define BDRPLINELEN_MAX 1024
476 BOOL IconWindowIconList__Func_ParseBackdrop(Class *CLASS, Object *self, char *bdrp_dir)
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;
483 if ((bdrp_dir == NULL) || (bdrp_dir[strlen(bdrp_dir) - 1] != ':'))
484 return retVal;
486 if ((bdrp_file = AllocVec(strlen(bdrp_dir) + 9 + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
488 sprintf(bdrp_file, "%s.backdrop", bdrp_dir);
489 if ((bdrp_lock = Open(bdrp_file, MODE_OLDFILE)))
491 D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: Loading backdrop file: '%s'\n", bdrp_file));
493 if ((linebuf = AllocMem(BDRPLINELEN_MAX, MEMF_PUBLIC)) != NULL)
495 while (FGets(bdrp_lock, linebuf, BDRPLINELEN_MAX))
497 int linelen = 0;
498 if (*linebuf != ':')
499 continue;
501 linelen = strlen(linebuf) - 1; /* drop the newline char */
502 linebuf[linelen] = '\0';
504 if ((bdrp_fullfile = AllocVec(linelen + strlen(bdrp_dir), MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
506 sprintf(bdrp_fullfile, "%s%s", bdrp_dir, &linebuf[1]);
507 bdrp_namepart = FilePart(bdrp_fullfile);
508 bdrp_currfile_dob = GetIconTags
510 bdrp_fullfile,
511 ICONGETA_FailIfUnavailable, FALSE,
512 ICONGETA_Label, bdrp_namepart,
513 TAG_DONE
516 D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: LEAVEOUT Icon '%s' ('%s') DOB @ 0x%p\n", bdrp_fullfile, bdrp_namepart, bdrp_currfile_dob));
518 if (bdrp_currfile_dob)
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)))
523 struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
524 if (fib)
526 BPTR fib_lock = (BPTR)NULL;
527 if ((fib_lock = Lock(bdrp_fullfile, SHARED_LOCK)) != NULL)
529 if (Examine(fib_lock, fib))
531 if (fib->fib_DirEntryType == ST_FILE)
533 this_entry->ie_IconListEntry.type = ST_LINKFILE;
534 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKFILE Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
536 else if (fib->fib_DirEntryType == ST_USERDIR)
538 this_entry->ie_IconListEntry.type = ST_LINKDIR;
539 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKDIR Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
541 else
543 D(bug("[IconWindowIconList] %s: LEAVEOUT Unknown Entry Type @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
546 UnLock(fib_lock);
548 FreeDosObject(DOS_FIB, fib);
550 retVal = TRUE;
555 FreeMem(linebuf, BDRPLINELEN_MAX);
557 Close(bdrp_lock);
559 FreeVec(bdrp_file);
561 return retVal;
565 /*** Methods ****************************************************************/
566 ///OM_NEW()
567 Object *IconWindowIconList__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
569 IPTR _newIconList__FSNotifyPort = 0;
571 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW()\n"));
573 _newIconList__FSNotifyPort = GetTagData(MUIA_Wanderer_FileSysNotifyPort, (IPTR) NULL, message->ops_AttrList);
575 self = (Object *) DoSuperNewTags
577 CLASS, self, NULL,
578 MUIA_CycleChain, 1,
579 TAG_MORE, (IPTR) message->ops_AttrList
582 if (self != NULL)
584 SETUP_INST_DATA;
585 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW: SELF = 0x%p\n", self));
587 #ifdef __AROS__
588 data->iwcd_ProcessIconListPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowIconList__HookFunc_ProcessIconListPrefsFunc;
589 #else
590 data->iwcd_ProcessIconListPrefs_hook = &Hook_ProcessIconListPrefsFunc;
591 #endif
593 if (_newIconList__FSNotifyPort != 0)
595 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
596 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port = _newIconList__FSNotifyPort;
597 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW: FS Notify Port @ 0x%p\n", _newIconList__FSNotifyPort));
600 D(bug("[IconWindowIconList] obj = %ld\n", self));
602 return self;
606 ///OM_SET()
607 IPTR IconWindowIconList__OM_SET(Class *CLASS, Object *self, struct opSet *message)
609 SETUP_INST_DATA;
611 struct TagItem *tstate = message->ops_AttrList, *tag;
613 while ((tag = NextTagItem((const struct TagItem**)&tstate)) != NULL)
615 switch (tag->ti_Tag)
617 case MUIA_Background:
619 D(bug("[IconWindowIconList] %s: MUIA_Background\n", __PRETTY_FUNCTION__));
620 break;
622 case MUIA_IconWindow_Window:
624 D(bug("[IconWindowIconList] %s: MUIA_IconWindow_Window @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
625 data->iwcd_IconWindow = (Object *)tag->ti_Data;
626 break;
628 case MUIA_IconList_BufferRastport:
630 D(bug("[IconWindowIconList] %s: MUIA_IconList_BufferRastport @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
631 data->iwcd_RastPort = (struct RastPort *)tag->ti_Data;
632 break;
636 return DoSuperMethodA(CLASS, self, (Msg) message);
640 ///OM_GET()
641 IPTR IconWindowIconList__OM_GET(Class *CLASS, Object *self, struct opGet *message)
643 //SETUP_INST_DATA;
644 //IPTR *store = message->opg_Storage;
645 IPTR rv = TRUE;
647 switch (message->opg_AttrID)
649 default:
650 rv = DoSuperMethodA(CLASS, self, (Msg) message);
653 return rv;
657 ///IconWindowIconList__MUIM_Setup()
658 IPTR IconWindowIconList__MUIM_Setup
660 Class *CLASS, Object *self, Msg message
663 SETUP_INST_DATA;
665 Object *prefs = NULL;
667 if (!DoSuperMethodA(CLASS, self, message)) return FALSE;
669 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
671 if (prefs)
673 /* Set our initial options */
674 IPTR attrib_Prefs;
676 GET(_win(self), MUIA_IconWindow_BackgroundAttrib, &data->iwcd_ViewPrefs_ID);
677 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Setup: Window Background = '%s'\n", data->iwcd_ViewPrefs_ID));
678 data->iwcd_ViewPrefs_NotificationObject = (Object *)DoMethod(prefs,
679 MUIM_WandererPrefs_ViewSettings_GetNotifyObject,
680 data->iwcd_ViewPrefs_ID);
682 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Setup: Background Notification Obj @ 0x%p\n", data->iwcd_ViewPrefs_NotificationObject));
684 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_IconListMode);
685 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_IconListMode))) SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
687 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_Mode);
688 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_Mode))) SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
690 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen);
691 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MaxLineLen))) SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
693 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine);
694 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLine))) SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
696 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus);
697 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLineOnFocus))) SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
699 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing);
700 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_HorizontalSpacing))) SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
702 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing);
703 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_VerticalSpacing))) SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
705 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing);
706 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_ImageSpacing))) SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
708 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding);
709 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_HorizontalPadding))) SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
711 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding);
712 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_VerticalPadding))) SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
714 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth);
715 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderWidth))) SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
717 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight);
718 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderHeight))) SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
720 /* Configure notifications incase they get updated =) */
721 DoMethod
723 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_IconListMode, MUIV_EveryTime,
724 (IPTR) self, 3,
725 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_IconListMode
728 DoMethod
730 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_Mode, MUIV_EveryTime,
731 (IPTR) self, 3,
732 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_Mode
735 DoMethod
737 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MaxLineLen, MUIV_EveryTime,
738 (IPTR) self, 3,
739 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MaxLineLen
742 DoMethod
744 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLine, MUIV_EveryTime,
745 (IPTR) self, 3,
746 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLine
749 DoMethod
751 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLineOnFocus, MUIV_EveryTime,
752 (IPTR) self, 3,
753 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLineOnFocus
756 DoMethod
758 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_HorizontalSpacing, MUIV_EveryTime,
759 (IPTR) self, 3,
760 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_HorizontalSpacing
763 DoMethod
765 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_VerticalSpacing, MUIV_EveryTime,
766 (IPTR) self, 3,
767 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_VerticalSpacing
770 DoMethod
772 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_ImageSpacing, MUIV_EveryTime,
773 (IPTR) self, 3,
774 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_ImageSpacing
777 DoMethod
779 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_HorizontalPadding, MUIV_EveryTime,
780 (IPTR) self, 3,
781 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_HorizontalPadding
784 DoMethod
786 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_VerticalPadding, MUIV_EveryTime,
787 (IPTR) self, 3,
788 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_VerticalPadding
791 DoMethod
793 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderWidth, MUIV_EveryTime,
794 (IPTR) self, 3,
795 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderWidth
798 DoMethod
800 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderHeight, MUIV_EveryTime,
801 (IPTR) self, 3,
802 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderHeight
806 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
808 if (prefs)
810 #ifdef __AROS__
811 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc;
812 #else
813 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook = &Hook_UpdateNetworkPrefsFunc;
814 #endif
816 DoMethod
818 prefs, MUIM_Notify, MUIA_IconWindowExt_NetworkBrowser_Show, MUIV_EveryTime,
819 (IPTR) self, 3,
820 MUIM_CallHook, &((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook, (IPTR)CLASS
824 if (muiRenderInfo(self))
826 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Setting up EventHandler for (IDCMP_DISKINSERTED | IDCMP_DISKREMOVED)\n"));
828 data->iwcd_EventHandlerNode.ehn_Priority = 1;
829 data->iwcd_EventHandlerNode.ehn_Flags = MUI_EHF_GUIMODE;
830 data->iwcd_EventHandlerNode.ehn_Object = self;
831 data->iwcd_EventHandlerNode.ehn_Class = CLASS;
832 data->iwcd_EventHandlerNode.ehn_Events = IDCMP_DISKINSERTED | IDCMP_DISKREMOVED;
834 DoMethod(_win(self), MUIM_Window_AddEventHandler, &data->iwcd_EventHandlerNode);
836 else
838 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Couldnt add IDCMP EventHandler!\n"));
841 else
843 /* Setup notification on the directory -------------------------------- */
844 STRPTR directory_path = NULL;
845 GET(self, MUIA_IconDrawerList_Drawer, &directory_path);
847 if (directory_path != NULL)
849 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
851 if (drawerlist_data->iwdcd_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port != NULL)
853 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name = directory_path;
854 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Flags = NRF_SEND_MESSAGE;
855 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_UserData = self;
857 if (StartNotify(&drawerlist_data->iwdcd_DrawerNotifyRequest))
859 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Drawer-notification setup on '%s'\n", drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name));
861 else
863 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: FAILED to setup Drawer-notification!\n"));
864 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name = NULL;
870 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Setup complete!\n"));
872 return TRUE;
876 ///IconWindowIconList__MUIM_Cleanup()
877 IPTR IconWindowIconList__MUIM_Cleanup
879 Class *CLASS, Object *self, Msg message
882 SETUP_INST_DATA;
884 Object *prefs = NULL;
886 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup()\n"));
887 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
889 if (prefs)
891 DoMethod
893 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_IconListMode, (IPTR)self
896 DoMethod
898 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_Mode, (IPTR)self
901 DoMethod
903 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MaxLineLen, (IPTR)self
906 DoMethod
908 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLine, (IPTR)self
911 DoMethod
913 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLineOnFocus, (IPTR)self
916 DoMethod
918 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_HorizontalSpacing, (IPTR)self
921 DoMethod
923 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_VerticalSpacing, (IPTR)self
926 DoMethod
928 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_ImageSpacing, (IPTR)self
931 DoMethod
933 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_HorizontalPadding, (IPTR)self
936 DoMethod
938 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_VerticalPadding, (IPTR)self
941 DoMethod
943 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderWidth, (IPTR)self
946 DoMethod
948 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderHeight, (IPTR)self
952 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
954 if (prefs)
956 DoMethod
958 prefs,
959 MUIM_KillNotifyObj, MUIA_IconWindowExt_NetworkBrowser_Show, (IPTR) self
962 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup: (ROOT WINDOW) Removing our Disk Event Handler\n"));
963 DoMethod(_win(self), MUIM_Window_RemEventHandler, &data->iwcd_EventHandlerNode);
965 else
967 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
968 if (drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name != NULL)
970 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup: (DRAWER WINDOW) Removing our Drawer Notification Request\n"));
971 EndNotify(&drawerlist_data->iwdcd_DrawerNotifyRequest);
975 return DoSuperMethodA(CLASS, self, message);
979 ///IconWindowIconList__MUIM_HandleEvent()
980 IPTR IconWindowIconList__MUIM_HandleEvent
982 Class *CLASS, Object *self, struct MUIP_HandleEvent *message
985 //SETUP_INST_DATA;
987 struct IntuiMessage *imsg = message->imsg;
989 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent()\n"));
991 if(imsg->Class == IDCMP_DISKINSERTED)
993 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent: IDCMP_DISKINSERTED\n"));
994 DoMethod(self, MUIM_IconList_Update);
995 DoMethod(self, MUIM_IconList_Sort);
996 return(MUI_EventHandlerRC_Eat);
998 else if (imsg->Class == IDCMP_DISKREMOVED)
1000 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent: IDCMP_DISKREMOVED\n"));
1001 DoMethod(self, MUIM_IconList_Update);
1002 DoMethod(self, MUIM_IconList_Sort);
1003 return(MUI_EventHandlerRC_Eat);
1005 return 0;
1009 ///IconWindowIconList__MUIM_DrawBackground()
1010 IPTR IconWindowIconList__MUIM_DrawBackground
1012 Class *CLASS, Object *self, struct MUIP_DrawBackground *message
1015 SETUP_INST_DATA;
1017 IPTR retVal = (IPTR)TRUE;
1018 IPTR clip = 0;
1019 struct RastPort *DrawBackGround_RastPort;
1020 struct IconWindowBackFillMsg DrawBackGround_BackFillMsg;
1022 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground()\n"));
1024 if ((iconwindow_BackFill_Active == NULL) ||
1025 (data->iwcd_IconWindow == NULL))
1027 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: No Backfill support/Window not set .. causing parent class to render\n"));
1028 goto iwc_ParentBackground;
1031 DrawBackGround_RastPort = _rp(self);
1033 if ((data->iwcd_RastPort != NULL) && (DrawBackGround_RastPort != data->iwcd_RastPort))
1035 DrawBackGround_RastPort = data->iwcd_RastPort;
1037 DrawBackGround_BackFillMsg.AreaBounds.MinX = 0;
1038 DrawBackGround_BackFillMsg.AreaBounds.MinY = 0;
1039 DrawBackGround_BackFillMsg.AreaBounds.MaxX = _mwidth(self);
1040 DrawBackGround_BackFillMsg.AreaBounds.MaxY = _mheight(self);
1042 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left - _mleft(self);
1043 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top - _mtop(self);
1044 DrawBackGround_BackFillMsg.DrawBounds.MaxX = message->width;
1045 DrawBackGround_BackFillMsg.DrawBounds.MaxY = message->height;
1047 else
1049 DrawBackGround_BackFillMsg.AreaBounds.MinX = _mleft(self);
1050 DrawBackGround_BackFillMsg.AreaBounds.MinY = _mtop(self);
1051 DrawBackGround_BackFillMsg.AreaBounds.MaxX = (_mleft(self) + _mwidth(self));
1052 DrawBackGround_BackFillMsg.AreaBounds.MaxY = (_mtop(self) + _mheight(self));
1054 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left;
1055 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top;
1056 DrawBackGround_BackFillMsg.DrawBounds.MaxX = (message->left + message->width);
1057 DrawBackGround_BackFillMsg.DrawBounds.MaxY = (message->top + message->height);
1060 DrawBackGround_BackFillMsg.Layer = DrawBackGround_RastPort->Layer;
1062 /* Offset into source image (ala scroll bar position) */
1063 DrawBackGround_BackFillMsg.OffsetX = message->xoffset;
1064 DrawBackGround_BackFillMsg.OffsetY = message->yoffset;
1066 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: RastPort @ 0x%p\n", DrawBackGround_RastPort));
1068 if ((retVal = DoMethod(data->iwcd_IconWindow, MUIM_IconWindow_BackFill_DrawBackground, XGET(data->iwcd_IconWindow, MUIA_IconWindow_BackFillData), &DrawBackGround_BackFillMsg, DrawBackGround_RastPort)) == (IPTR)TRUE)
1070 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: Backfill module rendered background ..\n"));
1071 return retVal;
1073 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: Backfill module failed to render background ..\n"));
1075 iwc_ParentBackground:
1077 clip = (IPTR)MUI_AddClipping(muiRenderInfo(self), message->left, message->top, message->width, message->height);
1079 message->width = _mwidth(self);
1080 message->height = _mheight(self);
1081 message->left = _mleft(self);
1082 message->top = _mtop(self);
1084 retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1086 MUI_RemoveClipping(muiRenderInfo(self), (APTR)clip);
1088 return retVal;
1092 ///IconWindowIconList__MUIM_IconList_Update()
1093 IPTR IconWindowIconList__MUIM_IconList_Update
1095 Class *CLASS, Object *self, struct MUIP_IconList_Update *message
1098 SETUP_INST_DATA;
1100 IPTR retVal = (IPTR)TRUE;
1102 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
1104 struct IconList_Entry *icon_entry = (IPTR)MUIV_IconList_NextIcon_Start;
1105 Object *prefs = NULL;
1106 BOOL sort_list = FALSE;
1108 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: (ROOT WINDOW) Causing parent to update\n"));
1109 retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1111 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: Checking for '.backdrop' files\n"));
1114 DoMethod(self, MUIM_IconList_NextIcon, MUIV_IconList_NextIcon_Visible, (IPTR)&icon_entry);
1115 if (
1116 ((IPTR)icon_entry != MUIV_IconList_NextIcon_End) &&
1117 ((icon_entry->type == ST_ROOT) && !(icon_entry->flags & ICONENTRY_VOL_OFFLINE))
1120 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: checking entry '%s'\n", icon_entry->label));
1121 if (IconWindowIconList__Func_ParseBackdrop(CLASS, self, icon_entry->label))
1122 sort_list = TRUE;
1124 else
1126 break;
1128 } while (TRUE);
1130 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: Check if we should show NetworkBrowser Icon ..\n"));
1132 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
1134 if (prefs)
1136 struct IconWindowIconVolumeList_DATA *volumel_data = (struct IconWindowIconVolumeList_DATA *)data;
1138 GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &volumel_data->iwvcd_ShowNetworkBrowser);
1140 #if defined(DEBUG_NETWORKBROWSER)
1141 volumel_data->iwvcd_ShowNetworkBrowser = TRUE;
1142 #endif
1144 if (volumel_data->iwvcd_ShowNetworkBrowser)
1146 struct DiskObject *_nb_dob = NULL;
1147 _nb_dob = GetIconTags
1149 "ENV:SYS/def_NetworkHost",
1150 ICONGETA_FailIfUnavailable, FALSE,
1151 ICONGETA_Label, (IPTR)"Network Access..",
1152 TAG_DONE
1155 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: NetworkBrowser Icon DOB @ 0x%p\n", _nb_dob));
1157 if (_nb_dob)
1159 struct Node *this_entry = NULL;
1160 if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)"?wanderer.networkbrowse?", (IPTR)"Network Access..", (IPTR)NULL, (IPTR)_nb_dob, 0)))
1162 this_entry->ln_Pri = 3; /// Network Access gets Priority 3 so its displayed after special dirs
1163 sort_list = TRUE;
1164 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: NetworkBrowser Icon Entry @ 0x%p\n", this_entry));
1169 GET(prefs, MUIA_IconWindowExt_UserFiles_ShowFilesFolder, &volumel_data->iwvcd_ShowUserFolder);
1171 #if defined(DEBUG_SHOWUSERFILES)
1172 volumel_data->iwvcd_ShowUserFolder = TRUE;
1173 #endif
1174 if (volumel_data->iwvcd_ShowUserFolder)
1176 if (GetVar("SYS/Wanderer/userfiles.prefs", __icwc_intern_TxtBuff, TXTBUFF_LEN, GVF_GLOBAL_ONLY) != -1)
1178 char * userfiles_path = NULL;
1180 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: SYS/UserFilesLocation = '%s'\n", __icwc_intern_TxtBuff));
1182 if ((userfiles_path = AllocVec(strlen(__icwc_intern_TxtBuff) + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
1184 struct DiskObject *_nb_dob = NULL;
1186 volumel_data->iwvcd_UserFolderPath = userfiles_path;
1188 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage @ 0x%p\n", userfiles_path));
1190 strcpy(userfiles_path, __icwc_intern_TxtBuff);
1192 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage contains '%s'\n", userfiles_path));
1194 _nb_dob = GetIconTags
1196 "ENV:SYS/def_UserHome",
1197 ICONGETA_FailIfUnavailable, FALSE,
1198 ICONGETA_Label, (IPTR)"User Files..",
1199 TAG_DONE
1202 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: UserFiles Icon DOB @ 0x%p\n", _nb_dob));
1204 if (_nb_dob)
1206 struct Node *this_entry = NULL;
1207 if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, userfiles_path, (IPTR)"User Files..", (IPTR)NULL, (IPTR)_nb_dob, 0)))
1209 this_entry->ln_Pri = 5; /// Special dirs get Priority 5
1210 sort_list = TRUE;
1216 if (sort_list) DoMethod(self, MUIM_IconList_Sort);
1219 else
1221 retVal = TRUE;
1222 DoMethod(self, MUIM_IconList_Clear);
1225 return retVal;
1228 /*** Setup ******************************************************************/
1229 #endif