2 Copyright © 2004-2016, The AROS Development Team. All rights reserved.
7 #define DOPENWINDOW(x) /* Window positioning and size */
11 #include "portable_macros.h"
13 #define MUIMASTER_YES_INLINE_STDARG
16 #define ICONWINDOW_NODETAILVIEWCLASS
17 //#define ICONWINDOW_BUFFERLIST
19 #include <exec/types.h>
20 #include <libraries/mui.h>
22 #include <proto/utility.h>
24 #include <proto/graphics.h>
26 #include <proto/exec.h>
27 #include <proto/datatypes.h>
30 #include <proto/dos.h>
32 #include <proto/icon.h>
37 #include <intuition/screens.h>
38 #include <datatypes/pictureclass.h>
39 #include <clib/macros.h>
42 #include <aros/debug.h>
43 #include <clib/alib_protos.h>
44 #include <prefs/wanderer.h>
45 #include <zune/customclasses.h>
47 #include <prefs_AROS/wanderer.h>
48 #include <zune_AROS/customclasses.h>
51 #if defined(__AMIGA__) && !defined(__PPC__)
52 #define NO_INLINE_STDARG
54 #include <proto/intuition.h>
55 #include <proto/muimaster.h>
57 #include "Classes/iconlist.h"
58 #include "Classes/iconlistview.h"
59 #include "Classes/iconlist_attributes.h"
60 #include "Classes/icon_attributes.h"
62 #include "wandererprefs.h"
64 #include "iconwindow.h"
65 #include "iconwindow_attributes.h"
66 #include "iconwindow_iconlist.h"
67 #include "iconwindowbackfill.h"
74 #define D(x) if (DEBUG) x
76 #define bug DebugPrintF
85 #if defined(ICONWINDOW_NODETAILVIEWCLASS)
86 struct MUI_CustomClass
*IconWindowDetailDrawerList_CLASS
;
93 #define DoSuperNew(cl, obj, ...) DoSuperNewTags(cl, obj, NULL, __VA_ARGS__)
95 #define IconListviewObject NewObject(IconListview_Class->mcc_Class
98 /*** Private Global Data *********************************************************/
100 static struct List iconwindow_BackFillNodes
;
101 struct List iconwindow_Extensions
;
102 struct IconWindow_BackFill_Descriptor
*iconwindow_BackFill_Active
;
104 static char __intern_wintitle_wanderer
[] = WANDERERNAME
;
106 #define TT_WNDRRSRT "WNDRRSRT"
109 /*** Helper functions ***********************************************************/
110 STATIC VOID
IconWindow_RestoreSettings(struct DiskObject
* dskobj
, Object
* iconwindowiconlist
, BOOL forceshowall
)
112 ULONG displayFlags
= (ICONLIST_DISP_SHOWINFO
| ICONLIST_DISP_MODEDEFAULT
);
113 BOOL displayFlagsRestored
= FALSE
;
115 if (dskobj
->do_ToolTypes
)
117 STRPTR hexFlags
= FindToolType(dskobj
->do_ToolTypes
, TT_WNDRRSRT
);
118 if (hexFlags
!= NULL
)
120 ULONG sortFlags
= strtol(hexFlags
, NULL
, 16);
121 SET(iconwindowiconlist
, MUIA_IconWindowIconList_RestoredSortFlags
, (ULONG
)sortFlags
);
125 if (dskobj
->do_Gadget
.UserData
)
128 * Note: it is actually possible when reading icons not snapshoted by Wanderer to end up in situation where
129 * only one of the dd_Flafs/dd_ViewModes has supported values. In that case however still the complete
130 * displayFlags are marked as restored. That is why the displayFlags have default value, so not to end
131 * up with invalid window settings.
133 D(bug("[Wanderer:IconWindow] %s: Drawer Icon has OS 2.x/3.x data: FLAGS %x\n", __PRETTY_FUNCTION__
, dskobj
->do_DrawerData
->dd_Flags
));
135 if (dskobj
->do_DrawerData
->dd_Flags
== DDFLAGS_SHOWICONS
)
137 displayFlags
|= ICONLIST_DISP_SHOWINFO
;
138 displayFlagsRestored
= TRUE
;
140 if (dskobj
->do_DrawerData
->dd_Flags
== DDFLAGS_SHOWALL
)
142 displayFlags
&= ~ICONLIST_DISP_SHOWINFO
;
143 displayFlagsRestored
= TRUE
;
145 if (dskobj
->do_DrawerData
->dd_ViewModes
== DDVM_BYICON
)
147 displayFlags
&= ~ICONLIST_DISP_MODE_MASK
;
148 displayFlags
|= ICONLIST_DISP_MODEDEFAULT
;
149 displayFlagsRestored
= TRUE
;
151 if (dskobj
->do_DrawerData
->dd_ViewModes
== DDVM_BYNAME
)
153 displayFlags
&= ~ICONLIST_DISP_MODE_MASK
;
154 displayFlags
|= ICONLIST_DISP_MODELIST
;
155 displayFlagsRestored
= TRUE
;
161 displayFlags
&= ~ICONLIST_DISP_SHOWINFO
;
162 displayFlagsRestored
= TRUE
;
165 if (displayFlagsRestored
)
166 SET(iconwindowiconlist
, MUIA_IconWindowIconList_RestoredDisplayFlags
, displayFlags
);
169 STATIC VOID
IconWindow_StoreSettings(Object
* iconwindow
)
171 Object
*iconList
= (Object
*) XGET(iconwindow
, MUIA_IconWindow_IconList
);
172 STRPTR dir_name
= (char *)XGET(iconwindow
, MUIA_IconWindow_Location
);
173 struct DiskObject
*drawericon
= NULL
;
174 IPTR geticon_error
= 0;
175 IPTR display_bits
= 0, sort_bits
= 0;
177 drawericon
= GetIconTags(dir_name
,
178 ICONGETA_FailIfUnavailable
, FALSE
,
179 ICONA_ErrorCode
, &geticon_error
,
182 if (drawericon
!= NULL
)
184 if (drawericon
->do_DrawerData
== NULL
)
186 D(bug("[Wanderer:IconWindow] %s: Icon for '%s' has no DRAWER data!\n", __PRETTY_FUNCTION__
, dir_name
));
187 drawericon
->do_DrawerData
= AllocMem(sizeof(struct DrawerData
), MEMF_CLEAR
|MEMF_PUBLIC
);
190 drawericon
->do_Gadget
.UserData
= (APTR
)1;
192 if (drawericon
->do_DrawerData
!= NULL
)
194 drawericon
->do_DrawerData
->dd_NewWindow
.TopEdge
= XGET(iconwindow
, MUIA_Window_TopEdge
);
195 drawericon
->do_DrawerData
->dd_NewWindow
.LeftEdge
= XGET(iconwindow
, MUIA_Window_LeftEdge
);
196 drawericon
->do_DrawerData
->dd_NewWindow
.Width
= XGET(iconwindow
, MUIA_Window_Width
);
197 drawericon
->do_DrawerData
->dd_NewWindow
.Height
= XGET(iconwindow
, MUIA_Window_Height
);
199 GET(iconList
, MUIA_IconList_DisplayFlags
, &display_bits
);
200 if (display_bits
& ICONLIST_DISP_SHOWINFO
)
202 D(bug("[Wanderer:IconWindow] %s: ICONLIST_DISP_SHOWINFO\n", __PRETTY_FUNCTION__
));
203 drawericon
->do_DrawerData
->dd_Flags
= DDFLAGS_SHOWICONS
;
207 drawericon
->do_DrawerData
->dd_Flags
= DDFLAGS_SHOWALL
;
210 if (display_bits
& ICONLIST_DISP_MODEDEFAULT
)
212 drawericon
->do_DrawerData
->dd_ViewModes
= DDVM_BYICON
;
214 if (display_bits
& ICONLIST_DISP_MODELIST
)
217 * ByName mode is used to encode list-view display mode. Note that actual sorting
218 * is stored in tool type, so the list-view window stores as DDVM_BYNAME does not
219 * have to be sorted by name.
221 drawericon
->do_DrawerData
->dd_ViewModes
= DDVM_BYNAME
;
225 /* Save settings into Tool Types */
227 LONG i
= 0, inew
= 0, tocopy
= 0;
228 TEXT buffer
[128] = {0};
229 UBYTE
** oldtooltypes
= drawericon
->do_ToolTypes
;
230 UBYTE
** newtooltypes
= NULL
;
232 /* Find how many need to be copied */
233 if (oldtooltypes
!= NULL
)
235 for (i
= 0; oldtooltypes
[i
]; i
++)
237 if (Strnicmp(oldtooltypes
[i
], TT_WNDRRSRT
, strlen(TT_WNDRRSRT
)) == 0)
243 /* Create new pointer array */
244 newtooltypes
= AllocVec(sizeof(STRPTR
) * (tocopy
+ TT_COUNT
+ 1), MEMF_CLEAR
);
246 if (newtooltypes
!= NULL
)
248 /* Copy, inew will have last index value */
249 if (oldtooltypes
!= NULL
)
251 for (i
= 0, inew
= 0; oldtooltypes
[i
]; i
++)
253 if (Strnicmp(oldtooltypes
[i
], TT_WNDRRSRT
, strlen(TT_WNDRRSRT
)) == 0)
255 newtooltypes
[inew
++] = StrDup(oldtooltypes
[i
]);
259 /* Add TT_WNDRRSRT value */
260 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
261 __sprintf(buffer
, TT_WNDRRSRT
"=0x%lx", sort_bits
);
262 newtooltypes
[inew
++] = StrDup(buffer
);
264 drawericon
->do_ToolTypes
= newtooltypes
;
266 PutDiskObject(dir_name
, drawericon
);
268 drawericon
->do_ToolTypes
= oldtooltypes
;
271 for (i
= 0; i
< inew
; i
++)
272 FreeVec(newtooltypes
[i
]);
273 FreeVec(newtooltypes
);
280 /*** Hook functions *********************************************************/
282 ///IconWindow__HookFunc_PrefsUpdatedFunc()
285 void, IconWindow__HookFunc_PrefsUpdatedFunc
,
286 AROS_UFHA(struct Hook
*, hook
, A0
),
287 AROS_UFHA(APTR
*, obj
, A2
),
288 AROS_UFHA(APTR
, param
, A1
)
292 HOOKPROTO(IconWindow__HookFunc_PrefsUpdatedFunc
, void, APTR
*obj
, APTR param
)
297 /* Get our private data */
298 Object
*self
= ( Object
*)obj
;
299 Class
*CLASS
= *( Class
**)param
;
302 SETUP_ICONWINDOW_INST_DATA
;
304 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
307 GET(self
, MUIA_IconWindow_Changed
, &changed_state
);
309 if ((changed_state
) && (data
->iwd_IconListObj
))
311 D(bug("[Wanderer:IconWindow] %s: Window contents have changed .. updating display ..\n", __PRETTY_FUNCTION__
));
312 DoMethod(data
->iwd_IconListObj
, MUIM_IconList_Update
);
313 DoMethod(data
->iwd_IconListObj
, MUIM_IconList_Sort
);
314 SET(self
, MUIA_IconWindow_Changed
, FALSE
);
320 MakeStaticHook(iwd_PrefsUpdated_hook
,IconWindow__HookFunc_PrefsUpdatedFunc
);
324 ///IconWindow__HookFunc_ProcessBackgroundFunc()
327 void, IconWindow__HookFunc_ProcessBackgroundFunc
,
328 AROS_UFHA(struct Hook
*, hook
, A0
),
329 AROS_UFHA(APTR
*, obj
, A2
),
330 AROS_UFHA(APTR
, param
, A1
)
334 HOOKPROTO(IconWindow__HookFunc_ProcessBackgroundFunc
, void, APTR
*obj
, APTR param
)
339 /* Get our private data */
340 Object
*self
= ( Object
*)obj
,
342 Class
*CLASS
= *( Class
**)param
;
344 SETUP_ICONWINDOW_INST_DATA
;
346 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
348 DoMethod(self
, MUIM_IconWindow_BackFill_ProcessBackground
, data
->iwd_BackFillInfo
, data
->iwd_RootViewObj
);
350 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
354 //BOOL options_changed = FALSE;
355 IPTR prefs_Processing
= 0;
357 GET(prefs
, MUIA_WandererPrefs_Processing
, &prefs_Processing
);
358 if (!prefs_Processing
)
360 /* TODO: We arent in prefs-processing so cause an update! */
367 MakeStaticHook(iwd_ProcessBackground_hook
,IconWindow__HookFunc_ProcessBackgroundFunc
);
371 ///IconWindow__HookFunc_WandererBackFillFunc()
374 void, IconWindow__HookFunc_WandererBackFillFunc
,
375 AROS_UFHA(struct Hook
*, hook
, A0
),
376 AROS_UFHA(struct RastPort
*, RP
, A2
),
377 AROS_UFHA(struct BackFillMsg
*, BFM
, A1
)
381 HOOKPROTO(IconWindow__HookFunc_WandererBackFillFunc
, void, struct RastPort
*RP
, struct BackFillMsg
*BFM
)
386 struct IconWindow_BackFillHookData
*HookData
= NULL
;
388 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
390 if ((HookData
= hook
->h_Data
) && (iconwindow_BackFill_Active
!= NULL
))
392 Class
*CLASS
= HookData
->bfhd_IWClass
;
393 Object
*self
= HookData
->bfhd_IWObject
;
395 SETUP_ICONWINDOW_INST_DATA
;
397 struct RastPort
*DrawBackGround_RastPort
= NULL
;
398 struct IconWindowBackFillMsg DrawBackGround_BackFillMsg
;
400 GET(data
->iwd_IconListObj
, MUIA_IconList_BufferRastport
, &DrawBackGround_RastPort
);
402 if (DrawBackGround_RastPort
!= NULL
)
404 if ((DrawBackGround_BackFillMsg
.Layer
= DrawBackGround_RastPort
->Layer
) == NULL
)
406 D(bug("[Wanderer:IconWindow] %s: Rastport Layer = NULL!\n", __PRETTY_FUNCTION__
));
409 GET(data
->iwd_IconListObj
,MUIA_IconList_BufferLeft
, &DrawBackGround_BackFillMsg
.AreaBounds
.MinX
);
410 GET(data
->iwd_IconListObj
,MUIA_IconList_BufferTop
, &DrawBackGround_BackFillMsg
.AreaBounds
.MinY
);
411 GET(data
->iwd_IconListObj
,MUIA_IconList_BufferWidth
, &DrawBackGround_BackFillMsg
.AreaBounds
.MaxX
);
412 GET(data
->iwd_IconListObj
,MUIA_IconList_BufferHeight
, &DrawBackGround_BackFillMsg
.AreaBounds
.MaxY
);
414 DrawBackGround_BackFillMsg
.AreaBounds
.MaxX
+= DrawBackGround_BackFillMsg
.AreaBounds
.MinX
- 1;
415 DrawBackGround_BackFillMsg
.AreaBounds
.MaxY
+= DrawBackGround_BackFillMsg
.AreaBounds
.MinY
- 1;
417 DrawBackGround_BackFillMsg
.DrawBounds
.MinX
= BFM
->Bounds
.MinX
;
418 DrawBackGround_BackFillMsg
.DrawBounds
.MinY
= BFM
->Bounds
.MinY
;
419 DrawBackGround_BackFillMsg
.DrawBounds
.MaxX
= BFM
->Bounds
.MaxX
;
420 DrawBackGround_BackFillMsg
.DrawBounds
.MaxY
= BFM
->Bounds
.MaxY
;
422 /* Offset into source image (ala scroll bar position) */
423 DrawBackGround_BackFillMsg
.OffsetX
= BFM
->OffsetX
;
424 DrawBackGround_BackFillMsg
.OffsetY
= BFM
->OffsetY
;
425 DoMethod(self
, MUIM_IconWindow_BackFill_DrawBackground
, data
->iwd_BackFillInfo
, &DrawBackGround_BackFillMsg
, DrawBackGround_RastPort
);
433 MakeStaticHook(Hook_WandererBackFillFunc
,IconWindow__HookFunc_WandererBackFillFunc
);
438 Object
*IconWindow__OM_NEW(Class
*CLASS
, Object
*self
, struct opSet
*message
)
440 struct iconWindow_Extension
*iw_Extension
= NULL
;
442 struct Screen
*_newIconWin__Screen
= NULL
;
443 Object
*_newIconWin__IconListObj
= NULL
,
444 *_newIconWin__RootViewObj
= NULL
,
446 *_newIconWin__TopPanelContainerObj
= NULL
,
447 *_newIconWin__TopPanelRootGroupObj
= NULL
,
448 *_newIconWin__TopPanelSpacerObj
= NULL
,
450 *_newIconWin__LeftPanelContainerObj
= NULL
,
451 *_newIconWin__LeftPanelRootGroupObj
= NULL
,
452 *_newIconWin__LeftPanelSpacerObj
= NULL
,
454 *_newIconWin__BottomPanelContainerObj
= NULL
,
455 *_newIconWin__BottomPanelRootGroupObj
= NULL
,
456 *_newIconWin__BottomPanelSpacerObj
= NULL
,
460 char *_newIconWin__Title
= NULL
;
462 UBYTE _newIconWin__VOLVIEWMODE
= MUIV_IconWindow_VolumeInfoMode_ShowAllIfNoInfo
;
467 struct Hook
*actionHook
= NULL
;
469 struct Hook
*_newIconWin__BackFillHook
= NULL
;
471 IPTR WindowBF_TAG
= (IPTR
)TAG_IGNORE
;
473 IPTR _newIconWin__WindowWidth
= 0;
474 IPTR _newIconWin__WindowHeight
= 0;
475 IPTR _newIconWin__WindowLeft
= 0;
476 IPTR _newIconWin__WindowTop
= 0;
478 IPTR _newIconWin__FSNotifyPort
= (IPTR
)NULL
;
479 struct MUI_CustomClass
*iconviewclass
= NULL
;
480 #if defined(ICONWINDOW_NODETAILVIEWCLASS)
481 IconWindowDetailDrawerList_CLASS
= IconWindowDrawerList_CLASS
;
484 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
486 /* More than one GetTagData is not very efficient, however since this isn't called very often... */
487 isBackdrop
= (BOOL
)GetTagData(MUIA_IconWindow_IsBackdrop
, (IPTR
)FALSE
, message
->ops_AttrList
);
489 isRoot
= (BOOL
)GetTagData(MUIA_IconWindow_IsRoot
, (IPTR
)FALSE
, message
->ops_AttrList
);
491 actionHook
= (struct Hook
*)GetTagData(MUIA_IconWindow_ActionHook
, (IPTR
) NULL
, message
->ops_AttrList
);
492 prefs
= (Object
*)GetTagData(MUIA_Wanderer_Prefs
, (IPTR
) NULL
, message
->ops_AttrList
);
494 _newIconWin__FSNotifyPort
= (IPTR
)GetTagData(MUIA_Wanderer_FileSysNotifyPort
, (IPTR
) NULL
, message
->ops_AttrList
);
496 /* Request the screen we should use .. */
497 if (!(_newIconWin__Screen
= (struct Screen
*)GetTagData(MUIA_Wanderer_Screen
, (IPTR
) NULL
, message
->ops_AttrList
)))
499 D(bug("[Wanderer:IconWindow] %s: NO SCREEN SET!\n", __PRETTY_FUNCTION__
));
502 D(bug("[Wanderer:IconWindow] %s: Screen @ 0x%p\n", __PRETTY_FUNCTION__
, _newIconWin__Screen
));
504 if ((_newIconWin__BackFillHook
= AllocVec(sizeof(struct Hook
), MEMF_CLEAR
|MEMF_PUBLIC
))!=NULL
)
506 D(bug("[Wanderer:IconWindow] %s: Allocated WindowBackFillHook @ 0x%p\n", __PRETTY_FUNCTION__
, _newIconWin__BackFillHook
));
509 _newIconWin__BackFillHook
->h_Entry
= ( HOOKFUNC
)IconWindow__HookFunc_WandererBackFillFunc
;
511 _newIconWin__BackFillHook
= &Hook_WandererBackFillFunc
;
514 //#if defined(__MORPHOS__)
515 // WindowBF_TAG = MUIA_Window_BackFillHook;
517 WindowBF_TAG
= WA_BackFill
;
523 iconviewclass
= IconWindowVolumeList_CLASS
;
524 _newIconWin__IconListObj
= (Object
*)NewObject(iconviewclass
->mcc_Class
, NULL
,
525 MUIA_Wanderer_FileSysNotifyPort
, _newIconWin__FSNotifyPort
,
529 * Use MUI built-in support to keep window aligned to size of screen
530 * Remember: sizes of screen can change without window being recreated
532 _newIconWin__WindowWidth
= MUIV_Window_Width_Screen(100);
533 _newIconWin__WindowHeight
= MUIV_Window_Height_Screen(100);
534 _newIconWin__WindowTop
= MUIV_Window_TopEdge_Delta(0);
535 _newIconWin__WindowLeft
= 0;
537 DOPENWINDOW(bug("[Wanderer:IconWindow] %s: Screen dimensions .. %ld x %ld\n", __PRETTY_FUNCTION__
, _newIconWin__WindowWidth
, _newIconWin__WindowHeight
));
541 DOPENWINDOW(bug("[Wanderer:IconWindow] %s: BACKDROP ROOT Window\n", __PRETTY_FUNCTION__
));
542 _newIconWin__Title
= NULL
;
546 DOPENWINDOW(bug("[Wanderer:IconWindow] %s: Plain ROOT Window\n", __PRETTY_FUNCTION__
));
547 _newIconWin__Title
= __intern_wintitle_wanderer
;
552 struct DiskObject
*drawericon
= NULL
;
553 IPTR geticon_error
= 0, geticon_isdefault
= 0;
554 IPTR _newIconWin__TitleLen
= 0;
555 BOOL forceshowall
= FALSE
;
558 _newIconWin__WindowTop
= MUIV_Window_TopEdge_Centered
;
559 _newIconWin__WindowLeft
= MUIV_Window_LeftEdge_Centered
;
560 _newIconWin__WindowWidth
= 300;
561 _newIconWin__WindowHeight
= 300;
563 _newIconWin__Title
= (STRPTR
) GetTagData(MUIA_IconWindow_Location
, (IPTR
)NULL
, message
->ops_AttrList
);
564 _newIconWin__TitleLen
= strlen(_newIconWin__Title
);
565 isVolume
= (_newIconWin__Title
[_newIconWin__TitleLen
- 1] == ':');
567 D(bug("[Wanderer:IconWindow] %s: Opening %s Window '%s'\n", __PRETTY_FUNCTION__
, isVolume
? "Volume Root" : "Drawer", _newIconWin__Title
));
569 drawericon
= GetIconTags(_newIconWin__Title
,
570 ICONGETA_Screen
, _newIconWin__Screen
,
571 ICONGETA_FailIfUnavailable
, FALSE
,
572 ICONGETA_IsDefaultIcon
, &geticon_isdefault
,
573 ICONA_ErrorCode
, &geticon_error
,
576 if ((drawericon
) && (drawericon
->do_DrawerData
))
578 D(bug("[Wanderer:IconWindow] %s: Directory Icon has DRAWER data!\n", __PRETTY_FUNCTION__
));
579 _newIconWin__WindowTop
= drawericon
->do_DrawerData
->dd_NewWindow
.TopEdge
;
580 _newIconWin__WindowLeft
= drawericon
->do_DrawerData
->dd_NewWindow
.LeftEdge
;
581 _newIconWin__WindowWidth
= drawericon
->do_DrawerData
->dd_NewWindow
.Width
;
582 _newIconWin__WindowHeight
= drawericon
->do_DrawerData
->dd_NewWindow
.Height
;
585 iconviewclass
= IconWindowDrawerList_CLASS
;
586 if ((drawericon
) && (drawericon
->do_Gadget
.UserData
> 0))
588 D(bug("[Wanderer:IconWindow] %s: Directory Icons has OS 2.x/3.x data: FLAGS %x [\n", __PRETTY_FUNCTION__
, drawericon
->do_DrawerData
->dd_Flags
));
589 D(bug("] VIEWMODES %x [", drawericon
->do_DrawerData
->dd_ViewModes
));
591 switch (drawericon
->do_DrawerData
->dd_ViewModes
)
595 D(bug("Default (inherit from parent)"));
600 D(bug("View as icons"));
605 D(bug("View as text, sorted by name"));
606 iconviewclass
= IconWindowDetailDrawerList_CLASS
;
611 D(bug("View as text, sorted by date"));
612 iconviewclass
= IconWindowDetailDrawerList_CLASS
;
617 D(bug("View as text, sorted by size"));
618 iconviewclass
= IconWindowDetailDrawerList_CLASS
;
623 D(bug("View as text, sorted by type"));
624 iconviewclass
= IconWindowDetailDrawerList_CLASS
;
636 (((geticon_isdefault
) && (_newIconWin__VOLVIEWMODE
== MUIV_IconWindow_VolumeInfoMode_ShowAllIfNoInfo
)) ||
637 (_newIconWin__VOLVIEWMODE
== MUIV_IconWindow_VolumeInfoMode_ShowAll
)))
639 D(bug("[Wanderer:IconWindow] %s: setting 'SHOW ALL FILES'\n", __PRETTY_FUNCTION__
));
643 _newIconWin__IconListObj
= (Object
*) NewObject(iconviewclass
->mcc_Class
, NULL
,
644 MUIA_IconDrawerList_Drawer
, (IPTR
) _newIconWin__Title
,
645 MUIA_Wanderer_FileSysNotifyPort
, _newIconWin__FSNotifyPort
,
649 IconWindow_RestoreSettings(drawericon
, _newIconWin__IconListObj
, forceshowall
);
651 _newIconWin__TopPanelRootGroupObj
= MUI_NewObject(MUIC_Group
,
655 MUIA_InnerBottom
,(0),
656 MUIA_Frame
, MUIV_Frame_None
,
657 MUIA_Group_Spacing
, 0,
658 Child
, (_newIconWin__TopPanelSpacerObj
= HSpace(0)),
661 if (_newIconWin__TopPanelRootGroupObj
)
663 _newIconWin__TopPanelContainerObj
= MUI_NewObject(MUIC_Group
, MUIA_Group_Horiz
, TRUE
,
666 MUIA_HorizWeight
, 100,
668 MUIA_Frame
, MUIV_Frame_None
,
669 MUIA_Group_Spacing
, 3,
670 Child
, (IPTR
)_newIconWin__TopPanelRootGroupObj
,
674 _newIconWin__BottomPanelRootGroupObj
= MUI_NewObject(MUIC_Group
,
678 MUIA_InnerBottom
,(0),
679 MUIA_Frame
, MUIV_Frame_None
,
680 MUIA_Group_Spacing
, 0,
681 Child
, (_newIconWin__BottomPanelSpacerObj
= HSpace(0)),
684 if (_newIconWin__BottomPanelRootGroupObj
)
686 _newIconWin__BottomPanelContainerObj
= MUI_NewObject(MUIC_Group
, MUIA_Group_Horiz
, TRUE
,
689 MUIA_HorizWeight
, 100,
691 MUIA_Frame
, MUIV_Frame_None
,
692 MUIA_Group_Spacing
, 3,
693 Child
, (IPTR
)_newIconWin__BottomPanelRootGroupObj
,
697 _newIconWin__LeftPanelRootGroupObj
= MUI_NewObject(MUIC_Group
,
701 MUIA_InnerBottom
,(0),
702 MUIA_Frame
, MUIV_Frame_None
,
703 MUIA_Group_Spacing
, 0,
704 Child
, (_newIconWin__LeftPanelSpacerObj
= HVSpace
),
707 if (_newIconWin__LeftPanelRootGroupObj
)
709 _newIconWin__LeftPanelContainerObj
= MUI_NewObject(MUIC_Group
, MUIA_Group_Horiz
, TRUE
,
713 MUIA_VertWeight
, 100,
714 MUIA_Frame
, MUIV_Frame_None
,
715 MUIA_Group_Spacing
, 3,
716 Child
, (IPTR
)_newIconWin__LeftPanelRootGroupObj
,
721 _newIconWin__RootViewObj
= (Object
*) IconListviewObject
,
723 MUIA_IconListview_UseWinBorder
, TRUE
,
724 MUIA_IconListview_IconList
, (IPTR
) _newIconWin__IconListObj
,
727 DOPENWINDOW(bug("[Wanderer:IconWindow] %s: Window Co-ords %d,%d [%d x %d]\n", __PRETTY_FUNCTION__
, _newIconWin__WindowLeft
, _newIconWin__WindowTop
, _newIconWin__WindowWidth
, _newIconWin__WindowHeight
));
728 D(bug("[Wanderer:IconWindow] %s: TopPanelContainerObj 0x%p RootViewObj 0x%p\n", __PRETTY_FUNCTION__
, _newIconWin__TopPanelContainerObj
, _newIconWin__RootViewObj
));
730 self
= (Object
*) DoSuperNew(CLASS
, self
,
731 MUIA_Window_Screen
, _newIconWin__Screen
,
732 MUIA_Window_Backdrop
, isBackdrop
? TRUE
: FALSE
,
733 MUIA_Window_Borderless
, isBackdrop
? TRUE
: FALSE
,
734 MUIA_Window_Width
, _newIconWin__WindowWidth
,
735 MUIA_Window_Height
, _newIconWin__WindowHeight
,
736 MUIA_Window_LeftEdge
, _newIconWin__WindowLeft
,
737 MUIA_Window_TopEdge
, _newIconWin__WindowTop
,
738 (!isBackdrop
) ? MUIA_Window_AltWidth
: TAG_IGNORE
, 100,
739 (!isBackdrop
) ? MUIA_Window_AltHeight
: TAG_IGNORE
, 80,
740 MUIA_Window_Title
, (IPTR
)_newIconWin__Title
,
742 MUIA_Window_DragBar
, (!isBackdrop
) ? TRUE
: FALSE
,
743 MUIA_Window_CloseGadget
, (!isBackdrop
) ? TRUE
: FALSE
,
744 MUIA_Window_SizeGadget
, (!isBackdrop
) ? TRUE
: FALSE
,
745 MUIA_Window_DepthGadget
, (!isBackdrop
) ? TRUE
: FALSE
,
746 #if defined(MUIA_Window_ZoomGadget)
747 MUIA_Window_ZoomGadget
, (!isBackdrop
) ? TRUE
: FALSE
,
749 MUIA_Window_UseBottomBorderScroller
, (!isBackdrop
) ? TRUE
: FALSE
,
750 MUIA_Window_UseRightBorderScroller
, (!isBackdrop
) ? TRUE
: FALSE
,
751 MUIA_Window_IsSubWindow
, TRUE
,
753 WindowBF_TAG
, _newIconWin__BackFillHook
,
755 MUIA_Window_ScreenTitle
, (IPTR
) "",
757 WindowContents
, (IPTR
) MUI_NewObject(MUIC_Group
,
758 MUIA_Group_Spacing
, 0,
759 MUIA_Group_SameSize
, FALSE
,
762 /* "Extension" group */
763 _newIconWin__TopPanelContainerObj
? Child
: TAG_IGNORE
, (IPTR
)_newIconWin__TopPanelContainerObj
,
766 _newIconWin__LeftPanelContainerObj
? Child
: TAG_IGNORE
, (IPTR
)_newIconWin__LeftPanelContainerObj
,
768 Child
, (IPTR
) _newIconWin__RootViewObj
,
771 _newIconWin__BottomPanelContainerObj
? Child
: TAG_IGNORE
, (IPTR
)_newIconWin__BottomPanelContainerObj
,
775 TAG_MORE
, (IPTR
) message
->ops_AttrList
780 SETUP_ICONWINDOW_INST_DATA
;
782 D(bug("[Wanderer:IconWindow] %s: SELF = 0x%p\n", __PRETTY_FUNCTION__
, self
));
784 data
->iwd_VolViewMode
= _newIconWin__VOLVIEWMODE
;
786 data
->iwd_Screen
= _newIconWin__Screen
;
787 data
->iwd_Title
= _newIconWin__Title
;
789 data
->iwd_RootViewObj
= _newIconWin__RootViewObj
;
790 data
->iwd_IconListObj
= _newIconWin__IconListObj
;
792 SET(data
->iwd_RootViewObj
, MUIA_IconWindow_Window
, self
);
794 data
->iwd_ActionHook
= actionHook
;
796 data
->iwd_TopPanel
.iwp_PanelGroupObj
= _newIconWin__TopPanelRootGroupObj
;
797 data
->iwd_TopPanel
.iwp_PanelContainerObj
= _newIconWin__TopPanelContainerObj
;
798 data
->iwd_TopPanel
.iwp_PanelGroupSpacerObj
= _newIconWin__TopPanelSpacerObj
;
800 data
->iwd_LeftPanel
.iwp_PanelGroupObj
= _newIconWin__LeftPanelRootGroupObj
;
801 data
->iwd_LeftPanel
.iwp_PanelContainerObj
= _newIconWin__LeftPanelContainerObj
;
802 data
->iwd_LeftPanel
.iwp_PanelGroupSpacerObj
= _newIconWin__LeftPanelSpacerObj
;
804 data
->iwd_BottomPanel
.iwp_PanelGroupObj
= _newIconWin__BottomPanelRootGroupObj
;
805 data
->iwd_BottomPanel
.iwp_PanelContainerObj
= _newIconWin__BottomPanelContainerObj
;
806 data
->iwd_BottomPanel
.iwp_PanelGroupSpacerObj
= _newIconWin__BottomPanelSpacerObj
;
810 data
->iwd_Flags
|= (isRoot
) ? IWDFLAG_ISROOT
: 0;
811 data
->iwd_Flags
|= (isBackdrop
) ? IWDFLAG_ISBACKDROP
: 0;
813 data
->iwd_ViewSettings_Attrib
= (data
->iwd_Flags
& IWDFLAG_ISROOT
)
817 data
->iwd_FSNotifyPort
= _newIconWin__FSNotifyPort
;
822 data
->iwd_PrefsUpdated_hook
.h_Entry
= ( HOOKFUNC
)IconWindow__HookFunc_PrefsUpdatedFunc
;
824 data
->iwd_PrefsUpdated_hook
= &iwd_PrefsUpdated_hook
;
829 prefs
, MUIM_Notify
, MUIA_WandererPrefs_Processing
, FALSE
,
831 MUIM_CallHook
, &data
->iwd_PrefsUpdated_hook
, (IPTR
)CLASS
834 data
->iwd_ViewSettings_PrefsNotificationObject
= (Object
*) DoMethod(prefs
,
835 MUIM_WandererPrefs_ViewSettings_GetNotifyObject
,
836 data
->iwd_ViewSettings_Attrib
);
837 data
->iwd_WindowFont
= (struct TextFont
*)DoMethod(prefs
, MUIM_WandererPrefs_ViewSettings_GetAttribute
,
838 data
->iwd_ViewSettings_Attrib
, MUIA_IconWindow_Font
);
839 SET(data
->iwd_IconListObj
, MUIA_Font
, data
->iwd_WindowFont
);
843 data
->iwd_ProcessBackground_hook
.h_Entry
= ( HOOKFUNC
)IconWindow__HookFunc_ProcessBackgroundFunc
;
845 data
->iwd_ProcessBackground_hook
= &iwd_ProcessBackground_hook
;
848 if ((data
->iwd_BackFill_hook
= _newIconWin__BackFillHook
))
850 data
->iwd_BackFillHookData
.bfhd_IWClass
= CLASS
;
851 data
->iwd_BackFillHookData
.bfhd_IWObject
= self
;
852 data
->iwd_BackFill_hook
->h_Data
= &data
->iwd_BackFillHookData
;
855 ForeachNode(&iconwindow_Extensions
, iw_Extension
)
857 D(bug("[Wanderer:IconWindow] %s: Setting up '%s' @ %p\n", __PRETTY_FUNCTION__
, iw_Extension
->iwe_Node
.ln_Name
, iw_Extension
));
858 iw_Extension
->iwe_Setup(CLASS
, self
, message
);
861 data
->iwd_Flags
|= IWDFLAG_SETUP
;
863 /* If double clicked then we call our own private methods, that's
864 easier then using Hooks */
867 _newIconWin__IconListObj
, MUIM_Notify
, MUIA_IconList_DoubleClick
, TRUE
,
868 (IPTR
) self
, 1, MUIM_IconWindow_DoubleClicked
871 /* notify when icons dropped on another (wanderer) window */
874 _newIconWin__IconListObj
, MUIM_Notify
, MUIA_IconList_IconsDropped
, MUIV_EveryTime
,
875 (IPTR
) self
, 1, MUIM_IconWindow_IconsDropped
878 /* notify when icons dropped on custom application */
881 _newIconWin__IconListObj
, MUIM_Notify
, MUIA_IconList_AppWindowDrop
, MUIV_EveryTime
,
882 (IPTR
) self
, 1, MUIM_IconWindow_AppWindowDrop
887 _newIconWin__IconListObj
, MUIM_Notify
, MUIA_IconList_Clicked
, MUIV_EveryTime
,
888 (IPTR
) self
, 1, MUIM_IconWindow_Clicked
891 D(bug("[Wanderer:IconWindow] obj = %ld\n", self
));
897 IPTR
IconWindow__OM_DISPOSE(Class
*CLASS
, Object
*self
, Msg message
)
899 SETUP_ICONWINDOW_INST_DATA
;
901 struct iconWindow_Extension
*iw_Extension
= NULL
;
902 Object
*prefs
= NULL
;
904 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
911 MUIM_KillNotifyObj
, MUIA_WandererPrefs_Processing
, (IPTR
) self
914 if (data
->iwd_Flags
& IWDFLAG_SETUP
)
916 ForeachNode(&iconwindow_Extensions
, iw_Extension
)
918 D(bug("[Wanderer:IconWindow] %s: Cleanup '%s'\n", __PRETTY_FUNCTION__
, iw_Extension
->iwe_Node
.ln_Name
));
919 iw_Extension
->iwe_Cleanup(CLASS
, self
, message
);
924 FreeVec(data
->iwd_BackFill_hook
);
926 return DoSuperMethodA(CLASS
, self
, message
);
931 IPTR
IconWindow__OM_SET(Class
*CLASS
, Object
*self
, struct opSet
*message
)
933 SETUP_ICONWINDOW_INST_DATA
;
935 struct iconWindow_Extension
*iw_Extension
= NULL
;
937 struct TagItem
*tstate
= message
->ops_AttrList
, *tag
;
938 BOOL UpdateIconlist
= FALSE
;
939 IPTR focusicon
= (IPTR
) NULL
;
942 while ((tag
= NextTagItem((TAGITEM
)&tstate
)) != NULL
)
946 case MUIA_Window_Screen
:
947 D(bug("[Wanderer:IconWindow] %s: MUIA_Window_Screen [screen @ %p]\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
948 data
->iwd_Screen
= (struct Screen
*) tag
->ti_Data
;
952 D(bug("[Wanderer:IconWindow] %s: MUIA_ShowMe [%x]\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
955 struct Screen
*__Wanderer__Screen
= NULL
;
956 GET(_app(self
), MUIA_Wanderer_Screen
, &__Wanderer__Screen
);
957 if (__Wanderer__Screen
!= data
->iwd_Screen
)
959 D(bug("[Wanderer:IconWindow] %s: Screen Changed [old = %p, new = %p]\n", __PRETTY_FUNCTION__
, data
->iwd_Screen
, __Wanderer__Screen
));
960 SET(self
, MUIA_Window_Screen
, __Wanderer__Screen
);
961 if (((data
->iwd_Flags
& IWDFLAG_ISROOT
)) && ((data
->iwd_Flags
& IWDFLAG_ISBACKDROP
)))
963 IPTR _IconWin__NewWindowWidth
= 0;
964 IPTR _IconWin__NewWindowHeight
= 0;
966 IPTR _IconWin__NewWindowLeft
= 0;
968 IPTR _IconWin__NewWindowTop
= 0;
970 D(bug("[Wanderer:IconWindow] %s: Updating Backdrop Window Dimensions\n", __PRETTY_FUNCTION__
));
972 _IconWin__NewWindowWidth
= GetBitMapAttr(__Wanderer__Screen
->RastPort
.BitMap
, BMA_WIDTH
);
973 _IconWin__NewWindowHeight
= GetBitMapAttr(__Wanderer__Screen
->RastPort
.BitMap
, BMA_HEIGHT
);
974 D(bug("[Wanderer:IconWindow] %s: Screen dimensions .. %d x %d\n", __PRETTY_FUNCTION__
, _IconWin__NewWindowWidth
, _IconWin__NewWindowHeight
));
976 _IconWin__NewWindowTop
= __Wanderer__Screen
->BarHeight
+ 1;
978 _IconWin__NewWindowLeft
= 0;
981 _IconWin__NewWindowHeight
-= _IconWin__NewWindowTop
;
983 D(bug("[Wanderer:IconWindow] %s: New Window dimensions .. %d x %d @ %d, %d\n", __PRETTY_FUNCTION__
, _IconWin__NewWindowWidth
, _IconWin__NewWindowHeight
, 0, _IconWin__NewWindowTop
));
985 SET(self
, MUIA_Window_Width
, _IconWin__NewWindowWidth
);
986 SET(self
, MUIA_Window_Height
, _IconWin__NewWindowHeight
);
992 case MUIA_IconWindow_Changed
:
993 data
->iwd_Flags
|= (tag
->ti_Data
) ? IWDFLAG_NEEDSUPDATE
: 0;
996 case MUIA_Window_Open
:
997 D(bug("[Wanderer:IconWindow] %s: MUIA_Window_Open [%ld]\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
1000 DoMethod(data
->iwd_IconListObj
, MUIM_IconList_Clear
);
1002 rv
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
1003 #if defined(ICONWINDOW_BUFFERLIST)
1004 if (!((data
->iwd_Flags
& IWDFLAG_ISROOT
)))
1006 IPTR CURDISPFLAGS
= NULL
;
1007 GET(data
->iwd_IconListObj
, MUIA_IconList_DisplayFlags
, &CURDISPFLAGS
);
1008 CURDISPFLAGS
|= ICONLIST_DISP_BUFFERED
;
1009 SET(data
->iwd_IconListObj
, MUIA_IconList_DisplayFlags
, CURDISPFLAGS
);
1012 D(bug("[Wanderer:IconWindow] %s: Process the background ..\n", __PRETTY_FUNCTION__
));
1013 DoMethod(self
, MUIM_IconWindow_BackFill_ProcessBackground
, data
->iwd_BackFillInfo
, data
->iwd_RootViewObj
);
1015 D(bug("[Wanderer:IconWindow] %s: Force an update of the list ..\n", __PRETTY_FUNCTION__
));
1016 DoMethod(data
->iwd_IconListObj
, MUIM_IconList_Update
);
1017 DoMethod(data
->iwd_IconListObj
, MUIM_IconList_Sort
);
1022 case MUIA_Window_Activate
:
1023 if (data
->iwd_IconListObj
)
1024 GET(data
->iwd_IconListObj
, MUIA_IconList_FocusIcon
, &focusicon
);
1028 case MUIA_IconWindow_Font
:
1029 data
->iwd_WindowFont
= (struct TextFont
*)tag
->ti_Data
;
1030 D(bug("[Wanderer:IconWindow] %s: MUIA_IconWindow_Font [font @ 0x%p]\n", __PRETTY_FUNCTION__
, data
->iwd_WindowFont
));
1032 if (!data
->iwd_WindowFont
)
1033 SetFont(_rp(self
), data
->iwd_WindowFont
);
1035 if (data
->iwd_IconListObj
)
1036 SET(data
->iwd_IconListObj
, MUIA_Font
, data
->iwd_WindowFont
);
1040 case MUIA_IconWindow_Location
:
1041 D(bug("[Wanderer:IconWindow] %s: MUIA_IconWindow_Location [drawer '%s']\n", __PRETTY_FUNCTION__
, data
->iwd_DirectoryPath
));
1043 if (!(data
->iwd_Flags
& IWDFLAG_ISROOT
))
1045 strcpy(data
->iwd_DirectoryPath
, (STRPTR
)tag
->ti_Data
);
1046 SET(self
, MUIA_Window_Title
, (IPTR
)data
->iwd_DirectoryPath
);
1047 SET(data
->iwd_IconListObj
, MUIA_IconDrawerList_Drawer
, (IPTR
)data
->iwd_DirectoryPath
);
1051 case MUIA_IconWindow_BackgroundAttrib
:
1052 D(bug("[Wanderer:IconWindow] %s: MUIA_IconWindow_BackgroundAttrib (not implemented)\n", __PRETTY_FUNCTION__
));
1058 rv
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
1060 if (data
->iwd_Flags
& IWDFLAG_SETUP
)
1062 ForeachNode(&iconwindow_Extensions
, iw_Extension
)
1064 D(bug("[Wanderer:IconWindow] %s: Checking '%s'\n", __PRETTY_FUNCTION__
, iw_Extension
->iwe_Node
.ln_Name
));
1065 iw_Extension
->iwe_Set(CLASS
, self
, message
);
1071 DoMethod(data
->iwd_IconListObj
, MUIM_IconList_Update
);
1072 DoMethod(data
->iwd_IconListObj
, MUIM_IconList_Sort
);
1077 D(bug("[Wanderer:IconWindow] %s: Updating focused icon (@ 0x%p)\n", __PRETTY_FUNCTION__
, focusicon
));
1078 //MUI_Redraw(data->iwd_IconListObj, MADF_DRAWOBJECT);
1086 IPTR
IconWindow__OM_GET(Class
*CLASS
, Object
*self
, struct opGet
*message
)
1088 SETUP_ICONWINDOW_INST_DATA
;
1089 struct iconWindow_Extension
*iw_Extension
= NULL
;
1090 IPTR
*store
= message
->opg_Storage
;
1093 switch (message
->opg_AttrID
)
1095 case MUIA_IconWindow_Changed
:
1096 *store
= (IPTR
)(data
->iwd_Flags
& IWDFLAG_NEEDSUPDATE
);
1099 case MUIA_IconWindow_Window
:
1100 *store
= (IPTR
)self
;
1103 case MUIA_IconWindow_Location
:
1104 *store
= !(data
->iwd_Flags
& IWDFLAG_ISROOT
)
1105 ? XGET(data
->iwd_IconListObj
, MUIA_IconDrawerList_Drawer
)
1109 case MUIA_IconWindow_IconList
:
1110 *store
= (IPTR
)data
->iwd_IconListObj
;
1113 case MUIA_IconWindow_IsRoot
:
1114 *store
= (IPTR
)(data
->iwd_Flags
& IWDFLAG_ISROOT
);
1117 case MUIA_IconWindow_IsBackdrop
:
1118 *store
= (IPTR
)(data
->iwd_Flags
& IWDFLAG_ISBACKDROP
);
1121 case MUIA_IconWindow_BackFillData
:
1122 *store
= (IPTR
)data
->iwd_BackFillInfo
;
1125 case MUIA_IconWindow_BackgroundAttrib
:
1126 *store
= (IPTR
)data
->iwd_ViewSettings_Attrib
;
1130 *store
= (IPTR
)WIWVERS
;
1134 *store
= (IPTR
)WIWREV
;
1142 rv
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
1146 ForeachNode(&iconwindow_Extensions
, iw_Extension
)
1148 D(bug("[Wanderer:IconWindow] %s: Checking '%s'\n", __PRETTY_FUNCTION__
, iw_Extension
->iwe_Node
.ln_Name
));
1149 if ((rv
= iw_Extension
->iwe_Get(CLASS
, self
, message
)))
1158 ///IconWindow__MUIM_Window_Setup()
1159 IPTR IconWindow__MUIM_Window_Setup
1161 Class
*CLASS
, Object
*self
, Msg message
1164 SETUP_ICONWINDOW_INST_DATA
;
1166 Object
*prefs
= NULL
;
1168 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1170 if (!DoSuperMethodA(CLASS
, self
, message
)) return FALSE
;
1172 if (iconwindow_BackFill_Active
)
1174 data
->iwd_BackFillInfo
=(struct BackFillInfo
*) DoMethod(self
, MUIM_IconWindow_BackFill_Setup
);
1175 D(bug("[Wanderer:IconWindow] %s: Window BackFill_Data @ 0x%p for '%s'\n", __PRETTY_FUNCTION__
, data
->iwd_BackFillInfo
, iconwindow_BackFill_Active
->bfd_BackFillID
));
1178 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
1180 D(bug("[Wanderer:IconWindow] %s: App PrefsObj @ 0x%p\n", __PRETTY_FUNCTION__
, prefs
));
1182 if ((prefs
) && (data
->iwd_ViewSettings_PrefsNotificationObject
))
1184 D(bug("[Wanderer:IconWindow] %s: Setting up window prefs change hooks\n", __PRETTY_FUNCTION__
));
1186 /* Set-up a hook to call ProcessBackground on prefs notification */
1189 data
->iwd_ViewSettings_PrefsNotificationObject
, MUIM_Notify
, MUIA_Background
, MUIV_EveryTime
,
1191 MUIM_CallHook
, &data
->iwd_ProcessBackground_hook
, (IPTR
)CLASS
1194 if ((data
->iwd_Flags
& IWDFLAG_ISROOT
))
1198 data
->iwd_ViewSettings_PrefsNotificationObject
, MUIM_Notify
, MUIA_IconWindowExt_ImageBackFill_BGRenderMode
, MUIV_EveryTime
,
1200 MUIM_CallHook
, &data
->iwd_ProcessBackground_hook
, (IPTR
)CLASS
1206 data
->iwd_ViewSettings_PrefsNotificationObject
, MUIM_Notify
, MUIA_IconWindowExt_ImageBackFill_BGTileMode
, MUIV_EveryTime
,
1208 MUIM_CallHook
, &data
->iwd_ProcessBackground_hook
, (IPTR
)CLASS
1213 data
->iwd_ViewSettings_PrefsNotificationObject
, MUIM_Notify
, MUIA_IconWindowExt_ImageBackFill_BGXOffset
, MUIV_EveryTime
,
1215 MUIM_CallHook
, &data
->iwd_ProcessBackground_hook
, (IPTR
)CLASS
1220 data
->iwd_ViewSettings_PrefsNotificationObject
, MUIM_Notify
, MUIA_IconWindowExt_ImageBackFill_BGYOffset
, MUIV_EveryTime
,
1222 MUIM_CallHook
, &data
->iwd_ProcessBackground_hook
, (IPTR
)CLASS
1225 /* React to notification on font change */
1228 data
->iwd_ViewSettings_PrefsNotificationObject
, MUIM_Notify
, MUIA_IconWindow_Font
, MUIV_EveryTime
,
1230 MUIM_Set
, MUIA_IconWindow_Font
, MUIV_TriggerValue
1235 D(bug("[Wanderer:IconWindow] %s: Setup complete!\n", __PRETTY_FUNCTION__
));
1241 ///IconWindow__MUIM_Window_Cleanup()
1242 IPTR IconWindow__MUIM_Window_Cleanup
1244 Class
*CLASS
, Object
*self
, Msg message
1247 SETUP_ICONWINDOW_INST_DATA
;
1249 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1251 if (data
->iwd_BackFillInfo
)
1253 DoMethod(self
, MUIM_IconWindow_BackFill_Cleanup
, data
->iwd_BackFillInfo
);
1254 data
->iwd_BackFillInfo
= NULL
;
1257 if (data
->iwd_ViewSettings_PrefsNotificationObject
)
1261 data
->iwd_ViewSettings_PrefsNotificationObject
,
1262 MUIM_KillNotifyObj
, MUIA_IconWindowExt_ImageBackFill_BGYOffset
, (IPTR
) self
1267 data
->iwd_ViewSettings_PrefsNotificationObject
,
1268 MUIM_KillNotifyObj
, MUIA_IconWindowExt_ImageBackFill_BGXOffset
, (IPTR
) self
1273 data
->iwd_ViewSettings_PrefsNotificationObject
,
1274 MUIM_KillNotifyObj
, MUIA_IconWindowExt_ImageBackFill_BGTileMode
, (IPTR
) self
1277 if ((data
->iwd_Flags
& IWDFLAG_ISROOT
))
1281 data
->iwd_ViewSettings_PrefsNotificationObject
,
1282 MUIM_KillNotifyObj
, MUIA_IconWindowExt_ImageBackFill_BGRenderMode
, (IPTR
) self
1288 data
->iwd_ViewSettings_PrefsNotificationObject
,
1289 MUIM_KillNotifyObj
, MUIA_Background
, (IPTR
) self
1294 data
->iwd_ViewSettings_PrefsNotificationObject
,
1295 MUIM_KillNotifyObj
, MUIA_IconWindow_Font
, (IPTR
) self
1298 return DoSuperMethodA(CLASS
, self
, message
);
1302 ///IconWindow__MUIM_IconWindow_DoubleClicked()
1303 IPTR IconWindow__MUIM_IconWindow_DoubleClicked
1305 Class
*CLASS
, Object
*self
, Msg message
1308 SETUP_ICONWINDOW_INST_DATA
;
1310 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1312 if (data
->iwd_ActionHook
)
1314 struct IconWindow_ActionMsg msg
;
1315 msg
.type
= ICONWINDOW_ACTION_OPEN
;
1316 msg
.iconlist
= data
->iwd_IconListObj
;
1317 msg
.isroot
= (data
->iwd_Flags
& IWDFLAG_ISROOT
);
1319 CallHookPkt(data
->iwd_ActionHook
, self
, &msg
);
1326 ///IconWindow__MUIM_IconWindow_Clicked()
1327 IPTR IconWindow__MUIM_IconWindow_Clicked
1329 Class
*CLASS
, Object
*self
, Msg message
1332 SETUP_ICONWINDOW_INST_DATA
;
1334 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1336 if (data
->iwd_ActionHook
)
1338 struct IconWindow_ActionMsg msg
;
1339 msg
.type
= ICONWINDOW_ACTION_CLICK
;
1340 msg
.iconlist
= data
->iwd_IconListObj
;
1341 msg
.isroot
= (data
->iwd_Flags
& IWDFLAG_ISROOT
);
1342 GET(data
->iwd_IconListObj
, MUIA_IconList_Clicked
, &msg
.click
);
1343 CallHookPkt(data
->iwd_ActionHook
, self
, &msg
);
1350 ///IconWindow__MUIM_IconWindow_IconsDropped()
1351 IPTR IconWindow__MUIM_IconWindow_IconsDropped
1353 Class
*CLASS
, Object
*self
, Msg message
1356 SETUP_ICONWINDOW_INST_DATA
;
1358 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1360 if (data
->iwd_ActionHook
)
1362 struct IconWindow_ActionMsg msg
;
1363 msg
.type
= ICONWINDOW_ACTION_ICONDROP
;
1364 msg
.iconlist
= data
->iwd_IconListObj
;
1365 msg
.isroot
= (data
->iwd_Flags
& IWDFLAG_ISROOT
);
1366 GET(data
->iwd_IconListObj
, MUIA_IconList_IconsDropped
, &msg
.drop
);
1369 NNSET(data
->iwd_IconListObj
, MUIA_IconList_IconsDropped
, NULL
);
1370 CallHookPkt(data
->iwd_ActionHook
, self
, &msg
);
1378 ///IconWindow__MUIM_IconWindow_AppWindowDrop()
1379 IPTR IconWindow__MUIM_IconWindow_AppWindowDrop
1381 Class
*CLASS
, Object
*self
, Msg message
1384 SETUP_ICONWINDOW_INST_DATA
;
1386 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1388 if (data
->iwd_ActionHook
)
1390 struct IconWindow_ActionMsg msg
;
1391 msg
.type
= ICONWINDOW_ACTION_APPWINDOWDROP
;
1392 msg
.iconlist
= data
->iwd_IconListObj
;
1393 msg
.isroot
= (data
->iwd_Flags
& IWDFLAG_ISROOT
);
1394 GET(data
->iwd_IconListObj
, MUIA_IconList_IconsDropped
, &msg
.drop
);
1395 CallHookPkt(data
->iwd_ActionHook
, self
, &msg
);
1402 ///IconWindow__MUIM_IconWindow_Open()
1403 IPTR IconWindow__MUIM_IconWindow_Open
1405 Class
*CLASS
, Object
*self
, Msg message
1408 // SETUP_ICONWINDOW_INST_DATA;
1410 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1412 if (!XGET(self
, MUIA_Window_Open
))
1414 SET(self
, MUIA_Window_Open
, TRUE
);
1417 D(bug("[Wanderer:IconWindow] %s: Setting window as active ..\n", __PRETTY_FUNCTION__
));
1418 SET(self
, MUIA_Window_Activate
, TRUE
);
1420 D(bug("[Wanderer:IconWindow] %s: All done\n", __PRETTY_FUNCTION__
));
1426 ///IconWindow__MUIM_IconWindow_DirectoryUp()
1427 IPTR IconWindow__MUIM_IconWindow_DirectoryUp
1429 Class
*CLASS
, Object
*self
, Msg message
1432 SETUP_ICONWINDOW_INST_DATA
;
1434 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1436 if (data
->iwd_ActionHook
)
1438 struct IconWindow_ActionMsg msg
;
1439 msg
.type
= ICONWINDOW_ACTION_DIRUP
;
1440 msg
.iconlist
= data
->iwd_IconListObj
;
1441 msg
.isroot
= (data
->iwd_Flags
& IWDFLAG_ISROOT
);
1443 CallHookPkt(data
->iwd_ActionHook
, self
, &msg
);
1451 ///IconWindow__MUIM_IconWindow_UnselectAll()
1452 IPTR IconWindow__MUIM_IconWindow_UnselectAll
1454 Class
*CLASS
, Object
*self
, Msg message
1457 SETUP_ICONWINDOW_INST_DATA
;
1459 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1461 DoMethod(data
->iwd_IconListObj
, MUIM_IconList_UnselectAll
);
1467 ///IconWindow__MUIM_IconWindow_Remove()
1468 IPTR IconWindow__MUIM_IconWindow_Remove
1470 Class
*CLASS
, Object
*self
, Msg message
1473 // SETUP_ICONWINDOW_INST_DATA;
1475 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1478 SET( self
, MUIA_Window_Open
, FALSE
);
1479 DoMethod ( _app(self
), OM_REMMEMBER
, self
);
1480 DisposeObject(self
);
1486 /*** Stubs for Backfill Hooks ******************************************************************/
1487 ///IconWindow__MUIM_IconWindow_BackFill_Register()
1488 IPTR IconWindow__MUIM_IconWindow_BackFill_Register
1490 Class
*CLASS
, Object
*self
, struct MUIP_IconWindow_BackFill_Register
*message
1493 // SETUP_ICONWINDOW_INST_DATA;
1495 D(bug("[Wanderer:IconWindow]: %s('%s')\n", __PRETTY_FUNCTION__
, message
->register_Node
->bfd_BackFillID
));
1497 AddTail(&iconwindow_BackFillNodes
, (struct Node
*)message
->register_Node
);
1498 if (iconwindow_BackFill_Active
== NULL
) iconwindow_BackFill_Active
= message
->register_Node
;
1504 ///IconWindow__MUIM_IconWindow_BackFill_Setup()
1505 IPTR IconWindow__MUIM_IconWindow_BackFill_Setup
1507 Class
*CLASS
, Object
*self
, struct MUIP_IconWindow_BackFill_Setup
*message
1510 // SETUP_ICONWINDOW_INST_DATA;
1512 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1514 if (iconwindow_BackFill_Active
== NULL
) return FALSE
;
1516 return (iconwindow_BackFill_Active
->bfd_MUIM_IconWindow_BackFill_Setup
)(CLASS
, self
, message
);
1520 ///IconWindow__MUIM_IconWindow_BackFill_Cleanup()
1521 IPTR IconWindow__MUIM_IconWindow_BackFill_Cleanup
1523 Class
*CLASS
, Object
*self
, struct MUIP_IconWindow_BackFill_Cleanup
*message
1526 //SETUP_ICONWINDOW_INST_DATA;
1528 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1530 if (iconwindow_BackFill_Active
== NULL
) return FALSE
;
1532 return (iconwindow_BackFill_Active
->bfd_MUIM_IconWindow_BackFill_Cleanup
)(CLASS
, self
, message
);
1536 ///IconWindow__MUIM_IconWindow_BackFill_ProcessBackground()
1537 IPTR IconWindow__MUIM_IconWindow_BackFill_ProcessBackground
1539 Class
*CLASS
, Object
*self
, struct MUIP_IconWindow_BackFill_ProcessBackground
*message
1542 SETUP_ICONWINDOW_INST_DATA
;
1544 IPTR retVal
= (IPTR
)FALSE
;
1546 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1548 if (iconwindow_BackFill_Active
!= NULL
)
1550 D(bug("[Wanderer:IconWindow] %s: Asking module @ 0x%p to process ..\n", __PRETTY_FUNCTION__
, iconwindow_BackFill_Active
));
1551 retVal
= (iconwindow_BackFill_Active
->bfd_MUIM_IconWindow_BackFill_ProcessBackground
)(CLASS
, self
, message
);
1554 if (!retVal
&& (data
->iwd_RootViewObj
!= NULL
))
1556 Object
*IconWindowPB_PrefsObj
= NULL
;
1558 D(bug("[Wanderer:IconWindow] %s: No BackFill module/ module cant render mode\n", __PRETTY_FUNCTION__
));
1559 D(bug("[Wanderer:IconWindow] %s: Using default MUI functions ..\n", __PRETTY_FUNCTION__
));
1561 GET(_app(self
), MUIA_Wanderer_Prefs
, &IconWindowPB_PrefsObj
);
1562 if (IconWindowPB_PrefsObj
)
1564 IPTR IconWindowPB_Background
= 0;
1565 IPTR IconWindowPB_BGMode
= 0;
1566 IPTR IconWindowPB_BGTileMode
= 0;
1568 if ((IconWindowPB_Background
= DoMethod(IconWindowPB_PrefsObj
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwd_ViewSettings_Attrib
, MUIA_Background
)) != -1)
1570 char *bgmode_string
;
1573 if ((IconWindowPB_BGMode
= DoMethod(IconWindowPB_PrefsObj
, MUIM_WandererPrefs_ViewSettings_GetAttribute
,
1574 data
->iwd_ViewSettings_Attrib
, MUIA_IconWindowExt_ImageBackFill_BGRenderMode
)) == -1)
1575 IconWindowPB_BGMode
= IconWindowExt_ImageBackFill_RenderMode_Tiled
;
1577 if ((IconWindowPB_BGTileMode
= DoMethod(IconWindowPB_PrefsObj
, MUIM_WandererPrefs_ViewSettings_GetAttribute
,
1578 data
->iwd_ViewSettings_Attrib
, MUIA_IconWindowExt_ImageBackFill_BGTileMode
)) == -1)
1579 IconWindowPB_BGTileMode
= IconWindowExt_ImageBackFill_TileMode_Float
;
1581 SET(data
->iwd_RootViewObj
, MUIA_Background
, IconWindowPB_Background
);
1583 bgmode_string
=(STRPTR
) IconWindowPB_Background
;
1584 this_mode
= bgmode_string
[0] - 48;
1586 D(bug("[Wanderer:IconWindow] %s: MUI BG Mode = %d\n", __PRETTY_FUNCTION__
, this_mode
));
1592 if (IconWindowPB_BGMode
== IconWindowExt_ImageBackFill_RenderMode_Scale
)
1594 SET(data
->iwd_RootViewObj
, MUIA_IconListview_ScaledBackground
, TRUE
);
1598 SET(data
->iwd_RootViewObj
, MUIA_IconListview_ScaledBackground
, FALSE
);
1602 if (IconWindowPB_BGTileMode
== IconWindowExt_ImageBackFill_TileMode_Fixed
)
1603 SET(data
->iwd_RootViewObj
, MUIA_IconListview_FixedBackground
, TRUE
);
1605 SET(data
->iwd_RootViewObj
, MUIA_IconListview_FixedBackground
, FALSE
);
1617 ///IconWindow__MUIM_IconWindow_BackFill_DrawBackground()
1618 IPTR IconWindow__MUIM_IconWindow_BackFill_DrawBackground
1620 Class
*CLASS
, Object
*self
, struct MUIP_IconWindow_BackFill_DrawBackground
*message
1623 // SETUP_ICONWINDOW_INST_DATA;
1625 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1627 if (iconwindow_BackFill_Active
== NULL
) return FALSE
;
1629 return (iconwindow_BackFill_Active
->bfd_MUIM_IconWindow_BackFill_DrawBackground
)(CLASS
, self
, message
);
1633 ///IconWindow__MUIM_IconWindow_RateLimitRefresh()
1634 IPTR IconWindow__MUIM_IconWindow_RateLimitRefresh
1636 Class
*CLASS
, Object
*self
, Msg message
1639 Object
* iconList
= NULL
;
1641 GET(self
, MUIA_IconWindow_IconList
, &iconList
);
1643 if (iconList
!= NULL
)
1644 return DoMethod(iconList
, MUIM_IconWindowIconList_RateLimitRefresh
);
1650 ///IconWindow__MUIM_IconWindow_Snapshot()
1651 IPTR IconWindow__MUIM_IconWindow_Snapshot
1653 Class
*CLASS
, Object
*self
, struct MUIP_IconWindow_Snapshot
* message
1656 Object
*iconList
= (Object
*) XGET(self
, MUIA_IconWindow_IconList
);
1658 if (message
->snapshotall
== TRUE
)
1660 struct IconList_Entry
*icon_entry
= (IPTR
)MUIV_IconList_NextIcon_Start
;
1661 struct IconEntry
*node
= NULL
;
1662 struct TagItem icon_tags
[] =
1664 { ICONPUTA_OnlyUpdatePosition
, TRUE
},
1667 D(bug("[Wanderer:IconWindow] %s: snapshot ALL\n", __PRETTY_FUNCTION__
));
1671 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Visible
, (IPTR
)&icon_entry
);
1673 if ((IPTR
)icon_entry
!= MUIV_IconList_NextIcon_End
)
1675 node
= (struct IconEntry
*)((IPTR
)icon_entry
- ((IPTR
)&node
->ie_IconListEntry
- (IPTR
)node
));
1676 if (node
->ie_Flags
& ICONENTRY_FLAG_HASICON
)
1678 /* Snapshot-all should only save positions of objects that already have icons.
1679 * This is by design and how 3.1 Workbench works. In order to snapshot all objects in window
1680 * regardless if they have icons or not: 1) make all objects visible, 2) select all objects,
1681 * 3) select icon->snapshot */
1682 D(bug("[Wanderer:IconWindow] %s: SNAPSHOT entry = '%s' @ %p, (%p)\n", __PRETTY_FUNCTION__
,
1683 icon_entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, icon_entry
, node
));
1684 if (node
->ie_DiskObj
)
1686 node
->ie_DiskObj
->do_CurrentX
= node
->ie_IconX
;
1687 node
->ie_DiskObj
->do_CurrentY
= node
->ie_IconY
;
1688 PutIconTagList(icon_entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, node
->ie_DiskObj
, icon_tags
);
1692 D(bug("[[Wanderer:IconWindow] %s: icon has no diskobj!\n", __PRETTY_FUNCTION__
));
1704 D(bug("[Wanderer:IconWindow] %s: snapshot WINDOW\n", __PRETTY_FUNCTION__
));
1707 IconWindow_StoreSettings(self
);
1714 IPTR
IconWindow__SetupClass()
1716 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1718 NewList(&iconwindow_BackFillNodes
);
1719 D(bug("[Wanderer:IconWindow] %s: iconwindow_BackFillNodes @ %p\n", __PRETTY_FUNCTION__
, &iconwindow_BackFillNodes
));
1720 NewList(&iconwindow_Extensions
);
1721 D(bug("[Wanderer:IconWindow] %s: iconwindow_Extensions @ %p\n", __PRETTY_FUNCTION__
, &iconwindow_Extensions
));
1722 iconwindow_BackFill_Active
= NULL
;
1727 /*** Setup ******************************************************************/
1728 ICONWINDOW_CUSTOMCLASS
1730 IconWindow
, NULL
, MUIC_Window
, NULL
,
1731 OM_NEW
, struct opSet
*,
1733 OM_SET
, struct opSet
*,
1734 OM_GET
, struct opGet
*,
1735 MUIM_Window_Setup
, Msg
,
1736 MUIM_Window_Cleanup
, Msg
,
1737 MUIM_IconWindow_Open
, Msg
,
1738 MUIM_IconWindow_UnselectAll
, Msg
,
1739 MUIM_IconWindow_DoubleClicked
, Msg
,
1740 MUIM_IconWindow_IconsDropped
, Msg
,
1741 MUIM_IconWindow_Clicked
, Msg
,
1742 MUIM_IconWindow_DirectoryUp
, Msg
,
1743 MUIM_IconWindow_AppWindowDrop
, Msg
,
1744 MUIM_IconWindow_Remove
, Msg
,
1745 MUIM_IconWindow_RateLimitRefresh
, Msg
,
1746 MUIM_IconWindow_Snapshot
, struct MUIP_IconWindow_Snapshot
*,
1747 MUIM_IconWindow_BackFill_Register
, struct MUIP_IconWindow_BackFill_Register
*,
1748 MUIM_IconWindow_BackFill_Setup
, struct MUIP_IconWindow_BackFill_Setup
*,
1749 MUIM_IconWindow_BackFill_Cleanup
, struct MUIP_IconWindow_BackFill_Cleanup
*,
1750 MUIM_IconWindow_BackFill_ProcessBackground
, struct MUIP_IconWindow_BackFill_ProcessBackground
*,
1751 MUIM_IconWindow_BackFill_DrawBackground
, struct MUIP_IconWindow_BackFill_DrawBackground
*
1754 ADD2INIT(IconWindow__SetupClass
, 0);
1757 int initIconWindowClass(void)
1759 IPTR ret1
= IconWindow_Initialize();
1761 IPTR ret2
= IconWindow__SetupClass();
1763 IPTR ret3
= ImageBackFill__SetupClass();
1765 if (ret1
&& ret2
&& ret3
)