2 Copyright 2004-2009, The AROS Development Team. All rights reserved.
8 #include "portable_macros.h"
11 #define MUIMASTER_YES_INLINE_STDARG
14 #define TXTBUFF_LEN 1024
18 #include <aros/debug.h>
21 #include <exec/types.h>
22 #include <libraries/mui.h>
25 #include <zune/customclasses.h>
27 #include <zune_AROS/customclasses.h>
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>
39 #include <proto/dos.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
51 #ifndef _PROTO_INTUITION_H
52 #include <proto/intuition.h>
54 #include <proto/muimaster.h>
56 #include "Classes/iconlist.h"
57 #include "Classes/iconlist_attributes.h"
58 #include "Classes/icon_attributes.h"
61 #include "wandererprefs.h"
62 #include "iconwindow.h"
63 #include "iconwindow_iconlist.h"
70 #define D(x) if (DEBUG) x
72 #define bug DebugPrintF
81 extern struct IconWindow_BackFill_Descriptor
*iconwindow_BackFill_Active
;
86 #define BG_DRAWFLAG 0xf00dd00f
88 /*** Instance Data **********************************************************/
90 struct IconWindowDrawerList_DATA
92 Object
*iwidld_IconWindow
;
93 struct RastPort
*iwidld_RastPort
;
94 struct MUI_EventHandlerNode iwidld_EventHandlerNode
;
96 struct Hook iwidld_ProcessIconListPrefs_hook
;
98 struct Hook
*iwidld_ProcessIconListPrefs_hook
;
101 IPTR iwidld_ViewPrefs_ID
;
102 Object
*iwidld_ViewPrefs_NotificationObject
;
104 /* File System update handling */
105 struct Wanderer_FSHandler iwidld_FSHandler
;
106 struct NotifyRequest iwidld_DrawerNotifyRequest
;
107 ULONG iwidld_LastRefresh
; /* In seconds */
108 BOOL iwidld_FSChanged
;
111 // static char __icwc_intern_TxtBuff[TXTBUFF_LEN];
113 /*** Macros *****************************************************************/
114 #define SETUP_INST_DATA struct IconWindowDrawerList_DATA *data = INST_DATA(CLASS, self)
116 /*** Hook functions *********************************************************/
117 ///IconWindowDrawerList__HookFunc_ProcessIconListPrefsFunc()
120 void, IconWindowDrawerList__HookFunc_ProcessIconListPrefsFunc
,
121 AROS_UFHA(struct Hook
*, hook
, A0
),
122 AROS_UFHA(APTR
*, obj
, A2
),
123 AROS_UFHA(IPTR
*, param
, A1
)
127 HOOKPROTO(IconWindowDrawerList__HookFunc_ProcessIconListPrefsFunc
, void, APTR
*obj
, IPTR
*param
)
132 /* Get our private data */
133 Object
*self
= ( Object
*)obj
;
134 IPTR CHANGED_ATTRIB
= *param
;
135 Class
*CLASS
= OCLASS(self
);
139 Object
*prefs
= NULL
;
141 D(bug("[Wanderer:DrawerList]: %s()\n", __PRETTY_FUNCTION__
));
143 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
147 IPTR attrib_Current
= 0, attrib_Prefs
, prefs_Processing
= 0;
148 BOOL options_changed
= FALSE
;
150 D(bug("[Wanderer:DrawerList] %s: Setting IconList options ..\n", __PRETTY_FUNCTION__
));
152 GET(prefs
, MUIA_WandererPrefs_Processing
, &prefs_Processing
);
154 switch (CHANGED_ATTRIB
)
156 case MUIA_IconList_IconListMode
:
157 GET(self
, MUIA_IconList_IconListMode
, &attrib_Current
);
159 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_IconListMode
)) != -1) &&
160 (attrib_Current
!= attrib_Prefs
))
162 D(bug("[Wanderer:DrawerList] %s: IconList ListMode changed - updating ..\n", __PRETTY_FUNCTION__
));
163 options_changed
= TRUE
;
164 if (prefs_Processing
)
166 NNSET(self
, MUIA_IconList_IconListMode
, attrib_Prefs
);
170 SET(self
, MUIA_IconList_IconListMode
, attrib_Prefs
);
175 case MUIA_IconList_LabelText_Mode
:
176 GET(self
, MUIA_IconList_LabelText_Mode
, &attrib_Current
);
178 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_Mode
)) != -1) &&
179 (attrib_Current
!= attrib_Prefs
))
181 D(bug("[Wanderer:DrawerList] %s: IconList TextRenderMode changed - updating ..\n", __PRETTY_FUNCTION__
));
182 options_changed
= TRUE
;
183 if (prefs_Processing
)
185 NNSET(self
, MUIA_IconList_LabelText_Mode
, attrib_Prefs
);
189 SET(self
, MUIA_IconList_LabelText_Mode
, attrib_Prefs
);
194 case MUIA_IconList_LabelText_MaxLineLen
:
195 GET(self
, MUIA_IconList_LabelText_MaxLineLen
, &attrib_Current
);
197 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_MaxLineLen
)) != -1) &&
198 (attrib_Current
!= attrib_Prefs
))
200 D(bug("[Wanderer:DrawerList] %s: IconList Max Text Length changed - updating ..\n", __PRETTY_FUNCTION__
));
201 options_changed
= TRUE
;
202 if (prefs_Processing
)
204 NNSET(self
, MUIA_IconList_LabelText_MaxLineLen
, attrib_Prefs
);
208 SET(self
, MUIA_IconList_LabelText_MaxLineLen
, attrib_Prefs
);
213 case MUIA_IconList_LabelText_MultiLine
:
214 GET(self
, MUIA_IconList_LabelText_MultiLine
, &attrib_Current
);
216 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_MultiLine
)) != -1) &&
217 (attrib_Current
!= attrib_Prefs
))
219 D(bug("[Wanderer:DrawerList] %s: IconList Multi-Line changed - updating ..\n", __PRETTY_FUNCTION__
));
220 options_changed
= TRUE
;
221 if (prefs_Processing
)
223 NNSET(self
, MUIA_IconList_LabelText_MultiLine
, attrib_Prefs
);
227 SET(self
, MUIA_IconList_LabelText_MultiLine
, attrib_Prefs
);
232 case MUIA_IconList_LabelText_MultiLineOnFocus
:
233 GET(self
, MUIA_IconList_LabelText_MultiLineOnFocus
, &attrib_Current
);
235 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_MultiLineOnFocus
)) != -1) &&
236 (attrib_Current
!= attrib_Prefs
))
238 D(bug("[Wanderer:DrawerList] %s: Multi-Line on Focus changed - updating ..\n", __PRETTY_FUNCTION__
));
239 options_changed
= TRUE
;
240 if (prefs_Processing
)
242 NNSET(self
, MUIA_IconList_LabelText_MultiLineOnFocus
, attrib_Prefs
);
246 SET(self
, MUIA_IconList_LabelText_MultiLineOnFocus
, attrib_Prefs
);
251 case MUIA_IconList_Icon_HorizontalSpacing
:
252 GET(self
, MUIA_IconList_Icon_HorizontalSpacing
, &attrib_Current
);
254 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_Icon_HorizontalSpacing
)) != -1) &&
255 (attrib_Current
!= attrib_Prefs
))
257 D(bug("[Wanderer:DrawerList] %s: Icon Horizontal Spacing changed - updating ..\n", __PRETTY_FUNCTION__
));
258 options_changed
= TRUE
;
259 if (prefs_Processing
)
261 NNSET(self
, MUIA_IconList_Icon_HorizontalSpacing
, attrib_Prefs
);
265 SET(self
, MUIA_IconList_Icon_HorizontalSpacing
, attrib_Prefs
);
270 case MUIA_IconList_Icon_VerticalSpacing
:
271 GET(self
, MUIA_IconList_Icon_VerticalSpacing
, &attrib_Current
);
273 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_Icon_VerticalSpacing
)) != -1) &&
274 (attrib_Current
!= attrib_Prefs
))
276 D(bug("[Wanderer:DrawerList] %s: Icon Vertical Spacing changed - updating ..\n", __PRETTY_FUNCTION__
));
277 options_changed
= TRUE
;
278 if (prefs_Processing
)
280 NNSET(self
, MUIA_IconList_Icon_VerticalSpacing
, attrib_Prefs
);
284 SET(self
, MUIA_IconList_Icon_VerticalSpacing
, attrib_Prefs
);
289 case MUIA_IconList_Icon_ImageSpacing
:
290 GET(self
, MUIA_IconList_Icon_ImageSpacing
, &attrib_Current
);
292 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_Icon_ImageSpacing
)) != -1) &&
293 (attrib_Current
!= attrib_Prefs
))
295 D(bug("[Wanderer:DrawerList] %s: Icon Label Image Spacing changed - updating ..\n", __PRETTY_FUNCTION__
));
296 options_changed
= TRUE
;
297 if (prefs_Processing
)
299 NNSET(self
, MUIA_IconList_Icon_ImageSpacing
, attrib_Prefs
);
303 SET(self
, MUIA_IconList_Icon_ImageSpacing
, attrib_Prefs
);
308 case MUIA_IconList_LabelText_HorizontalPadding
:
309 GET(self
, MUIA_IconList_LabelText_HorizontalPadding
, &attrib_Current
);
311 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_HorizontalPadding
)) != -1) &&
312 (attrib_Current
!= attrib_Prefs
))
314 D(bug("[Wanderer:DrawerList] %s: Icon Label Horizontal Padding changed - updating ..\n", __PRETTY_FUNCTION__
));
315 options_changed
= TRUE
;
316 if (prefs_Processing
)
318 NNSET(self
, MUIA_IconList_LabelText_HorizontalPadding
, attrib_Prefs
);
322 SET(self
, MUIA_IconList_LabelText_HorizontalPadding
, attrib_Prefs
);
327 case MUIA_IconList_LabelText_VerticalPadding
:
328 GET(self
, MUIA_IconList_LabelText_VerticalPadding
, &attrib_Current
);
330 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_VerticalPadding
)) != -1) &&
331 (attrib_Current
!= attrib_Prefs
))
333 D(bug("[Wanderer:DrawerList] %s: Icon Label Vertical Padding changed - updating ..\n", __PRETTY_FUNCTION__
));
334 options_changed
= TRUE
;
335 if (prefs_Processing
)
337 NNSET(self
, MUIA_IconList_LabelText_VerticalPadding
, attrib_Prefs
);
341 SET(self
, MUIA_IconList_LabelText_VerticalPadding
, attrib_Prefs
);
346 case MUIA_IconList_LabelText_BorderWidth
:
347 GET(self
, MUIA_IconList_LabelText_BorderWidth
, &attrib_Current
);
349 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_BorderWidth
)) != -1) &&
350 (attrib_Current
!= attrib_Prefs
))
352 D(bug("[Wanderer:DrawerList] %s: Icon Label Border Width changed - updating ..\n", __PRETTY_FUNCTION__
));
353 options_changed
= TRUE
;
354 if (prefs_Processing
)
356 NNSET(self
, MUIA_IconList_LabelText_BorderWidth
, attrib_Prefs
);
360 SET(self
, MUIA_IconList_LabelText_BorderWidth
, attrib_Prefs
);
365 case MUIA_IconList_LabelText_BorderHeight
:
366 GET(self
, MUIA_IconList_LabelText_BorderHeight
, &attrib_Current
);
368 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_BorderHeight
)) != -1) &&
369 (attrib_Current
!= attrib_Prefs
))
371 D(bug("[Wanderer:DrawerList] %s: Icon Label Border Height changed - updating ..\n", __PRETTY_FUNCTION__
));
372 options_changed
= TRUE
;
373 if (prefs_Processing
)
375 NNSET(self
, MUIA_IconList_LabelText_BorderHeight
, attrib_Prefs
);
379 SET(self
, MUIA_IconList_LabelText_BorderHeight
, attrib_Prefs
);
382 case MUIA_IconList_DragImageTransparent
:
383 case MUIA_IconList_SortFlags
:
385 GET(self
, (ULONG
)CHANGED_ATTRIB
, &attrib_Current
);
387 if (((attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, (ULONG
)CHANGED_ATTRIB
)) != -1) &&
388 (attrib_Current
!= attrib_Prefs
))
390 options_changed
= TRUE
;
391 if (prefs_Processing
)
393 NNSET(self
, (ULONG
)CHANGED_ATTRIB
, attrib_Prefs
);
397 SET(self
, (ULONG
)CHANGED_ATTRIB
, attrib_Prefs
);
403 D(bug("[Wanderer:DrawerList] %s: Unhandled change\n", __PRETTY_FUNCTION__
));
409 if (!(prefs_Processing
))
411 D(bug("[Wanderer:DrawerList] %s: IconList Options have changed, causing an update ..\n", __PRETTY_FUNCTION__
));
412 DoMethod(self
, MUIM_IconList_Update
);
413 DoMethod(self
, MUIM_IconList_Sort
);
415 else if (data
->iwidld_IconWindow
)
417 SET(data
->iwidld_IconWindow
, MUIA_IconWindow_Changed
, TRUE
);
424 MakeStaticHook(Hook_ProcessIconListPrefsFunc
, IconWindowDrawerList__HookFunc_ProcessIconListPrefsFunc
);
429 /*** Methods ****************************************************************/
431 Object
*IconWindowDrawerList__OM_NEW(Class
*CLASS
, Object
*self
, struct opSet
*message
)
433 IPTR _newIconList__FSNotifyPort
= 0;
435 D(bug("[Wanderer:DrawerList]: %s()\n", __PRETTY_FUNCTION__
));
437 _newIconList__FSNotifyPort
= GetTagData(MUIA_Wanderer_FileSysNotifyPort
, (IPTR
) NULL
, message
->ops_AttrList
);
439 self
= (Object
*) DoSuperNewTags
443 TAG_MORE
, (IPTR
) message
->ops_AttrList
449 D(bug("[Wanderer:DrawerList] %s: SELF @ 0x%p\n", __PRETTY_FUNCTION__
, self
));
452 data
->iwidld_ProcessIconListPrefs_hook
.h_Entry
= ( HOOKFUNC
)IconWindowDrawerList__HookFunc_ProcessIconListPrefsFunc
;
454 data
->iwidld_ProcessIconListPrefs_hook
= &Hook_ProcessIconListPrefsFunc
;
457 if (_newIconList__FSNotifyPort
!= 0)
459 struct IconWindowDrawerList_DATA
*drawerlist_data
= (struct IconWindowDrawerList_DATA
*)data
;
460 drawerlist_data
->iwidld_DrawerNotifyRequest
.nr_stuff
.nr_Msg
.nr_Port
= (struct MsgPort
*)_newIconList__FSNotifyPort
;
461 D(bug("[Wanderer:DrawerList] %s: FS Notify Port @ 0x%p\n", __PRETTY_FUNCTION__
, _newIconList__FSNotifyPort
));
469 IPTR
IconWindowDrawerList__HandleFSUpdate(Object
* iconwindow
, struct NotifyMessage
*msg
)
471 return DoMethod(iconwindow
, MUIM_IconWindowDrawerList_FileSystemChanged
);
474 ULONG
GetCurrentTimeInSeconds()
476 struct DateStamp stamp
;
480 return (stamp
.ds_Days
* 60 * 60 * 24) + (stamp
.ds_Minute
* 60) + (stamp
.ds_Tick
/ 50);
483 VOID
RemoveFSNotification(struct IconWindowDrawerList_DATA
*data
)
485 if (data
->iwidld_DrawerNotifyRequest
.nr_Name
!= NULL
)
487 D(bug("[Wanderer:DrawerList] %s: Removing Drawer FS Notification Request\n", __PRETTY_FUNCTION__
));
488 /* EndNotify also replies all already send messages, so they won't end up hitting dead space in handler->HandleFSUpdate */
489 EndNotify(&data
->iwidld_DrawerNotifyRequest
);
490 FreeVec(data
->iwidld_DrawerNotifyRequest
.nr_Name
);
491 data
->iwidld_DrawerNotifyRequest
.nr_Name
= NULL
;
492 data
->iwidld_FSHandler
.fshn_Node
.ln_Name
= NULL
;
496 VOID
UpdateFSNotification(STRPTR directory_path
, struct IconWindowDrawerList_DATA
*data
, APTR target
)
498 /* Remove existing if present */
499 RemoveFSNotification(data
);
502 if (directory_path
!= NULL
)
504 if (data
->iwidld_DrawerNotifyRequest
.nr_stuff
.nr_Msg
.nr_Port
!= NULL
)
506 data
->iwidld_FSHandler
.target
= target
;
507 data
->iwidld_FSHandler
.HandleFSUpdate
= IconWindowDrawerList__HandleFSUpdate
;
508 data
->iwidld_DrawerNotifyRequest
.nr_Name
= StrDup(directory_path
);
509 data
->iwidld_DrawerNotifyRequest
.nr_Flags
= NRF_SEND_MESSAGE
;
510 data
->iwidld_DrawerNotifyRequest
.nr_UserData
= (IPTR
)&data
->iwidld_FSHandler
;
511 data
->iwidld_LastRefresh
= GetCurrentTimeInSeconds();
512 data
->iwidld_FSChanged
= FALSE
;
513 data
->iwidld_FSHandler
.fshn_Node
.ln_Name
= data
->iwidld_DrawerNotifyRequest
.nr_Name
;
515 if (StartNotify(&data
->iwidld_DrawerNotifyRequest
))
517 D(bug("[Wanderer:DrawerList] %s: Drawer-notification setup on '%s'\n", __PRETTY_FUNCTION__
, directory_path
));
521 D(bug("[Wanderer:DrawerList] %s: FAILED to setup Drawer-notification on '%s'!\n", __PRETTY_FUNCTION__
, directory_path
));
522 FreeVec(data
->iwidld_DrawerNotifyRequest
.nr_Name
);
523 data
->iwidld_DrawerNotifyRequest
.nr_Name
= NULL
;
524 data
->iwidld_FSHandler
.fshn_Node
.ln_Name
= NULL
;
531 IPTR
IconWindowDrawerList__OM_SET(Class
*CLASS
, Object
*self
, struct opSet
*message
)
535 struct TagItem
*tstate
= message
->ops_AttrList
, *tag
;
537 while ((tag
= NextTagItem((const struct TagItem
**)&tstate
)) != NULL
)
541 case MUIA_Background
:
543 D(bug("[Wanderer:DrawerList] %s: MUIA_Background\n", __PRETTY_FUNCTION__
));
546 case MUIA_IconWindow_Window
:
548 D(bug("[Wanderer:DrawerList] %s: MUIA_IconWindow_Window @ %p\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
549 data
->iwidld_IconWindow
= (Object
*)tag
->ti_Data
;
552 case MUIA_IconList_BufferRastport
:
554 D(bug("[Wanderer:DrawerList] %s: MUIA_IconList_BufferRastport @ %p\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
555 data
->iwidld_RastPort
= (struct RastPort
*)tag
->ti_Data
;
558 case MUIA_IconDrawerList_Drawer
:
560 D(bug("[Wanderer:DrawerList] %s: MUIA_IconDrawerList_Drawer @ %p\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
561 UpdateFSNotification((STRPTR
)tag
->ti_Data
, data
, self
);
562 break; /* Fallthrough and handle this in parent class as well */
566 return DoSuperMethodA(CLASS
, self
, (Msg
) message
);
571 IPTR
IconWindowDrawerList__OM_GET(Class
*CLASS
, Object
*self
, struct opGet
*message
)
574 IPTR
*store
= message
->opg_Storage
;
577 switch (message
->opg_AttrID
)
580 *store
= (IPTR
)WIWDLVERS
;
584 *store
= (IPTR
)WIWDLREV
;
588 rv
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
595 ///IconWindowDrawerList__MUIM_Setup()
596 IPTR IconWindowDrawerList__MUIM_Setup
598 Class
*CLASS
, Object
*self
, Msg message
603 Object
*prefs
= NULL
;
605 if (!DoSuperMethodA(CLASS
, self
, message
)) return FALSE
;
607 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
611 /* Set our initial options */
614 GET(_win(self
), MUIA_IconWindow_BackgroundAttrib
, &data
->iwidld_ViewPrefs_ID
);
615 D(bug("[Wanderer:DrawerList] %s: Window Background = '%s'\n", __PRETTY_FUNCTION__
, data
->iwidld_ViewPrefs_ID
));
616 data
->iwidld_ViewPrefs_NotificationObject
= (Object
*)DoMethod(prefs
,
617 MUIM_WandererPrefs_ViewSettings_GetNotifyObject
,
618 data
->iwidld_ViewPrefs_ID
);
620 D(bug("[Wanderer:DrawerList] %s: Background Notification Obj @ 0x%p\n", __PRETTY_FUNCTION__
, data
->iwidld_ViewPrefs_NotificationObject
));
622 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_IconListMode
);
623 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_IconListMode
))) SET(self
, MUIA_IconList_IconListMode
, attrib_Prefs
);
625 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_Mode
);
626 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_LabelText_Mode
))) SET(self
, MUIA_IconList_LabelText_Mode
, attrib_Prefs
);
628 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_SortFlags
);
629 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_SortFlags
))) SET(self
, MUIA_IconList_SortFlags
, attrib_Prefs
);
631 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_DragImageTransparent
);
632 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_DragImageTransparent
))) SET(self
, MUIA_IconList_DragImageTransparent
, attrib_Prefs
);
634 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_MaxLineLen
);
635 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_LabelText_MaxLineLen
))) SET(self
, MUIA_IconList_LabelText_MaxLineLen
, attrib_Prefs
);
637 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_MultiLine
);
638 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_LabelText_MultiLine
))) SET(self
, MUIA_IconList_LabelText_MultiLine
, attrib_Prefs
);
640 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_MultiLineOnFocus
);
641 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_LabelText_MultiLineOnFocus
))) SET(self
, MUIA_IconList_LabelText_MultiLineOnFocus
, attrib_Prefs
);
643 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_Icon_HorizontalSpacing
);
644 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_Icon_HorizontalSpacing
))) SET(self
, MUIA_IconList_Icon_HorizontalSpacing
, attrib_Prefs
);
646 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_Icon_VerticalSpacing
);
647 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_Icon_VerticalSpacing
))) SET(self
, MUIA_IconList_Icon_VerticalSpacing
, attrib_Prefs
);
649 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_Icon_ImageSpacing
);
650 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_Icon_ImageSpacing
))) SET(self
, MUIA_IconList_Icon_ImageSpacing
, attrib_Prefs
);
652 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_HorizontalPadding
);
653 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_LabelText_HorizontalPadding
))) SET(self
, MUIA_IconList_LabelText_HorizontalPadding
, attrib_Prefs
);
655 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_VerticalPadding
);
656 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_LabelText_VerticalPadding
))) SET(self
, MUIA_IconList_LabelText_VerticalPadding
, attrib_Prefs
);
658 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_BorderWidth
);
659 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_LabelText_BorderWidth
))) SET(self
, MUIA_IconList_LabelText_BorderWidth
, attrib_Prefs
);
661 attrib_Prefs
= DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwidld_ViewPrefs_ID
, MUIA_IconList_LabelText_BorderHeight
);
662 if ((attrib_Prefs
!= (IPTR
)-1) && (attrib_Prefs
!= XGET(self
, MUIA_IconList_LabelText_BorderHeight
))) SET(self
, MUIA_IconList_LabelText_BorderHeight
, attrib_Prefs
);
664 /* Configure notifications incase they get updated =) */
667 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_IconListMode
, MUIV_EveryTime
,
669 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_IconListMode
674 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_LabelText_Mode
, MUIV_EveryTime
,
676 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_LabelText_Mode
681 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_SortFlags
, MUIV_EveryTime
,
683 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_SortFlags
688 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_DragImageTransparent
, MUIV_EveryTime
,
690 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_DragImageTransparent
695 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_LabelText_MaxLineLen
, MUIV_EveryTime
,
697 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_LabelText_MaxLineLen
702 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_LabelText_MultiLine
, MUIV_EveryTime
,
704 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_LabelText_MultiLine
709 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_LabelText_MultiLineOnFocus
, MUIV_EveryTime
,
711 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_LabelText_MultiLineOnFocus
716 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_Icon_HorizontalSpacing
, MUIV_EveryTime
,
718 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_Icon_HorizontalSpacing
723 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_Icon_VerticalSpacing
, MUIV_EveryTime
,
725 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_Icon_VerticalSpacing
730 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_Icon_ImageSpacing
, MUIV_EveryTime
,
732 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_Icon_ImageSpacing
737 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_LabelText_HorizontalPadding
, MUIV_EveryTime
,
739 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_LabelText_HorizontalPadding
744 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_LabelText_VerticalPadding
, MUIV_EveryTime
,
746 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_LabelText_VerticalPadding
751 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_LabelText_BorderWidth
, MUIV_EveryTime
,
753 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_LabelText_BorderWidth
758 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_Notify
, MUIA_IconList_LabelText_BorderHeight
, MUIV_EveryTime
,
760 MUIM_CallHook
, &data
->iwidld_ProcessIconListPrefs_hook
, (IPTR
)MUIA_IconList_LabelText_BorderHeight
764 /* Setup notification on the directory -------------------------------- */
765 STRPTR directory_path
= NULL
;
766 GET(self
, MUIA_IconDrawerList_Drawer
, &directory_path
);
768 UpdateFSNotification(directory_path
, data
, self
);
770 D(bug("[Wanderer:DrawerList] %s: Setup complete!\n", __PRETTY_FUNCTION__
));
776 ///IconWindowDrawerList__MUIM_Cleanup()
777 IPTR IconWindowDrawerList__MUIM_Cleanup
779 Class
*CLASS
, Object
*self
, Msg message
784 Object
*prefs
= NULL
;
786 D(bug("[Wanderer:DrawerList]: %s()\n", __PRETTY_FUNCTION__
));
788 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
794 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_IconListMode
, (IPTR
)self
799 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_LabelText_Mode
, (IPTR
)self
804 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_SortFlags
, (IPTR
)self
809 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_DragImageTransparent
, (IPTR
)self
814 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_LabelText_MaxLineLen
, (IPTR
)self
819 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_LabelText_MultiLine
, (IPTR
)self
824 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_LabelText_MultiLineOnFocus
, (IPTR
)self
829 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_Icon_HorizontalSpacing
, (IPTR
)self
834 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_Icon_VerticalSpacing
, (IPTR
)self
839 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_Icon_ImageSpacing
, (IPTR
)self
844 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_LabelText_HorizontalPadding
, (IPTR
)self
849 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_LabelText_VerticalPadding
, (IPTR
)self
854 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_LabelText_BorderWidth
, (IPTR
)self
859 data
->iwidld_ViewPrefs_NotificationObject
, MUIM_KillNotifyObj
, MUIA_IconList_LabelText_BorderHeight
, (IPTR
)self
863 RemoveFSNotification(data
);
865 return DoSuperMethodA(CLASS
, self
, message
);
869 ///IconWindowDrawerList__MUIM_DrawBackground()
870 IPTR IconWindowDrawerList__MUIM_DrawBackground
872 Class
*CLASS
, Object
*self
, struct MUIP_DrawBackground
*message
877 IPTR retVal
= (IPTR
)TRUE
;
879 struct RastPort
*DrawBackGround_RastPort
;
880 struct IconWindowBackFillMsg DrawBackGround_BackFillMsg
;
882 D(bug("[Wanderer:DrawerList]: %s()\n", __PRETTY_FUNCTION__
));
884 if ((iconwindow_BackFill_Active
== NULL
) ||
885 (data
->iwidld_IconWindow
== NULL
))
887 D(bug("[Wanderer:DrawerList] %s: No Backfill support/Window not set .. causing parent class to render\n", __PRETTY_FUNCTION__
));
888 goto iwc_ParentBackground
;
891 DrawBackGround_RastPort
= _rp(self
);
893 if ((data
->iwidld_RastPort
!= NULL
) && (DrawBackGround_RastPort
!= data
->iwidld_RastPort
))
895 DrawBackGround_RastPort
= data
->iwidld_RastPort
;
897 DrawBackGround_BackFillMsg
.AreaBounds
.MinX
= 0;
898 DrawBackGround_BackFillMsg
.AreaBounds
.MinY
= 0;
899 DrawBackGround_BackFillMsg
.AreaBounds
.MaxX
= _mwidth(self
) - 1;
900 DrawBackGround_BackFillMsg
.AreaBounds
.MaxY
= _mheight(self
) - 1;
902 DrawBackGround_BackFillMsg
.DrawBounds
.MinX
= message
->left
- _mleft(self
);
903 DrawBackGround_BackFillMsg
.DrawBounds
.MinY
= message
->top
- _mtop(self
);
904 DrawBackGround_BackFillMsg
.DrawBounds
.MaxX
= DrawBackGround_BackFillMsg
.DrawBounds
.MinX
+ message
->width
- 1;
905 DrawBackGround_BackFillMsg
.DrawBounds
.MaxY
= DrawBackGround_BackFillMsg
.DrawBounds
.MinY
+ message
->height
- 1;
909 DrawBackGround_BackFillMsg
.AreaBounds
.MinX
= _mleft(self
);
910 DrawBackGround_BackFillMsg
.AreaBounds
.MinY
= _mtop(self
);
911 DrawBackGround_BackFillMsg
.AreaBounds
.MaxX
= _mleft(self
) + _mwidth(self
) - 1;
912 DrawBackGround_BackFillMsg
.AreaBounds
.MaxY
= _mtop(self
) + _mheight(self
) - 1;
914 DrawBackGround_BackFillMsg
.DrawBounds
.MinX
= message
->left
;
915 DrawBackGround_BackFillMsg
.DrawBounds
.MinY
= message
->top
;
916 DrawBackGround_BackFillMsg
.DrawBounds
.MaxX
= message
->left
+ message
->width
- 1;
917 DrawBackGround_BackFillMsg
.DrawBounds
.MaxY
= message
->top
+ message
->height
- 1;
920 DrawBackGround_BackFillMsg
.Layer
= DrawBackGround_RastPort
->Layer
;
922 /* Offset into source image (ala scroll bar position) */
923 DrawBackGround_BackFillMsg
.OffsetX
= message
->xoffset
;
924 DrawBackGround_BackFillMsg
.OffsetY
= message
->yoffset
;
926 D(bug("[Wanderer:DrawerList] %s: RastPort @ 0x%p\n", __PRETTY_FUNCTION__
, DrawBackGround_RastPort
));
928 if ((retVal
= DoMethod(data
->iwidld_IconWindow
, MUIM_IconWindow_BackFill_DrawBackground
, XGET(data
->iwidld_IconWindow
, MUIA_IconWindow_BackFillData
), &DrawBackGround_BackFillMsg
, DrawBackGround_RastPort
)) == (IPTR
)TRUE
)
930 D(bug("[Wanderer:DrawerList] %s: Backfill module rendered background ..\n", __PRETTY_FUNCTION__
));
933 D(bug("[Wanderer:DrawerList] %s: Backfill module failed to render background ..\n", __PRETTY_FUNCTION__
));
935 iwc_ParentBackground
:
937 clip
= (IPTR
)MUI_AddClipping(muiRenderInfo(self
), message
->left
, message
->top
, message
->width
, message
->height
);
939 message
->width
= _mwidth(self
);
940 message
->height
= _mheight(self
);
941 message
->left
= _mleft(self
);
942 message
->top
= _mtop(self
);
944 retVal
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
946 MUI_RemoveClipping(muiRenderInfo(self
), (APTR
)clip
);
952 /// IconWindowDrawerList__MUIM_IconWindowDrawerList_FileSystemChanged
953 IPTR IconWindowDrawerList__MUIM_IconWindowDrawerList_FileSystemChanged
955 Class
*CLASS
, Object
*self
, Msg message
960 data
->iwidld_FSChanged
= TRUE
;
962 return DoMethod(self
, MUIM_IconWindowIconList_RateLimitRefresh
);
966 /// IconWindowDrawerList__MUIM_IconWindowIconList_RateLimitRefresh
967 IPTR IconWindowDrawerList__MUIM_IconWindowIconList_RateLimitRefresh
969 Class
*CLASS
, Object
*self
, Msg message
975 if (!data
->iwidld_FSChanged
)
978 current
= GetCurrentTimeInSeconds();
980 if (data
->iwidld_LastRefresh
<= current
- 3) /* At most every 3 seconds */
982 DoMethod(self
, MUIM_IconList_Update
);
983 DoMethod(self
, MUIM_IconList_Sort
);
984 /* Record finish time */
985 data
->iwidld_LastRefresh
= GetCurrentTimeInSeconds();
986 data
->iwidld_FSChanged
= FALSE
;
994 /*** Setup ******************************************************************/
996 ICONWINDOWICONDRAWERLIST_CUSTOMCLASS
998 IconWindowDrawerList
, NULL
, MUIC_IconDrawerList
, NULL
,
999 OM_NEW
, struct opSet
*,
1000 OM_SET
, struct opSet
*,
1001 OM_GET
, struct opGet
*,
1004 MUIM_DrawBackground
, struct MUIP_DrawBackground
*,
1005 MUIM_IconWindowDrawerList_FileSystemChanged
, Msg
,
1006 MUIM_IconWindowIconList_RateLimitRefresh
, Msg
1009 ICONWINDOWICONDRAWERLIST_CUSTOMCLASS
1011 IconWindowDrawerList
, NULL
, NULL
, IconDrawerList_Class
,
1012 OM_NEW
, struct opSet
*,
1013 OM_SET
, struct opSet
*,
1014 OM_GET
, struct opGet
*,
1017 MUIM_DrawBackground
, struct MUIP_DrawBackground
*,
1018 MUIM_IconWindowDrawerList_FileSystemChanged
, Msg
,
1019 MUIM_IconWindowIconList_RateLimitRefresh
, Msg