Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / system / Wanderer / iconwindow_networkbrowserlist.c
blobb10f4d946ed9b3de87d1314b1ff0720cf420a7ea
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);
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);
517 else if (data->iwcd_IconWindow)
519 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
522 AROS_USERFUNC_EXIT
524 #ifndef __AROS__
525 MakeStaticHook(Hook_UpdateNetworkPrefsFunc,IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc);
526 #endif
528 #define BDRPLINELEN_MAX 1024
529 BOOL IconWindowIconList__Func_ParseBackdrop(Class *CLASS, Object *self, char *bdrp_dir)
531 BPTR bdrp_lock = (BPTR)NULL;
532 char *bdrp_file = NULL, *linebuf = NULL, *bdrp_fullfile = NULL, *bdrp_namepart = NULL;
533 struct DiskObject *bdrp_currfile_dob = NULL;
534 BOOL retVal = FALSE;
536 if ((bdrp_dir == NULL) || (bdrp_dir[strlen(bdrp_dir) - 1] != ':'))
537 return retVal;
539 if ((bdrp_file = AllocVec(strlen(bdrp_dir) + 9 + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
541 sprintf(bdrp_file, "%s.backdrop", bdrp_dir);
542 if ((bdrp_lock = Open(bdrp_file, MODE_OLDFILE)))
544 D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: Loading backdrop file: '%s'\n", bdrp_file));
546 if ((linebuf = AllocMem(BDRPLINELEN_MAX, MEMF_PUBLIC)) != NULL)
548 while (FGets(bdrp_lock, linebuf, BDRPLINELEN_MAX))
550 int linelen = 0;
551 if (*linebuf != ':')
552 continue;
554 linelen = strlen(linebuf) - 1; /* drop the newline char */
555 linebuf[linelen] = '\0';
557 if ((bdrp_fullfile = AllocVec(linelen + strlen(bdrp_dir), MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
559 sprintf(bdrp_fullfile, "%s%s", bdrp_dir, &linebuf[1]);
560 bdrp_namepart = FilePart(bdrp_fullfile);
561 bdrp_currfile_dob = GetIconTags
563 bdrp_fullfile,
564 ICONGETA_FailIfUnavailable, FALSE,
565 ICONGETA_Label, bdrp_namepart,
566 TAG_DONE
569 D(bug("[IconWindowIconList] IconWindowIconList__Func_ParseBackdrop: LEAVEOUT Icon '%s' ('%s') DOB @ 0x%p\n", bdrp_fullfile, bdrp_namepart, bdrp_currfile_dob));
571 if (bdrp_currfile_dob)
573 struct IconEntry *this_entry = NULL;
574 if ((this_entry = (struct IconEntry *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)bdrp_fullfile, (IPTR)bdrp_namepart, (IPTR)NULL, (IPTR)bdrp_currfile_dob, 0)))
576 struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
577 if (fib)
579 BPTR fib_lock = (BPTR)NULL;
580 if ((fib_lock = Lock(bdrp_fullfile, SHARED_LOCK)) != NULL)
582 if (Examine(fib_lock, fib))
584 if (fib->fib_DirEntryType == ST_FILE)
586 this_entry->ie_IconListEntry.type = ST_LINKFILE;
587 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKFILE Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
589 else if (fib->fib_DirEntryType == ST_USERDIR)
591 this_entry->ie_IconListEntry.type = ST_LINKDIR;
592 D(bug("[IconWindowIconList] %s: LEAVEOUT ST_LINKDIR Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
594 else
596 D(bug("[IconWindowIconList] %s: LEAVEOUT Unknown Entry Type @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
599 UnLock(fib_lock);
601 FreeDosObject(DOS_FIB, fib);
603 retVal = TRUE;
608 FreeMem(linebuf, BDRPLINELEN_MAX);
610 Close(bdrp_lock);
612 FreeVec(bdrp_file);
614 return retVal;
618 /*** Methods ****************************************************************/
619 ///OM_NEW()
620 Object *IconWindowIconList__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
622 IPTR _newIconList__FSNotifyPort = 0;
624 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW()\n"));
626 _newIconList__FSNotifyPort = GetTagData(MUIA_Wanderer_FileSysNotifyPort, (IPTR) NULL, message->ops_AttrList);
628 self = (Object *) DoSuperNewTags
630 CLASS, self, NULL,
631 MUIA_CycleChain, 1,
632 TAG_MORE, (IPTR) message->ops_AttrList
635 if (self != NULL)
637 SETUP_INST_DATA;
638 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW: SELF = 0x%p\n", self));
640 #ifdef __AROS__
641 data->iwcd_ProcessIconListPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowIconList__HookFunc_ProcessIconListPrefsFunc;
642 #else
643 data->iwcd_ProcessIconListPrefs_hook = &Hook_ProcessIconListPrefsFunc;
644 #endif
646 if (_newIconList__FSNotifyPort != 0)
648 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
649 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port = _newIconList__FSNotifyPort;
650 D(bug("[IconWindowIconList] IconWindowIconList__OM_NEW: FS Notify Port @ 0x%p\n", _newIconList__FSNotifyPort));
653 D(bug("[IconWindowIconList] obj = %ld\n", self));
655 return self;
659 ///OM_SET()
660 IPTR IconWindowIconList__OM_SET(Class *CLASS, Object *self, struct opSet *message)
662 SETUP_INST_DATA;
664 struct TagItem *tstate = message->ops_AttrList, *tag;
666 while ((tag = NextTagItem((const struct TagItem**)&tstate)) != NULL)
668 switch (tag->ti_Tag)
670 case MUIA_Background:
672 D(bug("[IconWindowIconList] %s: MUIA_Background\n", __PRETTY_FUNCTION__));
673 break;
675 case MUIA_IconWindow_Window:
677 D(bug("[IconWindowIconList] %s: MUIA_IconWindow_Window @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
678 data->iwcd_IconWindow = (Object *)tag->ti_Data;
679 break;
681 case MUIA_IconList_BufferRastport:
683 D(bug("[IconWindowIconList] %s: MUIA_IconList_BufferRastport @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
684 data->iwcd_RastPort = (struct RastPort *)tag->ti_Data;
685 break;
689 return DoSuperMethodA(CLASS, self, (Msg) message);
693 ///OM_GET()
694 IPTR IconWindowIconList__OM_GET(Class *CLASS, Object *self, struct opGet *message)
696 //SETUP_INST_DATA;
697 //IPTR *store = message->opg_Storage;
698 IPTR rv = TRUE;
700 switch (message->opg_AttrID)
702 default:
703 rv = DoSuperMethodA(CLASS, self, (Msg) message);
706 return rv;
710 ///IconWindowIconList__MUIM_Setup()
711 IPTR IconWindowIconList__MUIM_Setup
713 Class *CLASS, Object *self, Msg message
716 SETUP_INST_DATA;
718 Object *prefs = NULL;
720 if (!DoSuperMethodA(CLASS, self, message)) return FALSE;
722 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
724 if (prefs)
726 /* Set our initial options */
727 IPTR attrib_Prefs;
729 GET(_win(self), MUIA_IconWindow_BackgroundAttrib, &data->iwcd_ViewPrefs_ID);
730 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Setup: Window Background = '%s'\n", data->iwcd_ViewPrefs_ID));
731 data->iwcd_ViewPrefs_NotificationObject = (Object *)DoMethod(prefs,
732 MUIM_WandererPrefs_ViewSettings_GetNotifyObject,
733 data->iwcd_ViewPrefs_ID);
735 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Setup: Background Notification Obj @ 0x%p\n", data->iwcd_ViewPrefs_NotificationObject));
737 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_IconListMode);
738 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_IconListMode))) SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
740 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_Mode);
741 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_Mode))) SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
743 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen);
744 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MaxLineLen))) SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
746 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine);
747 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLine))) SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
749 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus);
750 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLineOnFocus))) SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
752 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing);
753 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_HorizontalSpacing))) SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
755 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing);
756 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_VerticalSpacing))) SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
758 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing);
759 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_ImageSpacing))) SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
761 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding);
762 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_HorizontalPadding))) SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
764 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding);
765 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_VerticalPadding))) SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
767 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth);
768 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderWidth))) SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
770 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight);
771 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderHeight))) SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
773 /* Configure notifications incase they get updated =) */
774 DoMethod
776 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_IconListMode, MUIV_EveryTime,
777 (IPTR) self, 3,
778 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_IconListMode
781 DoMethod
783 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_Mode, MUIV_EveryTime,
784 (IPTR) self, 3,
785 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_Mode
788 DoMethod
790 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MaxLineLen, MUIV_EveryTime,
791 (IPTR) self, 3,
792 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MaxLineLen
795 DoMethod
797 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLine, MUIV_EveryTime,
798 (IPTR) self, 3,
799 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLine
802 DoMethod
804 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLineOnFocus, MUIV_EveryTime,
805 (IPTR) self, 3,
806 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLineOnFocus
809 DoMethod
811 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_HorizontalSpacing, MUIV_EveryTime,
812 (IPTR) self, 3,
813 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_HorizontalSpacing
816 DoMethod
818 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_VerticalSpacing, MUIV_EveryTime,
819 (IPTR) self, 3,
820 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_VerticalSpacing
823 DoMethod
825 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_ImageSpacing, MUIV_EveryTime,
826 (IPTR) self, 3,
827 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_ImageSpacing
830 DoMethod
832 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_HorizontalPadding, MUIV_EveryTime,
833 (IPTR) self, 3,
834 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_HorizontalPadding
837 DoMethod
839 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_VerticalPadding, MUIV_EveryTime,
840 (IPTR) self, 3,
841 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_VerticalPadding
844 DoMethod
846 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderWidth, MUIV_EveryTime,
847 (IPTR) self, 3,
848 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderWidth
851 DoMethod
853 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderHeight, MUIV_EveryTime,
854 (IPTR) self, 3,
855 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderHeight
859 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
861 if (prefs)
863 #ifdef __AROS__
864 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowIconList__HookFunc_UpdateNetworkPrefsFunc;
865 #else
866 ((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook = &Hook_UpdateNetworkPrefsFunc;
867 #endif
869 DoMethod
871 prefs, MUIM_Notify, MUIA_IconWindowExt_NetworkBrowser_Show, MUIV_EveryTime,
872 (IPTR) self, 3,
873 MUIM_CallHook, &((struct IconWindowIconVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook, (IPTR)CLASS
877 if (muiRenderInfo(self))
879 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Setting up EventHandler for (IDCMP_DISKINSERTED | IDCMP_DISKREMOVED)\n"));
881 data->iwcd_EventHandlerNode.ehn_Priority = 1;
882 data->iwcd_EventHandlerNode.ehn_Flags = MUI_EHF_GUIMODE;
883 data->iwcd_EventHandlerNode.ehn_Object = self;
884 data->iwcd_EventHandlerNode.ehn_Class = CLASS;
885 data->iwcd_EventHandlerNode.ehn_Events = IDCMP_DISKINSERTED | IDCMP_DISKREMOVED;
887 DoMethod(_win(self), MUIM_Window_AddEventHandler, &data->iwcd_EventHandlerNode);
889 else
891 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Couldnt add IDCMP EventHandler!\n"));
894 else
896 /* Setup notification on the directory -------------------------------- */
897 STRPTR directory_path = NULL;
898 GET(self, MUIA_IconDrawerList_Drawer, &directory_path);
900 if (directory_path != NULL)
902 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
904 if (drawerlist_data->iwdcd_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port != NULL)
906 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name = directory_path;
907 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Flags = NRF_SEND_MESSAGE;
908 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_UserData = self;
910 if (StartNotify(&drawerlist_data->iwdcd_DrawerNotifyRequest))
912 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Drawer-notification setup on '%s'\n", drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name));
914 else
916 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: FAILED to setup Drawer-notification!\n"));
917 drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name = NULL;
923 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: Setup complete!\n"));
925 return TRUE;
929 ///IconWindowIconList__MUIM_Cleanup()
930 IPTR IconWindowIconList__MUIM_Cleanup
932 Class *CLASS, Object *self, Msg message
935 SETUP_INST_DATA;
937 Object *prefs = NULL;
939 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup()\n"));
940 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
942 if (prefs)
944 DoMethod
946 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_IconListMode, (IPTR)self
949 DoMethod
951 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_Mode, (IPTR)self
954 DoMethod
956 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MaxLineLen, (IPTR)self
959 DoMethod
961 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLine, (IPTR)self
964 DoMethod
966 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLineOnFocus, (IPTR)self
969 DoMethod
971 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_HorizontalSpacing, (IPTR)self
974 DoMethod
976 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_VerticalSpacing, (IPTR)self
979 DoMethod
981 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_ImageSpacing, (IPTR)self
984 DoMethod
986 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_HorizontalPadding, (IPTR)self
989 DoMethod
991 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_VerticalPadding, (IPTR)self
994 DoMethod
996 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderWidth, (IPTR)self
999 DoMethod
1001 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderHeight, (IPTR)self
1005 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
1007 if (prefs)
1009 DoMethod
1011 prefs,
1012 MUIM_KillNotifyObj, MUIA_IconWindowExt_NetworkBrowser_Show, (IPTR) self
1015 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup: (ROOT WINDOW) Removing our Disk Event Handler\n"));
1016 DoMethod(_win(self), MUIM_Window_RemEventHandler, &data->iwcd_EventHandlerNode);
1018 else
1020 struct IconWindowIconDrawerList_DATA *drawerlist_data = (struct IconWindowIconDrawerList_DATA *)data;
1021 if (drawerlist_data->iwdcd_DrawerNotifyRequest.nr_Name != NULL)
1023 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Cleanup: (DRAWER WINDOW) Removing our Drawer Notification Request\n"));
1024 EndNotify(&drawerlist_data->iwdcd_DrawerNotifyRequest);
1028 return DoSuperMethodA(CLASS, self, message);
1032 ///IconWindowIconList__MUIM_HandleEvent()
1033 IPTR IconWindowIconList__MUIM_HandleEvent
1035 Class *CLASS, Object *self, struct MUIP_HandleEvent *message
1038 //SETUP_INST_DATA;
1040 struct IntuiMessage *imsg = message->imsg;
1042 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent()\n"));
1044 if(imsg->Class == IDCMP_DISKINSERTED)
1046 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent: IDCMP_DISKINSERTED\n"));
1047 DoMethod(self, MUIM_IconList_Update);
1048 return(MUI_EventHandlerRC_Eat);
1050 else if (imsg->Class == IDCMP_DISKREMOVED)
1052 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_HandleEvent: IDCMP_DISKREMOVED\n"));
1053 DoMethod(self, MUIM_IconList_Update);
1054 return(MUI_EventHandlerRC_Eat);
1056 return 0;
1060 ///IconWindowIconList__MUIM_DrawBackground()
1061 IPTR IconWindowIconList__MUIM_DrawBackground
1063 Class *CLASS, Object *self, struct MUIP_DrawBackground *message
1066 SETUP_INST_DATA;
1068 IPTR retVal = (IPTR)TRUE;
1069 IPTR clip = 0;
1070 struct RastPort *DrawBackGround_RastPort;
1071 struct IconWindowBackFillMsg DrawBackGround_BackFillMsg;
1073 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground()\n"));
1075 if ((iconwindow_BackFill_Active == NULL) ||
1076 (data->iwcd_IconWindow == NULL))
1078 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: No Backfill support/Window not set .. causing parent class to render\n"));
1079 goto iwc_ParentBackground;
1082 DrawBackGround_RastPort = _rp(self);
1084 if ((data->iwcd_RastPort != NULL) && (DrawBackGround_RastPort != data->iwcd_RastPort))
1086 DrawBackGround_RastPort = data->iwcd_RastPort;
1088 DrawBackGround_BackFillMsg.AreaBounds.MinX = 0;
1089 DrawBackGround_BackFillMsg.AreaBounds.MinY = 0;
1090 DrawBackGround_BackFillMsg.AreaBounds.MaxX = _mwidth(self);
1091 DrawBackGround_BackFillMsg.AreaBounds.MaxY = _mheight(self);
1093 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left - _mleft(self);
1094 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top - _mtop(self);
1095 DrawBackGround_BackFillMsg.DrawBounds.MaxX = message->width;
1096 DrawBackGround_BackFillMsg.DrawBounds.MaxY = message->height;
1098 else
1100 DrawBackGround_BackFillMsg.AreaBounds.MinX = _mleft(self);
1101 DrawBackGround_BackFillMsg.AreaBounds.MinY = _mtop(self);
1102 DrawBackGround_BackFillMsg.AreaBounds.MaxX = (_mleft(self) + _mwidth(self));
1103 DrawBackGround_BackFillMsg.AreaBounds.MaxY = (_mtop(self) + _mheight(self));
1105 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left;
1106 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top;
1107 DrawBackGround_BackFillMsg.DrawBounds.MaxX = (message->left + message->width);
1108 DrawBackGround_BackFillMsg.DrawBounds.MaxY = (message->top + message->height);
1111 DrawBackGround_BackFillMsg.Layer = DrawBackGround_RastPort->Layer;
1113 /* Offset into source image (ala scroll bar position) */
1114 DrawBackGround_BackFillMsg.OffsetX = message->xoffset;
1115 DrawBackGround_BackFillMsg.OffsetY = message->yoffset;
1117 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: RastPort @ 0x%p\n", DrawBackGround_RastPort));
1119 if ((retVal = DoMethod(data->iwcd_IconWindow, MUIM_IconWindow_BackFill_DrawBackground, XGET(data->iwcd_IconWindow, MUIA_IconWindow_BackFillData), &DrawBackGround_BackFillMsg, DrawBackGround_RastPort)) == (IPTR)TRUE)
1121 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: Backfill module rendered background ..\n"));
1122 return retVal;
1124 D(bug("[IconWindow] IconWindowIconList__MUIM_DrawBackground: Backfill module failed to render background ..\n"));
1126 iwc_ParentBackground:
1128 clip = (IPTR)MUI_AddClipping(muiRenderInfo(self), message->left, message->top, message->width, message->height);
1130 message->width = _mwidth(self);
1131 message->height = _mheight(self);
1132 message->left = _mleft(self);
1133 message->top = _mtop(self);
1135 retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1137 MUI_RemoveClipping(muiRenderInfo(self), (APTR)clip);
1139 return retVal;
1143 ///IconWindowIconList__MUIM_IconList_Update()
1144 IPTR IconWindowIconList__MUIM_IconList_Update
1146 Class *CLASS, Object *self, struct MUIP_IconList_Update *message
1149 SETUP_INST_DATA;
1151 IPTR retVal = (IPTR)TRUE;
1153 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
1155 struct IconList_Entry *icon_entry = (IPTR)MUIV_IconList_NextIcon_Start;
1156 Object *prefs = NULL;
1157 BOOL sort_list = FALSE;
1159 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: (ROOT WINDOW) Causing parent to update\n"));
1160 retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1162 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: Checking for '.backdrop' files\n"));
1165 DoMethod(self, MUIM_IconList_NextIcon, MUIV_IconList_NextIcon_Visible, (IPTR)&icon_entry);
1166 if (
1167 ((IPTR)icon_entry != MUIV_IconList_NextIcon_End) &&
1168 ((icon_entry->type == ST_ROOT) && !(icon_entry->flags & ICONENTRY_VOL_OFFLINE))
1171 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: checking entry '%s'\n", icon_entry->label));
1172 if (IconWindowIconList__Func_ParseBackdrop(CLASS, self, icon_entry->label))
1173 sort_list = TRUE;
1175 else
1177 break;
1179 } while (TRUE);
1181 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: Check if we should show NetworkBrowser Icon ..\n"));
1183 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
1185 if (prefs)
1187 struct IconWindowIconVolumeList_DATA *volumel_data = (struct IconWindowIconVolumeList_DATA *)data;
1189 GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &volumel_data->iwvcd_ShowNetworkBrowser);
1191 #if defined(DEBUG_NETWORKBROWSER)
1192 volumel_data->iwvcd_ShowNetworkBrowser = TRUE;
1193 #endif
1195 if (volumel_data->iwvcd_ShowNetworkBrowser)
1197 struct DiskObject *_nb_dob = NULL;
1198 _nb_dob = GetIconTags
1200 "ENV:SYS/def_NetworkHost",
1201 ICONGETA_FailIfUnavailable, FALSE,
1202 ICONGETA_Label, (IPTR)"Network Access..",
1203 TAG_DONE
1206 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: NetworkBrowser Icon DOB @ 0x%p\n", _nb_dob));
1208 if (_nb_dob)
1210 struct Node *this_entry = NULL;
1211 if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)"?wanderer.networkbrowse?", (IPTR)"Network Access..", (IPTR)NULL, (IPTR)_nb_dob, 0)))
1213 this_entry->ln_Pri = 3; /// Network Access gets Priority 3 so its displayed after special dirs
1214 sort_list = TRUE;
1215 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: NetworkBrowser Icon Entry @ 0x%p\n", this_entry));
1220 GET(prefs, MUIA_IconWindowExt_UserFiles_ShowFilesFolder, &volumel_data->iwvcd_ShowUserFolder);
1222 #if defined(DEBUG_SHOWUSERFILES)
1223 volumel_data->iwvcd_ShowUserFolder = TRUE;
1224 #endif
1225 if (volumel_data->iwvcd_ShowUserFolder)
1227 if (GetVar("SYS/Wanderer/userfiles.prefs", __icwc_intern_TxtBuff, TXTBUFF_LEN, GVF_GLOBAL_ONLY) != -1)
1229 char * userfiles_path = NULL;
1231 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: SYS/UserFilesLocation = '%s'\n", __icwc_intern_TxtBuff));
1233 if ((userfiles_path = AllocVec(strlen(__icwc_intern_TxtBuff) + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
1235 struct DiskObject *_nb_dob = NULL;
1237 volumel_data->iwvcd_UserFolderPath = userfiles_path;
1239 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage @ 0x%p\n", userfiles_path));
1241 strcpy(userfiles_path, __icwc_intern_TxtBuff);
1243 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_IconList_Update: UserFilesLocation Path storage contains '%s'\n", userfiles_path));
1245 _nb_dob = GetIconTags
1247 "ENV:SYS/def_UserHome",
1248 ICONGETA_FailIfUnavailable, FALSE,
1249 ICONGETA_Label, (IPTR)"User Files..",
1250 TAG_DONE
1253 D(bug("[IconWindowIconList] IconWindowIconList__MUIM_Window_Setup: UserFiles Icon DOB @ 0x%p\n", _nb_dob));
1255 if (_nb_dob)
1257 struct Node *this_entry = NULL;
1258 if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, userfiles_path, (IPTR)"User Files..", (IPTR)NULL, (IPTR)_nb_dob, 0)))
1260 this_entry->ln_Pri = 5; /// Special dirs get Priority 5
1261 sort_list = TRUE;
1267 if (sort_list) DoMethod(self, MUIM_IconList_Sort);
1270 else
1272 retVal = TRUE;
1273 DoMethod(self, MUIM_IconList_Clear);
1276 return retVal;
1279 /*** Setup ******************************************************************/
1280 #ifdef __AROS__
1281 ICONWINDOWICONDRAWERLIST_CUSTOMCLASS
1283 IconWindowIconDrawerList, IconWindowIconList, NULL, MUIC_IconDrawerList, NULL,
1284 OM_NEW, struct opSet *,
1285 OM_SET, struct opSet *,
1286 OM_GET, struct opGet *,
1287 MUIM_Setup, Msg,
1288 MUIM_Cleanup, Msg,
1289 MUIM_DrawBackground, Msg
1292 ICONWINDOWICONVOLUMELIST_CUSTOMCLASS
1294 IconWindowIconVolumeList, IconWindowIconList, NULL, MUIC_IconVolumeList, NULL,
1295 OM_NEW, struct opSet *,
1296 OM_SET, struct opSet *,
1297 OM_GET, struct opGet *,
1298 MUIM_Setup, Msg,
1299 MUIM_Cleanup, Msg,
1300 MUIM_DrawBackground, Msg,
1301 MUIM_HandleEvent, Msg,
1302 MUIM_IconList_Update, struct MUIP_IconList_Update *
1305 ICONWINDOWICONNETWORKBROWSERLIST_CUSTOMCLASS
1307 IconWindowIconNetworkBrowserList, IconWindowIconList, NULL, MUIC_IconList, NULL,
1308 OM_NEW, struct opSet *,
1309 OM_SET, struct opSet *,
1310 OM_GET, struct opGet *,
1311 MUIM_Setup, Msg,
1312 MUIM_Cleanup, Msg,
1313 MUIM_DrawBackground, Msg,
1314 MUIM_HandleEvent, Msg,
1315 MUIM_IconList_Update, struct MUIP_IconList_Update *
1318 #else
1319 ICONWINDOWICONDRAWERLIST_CUSTOMCLASS
1321 IconWindowIconDrawerList, IconWindowIconList, NULL, NULL, IconDrawerList_Class,
1322 OM_NEW, struct opSet *,
1323 OM_SET, struct opSet *,
1324 OM_GET, struct opGet *,
1325 MUIM_Setup, Msg,
1326 MUIM_Cleanup, Msg,
1327 MUIM_DrawBackground, Msg
1330 ICONWINDOWICONVOLUMELIST_CUSTOMCLASS
1332 IconWindowIconVolumeList, IconWindowIconList, NULL, NULL, IconVolumeList_Class,
1333 OM_NEW, struct opSet *,
1334 OM_SET, struct opSet *,
1335 OM_GET, struct opGet *,
1336 MUIM_Setup, Msg,
1337 MUIM_Cleanup, Msg,
1338 MUIM_DrawBackground, Msg,
1339 MUIM_HandleEvent, Msg,
1340 MUIM_IconList_Update, struct MUIP_IconList_Update *
1343 ICONWINDOWICONNETWORKBROWSERLIST_CUSTOMCLASS
1345 IconWindowIconNetworkBrowserList, IconWindowIconList, NULL, NULL, IconList_Class,
1346 OM_NEW, struct opSet *,
1347 OM_SET, struct opSet *,
1348 OM_GET, struct opGet *,
1349 MUIM_Setup, Msg,
1350 MUIM_Cleanup, Msg,
1351 MUIM_DrawBackground, Msg,
1352 MUIM_HandleEvent, Msg,
1353 MUIM_IconList_Update, struct MUIP_IconList_Update *
1355 #endif