Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / system / Wanderer / iconwindow_networkbrowserlist.c
blobd112e583573605fe44e9430cb6b3bb5b4b2d2fa9
1 /*
2 Copyright 2004-2013, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "portable_macros.h"
8 #ifdef __AROS__
9 #define MUIMASTER_YES_INLINE_STDARG
10 #endif
12 //#define DEBUG_NETWORKBROWSER
13 //#define DEBUG_SHOWUSERFILES
14 #define TXTBUFF_LEN 1024
16 #ifdef __AROS__
17 #define DEBUG 0
18 #include <aros/debug.h>
19 #endif
21 #include <exec/types.h>
22 #include <libraries/mui.h>
24 #ifdef __AROS__
25 #include <zune/customclasses.h>
26 #else
27 #include <zune_AROS/customclasses.h>
28 #endif
31 #include <proto/utility.h>
33 #include <proto/graphics.h>
34 #include <proto/exec.h>
35 #include <proto/datatypes.h>
36 #include <proto/icon.h>
38 #include <dos/dos.h>
39 #include <proto/dos.h>
41 #include <stdio.h>
42 #include <string.h>
44 #include <intuition/screens.h>
45 #include <datatypes/pictureclass.h>
46 #include <clib/macros.h>
48 #if defined(__AMIGA__) && !defined(__PPC__)
49 #define NO_INLINE_STDARG
50 #endif
51 #ifndef _PROTO_INTUITION_H
52 #include <proto/intuition.h>
53 #endif
54 #include <proto/muimaster.h>
56 #include "Classes/iconlist.h"
57 #include "Classes/iconlist_attributes.h"
58 #include "Classes/icon_attributes.h"
60 #include "wanderer.h"
61 #include "wandererprefs.h"
62 #include "iconwindow.h"
63 #include "iconwindow_iconlist.h"
66 #ifndef __AROS__
67 #define DEBUG 1
69 #ifdef DEBUG
70 #define D(x) if (DEBUG) x
71 #ifdef __amigaos4__
72 #define bug DebugPrintF
73 #else
74 #define bug kprintf
75 #endif
76 #else
77 #define D(...)
78 #endif
79 #endif
81 extern struct IconWindow_BackFill_Descriptor *iconwindow_BackFill_Active;
83 #define BG_DRAWFLAG 0xf00dd00f
85 /*** Instance Data **********************************************************/
87 struct IconWindowIconList_DATA
89 Object *iwcd_IconWindow;
90 struct RastPort *iwcd_RastPort;
91 struct MUI_EventHandlerNode iwcd_EventHandlerNode;
92 #ifdef __AROS__
93 struct Hook iwcd_ProcessIconListPrefs_hook;
94 #else
95 struct Hook *iwcd_ProcessIconListPrefs_hook;
96 #endif
98 IPTR iwcd_ViewPrefs_ID;
99 Object *iwcd_ViewPrefs_NotificationObject;
102 struct IconWindowIconDrawerList_DATA
104 Object *iwcd_IconWindow;
105 struct RastPort *iwcd_RastPort;
106 struct MUI_EventHandlerNode iwcd_EventHandlerNode;
107 #ifdef __AROS__
108 struct Hook iwcd_ProcessIconListPrefs_hook;
109 #else
110 struct Hook *iwcd_ProcessIconListPrefs_hook;
111 #endif
113 IPTR iwcd_ViewPrefs_ID;
114 Object *iwcd_ViewPrefs_NotificationObject;
115 struct NotifyRequest iwdcd_DrawerNotifyRequest;
118 struct IconWindowIconVolumeList_DATA
120 Object *iwcd_IconWindow;
121 struct RastPort *iwcd_RastPort;
122 struct MUI_EventHandlerNode iwcd_EventHandlerNode;
123 #ifdef __AROS__
124 struct Hook iwcd_ProcessIconListPrefs_hook;
125 #else
126 struct Hook *iwcd_ProcessIconListPrefs_hook;
127 #endif
129 IPTR iwcd_ViewPrefs_ID;
130 Object *iwcd_ViewPrefs_NotificationObject;
131 #ifdef __AROS__
132 struct Hook iwvcd_UpdateNetworkPrefs_hook;
133 #else
134 struct Hook *iwvcd_UpdateNetworkPrefs_hook;
135 #endif
137 IPTR iwvcd_ShowNetworkBrowser;
138 IPTR iwvcd_ShowUserFolder;
141 struct IconWindowIconNetworkBrowserList_DATA
143 Object *iwcd_IconWindow;
144 struct RastPort *iwcd_RastPort;
145 struct MUI_EventHandlerNode iwcd_EventHandlerNode;
146 #ifdef __AROS__
147 struct Hook iwcd_ProcessIconListPrefs_hook;
148 #else
149 struct Hook *iwcd_ProcessIconListPrefs_hook;
150 #endif
152 IPTR iwcd_ViewPrefs_ID;
153 Object *iwcd_ViewPrefs_NotificationObject;
154 struct Hook iwnbcd_UpdateNetworkPrefs_hook;
155 struct List iwnbcd_NetworkClasses;
158 static char __icwc_intern_TxtBuff[TXTBUFF_LEN];
160 /*** Macros *****************************************************************/
161 #define SETUP_INST_DATA struct IconWindowIconList_DATA *data = INST_DATA(CLASS, self)
163 /*** Hook functions *********************************************************/
164 ///IconWindowIconList__HookFunc_ProcessIconListPrefsFunc()
165 #ifdef __AROS__
166 AROS_UFH3(
167 void, IconWindowIconList__HookFunc_ProcessIconListPrefsFunc,
168 AROS_UFHA(struct Hook *, hook, A0),
169 AROS_UFHA(APTR *, obj, A2),
170 AROS_UFHA(IPTR *, param, A1)
173 #else
174 HOOKPROTO(IconWindowIconList__HookFunc_ProcessIconListPrefsFunc, void, APTR *obj, IPTR *param)
176 #endif
177 AROS_USERFUNC_INIT
179 /* Get our private data */
180 Object *self = ( Object *)obj;
181 IPTR CHANGED_ATTRIB = *param;
182 Class *CLASS = OCLASS(self);
184 SETUP_INST_DATA;
186 Object *prefs = NULL;
188 D(bug("[IconWindowIconList] %s()\n", __PRETTY_FUNCTION__));
190 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
192 if (prefs)
194 IPTR attrib_Current, attrib_Prefs, prefs_Processing = 0;
195 BOOL options_changed = FALSE;
197 D(bug("[IconWindowIconList] %s: Setting IconList options ..\n", __PRETTY_FUNCTION__));
199 GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
201 switch (CHANGED_ATTRIB)
203 case MUIA_IconList_IconListMode:
204 GET(self, MUIA_IconList_IconListMode, &attrib_Current);
206 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_IconListMode)) != -1) &&
207 (attrib_Current != attrib_Prefs))
209 D(bug("[IconWindowIconList] %s: IconList ListMode changed - updating ..\n", __PRETTY_FUNCTION__));
210 options_changed = TRUE;
211 if (prefs_Processing)
213 NNSET(self, MUIA_IconList_IconListMode, attrib_Prefs);
215 else
217 SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
220 break;
222 case MUIA_IconList_LabelText_Mode:
223 GET(self, MUIA_IconList_LabelText_Mode, &attrib_Current);
225 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_Mode)) != -1) &&
226 (attrib_Current != attrib_Prefs))
228 D(bug("[IconWindowIconList] %s: IconList TextRenderMode changed - updating ..\n", __PRETTY_FUNCTION__));
229 options_changed = TRUE;
230 if (prefs_Processing)
232 NNSET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
234 else
236 SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
239 break;
241 case MUIA_IconList_LabelText_MaxLineLen:
242 GET(self, MUIA_IconList_LabelText_MaxLineLen, &attrib_Current);
244 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen)) != -1) &&
245 (attrib_Current != attrib_Prefs))
247 D(bug("[IconWindowIconList] %s: IconList Max Text Length changed - updating ..\n", __PRETTY_FUNCTION__));
248 options_changed = TRUE;
249 if (prefs_Processing)
251 NNSET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
253 else
255 SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
258 break;
260 case MUIA_IconList_LabelText_MultiLine:
261 GET(self, MUIA_IconList_LabelText_MultiLine, &attrib_Current);
263 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine)) != -1) &&
264 (attrib_Current != attrib_Prefs))
266 D(bug("[IconWindowIconList] %s: IconList Multi-Line changed - updating ..\n", __PRETTY_FUNCTION__));
267 options_changed = TRUE;
268 if (prefs_Processing)
270 NNSET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
272 else
274 SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
277 break;
279 case MUIA_IconList_LabelText_MultiLineOnFocus:
280 GET(self, MUIA_IconList_LabelText_MultiLineOnFocus, &attrib_Current);
282 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus)) != -1) &&
283 (attrib_Current != attrib_Prefs))
285 D(bug("[IconWindowIconList] %s: Multi-Line on Focus changed - updating ..\n", __PRETTY_FUNCTION__));
286 options_changed = TRUE;
287 if (prefs_Processing)
289 NNSET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
291 else
293 SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
296 break;
298 case MUIA_IconList_Icon_HorizontalSpacing:
299 GET(self, MUIA_IconList_Icon_HorizontalSpacing, &attrib_Current);
301 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing)) != -1) &&
302 (attrib_Current != attrib_Prefs))
304 D(bug("[IconWindowIconList] %s: Icon Horizontal Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
305 options_changed = TRUE;
306 if (prefs_Processing)
308 NNSET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
310 else
312 SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
315 break;
317 case MUIA_IconList_Icon_VerticalSpacing:
318 GET(self, MUIA_IconList_Icon_VerticalSpacing, &attrib_Current);
320 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing)) != -1) &&
321 (attrib_Current != attrib_Prefs))
323 D(bug("[IconWindowIconList] %s: Icon Vertical Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
324 options_changed = TRUE;
325 if (prefs_Processing)
327 NNSET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
329 else
331 SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
334 break;
336 case MUIA_IconList_Icon_ImageSpacing:
337 GET(self, MUIA_IconList_Icon_ImageSpacing, &attrib_Current);
339 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing)) != -1) &&
340 (attrib_Current != attrib_Prefs))
342 D(bug("[IconWindowIconList] %s: Icon Label Image Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
343 options_changed = TRUE;
344 if (prefs_Processing)
346 NNSET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
348 else
350 SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
353 break;
355 case MUIA_IconList_LabelText_HorizontalPadding:
356 GET(self, MUIA_IconList_LabelText_HorizontalPadding, &attrib_Current);
358 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding)) != -1) &&
359 (attrib_Current != attrib_Prefs))
361 D(bug("[IconWindowIconList] %s: Icon Label Horizontal Padding changed - updating ..\n", __PRETTY_FUNCTION__));
362 options_changed = TRUE;
363 if (prefs_Processing)
365 NNSET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
367 else
369 SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
372 break;
374 case MUIA_IconList_LabelText_VerticalPadding:
375 GET(self, MUIA_IconList_LabelText_VerticalPadding, &attrib_Current);
377 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding)) != -1) &&
378 (attrib_Current != attrib_Prefs))
380 D(bug("[IconWindowIconList] %s: Icon Label Vertical Padding changed - updating ..\n", __PRETTY_FUNCTION__));
381 options_changed = TRUE;
382 if (prefs_Processing)
384 NNSET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
386 else
388 SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
391 break;
393 case MUIA_IconList_LabelText_BorderWidth:
394 GET(self, MUIA_IconList_LabelText_BorderWidth, &attrib_Current);
396 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth)) != -1) &&
397 (attrib_Current != attrib_Prefs))
399 D(bug("[IconWindowIconList] %s: Icon Label Border Width changed - updating ..\n", __PRETTY_FUNCTION__));
400 options_changed = TRUE;
401 if (prefs_Processing)
403 NNSET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
405 else
407 SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
410 break;
412 case MUIA_IconList_LabelText_BorderHeight:
413 GET(self, MUIA_IconList_LabelText_BorderHeight, &attrib_Current);
415 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight)) != -1) &&
416 (attrib_Current != attrib_Prefs))
418 D(bug("[IconWindowIconList] %s: Icon Label Border Height changed - updating ..\n", __PRETTY_FUNCTION__));
419 options_changed = TRUE;
420 if (prefs_Processing)
422 NNSET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
424 else
426 SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
429 break;
431 default:
432 D(bug("[IconWindowIconList] %s: Unhandled change\n", __PRETTY_FUNCTION__));
433 break;
436 if (options_changed)
438 if (!(prefs_Processing))
440 D(bug("[IconWindowIconList] %s: IconList Options have changed, causing an update ..\n", __PRETTY_FUNCTION__));
441 DoMethod(self, MUIM_IconList_Update);
442 DoMethod(self, MUIM_IconList_Sort);
444 else if (data->iwcd_IconWindow)
446 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
450 AROS_USERFUNC_EXIT
452 #ifndef __AROS__
453 MakeStaticHook(Hook_ProcessIconListPrefsFunc,IconWindowIconList__HookFunc_ProcessIconListPrefsFunc);
454 #endif
457 ///IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc()
458 #ifdef __AROS__
459 AROS_UFH3(
460 void, IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc,
461 AROS_UFHA(struct Hook *, hook, A0),
462 AROS_UFHA(APTR *, obj, A2),
463 AROS_UFHA(APTR, param, A1)
466 #else
467 HOOKPROTO(IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc, void, APTR *obj, APTR param)
469 #endif
470 AROS_USERFUNC_INIT
472 /* Get our private data */
473 Object *self = ( Object *)obj;
474 Object *prefs = NULL;
475 Class *CLASS = *( Class **)param;
477 SETUP_INST_DATA;
479 D(bug("[IconWindowIconList] %s()\n", __PRETTY_FUNCTION__));
481 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
483 if (prefs)
485 BOOL options_changed = FALSE;
486 IPTR prefs_Processing = 0;
488 GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
490 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
492 IPTR current_ShowNetwork = 0;
493 IPTR prefs_ShowNetwork = 0;
495 D(bug("[IconWindowIconList] %s: Setting ROOT view Network options ..\n", __PRETTY_FUNCTION__));
497 GET(self, MUIA_IconWindowExt_NetworkBrowser_Show, &current_ShowNetwork);
499 D(bug("[IconWindowIconList] %s: Current = %d\n", __PRETTY_FUNCTION__, current_ShowNetwork));
501 GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &prefs_ShowNetwork);
503 D(bug("[IconWindowIconList] %s: Prefs = %d\n", __PRETTY_FUNCTION__, prefs_ShowNetwork));
505 if ((BOOL)current_ShowNetwork != (BOOL)prefs_ShowNetwork)
507 D(bug("[IconWindowIconList] %s: ROOT view Network prefs changed - updating ..\n", __PRETTY_FUNCTION__));
508 options_changed = TRUE;
509 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_ShowNetworkBrowser = prefs_ShowNetwork;
512 if ((options_changed) && !(prefs_Processing))
514 D(bug("[IconWindowIconList] %s: Network prefs changed, causing an update ..\n", __PRETTY_FUNCTION__));
515 DoMethod(self, MUIM_IconList_Update);
516 DoMethod(self, MUIM_IconList_Sort);
518 else if (data->iwcd_IconWindow)
520 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
523 AROS_USERFUNC_EXIT
525 #ifndef __AROS__
526 MakeStaticHook(Hook_UpdateNetworkPrefsFunc,IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc);
527 #endif
529 #define BDRPLINELEN_MAX 1024
530 BOOL IconWindowIconList__Func_ParseBackdrop(Class *CLASS, Object *self, char *bdrp_dir)
532 BPTR bdrp_lock = (BPTR)NULL;
533 char *bdrp_file = NULL, *linebuf = NULL, *bdrp_fullfile = NULL, *bdrp_namepart = NULL;
534 struct DiskObject *bdrp_currfile_dob = NULL;
535 BOOL retVal = FALSE;
537 if ((bdrp_dir == NULL) || (bdrp_dir[strlen(bdrp_dir) - 1] != ':'))
538 return retVal;
540 if ((bdrp_file = AllocVec(strlen(bdrp_dir) + 9 + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
542 sprintf(bdrp_file, "%s.backdrop", bdrp_dir);
543 if ((bdrp_lock = Open(bdrp_file, MODE_OLDFILE)))
545 D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: Loading backdrop file: '%s'\n", bdrp_file));
547 if ((linebuf = AllocMem(BDRPLINELEN_MAX, MEMF_PUBLIC)) != NULL)
549 while (FGets(bdrp_lock, linebuf, BDRPLINELEN_MAX))
551 int linelen = 0;
552 if (*linebuf != ':')
553 continue;
555 linelen = strlen(linebuf) - 1; /* drop the newline char */
556 linebuf[linelen] = '\0';
558 if ((bdrp_fullfile = AllocVec(linelen + strlen(bdrp_dir), MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
560 sprintf(bdrp_fullfile, "%s%s", bdrp_dir, &linebuf[1]);
561 bdrp_namepart = FilePart(bdrp_fullfile);
562 bdrp_currfile_dob = GetIconTags
564 bdrp_fullfile,
565 ICONGETA_FailIfUnavailable, FALSE,
566 ICONGETA_Label, bdrp_namepart,
567 TAG_DONE
570 D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: LEAVEOUT Icon '%s' ('%s') DOB @ 0x%p\n", bdrp_fullfile, bdrp_namepart, bdrp_currfile_dob));
572 if (bdrp_currfile_dob)
574 struct IconEntry *this_entry = NULL;
575 if ((this_entry = (struct IconEntry *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)bdrp_fullfile, (IPTR)bdrp_namepart, (IPTR)NULL, (IPTR)bdrp_currfile_dob, 0, (IPTR)NULL)))
577 struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
578 if (fib)
580 BPTR fib_lock = (BPTR)NULL;
581 if ((fib_lock = Lock(bdrp_fullfile, SHARED_LOCK)) != NULL)
583 if (Examine(fib_lock, fib))
585 if (fib->fib_DirEntryType == ST_FILE)
587 this_entry->ie_IconListEntry.type = ST_LINKFILE;
588 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKFILE Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
590 else if (fib->fib_DirEntryType == ST_USERDIR)
592 this_entry->ie_IconListEntry.type = ST_LINKDIR;
593 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKDIR Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
595 else
597 D(bug("[IconWindowIconList] %s: LEAVEOUT Unknown Entry Type @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
600 UnLock(fib_lock);
602 FreeDosObject(DOS_FIB, fib);
604 retVal = TRUE;
607 FreeVec(bdrp_fullfile);
610 FreeMem(linebuf, BDRPLINELEN_MAX);
612 Close(bdrp_lock);
614 FreeVec(bdrp_file);
616 return retVal;
620 /*** Methods ****************************************************************/
621 ///OM_NEW()
622 Object *IconWindowIconList__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
624 IPTR _newIconList__FSNotifyPort = 0;
626 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW()\n"));
628 _newIconList__FSNotifyPort = GetTagData(MUIA_Wanderer_FileSysNotifyPort, (IPTR) NULL, message->ops_AttrList);
630 self = (Object *) DoSuperNewTags
632 CLASS, self, NULL,
633 MUIA_CycleChain, 1,
634 TAG_MORE, (IPTR) message->ops_AttrList
637 if (self != NULL)
639 SETUP_INST_DATA;
640 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW: SELF = 0x%p\n", self));
642 #ifdef __AROS__
643 data->iwcd_ProcessIconListPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowIconList__HookFunc_ProcessIconListPrefsFunc;
644 #else
645 data->iwcd_ProcessIconListPrefs_hook = &Hook_ProcessIconListPrefsFunc;
646 #endif
648 if (_newIconList__FSNotifyPort != 0)
650 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
651 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port = _newIconList__FSNotifyPort;
652 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW: FS Notify Port @ 0x%p\n", _newIconList__FSNotifyPort));
655 D(bug("[IconWindowIconList] obj = %ld\n", self));
657 return self;
661 ///OM_SET()
662 IPTR IconWindowIconList__OM_SET(Class *CLASS, Object *self, struct opSet *message)
664 SETUP_INST_DATA;
666 struct TagItem *tstate = message->ops_AttrList, *tag;
668 while ((tag = NextTagItem(&tstate)) != NULL)
670 switch (tag->ti_Tag)
672 case MUIA_Background:
674 D(bug("[IconWindowIconList] %s: MUIA_Background\n", __PRETTY_FUNCTION__));
675 break;
677 case MUIA_IconWindow_Window:
679 D(bug("[IconWindowIconList] %s: MUIA_IconWindow_Window @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
680 data->iwcd_IconWindow = (Object *)tag->ti_Data;
681 break;
683 case MUIA_IconList_BufferRastport:
685 D(bug("[IconWindowIconList] %s: MUIA_IconList_BufferRastport @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
686 data->iwcd_RastPort = (struct RastPort *)tag->ti_Data;
687 break;
691 return DoSuperMethodA(CLASS, self, (Msg) message);
695 ///OM_GET()
696 IPTR IconWindowIconList__OM_GET(Class *CLASS, Object *self, struct opGet *message)
698 //SETUP_INST_DATA;
699 //IPTR *store = message->opg_Storage;
700 IPTR rv = TRUE;
702 switch (message->opg_AttrID)
704 default:
705 rv = DoSuperMethodA(CLASS, self, (Msg) message);
708 return rv;
712 ///IconWindowIconList__MUIM_Setup()
713 IPTR IconWindowIconList__MUIM_Setup
715 Class *CLASS, Object *self, Msg message
718 SETUP_INST_DATA;
720 Object *prefs = NULL;
722 if (!DoSuperMethodA(CLASS, self, message)) return FALSE;
724 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
726 if (prefs)
728 /* Set our initial options */
729 IPTR attrib_Prefs;
731 GET(_win(self), MUIA_IconWindow_BackgroundAttrib, &data->iwcd_ViewPrefs_ID);
732 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Setup: Window Background = '%s'\n", data->iwcd_ViewPrefs_ID));
733 data->iwcd_ViewPrefs_NotificationObject = (Object *)DoMethod(prefs,
734 MUIM_WandererPrefs_ViewSettings_GetNotifyObject,
735 data->iwcd_ViewPrefs_ID);
737 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Setup: Background Notification Obj @ 0x%p\n", data->iwcd_ViewPrefs_NotificationObject));
739 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_IconListMode);
740 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_IconListMode))) SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
742 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_Mode);
743 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_Mode))) SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
745 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen);
746 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MaxLineLen))) SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
748 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine);
749 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLine))) SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
751 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus);
752 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLineOnFocus))) SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
754 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing);
755 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_HorizontalSpacing))) SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
757 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing);
758 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_VerticalSpacing))) SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
760 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing);
761 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_ImageSpacing))) SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
763 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding);
764 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_HorizontalPadding))) SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
766 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding);
767 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_VerticalPadding))) SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
769 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth);
770 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderWidth))) SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
772 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight);
773 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderHeight))) SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
775 /* Configure notifications incase they get updated =) */
776 DoMethod
778 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_IconListMode, MUIV_EveryTime,
779 (IPTR) self, 3,
780 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_IconListMode
783 DoMethod
785 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_Mode, MUIV_EveryTime,
786 (IPTR) self, 3,
787 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_Mode
790 DoMethod
792 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MaxLineLen, MUIV_EveryTime,
793 (IPTR) self, 3,
794 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MaxLineLen
797 DoMethod
799 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLine, MUIV_EveryTime,
800 (IPTR) self, 3,
801 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLine
804 DoMethod
806 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLineOnFocus, MUIV_EveryTime,
807 (IPTR) self, 3,
808 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLineOnFocus
811 DoMethod
813 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_HorizontalSpacing, MUIV_EveryTime,
814 (IPTR) self, 3,
815 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_HorizontalSpacing
818 DoMethod
820 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_VerticalSpacing, MUIV_EveryTime,
821 (IPTR) self, 3,
822 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_VerticalSpacing
825 DoMethod
827 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_ImageSpacing, MUIV_EveryTime,
828 (IPTR) self, 3,
829 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_ImageSpacing
832 DoMethod
834 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_HorizontalPadding, MUIV_EveryTime,
835 (IPTR) self, 3,
836 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_HorizontalPadding
839 DoMethod
841 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_VerticalPadding, MUIV_EveryTime,
842 (IPTR) self, 3,
843 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_VerticalPadding
846 DoMethod
848 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderWidth, MUIV_EveryTime,
849 (IPTR) self, 3,
850 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderWidth
853 DoMethod
855 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderHeight, MUIV_EveryTime,
856 (IPTR) self, 3,
857 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderHeight
861 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
863 if (prefs)
865 #ifdef __AROS__
866 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc;
867 #else
868 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook = &Hook_UpdateNetworkPrefsFunc;
869 #endif
871 DoMethod
873 prefs, MUIM_Notify, MUIA_IconWindowExt_NetworkBrowser_Show, MUIV_EveryTime,
874 (IPTR) self, 3,
875 MUIM_CallHook, &((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook, (IPTR)CLASS
879 if (muiRenderInfo(self))
881 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Setting up EventHandler for (IDCMP_DISKINSERTED | IDCMP_DISKREMOVED)\n"));
883 data->iwcd_EventHandlerNode.ehn_Priority = 1;
884 data->iwcd_EventHandlerNode.ehn_Flags = MUI_EHF_GUIMODE;
885 data->iwcd_EventHandlerNode.ehn_Object = self;
886 data->iwcd_EventHandlerNode.ehn_Class = CLASS;
887 data->iwcd_EventHandlerNode.ehn_Events = IDCMP_DISKINSERTED | IDCMP_DISKREMOVED;
889 DoMethod(_win(self), MUIM_Window_AddEventHandler, &data->iwcd_EventHandlerNode);
891 else
893 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Couldnt add IDCMP EventHandler!\n"));
896 else
898 /* Setup notification on the directory -------------------------------- */
899 STRPTR directory_path = NULL;
900 GET(self, MUIA_IconDrawerList_Drawer, &directory_path);
902 if (directory_path != NULL)
904 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
906 if (drawerlist_data->iwdcd_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port != NULL)
908 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name = directory_path;
909 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Flags = NRF_SEND_MESSAGE;
910 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_UserData = self;
912 if (StartNotify(&drawerlist_data->iwdcd_DrawerNotifyRequest))
914 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Drawer-notification setup on '%s'\n", drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name));
916 else
918 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: FAILED to setup Drawer-notification!\n"));
919 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name = NULL;
925 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Setup complete!\n"));
927 return TRUE;
931 ///IconWindowIconList__MUIM_Cleanup()
932 IPTR IconWindowIconList__MUIM_Cleanup
934 Class *CLASS, Object *self, Msg message
937 SETUP_INST_DATA;
939 Object *prefs = NULL;
941 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup()\n"));
942 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
944 if (prefs)
946 DoMethod
948 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_IconListMode, (IPTR)self
951 DoMethod
953 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_Mode, (IPTR)self
956 DoMethod
958 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MaxLineLen, (IPTR)self
961 DoMethod
963 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLine, (IPTR)self
966 DoMethod
968 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLineOnFocus, (IPTR)self
971 DoMethod
973 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_HorizontalSpacing, (IPTR)self
976 DoMethod
978 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_VerticalSpacing, (IPTR)self
981 DoMethod
983 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_ImageSpacing, (IPTR)self
986 DoMethod
988 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_HorizontalPadding, (IPTR)self
991 DoMethod
993 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_VerticalPadding, (IPTR)self
996 DoMethod
998 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderWidth, (IPTR)self
1001 DoMethod
1003 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderHeight, (IPTR)self
1007 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
1009 if (prefs)
1011 DoMethod
1013 prefs,
1014 MUIM_KillNotifyObj, MUIA_IconWindowExt_NetworkBrowser_Show, (IPTR) self
1017 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup: (ROOT WINDOW) Removing our Disk Event Handler\n"));
1018 DoMethod(_win(self), MUIM_Window_RemEventHandler, &data->iwcd_EventHandlerNode);
1020 else
1022 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
1023 if (drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name != NULL)
1025 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup: (DRAWER WINDOW) Removing our Drawer Notification Request\n"));
1026 EndNotify(&drawerlist_data->iwdcd_DrawerNotifyRequest);
1030 return DoSuperMethodA(CLASS, self, message);
1034 ///IconWindowIconList__MUIM_HandleEvent()
1035 IPTR IconWindowIconList__MUIM_HandleEvent
1037 Class *CLASS, Object *self, struct MUIP_HandleEvent *message
1040 //SETUP_INST_DATA;
1042 struct IntuiMessage *imsg = message->imsg;
1044 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent()\n"));
1046 if(imsg->Class == IDCMP_DISKINSERTED)
1048 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent: IDCMP_DISKINSERTED\n"));
1049 DoMethod(self, MUIM_IconList_Update);
1050 DoMethod(self, MUIM_IconList_Sort);
1051 return(MUI_EventHandlerRC_Eat);
1053 else if (imsg->Class == IDCMP_DISKREMOVED)
1055 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent: IDCMP_DISKREMOVED\n"));
1056 DoMethod(self, MUIM_IconList_Update);
1057 DoMethod(self, MUIM_IconList_Sort);
1058 return(MUI_EventHandlerRC_Eat);
1060 return 0;
1064 ///IconWindowIconList__MUIM_DrawBackground()
1065 IPTR IconWindowIconList__MUIM_DrawBackground
1067 Class *CLASS, Object *self, struct MUIP_DrawBackground *message
1070 SETUP_INST_DATA;
1072 IPTR retVal = (IPTR)TRUE;
1073 IPTR clip = 0;
1074 struct RastPort *DrawBackGround_RastPort;
1075 struct IconWindowBackFillMsg DrawBackGround_BackFillMsg;
1077 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground()\n"));
1079 if ((iconwindow_BackFill_Active == NULL) ||
1080 (data->iwcd_IconWindow == NULL))
1082 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: No Backfill support/Window not set .. causing parent class to render\n"));
1083 goto iwc_ParentBackground;
1086 DrawBackGround_RastPort = _rp(self);
1088 if ((data->iwcd_RastPort != NULL) && (DrawBackGround_RastPort != data->iwcd_RastPort))
1090 DrawBackGround_RastPort = data->iwcd_RastPort;
1092 DrawBackGround_BackFillMsg.AreaBounds.MinX = 0;
1093 DrawBackGround_BackFillMsg.AreaBounds.MinY = 0;
1094 DrawBackGround_BackFillMsg.AreaBounds.MaxX = _mwidth(self);
1095 DrawBackGround_BackFillMsg.AreaBounds.MaxY = _mheight(self);
1097 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left - _mleft(self);
1098 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top - _mtop(self);
1099 DrawBackGround_BackFillMsg.DrawBounds.MaxX = message->width;
1100 DrawBackGround_BackFillMsg.DrawBounds.MaxY = message->height;
1102 else
1104 DrawBackGround_BackFillMsg.AreaBounds.MinX = _mleft(self);
1105 DrawBackGround_BackFillMsg.AreaBounds.MinY = _mtop(self);
1106 DrawBackGround_BackFillMsg.AreaBounds.MaxX = (_mleft(self) + _mwidth(self));
1107 DrawBackGround_BackFillMsg.AreaBounds.MaxY = (_mtop(self) + _mheight(self));
1109 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left;
1110 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top;
1111 DrawBackGround_BackFillMsg.DrawBounds.MaxX = (message->left + message->width);
1112 DrawBackGround_BackFillMsg.DrawBounds.MaxY = (message->top + message->height);
1115 DrawBackGround_BackFillMsg.Layer = DrawBackGround_RastPort->Layer;
1117 /* Offset into source image (ala scroll bar position) */
1118 DrawBackGround_BackFillMsg.OffsetX = message->xoffset;
1119 DrawBackGround_BackFillMsg.OffsetY = message->yoffset;
1121 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: RastPort @ 0x%p\n", DrawBackGround_RastPort));
1123 if ((retVal = DoMethod(data->iwcd_IconWindow, MUIM_IconWindow_BackFill_DrawBackground, XGET(data->iwcd_IconWindow, MUIA_IconWindow_BackFillData), &DrawBackGround_BackFillMsg, DrawBackGround_RastPort)) == (IPTR)TRUE)
1125 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: Backfill module rendered background ..\n"));
1126 return retVal;
1128 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: Backfill module failed to render background ..\n"));
1130 iwc_ParentBackground:
1132 clip = (IPTR)MUI_AddClipping(muiRenderInfo(self), message->left, message->top, message->width, message->height);
1134 message->width = _mwidth(self);
1135 message->height = _mheight(self);
1136 message->left = _mleft(self);
1137 message->top = _mtop(self);
1139 retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1141 MUI_RemoveClipping(muiRenderInfo(self), (APTR)clip);
1143 return retVal;
1147 ///IconWindowIconList__MUIM_IconList_Update()
1148 IPTR IconWindowIconList__MUIM_IconList_Update
1150 Class *CLASS, Object *self, struct MUIP_IconList_Update *message
1153 SETUP_INST_DATA;
1155 IPTR retVal = (IPTR)TRUE;
1157 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
1159 struct IconList_Entry *icon_entry = (IPTR)MUIV_IconList_NextIcon_Start;
1160 Object *prefs = NULL;
1161 BOOL sort_list = FALSE;
1163 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: (ROOT WINDOW) Causing parent to update\n"));
1164 retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1166 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: Checking for '.backdrop' files\n"));
1169 DoMethod(self, MUIM_IconList_NextIcon, MUIV_IconList_NextIcon_Visible, (IPTR)&icon_entry);
1170 if (
1171 ((IPTR)icon_entry != MUIV_IconList_NextIcon_End) &&
1172 ((icon_entry->type == ST_ROOT) && !(icon_entry->flags & ICONENTRY_VOL_OFFLINE))
1175 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: checking entry '%s'\n", icon_entry->label));
1176 if (IconWindowIconList__Func_ParseBackdrop(CLASS, self, icon_entry->label))
1177 sort_list = TRUE;
1179 else
1181 break;
1183 } while (TRUE);
1185 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: Check if we should show NetworkBrowser Icon ..\n"));
1187 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
1189 if (prefs)
1191 struct IconWindowIconVolumeList_DATA *volumel_data = (struct IconWindowIconVolumeList_DATA *)data;
1193 GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &volumel_data->iwvcd_ShowNetworkBrowser);
1195 #if defined(DEBUG_NETWORKBROWSER)
1196 volumel_data->iwvcd_ShowNetworkBrowser = TRUE;
1197 #endif
1199 if (volumel_data->iwvcd_ShowNetworkBrowser)
1201 struct DiskObject *_nb_dob = NULL;
1202 _nb_dob = GetIconTags
1204 "ENV:SYS/def_NetworkHost",
1205 ICONGETA_FailIfUnavailable, FALSE,
1206 ICONGETA_Label, (IPTR)"Network Access..",
1207 TAG_DONE
1210 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: NetworkBrowser Icon DOB @ 0x%p\n", _nb_dob));
1212 if (_nb_dob)
1214 struct Node *this_entry = NULL;
1215 if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)"?wanderer.networkbrowse?", (IPTR)"Network Access..", (IPTR)NULL, (IPTR)_nb_dob, 0, (IPTR)NULL)))
1217 this_entry->ln_Pri = 3; /// Network Access gets Priority 3 so its displayed after special dirs
1218 sort_list = TRUE;
1219 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: NetworkBrowser Icon Entry @ 0x%p\n", this_entry));
1224 GET(prefs, MUIA_IconWindowExt_UserFiles_ShowFilesFolder, &volumel_data->iwvcd_ShowUserFolder);
1226 #if defined(DEBUG_SHOWUSERFILES)
1227 volumel_data->iwvcd_ShowUserFolder = TRUE;
1228 #endif
1229 if (volumel_data->iwvcd_ShowUserFolder)
1231 if (GetVar("SYS/Wanderer/userfiles.prefs", __icwc_intern_TxtBuff, TXTBUFF_LEN, GVF_GLOBAL_ONLY) != -1)
1233 char * userfiles_path = NULL;
1235 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: SYS/UserFilesLocation = '%s'\n", __icwc_intern_TxtBuff));
1237 if ((userfiles_path = AllocVec(strlen(__icwc_intern_TxtBuff) + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
1239 struct DiskObject *_nb_dob = NULL;
1241 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage @ 0x%p\n", userfiles_path));
1243 strcpy(userfiles_path, __icwc_intern_TxtBuff);
1245 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage contains '%s'\n", userfiles_path));
1247 _nb_dob = GetIconTags
1249 "ENV:SYS/def_UserHome",
1250 ICONGETA_FailIfUnavailable, FALSE,
1251 ICONGETA_Label, (IPTR)"User Files..",
1252 TAG_DONE
1255 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: UserFiles Icon DOB @ 0x%p\n", _nb_dob));
1257 if (_nb_dob)
1259 struct Node *this_entry = NULL;
1260 if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, userfiles_path, (IPTR)"User Files..", (IPTR)NULL, (IPTR)_nb_dob, 0, (IPTR)NULL)))
1262 this_entry->ln_Pri = 5; /// Special dirs get Priority 5
1263 sort_list = TRUE;
1269 if (sort_list) DoMethod(self, MUIM_IconList_Sort);
1272 else
1274 retVal = TRUE;
1275 DoMethod(self, MUIM_IconList_Clear);
1278 return retVal;
1281 /*** Setup ******************************************************************/
1282 #ifdef __AROS__
1283 ICONWINDOWICONDRAWERLIST_CUSTOMCLASS
1285 IconWindowIconDrawerList, IconWindowIconList, NULL, MUIC_IconDrawerList, NULL,
1286 OM_NEW, struct opSet *,
1287 OM_SET, struct opSet *,
1288 OM_GET, struct opGet *,
1289 MUIM_Setup, Msg,
1290 MUIM_Cleanup, Msg,
1291 MUIM_DrawBackground, Msg
1294 ICONWINDOWICONVOLUMELIST_CUSTOMCLASS
1296 IconWindowIconVolumeList, IconWindowIconList, NULL, MUIC_IconVolumeList, NULL,
1297 OM_NEW, struct opSet *,
1298 OM_SET, struct opSet *,
1299 OM_GET, struct opGet *,
1300 MUIM_Setup, Msg,
1301 MUIM_Cleanup, Msg,
1302 MUIM_DrawBackground, Msg,
1303 MUIM_HandleEvent, Msg,
1304 MUIM_IconList_Update, struct MUIP_IconList_Update *
1307 ICONWINDOWICONNETWORKBROWSERLIST_CUSTOMCLASS
1309 IconWindowIconNetworkBrowserList, IconWindowIconList, NULL, MUIC_IconList, NULL,
1310 OM_NEW, struct opSet *,
1311 OM_SET, struct opSet *,
1312 OM_GET, struct opGet *,
1313 MUIM_Setup, Msg,
1314 MUIM_Cleanup, Msg,
1315 MUIM_DrawBackground, Msg,
1316 MUIM_HandleEvent, Msg,
1317 MUIM_IconList_Update, struct MUIP_IconList_Update *
1320 #else
1321 ICONWINDOWICONDRAWERLIST_CUSTOMCLASS
1323 IconWindowIconDrawerList, IconWindowIconList, NULL, NULL, IconDrawerList_Class,
1324 OM_NEW, struct opSet *,
1325 OM_SET, struct opSet *,
1326 OM_GET, struct opGet *,
1327 MUIM_Setup, Msg,
1328 MUIM_Cleanup, Msg,
1329 MUIM_DrawBackground, Msg
1332 ICONWINDOWICONVOLUMELIST_CUSTOMCLASS
1334 IconWindowIconVolumeList, IconWindowIconList, NULL, NULL, IconVolumeList_Class,
1335 OM_NEW, struct opSet *,
1336 OM_SET, struct opSet *,
1337 OM_GET, struct opGet *,
1338 MUIM_Setup, Msg,
1339 MUIM_Cleanup, Msg,
1340 MUIM_DrawBackground, Msg,
1341 MUIM_HandleEvent, Msg,
1342 MUIM_IconList_Update, struct MUIP_IconList_Update *
1345 ICONWINDOWICONNETWORKBROWSERLIST_CUSTOMCLASS
1347 IconWindowIconNetworkBrowserList, IconWindowIconList, NULL, NULL, IconList_Class,
1348 OM_NEW, struct opSet *,
1349 OM_SET, struct opSet *,
1350 OM_GET, struct opGet *,
1351 MUIM_Setup, Msg,
1352 MUIM_Cleanup, Msg,
1353 MUIM_DrawBackground, Msg,
1354 MUIM_HandleEvent, Msg,
1355 MUIM_IconList_Update, struct MUIP_IconList_Update *
1357 #endif