Some compiler warnings removed.
[cake.git] / workbench / system / Wanderer / iconwindowcontents.c
blobe63b48c34c495df49ee121b848dadd6bbd346fe3
1 /*
2 Copyright 2004-2009, 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 "iconwindowcontents.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;
124 #ifdef __AROS__
125 struct Hook iwcd_ProcessIconListPrefs_hook;
126 #else
127 struct Hook *iwcd_ProcessIconListPrefs_hook;
128 #endif
130 IPTR iwcd_ViewPrefs_ID;
131 Object *iwcd_ViewPrefs_NotificationObject;
133 #ifdef __AROS__
134 struct Hook iwvcd_UpdateNetworkPrefs_hook;
135 #else
136 struct Hook *iwvcd_UpdateNetworkPrefs_hook;
137 #endif
139 IPTR iwvcd_ShowNetworkBrowser;
140 IPTR iwvcd_ShowUserFolder;
141 char *iwvcd_UserFolderPath;
145 struct IconWindowIconNetworkBrowserList_DATA
147 Object *iwcd_IconWindow;
148 struct RastPort *iwcd_RastPort;
149 struct MUI_EventHandlerNode iwcd_EventHandlerNode;
150 #ifdef __AROS__
151 struct Hook iwcd_ProcessIconListPrefs_hook;
152 #else
153 struct Hook *iwcd_ProcessIconListPrefs_hook;
154 #endif
156 IPTR iwcd_ViewPrefs_ID;
157 Object *iwcd_ViewPrefs_NotificationObject;
158 struct Hook iwnbcd_UpdateNetworkPrefs_hook;
159 struct List iwnbcd_NetworkClasses;
162 static char __icwc_intern_TxtBuff[TXTBUFF_LEN];
164 /*** Macros *****************************************************************/
165 #define SETUP_INST_DATA struct IconWindowIconList_DATA *data = INST_DATA(CLASS, self)
167 /*** Hook functions *********************************************************/
168 ///IconWindowIconList__HookFunc_ProcessIconListPrefsFunc()
169 #ifdef __AROS__
170 AROS_UFH3(
171 void, IconWindowIconList__HookFunc_ProcessIconListPrefsFunc,
172 AROS_UFHA(struct Hook *, hook, A0),
173 AROS_UFHA(APTR *, obj, A2),
174 AROS_UFHA(IPTR *, param, A1)
177 #else
178 HOOKPROTO(IconWindowIconList__HookFunc_ProcessIconListPrefsFunc, void, APTR *obj, IPTR *param)
180 #endif
181 AROS_USERFUNC_INIT
183 /* Get our private data */
184 Object *self = ( Object *)obj;
185 IPTR CHANGED_ATTRIB = *param;
186 Class *CLASS = OCLASS(self);
188 SETUP_INST_DATA;
190 Object *prefs = NULL;
192 D(bug("[IconWindowIconList] %s()\n", __PRETTY_FUNCTION__));
194 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
196 if (prefs)
198 IPTR attrib_Current, attrib_Prefs, prefs_Processing = 0;
199 BOOL options_changed = FALSE;
201 D(bug("[IconWindowIconList] %s: Setting IconList options ..\n", __PRETTY_FUNCTION__));
203 GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
205 switch (CHANGED_ATTRIB)
207 case MUIA_IconList_IconListMode:
208 GET(self, MUIA_IconList_IconListMode, &attrib_Current);
210 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_IconListMode)) != -1) &&
211 (attrib_Current != attrib_Prefs))
213 D(bug("[IconWindowIconList] %s: IconList ListMode changed - updating ..\n", __PRETTY_FUNCTION__));
214 options_changed = TRUE;
215 if (prefs_Processing)
217 NNSET(self, MUIA_IconList_IconListMode, attrib_Prefs);
219 else
221 SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
224 break;
226 case MUIA_IconList_LabelText_Mode:
227 GET(self, MUIA_IconList_LabelText_Mode, &attrib_Current);
229 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_Mode)) != -1) &&
230 (attrib_Current != attrib_Prefs))
232 D(bug("[IconWindowIconList] %s: IconList TextRenderMode changed - updating ..\n", __PRETTY_FUNCTION__));
233 options_changed = TRUE;
234 if (prefs_Processing)
236 NNSET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
238 else
240 SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
243 break;
245 case MUIA_IconList_LabelText_MaxLineLen:
246 GET(self, MUIA_IconList_LabelText_MaxLineLen, &attrib_Current);
248 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen)) != -1) &&
249 (attrib_Current != attrib_Prefs))
251 D(bug("[IconWindowIconList] %s: IconList Max Text Length changed - updating ..\n", __PRETTY_FUNCTION__));
252 options_changed = TRUE;
253 if (prefs_Processing)
255 NNSET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
257 else
259 SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
262 break;
264 case MUIA_IconList_LabelText_MultiLine:
265 GET(self, MUIA_IconList_LabelText_MultiLine, &attrib_Current);
267 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine)) != -1) &&
268 (attrib_Current != attrib_Prefs))
270 D(bug("[IconWindowIconList] %s: IconList Multi-Line changed - updating ..\n", __PRETTY_FUNCTION__));
271 options_changed = TRUE;
272 if (prefs_Processing)
274 NNSET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
276 else
278 SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
281 break;
283 case MUIA_IconList_LabelText_MultiLineOnFocus:
284 GET(self, MUIA_IconList_LabelText_MultiLineOnFocus, &attrib_Current);
286 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus)) != -1) &&
287 (attrib_Current != attrib_Prefs))
289 D(bug("[IconWindowIconList] %s: Multi-Line on Focus changed - updating ..\n", __PRETTY_FUNCTION__));
290 options_changed = TRUE;
291 if (prefs_Processing)
293 NNSET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
295 else
297 SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
300 break;
302 case MUIA_IconList_Icon_HorizontalSpacing:
303 GET(self, MUIA_IconList_Icon_HorizontalSpacing, &attrib_Current);
305 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing)) != -1) &&
306 (attrib_Current != attrib_Prefs))
308 D(bug("[IconWindowIconList] %s: Icon Horizontal Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
309 options_changed = TRUE;
310 if (prefs_Processing)
312 NNSET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
314 else
316 SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
319 break;
321 case MUIA_IconList_Icon_VerticalSpacing:
322 GET(self, MUIA_IconList_Icon_VerticalSpacing, &attrib_Current);
324 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing)) != -1) &&
325 (attrib_Current != attrib_Prefs))
327 D(bug("[IconWindowIconList] %s: Icon Vertical Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
328 options_changed = TRUE;
329 if (prefs_Processing)
331 NNSET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
333 else
335 SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
338 break;
340 case MUIA_IconList_Icon_ImageSpacing:
341 GET(self, MUIA_IconList_Icon_ImageSpacing, &attrib_Current);
343 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing)) != -1) &&
344 (attrib_Current != attrib_Prefs))
346 D(bug("[IconWindowIconList] %s: Icon Label Image Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
347 options_changed = TRUE;
348 if (prefs_Processing)
350 NNSET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
352 else
354 SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
357 break;
359 case MUIA_IconList_LabelText_HorizontalPadding:
360 GET(self, MUIA_IconList_LabelText_HorizontalPadding, &attrib_Current);
362 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding)) != -1) &&
363 (attrib_Current != attrib_Prefs))
365 D(bug("[IconWindowIconList] %s: Icon Label Horizontal Padding changed - updating ..\n", __PRETTY_FUNCTION__));
366 options_changed = TRUE;
367 if (prefs_Processing)
369 NNSET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
371 else
373 SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
376 break;
378 case MUIA_IconList_LabelText_VerticalPadding:
379 GET(self, MUIA_IconList_LabelText_VerticalPadding, &attrib_Current);
381 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding)) != -1) &&
382 (attrib_Current != attrib_Prefs))
384 D(bug("[IconWindowIconList] %s: Icon Label Vertical Padding changed - updating ..\n", __PRETTY_FUNCTION__));
385 options_changed = TRUE;
386 if (prefs_Processing)
388 NNSET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
390 else
392 SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
395 break;
397 case MUIA_IconList_LabelText_BorderWidth:
398 GET(self, MUIA_IconList_LabelText_BorderWidth, &attrib_Current);
400 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth)) != -1) &&
401 (attrib_Current != attrib_Prefs))
403 D(bug("[IconWindowIconList] %s: Icon Label Border Width changed - updating ..\n", __PRETTY_FUNCTION__));
404 options_changed = TRUE;
405 if (prefs_Processing)
407 NNSET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
409 else
411 SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
414 break;
416 case MUIA_IconList_LabelText_BorderHeight:
417 GET(self, MUIA_IconList_LabelText_BorderHeight, &attrib_Current);
419 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight)) != -1) &&
420 (attrib_Current != attrib_Prefs))
422 D(bug("[IconWindowIconList] %s: Icon Label Border Height changed - updating ..\n", __PRETTY_FUNCTION__));
423 options_changed = TRUE;
424 if (prefs_Processing)
426 NNSET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
428 else
430 SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
433 break;
435 default:
436 D(bug("[IconWindowIconList] %s: Unhandled change\n", __PRETTY_FUNCTION__));
437 break;
440 if (options_changed)
442 if (!(prefs_Processing))
444 D(bug("[IconWindowIconList] %s: IconList Options have changed, causing an update ..\n", __PRETTY_FUNCTION__));
445 DoMethod(self, MUIM_IconList_Update);
447 else if (data->iwcd_IconWindow)
449 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
453 AROS_USERFUNC_EXIT
455 #ifndef __AROS__
456 MakeStaticHook(Hook_ProcessIconListPrefsFunc,IconWindowIconList__HookFunc_ProcessIconListPrefsFunc);
457 #endif
460 ///IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc()
461 #ifdef __AROS__
462 AROS_UFH3(
463 void, IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc,
464 AROS_UFHA(struct Hook *, hook, A0),
465 AROS_UFHA(APTR *, obj, A2),
466 AROS_UFHA(APTR, param, A1)
469 #else
470 HOOKPROTO(IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc, void, APTR *obj, APTR param)
472 #endif
473 AROS_USERFUNC_INIT
475 /* Get our private data */
476 Object *self = ( Object *)obj;
477 Object *prefs = NULL;
478 Class *CLASS = *( Class **)param;
480 SETUP_INST_DATA;
482 D(bug("[IconWindowIconList] %s()\n", __PRETTY_FUNCTION__));
484 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
486 if (prefs)
488 BOOL options_changed = FALSE;
489 IPTR prefs_Processing = 0;
491 GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
493 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
495 ULONG current_ShowNetwork;
496 ULONG prefs_ShowNetwork;
498 D(bug("[IconWindowIconList] %s: Setting ROOT view Network options ..\n", __PRETTY_FUNCTION__));
499 current_ShowNetwork = 0;
501 GET(self, MUIA_IconWindowExt_NetworkBrowser_Show, &current_ShowNetwork);
503 D(bug("[IconWindowIconList] %s: Current = %d\n", __PRETTY_FUNCTION__, current_ShowNetwork));
505 prefs_ShowNetwork = 0;
507 GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &prefs_ShowNetwork);
509 D(bug("[IconWindowIconList] %s: Prefs = %d\n", __PRETTY_FUNCTION__, prefs_ShowNetwork));
511 if ((BOOL)current_ShowNetwork != (BOOL)prefs_ShowNetwork)
513 D(bug("[IconWindowIconList] %s: ROOT view Network prefs changed - updating ..\n", __PRETTY_FUNCTION__));
514 options_changed = TRUE;
515 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_ShowNetworkBrowser = prefs_ShowNetwork;
518 if ((options_changed) && !(prefs_Processing))
520 D(bug("[IconWindowIconList] %s: Network prefs changed, causing an update ..\n", __PRETTY_FUNCTION__));
521 DoMethod(self, MUIM_IconList_Update);
523 else if (data->iwcd_IconWindow)
525 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
528 AROS_USERFUNC_EXIT
530 #ifndef __AROS__
531 MakeStaticHook(Hook_UpdateNetworkPrefsFunc,IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc);
532 #endif
534 #define BDRPLINELEN_MAX 1024
535 BOOL IconWindowIconList__Func_ParseBackdrop(Class *CLASS, Object *self, char *bdrp_dir)
537 BPTR bdrp_lock = (BPTR)NULL;
538 char *bdrp_file = NULL, *linebuf = NULL, *bdrp_fullfile = NULL, *bdrp_namepart = NULL;
539 struct DiskObject *bdrp_currfile_dob = NULL;
540 BOOL retVal = FALSE;
542 if ((bdrp_dir == NULL) || (bdrp_dir[strlen(bdrp_dir) - 1] != ':'))
543 return retVal;
545 if ((bdrp_file = AllocVec(strlen(bdrp_dir) + 9 + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
547 sprintf(bdrp_file, "%s.backdrop", bdrp_dir);
548 if ((bdrp_lock = Open(bdrp_file, MODE_OLDFILE)))
550 D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: Loading config file: '%s'\n", bdrp_file));
551 if ((linebuf = AllocMem(BDRPLINELEN_MAX, MEMF_PUBLIC)) != NULL)
553 while (FGets(bdrp_lock, linebuf, BDRPLINELEN_MAX))
555 int linelen = 0;
556 if (*linebuf != ':')
557 continue;
559 linelen = strlen(linebuf) - 1; /* drop the newline char */
560 linebuf[linelen] = '\0';
562 if ((bdrp_fullfile = AllocVec(linelen + strlen(bdrp_dir), MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
564 sprintf(bdrp_fullfile, "%s%s", bdrp_dir, &linebuf[1]);
565 bdrp_namepart = FilePart(bdrp_fullfile);
566 bdrp_currfile_dob = GetIconTags
568 bdrp_fullfile,
569 ICONGETA_FailIfUnavailable, FALSE,
570 ICONGETA_Label, bdrp_namepart,
571 TAG_DONE
574 D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: LEAVEOUT Icon '%s' ('%s') DOB @ 0x%p\n", bdrp_fullfile, bdrp_namepart, bdrp_currfile_dob));
576 if (bdrp_currfile_dob)
578 struct IconEntry *this_entry = NULL;
579 if ((this_entry = (struct IconEntry *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)bdrp_fullfile, (IPTR)bdrp_namepart, (IPTR)NULL, (IPTR)bdrp_currfile_dob, 0)))
581 struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
582 if (fib)
584 BPTR fib_lock = (BPTR)NULL;
585 if ((fib_lock = Lock(bdrp_fullfile, SHARED_LOCK)) != NULL)
587 if (Examine(fib_lock, fib))
589 if (fib->fib_DirEntryType == ST_FILE)
591 this_entry->ile_IconListEntry.type = ST_LINKFILE;
592 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKFILE Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
594 else if (fib->fib_DirEntryType == ST_USERDIR)
596 this_entry->ile_IconListEntry.type = ST_LINKDIR;
597 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKDIR Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
599 else
601 D(bug("[IconWindowIconList] %s: LEAVEOUT Unknown Entry Type @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
604 UnLock(fib_lock);
606 FreeDosObject(DOS_FIB, fib);
608 retVal = TRUE;
613 FreeMem(linebuf, BDRPLINELEN_MAX);
615 Close(bdrp_lock);
617 FreeVec(bdrp_file);
619 return retVal;
623 /*** Methods ****************************************************************/
624 ///OM_NEW()
625 Object *IconWindowIconList__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
627 IPTR _newIconList__FSNotifyPort = 0;
629 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW()\n"));
631 _newIconList__FSNotifyPort = GetTagData(MUIA_Wanderer_FileSysNotifyPort, (IPTR) NULL, message->ops_AttrList);
633 self = (Object *) DoSuperNewTags
635 CLASS, self, NULL,
636 MUIA_CycleChain, 1,
637 TAG_MORE, (IPTR) message->ops_AttrList
640 if (self != NULL)
642 SETUP_INST_DATA;
643 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW: SELF = 0x%p\n", self));
645 #ifdef __AROS__
646 data->iwcd_ProcessIconListPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowIconList__HookFunc_ProcessIconListPrefsFunc;
647 #else
648 data->iwcd_ProcessIconListPrefs_hook = &Hook_ProcessIconListPrefsFunc;
649 #endif
651 if (_newIconList__FSNotifyPort != 0)
653 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
654 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port = _newIconList__FSNotifyPort;
655 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW: FS Notify Port @ 0x%p\n", _newIconList__FSNotifyPort));
658 D(bug("[IconWindowIconList] obj = %ld\n", self));
659 return self;
663 ///OM_SET()
664 IPTR IconWindowIconList__OM_SET(Class *CLASS, Object *self, struct opSet *message)
666 SETUP_INST_DATA;
668 struct TagItem *tstate = message->ops_AttrList, *tag;
670 while ((tag = NextTagItem((const struct TagItem**)&tstate)) != NULL)
672 switch (tag->ti_Tag)
674 case MUIA_Background:
676 D(bug("[IconWindowIconList] %s: MUIA_Background\n", __PRETTY_FUNCTION__));
677 break;
679 case MUIA_IconWindow_Window:
681 D(bug("[IconWindowIconList] %s: MUIA_IconWindow_Window @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
682 data->iwcd_IconWindow = (Object *)tag->ti_Data;
683 break;
685 case MUIA_IconList_BufferRastport:
687 D(bug("[IconWindowIconList] %s: MUIA_IconList_BufferRastport @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
688 data->iwcd_RastPort = (struct RastPort *)tag->ti_Data;
689 break;
693 return DoSuperMethodA(CLASS, self, (Msg) message);
697 ///OM_GET()
698 IPTR IconWindowIconList__OM_GET(Class *CLASS, Object *self, struct opGet *message)
700 //SETUP_INST_DATA;
701 //IPTR *store = message->opg_Storage;
702 IPTR rv = TRUE;
704 switch (message->opg_AttrID)
706 default:
707 rv = DoSuperMethodA(CLASS, self, (Msg) message);
710 return rv;
714 ///IconWindowIconList__MUIM_Setup()
715 IPTR IconWindowIconList__MUIM_Setup
717 Class *CLASS, Object *self, Msg message
720 SETUP_INST_DATA;
722 Object *prefs = NULL;
724 if (!DoSuperMethodA(CLASS, self, message)) return FALSE;
726 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
728 if (prefs)
730 /* Set our initial options */
731 IPTR attrib_Prefs;
733 GET(_win(self), MUIA_IconWindow_BackgroundAttrib, &data->iwcd_ViewPrefs_ID);
734 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Setup: Window Background = '%s'\n", data->iwcd_ViewPrefs_ID));
735 data->iwcd_ViewPrefs_NotificationObject = (Object *)DoMethod(prefs,
736 MUIM_WandererPrefs_ViewSettings_GetNotifyObject,
737 data->iwcd_ViewPrefs_ID);
739 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Setup: Background Notification Obj @ 0x%p\n", data->iwcd_ViewPrefs_NotificationObject));
743 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_IconListMode);
744 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_IconListMode))) SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
746 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_Mode);
747 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_Mode))) SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
749 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen);
750 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MaxLineLen))) SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
752 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine);
753 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLine))) SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
755 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus);
756 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLineOnFocus))) SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
758 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing);
759 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_HorizontalSpacing))) SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
761 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing);
762 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_VerticalSpacing))) SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
764 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing);
765 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_ImageSpacing))) SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
767 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding);
768 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_HorizontalPadding))) SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
770 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding);
771 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_VerticalPadding))) SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
773 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth);
774 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderWidth))) SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
776 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight);
777 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderHeight))) SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
779 /* Configure notifications incase they get updated =) */
780 DoMethod
782 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_IconListMode, MUIV_EveryTime,
783 (IPTR) self, 3,
784 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_IconListMode
787 DoMethod
789 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_Mode, MUIV_EveryTime,
790 (IPTR) self, 3,
791 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_Mode
794 DoMethod
796 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MaxLineLen, MUIV_EveryTime,
797 (IPTR) self, 3,
798 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MaxLineLen
801 DoMethod
803 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLine, MUIV_EveryTime,
804 (IPTR) self, 3,
805 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLine
808 DoMethod
810 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLineOnFocus, MUIV_EveryTime,
811 (IPTR) self, 3,
812 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLineOnFocus
815 DoMethod
817 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_HorizontalSpacing, MUIV_EveryTime,
818 (IPTR) self, 3,
819 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_HorizontalSpacing
822 DoMethod
824 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_VerticalSpacing, MUIV_EveryTime,
825 (IPTR) self, 3,
826 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_VerticalSpacing
829 DoMethod
831 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_ImageSpacing, MUIV_EveryTime,
832 (IPTR) self, 3,
833 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_ImageSpacing
836 DoMethod
838 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_HorizontalPadding, MUIV_EveryTime,
839 (IPTR) self, 3,
840 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_HorizontalPadding
843 DoMethod
845 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_VerticalPadding, MUIV_EveryTime,
846 (IPTR) self, 3,
847 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_VerticalPadding
850 DoMethod
852 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderWidth, MUIV_EveryTime,
853 (IPTR) self, 3,
854 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderWidth
857 DoMethod
859 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderHeight, MUIV_EveryTime,
860 (IPTR) self, 3,
861 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderHeight
865 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
867 if (prefs)
869 #ifdef __AROS__
870 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc;
871 #else
872 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook = &Hook_UpdateNetworkPrefsFunc;
873 #endif
876 DoMethod
878 prefs, MUIM_Notify, MUIA_IconWindowExt_NetworkBrowser_Show, MUIV_EveryTime,
879 (IPTR) self, 3,
880 MUIM_CallHook, &((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook, (IPTR)CLASS
884 if (muiRenderInfo(self))
886 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Setting up EventHandler for (IDCMP_DISKINSERTED | IDCMP_DISKREMOVED)\n"));
888 data->iwcd_EventHandlerNode.ehn_Priority = 1;
889 data->iwcd_EventHandlerNode.ehn_Flags = MUI_EHF_GUIMODE;
890 data->iwcd_EventHandlerNode.ehn_Object = self;
891 data->iwcd_EventHandlerNode.ehn_Class = CLASS;
892 data->iwcd_EventHandlerNode.ehn_Events = IDCMP_DISKINSERTED | IDCMP_DISKREMOVED;
894 DoMethod(_win(self), MUIM_Window_AddEventHandler, &data->iwcd_EventHandlerNode);
896 else
898 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Couldnt add IDCMP EventHandler!\n"));
901 else
903 /* Setup notification on the directory -------------------------------- */
904 STRPTR directory_path = NULL;
905 GET(self, MUIA_IconDrawerList_Drawer, &directory_path);
907 if (directory_path != NULL)
909 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
911 if (drawerlist_data->iwdcd_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port != NULL)
913 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name = directory_path;
914 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Flags = NRF_SEND_MESSAGE;
915 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_UserData = self;
917 if (StartNotify(&drawerlist_data->iwdcd_DrawerNotifyRequest))
919 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Drawer-notification setup on '%s'\n", drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name));
921 else
923 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: FAILED to setup Drawer-notification!\n"));
924 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name = NULL;
930 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Setup complete!\n"));
932 return TRUE;
936 ///IconWindowIconList__MUIM_Cleanup()
937 IPTR IconWindowIconList__MUIM_Cleanup
939 Class *CLASS, Object *self, Msg message
942 SETUP_INST_DATA;
944 Object *prefs = NULL;
946 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup()\n"));
947 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
949 if (prefs)
951 DoMethod
953 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_IconListMode, (IPTR)self
956 DoMethod
958 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_Mode, (IPTR)self
961 DoMethod
963 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MaxLineLen, (IPTR)self
966 DoMethod
968 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLine, (IPTR)self
971 DoMethod
973 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLineOnFocus, (IPTR)self
976 DoMethod
978 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_HorizontalSpacing, (IPTR)self
981 DoMethod
983 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_VerticalSpacing, (IPTR)self
986 DoMethod
988 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_ImageSpacing, (IPTR)self
991 DoMethod
993 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_HorizontalPadding, (IPTR)self
996 DoMethod
998 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_VerticalPadding, (IPTR)self
1001 DoMethod
1003 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderWidth, (IPTR)self
1006 DoMethod
1008 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderHeight, (IPTR)self
1012 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
1014 if (prefs)
1016 DoMethod
1018 prefs,
1019 MUIM_KillNotifyObj, MUIA_IconWindowExt_NetworkBrowser_Show, (IPTR) self
1022 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup: (ROOT WINDOW) Removing our Disk Event Handler\n"));
1023 DoMethod(_win(self), MUIM_Window_RemEventHandler, &data->iwcd_EventHandlerNode);
1025 else
1027 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
1028 if (drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name != NULL)
1030 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup: (DRAWER WINDOW) Removing our Drawer Notification Request\n"));
1031 EndNotify(&drawerlist_data->iwdcd_DrawerNotifyRequest);
1035 return DoSuperMethodA(CLASS, self, message);
1039 ///IconWindowIconList__MUIM_HandleEvent()
1040 IPTR IconWindowIconList__MUIM_HandleEvent
1042 Class *CLASS, Object *self, struct MUIP_HandleEvent *message
1045 //SETUP_INST_DATA;
1047 struct IntuiMessage *imsg = message->imsg;
1049 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent()\n"));
1051 if(imsg->Class == IDCMP_DISKINSERTED)
1053 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent: IDCMP_DISKINSERTED\n"));
1054 DoMethod(self, MUIM_IconList_Update);
1055 return(MUI_EventHandlerRC_Eat);
1057 else if (imsg->Class == IDCMP_DISKREMOVED)
1059 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent: IDCMP_DISKREMOVED\n"));
1060 DoMethod(self, MUIM_IconList_Update);
1061 return(MUI_EventHandlerRC_Eat);
1063 return 0;
1067 ///IconWindowIconList__MUIM_DrawBackground()
1068 IPTR IconWindowIconList__MUIM_DrawBackground
1070 Class *CLASS, Object *self, struct MUIP_DrawBackground *message
1073 SETUP_INST_DATA;
1075 IPTR retVal = (IPTR)TRUE;
1076 IPTR clip = 0;
1077 struct RastPort *DrawBackGround_RastPort;
1078 struct IconWindowBackFillMsg DrawBackGround_BackFillMsg;
1080 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground()\n"));
1082 if ((iconwindow_BackFill_Active == NULL) ||
1083 (data->iwcd_IconWindow == NULL))
1085 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: No Backfill support/Window not set .. causing parent class to render\n"));
1086 goto iwc_ParentBackground;
1089 DrawBackGround_RastPort = _rp(self);
1092 if ((data->iwcd_RastPort != NULL) && (DrawBackGround_RastPort != data->iwcd_RastPort))
1094 DrawBackGround_RastPort = data->iwcd_RastPort;
1096 DrawBackGround_BackFillMsg.AreaBounds.MinX = 0;
1097 DrawBackGround_BackFillMsg.AreaBounds.MinY = 0;
1098 DrawBackGround_BackFillMsg.AreaBounds.MaxX = _mwidth(self);
1099 DrawBackGround_BackFillMsg.AreaBounds.MaxY = _mheight(self);
1101 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left - _mleft(self);
1102 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top - _mtop(self);
1103 DrawBackGround_BackFillMsg.DrawBounds.MaxX = message->width;
1104 DrawBackGround_BackFillMsg.DrawBounds.MaxY = message->height;
1106 else
1108 DrawBackGround_BackFillMsg.AreaBounds.MinX = _mleft(self);
1109 DrawBackGround_BackFillMsg.AreaBounds.MinY = _mtop(self);
1110 DrawBackGround_BackFillMsg.AreaBounds.MaxX = (_mleft(self) + _mwidth(self));
1111 DrawBackGround_BackFillMsg.AreaBounds.MaxY = (_mtop(self) + _mheight(self));
1113 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left;
1114 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top;
1115 DrawBackGround_BackFillMsg.DrawBounds.MaxX = (message->left + message->width);
1116 DrawBackGround_BackFillMsg.DrawBounds.MaxY = (message->top + message->height);
1119 DrawBackGround_BackFillMsg.Layer = DrawBackGround_RastPort->Layer;
1121 /* Offset into source image (ala scroll bar position) */
1122 DrawBackGround_BackFillMsg.OffsetX = message->xoffset;
1123 DrawBackGround_BackFillMsg.OffsetY = message->yoffset;
1125 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: RastPort @ 0x%p\n", DrawBackGround_RastPort));
1127 if ((retVal = DoMethod(data->iwcd_IconWindow, MUIM_IconWindow_BackFill_DrawBackground, XGET(data->iwcd_IconWindow, MUIA_IconWindow_BackFillData), &DrawBackGround_BackFillMsg, DrawBackGround_RastPort)) == (IPTR)TRUE)
1129 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: Backfill module rendered background ..\n"));
1130 return retVal;
1132 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: Backfill module failed to render background ..\n"));
1134 iwc_ParentBackground:
1136 clip = (IPTR)MUI_AddClipping(muiRenderInfo(self), message->left, message->top, message->width, message->height);
1138 message->width = _mwidth(self);
1139 message->height = _mheight(self);
1140 message->left = _mleft(self);
1141 message->top = _mtop(self);
1143 retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1145 MUI_RemoveClipping(muiRenderInfo(self), (APTR)clip);
1147 return retVal;
1151 ///IconWindowIconList__MUIM_IconList_Update()
1152 IPTR IconWindowIconList__MUIM_IconList_Update
1154 Class *CLASS, Object *self, struct MUIP_IconList_Update *message
1157 SETUP_INST_DATA;
1159 IPTR retVal = (IPTR)TRUE;
1161 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
1163 struct IconList_Entry *icon_entry = (IPTR)MUIV_IconList_NextIcon_Start;
1164 Object *prefs = NULL;
1165 BOOL sort_list = FALSE;
1167 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: (ROOT WINDOW) Causing parent to update\n"));
1168 retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1170 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: Checking for '.backdrop' files\n"));
1173 DoMethod(self, MUIM_IconList_NextIcon, MUIV_IconList_NextIcon_Visible, (IPTR)&icon_entry);
1174 if (
1175 ((IPTR)icon_entry != MUIV_IconList_NextIcon_End) &&
1176 ((icon_entry->type == ST_ROOT) && !(icon_entry->flags & ICONENTRY_VOL_OFFLINE))
1179 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: checking entry '%s'\n", icon_entry->label));
1180 if (IconWindowIconList__Func_ParseBackdrop(CLASS, self, icon_entry->label))
1181 sort_list = TRUE;
1183 else
1185 break;
1187 } while (TRUE);
1189 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: Check if we should show NetworkBrowser Icon ..\n"));
1191 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
1193 if (prefs)
1195 struct IconWindowIconVolumeList_DATA *volumel_data = (struct IconWindowIconVolumeList_DATA *)data;
1197 GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &volumel_data->iwvcd_ShowNetworkBrowser);
1199 #if defined(DEBUG_NETWORKBROWSER)
1200 volumel_data->iwvcd_ShowNetworkBrowser = TRUE;
1201 #endif
1203 if (volumel_data->iwvcd_ShowNetworkBrowser)
1205 struct DiskObject *_nb_dob = NULL;
1206 _nb_dob = GetIconTags
1208 "ENV:SYS/def_NetworkHost",
1209 ICONGETA_FailIfUnavailable, FALSE,
1210 ICONGETA_Label, (IPTR)"Network Access..",
1211 TAG_DONE
1214 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: NetworkBrowser Icon DOB @ 0x%p\n", _nb_dob));
1216 if (_nb_dob)
1218 struct Node *this_entry = NULL;
1219 if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)"?wanderer.networkbrowse?", (IPTR)"Network Access..", (IPTR)NULL, (IPTR)_nb_dob, 0)))
1221 this_entry->ln_Pri = 3; /// Network Access gets Priority 3 so its displayed after special dirs
1222 sort_list = TRUE;
1223 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: NetworkBrowser Icon Entry @ 0x%p\n", this_entry));
1228 GET(prefs, MUIA_IconWindowExt_UserFiles_ShowFilesFolder, &volumel_data->iwvcd_ShowUserFolder);
1230 #if defined(DEBUG_SHOWUSERFILES)
1231 volumel_data->iwvcd_ShowUserFolder = TRUE;
1232 #endif
1233 if (volumel_data->iwvcd_ShowUserFolder)
1235 if (GetVar("SYS/UserFilesLocation", __icwc_intern_TxtBuff, TXTBUFF_LEN, GVF_GLOBAL_ONLY) != -1)
1237 char * userfiles_path = NULL;
1239 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: SYS/UserFilesLocation = '%s'\n", __icwc_intern_TxtBuff));
1241 if ((userfiles_path = AllocVec(strlen(__icwc_intern_TxtBuff) + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
1243 struct DiskObject *_nb_dob = NULL;
1245 volumel_data->iwvcd_UserFolderPath = userfiles_path;
1247 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage @ 0x%p\n", userfiles_path));
1249 strcpy(userfiles_path, __icwc_intern_TxtBuff);
1251 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage contains '%s'\n", userfiles_path));
1253 _nb_dob = GetIconTags
1255 "ENV:SYS/def_UserHome",
1256 ICONGETA_FailIfUnavailable, FALSE,
1257 ICONGETA_Label, (IPTR)"User Files..",
1258 TAG_DONE
1261 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: UserFiles Icon DOB @ 0x%p\n", _nb_dob));
1263 if (_nb_dob)
1265 struct Node *this_entry = NULL;
1266 if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, userfiles_path, (IPTR)"User Files..", (IPTR)NULL, (IPTR)_nb_dob, 0)))
1268 this_entry->ln_Pri = 5; /// Special dirs get Priority 5
1269 sort_list = TRUE;
1275 if (sort_list) DoMethod(self, MUIM_IconList_Sort);
1278 else
1280 retVal = TRUE;
1281 DoMethod(self, MUIM_IconList_Clear);
1284 return retVal;
1287 /*** Setup ******************************************************************/
1288 #ifdef __AROS__
1289 ICONWINDOWICONDRAWERLIST_CUSTOMCLASS
1291 IconWindowIconDrawerList, IconWindowIconList, NULL, MUIC_IconDrawerList, NULL,
1292 OM_NEW, struct opSet *,
1293 OM_SET, struct opSet *,
1294 OM_GET, struct opGet *,
1295 MUIM_Setup, Msg,
1296 MUIM_Cleanup, Msg,
1297 MUIM_DrawBackground, Msg
1300 ICONWINDOWICONVOLUMELIST_CUSTOMCLASS
1302 IconWindowIconVolumeList, IconWindowIconList, NULL, MUIC_IconVolumeList, NULL,
1303 OM_NEW, struct opSet *,
1304 OM_SET, struct opSet *,
1305 OM_GET, struct opGet *,
1306 MUIM_Setup, Msg,
1307 MUIM_Cleanup, Msg,
1308 MUIM_DrawBackground, Msg,
1309 MUIM_HandleEvent, Msg,
1310 MUIM_IconList_Update, struct MUIP_IconList_Update *
1313 ICONWINDOWICONNETWORKBROWSERLIST_CUSTOMCLASS
1315 IconWindowIconNetworkBrowserList, IconWindowIconList, NULL, MUIC_IconList, NULL,
1316 OM_NEW, struct opSet *,
1317 OM_SET, struct opSet *,
1318 OM_GET, struct opGet *,
1319 MUIM_Setup, Msg,
1320 MUIM_Cleanup, Msg,
1321 MUIM_DrawBackground, Msg,
1322 MUIM_HandleEvent, Msg,
1323 MUIM_IconList_Update, struct MUIP_IconList_Update *
1326 #else
1327 ICONWINDOWICONDRAWERLIST_CUSTOMCLASS
1329 IconWindowIconDrawerList, IconWindowIconList, NULL, NULL, IconDrawerList_Class,
1330 OM_NEW, struct opSet *,
1331 OM_SET, struct opSet *,
1332 OM_GET, struct opGet *,
1333 MUIM_Setup, Msg,
1334 MUIM_Cleanup, Msg,
1335 MUIM_DrawBackground, Msg
1338 ICONWINDOWICONVOLUMELIST_CUSTOMCLASS
1340 IconWindowIconVolumeList, IconWindowIconList, NULL, NULL, IconVolumeList_Class,
1341 OM_NEW, struct opSet *,
1342 OM_SET, struct opSet *,
1343 OM_GET, struct opGet *,
1344 MUIM_Setup, Msg,
1345 MUIM_Cleanup, Msg,
1346 MUIM_DrawBackground, Msg,
1347 MUIM_HandleEvent, Msg,
1348 MUIM_IconList_Update, struct MUIP_IconList_Update *
1351 ICONWINDOWICONNETWORKBROWSERLIST_CUSTOMCLASS
1353 IconWindowIconNetworkBrowserList, IconWindowIconList, NULL, NULL, IconList_Class,
1354 OM_NEW, struct opSet *,
1355 OM_SET, struct opSet *,
1356 OM_GET, struct opGet *,
1357 MUIM_Setup, Msg,
1358 MUIM_Cleanup, Msg,
1359 MUIM_DrawBackground, Msg,
1360 MUIM_HandleEvent, Msg,
1361 MUIM_IconList_Update, struct MUIP_IconList_Update *
1363 #endif