Fixes to comments.
[AROS.git] / workbench / system / Wanderer / iconwindow_networkbrowserlist.c
blobbbb60e8b8639f3b6b02469b24edeec7a41d8407a
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 "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;
139 char *iwvcd_UserFolderPath;
142 struct IconWindowIconNetworkBrowserList_DATA
144 Object *iwcd_IconWindow;
145 struct RastPort *iwcd_RastPort;
146 struct MUI_EventHandlerNode iwcd_EventHandlerNode;
147 #ifdef __AROS__
148 struct Hook iwcd_ProcessIconListPrefs_hook;
149 #else
150 struct Hook *iwcd_ProcessIconListPrefs_hook;
151 #endif
153 IPTR iwcd_ViewPrefs_ID;
154 Object *iwcd_ViewPrefs_NotificationObject;
155 struct Hook iwnbcd_UpdateNetworkPrefs_hook;
156 struct List iwnbcd_NetworkClasses;
159 static char __icwc_intern_TxtBuff[TXTBUFF_LEN];
161 /*** Macros *****************************************************************/
162 #define SETUP_INST_DATA struct IconWindowIconList_DATA *data = INST_DATA(CLASS, self)
164 /*** Hook functions *********************************************************/
165 ///IconWindowIconList__HookFunc_ProcessIconListPrefsFunc()
166 #ifdef __AROS__
167 AROS_UFH3(
168 void, IconWindowIconList__HookFunc_ProcessIconListPrefsFunc,
169 AROS_UFHA(struct Hook *, hook, A0),
170 AROS_UFHA(APTR *, obj, A2),
171 AROS_UFHA(IPTR *, param, A1)
174 #else
175 HOOKPROTO(IconWindowIconList__HookFunc_ProcessIconListPrefsFunc, void, APTR *obj, IPTR *param)
177 #endif
178 AROS_USERFUNC_INIT
180 /* Get our private data */
181 Object *self = ( Object *)obj;
182 IPTR CHANGED_ATTRIB = *param;
183 Class *CLASS = OCLASS(self);
185 SETUP_INST_DATA;
187 Object *prefs = NULL;
189 D(bug("[IconWindowIconList] %s()\n", __PRETTY_FUNCTION__));
191 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
193 if (prefs)
195 IPTR attrib_Current, attrib_Prefs, prefs_Processing = 0;
196 BOOL options_changed = FALSE;
198 D(bug("[IconWindowIconList] %s: Setting IconList options ..\n", __PRETTY_FUNCTION__));
200 GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
202 switch (CHANGED_ATTRIB)
204 case MUIA_IconList_IconListMode:
205 GET(self, MUIA_IconList_IconListMode, &attrib_Current);
207 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_IconListMode)) != -1) &&
208 (attrib_Current != attrib_Prefs))
210 D(bug("[IconWindowIconList] %s: IconList ListMode changed - updating ..\n", __PRETTY_FUNCTION__));
211 options_changed = TRUE;
212 if (prefs_Processing)
214 NNSET(self, MUIA_IconList_IconListMode, attrib_Prefs);
216 else
218 SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
221 break;
223 case MUIA_IconList_LabelText_Mode:
224 GET(self, MUIA_IconList_LabelText_Mode, &attrib_Current);
226 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_Mode)) != -1) &&
227 (attrib_Current != attrib_Prefs))
229 D(bug("[IconWindowIconList] %s: IconList TextRenderMode changed - updating ..\n", __PRETTY_FUNCTION__));
230 options_changed = TRUE;
231 if (prefs_Processing)
233 NNSET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
235 else
237 SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
240 break;
242 case MUIA_IconList_LabelText_MaxLineLen:
243 GET(self, MUIA_IconList_LabelText_MaxLineLen, &attrib_Current);
245 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen)) != -1) &&
246 (attrib_Current != attrib_Prefs))
248 D(bug("[IconWindowIconList] %s: IconList Max Text Length changed - updating ..\n", __PRETTY_FUNCTION__));
249 options_changed = TRUE;
250 if (prefs_Processing)
252 NNSET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
254 else
256 SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
259 break;
261 case MUIA_IconList_LabelText_MultiLine:
262 GET(self, MUIA_IconList_LabelText_MultiLine, &attrib_Current);
264 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine)) != -1) &&
265 (attrib_Current != attrib_Prefs))
267 D(bug("[IconWindowIconList] %s: IconList Multi-Line changed - updating ..\n", __PRETTY_FUNCTION__));
268 options_changed = TRUE;
269 if (prefs_Processing)
271 NNSET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
273 else
275 SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
278 break;
280 case MUIA_IconList_LabelText_MultiLineOnFocus:
281 GET(self, MUIA_IconList_LabelText_MultiLineOnFocus, &attrib_Current);
283 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus)) != -1) &&
284 (attrib_Current != attrib_Prefs))
286 D(bug("[IconWindowIconList] %s: Multi-Line on Focus changed - updating ..\n", __PRETTY_FUNCTION__));
287 options_changed = TRUE;
288 if (prefs_Processing)
290 NNSET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
292 else
294 SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
297 break;
299 case MUIA_IconList_Icon_HorizontalSpacing:
300 GET(self, MUIA_IconList_Icon_HorizontalSpacing, &attrib_Current);
302 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing)) != -1) &&
303 (attrib_Current != attrib_Prefs))
305 D(bug("[IconWindowIconList] %s: Icon Horizontal Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
306 options_changed = TRUE;
307 if (prefs_Processing)
309 NNSET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
311 else
313 SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
316 break;
318 case MUIA_IconList_Icon_VerticalSpacing:
319 GET(self, MUIA_IconList_Icon_VerticalSpacing, &attrib_Current);
321 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing)) != -1) &&
322 (attrib_Current != attrib_Prefs))
324 D(bug("[IconWindowIconList] %s: Icon Vertical Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
325 options_changed = TRUE;
326 if (prefs_Processing)
328 NNSET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
330 else
332 SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
335 break;
337 case MUIA_IconList_Icon_ImageSpacing:
338 GET(self, MUIA_IconList_Icon_ImageSpacing, &attrib_Current);
340 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing)) != -1) &&
341 (attrib_Current != attrib_Prefs))
343 D(bug("[IconWindowIconList] %s: Icon Label Image Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
344 options_changed = TRUE;
345 if (prefs_Processing)
347 NNSET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
349 else
351 SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
354 break;
356 case MUIA_IconList_LabelText_HorizontalPadding:
357 GET(self, MUIA_IconList_LabelText_HorizontalPadding, &attrib_Current);
359 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding)) != -1) &&
360 (attrib_Current != attrib_Prefs))
362 D(bug("[IconWindowIconList] %s: Icon Label Horizontal Padding changed - updating ..\n", __PRETTY_FUNCTION__));
363 options_changed = TRUE;
364 if (prefs_Processing)
366 NNSET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
368 else
370 SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
373 break;
375 case MUIA_IconList_LabelText_VerticalPadding:
376 GET(self, MUIA_IconList_LabelText_VerticalPadding, &attrib_Current);
378 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding)) != -1) &&
379 (attrib_Current != attrib_Prefs))
381 D(bug("[IconWindowIconList] %s: Icon Label Vertical Padding changed - updating ..\n", __PRETTY_FUNCTION__));
382 options_changed = TRUE;
383 if (prefs_Processing)
385 NNSET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
387 else
389 SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
392 break;
394 case MUIA_IconList_LabelText_BorderWidth:
395 GET(self, MUIA_IconList_LabelText_BorderWidth, &attrib_Current);
397 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth)) != -1) &&
398 (attrib_Current != attrib_Prefs))
400 D(bug("[IconWindowIconList] %s: Icon Label Border Width changed - updating ..\n", __PRETTY_FUNCTION__));
401 options_changed = TRUE;
402 if (prefs_Processing)
404 NNSET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
406 else
408 SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
411 break;
413 case MUIA_IconList_LabelText_BorderHeight:
414 GET(self, MUIA_IconList_LabelText_BorderHeight, &attrib_Current);
416 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight)) != -1) &&
417 (attrib_Current != attrib_Prefs))
419 D(bug("[IconWindowIconList] %s: Icon Label Border Height changed - updating ..\n", __PRETTY_FUNCTION__));
420 options_changed = TRUE;
421 if (prefs_Processing)
423 NNSET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
425 else
427 SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
430 break;
432 default:
433 D(bug("[IconWindowIconList] %s: Unhandled change\n", __PRETTY_FUNCTION__));
434 break;
437 if (options_changed)
439 if (!(prefs_Processing))
441 D(bug("[IconWindowIconList] %s: IconList Options have changed, causing an update ..\n", __PRETTY_FUNCTION__));
442 DoMethod(self, MUIM_IconList_Update);
443 DoMethod(self, MUIM_IconList_Sort);
445 else if (data->iwcd_IconWindow)
447 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
451 AROS_USERFUNC_EXIT
453 #ifndef __AROS__
454 MakeStaticHook(Hook_ProcessIconListPrefsFunc,IconWindowIconList__HookFunc_ProcessIconListPrefsFunc);
455 #endif
458 ///IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc()
459 #ifdef __AROS__
460 AROS_UFH3(
461 void, IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc,
462 AROS_UFHA(struct Hook *, hook, A0),
463 AROS_UFHA(APTR *, obj, A2),
464 AROS_UFHA(APTR, param, A1)
467 #else
468 HOOKPROTO(IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc, void, APTR *obj, APTR param)
470 #endif
471 AROS_USERFUNC_INIT
473 /* Get our private data */
474 Object *self = ( Object *)obj;
475 Object *prefs = NULL;
476 Class *CLASS = *( Class **)param;
478 SETUP_INST_DATA;
480 D(bug("[IconWindowIconList] %s()\n", __PRETTY_FUNCTION__));
482 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
484 if (prefs)
486 BOOL options_changed = FALSE;
487 IPTR prefs_Processing = 0;
489 GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
491 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
493 IPTR current_ShowNetwork = 0;
494 IPTR prefs_ShowNetwork = 0;
496 D(bug("[IconWindowIconList] %s: Setting ROOT view Network options ..\n", __PRETTY_FUNCTION__));
498 GET(self, MUIA_IconWindowExt_NetworkBrowser_Show, &current_ShowNetwork);
500 D(bug("[IconWindowIconList] %s: Current = %d\n", __PRETTY_FUNCTION__, current_ShowNetwork));
502 GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &prefs_ShowNetwork);
504 D(bug("[IconWindowIconList] %s: Prefs = %d\n", __PRETTY_FUNCTION__, prefs_ShowNetwork));
506 if ((BOOL)current_ShowNetwork != (BOOL)prefs_ShowNetwork)
508 D(bug("[IconWindowIconList] %s: ROOT view Network prefs changed - updating ..\n", __PRETTY_FUNCTION__));
509 options_changed = TRUE;
510 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_ShowNetworkBrowser = prefs_ShowNetwork;
513 if ((options_changed) && !(prefs_Processing))
515 D(bug("[IconWindowIconList] %s: Network prefs changed, causing an update ..\n", __PRETTY_FUNCTION__));
516 DoMethod(self, MUIM_IconList_Update);
517 DoMethod(self, MUIM_IconList_Sort);
519 else if (data->iwcd_IconWindow)
521 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
524 AROS_USERFUNC_EXIT
526 #ifndef __AROS__
527 MakeStaticHook(Hook_UpdateNetworkPrefsFunc,IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc);
528 #endif
530 #define BDRPLINELEN_MAX 1024
531 BOOL IconWindowIconList__Func_ParseBackdrop(Class *CLASS, Object *self, char *bdrp_dir)
533 BPTR bdrp_lock = (BPTR)NULL;
534 char *bdrp_file = NULL, *linebuf = NULL, *bdrp_fullfile = NULL, *bdrp_namepart = NULL;
535 struct DiskObject *bdrp_currfile_dob = NULL;
536 BOOL retVal = FALSE;
538 if ((bdrp_dir == NULL) || (bdrp_dir[strlen(bdrp_dir) - 1] != ':'))
539 return retVal;
541 if ((bdrp_file = AllocVec(strlen(bdrp_dir) + 9 + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
543 sprintf(bdrp_file, "%s.backdrop", bdrp_dir);
544 if ((bdrp_lock = Open(bdrp_file, MODE_OLDFILE)))
546 D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: Loading backdrop file: '%s'\n", bdrp_file));
548 if ((linebuf = AllocMem(BDRPLINELEN_MAX, MEMF_PUBLIC)) != NULL)
550 while (FGets(bdrp_lock, linebuf, BDRPLINELEN_MAX))
552 int linelen = 0;
553 if (*linebuf != ':')
554 continue;
556 linelen = strlen(linebuf) - 1; /* drop the newline char */
557 linebuf[linelen] = '\0';
559 if ((bdrp_fullfile = AllocVec(linelen + strlen(bdrp_dir), MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
561 sprintf(bdrp_fullfile, "%s%s", bdrp_dir, &linebuf[1]);
562 bdrp_namepart = FilePart(bdrp_fullfile);
563 bdrp_currfile_dob = GetIconTags
565 bdrp_fullfile,
566 ICONGETA_FailIfUnavailable, FALSE,
567 ICONGETA_Label, bdrp_namepart,
568 TAG_DONE
571 D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: LEAVEOUT Icon '%s' ('%s') DOB @ 0x%p\n", bdrp_fullfile, bdrp_namepart, bdrp_currfile_dob));
573 if (bdrp_currfile_dob)
575 struct IconEntry *this_entry = NULL;
576 if ((this_entry = (struct IconEntry *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)bdrp_fullfile, (IPTR)bdrp_namepart, (IPTR)NULL, (IPTR)bdrp_currfile_dob, 0)))
578 struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
579 if (fib)
581 BPTR fib_lock = (BPTR)NULL;
582 if ((fib_lock = Lock(bdrp_fullfile, SHARED_LOCK)) != NULL)
584 if (Examine(fib_lock, fib))
586 if (fib->fib_DirEntryType == ST_FILE)
588 this_entry->ie_IconListEntry.type = ST_LINKFILE;
589 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKFILE Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
591 else if (fib->fib_DirEntryType == ST_USERDIR)
593 this_entry->ie_IconListEntry.type = ST_LINKDIR;
594 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKDIR Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
596 else
598 D(bug("[IconWindowIconList] %s: LEAVEOUT Unknown Entry Type @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
601 UnLock(fib_lock);
603 FreeDosObject(DOS_FIB, fib);
605 retVal = TRUE;
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)))
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 volumel_data->iwvcd_UserFolderPath = userfiles_path;
1243 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage @ 0x%p\n", userfiles_path));
1245 strcpy(userfiles_path, __icwc_intern_TxtBuff);
1247 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage contains '%s'\n", userfiles_path));
1249 _nb_dob = GetIconTags
1251 "ENV:SYS/def_UserHome",
1252 ICONGETA_FailIfUnavailable, FALSE,
1253 ICONGETA_Label, (IPTR)"User Files..",
1254 TAG_DONE
1257 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: UserFiles Icon DOB @ 0x%p\n", _nb_dob));
1259 if (_nb_dob)
1261 struct Node *this_entry = NULL;
1262 if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, userfiles_path, (IPTR)"User Files..", (IPTR)NULL, (IPTR)_nb_dob, 0)))
1264 this_entry->ln_Pri = 5; /// Special dirs get Priority 5
1265 sort_list = TRUE;
1271 if (sort_list) DoMethod(self, MUIM_IconList_Sort);
1274 else
1276 retVal = TRUE;
1277 DoMethod(self, MUIM_IconList_Clear);
1280 return retVal;
1283 /*** Setup ******************************************************************/
1284 #ifdef __AROS__
1285 ICONWINDOWICONDRAWERLIST_CUSTOMCLASS
1287 IconWindowIconDrawerList, IconWindowIconList, NULL, MUIC_IconDrawerList, NULL,
1288 OM_NEW, struct opSet *,
1289 OM_SET, struct opSet *,
1290 OM_GET, struct opGet *,
1291 MUIM_Setup, Msg,
1292 MUIM_Cleanup, Msg,
1293 MUIM_DrawBackground, Msg
1296 ICONWINDOWICONVOLUMELIST_CUSTOMCLASS
1298 IconWindowIconVolumeList, IconWindowIconList, NULL, MUIC_IconVolumeList, NULL,
1299 OM_NEW, struct opSet *,
1300 OM_SET, struct opSet *,
1301 OM_GET, struct opGet *,
1302 MUIM_Setup, Msg,
1303 MUIM_Cleanup, Msg,
1304 MUIM_DrawBackground, Msg,
1305 MUIM_HandleEvent, Msg,
1306 MUIM_IconList_Update, struct MUIP_IconList_Update *
1309 ICONWINDOWICONNETWORKBROWSERLIST_CUSTOMCLASS
1311 IconWindowIconNetworkBrowserList, IconWindowIconList, NULL, MUIC_IconList, NULL,
1312 OM_NEW, struct opSet *,
1313 OM_SET, struct opSet *,
1314 OM_GET, struct opGet *,
1315 MUIM_Setup, Msg,
1316 MUIM_Cleanup, Msg,
1317 MUIM_DrawBackground, Msg,
1318 MUIM_HandleEvent, Msg,
1319 MUIM_IconList_Update, struct MUIP_IconList_Update *
1322 #else
1323 ICONWINDOWICONDRAWERLIST_CUSTOMCLASS
1325 IconWindowIconDrawerList, IconWindowIconList, NULL, NULL, IconDrawerList_Class,
1326 OM_NEW, struct opSet *,
1327 OM_SET, struct opSet *,
1328 OM_GET, struct opGet *,
1329 MUIM_Setup, Msg,
1330 MUIM_Cleanup, Msg,
1331 MUIM_DrawBackground, Msg
1334 ICONWINDOWICONVOLUMELIST_CUSTOMCLASS
1336 IconWindowIconVolumeList, IconWindowIconList, NULL, NULL, IconVolumeList_Class,
1337 OM_NEW, struct opSet *,
1338 OM_SET, struct opSet *,
1339 OM_GET, struct opGet *,
1340 MUIM_Setup, Msg,
1341 MUIM_Cleanup, Msg,
1342 MUIM_DrawBackground, Msg,
1343 MUIM_HandleEvent, Msg,
1344 MUIM_IconList_Update, struct MUIP_IconList_Update *
1347 ICONWINDOWICONNETWORKBROWSERLIST_CUSTOMCLASS
1349 IconWindowIconNetworkBrowserList, IconWindowIconList, NULL, NULL, IconList_Class,
1350 OM_NEW, struct opSet *,
1351 OM_SET, struct opSet *,
1352 OM_GET, struct opGet *,
1353 MUIM_Setup, Msg,
1354 MUIM_Cleanup, Msg,
1355 MUIM_DrawBackground, Msg,
1356 MUIM_HandleEvent, Msg,
1357 MUIM_IconList_Update, struct MUIP_IconList_Update *
1359 #endif