2 Copyright 2004-2011, The AROS Development Team. All rights reserved.
8 #include "portable_macros.h"
11 #define MUIMASTER_YES_INLINE_STDARG
14 //#define DEBUG_NETWORKBROWSER
15 //#define DEBUG_SHOWUSERFILES
16 #define TXTBUFF_LEN 1024
20 #include <aros/debug.h>
23 #include <exec/types.h>
24 #include <libraries/mui.h>
27 #include <zune/customclasses.h>
29 #include <zune_AROS/customclasses.h>
33 #include <proto/utility.h>
35 #include <proto/graphics.h>
36 #include <proto/exec.h>
37 #include <proto/datatypes.h>
38 #include <proto/icon.h>
41 #include <proto/dos.h>
46 #include <intuition/screens.h>
47 #include <datatypes/pictureclass.h>
48 #include <clib/macros.h>
50 #if defined(__AMIGA__) && !defined(__PPC__)
51 #define NO_INLINE_STDARG
53 #ifndef _PROTO_INTUITION_H
54 #include <proto/intuition.h>
56 #include <proto/muimaster.h>
58 #include "Classes/iconlist.h"
59 #include "Classes/iconlist_attributes.h"
60 #include "Classes/icon_attributes.h"
63 #include "wandererprefs.h"
64 #include "iconwindow.h"
65 #include "iconwindow_iconlist.h"
66 #include "appobjects.h"
72 #define D(x) if (DEBUG) x
74 #define bug DebugPrintF
83 extern struct IconWindow_BackFill_Descriptor
*iconwindow_BackFill_Active
;
88 #define BG_DRAWFLAG 0xf00dd00f
90 /*** Instance Data **********************************************************/
92 struct IconWindowVolumeList_DATA
94 Object
*iwcd_IconWindow
;
95 struct RastPort
*iwcd_RastPort
;
96 struct MUI_EventHandlerNode iwcd_EventHandlerNode
;
98 struct Hook iwcd_ProcessIconListPrefs_hook
;
100 struct Hook
*iwcd_ProcessIconListPrefs_hook
;
103 IPTR iwcd_ViewPrefs_ID
;
104 Object
*iwcd_ViewPrefs_NotificationObject
;
106 struct Hook iwvcd_UpdateNetworkPrefs_hook
;
108 struct Hook
*iwvcd_UpdateNetworkPrefs_hook
;
111 IPTR iwvcd_ShowNetworkBrowser
;
112 IPTR iwvcd_ShowUserFolder
;
113 char *iwvcd_UserFolderPath
;
115 /* File System update handling */
116 struct MsgPort
*iwvcd_FSNotifyPort
;
119 static char __icwc_intern_TxtBuff
[TXTBUFF_LEN
];
121 /*** Macros *****************************************************************/
122 #define SETUP_INST_DATA struct IconWindowVolumeList_DATA *data = INST_DATA(CLASS, self)
124 /*** Hook functions *********************************************************/
125 ///IconWindowVolumeList__HookFunc_ProcessIconListPrefsFunc()
128 void, IconWindowVolumeList__HookFunc_ProcessIconListPrefsFunc
,
129 AROS_UFHA(struct Hook
*, hook
, A0
),
130 AROS_UFHA(APTR
*, obj
, A2
),
131 AROS_UFHA(IPTR
*, param
, A1
)
135 HOOKPROTO(IconWindowVolumeList__HookFunc_ProcessIconListPrefsFunc
, void, APTR
*obj
, IPTR
*param
)
140 /* Get our private data */
141 Object
*self
= ( Object
*)obj
;
142 IPTR CHANGED_ATTRIB
= *param
;
143 Class
*CLASS
= OCLASS(self
);
147 Object
*prefs
= NULL
;
149 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__
));
151 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
155 IPTR attrib_Current
= 0, attrib_Prefs
, prefs_Processing
= 0;
156 BOOL options_changed
= FALSE
;
158 D(bug("[Wanderer:VolumeList] %s: Setting IconList options ..\n", __PRETTY_FUNCTION__
));
160 GET(prefs
, MUIA_WandererPrefs_Processing
, &prefs_Processing
);
162 switch (CHANGED_ATTRIB
)
164 case MUIA_IconList_IconListMode
:
165 case MUIA_IconList_LabelText_Mode
:
166 case MUIA_IconList_LabelText_MaxLineLen
:
167 case MUIA_IconList_LabelText_MultiLine
:
168 case MUIA_IconList_LabelText_MultiLineOnFocus
:
169 case MUIA_IconList_Icon_HorizontalSpacing
:
170 case MUIA_IconList_Icon_VerticalSpacing
:
171 case MUIA_IconList_Icon_ImageSpacing
:
172 case MUIA_IconList_LabelText_HorizontalPadding
:
173 case MUIA_IconList_LabelText_VerticalPadding
:
174 case MUIA_IconList_LabelText_BorderWidth
:
175 case MUIA_IconList_LabelText_BorderHeight
:
176 case MUIA_IconList_DragImageTransparent
:
177 case MUIA_IconList_SortFlags
:
179 GET(self
, (ULONG
)CHANGED_ATTRIB
, &attrib_Current
);
181 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwcd_ViewPrefs_ID
, (ULONG
)CHANGED_ATTRIB
)) != -1) &&
182 (attrib_Current
!= attrib_Prefs
))
184 options_changed
= TRUE
;
185 if (prefs_Processing
)
187 NNSET(self
, (ULONG
)CHANGED_ATTRIB
, attrib_Prefs
);
191 SET(self
, (ULONG
)CHANGED_ATTRIB
, attrib_Prefs
);
197 D(bug("[Wanderer:VolumeList] %s: Unhandled change\n", __PRETTY_FUNCTION__
));
203 if (!(prefs_Processing
))
205 D(bug("[Wanderer:VolumeList] %s: IconList Options have changed, causing an update ..\n", __PRETTY_FUNCTION__
));
206 DoMethod(self
, MUIM_IconList_Update
);
207 DoMethod(self
, MUIM_IconList_Sort
);
209 else if (data
->iwcd_IconWindow
)
211 SET(data
->iwcd_IconWindow
, MUIA_IconWindow_Changed
, TRUE
);
218 MakeStaticHook(Hook_ProcessIconListPrefsFunc
,IconWindowVolumeList__HookFunc_ProcessIconListPrefsFunc
);
222 ///IconWindowVolumeList__HookFunc_UpdateNetworkPrefsFunc()
225 void, IconWindowVolumeList__HookFunc_UpdateNetworkPrefsFunc
,
226 AROS_UFHA(struct Hook
*, hook
, A0
),
227 AROS_UFHA(APTR
*, obj
, A2
),
228 AROS_UFHA(APTR
, param
, A1
)
232 HOOKPROTO(IconWindowVolumeList__HookFunc_UpdateNetworkPrefsFunc
, void, APTR
*obj
, APTR param
)
237 /* Get our private data */
238 Object
*self
= ( Object
*)obj
;
239 Object
*prefs
= NULL
;
240 Class
*CLASS
= *( Class
**)param
;
244 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__
));
246 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
250 BOOL options_changed
= FALSE
;
251 IPTR prefs_Processing
= 0;
253 GET(prefs
, MUIA_WandererPrefs_Processing
, &prefs_Processing
);
255 IPTR current_ShowNetwork
= 0;
256 IPTR prefs_ShowNetwork
= 0;
258 D(bug("[Wanderer:VolumeList] %s: Setting ROOT view Network options ..\n", __PRETTY_FUNCTION__
));
260 GET(self
, MUIA_IconWindowExt_NetworkBrowser_Show
, ¤t_ShowNetwork
);
262 D(bug("[Wanderer:VolumeList] %s: Current = %d\n", __PRETTY_FUNCTION__
, current_ShowNetwork
));
264 GET(prefs
, MUIA_IconWindowExt_NetworkBrowser_Show
, &prefs_ShowNetwork
);
266 D(bug("[Wanderer:VolumeList] %s: Prefs = %d\n", __PRETTY_FUNCTION__
, prefs_ShowNetwork
));
268 if ((BOOL
)current_ShowNetwork
!= (BOOL
)prefs_ShowNetwork
)
270 D(bug("[Wanderer:VolumeList] %s: ROOT view Network prefs changed - updating ..\n", __PRETTY_FUNCTION__
));
271 options_changed
= TRUE
;
272 ((struct IconWindowVolumeList_DATA
*)data
)->iwvcd_ShowNetworkBrowser
= prefs_ShowNetwork
;
274 if ((options_changed
) && !(prefs_Processing
))
276 D(bug("[Wanderer:VolumeList] %s: Network prefs changed, causing an update ..\n", __PRETTY_FUNCTION__
));
277 DoMethod(self
, MUIM_IconList_Update
);
278 DoMethod(self
, MUIM_IconList_Sort
);
280 else if (data
->iwcd_IconWindow
)
282 SET(data
->iwcd_IconWindow
, MUIA_IconWindow_Changed
, TRUE
);
288 MakeStaticHook(Hook_UpdateNetworkPrefsFunc
,IconWindowVolumeList__HookFunc_UpdateNetworkPrefsFunc
);
291 #define BDRPLINELEN_MAX 1024
292 BOOL
IconWindowVolumeList__Func_ParseBackdrop(Object
*self
, struct IconEntry
*bdrp_direntry
, struct List
* entryList
)
294 BPTR bdrp_lock
= (BPTR
)NULL
;
295 char *bdrp_file
= NULL
, *linebuf
= NULL
, *bdrp_fullfile
= NULL
, *bdrp_namepart
= NULL
;
296 struct DiskObject
*bdrp_currfile_dob
= NULL
;
298 char *bdrp_dir
= bdrp_direntry
->ie_IconNode
.ln_Name
;
300 if ((bdrp_dir
== NULL
) || (bdrp_dir
[strlen(bdrp_dir
) - 1] != ':'))
303 D(bug("[Wanderer:VolumeList] %s('%s')\n", __PRETTY_FUNCTION__
, bdrp_dir
));
305 if ((bdrp_file
= AllocVec(strlen(bdrp_dir
) + 9 + 1, MEMF_CLEAR
|MEMF_PUBLIC
)) != NULL
)
307 sprintf(bdrp_file
, "%s.backdrop", bdrp_dir
);
308 if ((bdrp_lock
= Open(bdrp_file
, MODE_OLDFILE
)))
310 D(bug("[Wanderer:VolumeList] %s: Loading backdrop file: '%s'\n", __PRETTY_FUNCTION__
, bdrp_file
));
312 if ((linebuf
= AllocMem(BDRPLINELEN_MAX
, MEMF_PUBLIC
)) != NULL
)
314 while (FGets(bdrp_lock
, linebuf
, BDRPLINELEN_MAX
))
320 linelen
= strlen(linebuf
) - 1; /* drop the newline char */
321 linebuf
[linelen
] = '\0';
323 if ((bdrp_fullfile
= AllocVec(linelen
+ strlen(bdrp_dir
), MEMF_CLEAR
|MEMF_PUBLIC
)) != NULL
)
327 sprintf(bdrp_fullfile
, "%s%s", bdrp_dir
, &linebuf
[1]);
329 struct FileInfoBlock
*lofFIB
= AllocDosObject(DOS_FIB
, NULL
);
332 BPTR lofLock
= BNULL
;
333 if ((lofLock
= Lock(bdrp_fullfile
, SHARED_LOCK
)) != BNULL
)
335 char *tmpbdrp_file
= NULL
;
336 int tmpbdrp_len
= strlen(bdrp_fullfile
) + 128;
337 if ((tmpbdrp_file
= AllocVec(tmpbdrp_len
, MEMF_CLEAR
|MEMF_PUBLIC
)) != NULL
)
339 if (NameFromLock(lofLock
, tmpbdrp_file
, tmpbdrp_len
) != 0)
341 FreeVec(bdrp_fullfile
);
342 bdrp_fullfile
= tmpbdrp_file
;
345 FreeVec(tmpbdrp_file
);
347 if (Examine(lofLock
, lofFIB
))
349 if (lofFIB
->fib_DirEntryType
== ST_FILE
)
351 lofTYPE
= ST_LINKFILE
;
353 else if (lofFIB
->fib_DirEntryType
== ST_USERDIR
)
355 lofTYPE
= ST_LINKDIR
;
360 FreeDosObject(DOS_FIB
, lofFIB
);
363 bdrp_namepart
= FilePart(bdrp_fullfile
);
365 struct IconEntry
*this_entry
= NULL
, *iconNode
= NULL
, *tmpentry
= NULL
;
367 if (entryList
!= NULL
)
369 D(bug("[Wanderer:VolumeList] %s: Checking for existing entry in list @ 0x%p\n", __PRETTY_FUNCTION__
, entryList
));
370 ForeachNodeSafe(entryList
, iconNode
, tmpentry
)
372 if (strcmp(iconNode
->ie_IconNode
.ln_Name
, bdrp_fullfile
) == 0)
374 this_entry
= iconNode
;
375 Remove((struct Node
*)&iconNode
->ie_IconNode
);
376 iconNode
->ie_IconListEntry
.udata
= bdrp_direntry
;
377 D(bug("[Wanderer:VolumeList] %s: Reinserting '%s'\n", __PRETTY_FUNCTION__
, iconNode
->ie_IconNode
.ln_Name
));
378 DoMethod(self
, MUIM_Family_AddTail
, (struct Node
*)&iconNode
->ie_IconNode
);
379 /* retVal - this case is not considered a change */
385 if (this_entry
== NULL
)
387 //bug("[Wanderer:VolumeList] %s: Checking for existing entry in iconlist\n", __PRETTY_FUNCTION__);
389 bdrp_currfile_dob
= GetIconTags
392 ICONGETA_Screen
, _screen(self
),
393 ICONGETA_FailIfUnavailable
, FALSE
,
394 ICONGETA_Label
, bdrp_namepart
,
398 D(bug("[Wanderer:VolumeList] %s: LEAVEOUT Icon '%s' ('%s') DOB @ 0x%p\n", __PRETTY_FUNCTION__
, bdrp_fullfile
, bdrp_namepart
, bdrp_currfile_dob
));
400 if (bdrp_currfile_dob
)
402 if ((this_entry
= (struct IconEntry
*)DoMethod(self
, MUIM_IconList_CreateEntry
, (IPTR
)bdrp_fullfile
, (IPTR
)bdrp_namepart
, (IPTR
)NULL
, (IPTR
)bdrp_currfile_dob
, 0)))
404 this_entry
->ie_IconNode
.ln_Pri
= 1;
405 this_entry
->ie_IconListEntry
.type
= lofTYPE
;
406 this_entry
->ie_IconListEntry
.udata
= bdrp_direntry
;
407 DoMethod(self
, MUIM_Family_AddTail
, (struct Node
*)&this_entry
->ie_IconNode
);
415 FreeMem(linebuf
, BDRPLINELEN_MAX
);
425 /*** Methods ****************************************************************/
427 Object
*IconWindowVolumeList__OM_NEW(Class
*CLASS
, Object
*self
, struct opSet
*message
)
429 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__
));
431 self
= (Object
*) DoSuperNewTags
435 TAG_MORE
, (IPTR
) message
->ops_AttrList
441 D(bug("[Wanderer:VolumeList] %s: SELF = 0x%p\n", __PRETTY_FUNCTION__
, self
));
443 data
->iwvcd_FSNotifyPort
= (struct MsgPort
*)GetTagData(MUIA_Wanderer_FileSysNotifyPort
, (IPTR
) NULL
, message
->ops_AttrList
);
446 data
->iwcd_ProcessIconListPrefs_hook
.h_Entry
= ( HOOKFUNC
)IconWindowVolumeList__HookFunc_ProcessIconListPrefsFunc
;
448 data
->iwcd_ProcessIconListPrefs_hook
= &Hook_ProcessIconListPrefsFunc
;
457 IPTR
IconWindowVolumeList__OM_SET(Class
*CLASS
, Object
*self
, struct opSet
*message
)
461 struct TagItem
*tstate
= message
->ops_AttrList
, *tag
;
463 while ((tag
= NextTagItem(&tstate
)) != NULL
)
467 case MUIA_Background
:
469 D(bug("[Wanderer:VolumeList] %s: MUIA_Background\n", __PRETTY_FUNCTION__
));
472 case MUIA_IconWindow_Window
:
474 D(bug("[Wanderer:VolumeList] %s: MUIA_IconWindow_Window @ %p\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
475 data
->iwcd_IconWindow
= (Object
*)tag
->ti_Data
;
478 case MUIA_IconList_BufferRastport
:
480 D(bug("[Wanderer:VolumeList] %s: MUIA_IconList_BufferRastport @ %p\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
481 data
->iwcd_RastPort
= (struct RastPort
*)tag
->ti_Data
;
486 return DoSuperMethodA(CLASS
, self
, (Msg
) message
);
491 IPTR
IconWindowVolumeList__OM_GET(Class
*CLASS
, Object
*self
, struct opGet
*message
)
494 IPTR
*store
= message
->opg_Storage
;
497 switch (message
->opg_AttrID
)
500 *store
= (IPTR
)WIWVLVERS
;
504 *store
= (IPTR
)WIWVLREV
;
508 rv
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
515 #define SETFROMPREFS(tag) \
516 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, tag); \
517 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, tag))) SET(self, tag, attrib_Prefs);
519 #define ADDPREFSNTF(tag) \
520 DoMethod(data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, tag, MUIV_EveryTime, (IPTR) self, 3, \
521 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)tag);
523 #define REMPREFSNTF(tag) \
524 DoMethod(data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, tag, (IPTR)self);
526 ///IconWindowVolumeList__MUIM_Setup()
527 IPTR IconWindowVolumeList__MUIM_Setup
529 Class
*CLASS
, Object
*self
, Msg message
534 Object
*prefs
= NULL
;
536 if (!DoSuperMethodA(CLASS
, self
, message
)) return FALSE
;
538 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
542 /* Set our initial options */
545 GET(_win(self
), MUIA_IconWindow_BackgroundAttrib
, &data
->iwcd_ViewPrefs_ID
);
546 D(bug("[Wanderer:VolumeList] %s: Window Background = '%s'\n", __PRETTY_FUNCTION__
, data
->iwcd_ViewPrefs_ID
));
547 data
->iwcd_ViewPrefs_NotificationObject
= (Object
*)DoMethod(prefs
,
548 MUIM_WandererPrefs_ViewSettings_GetNotifyObject
,
549 data
->iwcd_ViewPrefs_ID
);
551 D(bug("[Wanderer:VolumeList] %s: Background Notification Obj @ 0x%p\n", __PRETTY_FUNCTION__
, data
->iwcd_ViewPrefs_NotificationObject
));
553 SETFROMPREFS(MUIA_IconList_IconListMode
);
554 SETFROMPREFS(MUIA_IconList_LabelText_Mode
);
555 SETFROMPREFS(MUIA_IconList_SortFlags
);
556 SETFROMPREFS(MUIA_IconList_DragImageTransparent
);
557 SETFROMPREFS(MUIA_IconList_LabelText_MaxLineLen
);
558 SETFROMPREFS(MUIA_IconList_LabelText_MultiLine
);
559 SETFROMPREFS(MUIA_IconList_LabelText_MultiLineOnFocus
);
560 SETFROMPREFS(MUIA_IconList_Icon_HorizontalSpacing
);
561 SETFROMPREFS(MUIA_IconList_Icon_VerticalSpacing
);
562 SETFROMPREFS(MUIA_IconList_Icon_ImageSpacing
);
563 SETFROMPREFS(MUIA_IconList_LabelText_HorizontalPadding
);
564 SETFROMPREFS(MUIA_IconList_LabelText_VerticalPadding
);
565 SETFROMPREFS(MUIA_IconList_LabelText_BorderWidth
);
566 SETFROMPREFS(MUIA_IconList_LabelText_BorderHeight
);
568 /* Configure notifications incase they get updated =) */
569 ADDPREFSNTF(MUIA_IconList_IconListMode
);
570 ADDPREFSNTF(MUIA_IconList_LabelText_Mode
);
571 ADDPREFSNTF(MUIA_IconList_SortFlags
);
572 ADDPREFSNTF(MUIA_IconList_DragImageTransparent
);
573 ADDPREFSNTF(MUIA_IconList_LabelText_MaxLineLen
);
574 ADDPREFSNTF(MUIA_IconList_LabelText_MultiLine
);
575 ADDPREFSNTF(MUIA_IconList_LabelText_MultiLineOnFocus
);
576 ADDPREFSNTF(MUIA_IconList_Icon_HorizontalSpacing
);
577 ADDPREFSNTF(MUIA_IconList_Icon_VerticalSpacing
);
578 ADDPREFSNTF(MUIA_IconList_Icon_ImageSpacing
);
579 ADDPREFSNTF(MUIA_IconList_LabelText_HorizontalPadding
);
580 ADDPREFSNTF(MUIA_IconList_LabelText_VerticalPadding
);
581 ADDPREFSNTF(MUIA_IconList_LabelText_BorderWidth
);
582 ADDPREFSNTF(MUIA_IconList_LabelText_BorderHeight
);
588 ((struct IconWindowVolumeList_DATA
*)data
)->iwvcd_UpdateNetworkPrefs_hook
.h_Entry
= ( HOOKFUNC
)IconWindowVolumeList__HookFunc_UpdateNetworkPrefsFunc
;
590 ((struct IconWindowVolumeList_DATA
*)data
)->iwvcd_UpdateNetworkPrefs_hook
= &Hook_UpdateNetworkPrefsFunc
;
595 prefs
, MUIM_Notify
, MUIA_IconWindowExt_NetworkBrowser_Show
, MUIV_EveryTime
,
597 MUIM_CallHook
, &((struct IconWindowVolumeList_DATA
*)data
)->iwvcd_UpdateNetworkPrefs_hook
, (IPTR
)CLASS
601 if (muiRenderInfo(self
))
603 D(bug("[Wanderer:VolumeList] %s: Setting up EventHandler for (IDCMP_DISKINSERTED | IDCMP_DISKREMOVED)\n", __PRETTY_FUNCTION__
));
605 data
->iwcd_EventHandlerNode
.ehn_Priority
= 1;
606 data
->iwcd_EventHandlerNode
.ehn_Flags
= MUI_EHF_GUIMODE
;
607 data
->iwcd_EventHandlerNode
.ehn_Object
= self
;
608 data
->iwcd_EventHandlerNode
.ehn_Class
= CLASS
;
609 data
->iwcd_EventHandlerNode
.ehn_Events
= IDCMP_DISKINSERTED
| IDCMP_DISKREMOVED
;
611 DoMethod(_win(self
), MUIM_Window_AddEventHandler
, &data
->iwcd_EventHandlerNode
);
615 D(bug("[Wanderer:VolumeList] %s: Couldnt add IDCMP EventHandler!\n", __PRETTY_FUNCTION__
));
618 D(bug("[Wanderer:VolumeList] %s: Setup complete!\n", __PRETTY_FUNCTION__
));
624 ///IconWindowVolumeList__MUIM_Cleanup()
625 IPTR IconWindowVolumeList__MUIM_Cleanup
627 Class
*CLASS
, Object
*self
, Msg message
632 Object
*prefs
= NULL
;
634 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__
));
635 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
639 REMPREFSNTF(MUIA_IconList_IconListMode
);
640 REMPREFSNTF(MUIA_IconList_LabelText_Mode
);
641 REMPREFSNTF(MUIA_IconList_SortFlags
);
642 REMPREFSNTF(MUIA_IconList_DragImageTransparent
);
643 REMPREFSNTF(MUIA_IconList_LabelText_MaxLineLen
);
644 REMPREFSNTF(MUIA_IconList_LabelText_MultiLine
);
645 REMPREFSNTF(MUIA_IconList_LabelText_MultiLineOnFocus
);
646 REMPREFSNTF(MUIA_IconList_Icon_HorizontalSpacing
);
647 REMPREFSNTF(MUIA_IconList_Icon_VerticalSpacing
);
648 REMPREFSNTF(MUIA_IconList_Icon_ImageSpacing
);
649 REMPREFSNTF(MUIA_IconList_LabelText_HorizontalPadding
);
650 REMPREFSNTF(MUIA_IconList_LabelText_VerticalPadding
);
651 REMPREFSNTF(MUIA_IconList_LabelText_BorderWidth
);
652 REMPREFSNTF(MUIA_IconList_LabelText_BorderHeight
);
660 MUIM_KillNotifyObj
, MUIA_IconWindowExt_NetworkBrowser_Show
, (IPTR
) self
663 D(bug("[Wanderer:VolumeList] %s: Removing Disk Event Handler\n", __PRETTY_FUNCTION__
));
664 DoMethod(_win(self
), MUIM_Window_RemEventHandler
, &data
->iwcd_EventHandlerNode
);
666 return DoSuperMethodA(CLASS
, self
, message
);
670 ///IconWindowVolumeList__MUIM_HandleEvent()
671 IPTR IconWindowVolumeList__MUIM_HandleEvent
673 Class
*CLASS
, Object
*self
, struct MUIP_HandleEvent
*message
678 struct IntuiMessage
*imsg
= message
->imsg
;
680 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__
));
682 if(imsg
->Class
== IDCMP_DISKINSERTED
)
684 D(bug("[Wanderer:VolumeList] %s: IDCMP_DISKINSERTED\n", __PRETTY_FUNCTION__
));
685 DoMethod(self
, MUIM_IconList_Update
);
686 DoMethod(self
, MUIM_IconList_Sort
);
687 return(MUI_EventHandlerRC_Eat
);
689 else if (imsg
->Class
== IDCMP_DISKREMOVED
)
691 D(bug("[Wanderer:VolumeList] %s: IDCMP_DISKREMOVED\n", __PRETTY_FUNCTION__
));
692 DoMethod(self
, MUIM_IconList_Update
);
693 DoMethod(self
, MUIM_IconList_Sort
);
694 return(MUI_EventHandlerRC_Eat
);
700 ///IconWindowVolumeList__MUIM_DrawBackground()
701 IPTR IconWindowVolumeList__MUIM_DrawBackground
703 Class
*CLASS
, Object
*self
, struct MUIP_DrawBackground
*message
708 IPTR retVal
= (IPTR
)TRUE
;
710 struct RastPort
*DrawBackGround_RastPort
;
711 struct IconWindowBackFillMsg DrawBackGround_BackFillMsg
;
713 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__
));
715 if ((iconwindow_BackFill_Active
== NULL
) ||
716 (data
->iwcd_IconWindow
== NULL
))
718 D(bug("[Wanderer:VolumeList] %s: No Backfill support/Window not set .. causing parent class to render\n", __PRETTY_FUNCTION__
));
719 goto iwc_ParentBackground
;
722 DrawBackGround_RastPort
= _rp(self
);
724 if ((data
->iwcd_RastPort
!= NULL
) && (DrawBackGround_RastPort
!= data
->iwcd_RastPort
))
726 DrawBackGround_RastPort
= data
->iwcd_RastPort
;
728 DrawBackGround_BackFillMsg
.AreaBounds
.MinX
= 0;
729 DrawBackGround_BackFillMsg
.AreaBounds
.MinY
= 0;
730 DrawBackGround_BackFillMsg
.AreaBounds
.MaxX
= _mwidth(self
);
731 DrawBackGround_BackFillMsg
.AreaBounds
.MaxY
= _mheight(self
);
733 DrawBackGround_BackFillMsg
.DrawBounds
.MinX
= message
->left
- _mleft(self
);
734 DrawBackGround_BackFillMsg
.DrawBounds
.MinY
= message
->top
- _mtop(self
);
735 DrawBackGround_BackFillMsg
.DrawBounds
.MaxX
= message
->width
;
736 DrawBackGround_BackFillMsg
.DrawBounds
.MaxY
= message
->height
;
740 DrawBackGround_BackFillMsg
.AreaBounds
.MinX
= _mleft(self
);
741 DrawBackGround_BackFillMsg
.AreaBounds
.MinY
= _mtop(self
);
742 DrawBackGround_BackFillMsg
.AreaBounds
.MaxX
= (_mleft(self
) + _mwidth(self
));
743 DrawBackGround_BackFillMsg
.AreaBounds
.MaxY
= (_mtop(self
) + _mheight(self
));
745 DrawBackGround_BackFillMsg
.DrawBounds
.MinX
= message
->left
;
746 DrawBackGround_BackFillMsg
.DrawBounds
.MinY
= message
->top
;
747 DrawBackGround_BackFillMsg
.DrawBounds
.MaxX
= (message
->left
+ message
->width
);
748 DrawBackGround_BackFillMsg
.DrawBounds
.MaxY
= (message
->top
+ message
->height
);
751 DrawBackGround_BackFillMsg
.Layer
= DrawBackGround_RastPort
->Layer
;
753 /* Offset into source image (ala scroll bar position) */
754 DrawBackGround_BackFillMsg
.OffsetX
= message
->xoffset
;
755 DrawBackGround_BackFillMsg
.OffsetY
= message
->yoffset
;
757 D(bug("[Wanderer:VolumeList] %s: RastPort @ 0x%p\n", __PRETTY_FUNCTION__
, DrawBackGround_RastPort
));
759 if ((retVal
= DoMethod(data
->iwcd_IconWindow
, MUIM_IconWindow_BackFill_DrawBackground
, XGET(data
->iwcd_IconWindow
, MUIA_IconWindow_BackFillData
), &DrawBackGround_BackFillMsg
, DrawBackGround_RastPort
)) == (IPTR
)TRUE
)
761 D(bug("[Wanderer:VolumeList] %s: Backfill module rendered background ..\n", __PRETTY_FUNCTION__
));
764 D(bug("[Wanderer:VolumeList] %s: Backfill module failed to render background ..\n", __PRETTY_FUNCTION__
));
766 iwc_ParentBackground
:
768 clip
= (IPTR
)MUI_AddClipping(muiRenderInfo(self
), message
->left
, message
->top
, message
->width
, message
->height
);
770 message
->width
= _mwidth(self
);
771 message
->height
= _mheight(self
);
772 message
->left
= _mleft(self
);
773 message
->top
= _mtop(self
);
775 retVal
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
777 MUI_RemoveClipping(muiRenderInfo(self
), (APTR
)clip
);
783 ///IconWindowVolumeList__MUIM_IconList_Update()
784 IPTR IconWindowVolumeList__MUIM_IconList_Update
786 Class
*CLASS
, Object
*self
, struct MUIP_IconList_Update
*message
791 IPTR retVal
= (IPTR
)TRUE
;
793 if ((BOOL
)XGET(_win(self
), MUIA_IconWindow_IsRoot
))
795 // struct IconList_Entry *icon_entry = (IPTR)MUIV_IconList_NextIcon_Start;
796 Object
*prefs
= NULL
;
797 struct Node
*Obj_NetworkIcon
= NULL
;
798 struct Node
*Obj_UserFilesIcon
= NULL
;
800 struct List leftoutList
, iconifiedList
, *iconList
= NULL
;
801 struct IconEntry
*volentry
= NULL
, *entry
= NULL
, *tmpentry
= NULL
;
803 NEWLIST(&leftoutList
);
804 NEWLIST(&iconifiedList
);
806 D(bug("[Wanderer:VolumeList] %s: left-out List @ %p\n", __PRETTY_FUNCTION__
, &leftoutList
));
808 GET(self
, MUIA_Family_List
, &iconList
);
810 ForeachNodeSafe(iconList
, entry
, tmpentry
)
812 if (entry
->ie_IconListEntry
.type
== ST_ROOT
)
814 D(bug("[Wanderer:VolumeList] %s: Marking volume entry '%s' (pri = %d)\n",
815 __PRETTY_FUNCTION__
, entry
->ie_IconNode
.ln_Name
, entry
->ie_IconNode
.ln_Pri
));
816 if (entry
->ie_IconNode
.ln_Pri
== 5) entry
->ie_IconNode
.ln_Pri
= -5;
817 else entry
->ie_IconNode
.ln_Pri
= -2;
819 if ((entry
->ie_IconListEntry
.type
== ST_LINKFILE
) || (entry
->ie_IconListEntry
.type
== ST_LINKDIR
))
821 D(bug("[Wanderer:VolumeList] %s: Removing left out entry '%s'\n",
822 __PRETTY_FUNCTION__
, entry
->ie_IconNode
.ln_Name
));
823 Remove(&entry
->ie_IconNode
);
824 AddTail(&leftoutList
, &entry
->ie_IconNode
);
826 else if (entry
->ie_IconListEntry
.type
== ILE_TYPE_APPICON
)
828 D(bug("[Wanderer:VolumeList] %s: Removing iconified entry '%s'\n",
829 __PRETTY_FUNCTION__
, entry
->ie_IconNode
.ln_Name
));
830 Remove(&entry
->ie_IconNode
);
831 AddTail(&iconifiedList
, &entry
->ie_IconNode
);
833 else if (strcmp(entry
->ie_IconNode
.ln_Name
, "?wanderer.networkbrowse?") == 0)
835 D(bug("[Wanderer:VolumeList] %s: Removing NetworkBrowser entry\n", __PRETTY_FUNCTION__
));
836 Remove(&entry
->ie_IconNode
);
837 Obj_NetworkIcon
= (struct Node
*)entry
;
839 /*else if (strcmp(, "User Files..") == 0)
841 Remove(&entry->ie_IconNode);
842 Obj_UserFilesIcon = entry;
846 D(bug("[Wanderer:VolumeList] %s: Causing parent to update\n", __PRETTY_FUNCTION__
));
847 retVal
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
849 GET(self
, MUIA_Family_List
, &iconList
);
851 /* Re-parsing .backdrop files and re-adding entries */
852 ForeachNode(iconList
, volentry
)
854 if ((volentry
->ie_IconListEntry
.type
== ST_ROOT
)
855 && ((volentry
->ie_IconNode
.ln_Pri
== -2) || (volentry
->ie_IconNode
.ln_Pri
== -5))
856 && !(volentry
->ie_IconListEntry
.flags
& ICONENTRY_VOL_OFFLINE
))
858 if (volentry
->ie_IconNode
.ln_Pri
== -5) volentry
->ie_IconNode
.ln_Pri
= 5;
859 else volentry
->ie_IconNode
.ln_Pri
= 2;
861 D(bug("[Wanderer:VolumeList] %s: Re-Parsing backdrop file for '%s'\n", __PRETTY_FUNCTION__
, volentry
->ie_IconNode
.ln_Name
));
863 /* Re-add entries which did not change and create entries for new left-out entries */
864 /* This function removes objects from leftoutlist */
865 IconWindowVolumeList__Func_ParseBackdrop(self
, volentry
, &leftoutList
);
869 /* Destroy entries which where not re-added */
870 ForeachNodeSafe(&leftoutList
, entry
, tmpentry
)
872 if ((entry
->ie_IconListEntry
.type
== ST_LINKFILE
) || (entry
->ie_IconListEntry
.type
== ST_LINKDIR
))
874 D(bug("[Wanderer:VolumeList] %s: Destroying orphaned left-out entry '%s'\n", __PRETTY_FUNCTION__
, entry
->ie_IconNode
.ln_Name
));
875 Remove(&entry
->ie_IconNode
);
876 DoMethod(self
, MUIM_IconList_DestroyEntry
, entry
);
882 /* Refresh entries for AppIcons */
885 struct AppIcon
* appicon
= NULL
;
887 APTR lock
= AppObjectsLock();
889 /* Reinsert existing, add new */
890 while ((appicon
= GetNextAppIconLocked(appicon
, lock
)))
892 struct IconEntry
* appentry
= NULL
;
894 ForeachNodeSafe(&iconifiedList
, entry
, tmpentry
)
896 if (entry
->ie_User1
== (APTR
)appicon
)
899 Remove((struct Node
*)&entry
->ie_IconNode
);
900 D(bug("[Wanderer:VolumeList] %s: Reinserting '%s'\n", __PRETTY_FUNCTION__
,
901 entry
->ie_IconNode
.ln_Name
));
902 DoMethod(self
, MUIM_Family_AddTail
, (struct Node
*)&entry
->ie_IconNode
);
907 if (appentry
== NULL
)
909 struct DiskObject
* appdo
= AppIcon_GetDiskObject(appicon
);
910 struct DiskObject
* dupdo
= DupDiskObject(appdo
, TAG_DONE
);
911 LayoutIconA(dupdo
, _screen(self
), NULL
);
912 CONST_STRPTR label
= AppIcon_GetLabel(appicon
);
913 appentry
= (struct IconEntry
*)DoMethod(self
,
914 MUIM_IconList_CreateEntry
, (IPTR
)"?APPICON?", (IPTR
)label
, (IPTR
)NULL
, (IPTR
)dupdo
, 0);
917 appentry
->ie_User1
= (APTR
)appicon
;
918 appentry
->ie_IconNode
.ln_Pri
= 0;
919 appentry
->ie_IconListEntry
.type
= ILE_TYPE_APPICON
;
920 DoMethod(self
, MUIM_Family_AddTail
, (struct Node
*)&appentry
->ie_IconNode
);
925 AppObjectsUnlock(lock
);
927 /* Destroy entries which where not re-added */
928 ForeachNodeSafe(&iconifiedList
, entry
, tmpentry
)
930 D(bug("[Wanderer:VolumeList] %s: Destroying old iconified entry '%s'\n",
931 __PRETTY_FUNCTION__
, entry
->ie_IconNode
.ln_Name
));
932 Remove(&entry
->ie_IconNode
);
933 DoMethod(self
, MUIM_IconList_DestroyEntry
, entry
);
939 /* Network browser / User Files */
940 D(bug("[Wanderer:VolumeList] %s: Check if we should show NetworkBrowser Icon ..\n", __PRETTY_FUNCTION__
));
942 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
946 struct IconWindowVolumeList_DATA
*volumel_data
= (struct IconWindowVolumeList_DATA
*)data
;
948 GET(prefs
, MUIA_IconWindowExt_NetworkBrowser_Show
, &volumel_data
->iwvcd_ShowNetworkBrowser
);
950 #if defined(DEBUG_NETWORKBROWSER)
951 volumel_data
->iwvcd_ShowNetworkBrowser
= TRUE
;
954 if (volumel_data
->iwvcd_ShowNetworkBrowser
)
956 if (Obj_NetworkIcon
== NULL
)
958 struct DiskObject
*_nb_dob
= NULL
;
959 _nb_dob
= GetIconTags
961 "ENV:SYS/def_NetworkHost",
962 ICONGETA_FailIfUnavailable
, FALSE
,
963 ICONGETA_Label
, (IPTR
)"Network Access..",
967 D(bug("[Wanderer:VolumeList] %s: NetworkBrowser Icon DOB @ 0x%p\n", __PRETTY_FUNCTION__
, _nb_dob
));
971 if ((Obj_NetworkIcon
= (struct Node
*)DoMethod(self
, MUIM_IconList_CreateEntry
, (IPTR
)"?wanderer.networkbrowse?", (IPTR
)"Network Access..", (IPTR
)NULL
, (IPTR
)_nb_dob
, 0)))
973 Obj_NetworkIcon
->ln_Pri
= 4; /// Network Access gets Priority 4 so its displayed after special dirs
974 // D(bug("[Wanderer:VolumeList] %s: NetworkBrowser Icon Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
981 if (Obj_NetworkIcon
!= NULL
)
983 DoMethod(self
, MUIM_IconList_DestroyEntry
, Obj_NetworkIcon
);
987 GET(prefs
, MUIA_IconWindowExt_UserFiles_ShowFilesFolder
, &volumel_data
->iwvcd_ShowUserFolder
);
989 #if defined(DEBUG_SHOWUSERFILES)
990 volumel_data
->iwvcd_ShowUserFolder
= TRUE
;
992 if (volumel_data
->iwvcd_ShowUserFolder
)
994 if (Obj_UserFilesIcon
== NULL
)
996 if (GetVar("SYS/Wanderer/userfiles.prefs", __icwc_intern_TxtBuff
, TXTBUFF_LEN
, GVF_GLOBAL_ONLY
) != -1)
998 char * userfiles_path
= NULL
;
1000 D(bug("[Wanderer:VolumeList] %s: SYS/UserFilesLocation = '%s'\n", __PRETTY_FUNCTION__
, __icwc_intern_TxtBuff
));
1002 if ((userfiles_path
= AllocVec(strlen(__icwc_intern_TxtBuff
) + 1, MEMF_CLEAR
|MEMF_PUBLIC
)) != NULL
)
1004 struct DiskObject
*_nb_dob
= NULL
;
1006 volumel_data
->iwvcd_UserFolderPath
= userfiles_path
;
1008 D(bug("[Wanderer:VolumeList] %s: UserFilesLocation Path storage @ 0x%p\n", __PRETTY_FUNCTION__
, userfiles_path
));
1010 strcpy(userfiles_path
, __icwc_intern_TxtBuff
);
1012 D(bug("[Wanderer:VolumeList] %s: UserFilesLocation Path storage contains '%s'\n", __PRETTY_FUNCTION__
, userfiles_path
));
1014 _nb_dob
= GetIconTags
1016 "ENV:SYS/def_UserHome",
1017 ICONGETA_FailIfUnavailable
, FALSE
,
1018 ICONGETA_Label
, (IPTR
)"User Files..",
1022 D(bug("[Wanderer:VolumeList] %s: UserFiles Icon DOB @ 0x%p\n", __PRETTY_FUNCTION__
, _nb_dob
));
1026 if ((Obj_UserFilesIcon
= (struct Node
*)DoMethod(self
, MUIM_IconList_CreateEntry
, userfiles_path
, (IPTR
)"User Files..", (IPTR
)NULL
, (IPTR
)_nb_dob
, 0)))
1028 Obj_UserFilesIcon
->ln_Pri
= 5; /// Special dirs get Priority 5
1037 if (Obj_UserFilesIcon
!= NULL
)
1039 DoMethod(self
, MUIM_IconList_DestroyEntry
, Obj_UserFilesIcon
);
1047 DoMethod(self
, MUIM_IconList_Clear
);
1054 * This handle only changes to .backdrop file. In theory we could just add notification on this file instead of whole root directory
1055 * but this file is not guaranteed to exist - meaning that leavout dune during "first" session would not be visible until reboot
1057 IPTR
IconWindowVolumeList__HandleFSUpdate(Object
*target
, struct NotifyMessage
*msg
)
1059 struct List
*iconList
= NULL
, fsLeftOutList
;
1060 struct IconEntry
*entry
= NULL
, *tmpEntry
= NULL
, *fsEntry
= NULL
;
1061 BOOL changed
= FALSE
;
1063 D(bug("[Wanderer:VolumeList]: %s(NotifyMessage @ %p -> '%s')\n", __PRETTY_FUNCTION__
, msg
, msg
->nm_NReq
->nr_Name
));
1065 NEWLIST(&fsLeftOutList
);
1067 D(bug("[Wanderer:VolumeList] %s: IconWindowVolumeList, IconList @ %p\n", __PRETTY_FUNCTION__
, target
));
1069 GET(target
, MUIA_Family_List
, &iconList
);
1070 /* Find out which icon matches the volument that notified us */
1071 ForeachNode(iconList
, entry
)
1073 if ((entry
->ie_IconListEntry
.type
== ST_ROOT
)
1074 && (strncmp(entry
->ie_IconNode
.ln_Name
, msg
->nm_NReq
->nr_Name
, strlen(entry
->ie_IconNode
.ln_Name
)) == 0))
1081 if (fsEntry
!= NULL
)
1083 D(bug("[Wanderer:VolumeList] %s: Processing .backdrop for entry @ %p '%s'\n", __PRETTY_FUNCTION__
, fsEntry
, fsEntry
->ie_IconNode
.ln_Name
));
1085 /* Find other icons that are linked the the root icon */
1086 ForeachNodeSafe(iconList
, entry
,tmpEntry
)
1088 if (((entry
->ie_IconListEntry
.type
== ST_LINKFILE
) || (entry
->ie_IconListEntry
.type
== ST_LINKDIR
)) && (entry
->ie_IconListEntry
.udata
== fsEntry
))
1090 D(bug("[Wanderer:VolumeList] %s: existing left-out entry @ %p '%s' for this volume\n", __PRETTY_FUNCTION__
, entry
, entry
->ie_IconNode
.ln_Name
));
1091 Remove(&entry
->ie_IconNode
);
1092 AddTail(&fsLeftOutList
, &entry
->ie_IconNode
);
1096 /* Parse .backdrop and add any of the existing icons back to family list */
1097 changed
= IconWindowVolumeList__Func_ParseBackdrop(target
, fsEntry
, &fsLeftOutList
);
1099 /* Destroy left-out entries which are no longer valid */
1100 ForeachNodeSafe(&fsLeftOutList
, entry
, tmpEntry
)
1102 D(bug("[Wanderer:VolumeList] %s: Destroying orphaned entry @ %p '%s'\n", __PRETTY_FUNCTION__
, entry
, entry
->ie_IconNode
.ln_Name
));
1103 Remove(&entry
->ie_IconNode
);
1104 DoMethod(target
, MUIM_IconList_DestroyEntry
, entry
);
1108 /* Re-sort the list */
1110 DoMethod(target
, MUIM_IconList_Sort
);
1116 IPTR
IconWindowVolumeList__MUIM_IconList_CreateEntry(struct IClass
*CLASS
, Object
*self
, struct MUIP_IconList_CreateEntry
*message
)
1118 struct IconEntry
*this_Icon
= NULL
;
1119 struct VolumeIcon_Private
*volPrivate
= NULL
;
1120 struct Wanderer_FSHandler
*_volumeIcon__FSNotifyHandler
= NULL
;
1122 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__
));
1124 this_Icon
= (struct IconEntry
*)DoSuperMethodA(CLASS
, self
, (Msg
) message
);
1128 volPrivate
= this_Icon
->ie_IconListEntry
.udata
;
1130 D(bug("[Wanderer:VolumeList] %s: IconEntry '%s' Allocated @ %p, volPrivate @ %p\n", __PRETTY_FUNCTION__
, this_Icon
->ie_IconNode
.ln_Name
, this_Icon
, volPrivate
));
1132 if ((this_Icon
->ie_IconListEntry
.type
== ST_ROOT
) && (volPrivate
&& ((volPrivate
->vip_FLags
& (ICONENTRY_VOL_OFFLINE
|ICONENTRY_VOL_DISABLED
)) == 0)))
1134 if (((_volumeIcon__FSNotifyHandler
= AllocMem(sizeof(struct Wanderer_FSHandler
), MEMF_CLEAR
)) != NULL
))
1138 _volumeIcon__FSNotifyHandler
->target
= self
;
1139 _volumeIcon__FSNotifyHandler
->HandleFSUpdate
= IconWindowVolumeList__HandleFSUpdate
;
1140 volPrivate
->vip_FSNotifyRequest
.nr_Name
= this_Icon
->ie_IconNode
.ln_Name
;
1141 volPrivate
->vip_FSNotifyRequest
.nr_Flags
= NRF_SEND_MESSAGE
;
1142 volPrivate
->vip_FSNotifyRequest
.nr_stuff
.nr_Msg
.nr_Port
= data
->iwvcd_FSNotifyPort
;
1143 volPrivate
->vip_FSNotifyRequest
.nr_UserData
= (IPTR
)_volumeIcon__FSNotifyHandler
;
1144 _volumeIcon__FSNotifyHandler
->fshn_Node
.ln_Name
= volPrivate
->vip_FSNotifyRequest
.nr_Name
;
1146 if (StartNotify(&volPrivate
->vip_FSNotifyRequest
))
1148 D(bug("[Wanderer:VolumeList] %s: FSNotification setup", __PRETTY_FUNCTION__
));
1152 D(bug("[Wanderer:VolumeList] %s: FAILED to setup FSNotification", __PRETTY_FUNCTION__
));
1153 FreeMem(_volumeIcon__FSNotifyHandler
, sizeof(struct Wanderer_FSHandler
));
1154 volPrivate
->vip_FSNotifyRequest
.nr_Name
= NULL
;
1155 volPrivate
->vip_FSNotifyRequest
.nr_UserData
= (IPTR
)NULL
;
1157 D(bug(" for Volume '%s'\n", this_Icon
->ie_IconNode
.ln_Name
));
1159 IconWindowVolumeList__Func_ParseBackdrop(self
, this_Icon
, NULL
);
1162 return (IPTR
)this_Icon
;
1165 IPTR
IconWindowVolumeList__MUIM_IconList_UpdateEntry(struct IClass
*CLASS
, Object
*obj
, struct MUIP_IconList_UpdateEntry
*message
)
1167 struct VolumeIcon_Private
*volPrivate
= NULL
;
1168 struct IconEntry
*this_Icon
= NULL
;
1170 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__
));
1172 volPrivate
= message
->entry
->ie_IconListEntry
.udata
;
1174 if (message
->entry
->ie_IconListEntry
.type
== ST_ROOT
1175 && (message
->entry
->ie_IconListEntry
.flags
&
1176 (ICONENTRY_VOL_OFFLINE
|ICONENTRY_VOL_DISABLED
)) != 0)
1178 if (volPrivate
->vip_FSNotifyRequest
.nr_Name
!= NULL
)
1180 EndNotify(&volPrivate
->vip_FSNotifyRequest
);
1182 FreeMem((struct Wanderer_FSHandler
*)volPrivate
->vip_FSNotifyRequest
.nr_UserData
, sizeof(struct Wanderer_FSHandler
));
1183 volPrivate
->vip_FSNotifyRequest
.nr_Name
= NULL
;
1184 volPrivate
->vip_FSNotifyRequest
.nr_UserData
= (IPTR
)NULL
;
1188 this_Icon
= (struct IconEntry
*)DoSuperMethodA(CLASS
, obj
, (Msg
) message
);
1190 return (IPTR
)this_Icon
;
1193 IPTR
IconWindowVolumeList__MUIM_IconList_DestroyEntry(struct IClass
*CLASS
, Object
*obj
, struct MUIP_IconList_DestroyEntry
*message
)
1195 struct VolumeIcon_Private
*volPrivate
= NULL
;
1198 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__
));
1200 volPrivate
= message
->entry
->ie_IconListEntry
.udata
;
1202 if ((message
->entry
->ie_IconListEntry
.type
== ST_ROOT
))
1204 if (volPrivate
->vip_FSNotifyRequest
.nr_Name
!= NULL
)
1206 EndNotify(&volPrivate
->vip_FSNotifyRequest
);
1207 FreeMem((struct Wanderer_FSHandler
*)volPrivate
->vip_FSNotifyRequest
.nr_UserData
, sizeof(struct Wanderer_FSHandler
));
1208 volPrivate
->vip_FSNotifyRequest
.nr_Name
= NULL
;
1209 volPrivate
->vip_FSNotifyRequest
.nr_UserData
= (IPTR
)NULL
;
1212 else if ((message
->entry
->ie_IconListEntry
.type
== ST_LINKFILE
) || (message
->entry
->ie_IconListEntry
.type
== ST_LINKDIR
))
1213 message
->entry
->ie_IconListEntry
.udata
= NULL
;
1215 D(bug("[Wanderer:VolumeList] %s: causing parent class to dispose of '%s'\n", __PRETTY_FUNCTION__
, message
->entry
->ie_IconNode
.ln_Name
));
1217 rv
= DoSuperMethodA(CLASS
, obj
, (Msg
) message
);
1222 IPTR
IconWindowVolumeList__MUIM_IconList_DrawEntry(struct IClass
*CLASS
, Object
*self
, struct MUIP_IconList_DrawEntry
*message
)
1224 D(bug("[Wanderer:Volumelist]: %s()\n", __PRETTY_FUNCTION__
));
1226 /* If the Entry is an AppIcon, and it has a renderhook - use the hook to perform the rendering, otherwise fallback to our parents handling */
1227 if (message
->entry
->ie_IconListEntry
.type
== ILE_TYPE_APPICON
)
1229 if (AppIcon_Supports((struct AppIcon
*)message
->entry
->ie_User1
, WBAPPICONA_RenderHook
))
1231 struct AppIconRenderMsg renderMsg
;
1232 struct TagItem renderTags
[] = {
1233 { ICONDRAWA_Frameless
, TRUE
},
1234 { ICONDRAWA_Borderless
, TRUE
},
1235 { ICONDRAWA_EraseBackground
, FALSE
},
1239 GET(self
, MUIA_IconList_BufferRastport
, &renderMsg
.arm_RastPort
);
1240 renderMsg
.arm_Icon
= message
->entry
->ie_DiskObj
;
1241 renderMsg
.arm_Label
= message
->entry
->ie_TxtBuf_DisplayedLabel
;
1243 renderMsg
.arm_Left
= message
->entry
->ie_IconX
;
1244 renderMsg
.arm_Top
= message
->entry
->ie_IconY
;
1245 renderMsg
.arm_Width
= message
->entry
->ie_IconWidth
;
1246 renderMsg
.arm_Height
= message
->entry
->ie_IconHeight
;
1248 renderMsg
.arm_State
= (message
->entry
->ie_Flags
& ICONENTRY_FLAG_SELECTED
) ? IDS_SELECTED
: IDS_NORMAL
;
1249 renderMsg
.arm_Tags
= renderTags
;
1251 D(bug("[Wanderer:Volumelist] %s: Using AppIcon RenderHook for AppIcon 0x%p with DiskObj 0x%p and RastPort 0x%p\n",
1252 __PRETTY_FUNCTION__
, diEntry
->di_Data
, renderMsg
.arm_Icon
, renderMsg
.arm_RastPort
));
1253 D(bug("[Wanderer:Volumelist] %s: Render @ %d, %d (%d x %d pixels)\n", __PRETTY_FUNCTION__
,
1254 renderMsg
.arm_Left
, renderMsg
.arm_Top
, renderMsg
.arm_Width
, renderMsg
.arm_Height
));
1256 AppIcon_CallRenderHook((struct AppIcon
*)message
->entry
->ie_User1
, &renderMsg
);
1262 return DoSuperMethodA(CLASS
, self
, (Msg
) message
);
1265 IPTR
IconWindowVolumeList__MUIM_IconList_PropagateEntryPos(struct IClass
*CLASS
, Object
*obj
,
1266 struct MUIP_IconList_PropagateEntryPos
*message
)
1269 if (message
->entry
->ie_IconListEntry
.type
== ILE_TYPE_APPICON
)
1271 struct AppIcon
* ai
= (struct AppIcon
*)message
->entry
->ie_User1
;
1273 if (AppIcon_Supports(ai
, WBAPPICONA_PropagatePosition
))
1275 struct DiskObject
* diskobj
= AppIcon_GetDiskObject(ai
);
1276 diskobj
->do_CurrentX
= message
->entry
->ie_IconX
;
1277 diskobj
->do_CurrentY
= message
->entry
->ie_IconY
;
1281 return DoSuperMethodA(CLASS
, obj
, (Msg
) message
);
1284 IPTR
IconWindowVolumeList__MUIM_IconList_DrawEntryLabel(struct IClass
*CLASS
, Object
*self
, struct MUIP_IconList_DrawEntryLabel
*message
)
1286 D(bug("[Wanderer:Volumelist]: %s()\n", __PRETTY_FUNCTION__
));
1288 if (message
->entry
->ie_IconListEntry
.type
== ILE_TYPE_APPICON
)
1290 if (AppIcon_Supports((struct AppIcon
*)message
->entry
->ie_User1
, WBAPPICONA_RenderHook
))
1294 return DoSuperMethodA(CLASS
, self
, (Msg
) message
);
1298 /*** Setup ******************************************************************/
1300 ICONWINDOWICONVOLUMELIST_CUSTOMCLASS
1302 IconWindowVolumeList
, NULL
, MUIC_IconVolumeList
, NULL
,
1303 OM_NEW
, struct opSet
*,
1304 OM_SET
, struct opSet
*,
1305 OM_GET
, struct opGet
*,
1308 MUIM_DrawBackground
, struct MUIP_DrawBackground
*,
1309 MUIM_HandleEvent
, struct MUIP_HandleEvent
*,
1310 MUIM_IconList_Update
, struct MUIP_IconList_Update
*,
1311 MUIM_IconList_CreateEntry
, struct MUIP_IconList_CreateEntry
*,
1312 MUIM_IconList_UpdateEntry
, struct MUIP_IconList_UpdateEntry
*,
1313 MUIM_IconList_DestroyEntry
, struct MUIP_IconList_DestroyEntry
*,
1314 MUIM_IconList_PropagateEntryPos
, struct MUIP_IconList_PropagateEntryPos
*,
1315 MUIM_IconList_DrawEntry
, struct MUIP_IconList_DrawEntry
*,
1316 MUIM_IconList_DrawEntryLabel
, struct MUIP_IconList_DrawEntryLabel
*
1319 ICONWINDOWICONVOLUMELIST_CUSTOMCLASS
1321 IconWindowVolumeList
, NULL
, NULL
, IconVolumeList_Class
,
1322 OM_NEW
, struct opSet
*,
1323 OM_SET
, struct opSet
*,
1324 OM_GET
, struct opGet
*,
1327 MUIM_DrawBackground
, Msg
,
1328 MUIM_HandleEvent
, Msg
,
1329 MUIM_IconList_Update
, struct MUIP_IconList_Update
*,
1330 MUIM_IconList_CreateEntry
, struct MUIP_IconList_CreateEntry
*,
1331 MUIM_IconList_UpdateEntry
, struct MUIP_IconList_UpdateEntry
*,
1332 MUIM_IconList_DestroyEntry
, struct MUIP_IconList_DestroyEntry
*,
1333 MUIM_IconList_PropagateEntryPos
, struct MUIP_IconList_PropagateEntryPos
*,
1334 MUIM_IconList_DrawEntry
, struct MUIP_IconList_DrawEntry
*,
1335 MUIM_IconList_DrawEntryLabel
, struct MUIP_IconList_DrawEntryLabel
*