2 Copyright 2004-2009, The AROS Development Team. All rights reserved.
8 #include "portable_macros.h"
10 #define MUIMASTER_YES_INLINE_STDARG
13 #define ICONWINDOW_NODETAILVIEWCLASS
14 //#define ICONWINDOW_BUFFERLIST
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>
30 #include <proto/utility.h>
32 #include <proto/graphics.h>
34 #include <proto/exec.h>
35 #include <proto/datatypes.h>
38 #include <proto/dos.h>
40 #include <proto/icon.h>
45 #include <intuition/screens.h>
46 #include <datatypes/pictureclass.h>
47 #include <clib/macros.h>
50 #include <clib/alib_protos.h>
52 #include <prefs/wanderer.h>
54 #include <prefs_AROS/wanderer.h>
57 #if defined(__AMIGA__) && !defined(__PPC__)
58 #define NO_INLINE_STDARG
60 #ifndef _PROTO_INTUITION_H
61 #include <proto/intuition.h>
63 #include <proto/muimaster.h>
65 #include "Classes/iconlist.h"
66 #include "Classes/iconlistview.h"
67 #include "Classes/iconlist_attributes.h"
69 #include "wandererprefs.h"
71 #include "iconwindow.h"
72 #include "iconwindow_attributes.h"
73 #include "iconwindow_iconlist.h"
74 #include "iconwindowbackfill.h"
80 #define D(x) if (DEBUG) x
82 #define bug DebugPrintF
91 #if defined(ICONWINDOW_NODETAILVIEWCLASS)
92 struct MUI_CustomClass
*IconWindowDetailDrawerList_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 const char __intern_wintitle_wanderer
[] = "Wanderer";
106 /*** Hook functions *********************************************************/
108 ///IconWindow__HookFunc_PrefsUpdatedFunc()
111 void, IconWindow__HookFunc_PrefsUpdatedFunc
,
112 AROS_UFHA(struct Hook
*, hook
, A0
),
113 AROS_UFHA(APTR
*, obj
, A2
),
114 AROS_UFHA(APTR
, param
, A1
)
118 HOOKPROTO(IconWindow__HookFunc_PrefsUpdatedFunc
, void, APTR
*obj
, APTR param
)
123 /* Get our private data */
124 Object
*self
= ( Object
*)obj
;
125 Class
*CLASS
= *( Class
**)param
;
128 SETUP_ICONWINDOW_INST_DATA
;
130 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
133 GET(self
, MUIA_IconWindow_Changed
, &changed_state
);
135 if ((changed_state
) && (data
->iwd_IconListObj
))
137 D(bug("[Wanderer:IconWindow] %s: Window contents have changed .. updating display ..\n", __PRETTY_FUNCTION__
));
138 DoMethod(data
->iwd_IconListObj
, MUIM_IconList_Update
);
139 SET(self
, MUIA_IconWindow_Changed
, FALSE
);
145 MakeStaticHook(iwd_PrefsUpdated_hook
,IconWindow__HookFunc_PrefsUpdatedFunc
);
149 ///IconWindow__HookFunc_ProcessBackgroundFunc()
152 void, IconWindow__HookFunc_ProcessBackgroundFunc
,
153 AROS_UFHA(struct Hook
*, hook
, A0
),
154 AROS_UFHA(APTR
*, obj
, A2
),
155 AROS_UFHA(APTR
, param
, A1
)
159 HOOKPROTO(IconWindow__HookFunc_ProcessBackgroundFunc
, void, APTR
*obj
, APTR param
)
164 /* Get our private data */
165 Object
*self
= ( Object
*)obj
,
167 Class
*CLASS
= *( Class
**)param
;
169 SETUP_ICONWINDOW_INST_DATA
;
171 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
173 DoMethod(self
, MUIM_IconWindow_BackFill_ProcessBackground
, data
->iwd_BackFillInfo
, data
->iwd_RootViewObj
);
175 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
179 //BOOL options_changed = FALSE;
180 IPTR prefs_Processing
= 0;
182 GET(prefs
, MUIA_WandererPrefs_Processing
, &prefs_Processing
);
183 if (!prefs_Processing
)
185 #warning "TODO: We arent in prefs-processing so cause an update!"
192 MakeStaticHook(iwd_ProcessBackground_hook
,IconWindow__HookFunc_ProcessBackgroundFunc
);
196 ///IconWindow__HookFunc_WandererBackFillFunc()
199 void, IconWindow__HookFunc_WandererBackFillFunc
,
200 AROS_UFHA(struct Hook
*, hook
, A0
),
201 AROS_UFHA(struct RastPort
*, RP
, A2
),
202 AROS_UFHA(struct BackFillMsg
*, BFM
, A1
)
206 HOOKPROTO(IconWindow__HookFunc_WandererBackFillFunc
, void, struct RastPort
*RP
, struct BackFillMsg
*BFM
)
211 struct IconWindow_BackFillHookData
*HookData
= NULL
;
213 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
215 if ((HookData
= hook
->h_Data
) && (iconwindow_BackFill_Active
!= NULL
))
217 Class
*CLASS
= HookData
->bfhd_IWClass
;
218 Object
*self
= HookData
->bfhd_IWObject
;
220 SETUP_ICONWINDOW_INST_DATA
;
222 struct RastPort
*DrawBackGround_RastPort
= NULL
;
223 struct IconWindowBackFillMsg DrawBackGround_BackFillMsg
;
225 GET(data
->iwd_IconListObj
, MUIA_IconList_BufferRastport
, &DrawBackGround_RastPort
);
227 if (DrawBackGround_RastPort
!= NULL
)
229 if ((DrawBackGround_BackFillMsg
.Layer
= DrawBackGround_RastPort
->Layer
) == NULL
)
231 D(bug("[Wanderer:IconWindow] %s: Rastport Layer = NULL!\n", __PRETTY_FUNCTION__
));
234 GET(data
->iwd_IconListObj
,MUIA_IconList_BufferLeft
, &DrawBackGround_BackFillMsg
.AreaBounds
.MinX
);
235 GET(data
->iwd_IconListObj
,MUIA_IconList_BufferTop
, &DrawBackGround_BackFillMsg
.AreaBounds
.MinY
);
236 GET(data
->iwd_IconListObj
,MUIA_IconList_BufferWidth
, &DrawBackGround_BackFillMsg
.AreaBounds
.MaxX
);
237 GET(data
->iwd_IconListObj
,MUIA_IconList_BufferHeight
, &DrawBackGround_BackFillMsg
.AreaBounds
.MaxY
);
239 DrawBackGround_BackFillMsg
.AreaBounds
.MaxX
+= DrawBackGround_BackFillMsg
.AreaBounds
.MinX
- 1;
240 DrawBackGround_BackFillMsg
.AreaBounds
.MaxY
+= DrawBackGround_BackFillMsg
.AreaBounds
.MinY
- 1;
242 DrawBackGround_BackFillMsg
.DrawBounds
.MinX
= BFM
->Bounds
.MinX
;
243 DrawBackGround_BackFillMsg
.DrawBounds
.MinY
= BFM
->Bounds
.MinY
;
244 DrawBackGround_BackFillMsg
.DrawBounds
.MaxX
= BFM
->Bounds
.MaxX
;
245 DrawBackGround_BackFillMsg
.DrawBounds
.MaxY
= BFM
->Bounds
.MaxY
;
247 /* Offset into source image (ala scroll bar position) */
248 DrawBackGround_BackFillMsg
.OffsetX
= BFM
->OffsetX
;
249 DrawBackGround_BackFillMsg
.OffsetY
= BFM
->OffsetY
;
250 DoMethod(self
, MUIM_IconWindow_BackFill_DrawBackground
, data
->iwd_BackFillInfo
, &DrawBackGround_BackFillMsg
, DrawBackGround_RastPort
);
258 MakeStaticHook(Hook_WandererBackFillFunc
,IconWindow__HookFunc_WandererBackFillFunc
);
263 Object
*IconWindow__OM_NEW(Class
*CLASS
, Object
*self
, struct opSet
*message
)
265 struct iconWindow_Extension
*iw_Extension
= NULL
;
267 struct Screen
*_newIconWin__Screen
= NULL
;
268 Object
*_newIconWin__IconListObj
= NULL
,
269 *_newIconWin__RootViewObj
= NULL
,
271 *_newIconWin__TopPanelContainerObj
= NULL
,
272 *_newIconWin__TopPanelRootGroupObj
= NULL
,
273 *_newIconWin__TopPanelSpacerObj
= NULL
,
275 *_newIconWin__LeftPanelContainerObj
= NULL
,
276 *_newIconWin__LeftPanelRootGroupObj
= NULL
,
277 *_newIconWin__LeftPanelSpacerObj
= NULL
,
279 *_newIconWin__BottomPanelContainerObj
= NULL
,
280 *_newIconWin__BottomPanelRootGroupObj
= NULL
,
281 *_newIconWin__BottomPanelSpacerObj
= NULL
,
285 char *_newIconWin__Title
= NULL
;
287 UBYTE _newIconWin__VOLVIEWMODE
= MUIV_IconWindow_VolumeInfoMode_ShowAllIfNoInfo
;
292 struct Hook
*actionHook
= NULL
;
293 struct TextFont
*_newIconWin__WindowFont
= NULL
;
295 struct Hook
*_newIconWin__BackFillHook
= NULL
;
297 IPTR WindowBF_TAG
= (IPTR
)TAG_IGNORE
;
299 IPTR _newIconWin__WindowWidth
= 0;
300 IPTR _newIconWin__WindowHeight
= 0;
301 IPTR _newIconWin__WindowLeft
= 0;
302 IPTR _newIconWin__WindowTop
= 0;
304 IPTR _newIconWin__FSNotifyPort
= (IPTR
)NULL
;
305 struct MUI_CustomClass
*iconviewclass
= NULL
;
306 #if defined(ICONWINDOW_NODETAILVIEWCLASS)
307 IconWindowDetailDrawerList_CLASS
= IconWindowDrawerList_CLASS
;
310 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
312 /* More than one GetTagData is not very efficient, however since this isn't called very often... */
313 isBackdrop
= (BOOL
)GetTagData(MUIA_IconWindow_IsBackdrop
, (IPTR
)FALSE
, message
->ops_AttrList
);
315 isRoot
= (BOOL
)GetTagData(MUIA_IconWindow_IsRoot
, (IPTR
)FALSE
, message
->ops_AttrList
);
317 actionHook
= (struct Hook
*)GetTagData(MUIA_IconWindow_ActionHook
, (IPTR
) NULL
, message
->ops_AttrList
);
318 _newIconWin__WindowFont
= (struct TextFont
*)GetTagData(MUIA_IconWindow_Font
, (IPTR
) NULL
, message
->ops_AttrList
);
319 prefs
= (Object
*)GetTagData(MUIA_Wanderer_Prefs
, (IPTR
) NULL
, message
->ops_AttrList
);
321 _newIconWin__FSNotifyPort
= (IPTR
)GetTagData(MUIA_Wanderer_FileSysNotifyPort
, (IPTR
) NULL
, message
->ops_AttrList
);
323 /* Request the screen we should use .. */
324 if (!(_newIconWin__Screen
= (struct Screen
*)GetTagData(MUIA_Wanderer_Screen
, (IPTR
) NULL
, message
->ops_AttrList
)))
326 D(bug("[Wanderer:IconWindow] %s: NO SCREEN SET!\n", __PRETTY_FUNCTION__
));
329 D(bug("[Wanderer:IconWindow] %s: Screen @ 0x%p\n", __PRETTY_FUNCTION__
, _newIconWin__Screen
));
331 if ((_newIconWin__BackFillHook
= AllocVec(sizeof(struct Hook
), MEMF_CLEAR
|MEMF_PUBLIC
))!=NULL
)
333 D(bug("[Wanderer:IconWindow] %s: Allocated WindowBackFillHook @ 0x%p\n", __PRETTY_FUNCTION__
, _newIconWin__BackFillHook
));
336 _newIconWin__BackFillHook
->h_Entry
= ( HOOKFUNC
)IconWindow__HookFunc_WandererBackFillFunc
;
338 _newIconWin__BackFillHook
= &Hook_WandererBackFillFunc
;
341 //#if defined(__MORPHOS__)
342 // WindowBF_TAG = MUIA_Window_BackFillHook;
344 WindowBF_TAG
= (APTR
)WA_BackFill
;
350 iconviewclass
= IconWindowVolumeList_CLASS
;
351 _newIconWin__IconListObj
= (Object
*)NewObject(iconviewclass
->mcc_Class
, NULL
,
352 MUIA_Font
, (IPTR
)_newIconWin__WindowFont
,
355 _newIconWin__WindowWidth
= GetBitMapAttr(_newIconWin__Screen
->RastPort
.BitMap
, BMA_WIDTH
);
356 _newIconWin__WindowHeight
= GetBitMapAttr(_newIconWin__Screen
->RastPort
.BitMap
, BMA_HEIGHT
);
357 D(bug("[Wanderer:IconWindow] %s: Screen dimensions .. %ld x %ld\n", __PRETTY_FUNCTION__
, _newIconWin__WindowWidth
, _newIconWin__WindowHeight
));
361 D(bug("[Wanderer:IconWindow] %s: BACKDROP ROOT Window\n", __PRETTY_FUNCTION__
));
362 _newIconWin__Title
= NULL
;
366 D(bug("[Wanderer:IconWindow] %s: Plain ROOT Window\n", __PRETTY_FUNCTION__
));
367 _newIconWin__Title
= __intern_wintitle_wanderer
;
370 _newIconWin__WindowTop
= _newIconWin__Screen
->BarHeight
+ 1;
371 _newIconWin__WindowLeft
= 0;
373 _newIconWin__WindowHeight
-= _newIconWin__WindowTop
;
377 struct DiskObject
*drawericon
= NULL
;
378 IPTR geticon_error
= 0, geticon_isdefault
= 0;
379 IPTR _newIconWin__TitleLen
= 0;
380 IPTR current_DispFlags
= 0, current_SortFlags
= 0;
381 IPTR icon__DispFlags
= 0,icon__DispFlagMask
= ~0;
383 _newIconWin__WindowTop
= MUIV_Window_TopEdge_Centered
;
384 _newIconWin__WindowLeft
= MUIV_Window_LeftEdge_Centered
;
385 _newIconWin__WindowWidth
= 300;
386 _newIconWin__WindowHeight
= 300;
388 _newIconWin__Title
= (STRPTR
) GetTagData(MUIA_IconWindow_Location
, (IPTR
)NULL
, message
->ops_AttrList
);
389 _newIconWin__TitleLen
= strlen(_newIconWin__Title
);
391 if (_newIconWin__Title
[_newIconWin__TitleLen
- 1] == ':')
393 D(bug("[Wanderer:IconWindow] %s: Opening Volume Root Window '%s'\n", __PRETTY_FUNCTION__
, _newIconWin__Title
));
397 D(bug("[Wanderer:IconWindow] %s: Opening Drawer Window '%s'\n", __PRETTY_FUNCTION__
, _newIconWin__Title
));
400 drawericon
= GetIconTags(_newIconWin__Title
,
401 ICONGETA_FailIfUnavailable
, FALSE
,
402 ICONGETA_IsDefaultIcon
, &geticon_isdefault
,
403 ICONA_ErrorCode
, &geticon_error
,
406 if ((drawericon
) && (drawericon
->do_DrawerData
))
408 D(bug("[Wanderer:IconWindow] %s: Directory Icon has DRAWER data!\n", __PRETTY_FUNCTION__
));
409 _newIconWin__WindowTop
= drawericon
->do_DrawerData
->dd_NewWindow
.TopEdge
;
410 _newIconWin__WindowLeft
= drawericon
->do_DrawerData
->dd_NewWindow
.LeftEdge
;
411 _newIconWin__WindowWidth
= drawericon
->do_DrawerData
->dd_NewWindow
.Width
;
412 _newIconWin__WindowHeight
= drawericon
->do_DrawerData
->dd_NewWindow
.Height
;
415 iconviewclass
= IconWindowDrawerList_CLASS
;
416 if ((drawericon
) && (drawericon
->do_Gadget
.UserData
> 0))
418 D(bug("[Wanderer:IconWindow] %s: Directory Icons has OS 2.x/3.x data: FLAGS %x [\n", __PRETTY_FUNCTION__
, drawericon
->do_DrawerData
->dd_Flags
));
419 switch (drawericon
->do_DrawerData
->dd_Flags
)
428 D(bug("Show only icons"));
429 icon__DispFlags
|= ICONLIST_DISP_SHOWINFO
;
434 D(bug("Show all files"));
435 icon__DispFlagMask
&= ~ICONLIST_DISP_SHOWINFO
;
440 D(bug("Show all files"));
441 icon__DispFlags
|= ICONLIST_DISP_SHOWHIDDEN
;
442 icon__DispFlagMask
&= ~ICONLIST_DISP_SHOWINFO
;
451 D(bug("] VIEWMODES %x [", drawericon
->do_DrawerData
->dd_ViewModes
));
453 switch (drawericon
->do_DrawerData
->dd_ViewModes
)
457 D(bug("Default (inherit from parent)"));
462 D(bug("View as icons"));
467 D(bug("View as text, sorted by name"));
468 iconviewclass
= IconWindowDetailDrawerList_CLASS
;
473 D(bug("View as text, sorted by date"));
474 iconviewclass
= IconWindowDetailDrawerList_CLASS
;
479 D(bug("View as text, sorted by size"));
480 iconviewclass
= IconWindowDetailDrawerList_CLASS
;
485 D(bug("View as text, sorted by type"));
486 iconviewclass
= IconWindowDetailDrawerList_CLASS
;
497 if ((_newIconWin__Title
[_newIconWin__TitleLen
- 1] == ':') &&
498 (((geticon_isdefault
) && (_newIconWin__VOLVIEWMODE
== MUIV_IconWindow_VolumeInfoMode_ShowAllIfNoInfo
)) ||
499 (_newIconWin__VOLVIEWMODE
== MUIV_IconWindow_VolumeInfoMode_ShowAll
)))
501 D(bug("[Wanderer:IconWindow] %s: setting 'SHOW ALL FILES'\n", __PRETTY_FUNCTION__
));
502 icon__DispFlagMask
&= ~ICONLIST_DISP_SHOWINFO
;
505 _newIconWin__IconListObj
= (Object
*) NewObject(iconviewclass
->mcc_Class
, NULL
,
506 MUIA_Font
, (IPTR
)_newIconWin__WindowFont
,
507 MUIA_IconDrawerList_Drawer
, (IPTR
) _newIconWin__Title
,
508 MUIA_Wanderer_FileSysNotifyPort
, _newIconWin__FSNotifyPort
,
511 GET(_newIconWin__IconListObj
, MUIA_IconList_DisplayFlags
, ¤t_DispFlags
);
512 SET(_newIconWin__IconListObj
, MUIA_IconList_DisplayFlags
, ((current_DispFlags
& icon__DispFlagMask
)|icon__DispFlags
));
514 D(bug("[Wanderer:IconWindow] %s: Window Co-ords %d,%d [%d x %d]\n", __PRETTY_FUNCTION__
, _newIconWin__WindowLeft
, _newIconWin__WindowTop
, _newIconWin__WindowWidth
, _newIconWin__WindowHeight
));
516 _newIconWin__TopPanelRootGroupObj
= MUI_NewObject(MUIC_Group
,
520 MUIA_InnerBottom
,(0),
521 MUIA_Frame
, MUIV_Frame_None
,
522 MUIA_Group_Spacing
, 0,
523 Child
, (_newIconWin__TopPanelSpacerObj
= HSpace(0)),
526 if (_newIconWin__TopPanelRootGroupObj
)
528 _newIconWin__TopPanelContainerObj
= MUI_NewObject(MUIC_Group
, MUIA_Group_Horiz
, TRUE
,
531 MUIA_HorizWeight
, 100,
533 MUIA_Frame
, MUIV_Frame_None
,
534 MUIA_Group_Spacing
, 3,
535 Child
, (IPTR
)_newIconWin__TopPanelRootGroupObj
,
539 _newIconWin__BottomPanelRootGroupObj
= MUI_NewObject(MUIC_Group
,
543 MUIA_InnerBottom
,(0),
544 MUIA_Frame
, MUIV_Frame_None
,
545 MUIA_Group_Spacing
, 0,
546 Child
, (_newIconWin__BottomPanelSpacerObj
= HSpace(0)),
549 if (_newIconWin__BottomPanelRootGroupObj
)
551 _newIconWin__BottomPanelContainerObj
= MUI_NewObject(MUIC_Group
, MUIA_Group_Horiz
, TRUE
,
554 MUIA_HorizWeight
, 100,
556 MUIA_Frame
, MUIV_Frame_None
,
557 MUIA_Group_Spacing
, 3,
558 Child
, (IPTR
)_newIconWin__BottomPanelRootGroupObj
,
562 _newIconWin__LeftPanelRootGroupObj
= MUI_NewObject(MUIC_Group
,
566 MUIA_InnerBottom
,(0),
567 MUIA_Frame
, MUIV_Frame_None
,
568 MUIA_Group_Spacing
, 0,
569 Child
, (_newIconWin__LeftPanelSpacerObj
= HVSpace
),
572 if (_newIconWin__LeftPanelRootGroupObj
)
574 _newIconWin__LeftPanelContainerObj
= MUI_NewObject(MUIC_Group
, MUIA_Group_Horiz
, TRUE
,
578 MUIA_VertWeight
, 100,
579 MUIA_Frame
, MUIV_Frame_None
,
580 MUIA_Group_Spacing
, 3,
581 Child
, (IPTR
)_newIconWin__LeftPanelRootGroupObj
,
587 _newIconWin__RootViewObj
= (Object
*) IconListviewObject
,
589 MUIA_IconListview_UseWinBorder
, TRUE
,
590 MUIA_IconListview_IconList
, (IPTR
) _newIconWin__IconListObj
,
593 _newIconWin__RootViewObj
= (Object
*) NewObject(IconListview_Class
->mcc_Class
, NULL
,
595 MUIA_IconListview_UseWinBorder
, TRUE
,
596 MUIA_IconListview_IconList
, (IPTR
) _newIconWin__IconListObj
,
601 D(bug("[Wanderer:IconWindow] %s: Font @ 0x%p\n", __PRETTY_FUNCTION__
, _newIconWin__WindowFont
));
604 self
= (Object
*) DoSuperNewTags
608 MUIA_Window_Screen
, _newIconWin__Screen
,
609 MUIA_Window_Backdrop
, isBackdrop
? TRUE
: FALSE
,
610 MUIA_Window_Borderless
, isBackdrop
? TRUE
: FALSE
,
611 MUIA_Window_Width
, _newIconWin__WindowWidth
,
612 MUIA_Window_Height
, _newIconWin__WindowHeight
,
613 MUIA_Window_LeftEdge
, _newIconWin__WindowLeft
,
614 MUIA_Window_TopEdge
, _newIconWin__WindowTop
,
615 (!isBackdrop
) ? MUIA_Window_AltWidth
: TAG_IGNORE
, 100,
616 (!isBackdrop
) ? MUIA_Window_AltHeight
: TAG_IGNORE
, 80,
617 MUIA_Window_Title
, (IPTR
)_newIconWin__Title
,
619 MUIA_Window_DragBar
, (!isBackdrop
) ? TRUE
: FALSE
,
620 MUIA_Window_CloseGadget
, (!isBackdrop
) ? TRUE
: FALSE
,
621 MUIA_Window_SizeGadget
, (!isBackdrop
) ? TRUE
: FALSE
,
622 MUIA_Window_DepthGadget
, (!isBackdrop
) ? TRUE
: FALSE
,
623 #if defined(MUIA_Window_ZoomGadget)
624 MUIA_Window_ZoomGadget
, (!isBackdrop
) ? TRUE
: FALSE
,
626 MUIA_Window_UseBottomBorderScroller
, (!isBackdrop
) ? TRUE
: FALSE
,
627 MUIA_Window_UseRightBorderScroller
, (!isBackdrop
) ? TRUE
: FALSE
,
628 MUIA_Window_IsSubWindow
, TRUE
,
630 WindowBF_TAG
, _newIconWin__BackFillHook
,
632 MUIA_Window_ScreenTitle
, (IPTR
) "",
633 MUIA_Font
, (IPTR
) _newIconWin__WindowFont
,
635 WindowContents
, (IPTR
) MUI_NewObject(MUIC_Group
,
636 MUIA_Group_Spacing
, 0,
637 MUIA_Group_SameSize
, FALSE
,
640 ((!isRoot
) && _newIconWin__TopPanelContainerObj
) ? Child
: TAG_IGNORE
, (IPTR
)_newIconWin__TopPanelContainerObj
,
643 ((!isRoot
) && _newIconWin__LeftPanelContainerObj
) ? Child
: TAG_IGNORE
, (IPTR
)_newIconWin__LeftPanelContainerObj
,
644 /* The actual icon list */
645 Child
, (IPTR
) _newIconWin__RootViewObj
,
648 ((!isRoot
) && _newIconWin__BottomPanelContainerObj
) ? Child
: TAG_IGNORE
, (IPTR
)_newIconWin__BottomPanelContainerObj
,
652 TAG_MORE
, (IPTR
) message
->ops_AttrList
655 self
= (Object
*) DoSuperNew(CLASS
, self
,
656 MUIA_Window_Screen
, _newIconWin__Screen
,
657 MUIA_Window_Backdrop
, isBackdrop
? TRUE
: FALSE
,
658 MUIA_Window_Borderless
, isBackdrop
? TRUE
: FALSE
,
659 MUIA_Window_Width
, _newIconWin__WindowWidth
,
660 MUIA_Window_Height
, _newIconWin__WindowHeight
,
661 MUIA_Window_LeftEdge
, _newIconWin__WindowLeft
,
662 MUIA_Window_TopEdge
, _newIconWin__WindowTop
,
663 (!isBackdrop
) ? MUIA_Window_AltWidth
: TAG_IGNORE
, 100,
664 (!isBackdrop
) ? MUIA_Window_AltHeight
: TAG_IGNORE
, 80,
665 MUIA_Window_Title
, (IPTR
)_newIconWin__Title
,
667 MUIA_Window_DragBar
, (!isBackdrop
) ? TRUE
: FALSE
,
668 MUIA_Window_CloseGadget
, (!isBackdrop
) ? TRUE
: FALSE
,
669 MUIA_Window_SizeGadget
, (!isBackdrop
) ? TRUE
: FALSE
,
670 MUIA_Window_DepthGadget
, (!isBackdrop
) ? TRUE
: FALSE
,
671 #if defined(MUIA_Window_ZoomGadget)
672 MUIA_Window_ZoomGadget
, (!isBackdrop
) ? TRUE
: FALSE
,
674 MUIA_Window_UseBottomBorderScroller
, (!isBackdrop
) ? TRUE
: FALSE
,
675 MUIA_Window_UseRightBorderScroller
, (!isBackdrop
) ? TRUE
: FALSE
,
676 MUIA_Window_IsSubWindow
, TRUE
,
678 WindowBF_TAG
, *_newIconWin__BackFillHook
,
680 MUIA_Window_ScreenTitle
, (IPTR
) "",
681 MUIA_Font
, (IPTR
) _newIconWin__WindowFont
,
683 WindowContents
, (IPTR
) MUI_NewObject(MUIC_Group
,
684 MUIA_Group_Spacing
, 0,
685 MUIA_Group_SameSize
, FALSE
,
688 /* "Extension" group */
689 _newIconWin__TopPanelContainerObj
? Child
: TAG_IGNORE
, (IPTR
)_newIconWin__TopPanelContainerObj
,
692 Child
, (IPTR
) _newIconWin__RootViewObj
,
696 TAG_MORE
, (IPTR
) message
->ops_AttrList
702 SETUP_ICONWINDOW_INST_DATA
;
704 D(bug("[Wanderer:IconWindow] %s: SELF = 0x%p\n", __PRETTY_FUNCTION__
, self
));
706 data
->iwd_VolViewMode
= _newIconWin__VOLVIEWMODE
;
708 data
->iwd_Screen
= _newIconWin__Screen
;
709 data
->iwd_Title
= _newIconWin__Title
;
711 data
->iwd_RootViewObj
= _newIconWin__RootViewObj
;
712 data
->iwd_IconListObj
= _newIconWin__IconListObj
;
714 SET(data
->iwd_RootViewObj
, MUIA_IconWindow_Window
, self
);
716 data
->iwd_ActionHook
= actionHook
;
718 data
->iwd_TopPanel
.iwp_PanelGroupObj
= _newIconWin__TopPanelRootGroupObj
;
719 data
->iwd_TopPanel
.iwp_PanelContainerObj
= _newIconWin__TopPanelContainerObj
;
720 data
->iwd_TopPanel
.iwp_PanelGroupSpacerObj
= _newIconWin__TopPanelSpacerObj
;
722 data
->iwd_LeftPanel
.iwp_PanelGroupObj
= _newIconWin__LeftPanelRootGroupObj
;
723 data
->iwd_LeftPanel
.iwp_PanelContainerObj
= _newIconWin__LeftPanelContainerObj
;
724 data
->iwd_LeftPanel
.iwp_PanelGroupSpacerObj
= _newIconWin__LeftPanelSpacerObj
;
726 data
->iwd_BottomPanel
.iwp_PanelGroupObj
= _newIconWin__BottomPanelRootGroupObj
;
727 data
->iwd_BottomPanel
.iwp_PanelContainerObj
= _newIconWin__BottomPanelContainerObj
;
728 data
->iwd_BottomPanel
.iwp_PanelGroupSpacerObj
= _newIconWin__BottomPanelSpacerObj
;
732 data
->iwd_Flags
|= (isRoot
) ? IWDFLAG_ISROOT
: 0;
733 data
->iwd_Flags
|= (isBackdrop
) ? IWDFLAG_ISBACKDROP
: 0;
735 data
->iwd_WindowFont
= _newIconWin__WindowFont
;
737 data
->iwd_ViewSettings_Attrib
= (data
->iwd_Flags
& IWDFLAG_ISROOT
)
741 data
->iwd_FSNotifyPort
= _newIconWin__FSNotifyPort
;
746 data
->iwd_PrefsUpdated_hook
.h_Entry
= ( HOOKFUNC
)IconWindow__HookFunc_PrefsUpdatedFunc
;
748 data
->iwd_PrefsUpdated_hook
= &iwd_PrefsUpdated_hook
;
753 prefs
, MUIM_Notify
, MUIA_WandererPrefs_Processing
, FALSE
,
755 MUIM_CallHook
, &data
->iwd_PrefsUpdated_hook
, (IPTR
)CLASS
758 data
->iwd_ViewSettings_PrefsNotificationObject
= (Object
*) DoMethod(prefs
,
759 MUIM_WandererPrefs_ViewSettings_GetNotifyObject
,
760 data
->iwd_ViewSettings_Attrib
);
764 data
->iwd_ProcessBackground_hook
.h_Entry
= ( HOOKFUNC
)IconWindow__HookFunc_ProcessBackgroundFunc
;
766 data
->iwd_ProcessBackground_hook
= &iwd_ProcessBackground_hook
;
769 if ((data
->iwd_BackFill_hook
= _newIconWin__BackFillHook
))
771 data
->iwd_BackFillHookData
.bfhd_IWClass
= CLASS
;
772 data
->iwd_BackFillHookData
.bfhd_IWObject
= self
;
773 data
->iwd_BackFill_hook
->h_Data
= &data
->iwd_BackFillHookData
;
776 ForeachNode(&iconwindow_Extensions
, iw_Extension
)
778 D(bug("[Wanderer:IconWindow] %s: Setting up '%s' @ %p\n", __PRETTY_FUNCTION__
, iw_Extension
->iwe_Node
.ln_Name
, iw_Extension
));
779 iw_Extension
->iwe_Setup(CLASS
, self
, message
);
782 data
->iwd_Flags
|= IWDFLAG_SETUP
;
784 /* If double clicked then we call our own private methods, that's
785 easier then using Hooks */
788 _newIconWin__IconListObj
, MUIM_Notify
, MUIA_IconList_DoubleClick
, TRUE
,
789 (IPTR
) self
, 1, MUIM_IconWindow_DoubleClicked
792 /* notify when icons dropped on another (wanderer) window */
795 _newIconWin__IconListObj
, MUIM_Notify
, MUIA_IconList_IconsDropped
, MUIV_EveryTime
,
796 (IPTR
) self
, 1, MUIM_IconWindow_IconsDropped
799 /* notify when icons dropped on custom application */
802 _newIconWin__IconListObj
, MUIM_Notify
, MUIA_IconList_AppWindowDrop
, MUIV_EveryTime
,
803 (IPTR
) self
, 1, MUIM_IconWindow_AppWindowDrop
808 _newIconWin__IconListObj
, MUIM_Notify
, MUIA_IconList_Clicked
, MUIV_EveryTime
,
809 (IPTR
) self
, 1, MUIM_IconWindow_Clicked
812 D(bug("[Wanderer:IconWindow] obj = %ld\n", self
));
818 IPTR
IconWindow__OM_DISPOSE(Class
*CLASS
, Object
*self
, Msg message
)
820 SETUP_ICONWINDOW_INST_DATA
;
822 struct iconWindow_Extension
*iw_Extension
= NULL
;
823 Object
*prefs
= NULL
;
825 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
832 MUIM_KillNotifyObj
, MUIA_WandererPrefs_Processing
, (IPTR
) self
835 if (data
->iwd_Flags
& IWDFLAG_SETUP
)
837 ForeachNode(&iconwindow_Extensions
, iw_Extension
)
839 D(bug("[Wanderer:IconWindow] %s: Cleanup '%s'\n", __PRETTY_FUNCTION__
, iw_Extension
->iwe_Node
.ln_Name
));
840 iw_Extension
->iwe_Cleanup(CLASS
, self
, message
);
845 if (data
->iwd_BackFill_hook
)
846 FreeVec(data
->iwd_BackFill_hook
);
848 return DoSuperMethodA(CLASS
, self
, message
);
853 IPTR
IconWindow__OM_SET(Class
*CLASS
, Object
*self
, struct opSet
*message
)
855 SETUP_ICONWINDOW_INST_DATA
;
857 struct iconWindow_Extension
*iw_Extension
= NULL
;
859 struct TagItem
*tstate
= message
->ops_AttrList
, *tag
;
860 BOOL UpdateIconlist
= FALSE
;
861 IPTR focusicon
= (IPTR
) NULL
;
864 while ((tag
= NextTagItem((TAGITEM
)&tstate
)) != NULL
)
868 case MUIA_Window_Screen
:
869 D(bug("[Wanderer:IconWindow] %s: MUIA_Window_Screen [screen @ %p]\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
870 data
->iwd_Screen
= (struct Screen
*) tag
->ti_Tag
;
874 D(bug("[Wanderer:IconWindow] %s: MUIA_ShowMe [%x]\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
875 if ((BOOL
)tag
->ti_Data
== TRUE
)
877 struct Screen
*__Wanderer__Screen
= NULL
;
878 GET(_app(self
), MUIA_Wanderer_Screen
, &__Wanderer__Screen
);
879 if (__Wanderer__Screen
!= data
->iwd_Screen
)
881 D(bug("[Wanderer:IconWindow] %s: Screen Changed [old = %p, new = %p]\n", __PRETTY_FUNCTION__
, data
->iwd_Screen
, __Wanderer__Screen
));
882 SET(self
, MUIA_Window_Screen
, __Wanderer__Screen
);
883 if (((data
->iwd_Flags
& IWDFLAG_ISROOT
)) && ((data
->iwd_Flags
& IWDFLAG_ISBACKDROP
)))
885 IPTR _IconWin__NewWindowWidth
= 0;
886 IPTR _IconWin__NewWindowHeight
= 0;
887 IPTR _IconWin__NewWindowLeft
= 0;
888 IPTR _IconWin__NewWindowTop
= 0;
890 D(bug("[Wanderer:IconWindow] %s: Updating Backdrop Window Dimensions\n", __PRETTY_FUNCTION__
));
892 _IconWin__NewWindowWidth
= GetBitMapAttr(__Wanderer__Screen
->RastPort
.BitMap
, BMA_WIDTH
);
893 _IconWin__NewWindowHeight
= GetBitMapAttr(__Wanderer__Screen
->RastPort
.BitMap
, BMA_HEIGHT
);
894 D(bug("[Wanderer:IconWindow] %s: Screen dimensions .. %d x %d\n", __PRETTY_FUNCTION__
, _IconWin__NewWindowWidth
, _IconWin__NewWindowHeight
));
896 _IconWin__NewWindowTop
= __Wanderer__Screen
->BarHeight
+ 1;
897 _IconWin__NewWindowLeft
= 0;
899 _IconWin__NewWindowHeight
-= _IconWin__NewWindowTop
;
901 D(bug("[Wanderer:IconWindow] %s: New Window dimensions .. %d x %d @ %d, %d\n", __PRETTY_FUNCTION__
, _IconWin__NewWindowWidth
, _IconWin__NewWindowHeight
, _IconWin__NewWindowLeft
, _IconWin__NewWindowTop
));
903 SET(self
, MUIA_Window_Width
, _IconWin__NewWindowWidth
);
904 SET(self
, MUIA_Window_Height
, _IconWin__NewWindowHeight
);
910 case MUIA_IconWindow_Changed
:
911 data
->iwd_Flags
|= (tag
->ti_Data
) ? IWDFLAG_NEEDSUPDATE
: 0;
914 case MUIA_Window_Open
:
915 D(bug("[Wanderer:IconWindow] %s: MUIA_Window_Open [%ld]\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
916 if ((BOOL
)tag
->ti_Data
== TRUE
)
918 DoMethod(data
->iwd_IconListObj
, MUIM_IconList_Clear
);
920 rv
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
921 #if defined(ICONWINDOW_BUFFERLIST)
922 if (!((data
->iwd_Flags
& IWDFLAG_ISROOT
)))
924 IPTR CURDISPFLAGS
= NULL
;
925 GET(data
->iwd_IconListObj
, MUIA_IconList_DisplayFlags
, &CURDISPFLAGS
);
926 CURDISPFLAGS
|= ICONLIST_DISP_BUFFERED
;
927 SET(data
->iwd_IconListObj
, MUIA_IconList_DisplayFlags
, CURDISPFLAGS
);
930 D(bug("[Wanderer:IconWindow] %s: Process the background ..\n", __PRETTY_FUNCTION__
));
931 DoMethod(self
, MUIM_IconWindow_BackFill_ProcessBackground
, data
->iwd_BackFillInfo
, data
->iwd_RootViewObj
);
933 D(bug("[Wanderer:IconWindow] %s: Force an update of the list ..\n", __PRETTY_FUNCTION__
));
934 DoMethod(data
->iwd_IconListObj
, MUIM_IconList_Update
);
939 case MUIA_Window_Activate
:
940 if (data
->iwd_IconListObj
)
941 GET(data
->iwd_IconListObj
, MUIA_IconList_FocusIcon
, &focusicon
);
945 case MUIA_IconWindow_Font
:
946 data
->iwd_WindowFont
= (struct TextFont
*)tag
->ti_Data
;
947 D(bug("[Wanderer:IconWindow] %s: MUIA_IconWindow_Font [font @ 0x%p]\n", __PRETTY_FUNCTION__
, data
->iwd_WindowFont
));
949 if (!data
->iwd_WindowFont
)
950 SetFont(_rp(self
), data
->iwd_WindowFont
);
954 case MUIA_IconWindow_Location
:
955 D(bug("[Wanderer:IconWindow] %s: MUIA_IconWindow_Location [drawer '%s']\n", __PRETTY_FUNCTION__
, data
->iwd_DirectoryPath
));
957 if (!(data
->iwd_Flags
& IWDFLAG_ISROOT
))
959 strcpy(data
->iwd_DirectoryPath
, (STRPTR
)tag
->ti_Data
);
960 SET(self
, MUIA_Window_Title
, (IPTR
)data
->iwd_DirectoryPath
);
961 SET(data
->iwd_IconListObj
, MUIA_IconDrawerList_Drawer
, (IPTR
)data
->iwd_DirectoryPath
);
965 case MUIA_IconWindow_BackgroundAttrib
:
966 D(bug("[Wanderer:IconWindow] %s: MUIA_IconWindow_BackgroundAttrib (not implemented)\n", __PRETTY_FUNCTION__
));
972 rv
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
974 if (data
->iwd_Flags
& IWDFLAG_SETUP
)
976 ForeachNode(&iconwindow_Extensions
, iw_Extension
)
978 D(bug("[Wanderer:IconWindow] %s: Checking '%s'\n", __PRETTY_FUNCTION__
, iw_Extension
->iwe_Node
.ln_Name
));
979 iw_Extension
->iwe_Set(CLASS
, self
, message
);
984 DoMethod(data
->iwd_IconListObj
, MUIM_IconList_Update
);
988 D(bug("[Wanderer:IconWindow] %s: Updating focused icon (@ 0x%p)\n", __PRETTY_FUNCTION__
, focusicon
));
989 //MUI_Redraw(data->iwd_IconListObj, MADF_DRAWOBJECT);
997 IPTR
IconWindow__OM_GET(Class
*CLASS
, Object
*self
, struct opGet
*message
)
999 SETUP_ICONWINDOW_INST_DATA
;
1000 struct iconWindow_Extension
*iw_Extension
= NULL
;
1001 IPTR
*store
= message
->opg_Storage
;
1004 switch (message
->opg_AttrID
)
1006 case MUIA_IconWindow_Changed
:
1007 *store
= (IPTR
)(data
->iwd_Flags
& IWDFLAG_NEEDSUPDATE
);
1010 case MUIA_IconWindow_Window
:
1011 *store
= (IPTR
)self
;
1014 case MUIA_IconWindow_Location
:
1015 *store
= !(data
->iwd_Flags
& IWDFLAG_ISROOT
)
1016 ? XGET(data
->iwd_IconListObj
, MUIA_IconDrawerList_Drawer
)
1020 case MUIA_IconWindow_IconList
:
1021 *store
= (IPTR
)data
->iwd_IconListObj
;
1024 case MUIA_IconWindow_IsRoot
:
1025 *store
= (IPTR
)(data
->iwd_Flags
& IWDFLAG_ISROOT
);
1028 case MUIA_IconWindow_IsBackdrop
:
1029 *store
= (IPTR
)(data
->iwd_Flags
& IWDFLAG_ISBACKDROP
);
1032 case MUIA_IconWindow_BackFillData
:
1033 *store
= (IPTR
)data
->iwd_BackFillInfo
;
1036 case MUIA_IconWindow_BackgroundAttrib
:
1037 *store
= (IPTR
)data
->iwd_ViewSettings_Attrib
;
1041 *store
= (IPTR
)WIWVERS
;
1045 *store
= (IPTR
)WIWREV
;
1053 rv
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
1057 ForeachNode(&iconwindow_Extensions
, iw_Extension
)
1059 D(bug("[Wanderer:IconWindow] %s: Checking '%s'\n", __PRETTY_FUNCTION__
, iw_Extension
->iwe_Node
.ln_Name
));
1060 if ((rv
= iw_Extension
->iwe_Get(CLASS
, self
, message
)) == TRUE
)
1069 ///IconWindow__MUIM_Window_Setup()
1070 IPTR IconWindow__MUIM_Window_Setup
1072 Class
*CLASS
, Object
*self
, Msg message
1075 SETUP_ICONWINDOW_INST_DATA
;
1077 Object
*prefs
= NULL
;
1079 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1081 if (!DoSuperMethodA(CLASS
, self
, message
)) return FALSE
;
1083 if (iconwindow_BackFill_Active
)
1085 data
->iwd_BackFillInfo
=(struct BackFillInfo
*) DoMethod(self
, MUIM_IconWindow_BackFill_Setup
);
1086 D(bug("[Wanderer:IconWindow] %s: Window BackFill_Data @ 0x%p for '%s'\n", __PRETTY_FUNCTION__
, data
->iwd_BackFillInfo
, iconwindow_BackFill_Active
->bfd_BackFillID
));
1089 GET(_app(self
), MUIA_Wanderer_Prefs
, &prefs
);
1091 D(bug("[Wanderer:IconWindow] %s: App PrefsObj @ 0x%p\n", __PRETTY_FUNCTION__
, prefs
));
1093 if ((prefs
) && (data
->iwd_ViewSettings_PrefsNotificationObject
))
1095 D(bug("[Wanderer:IconWindow] %s: Setting up window background change hook\n", __PRETTY_FUNCTION__
));
1097 /* Set-up a hook to call ProcessBackground on prefs notification */
1100 data
->iwd_ViewSettings_PrefsNotificationObject
, MUIM_Notify
, MUIA_Background
, MUIV_EveryTime
,
1102 MUIM_CallHook
, &data
->iwd_ProcessBackground_hook
, (IPTR
)CLASS
1105 if ((data
->iwd_Flags
& IWDFLAG_ISROOT
))
1109 data
->iwd_ViewSettings_PrefsNotificationObject
, MUIM_Notify
, MUIA_IconWindowExt_ImageBackFill_BGRenderMode
, MUIV_EveryTime
,
1111 MUIM_CallHook
, &data
->iwd_ProcessBackground_hook
, (IPTR
)CLASS
1117 data
->iwd_ViewSettings_PrefsNotificationObject
, MUIM_Notify
, MUIA_IconWindowExt_ImageBackFill_BGTileMode
, MUIV_EveryTime
,
1119 MUIM_CallHook
, &data
->iwd_ProcessBackground_hook
, (IPTR
)CLASS
1124 data
->iwd_ViewSettings_PrefsNotificationObject
, MUIM_Notify
, MUIA_IconWindowExt_ImageBackFill_BGXOffset
, MUIV_EveryTime
,
1126 MUIM_CallHook
, &data
->iwd_ProcessBackground_hook
, (IPTR
)CLASS
1131 data
->iwd_ViewSettings_PrefsNotificationObject
, MUIM_Notify
, MUIA_IconWindowExt_ImageBackFill_BGYOffset
, MUIV_EveryTime
,
1133 MUIM_CallHook
, &data
->iwd_ProcessBackground_hook
, (IPTR
)CLASS
1137 D(bug("[Wanderer:IconWindow] %s: Setup complete!\n", __PRETTY_FUNCTION__
));
1143 ///IconWindow__MUIM_Window_Cleanup()
1144 IPTR IconWindow__MUIM_Window_Cleanup
1146 Class
*CLASS
, Object
*self
, Msg message
1149 SETUP_ICONWINDOW_INST_DATA
;
1151 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1153 if (data
->iwd_BackFillInfo
)
1155 DoMethod(self
, MUIM_IconWindow_BackFill_Cleanup
, data
->iwd_BackFillInfo
);
1156 data
->iwd_BackFillInfo
= NULL
;
1159 if (data
->iwd_ViewSettings_PrefsNotificationObject
)
1163 data
->iwd_ViewSettings_PrefsNotificationObject
,
1164 MUIM_KillNotifyObj
, MUIA_IconWindowExt_ImageBackFill_BGYOffset
, (IPTR
) self
1169 data
->iwd_ViewSettings_PrefsNotificationObject
,
1170 MUIM_KillNotifyObj
, MUIA_IconWindowExt_ImageBackFill_BGXOffset
, (IPTR
) self
1175 data
->iwd_ViewSettings_PrefsNotificationObject
,
1176 MUIM_KillNotifyObj
, MUIA_IconWindowExt_ImageBackFill_BGTileMode
, (IPTR
) self
1179 if ((data
->iwd_Flags
& IWDFLAG_ISROOT
))
1183 data
->iwd_ViewSettings_PrefsNotificationObject
,
1184 MUIM_KillNotifyObj
, MUIA_IconWindowExt_ImageBackFill_BGRenderMode
, (IPTR
) self
1190 data
->iwd_ViewSettings_PrefsNotificationObject
,
1191 MUIM_KillNotifyObj
, MUIA_Background
, (IPTR
) self
1194 return DoSuperMethodA(CLASS
, self
, message
);
1198 ///IconWindow__MUIM_IconWindow_DoubleClicked()
1199 IPTR IconWindow__MUIM_IconWindow_DoubleClicked
1201 Class
*CLASS
, Object
*self
, Msg message
1204 SETUP_ICONWINDOW_INST_DATA
;
1206 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1208 if (data
->iwd_ActionHook
)
1210 struct IconWindow_ActionMsg msg
;
1211 msg
.type
= ICONWINDOW_ACTION_OPEN
;
1212 msg
.iconlist
= data
->iwd_IconListObj
;
1213 msg
.isroot
= (data
->iwd_Flags
& IWDFLAG_ISROOT
);
1215 CallHookPkt(data
->iwd_ActionHook
, self
, &msg
);
1222 ///IconWindow__MUIM_IconWindow_Clicked()
1223 IPTR IconWindow__MUIM_IconWindow_Clicked
1225 Class
*CLASS
, Object
*self
, Msg message
1228 SETUP_ICONWINDOW_INST_DATA
;
1230 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1232 if (data
->iwd_ActionHook
)
1234 struct IconWindow_ActionMsg msg
;
1235 msg
.type
= ICONWINDOW_ACTION_CLICK
;
1236 msg
.iconlist
= data
->iwd_IconListObj
;
1237 msg
.isroot
= (data
->iwd_Flags
& IWDFLAG_ISROOT
);
1238 GET(data
->iwd_IconListObj
, MUIA_IconList_Clicked
, &msg
.click
);
1239 CallHookPkt(data
->iwd_ActionHook
, self
, &msg
);
1246 ///IconWindow__MUIM_IconWindow_IconsDropped()
1247 IPTR IconWindow__MUIM_IconWindow_IconsDropped
1249 Class
*CLASS
, Object
*self
, Msg message
1252 SETUP_ICONWINDOW_INST_DATA
;
1254 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1256 if (data
->iwd_ActionHook
)
1258 struct IconWindow_ActionMsg msg
;
1259 msg
.type
= ICONWINDOW_ACTION_ICONDROP
;
1260 msg
.iconlist
= data
->iwd_IconListObj
;
1261 msg
.isroot
= (data
->iwd_Flags
& IWDFLAG_ISROOT
);
1262 GET(data
->iwd_IconListObj
, MUIA_IconList_IconsDropped
, &msg
.drop
);
1265 NNSET(data
->iwd_IconListObj
, MUIA_IconList_IconsDropped
, NULL
);
1266 CallHookPkt(data
->iwd_ActionHook
, self
, &msg
);
1274 ///IconWindow__MUIM_IconWindow_AppWindowDrop()
1275 IPTR IconWindow__MUIM_IconWindow_AppWindowDrop
1277 Class
*CLASS
, Object
*self
, Msg message
1280 SETUP_ICONWINDOW_INST_DATA
;
1282 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1284 if (data
->iwd_ActionHook
)
1286 struct IconWindow_ActionMsg msg
;
1287 msg
.type
= ICONWINDOW_ACTION_APPWINDOWDROP
;
1288 msg
.iconlist
= data
->iwd_IconListObj
;
1289 msg
.isroot
= (data
->iwd_Flags
& IWDFLAG_ISROOT
);
1290 GET(data
->iwd_IconListObj
, MUIA_IconList_IconsDropped
, &msg
.drop
);
1291 CallHookPkt(data
->iwd_ActionHook
, self
, &msg
);
1298 ///IconWindow__MUIM_IconWindow_Open()
1299 IPTR IconWindow__MUIM_IconWindow_Open
1301 Class
*CLASS
, Object
*self
, Msg message
1304 // SETUP_ICONWINDOW_INST_DATA;
1306 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1308 if (!XGET(self
, MUIA_Window_Open
))
1310 SET(self
, MUIA_Window_Open
, TRUE
);
1313 D(bug("[Wanderer:IconWindow] %s: Setting window as active ..\n", __PRETTY_FUNCTION__
));
1314 SET(self
, MUIA_Window_Activate
, TRUE
);
1316 D(bug("[Wanderer:IconWindow] %s: All done\n", __PRETTY_FUNCTION__
));
1322 ///IconWindow__MUIM_IconWindow_DirectoryUp()
1323 IPTR IconWindow__MUIM_IconWindow_DirectoryUp
1325 Class
*CLASS
, Object
*self
, Msg message
1328 SETUP_ICONWINDOW_INST_DATA
;
1330 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1332 if (data
->iwd_ActionHook
)
1334 struct IconWindow_ActionMsg msg
;
1335 msg
.type
= ICONWINDOW_ACTION_DIRUP
;
1336 msg
.iconlist
= data
->iwd_IconListObj
;
1337 msg
.isroot
= (data
->iwd_Flags
& IWDFLAG_ISROOT
);
1339 CallHookPkt(data
->iwd_ActionHook
, self
, &msg
);
1347 ///IconWindow__MUIM_IconWindow_UnselectAll()
1348 IPTR IconWindow__MUIM_IconWindow_UnselectAll
1350 Class
*CLASS
, Object
*self
, Msg message
1353 SETUP_ICONWINDOW_INST_DATA
;
1355 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1357 DoMethod(data
->iwd_IconListObj
, MUIM_IconList_UnselectAll
);
1363 ///IconWindow__MUIM_IconWindow_Remove()
1364 IPTR IconWindow__MUIM_IconWindow_Remove
1366 Class
*CLASS
, Object
*self
, Msg message
1369 // SETUP_ICONWINDOW_INST_DATA;
1371 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1374 SET( self
, MUIA_Window_Open
, FALSE
);
1375 DoMethod ( _app(self
), OM_REMMEMBER
, self
);
1376 DisposeObject(self
);
1382 /*** Stubs for Backfill Hooks ******************************************************************/
1383 ///IconWindow__MUIM_IconWindow_BackFill_Register()
1384 IPTR IconWindow__MUIM_IconWindow_BackFill_Register
1386 Class
*CLASS
, Object
*self
, struct MUIP_IconWindow_BackFill_Register
*message
1389 // SETUP_ICONWINDOW_INST_DATA;
1391 D(bug("[Wanderer:IconWindow]: %s('%s')\n", __PRETTY_FUNCTION__
, message
->register_Node
->bfd_BackFillID
));
1393 AddTail(&iconwindow_BackFillNodes
, (struct Node
*)message
->register_Node
);
1394 if (iconwindow_BackFill_Active
== NULL
) iconwindow_BackFill_Active
= message
->register_Node
;
1400 ///IconWindow__MUIM_IconWindow_BackFill_Setup()
1401 IPTR IconWindow__MUIM_IconWindow_BackFill_Setup
1403 Class
*CLASS
, Object
*self
, struct MUIP_IconWindow_BackFill_Setup
*message
1406 // SETUP_ICONWINDOW_INST_DATA;
1408 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1410 if (iconwindow_BackFill_Active
== NULL
) return FALSE
;
1412 return (iconwindow_BackFill_Active
->bfd_MUIM_IconWindow_BackFill_Setup
)(CLASS
, self
, message
);
1416 ///IconWindow__MUIM_IconWindow_BackFill_Cleanup()
1417 IPTR IconWindow__MUIM_IconWindow_BackFill_Cleanup
1419 Class
*CLASS
, Object
*self
, struct MUIP_IconWindow_BackFill_Cleanup
*message
1422 //SETUP_ICONWINDOW_INST_DATA;
1424 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1426 if (iconwindow_BackFill_Active
== NULL
) return FALSE
;
1428 return (iconwindow_BackFill_Active
->bfd_MUIM_IconWindow_BackFill_Cleanup
)(CLASS
, self
, message
);
1432 ///IconWindow__MUIM_IconWindow_BackFill_ProcessBackground()
1433 IPTR IconWindow__MUIM_IconWindow_BackFill_ProcessBackground
1435 Class
*CLASS
, Object
*self
, struct MUIP_IconWindow_BackFill_ProcessBackground
*message
1438 SETUP_ICONWINDOW_INST_DATA
;
1440 IPTR retVal
= (IPTR
)FALSE
;
1442 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1444 if (iconwindow_BackFill_Active
!= NULL
)
1446 D(bug("[Wanderer:IconWindow] %s: Asking module @ 0x%p to process ..\n", __PRETTY_FUNCTION__
, iconwindow_BackFill_Active
));
1447 retVal
= (iconwindow_BackFill_Active
->bfd_MUIM_IconWindow_BackFill_ProcessBackground
)(CLASS
, self
, message
);
1450 if ((retVal
== (IPTR
)FALSE
) && (data
->iwd_RootViewObj
!= NULL
))
1452 Object
*IconWindowPB_PrefsObj
= NULL
;
1454 D(bug("[Wanderer:IconWindow] %s: No BackFill module/ module cant render mode\n", __PRETTY_FUNCTION__
));
1455 D(bug("[Wanderer:IconWindow] %s: Using default MUI functions ..\n", __PRETTY_FUNCTION__
));
1457 GET(_app(self
), MUIA_Wanderer_Prefs
, &IconWindowPB_PrefsObj
);
1458 if (IconWindowPB_PrefsObj
)
1460 IPTR IconWindowPB_Background
= 0;
1461 IPTR IconWindowPB_BGMode
= 0;
1462 IPTR IconWindowPB_BGTileMode
= 0;
1464 if ((IconWindowPB_Background
= DoMethod(IconWindowPB_PrefsObj
, MUIM_WandererPrefs_ViewSettings_GetAttribute
, data
->iwd_ViewSettings_Attrib
, MUIA_Background
)) != -1)
1466 char *bgmode_string
;
1469 if ((IconWindowPB_BGMode
= DoMethod(IconWindowPB_PrefsObj
, MUIM_WandererPrefs_ViewSettings_GetAttribute
,
1470 data
->iwd_ViewSettings_Attrib
, MUIA_IconWindowExt_ImageBackFill_BGRenderMode
)) == -1)
1471 IconWindowPB_BGMode
= IconWindowExt_ImageBackFill_RenderMode_Tiled
;
1473 if ((IconWindowPB_BGTileMode
= DoMethod(IconWindowPB_PrefsObj
, MUIM_WandererPrefs_ViewSettings_GetAttribute
,
1474 data
->iwd_ViewSettings_Attrib
, MUIA_IconWindowExt_ImageBackFill_BGTileMode
)) == -1)
1475 IconWindowPB_BGTileMode
= IconWindowExt_ImageBackFill_TileMode_Float
;
1477 SET(data
->iwd_RootViewObj
, MUIA_Background
, IconWindowPB_Background
);
1479 bgmode_string
=(STRPTR
) IconWindowPB_Background
;
1480 this_mode
= bgmode_string
[0] - 48;
1482 D(bug("[Wanderer:IconWindow] %s: MUI BG Mode = %d\n", __PRETTY_FUNCTION__
, this_mode
));
1488 if (IconWindowPB_BGMode
== IconWindowExt_ImageBackFill_RenderMode_Scale
)
1490 SET(data
->iwd_RootViewObj
, MUIA_IconListview_ScaledBackground
, TRUE
);
1494 SET(data
->iwd_RootViewObj
, MUIA_IconListview_ScaledBackground
, FALSE
);
1498 if (IconWindowPB_BGTileMode
== IconWindowExt_ImageBackFill_TileMode_Fixed
)
1499 SET(data
->iwd_RootViewObj
, MUIA_IconListview_FixedBackground
, TRUE
);
1501 SET(data
->iwd_RootViewObj
, MUIA_IconListview_FixedBackground
, FALSE
);
1513 ///IconWindow__MUIM_IconWindow_BackFill_DrawBackground()
1514 IPTR IconWindow__MUIM_IconWindow_BackFill_DrawBackground
1516 Class
*CLASS
, Object
*self
, struct MUIP_IconWindow_BackFill_DrawBackground
*message
1519 // SETUP_ICONWINDOW_INST_DATA;
1521 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1523 if (iconwindow_BackFill_Active
== NULL
) return FALSE
;
1525 return (iconwindow_BackFill_Active
->bfd_MUIM_IconWindow_BackFill_DrawBackground
)(CLASS
, self
, message
);
1530 IPTR
IconWindow__SetupClass()
1532 D(bug("[Wanderer:IconWindow]: %s()\n", __PRETTY_FUNCTION__
));
1534 NewList(&iconwindow_BackFillNodes
);
1535 D(bug("[Wanderer:IconWindow] %s: iconwindow_BackFillNodes @ %p\n", __PRETTY_FUNCTION__
, &iconwindow_BackFillNodes
));
1536 NewList(&iconwindow_Extensions
);
1537 D(bug("[Wanderer:IconWindow] %s: iconwindow_Extensions @ %p\n", __PRETTY_FUNCTION__
, &iconwindow_Extensions
));
1538 iconwindow_BackFill_Active
= NULL
;
1543 /*** Setup ******************************************************************/
1544 ICONWINDOW_CUSTOMCLASS
1546 IconWindow
, NULL
, MUIC_Window
, NULL
,
1547 OM_NEW
, struct opSet
*,
1549 OM_SET
, struct opSet
*,
1550 OM_GET
, struct opGet
*,
1551 MUIM_Window_Setup
, Msg
,
1552 MUIM_Window_Cleanup
, Msg
,
1553 MUIM_IconWindow_Open
, Msg
,
1554 MUIM_IconWindow_UnselectAll
, Msg
,
1555 MUIM_IconWindow_DoubleClicked
, Msg
,
1556 MUIM_IconWindow_IconsDropped
, Msg
,
1557 MUIM_IconWindow_Clicked
, Msg
,
1558 MUIM_IconWindow_DirectoryUp
, Msg
,
1559 MUIM_IconWindow_AppWindowDrop
, Msg
,
1560 MUIM_IconWindow_Remove
, Msg
,
1561 MUIM_IconWindow_BackFill_Register
, struct MUIP_IconWindow_BackFill_Register
*,
1562 MUIM_IconWindow_BackFill_Setup
, struct MUIP_IconWindow_BackFill_Setup
*,
1563 MUIM_IconWindow_BackFill_Cleanup
, struct MUIP_IconWindow_BackFill_Cleanup
*,
1564 MUIM_IconWindow_BackFill_ProcessBackground
, struct MUIP_IconWindow_BackFill_ProcessBackground
*,
1565 MUIM_IconWindow_BackFill_DrawBackground
, struct MUIP_IconWindow_BackFill_DrawBackground
*
1568 ADD2INIT(IconWindow__SetupClass
, 0);
1571 int initIconWindowClass(void)
1573 IPTR ret1
= IconWindow_Initialize();
1575 IPTR ret2
= IconWindow__SetupClass();
1577 IPTR ret3
= ImageBackFill__SetupClass();
1579 if (ret1
&& ret2
&& ret3
)