2 Copyright 2004-2009, The AROS Development Team. All rights reserved.
8 #include "portable_macros.h"
11 #define MUIMASTER_YES_INLINE_STDARG
14 #include <aros/debug.h>
17 #define WANDERER_DEFAULT_BACKDROP
19 #include <exec/types.h>
20 #include <libraries/gadtools.h>
21 #include <libraries/mui.h>
24 #include <zune/customclasses.h>
26 #include <zune_AROS/customclasses.h>
29 #include <dos/notify.h>
32 #include <workbench/handler.h>
34 #include <workbench_AROS/handler.h>
37 #include <proto/graphics.h>
38 #include <proto/utility.h>
40 #include <proto/dos.h>
42 #include <proto/icon.h>
45 #include <proto/workbench.h>
48 #include <proto/layers.h>
51 #include <proto/alib.h>
60 #include <aros/detach.h>
61 #include <prefs/wanderer.h>
63 #include <prefs_AROS/wanderer.h>
66 #if defined(__AMIGA__) && !defined(__PPC__)
67 #define NO_INLINE_STDARG
69 #include <proto/intuition.h>
70 #include <proto/muimaster.h>
72 #include <zune/iconimage.h>
74 #include "iconwindow.h"
75 #include "iconwindow_attributes.h"
76 #include "iconwindow_iconlist.h"
77 #include "wandererprefs.h"
78 #include "wandererprefsintern.h"
79 #include "filesystems.h"
81 #include "Classes/iconlist.h"
82 #include "Classes/iconlist_attributes.h"
91 #define D(x) if (DEBUG) x
93 #define bug DebugPrintF
102 #ifndef NO_ICON_POSITION
103 #define NO_ICON_POSITION (0x8000000) /* belongs to workbench/workbench.h */
106 #define KeyButton(name,key) TextObject, ButtonFrame, MUIA_Font, MUIV_Font_Button, MUIA_Text_Contents, (IPTR)(name), MUIA_Text_PreParse, "\33c", MUIA_Text_HiChar, (IPTR)(key), MUIA_ControlChar, key, MUIA_InputMode, MUIV_InputMode_RelVerify, MUIA_Background, MUII_ButtonBack, TAG_DONE)
108 extern IPTR
InitWandererPrefs(void);
109 Object
*FindMenuitem(Object
* strip
, int id
);
110 Object
*Wanderer__Func_CreateWandererIntuitionMenu(BOOL isRoot
, BOOL useBackdrop
);
111 void wanderer_menufunc_window_update(void);
112 void execute_open_with_command(BPTR cd
, STRPTR contents
);
113 void DisposeCopyDisplay(struct MUIDisplayObjects
*d
);
114 BOOL
CreateCopyDisplay(UWORD flags
, struct MUIDisplayObjects
*d
);
116 static struct List _WandererIntern_FSHandlerList
;
118 /* Stored in the main wanderer executable */
119 extern Object
*_WandererIntern_AppObj
;
120 extern Class
*_WandererIntern_CLASS
;
123 struct Hook _WandererIntern_hook_standard
;
124 struct Hook _WandererIntern_hook_action
;
125 struct Hook _WandererIntern_hook_backdrop
;
127 struct Hook
*_WandererIntern_hook_standard
;
128 struct Hook
*_WandererIntern_hook_action
;
129 struct Hook
*_WandererIntern_hook_backdrop
;
132 /*** Instance Data **********************************************************/
135 struct Screen
*wd_Screen
;
142 struct MUI_InputHandlerNode wd_TimerIHN
;
143 struct MsgPort
*wd_CommandPort
;
144 struct MUI_InputHandlerNode wd_CommandIHN
;
145 struct MsgPort
*wd_NotifyPort
;
146 struct MUI_InputHandlerNode wd_NotifyIHN
;
149 BOOL wd_Option_BackDropMode
;
152 const UBYTE wand_titlestr
[] = WANDERERSTR
;
153 const UBYTE wand_versionstr
[] = VERSION
;
154 const UBYTE wand_copyrightstr
[] = WANDERERCOPY
;
155 const UBYTE wand_authorstr
[] = "The AROS Dev Team";
156 const UBYTE wand_namestr
[] = "Wanderer";
158 const UBYTE wand_copyprocnamestr
[] = "Wanderer FileCopy Operation";
160 /*** Macros *****************************************************************/
161 #define SETUP_WANDERER_INST_DATA struct Wanderer_DATA *data = INST_DATA(CLASS, self)
163 /**************************************************************************
165 **************************************************************************/
166 ///Wanderer__HookFunc_DisplayCopyFunc()
170 BOOL
, Wanderer__HookFunc_DisplayCopyFunc
,
171 AROS_UFHA(struct Hook
*, hook
, A0
),
172 AROS_UFHA(struct dCopyStruct
*, obj
, A2
),
173 AROS_UFHA(APTR
, unused_param
, A1
)
177 HOOKPROTO(Wanderer__HookFunc_DisplayCopyFunc
, BOOL
, struct dCopyStruct
*obj
, APTR unused_param
)
182 struct MUIDisplayObjects
*d
= (struct MUIDisplayObjects
*) obj
->userdata
;
184 if ((obj
->flags
& ACTION_UPDATE
) == 0)
188 if ((obj
->filelen
< 8192) && (d
->numfiles
> 0))
191 if (d
->smallobjects
>= 20) d
->smallobjects
= 0;
198 if (d
->smallobjects
> 0)
203 SET(d
->fileObject
, MUIA_Text_Contents
, obj
->file
);
204 SET(d
->sourceObject
, MUIA_Text_Contents
, obj
->spath
);
207 if (d
->action
!= ACTION_DELETE
)
209 d
->bytes
+= obj
->actlen
;
211 if ((obj
->flags
& ACTION_UPDATE
) == 0)
215 SET(d
->gauge
, MUIA_Gauge_Current
, 0);
216 SET(d
->destObject
, MUIA_Text_Contents
, obj
->dpath
);
222 if (d
->updateme
&&(obj
->totallen
<= obj
->filelen
))
224 double rate
= (double) (((double) obj
->totallen
) / (((double) obj
->difftime
) / ((double) CLOCKS_PER_SEC
))) / 1024.0;
225 if (rate
< 1024.0) sprintf(d
->SpeedBuffer
, "%.2f kBytes/s", rate
); else sprintf(d
->SpeedBuffer
, "%.2f MBytes/s", rate
/ 1024.0);
226 SetAttrs(d
->gauge
, MUIA_Gauge_Current
, (ULONG
) (32768.0 * (double) obj
->totallen
/ (double) obj
->filelen
), MUIA_Gauge_InfoText
, d
->SpeedBuffer
, TAG_DONE
);
232 if (d
->bytes
< 1048576)
234 if (obj
->filelen
< 1048576)
237 d
->Buffer
, "%s %ld %s %.2f kBytes %s %.2f kBytes",
238 _(MSG_WANDERER_FILEACCESS_NOOFFILES
), d
->numfiles
, _(MSG_WANDERER_FILEACCESS_ACTUAL
), (double) obj
->filelen
/ 1024.0, _(MSG_WANDERER_FILEACCESS_TOTAL
), (double) d
->bytes
/ 1024.0
244 d
->Buffer
, "%s %ld %s %.2f MBytes %s %.2f kBytes",
245 _(MSG_WANDERER_FILEACCESS_NOOFFILES
), d
->numfiles
, _(MSG_WANDERER_FILEACCESS_ACTUAL
), (double) obj
->filelen
/ 1048576.0, _(MSG_WANDERER_FILEACCESS_TOTAL
), (double) d
->bytes
/ 1024.0
251 if (obj
->filelen
< 1048576)
254 d
->Buffer
, "%s %ld %s %.2f kBytes %s %.2f MBytes",
255 _(MSG_WANDERER_FILEACCESS_NOOFFILES
), d
->numfiles
, _(MSG_WANDERER_FILEACCESS_ACTUAL
), (double) obj
->filelen
/ 1024.0, _(MSG_WANDERER_FILEACCESS_TOTAL
), (double) d
->bytes
/ 1048576.0
261 d
->Buffer
, "%s %ld %s %.2f MBytes %s %.2f MBytes",
262 _(MSG_WANDERER_FILEACCESS_NOOFFILES
), d
->numfiles
, _(MSG_WANDERER_FILEACCESS_ACTUAL
), (double) obj
->filelen
/ 1048576.0, _(MSG_WANDERER_FILEACCESS_TOTAL
), (double) d
->bytes
/ 1048576.0
266 SET(d
->performanceObject
, MUIA_Text_Contents
, d
->Buffer
);
270 DoMethod(d
->copyApp
, MUIM_Application_InputBuffered
);
272 /* read the stopflag and return TRUE if the user wanted to stop actionDir() */
273 if (d
->stopflag
== 1)
281 MakeStaticHook(Hook_DisplayCopyFunc
,Wanderer__HookFunc_DisplayCopyFunc
);
285 ///Wanderer__HookFunc_AskDeleteFunc()
289 ULONG
, Wanderer__HookFunc_AskDeleteFunc
,
290 AROS_UFHA(struct Hook
*, hook
, A0
),
291 AROS_UFHA(struct dCopyStruct
*, obj
, A2
),
292 AROS_UFHA(APTR
, unused_param
, A1
)
296 HOOKPROTO(Wanderer__HookFunc_AskDeleteFunc
, ULONG
, struct dCopyStruct
*obj
, APTR unused_param
)
301 ULONG back
= DELMODE_NONE
;
310 string
= CombineString("%s\n\033b%s\033n\n%s\n\033b%s\033n %s",
311 _(MSG_REQU_DELETE_FILE_S
), obj
->file
, _(MSG_REQU_DELETE_FILE_M
), obj
->spath
, _(MSG_REQU_DELETE_FILE_E
) );
313 else if (obj
->type
== 1)
315 string
= CombineString("%s\n\033b%s\033n\n%s\n\033b%s\033n %s",
316 _(MSG_REQU_FILEUNPROTECT_S
), obj
->file
, _(MSG_REQU_FILEUNPROTECT_M
), obj
->spath
, _(MSG_REQU_FILEUNPROTECT_E
) );
318 else if (obj
->type
== 2)
320 string
= CombineString("%s\n\033b%s\033n\n%s\n\033b%s\033n %s",
321 _(MSG_REQU_OVERWRITE_S
), obj
->file
, _(MSG_REQU_OVERWRITE_M
), obj
->spath
, _(MSG_REQU_OVERWRITE_E
) );
325 string
= CombineString("%s\n\033b%s\033n\n%s\n\033b%s\033n%s",
326 _(MSG_NOFILEACCESS_S
), obj
->file
, _(MSG_NOFILEACCESS_M
), obj
->spath
, _(MSG_NOFILEACCESS_E
) );
331 if (obj
->type
== 0) string
= CombineString("%s \033b%s\033n %s", _(MSG_REQU_DELETE_DRAWER_S
), obj
->spath
, _(MSG_REQU_DELETE_DRAWER_E
) );
332 else if (obj
->type
== 1) string
= CombineString("%s\n\033b%s\033n %s", _(MSG_REQU_PROTECTION_UNPROTECTDRAWER_S
), obj
->spath
, _(MSG_REQU_PROTECTION_UNPROTECTDRAWER_E
) );
333 else if (obj
->type
== 3) string
= CombineString("%s\n\033b%s %s", _(MSG_NODRAWERACCESS_S
), obj
->spath
, _(MSG_NODRAWERACCESS_E
) );
338 if (obj
->type
== 0) ret
= AskChoiceCentered( _(MSG_REQU_DELETE
), string
, _(MSG_REQU_DELETE_YESNO
), 0);
339 else if (obj
->type
== 1) ret
= AskChoiceCentered( _(MSG_REQU_PROTECTION
), string
, _(MSG_REQU_PROTECTION_UNPROTECT
), 0);
340 else if (obj
->type
== 2) ret
= AskChoiceCentered( _(MSG_REQU_OVERWRITE
), string
, _(MSG_REQU_OVERWRITE_YESNO
), 0);
341 else ret
= AskChoiceCentered( _(MSG_REQU_OVERWRITE
), string
, _(MSG_REQU_OVERWRITE_SKIPABORT
), 0);
342 freeString(NULL
, string
);
345 if (ret
== 0) back
= DELMODE_NONE
;
346 else if (ret
== 1) back
= DELMODE_DELETE
;
347 else if (ret
== 2) back
= DELMODE_ALL
;
348 else if (ret
== 3) back
= DELMODE_NO
;
355 MakeStaticHook(Hook_AskDeleteFunc
,Wanderer__HookFunc_AskDeleteFunc
);
359 ///Wanderer__Func_CopyDropEntries()
360 AROS_UFH3(void, Wanderer__Func_CopyDropEntries
,
361 AROS_UFHA(STRPTR
, argPtr
, A0
),
362 AROS_UFHA(ULONG
, argSize
, D0
),
363 AROS_UFHA(struct ExecBase
*, SysBase
, A6
))
367 struct IconList_Drop_Event
*copyFunc_DropEvent
= FindTask(NULL
)->tc_UserData
;
369 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
371 if (copyFunc_DropEvent
)
373 struct MUIDisplayObjects dobjects
;
374 struct IconList_Drop_SourceEntry
*currententry
;
376 struct Hook displayCopyHook
;
377 struct Hook displayDelHook
;
378 displayCopyHook
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_DisplayCopyFunc
;
379 displayDelHook
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_AskDeleteFunc
;
381 struct Hook
*displayCopyHook
;
382 struct Hook
*displayDelHook
;
383 displayCopyHook
= &Hook_DisplayCopyFunc
;
384 displayDelHook
= &Hook_AskDeleteFunc
;
387 if (CreateCopyDisplay(ACTION_COPY
, &dobjects
))
389 while ((currententry
= (struct IconList_Drop_SourceEntry
*)RemTail(©Func_DropEvent
->drop_SourceList
)) != NULL
)
391 D(bug("[Wanderer] %s: Copying '%s' to '%s'\n", __PRETTY_FUNCTION__
, currententry
->dropse_Node
.ln_Name
, copyFunc_DropEvent
->drop_TargetPath
));
394 currententry
->dropse_Node
.ln_Name
, copyFunc_DropEvent
->drop_TargetPath
,
395 TRUE
, ACTION_COPY
, &displayCopyHook
, &displayDelHook
, (APTR
) &dobjects
);
397 FreeVec(currententry
->dropse_Node
.ln_Name
);
398 FreeMem(currententry
, sizeof(struct IconList_Drop_SourceEntry
));
400 /* delete copy window */
401 DisposeCopyDisplay(&dobjects
);
404 if (copyFunc_DropEvent
->drop_TargetPath
) FreeVec(copyFunc_DropEvent
->drop_TargetPath
);
405 FreeMem(copyFunc_DropEvent
, sizeof(struct IconList_Drop_Event
));
413 ///Wanderer__HookFunc_ActionFunc()
417 void, Wanderer__HookFunc_ActionFunc
,
418 AROS_UFHA(struct Hook
*, hook
, A0
),
419 AROS_UFHA(Object
*, obj
, A2
),
420 AROS_UFHA(struct IconWindow_ActionMsg
*, msg
, A1
)
424 HOOKPROTO(Wanderer__HookFunc_ActionFunc
, void, Object
*obj
, struct IconWindow_ActionMsg
*msg
)
429 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
431 if (msg
->type
== ICONWINDOW_ACTION_OPEN
)
433 static unsigned char buf
[1024];
435 struct IconList_Entry
*ent
= (void*)MUIV_IconList_NextIcon_Start
;
437 DoMethod(msg
->iconlist
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&ent
);
438 if ((IPTR
)ent
== (IPTR
)MUIV_IconList_NextIcon_End
)
440 D(bug("[Wanderer] %s: ICONWINDOW_ACTION_OPEN: NextIcon returned MUIV_IconList_NextIcon_TAG_DONE)\n", __PRETTY_FUNCTION__
));
444 offset
= strlen(ent
->ile_IconEntry
->ie_IconNode
.ln_Name
) - 5;
446 if ((msg
->isroot
) && (ent
->type
== ST_ROOT
))
448 strcpy((STRPTR
)buf
, ent
->label
);
452 strcpy((STRPTR
)buf
, ent
->ile_IconEntry
->ie_IconNode
.ln_Name
);
455 D(bug("[Wanderer] %s: ICONWINDOW_ACTION_OPEN: offset = %d, buf = %s\n", __PRETTY_FUNCTION__
, offset
, buf
));
457 if ((ent
->type
== ST_ROOT
) || (ent
->type
== ST_USERDIR
) || (ent
->type
== ST_LINKDIR
))
459 Object
*cstate
= (Object
*)(((struct List
*)XGET(_app(obj
), MUIA_Application_WindowList
))->lh_Head
);
460 Object
*prefs
= (Object
*) XGET(_app(obj
), MUIA_Wanderer_Prefs
);
463 /* open new window if root or classic navigation set */
464 if ( (msg
->isroot
) || (XGET(prefs
, MUIA_IconWindow_WindowNavigationMethod
) == WPD_NAVIGATION_CLASSIC
) )
466 while ((child
= NextObject(&cstate
)))
468 if (XGET(child
, MUIA_UserData
))
470 STRPTR child_drawer
= (STRPTR
)XGET(child
, MUIA_IconWindow_Location
);
471 if (child_drawer
&& !Stricmp(buf
,(CONST_STRPTR
)child_drawer
))
473 BOOL is_open
= ( BOOL
)XGET(child
, MUIA_Window_Open
);
477 DoMethod(child
, MUIM_IconWindow_Open
);
481 DoMethod(child
, MUIM_Window_ToFront
);
482 SET(child
, MUIA_Window_Activate
, TRUE
);
489 /* Check if the window for this drawer is already opened */
490 DoMethod(_WandererIntern_AppObj
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) buf
);
491 // FIXME: error handling
495 /* open drawer in same window */
496 SET(obj
, MUIA_IconWindow_Location
, (IPTR
) buf
);
499 else if ((ent
->type
== ST_FILE
) || (ent
->type
== ST_LINKFILE
))
501 BPTR newwd
, oldwd
, file
;
503 /* Set the CurrentDir to the path of the executable to be started */
504 file
= Lock(ent
->ile_IconEntry
->ie_IconNode
.ln_Name
, SHARED_LOCK
);
507 newwd
= ParentDir(file
);
508 oldwd
= CurrentDir(newwd
);
510 if (!OpenWorkbenchObject(ent
->ile_IconEntry
->ie_IconNode
.ln_Name
, TAG_DONE
))
512 execute_open_with_command(newwd
, FilePart(ent
->ile_IconEntry
->ie_IconNode
.ln_Name
));
521 else if (msg
->type
== ICONWINDOW_ACTION_DIRUP
)
523 STRPTR actual_drawer
= (STRPTR
)XGET(obj
, MUIA_IconWindow_Location
);
524 STRPTR parent_drawer
= strrchr(actual_drawer
,'/');
525 STRPTR root_drawer
= strrchr(actual_drawer
,':');
527 /* check if dir is not drive root dir */
528 if ( strlen(root_drawer
) > 1 )
530 /* check if second or third level directory*/
533 (*(root_drawer
+1)) = 0;
534 SET(obj
, MUIA_IconWindow_Location
, actual_drawer
);
539 (*parent_drawer
) = 0;
540 SET(obj
, MUIA_IconWindow_Location
, actual_drawer
);
545 else if (msg
->type
== ICONWINDOW_ACTION_CLICK
)
547 if (!msg
->click
->shift
)
549 Object
*cstate
= (Object
*)(((struct List
*)XGET(_WandererIntern_AppObj
, MUIA_Application_WindowList
))->lh_Head
);
552 while ((child
= NextObject(&cstate
)))
554 if (XGET(child
, MUIA_UserData
))
556 if (child
!= obj
) DoMethod(child
, MUIM_IconWindow_UnselectAll
);
561 else if (msg
->type
== ICONWINDOW_ACTION_ICONDROP
)
563 struct Process
*wandererCopyProcess
;
564 struct IconList_Drop_Event
*dropevent
= (struct IconList_Drop_Event
*)msg
->drop
;
567 wandererCopyProcess
= CreateNewProcTags(
568 NP_Entry
, (IPTR
)Wanderer__Func_CopyDropEntries
,
569 NP_Name
, (IPTR
)wand_copyprocnamestr
,
570 NP_Synchronous
, FALSE
,
571 NP_UserData
, (IPTR
)dropevent
,
576 else if (msg
->type
== ICONWINDOW_ACTION_APPWINDOWDROP
)
578 struct Screen
*wscreen
= NULL
;
581 /* get wanderers screen struct and the layer located at cursor position afterwards */
582 get( obj
, MUIA_Window_Screen
, &wscreen
);
583 layer
= WhichLayer(&wscreen
->LayerInfo
,wscreen
->MouseX
,wscreen
->MouseY
);
587 struct Window
*win
= (struct Window
*) layer
->Window
;
593 struct IconList_Entry
*ent
;
597 ent
= (void*)MUIV_IconList_NextIcon_Start
;
598 /* process all selected entries */
601 DoMethod(msg
->iconlist
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
) &ent
);
602 /* if not end of selection, process */
603 if ( (int)ent
!= MUIV_IconList_NextIcon_End
)
605 struct AppW
*a
= AllocVec(sizeof(struct AppW
), MEMF_CLEAR
);
608 a
->name
= AllocVec(strlen(ent
->ile_IconEntry
->ie_IconNode
.ln_Name
)+1, MEMF_CLEAR
);
612 strcpy(a
->name
, ent
->ile_IconEntry
->ie_IconNode
.ln_Name
);
613 AddTail(&AppList
, (struct Node
*) a
);
624 while ( ((int)ent
!= MUIV_IconList_NextIcon_End
) && !fail
);
626 if (!fail
&& (files
> 0))
628 STRPTR
*filelist
= AllocVec(sizeof(STRPTR
) * files
, MEMF_CLEAR
);
629 if (filelist
!= NULL
)
631 STRPTR
*flist
= filelist
;
632 if (!IsListEmpty(&AppList
))
635 struct Node
*s
= AppList
.lh_Head
;
636 while (((succ
= ((struct Node
*) s
)->ln_Succ
) != NULL
) && !fail
)
638 *flist
++ = ((struct AppW
*) s
)->name
;
642 D(bug("[Wanderer] %s: win:%s files:%s mx:%d my:%d\n", __PRETTY_FUNCTION__
,
643 win
->Title
, filelist
,
644 wscreen
->MouseX
- win
->LeftEdge
, wscreen
->MouseY
- win
->TopEdge
);)
646 /* send appwindow msg struct containing selected files to destination */
647 SendAppWindowMessage(win
, files
, (char **)filelist
, 0, wscreen
->MouseX
- win
->LeftEdge
, wscreen
->MouseY
- win
->TopEdge
, 0, 0);
653 if (!IsListEmpty(&AppList
))
656 struct Node
*s
= AppList
.lh_Head
;
657 while (((succ
= ((struct Node
*) s
)->ln_Succ
) != NULL
))
659 if ( ((struct AppW
*) s
)->name
!= NULL
)
660 FreeVec(((struct AppW
*) s
)->name
);
673 MakeStaticHook(Hook_ActionFunc
,Wanderer__HookFunc_ActionFunc
);
677 ///Wanderer__HookFunc_StandardFunc()
681 void, Wanderer__HookFunc_StandardFunc
,
682 AROS_UFHA(struct Hook
*, hook
, A0
),
683 AROS_UFHA(void *, dummy
, A2
),
684 AROS_UFHA(void **, funcptr
, A1
)
688 HOOKPROTO(Wanderer__HookFunc_StandardFunc
, void, void *dummy
, void **funcptr
)
693 void (*func
) (ULONG
*) = (void (*)(ULONG
*)) (*funcptr
);
694 if (func
) func((ULONG
*)(funcptr
+ 1));
699 MakeStaticHook(Hook_StandardFunc
,Wanderer__HookFunc_StandardFunc
);
703 ///Wanderer__HookFunc_BackdropFunc()
707 void, Wanderer__HookFunc_BackdropFunc
,
708 AROS_UFHA(struct Hook
*, hook
, A0
),
709 AROS_UFHA(void *, dummy
, A2
),
710 AROS_UFHA(void **, funcptr
, A1
)
714 HOOKPROTO(Wanderer__HookFunc_BackdropFunc
, void, void *dummy
, void **funcptr
)
719 struct Wanderer_DATA
*data
= INST_DATA(_WandererIntern_CLASS
, _WandererIntern_AppObj
);
720 BOOL wb_iscurrentlybd
;
722 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
724 D(bug("[Wanderer] %s: Private data @ %x\n", __PRETTY_FUNCTION__
, data
));
726 if (!data
->wd_WorkbenchWindow
)
728 D(bug("[Wanderer] %s: No Workbench Window\n", __PRETTY_FUNCTION__
));
732 wb_iscurrentlybd
= (BOOL
)XGET(data
->wd_WorkbenchWindow
, MUIA_IconWindow_IsBackdrop
);
734 if (wb_iscurrentlybd
!= data
->wd_Option_BackDropMode
)
736 BOOL isOpen
= (BOOL
)XGET(data
->wd_WorkbenchWindow
, MUIA_Window_Open
);
737 Object
*win_Active
= NULL
;
739 D(bug("[Wanderer] %s: Backdrop mode change requested!\n", __PRETTY_FUNCTION__
));
740 D(bug("[Wanderer] %s: Disposing of existing Workbench window Obj ..\n", __PRETTY_FUNCTION__
));
742 SET(data
->wd_WorkbenchWindow
, MUIA_Window_Open
, FALSE
);
744 if (data
->wd_WorkbenchWindow
== data
->wd_ActiveWindow
)
746 data
->wd_ActiveWindow
= NULL
;
750 win_Active
= data
->wd_ActiveWindow
;
753 /* Kill our close request notification .. */
756 data
->wd_WorkbenchWindow
, MUIM_KillNotify
, MUIA_Window_CloseRequest
759 /* .. And dispose of the window */
760 DoMethod(_WandererIntern_AppObj
, OM_REMMEMBER
, data
->wd_WorkbenchWindow
);
761 MUI_DisposeObject(data
->wd_WorkbenchWindow
);
762 data
->wd_WorkbenchWindow
= NULL
;
765 if (data
->wd_Option_BackDropMode
)
767 D(bug("[Wanderer] %s: Creating new Workbench window Obj (BACKDROP MODE)..\n", __PRETTY_FUNCTION__
));
771 D(bug("[Wanderer] %s: Creating new Workbench window Obj (NORMAL MODE)..\n", __PRETTY_FUNCTION__
));
774 data
->wd_WorkbenchWindow
= (Object
*) DoMethod
776 _WandererIntern_AppObj
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) NULL
779 if ((data
->wd_WorkbenchWindow
) && (isOpen
))
781 D(bug("[Wanderer] %s: Making Workbench window visable..\n", __PRETTY_FUNCTION__
));
782 DoMethod(data
->wd_WorkbenchWindow
, MUIM_IconWindow_Open
);
783 DoMethod(data
->wd_WorkbenchWindow
, MUIM_Window_ToBack
);
788 SET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
, win_Active
);
790 else if (data
->wd_WorkbenchWindow
)
792 SET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
, data
->wd_WorkbenchWindow
);
798 MakeStaticHook(Hook_BackdropFunc
,Wanderer__HookFunc_BackdropFunc
);
801 /******** code from workbench/c/Info.c *******************/
803 static void fmtlarge(UBYTE
*buf
, ULONG num
)
817 if (num
>= 0x40000000)
819 array
.val
= num
>> 30;
820 d
= ((UQUAD
)num
* 10 + 0x20000000) / 0x40000000;
825 else if (num
>= 0x100000)
827 array
.val
= num
>> 20;
828 d
= ((UQUAD
)num
* 10 + 0x80000) / 0x100000;
833 else if (num
>= 0x400)
835 array
.val
= num
>> 10;
836 d
= (num
* 10 + 0x200) / 0x400;
850 if (!array
.dec
&& (d
> array
.val
* 10))
855 RawDoFmt(array
.dec
? "%lu.%lu" : "%lu", &array
, NULL
, buf
);
856 while (*buf
) { buf
++; }
863 STRPTR
GetScreenTitle(VOID
)
865 static TEXT title
[256];
866 UBYTE chip
[10], fast
[10];
869 __availMem
= AvailMem(MEMF_CHIP
);
870 fmtlarge(chip
, __availMem
);
871 __availMem
= AvailMem(MEMF_FAST
);
872 fmtlarge(fast
, __availMem
);
874 sprintf(title
, _(MSG_SCREENTITLE
), chip
, fast
);
880 ///GetUserScreenTitle()
881 STRPTR
GetUserScreenTitle(Object
*self
)
883 /*Work in progress :-)
885 char *screentitlestr
;
888 GET(self
, MUIA_IconWindowExt_ScreenTitle_String
, &screentitlestr
);
890 screentitleleng
= strlen(screentitlestr
);
892 if (screentitleleng
<1)
894 return GetScreenTitle();
896 return screentitlestr
;
904 MEN_WANDERER_BACKDROP
,
905 MEN_WANDERER_EXECUTE
,
907 MEN_WANDERER_AROS_GUISETTINGS
,
908 MEN_WANDERER_AROS_ABOUT
,
911 MEN_WANDERER_SHUTDOWN
,
913 MEN_WINDOW_NEW_DRAWER
,
914 MEN_WINDOW_OPEN_PARENT
,
924 MEN_WINDOW_VIEW_ICON
,
925 MEN_WINDOW_VIEW_DETAIL
,
927 MEN_WINDOW_VIEW_HIDDEN
,
929 MEN_WINDOW_SORT_ENABLE
,
931 MEN_WINDOW_SORT_NAME
,
932 MEN_WINDOW_SORT_TYPE
,
933 MEN_WINDOW_SORT_DATE
,
934 MEN_WINDOW_SORT_SIZE
,
935 MEN_WINDOW_SORT_REVERSE
,
936 MEN_WINDOW_SORT_TOPDRAWERS
,
937 MEN_WINDOW_SORT_GROUP
,
941 MEN_ICON_INFORMATION
,
952 ///execute_open_with_command()
953 /**************************************************************************
954 Open the execute window. Similar to below but you can also set the
955 command. Called when item is openend
956 **************************************************************************/
957 void execute_open_with_command(BPTR cd
, STRPTR contents
)
961 if (cd
!=(BPTR
) NULL
) lock
= cd
;
962 else lock
= Lock("RAM:", ACCESS_READ
);
966 "WANDERER:Tools/ExecuteCommand",
967 WBOPENA_ArgLock
, (IPTR
) lock
,
968 WBOPENA_ArgName
, (IPTR
) contents
,
972 if (cd
==(BPTR
) NULL
) UnLock(lock
);
976 ///wanderer_menufunc_wanderer_execute()
977 /**************************************************************************
978 Open the execute window
980 This function will always get the current drawer as argument
981 **************************************************************************/
982 VOID
wanderer_menufunc_wanderer_execute(STRPTR
*cdptr
)
984 //TODO: remove the STRPTR *cdptr from top
985 //TODO:remove this commented out stuff
987 //if (cdptr != NULL) lock = Lock(*cdptr, SHARED_LOCK);
988 Object
*win
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
989 STRPTR dr
= ( STRPTR
)XGET( win
, MUIA_IconWindow_Location
);
990 BPTR cd
= Lock(dr
,SHARED_LOCK
);
991 execute_open_with_command(cd
, NULL
);
994 /*******************************/
997 ///wanderer_menufunc_wanderer_shell()
998 void wanderer_menufunc_wanderer_shell(STRPTR
*cd_ptr
)
1000 //TODO: remove the STRPTR *cdptr from top
1001 //TODO:remove this commented out stuff
1002 //BPTR cd = Lock(*cd_ptr,ACCESS_READ);
1003 Object
*win
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1004 STRPTR dr
= ( STRPTR
)XGET( win
, MUIA_IconWindow_Location
);
1012 cd
= Lock(dr
, ACCESS_READ
);
1013 if (SystemTags("NewShell", NP_CurrentDir
, (IPTR
)cd
, TAG_DONE
) == -1)
1020 ///wanderer_menufunc_wanderer_backdrop()
1021 void wanderer_menufunc_wanderer_backdrop(Object
**pstrip
)
1023 struct Wanderer_DATA
*data
= INST_DATA(_WandererIntern_CLASS
, _WandererIntern_AppObj
);
1024 Object
*strip
= *pstrip
;
1025 Object
*item
= FindMenuitem(strip
, MEN_WANDERER_BACKDROP
);
1027 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1031 data
->wd_Option_BackDropMode
= (BOOL
)XGET(item
, MUIA_Menuitem_Checked
);
1032 SET(data
->wd_WorkbenchWindow
, MUIA_IconWindow_IsBackdrop
, data
->wd_Option_BackDropMode
);
1037 ///wanderer_menufunc_window_newdrawer()
1038 void wanderer_menufunc_window_newdrawer(STRPTR
*cdptr
)
1040 //TODO: remove the STRPTR *cdptr from top
1042 Object
*win
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1043 STRPTR dr
= ( STRPTR
)XGET( win
, MUIA_IconWindow_Location
);
1044 Object
*actwindow
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1045 Object
*wbwindow
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_WorkbenchWindow
);
1048 D(bug("[Wanderer]: %s('%s')\n", __PRETTY_FUNCTION__
, dr
));
1050 if (actwindow
== wbwindow
)
1052 /* This check is necessary because WorkbenchWindow has path RAM: */
1053 D(bug("[Wanderer] %s: Can't call WBNewDrawer for WorkbenchWindow\n", __PRETTY_FUNCTION__
));
1056 if ( XGET(actwindow
, MUIA_Window_Open
) == FALSE
)
1058 D(bug("[Wanderer] %s: Can't call WBNewDrawer: the active window isn't open\n", __PRETTY_FUNCTION__
));
1062 lock
= Lock(dr
, ACCESS_READ
);
1065 "WANDERER:Tools/WBNewDrawer",
1066 WBOPENA_ArgLock
, (IPTR
) lock
,
1074 ///wanderer_menufunc_window_openparent()
1075 void wanderer_menufunc_window_openparent(STRPTR
*cdptr
)
1077 //TODO: Remove the **cdptr stuff from top
1078 Object
*win
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1079 STRPTR dr
= ( STRPTR
)XGET( win
, MUIA_IconWindow_Location
);
1082 STRPTR last_letter
=NULL
;
1087 BOOL foundSlash
, foundColon
;
1090 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1092 last_letter
= &dr
[ strlen(dr
) - 1 ];
1094 thispath
= FilePart(dr
);
1096 if (*last_letter
==0x3a) return; /* Top Drawer has no parent to open */
1098 last_letter
= &thispath
[strlen(thispath
)-1];
1100 if (*last_letter
==0x3a)
1101 path_len
= (IPTR
)(thispath
-(IPTR
)(dr
));
1103 path_len
= (IPTR
)((thispath
-(IPTR
)(dr
))-1);
1105 buf
= AllocVec((path_len
+1),MEMF_PUBLIC
|MEMF_CLEAR
);
1106 CopyMem(dr
, buf
, path_len
);
1108 cstate
= (Object
*)(((struct List
*)XGET(_WandererIntern_AppObj
, MUIA_Application_WindowList
))->lh_Head
);
1110 // Make sure we have a correct path
1111 foundSlash
= FALSE
, foundColon
= FALSE
;
1112 i
= 0; for ( ; i
< path_len
; i
++ )
1114 if ( buf
[ i
] == '/' ) foundSlash
= TRUE
;
1115 if ( buf
[ i
] == ':' ) foundColon
= TRUE
;
1117 if ( !foundColon
&& !foundSlash
)
1119 STRPTR newbuf
= AllocVec ((path_len
+ 2), MEMF_PUBLIC
|MEMF_CLEAR
);
1120 sprintf(newbuf
,"%s:",buf
);
1124 // Done with path correction check
1126 while ((child
= NextObject(&cstate
)))
1128 if (XGET(child
, MUIA_UserData
))
1130 STRPTR child_drawer
= (STRPTR
)XGET(child
, MUIA_IconWindow_Location
);
1131 if (child_drawer
&& !Stricmp(buf
,child_drawer
))
1133 int is_open
= XGET(child
, MUIA_Window_Open
);
1135 DoMethod(child
, MUIM_IconWindow_Open
);
1138 DoMethod(child
, MUIM_Window_ToFront
);
1139 SET(child
, MUIA_Window_Activate
, TRUE
);
1147 DoMethod(_WandererIntern_AppObj
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) buf
);
1152 ///wanderer_menufunc_window_close()
1153 void wanderer_menufunc_window_close()
1155 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1157 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1159 SET(window
, MUIA_Window_CloseRequest
, TRUE
);
1163 ///wanderer_menufunc_window_update()
1164 void wanderer_menufunc_window_update()
1166 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1167 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1169 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1171 if (iconList
!= NULL
)
1173 DoMethod(iconList
, MUIM_IconList_Update
);
1178 ///wanderer_menufunc_window_clear()
1179 void wanderer_menufunc_window_clear()
1181 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1182 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1184 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1186 if (iconList
!= NULL
)
1188 DoMethod(iconList
, MUIM_IconList_UnselectAll
);
1193 ///wanderer_menufunc_window_select()
1194 void wanderer_menufunc_window_select()
1196 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1197 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1199 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1201 if (iconList
!= NULL
)
1203 DoMethod(iconList
, MUIM_IconList_SelectAll
);
1208 ///wanderer_menufunc_window_snapshot()
1209 void wanderer_menufunc_window_snapshot(IPTR
*flags
)
1211 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1212 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1213 char *dir_name
= (char *)XGET(window
, MUIA_IconWindow_Location
);
1214 struct DiskObject
*drawericon
= NULL
;
1215 IPTR geticon_error
= 0;
1216 IPTR display_bits
= 0, sort_bits
= 0;
1217 BOOL snapshot_all
= *flags
;
1219 D(bug("[Wanderer]: %s('%s')\n", __PRETTY_FUNCTION__
, dir_name
));
1221 if (snapshot_all
== TRUE
)
1223 struct IconList_Entry
*icon_entry
= (IPTR
)MUIV_IconList_NextIcon_Start
;
1224 struct IconEntry
*node
= NULL
;
1225 struct TagItem icon_tags
[] =
1227 { ICONPUTA_OnlyUpdatePosition
, TRUE
},
1230 D(bug("[Wanderer] %s: snapshot ALL\n", __PRETTY_FUNCTION__
));
1234 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Visible
, (IPTR
)&icon_entry
);
1236 if ((IPTR
)icon_entry
!= MUIV_IconList_NextIcon_End
)
1238 node
= (struct IconEntry
*)((IPTR
)icon_entry
- ((IPTR
)&node
->ie_IconListEntry
- (IPTR
)node
));
1239 D(bug("[Wanderer] %s: SNAPSHOT entry = '%s' @ %p, (%p)\n", __PRETTY_FUNCTION__
, icon_entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, icon_entry
, node
));
1240 if (node
->ie_DiskObj
)
1242 node
->ie_DiskObj
->do_CurrentX
= node
->ie_IconX
;
1243 node
->ie_DiskObj
->do_CurrentY
= node
->ie_IconY
;
1244 PutIconTagList(icon_entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, node
->ie_DiskObj
, icon_tags
);
1248 D(bug("[Wanderer] %s: icon has no diskobj!\n", __PRETTY_FUNCTION__
));
1259 D(bug("[Wanderer] %s: snapshot WINDOW\n", __PRETTY_FUNCTION__
));
1262 drawericon
= GetIconTags(dir_name
,
1263 ICONGETA_FailIfUnavailable
, FALSE
,
1264 ICONA_ErrorCode
, &geticon_error
,
1267 if (drawericon
!= NULL
)
1269 if (drawericon
->do_DrawerData
== NULL
)
1271 D(bug("[Wanderer] %s: Icon for '%s' has no DRAWER data!\n", __PRETTY_FUNCTION__
, dir_name
));
1272 drawericon
->do_DrawerData
= AllocMem(sizeof(struct DrawerData
), MEMF_CLEAR
|MEMF_PUBLIC
);
1275 drawericon
->do_Gadget
.UserData
= (APTR
)1;
1277 drawericon
->do_DrawerData
->dd_NewWindow
.TopEdge
= XGET(window
, MUIA_Window_TopEdge
);
1278 drawericon
->do_DrawerData
->dd_NewWindow
.LeftEdge
= XGET(window
, MUIA_Window_LeftEdge
);
1279 drawericon
->do_DrawerData
->dd_NewWindow
.Width
= XGET(window
, MUIA_Window_Width
);
1280 drawericon
->do_DrawerData
->dd_NewWindow
.Height
= XGET(window
, MUIA_Window_Height
);
1282 GET(iconList
, MUIA_IconList_DisplayFlags
, &display_bits
);
1283 if (display_bits
& ICONLIST_DISP_SHOWINFO
)
1285 D(bug("[Wanderer] %s: ICONLIST_DISP_SHOWINFO\n", __PRETTY_FUNCTION__
));
1286 drawericon
->do_DrawerData
->dd_Flags
= 1;
1290 drawericon
->do_DrawerData
->dd_Flags
= 2;
1293 #warning "TODO: Icon sort flags are only really for text list mode ... fix"
1294 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1295 if (sort_bits
& ICONLIST_SORT_BY_DATE
)
1297 drawericon
->do_DrawerData
->dd_ViewModes
= 3;
1299 else if (sort_bits
& ICONLIST_SORT_BY_SIZE
)
1301 drawericon
->do_DrawerData
->dd_ViewModes
= 4;
1305 drawericon
->do_DrawerData
->dd_ViewModes
= 2;
1307 PutDiskObject(dir_name
, drawericon
);
1312 ///wanderer_menufunc_window_view_icons(Object **pstrip)
1313 void wanderer_menufunc_window_view_icons(Object
**pstrip
)
1315 Object
*strip
= *pstrip
;
1316 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_VIEW_ALL
);
1317 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1318 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1320 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1322 if ((item
!= NULL
) && (iconList
!= NULL
))
1324 IPTR display_bits
= 0, menu_view_state
= 0;
1325 GET(iconList
, MUIA_IconList_DisplayFlags
, &display_bits
);
1327 GET(item
, MUIA_Menuitem_Checked
, &menu_view_state
);
1329 if (menu_view_state
)
1331 display_bits
&= ~ICONLIST_DISP_SHOWINFO
;
1335 display_bits
|= ICONLIST_DISP_SHOWINFO
;
1338 SET(iconList
, MUIA_IconList_DisplayFlags
, display_bits
);
1339 DoMethod(iconList
, MUIM_IconList_Sort
);
1344 ///wanderer_menufunc_window_view_hidden(Object **pstrip)
1345 void wanderer_menufunc_window_view_hidden(Object
**pstrip
)
1347 Object
*strip
= *pstrip
;
1348 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_VIEW_HIDDEN
);
1349 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1350 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1352 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1354 if ((item
!= NULL
) && (iconList
!= NULL
))
1356 IPTR display_bits
= 0, menu_view_state
= 0;
1357 GET(iconList
, MUIA_IconList_DisplayFlags
, &display_bits
);
1359 GET(item
, MUIA_Menuitem_Checked
, &menu_view_state
);
1361 if (menu_view_state
)
1363 display_bits
|= ICONLIST_DISP_SHOWHIDDEN
;
1367 display_bits
&= ~ICONLIST_DISP_SHOWHIDDEN
;
1370 SET(iconList
, MUIA_IconList_DisplayFlags
, display_bits
);
1371 DoMethod(iconList
, MUIM_IconList_Sort
);
1375 ///wanderer_menufunc_window_sort_enable()
1376 void wanderer_menufunc_window_sort_enable(Object
**pstrip
)
1378 Object
*strip
= *pstrip
;
1379 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_ENABLE
);
1380 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1381 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1383 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1387 if (!XGET(item
, MUIA_Disabled
) && (iconList
!= NULL
))
1391 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1393 sort_bits
&= ~(ICONLIST_SORT_MASK
|ICONLIST_SORT_REVERSE
);
1394 sort_bits
|= ICONLIST_SORT_DRAWERS_MIXED
;
1396 if( XGET(item
, MUIA_Menuitem_Checked
) )
1398 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_DATE
)) != NULL
)
1400 NNSET(item
, MUIA_Disabled
, FALSE
);
1401 if( XGET(item
, MUIA_Menuitem_Checked
) )
1403 sort_bits
|= ICONLIST_SORT_BY_DATE
;
1406 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_SIZE
)) != NULL
)
1408 NNSET(item
, MUIA_Disabled
, FALSE
);
1409 if( XGET(item
, MUIA_Menuitem_Checked
) )
1411 sort_bits
|= ICONLIST_SORT_BY_SIZE
;
1414 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_TYPE
)) != NULL
)
1416 NNSET(item
, MUIA_Disabled
, FALSE
);
1417 if( XGET(item
, MUIA_Menuitem_Checked
) )
1419 sort_bits
|= ICONLIST_SORT_MASK
;
1422 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_NAME
)) != NULL
)
1424 NNSET(item
, MUIA_Disabled
, FALSE
);
1425 if( XGET(item
, MUIA_Menuitem_Checked
) )
1427 sort_bits
|= ICONLIST_SORT_BY_NAME
;
1430 if ((sort_bits
& ICONLIST_SORT_MASK
) == 0)
1432 NNSET(item
, MUIA_Menuitem_Checked
, TRUE
);
1433 sort_bits
|= ICONLIST_SORT_BY_NAME
;
1436 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_REVERSE
)) != NULL
)
1438 NNSET(item
, MUIA_Disabled
, FALSE
);
1439 if( XGET(item
, MUIA_Menuitem_Checked
) )
1441 sort_bits
|= ICONLIST_SORT_REVERSE
;
1444 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_TOPDRAWERS
)) != NULL
)
1446 NNSET(item
, MUIA_Disabled
, FALSE
);
1447 if( XGET(item
, MUIA_Menuitem_Checked
) )
1449 sort_bits
&= ~ICONLIST_SORT_DRAWERS_MIXED
;
1452 D(bug("[Wanderer] %s: (enable) Setting sort flags %08x\n", __PRETTY_FUNCTION__
, sort_bits
));
1456 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_DATE
)) != NULL
)
1458 NNSET(item
, MUIA_Disabled
, TRUE
);
1460 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_SIZE
)) != NULL
)
1462 NNSET(item
, MUIA_Disabled
, TRUE
);
1464 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_TYPE
)) != NULL
)
1466 NNSET(item
, MUIA_Disabled
, TRUE
);
1468 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_NAME
)) != NULL
)
1470 NNSET(item
, MUIA_Disabled
, TRUE
);
1472 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_REVERSE
)) != NULL
)
1474 NNSET(item
, MUIA_Disabled
, TRUE
);
1476 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_TOPDRAWERS
)) != NULL
)
1478 NNSET(item
, MUIA_Disabled
, TRUE
);
1480 D(bug("[Wanderer] %s: (disable) Setting sort flags %08x\n", __PRETTY_FUNCTION__
, sort_bits
));
1483 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1484 DoMethod(iconList
, MUIM_IconList_Sort
);
1490 ///wanderer_menufunc_window_sort_name()
1491 void wanderer_menufunc_window_sort_name(Object
**pstrip
)
1493 Object
*strip
= *pstrip
;
1494 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_NAME
);
1495 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1496 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1498 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1500 if (item
!= NULL
&& iconList
!= NULL
)
1502 IPTR sort_bits
= 0, checked
= FALSE
;
1503 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1504 GET(item
, MUIA_Menuitem_Checked
, &checked
);
1506 /*name = date and size bit both NOT set*/
1507 sort_bits
&= ~ICONLIST_SORT_MASK
;
1508 if (checked
== TRUE
)
1510 sort_bits
|= ICONLIST_SORT_BY_NAME
;
1512 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1513 DoMethod(iconList
, MUIM_IconList_Sort
);
1518 ///wanderer_menufunc_window_sort_date()
1519 void wanderer_menufunc_window_sort_date(Object
**pstrip
)
1521 Object
*strip
= *pstrip
;
1522 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_DATE
);
1523 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1524 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1526 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1528 if (item
!= NULL
&& iconList
!= NULL
)
1530 IPTR sort_bits
= 0, checked
= FALSE
;
1531 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1532 GET(item
, MUIA_Menuitem_Checked
, &checked
);
1534 /*exclude size bit*/
1535 sort_bits
&= ~ICONLIST_SORT_MASK
;
1536 if (checked
== TRUE
)
1538 sort_bits
|= ICONLIST_SORT_BY_DATE
;
1540 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1541 DoMethod(iconList
, MUIM_IconList_Sort
);
1546 ///wanderer_menufunc_window_sort_size()
1547 void wanderer_menufunc_window_sort_size(Object
**pstrip
)
1549 Object
*strip
= *pstrip
;
1550 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_SIZE
);
1551 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1552 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1554 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1556 if (item
!= NULL
&& iconList
!= NULL
)
1558 IPTR sort_bits
= 0, checked
= FALSE
;
1559 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1560 GET(item
, MUIA_Menuitem_Checked
, &checked
);
1562 D(bug("[Wanderer]: %s: (start) sort flags %08x\n", __PRETTY_FUNCTION__
, sort_bits
));
1563 /*exclude date bit*/
1564 sort_bits
&= ~ICONLIST_SORT_MASK
;
1566 if (checked
== TRUE
)
1568 sort_bits
|= ICONLIST_SORT_BY_SIZE
;
1570 D(bug("[Wanderer]: %s: (end) sort flags %08x\n", __PRETTY_FUNCTION__
, sort_bits
));
1571 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1572 DoMethod(iconList
, MUIM_IconList_Sort
);
1577 ///wanderer_menufunc_window_sort_type()
1578 void wanderer_menufunc_window_sort_type(Object
**pstrip
)
1580 Object
*strip
= *pstrip
;
1581 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_TYPE
);
1582 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1583 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1585 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1587 if (item
!= NULL
&& iconList
!= NULL
)
1589 IPTR sort_bits
= 0, checked
= FALSE
;
1590 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1591 GET(item
, MUIA_Menuitem_Checked
, &checked
);
1593 /*type = all sort bits set (name+date+size) */
1594 sort_bits
&= ~ICONLIST_SORT_MASK
;
1595 if (checked
== TRUE
)
1597 sort_bits
|= ICONLIST_SORT_MASK
;
1599 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1600 DoMethod(iconList
, MUIM_IconList_Sort
);
1605 ///wanderer_menufunc_window_sort_reverse()
1606 void wanderer_menufunc_window_sort_reverse(Object
**pstrip
)
1608 Object
*strip
= *pstrip
;
1609 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_REVERSE
);
1610 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1611 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1613 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1615 if (item
!= NULL
&& iconList
!= NULL
)
1617 IPTR sort_bits
= 0, checked
= FALSE
;
1618 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1619 GET(item
, MUIA_Menuitem_Checked
, &checked
);
1621 if (checked
== TRUE
)
1623 sort_bits
|= ICONLIST_SORT_REVERSE
;
1627 sort_bits
&= ~ICONLIST_SORT_REVERSE
;
1630 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1631 DoMethod(iconList
, MUIM_IconList_Sort
);
1636 ///wanderer_menufunc_window_sort_topdrawers()
1637 void wanderer_menufunc_window_sort_topdrawers(Object
**pstrip
)
1639 Object
*strip
= *pstrip
;
1640 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_TOPDRAWERS
);
1641 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1642 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1644 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1646 if (item
!= NULL
&& iconList
!= NULL
)
1648 IPTR sort_bits
= 0, checked
= FALSE
;
1649 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1650 GET(item
, MUIA_Menuitem_Checked
, &checked
);
1652 if (checked
== TRUE
)
1654 sort_bits
&= ~ICONLIST_SORT_DRAWERS_MIXED
;
1658 sort_bits
|= ICONLIST_SORT_DRAWERS_MIXED
;
1661 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1662 DoMethod(iconList
, MUIM_IconList_Sort
);
1667 ///wanderer_menufunc_icon_open()
1668 void wanderer_menufunc_icon_open()
1670 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1671 DoMethod(window
, MUIM_IconWindow_DoubleClicked
);
1675 ///wanderer_menufunc_icon_rename()
1676 void wanderer_menufunc_icon_rename(void)
1678 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1679 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1680 struct IconList_Entry
*entry
= (APTR
) MUIV_IconList_NextIcon_Start
;
1684 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
) &entry
);
1686 if ((int)entry
!= MUIV_IconList_NextIcon_End
)
1688 BPTR lock
= Lock(entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, ACCESS_READ
);
1689 BPTR parent
= ParentDir(lock
);
1692 D(bug("[Wanderer] %s: selected = '%s'\n", __PRETTY_FUNCTION__
, entry
->ile_IconEntry
->ie_IconNode
.ln_Name
));
1696 "WANDERER:Tools/WBRename",
1697 WBOPENA_ArgLock
, (IPTR
) parent
,
1698 WBOPENA_ArgName
, (IPTR
) FilePart(entry
->ile_IconEntry
->ie_IconNode
.ln_Name
),
1702 D(bug("[Wanderer] %s: selected = '%s'\n", __PRETTY_FUNCTION__
, entry
->ile_IconEntry
->ie_IconNode
.ln_Name
));
1714 ///wanderer_menufunc_icon_information()
1715 void wanderer_menufunc_icon_information()
1717 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1718 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1719 struct IconList_Entry
*entry
= (IPTR
)MUIV_IconList_NextIcon_Start
;
1723 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&entry
);
1725 if ((IPTR
)entry
!= MUIV_IconList_NextIcon_End
)
1730 D(bug("[Wanderer] %s: selected = '%s'\n", __PRETTY_FUNCTION__
, entry
->ile_IconEntry
->ie_IconNode
.ln_Name
));
1731 lock
= Lock(entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, ACCESS_READ
);
1732 name
= FilePart(entry
->ile_IconEntry
->ie_IconNode
.ln_Name
);
1734 parent
= ParentDir(lock
);
1739 D(bug("[Wanderer] %s: name = '%s' lock = 0x%08lX\n", __PRETTY_FUNCTION__
, name
, lock
));
1740 WBInfo(parent
, name
, NULL
);
1752 ///wanderer_menufunc_icon_snapshot()
1753 void wanderer_menufunc_icon_snapshot(IPTR
*flags
)
1755 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1756 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1757 struct IconList_Entry
*entry
= (IPTR
)MUIV_IconList_NextIcon_Start
;
1758 struct IconEntry
*node
= NULL
;
1759 BOOL snapshot
= *flags
;
1760 struct TagItem icontags
[] =
1762 { ICONPUTA_OnlyUpdatePosition
, TRUE
},
1766 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1770 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&entry
);
1772 if ((IPTR
)entry
!= MUIV_IconList_NextIcon_End
)
1774 node
= (struct IconEntry
*)((IPTR
)entry
- ((IPTR
)&node
->ie_IconListEntry
- (IPTR
)node
));
1775 D(bug("[Wanderer] %s: %s entry = '%s' @ %p, (%p)\n", __PRETTY_FUNCTION__
, (snapshot
) ? "SNAPSHOT" : "UNSNAPSHOT", entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, entry
, node
));
1776 if (node
->ie_DiskObj
)
1780 node
->ie_DiskObj
->do_CurrentX
= node
->ie_IconX
;
1781 node
->ie_DiskObj
->do_CurrentY
= node
->ie_IconY
;
1785 node
->ie_DiskObj
->do_CurrentX
= NO_ICON_POSITION
;
1786 node
->ie_DiskObj
->do_CurrentY
= NO_ICON_POSITION
;
1788 PutIconTagList(entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, node
->ie_DiskObj
, icontags
);
1789 D(bug("[Wanderer] %s: saved ..\n", __PRETTY_FUNCTION__
));
1793 D(bug("[Wanderer] %s: icon has no diskobj!\n", __PRETTY_FUNCTION__
));
1801 D(bug("[Wanderer] %s: finished ..\n", __PRETTY_FUNCTION__
));
1804 ///wanderer_menufunc_icon_leaveout()
1805 void wanderer_menufunc_icon_leaveout(void)
1807 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1808 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1809 struct IconList_Entry
*entry
= (IPTR
)MUIV_IconList_NextIcon_Start
;
1810 struct IconEntry
*node
= NULL
;
1811 char *leavout_dir
= NULL
;
1813 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1815 GET(window
, MUIA_IconWindow_Location
, &leavout_dir
);
1817 if (leavout_dir
!= NULL
)
1819 D(bug("[Wanderer] %s: dir '%s'\n", __PRETTY_FUNCTION__
, leavout_dir
));
1822 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&entry
);
1824 if (((IPTR
)entry
!= MUIV_IconList_NextIcon_End
) && ((entry
->type
== ST_FILE
) || (entry
->type
== ST_USERDIR
)))
1826 node
= (struct IconEntry
*)((IPTR
)entry
- ((IPTR
)&node
->ie_IconListEntry
- (IPTR
)node
));
1827 D(bug("[Wanderer] %s: entry = '%s' @ %p, (%p)\n", __PRETTY_FUNCTION__
, entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, entry
, node
));
1836 D(bug("[Wanderer] %s: finished ..\n", __PRETTY_FUNCTION__
));
1839 ///wanderer_menufunc_icon_putaway()
1840 void wanderer_menufunc_icon_putaway(void)
1842 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1843 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1844 struct IconList_Entry
*entry
= (IPTR
)MUIV_IconList_NextIcon_Start
;
1845 struct IconEntry
*node
= NULL
;
1846 struct List putawayicons
;
1848 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1850 NEWLIST(&putawayicons
);
1854 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&entry
);
1856 if (((IPTR
)entry
!= MUIV_IconList_NextIcon_End
) && ((entry
->type
== ST_LINKFILE
) || (entry
->type
== ST_LINKDIR
)))
1858 node
= (struct IconEntry
*)((IPTR
)entry
- ((IPTR
)&node
->ie_IconListEntry
- (IPTR
)node
));
1859 D(bug("[Wanderer] %s: entry = '%s' @ %p, (%p)\n", __PRETTY_FUNCTION__
, entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, entry
, node
));
1860 /* Remove the node from the iconlist .. */
1861 /* Add it to our internal list for cleanup.. */
1862 //AddTail(&putawayicons, node);
1869 D(bug("[Wanderer] %s: finished ..\n", __PRETTY_FUNCTION__
));
1872 ///DisposeCopyDisplay()
1873 /* dispose the file copy display */
1874 void DisposeCopyDisplay(struct MUIDisplayObjects
*d
)
1878 //SET(d->win,MUIA_Window_Open,FALSE);
1879 MUI_DisposeObject(d
->copyApp
);
1884 ///CreateCopyDisplay()
1885 /* create the file copy window */
1886 BOOL
CreateCopyDisplay(UWORD flags
, struct MUIDisplayObjects
*d
)
1890 Object
*group
, *fromObject
, *toObject
, *fileTextObject
, *fileLengthObject
, *gaugeGroup
;
1892 d
->stopflag
= 0; // will be set to 1 when clicking on stop, than the displayhook can tell actionDir() to stop copy
1896 d
->smallobjects
= 0;
1897 d
->copyApp
= MUI_NewObject(MUIC_Application
,
1898 MUIA_Application_Title
, (IPTR
)wand_copyprocnamestr
,
1899 MUIA_Application_Base
, (IPTR
)"WANDERER_COPY",
1900 MUIA_Application_Copyright
, (IPTR
) wand_copyrightstr
,
1901 MUIA_Application_Author
, (IPTR
) wand_authorstr
,
1902 MUIA_Application_SingleTask
, (IPTR
)FALSE
,
1903 MUIA_Application_Window
, (IPTR
)(d
->win
= MUI_NewObject(MUIC_Window
,
1904 MUIA_Window_Title
, (IPTR
)_(MSG_WANDERER_FILEACCESS
),
1905 MUIA_Window_ID
, (IPTR
)MAKE_ID('W','F','C','R'),
1906 MUIA_Window_Activate
, TRUE
,
1907 MUIA_Window_DepthGadget
, TRUE
,
1908 MUIA_Window_DragBar
, TRUE
,
1909 MUIA_Window_SizeGadget
, TRUE
,
1910 MUIA_Window_AppWindow
, FALSE
,
1911 MUIA_Window_CloseGadget
, FALSE
,
1912 MUIA_Window_Borderless
, FALSE
,
1913 MUIA_Window_TopEdge
, MUIV_Window_TopEdge_Centered
,
1914 MUIA_Window_LeftEdge
, MUIV_Window_LeftEdge_Centered
,
1915 MUIA_Window_Width
, MUIV_Window_Width_Visible(60),
1916 WindowContents
, (group
= MUI_NewObject(MUIC_Group
,
1917 Child
, (IPTR
)(fromObject
= MUI_NewObject(MUIC_Text
,
1919 MUIA_InnerRight
,(8),
1921 MUIA_InnerBottom
,(2),
1922 MUIA_Text_PreParse
, (IPTR
)"\33c",
1924 Child
, (IPTR
)(d
->sourceObject
= MUI_NewObject(MUIC_Text
,
1927 MUIA_InnerRight
,(8),
1929 MUIA_InnerBottom
,(2),
1930 MUIA_Background
, MUII_TextBack
,
1931 MUIA_Text_PreParse
, (IPTR
)"\33c",
1932 MUIA_Text_Contents
, (IPTR
)"---",
1934 Child
, (IPTR
)(toObject
= MUI_NewObject(MUIC_Text
,
1936 MUIA_InnerRight
,(8),
1938 MUIA_InnerBottom
,(2),
1939 MUIA_Text_PreParse
, (IPTR
)"\33c",
1941 Child
, (IPTR
)(d
->destObject
= MUI_NewObject(MUIC_Text
,
1944 MUIA_InnerRight
,(8),
1946 MUIA_InnerBottom
,(2),
1947 MUIA_Background
, MUII_TextBack
,
1948 MUIA_Text_PreParse
, (IPTR
)"\33c",
1949 MUIA_Text_Contents
, (IPTR
)"---",
1951 Child
, (IPTR
)(fileTextObject
= MUI_NewObject(MUIC_Text
,
1953 MUIA_InnerRight
,(8),
1955 MUIA_InnerBottom
,(2),
1956 MUIA_Text_PreParse
, (IPTR
)"\33c",
1958 Child
, (IPTR
)(d
->fileObject
= MUI_NewObject(MUIC_Text
,
1961 MUIA_InnerRight
,(8),
1963 MUIA_InnerBottom
,(2),
1964 MUIA_Background
, MUII_TextBack
,
1965 MUIA_Text_PreParse
, (IPTR
)"\33c",
1966 MUIA_Text_Contents
, (IPTR
)"---",
1968 Child
, (IPTR
)(fileLengthObject
= MUI_NewObject(MUIC_Text
,
1970 MUIA_InnerRight
,(8),
1972 MUIA_InnerBottom
,(2),
1973 MUIA_Text_PreParse
, (IPTR
)"\33c",
1975 Child
, (IPTR
)(gaugeGroup
= MUI_NewObject(MUIC_Group
,
1977 Child
, d
->gauge
= MUI_NewObject(MUIC_Gauge
,
1978 MUIA_Gauge_Horiz
, TRUE
,
1979 MUIA_Gauge_Max
, 32768,
1980 MUIA_Gauge_InfoText
, _(MSG_WANDERER_FILEACCESS_PROCESSING
),
1982 Child
, MUI_NewObject(MUIC_Scale
,
1983 MUIA_Scale_Horiz
, TRUE
,
1986 Child
, (IPTR
)( d
->performanceObject
= MUI_NewObject(MUIC_Text
,
1989 MUIA_InnerRight
,(8),
1991 MUIA_InnerBottom
,(2),
1992 MUIA_Background
, MUII_TextBack
,
1993 MUIA_Text_PreParse
, (IPTR
)"\33c",
1994 MUIA_Text_Contents
, (IPTR
)"...........0 Bytes...........",
1997 Child
, (IPTR
)( d
->stopObject
= SimpleButton( _(MSG_WANDERER_FILEACCESS_STOP
) ) ),
2004 if ((flags
& (ACTION_COPY
|ACTION_DELETE
)) == (ACTION_COPY
|ACTION_DELETE
))
2006 SET(fromObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_MOVEFROM
) );
2007 SET(toObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_MOVETO
) );
2008 SET(fileTextObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_FILE
) );
2009 SET(fileLengthObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_TRAFFIC
) );
2011 else if ((flags
& ACTION_COPY
) == ACTION_COPY
)
2013 SET(fromObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_COPYFROM
) );
2014 SET(toObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_COPYTO
) );
2015 SET(fileTextObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_FILE
) );
2016 SET(fileLengthObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_TRAFFIC
) );
2019 else if ((flags
& ACTION_DELETE
) == ACTION_DELETE
)
2021 SET(fromObject
, MUIA_Text_Contents
, _(MSG_WANDERER_FILEACCESS_DELETEFROM
) );
2022 DoMethod(group
, MUIM_Group_InitChange
);
2023 DoMethod(group
, OM_REMMEMBER
, toObject
);
2024 DoMethod(group
, OM_REMMEMBER
, fileLengthObject
);
2025 DoMethod(group
, OM_REMMEMBER
, d
->performanceObject
);
2026 DoMethod(group
, OM_REMMEMBER
, d
->destObject
);
2027 DoMethod(group
, OM_REMMEMBER
, gaugeGroup
);
2028 DoMethod(group
, MUIM_Group_ExitChange
);
2029 SET(fileTextObject
, MUIA_Text_Contents
, _(MSG_WANDERER_FILEACCESS_FILETODELETE
) );
2032 SET(d
->win
,MUIA_Window_Open
,TRUE
);
2033 DoMethod(d
->stopObject
,MUIM_Notify
, MUIA_Pressed
, FALSE
, d
->stopObject
, 3, MUIM_WriteLong
, 1 ,&d
->stopflag
);
2040 ///wanderer_menufunc_icon_delete()
2041 void wanderer_menufunc_icon_delete(void)
2043 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
2044 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
2045 struct IconList_Entry
*entry
= ( void*) MUIV_IconList_NextIcon_Start
;
2046 struct MUIDisplayObjects dobjects
;
2047 struct Hook displayCopyHook
;
2048 struct Hook displayDelHook
;
2051 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
) &entry
);
2052 displayCopyHook
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_DisplayCopyFunc
;
2053 displayDelHook
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_AskDeleteFunc
;
2057 /* Process all selected entries */
2058 if (CreateCopyDisplay(ACTION_DELETE
, &dobjects
))
2062 if ((int)entry
!= MUIV_IconList_NextIcon_End
)
2064 /* copy via filesystems.c */
2065 D(bug("[Wanderer] Delete \"%s\"\n", entry
->ile_IconEntry
->ie_IconNode
.ln_Name
);)
2066 CopyContent( NULL
, entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, NULL
, TRUE
, ACTION_DELETE
, &displayCopyHook
, &displayDelHook
, (APTR
) &dobjects
);
2069 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
) &entry
);
2071 while ( (int)entry
!= MUIV_IconList_NextIcon_End
);
2072 DisposeCopyDisplay(&dobjects
);
2074 // Only update list if anything happened to the icons!
2075 if ( updatedIcons
> 0 )
2077 DoMethod(window
, MUIM_IconWindow_UnselectAll
);
2078 DoMethod ( iconList
, MUIM_IconList_Update
);
2083 ///wanderer_menufunc_icon_format()
2084 void wanderer_menufunc_icon_format(void)
2086 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
2087 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
2088 struct IconList_Entry
*entry
= ( void*) MUIV_IconList_NextIcon_Start
;
2090 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
) &entry
);
2092 /* Process only first selected entry */
2093 if ((int)entry
!= MUIV_IconList_NextIcon_End
)
2095 BPTR lock
= Lock(entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, ACCESS_READ
);
2096 D(bug("[Wanderer]: %s('%s')\n", __PRETTY_FUNCTION__
, entry
->ile_IconEntry
->ie_IconNode
.ln_Name
);)
2097 /* Usually we pass object name and parent lock. Here we do the same thing.
2098 Just object name is empty string and its parent is device's root. */
2101 "SYS:System/Format",
2102 WBOPENA_ArgLock
, (IPTR
) lock
,
2103 WBOPENA_ArgName
, lock
? (IPTR
)"" : (IPTR
)entry
->ile_IconEntry
->ie_IconNode
.ln_Name
,
2112 ///wanderer_menufunc_wanderer_AROS_guisettings()
2113 void wanderer_menufunc_wanderer_AROS_guisettings(void)
2115 //DoMethod(_WandererIntern_AppObj, MUIM_Application_OpenConfigWindow);
2116 OpenWorkbenchObject("SYS:Prefs/Zune",
2117 WBOPENA_ArgName
, (IPTR
) "WANDERER",
2122 ///wanderer_menufunc_wanderer_AROS_about()
2123 void wanderer_menufunc_wanderer_AROS_about(void)
2125 OpenWorkbenchObject("SYS:System/About",
2130 ///wanderer_menufunc_wanderer_about()
2131 void wanderer_menufunc_wanderer_about(Object
**pwand
)
2133 Object
*self
= *pwand
;
2134 Class
*CLASS
= _WandererIntern_CLASS
;
2135 SETUP_WANDERER_INST_DATA
;
2137 /* Display Information about this version of wanderer */
2138 if (data
->wd_AboutWindow
== NULL
)
2140 data
->wd_AboutWindow
= WindowObject
,
2141 MUIA_Window_Title
, "About Wanderer...",
2142 MUIA_Window_ID
, (IPTR
)MAKE_ID('W','A','B','T'),
2143 WindowContents
, VGroup
,
2145 Child
, (IPTR
) IconImageObject
,
2146 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2147 MUIA_IconImage_File
, (IPTR
)"PROGDIR:Wanderer",
2151 MUIA_Text_PreParse
, "\33c\33b",
2152 MUIA_Text_Contents
, (IPTR
)wand_titlestr
,
2155 MUIA_Text_PreParse
, "\33c",
2156 MUIA_Text_Contents
, (IPTR
)wand_copyrightstr
,
2161 MUIA_Frame
, MUIV_Frame_Group
,
2163 MUIA_Text_PreParse
, "\33b",
2164 MUIA_Text_Contents
, (IPTR
)"Internal Classes:",
2169 MUIA_Text_Contents
, (IPTR
)"iconwindow",
2172 MUIA_Text_Contents
, (IPTR
)"vXX.XX",
2175 MUIA_Text_Contents
, (IPTR
)"volumelist",
2178 MUIA_Text_Contents
, (IPTR
)"vXX.XX",
2181 MUIA_Text_Contents
, (IPTR
)"drawerlist",
2184 MUIA_Text_Contents
, (IPTR
)"vXX.XX",
2189 MUIA_Text_PreParse
, "\33b",
2190 MUIA_Text_Contents
, (IPTR
)"External Classes:",
2194 // Child, TextObject,
2195 // MUIA_Text_Contents, (IPTR)"icon.mui",
2197 // Child, TextObject,
2198 // MUIA_Text_Contents, (IPTR)"vXX.XX",
2201 MUIA_Text_Contents
, (IPTR
)"iconlist.mui",
2204 MUIA_Text_Contents
, (IPTR
)"vXX.XX",
2207 MUIA_Text_Contents
, (IPTR
)"iconlistview.mui",
2210 MUIA_Text_Contents
, (IPTR
)"vXX.XX",
2213 MUIA_Text_Contents
, (IPTR
)"iconvolumelist.mui",
2216 MUIA_Text_Contents
, (IPTR
)"vXX.XX",
2219 MUIA_Text_Contents
, (IPTR
)"icondrawerlist.mui",
2222 MUIA_Text_Contents
, (IPTR
)"vXX.XX",
2231 DoMethod(_app(self
), OM_ADDMEMBER
, (IPTR
) data
->wd_AboutWindow
);
2233 DoMethod(self
, OM_ADDMEMBER
, (IPTR
) data
->wd_AboutWindow
);
2237 data
->wd_AboutWindow
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
2238 (IPTR
)data
->wd_AboutWindow
, 3, MUIM_Set
, MUIA_Window_Open
, FALSE
2242 if (data
->wd_AboutWindow
)
2244 IPTR isOpen
= (IPTR
)FALSE
;
2245 GET(data
->wd_AboutWindow
, MUIA_Window_Open
, &isOpen
);
2254 SET(data
->wd_AboutWindow
, MUIA_Window_Open
, isOpen
);
2259 ///wanderer_menufunc_wanderer_quit()
2260 void wanderer_menufunc_wanderer_quit(void)
2262 if (OpenWorkbenchObject("WANDERER:Tools/Quit", TAG_DONE
))
2268 if (MUI_RequestA(_WandererIntern_AppObj
, NULL
, 0, wand_namestr
, _(MSG_YESNO
), _(MSG_REALLYQUIT
), NULL
))
2269 DoMethod(_WandererIntern_AppObj
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
2275 ///wanderer_menufunc_wanderer_shutdown()
2276 void wanderer_menufunc_wanderer_shutdown(void)
2280 action
= MUI_RequestA(_WandererIntern_AppObj
, NULL
, 0, _(MSG_SHUTDOWN_TITLE
), _(MSG_SHUTDOWN_BUTTONS
), _(MSG_SHUTDOWN_BODY
), NULL
);
2285 ShutdownA(SD_ACTION_POWEROFF
);
2288 ShutdownA(SD_ACTION_COLDREBOOT
);
2293 MUI_RequestA(_WandererIntern_AppObj
, NULL
, 0, _(MSG_SHUTDOWN_TITLE
), _(MSG_OK
), _(MSG_ACTION_NOT_SUPPORTED
), NULL
);
2299 /**************************************************************************
2300 This function returns a Menu Object with the given id
2301 **************************************************************************/
2302 Object
*FindMenuitem(Object
* strip
, int id
)
2304 return (Object
*)DoMethod(strip
, MUIM_FindUData
, id
);
2309 /**************************************************************************
2310 This connects a notify to the given menu entry id
2311 **************************************************************************/
2312 VOID
DoMenuNotify(Object
* strip
, int id
, IPTR trigattrib
, void *function
, void *arg
)
2315 entry
= FindMenuitem(strip
,id
);
2320 entry
, MUIM_Notify
, trigattrib
, MUIV_EveryTime
,
2321 (IPTR
) entry
, 4, MUIM_CallHook
, (IPTR
) &_WandererIntern_hook_standard
,
2322 (IPTR
) function
, (IPTR
) arg
2328 ///SetMenuDefaultNotifies()
2329 VOID
SetMenuDefaultNotifies(Object
*wanderer
, Object
*strip
, STRPTR path
)
2335 DoMenuNotify(strip
, MEN_WANDERER_EXECUTE
, MUIA_Menuitem_Trigger
,
2336 wanderer_menufunc_wanderer_execute
, path
);
2337 DoMenuNotify(strip
, MEN_WANDERER_SHELL
, MUIA_Menuitem_Trigger
,
2338 wanderer_menufunc_wanderer_shell
, path
);
2339 DoMenuNotify(strip
, MEN_WANDERER_AROS_GUISETTINGS
, MUIA_Menuitem_Trigger
,
2340 wanderer_menufunc_wanderer_AROS_guisettings
, NULL
);
2341 DoMenuNotify(strip
, MEN_WANDERER_AROS_ABOUT
, MUIA_Menuitem_Trigger
,
2342 wanderer_menufunc_wanderer_AROS_about
, NULL
);
2343 DoMenuNotify(strip
, MEN_WANDERER_ABOUT
, MUIA_Menuitem_Trigger
,
2344 wanderer_menufunc_wanderer_about
, wanderer
);
2345 DoMenuNotify(strip
, MEN_WANDERER_QUIT
, MUIA_Menuitem_Trigger
,
2346 wanderer_menufunc_wanderer_quit
, NULL
);
2347 DoMenuNotify(strip
, MEN_WANDERER_SHUTDOWN
, MUIA_Menuitem_Trigger
,
2348 wanderer_menufunc_wanderer_shutdown
, NULL
);
2350 DoMenuNotify(strip
, MEN_WINDOW_NEW_DRAWER
, MUIA_Menuitem_Trigger
,
2351 wanderer_menufunc_window_newdrawer
, path
);
2352 DoMenuNotify(strip
, MEN_WINDOW_OPEN_PARENT
, MUIA_Menuitem_Trigger
,
2353 wanderer_menufunc_window_openparent
, path
);
2354 DoMenuNotify(strip
, MEN_WINDOW_CLOSE
, MUIA_Menuitem_Trigger
,
2355 wanderer_menufunc_window_close
, NULL
);
2356 DoMenuNotify(strip
, MEN_WINDOW_UPDATE
, MUIA_Menuitem_Trigger
,
2357 wanderer_menufunc_window_update
, NULL
);
2358 DoMenuNotify(strip
, MEN_WINDOW_CLEAR
, MUIA_Menuitem_Trigger
,
2359 wanderer_menufunc_window_clear
, NULL
);
2361 DoMenuNotify(strip
, MEN_WINDOW_SNAP_WIN
, MUIA_Menuitem_Trigger
,
2362 wanderer_menufunc_window_snapshot
, FALSE
);
2363 DoMenuNotify(strip
, MEN_WINDOW_SNAP_ALL
, MUIA_Menuitem_Trigger
,
2364 wanderer_menufunc_window_snapshot
, (APTR
)TRUE
);
2366 DoMenuNotify(strip
, MEN_WINDOW_SELECT
, MUIA_Menuitem_Trigger
,
2367 wanderer_menufunc_window_select
, NULL
);
2368 DoMenuNotify(strip
, MEN_WINDOW_VIEW_ALL
, MUIA_Menuitem_Trigger
,
2369 wanderer_menufunc_window_view_icons
, strip
);
2370 // DoMenuNotify(strip, MEN_WINDOW_VIEW_HIDDEN, MUIA_Menuitem_Trigger,
2371 // wanderer_menufunc_window_view_hidden, strip);
2372 DoMenuNotify(strip
, MEN_WINDOW_SORT_ENABLE
, MUIA_Menuitem_Trigger
,
2373 wanderer_menufunc_window_sort_enable
, strip
);
2374 DoMenuNotify(strip
, MEN_WINDOW_SORT_NAME
, MUIA_Menuitem_Trigger
,
2375 wanderer_menufunc_window_sort_name
, strip
);
2376 DoMenuNotify(strip
, MEN_WINDOW_SORT_TYPE
, MUIA_Menuitem_Trigger
,
2377 wanderer_menufunc_window_sort_type
, strip
);
2378 DoMenuNotify(strip
, MEN_WINDOW_SORT_DATE
, MUIA_Menuitem_Trigger
,
2379 wanderer_menufunc_window_sort_date
, strip
);
2380 DoMenuNotify(strip
, MEN_WINDOW_SORT_SIZE
, MUIA_Menuitem_Trigger
,
2381 wanderer_menufunc_window_sort_size
, strip
);
2382 DoMenuNotify(strip
, MEN_WINDOW_SORT_REVERSE
, MUIA_Menuitem_Trigger
,
2383 wanderer_menufunc_window_sort_reverse
, strip
);
2384 DoMenuNotify(strip
, MEN_WINDOW_SORT_TOPDRAWERS
, MUIA_Menuitem_Trigger
,
2385 wanderer_menufunc_window_sort_topdrawers
, strip
);
2387 DoMenuNotify(strip
, MEN_ICON_OPEN
, MUIA_Menuitem_Trigger
,
2388 wanderer_menufunc_icon_open
, NULL
);
2389 DoMenuNotify(strip
, MEN_ICON_RENAME
, MUIA_Menuitem_Trigger
,
2390 wanderer_menufunc_icon_rename
, NULL
);
2391 DoMenuNotify(strip
, MEN_ICON_INFORMATION
, MUIA_Menuitem_Trigger
,
2392 wanderer_menufunc_icon_information
, NULL
);
2393 DoMenuNotify(strip
, MEN_ICON_SNAPSHOT
, MUIA_Menuitem_Trigger
,
2394 wanderer_menufunc_icon_snapshot
, (APTR
)TRUE
);
2395 DoMenuNotify(strip
, MEN_ICON_UNSNAPSHOT
, MUIA_Menuitem_Trigger
,
2396 wanderer_menufunc_icon_snapshot
, FALSE
);
2397 DoMenuNotify(strip
, MEN_ICON_LEAVEOUT
, MUIA_Menuitem_Trigger
,
2398 wanderer_menufunc_icon_leaveout
, NULL
);
2399 DoMenuNotify(strip
, MEN_ICON_PUTAWAY
, MUIA_Menuitem_Trigger
,
2400 wanderer_menufunc_icon_putaway
, NULL
);
2401 DoMenuNotify(strip
, MEN_ICON_DELETE
, MUIA_Menuitem_Trigger
,
2402 wanderer_menufunc_icon_delete
, NULL
);
2403 DoMenuNotify(strip
, MEN_ICON_FORMAT
, MUIA_Menuitem_Trigger
,
2404 wanderer_menufunc_icon_format
, NULL
);
2406 if ((item
= FindMenuitem(strip
, MEN_WANDERER_BACKDROP
)))
2410 item
, MUIM_Notify
, MUIA_Menuitem_Trigger
, MUIV_EveryTime
,
2411 (IPTR
) _WandererIntern_AppObj
, 7, MUIM_Application_PushMethod
,
2412 (IPTR
) _WandererIntern_AppObj
, 4, MUIM_CallHook
, (IPTR
) &_WandererIntern_hook_standard
,
2413 (IPTR
) wanderer_menufunc_wanderer_backdrop
, (IPTR
) strip
2419 ///Wanderer__Func_UpdateMenuStates()
2420 VOID
Wanderer__Func_UpdateMenuStates(Object
*WindowObj
, Object
*IconlistObj
)
2422 IPTR isRoot
= 0, current_DispFlags
= 0, current_SortFlags
= 0;
2423 Object
*current_Menustrip
= NULL
, *current_MenuItem
= NULL
;
2424 struct IconList_Entry
*icon_entry
= (IPTR
)MUIV_IconList_NextIcon_Start
;
2425 int selected_count
= 0;
2427 BOOL icon_men_PutAway
= FALSE
;
2428 BOOL icon_men_LeaveOut
= FALSE
;
2429 BOOL icon_men_Format
= FALSE
;
2430 BOOL icon_men_EmptyTrash
= FALSE
;
2431 BOOL icon_men_IconSort
= FALSE
;
2433 if (IconlistObj
== NULL
)
2436 D(bug("[Wanderer]: %s(IconList @ %p)\n", __PRETTY_FUNCTION__
, IconlistObj
));
2438 GET(IconlistObj
, MUIA_IconList_SortFlags
, ¤t_SortFlags
);
2439 GET(IconlistObj
, MUIA_IconList_DisplayFlags
, ¤t_DispFlags
);
2440 GET(WindowObj
, MUIA_Window_Menustrip
, ¤t_Menustrip
);
2441 GET(WindowObj
, MUIA_IconWindow_IsRoot
, &isRoot
);
2443 D(bug("[Wanderer] %s: Menu @ %p, Display Flags : %x, Sort Flags : %x\n", __PRETTY_FUNCTION__
, current_Menustrip
, current_DispFlags
, current_SortFlags
));
2447 DoMethod(IconlistObj
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&icon_entry
);
2449 if ((IPTR
)icon_entry
!= MUIV_IconList_NextIcon_End
)
2451 if (isRoot
&& (icon_entry
->type
== ST_ROOT
))
2453 D(bug("[Wanderer] %s: ST_ROOT\n", __PRETTY_FUNCTION__
));
2454 icon_men_Format
= TRUE
;
2456 if (isRoot
&& ((icon_entry
->type
== ST_LINKDIR
) || (icon_entry
->type
== ST_LINKFILE
)))
2458 D(bug("[Wanderer] %s: ST_LINKDIR/ST_LINKFILE\n", __PRETTY_FUNCTION__
));
2459 icon_men_PutAway
= TRUE
;
2461 if (!(isRoot
) && ((icon_entry
->type
== ST_USERDIR
) || (icon_entry
->type
== ST_FILE
)))
2463 D(bug("[Wanderer] %s: ST_USERDIR/ST_FILE\n", __PRETTY_FUNCTION__
));
2464 icon_men_LeaveOut
= TRUE
;
2474 if (current_Menustrip
!= NULL
)
2476 if (selected_count
> 0)
2478 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_OPEN
)) != NULL
)
2480 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, TRUE
);
2482 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_RENAME
)) != NULL
)
2484 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, TRUE
);
2486 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_INFORMATION
)) != NULL
)
2488 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, TRUE
);
2490 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_SNAPSHOT
)) != NULL
)
2492 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, TRUE
);
2494 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_UNSNAPSHOT
)) != NULL
)
2496 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, TRUE
);
2498 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_DELETE
)) != NULL
)
2500 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, icon_men_LeaveOut
);
2502 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_FORMAT
)) != NULL
)
2504 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, icon_men_Format
);
2506 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_LEAVEOUT
)) != NULL
)
2508 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, icon_men_LeaveOut
);
2510 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_PUTAWAY
)) != NULL
)
2512 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, icon_men_PutAway
);
2514 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_EMPTYTRASH
)) != NULL
)
2516 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, icon_men_EmptyTrash
);
2518 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_CLEAR
)) != NULL
)
2520 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, TRUE
);
2525 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_OPEN
)) != NULL
)
2527 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, FALSE
);
2529 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_RENAME
)) != NULL
)
2531 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, FALSE
);
2533 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_INFORMATION
)) != NULL
)
2535 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, FALSE
);
2537 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_SNAPSHOT
)) != NULL
)
2539 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, FALSE
);
2541 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_UNSNAPSHOT
)) != NULL
)
2543 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, FALSE
);
2545 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_DELETE
)) != NULL
)
2547 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, FALSE
);
2549 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_FORMAT
)) != NULL
)
2551 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, FALSE
);
2553 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_LEAVEOUT
)) != NULL
)
2555 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, FALSE
);
2557 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_PUTAWAY
)) != NULL
)
2559 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, FALSE
);
2561 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_EMPTYTRASH
)) != NULL
)
2563 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, FALSE
);
2565 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_CLEAR
)) != NULL
)
2567 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, FALSE
);
2570 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_VIEW_ALL
)) != NULL
)
2572 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, !(current_DispFlags
& ICONLIST_DISP_SHOWINFO
) ? TRUE
: FALSE
);
2574 // if ((current_MenuItem = FindMenuitem(current_Menustrip, MEN_WINDOW_VIEW_HIDDEN)) != NULL)
2576 // NNSET(current_MenuItem, MUIA_Menuitem_Checked, (current_DispFlags & ICONLIST_DISP_SHOWHIDDEN) ? TRUE : FALSE);
2578 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_NAME
)) != NULL
)
2580 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& ICONLIST_SORT_MASK
) == ICONLIST_SORT_BY_NAME
) ? TRUE
: FALSE
);
2582 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_DATE
)) != NULL
)
2584 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& ICONLIST_SORT_MASK
) == ICONLIST_SORT_BY_DATE
) ? TRUE
: FALSE
);
2586 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_SIZE
)) != NULL
)
2588 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& ICONLIST_SORT_MASK
) == ICONLIST_SORT_BY_SIZE
) ? TRUE
: FALSE
);
2590 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_TYPE
)) != NULL
)
2592 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& ICONLIST_SORT_MASK
) == ICONLIST_SORT_MASK
) ? TRUE
: FALSE
);
2594 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_REVERSE
)) != NULL
)
2596 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& ICONLIST_SORT_REVERSE
) == ICONLIST_SORT_REVERSE
) ? TRUE
: FALSE
);
2598 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_TOPDRAWERS
)) != NULL
)
2600 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& ICONLIST_SORT_DRAWERS_MIXED
) == ICONLIST_SORT_DRAWERS_MIXED
) ? FALSE
: TRUE
);
2602 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_ENABLE
)) != NULL
)
2606 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, FALSE
);
2610 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, TRUE
);
2613 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& ICONLIST_SORT_MASK
) == 0) ? FALSE
: TRUE
);
2618 ///Wanderer__HookFunc_UpdateMenuStatesFunc()
2622 ULONG
, Wanderer__HookFunc_UpdateMenuStatesFunc
,
2623 AROS_UFHA(struct Hook
*, hook
, A0
),
2624 AROS_UFHA(APTR
*, obj
, A2
),
2625 AROS_UFHA(APTR
, param
, A1
)
2629 HOOKPROTO(Wanderer__HookFunc_UpdateMenuStatesFunc
, ULONG
, struct dCopyStruct
*obj
, APTR param
)
2634 Object
*self
= ( Object
*)obj
;
2635 Object
*window
= *( Object
**)param
;
2636 Object
*iconlist
= NULL
;
2638 D(bug("[Wanderer]: %s(self @ %p, window @ %p)\n", __PRETTY_FUNCTION__
, self
, window
));
2640 GET(window
, MUIA_IconWindow_IconList
, &iconlist
);
2642 D(bug("[Wanderer] %s: iconlist @ %p\n", __PRETTY_FUNCTION__
, iconlist
));
2644 Wanderer__Func_UpdateMenuStates(window
, iconlist
);
2646 D(bug("[Wanderer] %s: Update Complete.\n", __PRETTY_FUNCTION__
));
2653 /*** Methods ****************************************************************/
2655 Object
*Wanderer__OM_NEW(Class
*CLASS
, Object
*self
, struct opSet
*message
)
2657 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
2659 self
= (Object
*) DoSuperNewTags
2663 MUIA_Application_Title
, (IPTR
) wand_namestr
,
2664 MUIA_Application_Base
, (IPTR
) "WANDERER",
2665 MUIA_Application_Version
, (IPTR
) VERSION
,
2666 MUIA_Application_Description
, (IPTR
) _(MSG_DESCRIPTION
),
2667 MUIA_Application_SingleTask
, TRUE
,
2669 MUIA_Application_Version
, (IPTR
) wand_versionstr
,
2670 MUIA_Application_Copyright
, (IPTR
) wand_copyrightstr
,
2671 MUIA_Application_Author
, (IPTR
) wand_authorstr
,
2673 TAG_MORE
, (IPTR
) message
->ops_AttrList
2678 SETUP_WANDERER_INST_DATA
;
2680 // ULONG updatedIcons;
2681 D(bug("[Wanderer] %s: Wanderer Obj @ %p, Instance data @ %p\n", __PRETTY_FUNCTION__
, self
, data
));
2683 _WandererIntern_CLASS
= CLASS
;
2685 NewList(&_WandererIntern_FSHandlerList
);
2687 D(bug("[Wanderer] %s: FSHandlerList @ %p\n", __PRETTY_FUNCTION__
, &_WandererIntern_FSHandlerList
));
2689 #if defined(WANDERER_DEFAULT_BACKDROP)
2690 data
->wd_Option_BackDropMode
= TRUE
;
2692 data
->wd_Option_BackDropMode
= FALSE
;
2695 /*-- Setup hooks structures ----------------------------------------*/
2697 _WandererIntern_hook_standard
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_StandardFunc
;
2698 _WandererIntern_hook_action
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_ActionFunc
;
2699 _WandererIntern_hook_backdrop
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_BackdropFunc
;
2701 _WandererIntern_hook_standard
= &Hook_StandardFunc
;
2702 _WandererIntern_hook_action
= &Hook_ActionFunc
;
2703 _WandererIntern_hook_backdrop
= &Hook_BackdropFunc
;
2707 if ((data
->wd_CommandPort
= CreateMsgPort()) == NULL
)
2709 CoerceMethod(CLASS
, self
, OM_DISPOSE
);
2713 if ((data
->wd_NotifyPort
= CreateMsgPort()) == NULL
)
2715 CoerceMethod(CLASS
, self
, OM_DISPOSE
);
2719 RegisterWorkbench(data
->wd_CommandPort
);
2721 /* Setup command port handler --------------------------------------*/
2722 data
->wd_CommandIHN
.ihn_Signals
= 1UL << data
->wd_CommandPort
->mp_SigBit
;
2723 data
->wd_CommandIHN
.ihn_Object
= self
;
2724 data
->wd_CommandIHN
.ihn_Method
= MUIM_Wanderer_HandleCommand
;
2728 self
, MUIM_Application_AddInputHandler
, (IPTR
) &data
->wd_CommandIHN
2731 /* Setup timer handler ---------------------------------------------*/
2732 data
->wd_TimerIHN
.ihn_Flags
= MUIIHNF_TIMER
;
2733 data
->wd_TimerIHN
.ihn_Millis
= 3000;
2734 data
->wd_TimerIHN
.ihn_Object
= self
;
2735 data
->wd_TimerIHN
.ihn_Method
= MUIM_Wanderer_HandleTimer
;
2739 self
, MUIM_Application_AddInputHandler
, (IPTR
) &data
->wd_TimerIHN
2742 /* Setup filesystem notification handler ---------------------------*/
2743 data
->wd_NotifyIHN
.ihn_Signals
= 1UL << data
->wd_NotifyPort
->mp_SigBit
;
2744 data
->wd_NotifyIHN
.ihn_Object
= self
;
2745 data
->wd_NotifyIHN
.ihn_Method
= MUIM_Wanderer_HandleNotify
;
2749 self
, MUIM_Application_AddInputHandler
, (IPTR
) &data
->wd_NotifyIHN
2752 // All the following should be moved to InitWandererPrefs
2755 data
->wd_Prefs
= (Object
*)WandererPrefsObject
,
2756 MUIA_Wanderer_FileSysNotifyPort
, (IPTR
)data
->wd_NotifyPort
,
2757 MUIA_Wanderer_FileSysNotifyList
, (IPTR
)&_WandererIntern_FSHandlerList
,
2758 End
; // FIXME: error handling
2760 data
->wd_Prefs
= NewObject(WandererPrefs_CLASS
->mcc_Class
, NULL
, TAG_DONE
); // FIXME: error handling
2765 D(bug("[Wanderer] %s: Prefs-Screentitle = '%s'\n", __PRETTY_FUNCTION__
, XGET(data
->wd_Prefs
, MUIA_IconWindowExt_ScreenTitle_String
)));
2766 data
->wd_PrefsIntern
= InitWandererPrefs();
2769 D(bug("[Wanderer] %s: WandererObj @ %p\n", __PRETTY_FUNCTION__
, self
));
2775 IPTR
Wanderer__OM_DISPOSE(Class
*CLASS
, Object
*self
, Msg message
)
2777 SETUP_WANDERER_INST_DATA
;
2779 if (data
->wd_CommandPort
)
2781 /* InputHandler's have only been added if the creation
2782 of the msg port was successful */
2783 DoMethod(self
, MUIM_Application_RemInputHandler
, (IPTR
) &data
->wd_TimerIHN
);
2784 DoMethod(self
, MUIM_Application_RemInputHandler
, (IPTR
) &data
->wd_CommandIHN
);
2785 DoMethod(self
, MUIM_Application_RemInputHandler
, (IPTR
) &data
->wd_NotifyIHN
);
2787 UnregisterWorkbench(data
->wd_CommandPort
);
2789 DeleteMsgPort(data
->wd_NotifyPort
);
2790 data
->wd_NotifyPort
= NULL
;
2792 DeleteMsgPort(data
->wd_CommandPort
);
2793 data
->wd_CommandPort
= NULL
;
2795 DisposeObject(data
->wd_Prefs
);
2796 data
->wd_Prefs
= NULL
;
2799 return DoSuperMethodA(CLASS
, self
, (Msg
) message
);
2804 IPTR
Wanderer__OM_SET(Class
*CLASS
, Object
*self
, struct opSet
*message
)
2806 SETUP_WANDERER_INST_DATA
;
2807 struct TagItem
*tstate
= message
->ops_AttrList
, *tag
;
2809 while ((tag
= NextTagItem((TAGITEM
)&tstate
)) != NULL
)
2811 switch (tag
->ti_Tag
)
2813 case MUIA_Wanderer_Screen
:
2814 D(bug("[Wanderer] %s: MUIA_Wanderer_Screen = %p\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
2815 D(bug("[Wanderer] %s: setting MUIA_Wanderer_Screen isnt yet handled!\n", __PRETTY_FUNCTION__
));
2818 case MUIA_Wanderer_ActiveWindow
:
2819 data
->wd_ActiveWindow
= (Object
*) tag
->ti_Data
;
2820 D(bug("[Wanderer] %s: MUIA_Wanderer_ActiveWindow = %p\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
2821 if (!(XGET(data
->wd_ActiveWindow
, MUIA_Window_Activate
)))
2823 NNSET(data
->wd_ActiveWindow
, MUIA_Window_Activate
, TRUE
);
2825 Object
*activatewin_Iconlist
= NULL
;
2827 GET(data
->wd_ActiveWindow
, MUIA_IconWindow_IconList
, &activatewin_Iconlist
);
2828 Wanderer__Func_UpdateMenuStates(data
->wd_ActiveWindow
, activatewin_Iconlist
);
2831 case MUIA_Application_Iconified
:
2832 /* Wanderer itself cannot be iconified,
2833 just hide, instead. */
2834 tag
->ti_Tag
= MUIA_ShowMe
;
2835 tag
->ti_Data
= !tag
->ti_Data
;
2840 return DoSuperMethodA(CLASS
, self
, (Msg
) message
);
2845 IPTR
Wanderer__OM_GET(Class
*CLASS
, Object
*self
, struct opGet
*message
)
2847 SETUP_WANDERER_INST_DATA
;
2848 IPTR
*store
= message
->opg_Storage
;
2851 switch (message
->opg_AttrID
)
2853 case MUIA_Wanderer_Screen
:
2854 *store
= (IPTR
)data
->wd_Screen
;
2857 case MUIA_Wanderer_Prefs
:
2858 *store
= (IPTR
)data
->wd_Prefs
;
2861 case MUIA_Wanderer_ActiveWindow
:
2862 *store
= (IPTR
)data
->wd_ActiveWindow
;
2865 case MUIA_Wanderer_WorkbenchWindow
:
2866 *store
= (IPTR
)data
->wd_WorkbenchWindow
;
2869 case MUIA_Wanderer_FileSysNotifyPort
:
2870 *store
= (IPTR
)data
->wd_NotifyPort
;
2873 case MUIA_Wanderer_FileSysNotifyList
:
2874 *store
= (IPTR
)&_WandererIntern_FSHandlerList
;
2878 *store
= (IPTR
)WANDERERVERS
;
2882 *store
= (IPTR
)WANDERERREV
;
2886 rv
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
2893 ///Wanderer__MUIM_Application_Execute()
2894 /* Main entry point for Wanderer Application Object */
2896 When the executable creates our object it calls zune
2897 to handle basic "control" ... which results in Zune
2898 calling this method ..
2900 IPTR Wanderer__MUIM_Application_Execute
2902 Class
*CLASS
, Object
*self
, Msg message
2905 SETUP_WANDERER_INST_DATA
;
2907 D(bug("[Wanderer] %s() ##\n[Wanderer] %s: Creating 'Workbench' Window..\n", __PRETTY_FUNCTION__
, __PRETTY_FUNCTION__
));
2909 data
->wd_WorkbenchWindow
= (Object
*) DoMethod
2911 self
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) NULL
2914 if (data
->wd_WorkbenchWindow
!= NULL
)
2916 D(bug("[Wanderer] %s: Workbench Window Obj @ %x\n", __PRETTY_FUNCTION__
, data
->wd_WorkbenchWindow
));
2920 D(bug("[Wanderer] %s: Really handing control to Zune ..\n", __PRETTY_FUNCTION__
));
2923 DoSuperMethodA(CLASS
, self
, message
);
2927 while (DoMethod(self
,MUIM_Application_NewInput
,&sigs
) != MUIV_Application_ReturnID_Quit
)
2931 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
);
2932 if (sigs
& SIGBREAKF_CTRL_C
) break;
2941 #warning "TODO: Report an error if we fail to create the Workbench's window ..."
2943 return RETURN_ERROR
;
2947 ///Wanderer__MUIM_Wanderer_HandleTimer()
2948 /*This function uses GetScreenTitle() function...*/
2950 IPTR Wanderer__MUIM_Wanderer_HandleTimer
2952 Class
*CLASS
, Object
*self
, Msg message
2955 SETUP_WANDERER_INST_DATA
;
2956 Object
*cstate
= (Object
*)(((struct List
*)XGET(self
, MUIA_Application_WindowList
))->lh_Head
);
2957 Object
*child
= NULL
;
2959 STRPTR scr_title
= GetUserScreenTitle(data
->wd_Prefs
);
2961 while ((child
= NextObject(&cstate
)))
2962 SET(child
, MUIA_Window_ScreenTitle
, (IPTR
) scr_title
);
2968 ///Wanderer__MUIM_Wanderer_HandleCommand()
2969 IPTR Wanderer__MUIM_Wanderer_HandleCommand
2971 Class
*CLASS
, Object
*self
, Msg message
2974 SETUP_WANDERER_INST_DATA
;
2975 struct WBHandlerMessage
*wbhm
= NULL
;
2976 struct List
*pub_screen_list
;
2977 struct PubScreenNode
*pub_screen_node
;
2978 WORD visitor_count
= 0;
2979 D(bug("[Wanderer] %s()\n", __PRETTY_FUNCTION__
));
2980 D(bug("[Wanderer] %s: Recieved signal at notification port\n", __PRETTY_FUNCTION__
));
2982 while ((wbhm
= WBHM(GetMsg(data
->wd_CommandPort
))) != NULL
)
2984 D(bug("[Wanderer] %s: Recieved message from handler, type = %ld\n", __PRETTY_FUNCTION__
, wbhm
->wbhm_Type
));
2986 switch (wbhm
->wbhm_Type
)
2988 case WBHM_TYPE_SHOW
:
2989 D(bug("[Wanderer] %s: WBHM_TYPE_SHOW\n", __PRETTY_FUNCTION__
));
2990 if ((data
->wd_Screen
= LockPubScreen(NULL
)) != NULL
)
2992 D(bug("[Wanderer] %s: Unlocking access to screen @ %x\n", __PRETTY_FUNCTION__
, data
->wd_Screen
));
2993 UnlockPubScreen(NULL
, data
->wd_Screen
);
2994 SET(self
, MUIA_ShowMe
, TRUE
);
2998 #warning "TODO: We need to handle the possiblity that we fail to lock the pubscreen..."
2999 D(bug("[Wanderer] %s: Couldnt Lock WB Screen!!\n", __PRETTY_FUNCTION__
));
3003 case WBHM_TYPE_HIDE
:
3004 D(bug("[Wanderer] %s: WBHM_TYPE_HIDE\n", __PRETTY_FUNCTION__
));
3005 pub_screen_list
= LockPubScreenList();
3008 ForeachNode (pub_screen_list
, pub_screen_node
)
3010 Foreach_Node(pub_screen_list
, pub_screen_node
);
3013 if (pub_screen_node
->psn_Screen
== data
->wd_Screen
)
3014 visitor_count
= pub_screen_node
->psn_VisitorCount
;
3016 UnlockPubScreenList();
3017 if (visitor_count
== 0)
3018 SET(self
, MUIA_ShowMe
, FALSE
);
3021 case WBHM_TYPE_UPDATE
:
3022 D(bug("[Wanderer] %s: WBHM_TYPE_UPDATE\n", __PRETTY_FUNCTION__
));
3024 CONST_STRPTR name
= wbhm
->wbhm_Data
.Update
.Name
;
3027 switch (wbhm
->wbhm_Data
.Update
.Type
)
3032 length
= strlen(name
);
3036 length
= PathPart(name
) - name
;
3040 D(bug("[Wanderer] %s: name = %s, length = %ld\n", __PRETTY_FUNCTION__
, name
, length
));
3043 Object
*cstate
= (Object
*)(((struct List
*)XGET(self
, MUIA_Application_WindowList
))->lh_Head
);
3044 Object
*child
= NULL
;
3046 while ((child
= NextObject(&cstate
)))
3048 if (XGET(child
, MUIA_UserData
))
3050 STRPTR child_drawer
= (STRPTR
)XGET(child
, MUIA_IconWindow_Location
);
3054 child_drawer
!= NULL
3055 && strncmp(name
, child_drawer
, length
) == 0
3056 && strlen(child_drawer
) == length
3059 Object
*iconlist
= (Object
*) XGET(child
, MUIA_IconWindow_IconList
);
3061 D(bug("[Wanderer] %s: Drawer found: %s!\n", __PRETTY_FUNCTION__
, child_drawer
));
3063 if (iconlist
!= NULL
)
3065 DoMethod ( iconlist
, MUIM_IconList_Update
);
3075 case WBHM_TYPE_OPEN
:
3076 D(bug("[Wanderer] %s: WBHM_TYPE_OPEN\n", __PRETTY_FUNCTION__
));
3079 Object
*cstate
= (Object
*)(((struct List
*)XGET(self
, MUIA_Application_WindowList
))->lh_Head
);
3081 CONST_STRPTR buf
= wbhm
->wbhm_Data
.Open
.Name
;
3083 while ((child
= NextObject(&cstate
)))
3085 if (XGET(child
, MUIA_UserData
))
3087 STRPTR child_drawer
= (STRPTR
)XGET(child
, MUIA_IconWindow_Location
);
3088 if (child_drawer
&& !Stricmp(buf
,child_drawer
))
3090 int is_open
= XGET(child
, MUIA_Window_Open
);
3092 DoMethod(child
, MUIM_IconWindow_Open
);
3095 DoMethod(child
, MUIM_Window_ToFront
);
3096 SET(child
, MUIA_Window_Activate
, TRUE
);
3105 _WandererIntern_AppObj
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) buf
3111 ReplyMsg((struct Message
*) wbhm
);
3118 ///Wanderer__MUIM_Wanderer_HandleNotify()
3119 IPTR Wanderer__MUIM_Wanderer_HandleNotify
3121 Class
*CLASS
, Object
*self
, Msg message
3124 SETUP_WANDERER_INST_DATA
;
3125 struct Message
*plainMessage
= NULL
;
3126 struct Wanderer_FSHandler
*nodeFSHandler
;
3128 while ((plainMessage
= GetMsg(data
->wd_NotifyPort
)) != NULL
)
3130 struct NotifyMessage
*notifyMessage
= (struct NotifyMessage
*) plainMessage
;
3131 IPTR notifyMessage_UserData
= notifyMessage
->nm_NReq
->nr_UserData
;
3132 D(bug("[Wanderer] %s: got FS notification ('%s' @ 0x%p) userdata = 0x%p!\n", __PRETTY_FUNCTION__
, notifyMessage
->nm_NReq
->nr_Name
, notifyMessage
, notifyMessage_UserData
));
3134 if (notifyMessage_UserData
!= (IPTR
) NULL
)
3136 D(bug("[Wanderer] %s: Drawer Window contents changed .. Updating\n", __PRETTY_FUNCTION__
));
3137 DoMethod((Object
*)notifyMessage_UserData
, MUIM_IconList_Update
);
3140 ForeachNode(&_WandererIntern_FSHandlerList
, nodeFSHandler
)
3142 if ((notifyMessage_UserData
== (IPTR
)NULL
) && (strcmp(notifyMessage
->nm_NReq
->nr_Name
, nodeFSHandler
->fshn_Node
.ln_Name
) == 0))
3144 /* reload prefs file */
3145 D(bug("[Wanderer] %s: Wanderer Prefs-File Changed .. Reloading\n", __PRETTY_FUNCTION__
));
3147 nodeFSHandler
->HandleFSUpdate();
3150 ReplyMsg((struct Message
*)notifyMessage
);
3157 ///Wanderer__Func_CreateWandererIntuitionMenu()
3158 /* Some differences here between volumes and subwindows */
3159 Object
* Wanderer__Func_CreateWandererIntuitionMenu( BOOL isRoot
, BOOL isBackdrop
)
3161 Object
*_NewWandIntMenu__menustrip
= NULL
;
3162 IPTR _NewWandIntMenu__OPTION_BACKDROP
= CHECKIT
|MENUTOGGLE
;
3163 IPTR _NewWandIntMenu__OPTION_SHOWALL
= CHECKIT
|MENUTOGGLE
;
3167 _NewWandIntMenu__OPTION_BACKDROP
|= CHECKED
;
3172 struct NewMenu nm
[] = {
3173 {NM_TITLE
, _(MSG_MEN_WANDERER
) },
3174 {NM_ITEM
, _(MSG_MEN_BACKDROP
), _(MSG_MEN_SC_BACKDROP
) , _NewWandIntMenu__OPTION_BACKDROP
, 0, (APTR
) MEN_WANDERER_BACKDROP
},
3175 {NM_ITEM
, _(MSG_MEN_EXECUTE
), _(MSG_MEN_SC_EXECUTE
) , 0 , 0, (APTR
) MEN_WANDERER_EXECUTE
},
3176 {NM_ITEM
, _(MSG_MEN_SHELL
), _(MSG_MEN_SC_SHELL
) , 0 , 0, (APTR
) MEN_WANDERER_SHELL
},
3177 #if defined(__AROS__)
3179 {NM_SUB
, _(MSG_MEN_ABOUT
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_AROS_ABOUT
},
3180 {NM_SUB
, _(MSG_MEN_GUISET
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_AROS_GUISETTINGS
},
3182 {NM_ITEM
, _(MSG_MEN_ABOUT
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_ABOUT
},
3183 {NM_ITEM
, _(MSG_MEN_QUIT
) , _(MSG_MEN_SC_QUIT
) , 0 , 0, (APTR
) MEN_WANDERER_QUIT
},
3184 {NM_ITEM
, _(MSG_MEN_SHUTDOWN
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_SHUTDOWN
},
3185 {NM_TITLE
, _(MSG_MEN_WINDOW
), NULL
, 0 },
3186 {NM_ITEM
, _(MSG_MEN_UPDATE
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_UPDATE
},
3187 {NM_ITEM
, NM_BARLABEL
},
3188 {NM_ITEM
, _(MSG_MEN_CONTENTS
), _(MSG_MEN_SC_CONTENTS
) , 0 , 0, (APTR
) MEN_WINDOW_SELECT
},
3189 {NM_ITEM
, _(MSG_MEN_CLRSEL
), _(MSG_MEN_SC_CLRSEL
) , 0 , 0, (APTR
) MEN_WINDOW_CLEAR
},
3190 {NM_ITEM
, NM_BARLABEL
},
3191 {NM_ITEM
, _(MSG_MEN_SNAPSHT
) },
3192 {NM_SUB
, _(MSG_MEN_WINDOW
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_SNAP_WIN
},
3193 {NM_SUB
, _(MSG_MEN_ALL
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_SNAP_ALL
},
3194 {NM_ITEM
, NM_BARLABEL
},
3195 {NM_ITEM
, _(MSG_MEN_VIEW
) },
3196 {NM_SUB
, _(MSG_MEN_ICVIEW
), NULL
, CHECKIT
|CHECKED
, ~((1 << 0)|(1 << 3)), (APTR
) MEN_WINDOW_VIEW_ICON
},
3197 {NM_SUB
, _(MSG_MEN_DCVIEW
), NULL
, CHECKIT
|NM_ITEMDISABLED
, ~((1 << 1)|(1 << 3)), (APTR
) MEN_WINDOW_VIEW_DETAIL
},
3198 {NM_SUB
, NM_BARLABEL
},
3199 {NM_SUB
, _(MSG_MEN_ALLFIL
), NULL
, _NewWandIntMenu__OPTION_SHOWALL
|NM_ITEMDISABLED
, 0, (APTR
) MEN_WINDOW_VIEW_ALL
},
3200 {NM_ITEM
, _(MSG_MEN_SORTIC
) },
3201 {NM_SUB
, _(MSG_MEN_CLNUP
), _(MSG_MEN_SC_CLNUP
) , 0 , 0, (APTR
) MEN_WINDOW_SORT_NOW
},
3202 {NM_SUB
, _(MSG_MEN_ICONSORTING
), NULL
, CHECKIT
|MENUTOGGLE
|CHECKED
|NM_ITEMDISABLED
, 0, (APTR
) MEN_WINDOW_SORT_ENABLE
},
3203 {NM_SUB
, NM_BARLABEL
},
3204 {NM_SUB
, _(MSG_MEN_BYNAME
), NULL
, CHECKIT
, ~((1 << 3)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_NAME
},
3205 {NM_SUB
, _(MSG_MEN_BYDATE
), NULL
, CHECKIT
, ~((1 << 4)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_DATE
},
3206 {NM_SUB
, _(MSG_MEN_BYSIZE
), NULL
, CHECKIT
, ~((1 << 5)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_SIZE
},
3207 {NM_SUB
, _(MSG_MEN_BYTYPE
), NULL
, CHECKIT
, ~((1 << 6)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_TYPE
},
3208 {NM_SUB
, NM_BARLABEL
},
3209 {NM_SUB
, _(MSG_MEN_REVERSE
), NULL
, CHECKIT
|MENUTOGGLE
, 0, (APTR
) MEN_WINDOW_SORT_REVERSE
},
3210 {NM_SUB
, _(MSG_MEN_DRWFRST
), NULL
, CHECKIT
|MENUTOGGLE
|NM_ITEMDISABLED
, 0, (APTR
) MEN_WINDOW_SORT_TOPDRAWERS
},
3211 {NM_SUB
, _(MSG_MEN_GROUPICONS
), NULL
, CHECKIT
|MENUTOGGLE
|NM_ITEMDISABLED
, 0, (APTR
) MEN_WINDOW_SORT_GROUP
},
3212 {NM_TITLE
, _(MSG_MEN_ICON
), NULL
, 0 },
3213 {NM_ITEM
, _(MSG_MEN_OPEN
), _(MSG_MEN_SC_OPEN
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_OPEN
},
3214 {NM_ITEM
, _(MSG_MEN_CLOSE
) ,"C" , NM_ITEMDISABLED
},
3215 {NM_ITEM
, _(MSG_MEN_RENAME
), _(MSG_MEN_SC_RENAME
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_RENAME
},
3216 {NM_ITEM
, _(MSG_MEN_INFO
), _(MSG_MEN_SC_INFO
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_INFORMATION
},
3217 {NM_ITEM
, _(MSG_SNAPSHOT
), "S" , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_SNAPSHOT
},
3218 {NM_ITEM
, _(MSG_UNSNAPSHOT
), "U" , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_UNSNAPSHOT
},
3219 {NM_ITEM
, _(MSG_LEAVE_OUT
), "L" , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_LEAVEOUT
},
3220 {NM_ITEM
, _(MSG_PUT_AWAY
), "P" , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_PUTAWAY
},
3221 {NM_ITEM
, NM_BARLABEL
},
3222 {NM_ITEM
, _(MSG_MEN_DELETE
), NULL
, NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_DELETE
},
3223 {NM_ITEM
, _(MSG_MEN_FORMAT
), NULL
, NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_FORMAT
},
3224 {NM_ITEM
, _(MSG_EMPTY_TRASH
), NULL
, NM_ITEMDISABLED
},
3225 {NM_TITLE
, _(MSG_MEN_TOOLS
), NULL
, NM_MENUDISABLED
},
3228 _NewWandIntMenu__menustrip
= MUI_MakeObject(MUIO_MenustripNM
, nm
, (IPTR
) NULL
);
3232 struct NewMenu nm
[] = {
3233 {NM_TITLE
, _(MSG_MEN_WANDERER
) },
3234 {NM_ITEM
, _(MSG_MEN_BACKDROP
), _(MSG_MEN_SC_BACKDROP
) , _NewWandIntMenu__OPTION_BACKDROP
, 0, (APTR
) MEN_WANDERER_BACKDROP
},
3235 {NM_ITEM
, _(MSG_MEN_EXECUTE
), _(MSG_MEN_SC_EXECUTE
) , 0 , 0, (APTR
) MEN_WANDERER_EXECUTE
},
3236 {NM_ITEM
, _(MSG_MEN_SHELL
), _(MSG_MEN_SC_SHELL
) , 0 , 0, (APTR
) MEN_WANDERER_SHELL
},
3237 #if defined(__AROS__)
3239 {NM_SUB
, _(MSG_MEN_ABOUT
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_AROS_ABOUT
},
3240 {NM_SUB
, _(MSG_MEN_GUISET
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_AROS_GUISETTINGS
},
3242 {NM_ITEM
, _(MSG_MEN_ABOUT
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_ABOUT
},
3243 {NM_ITEM
, _(MSG_MEN_QUIT
) , _(MSG_MEN_SC_QUIT
) , 0 , 0, (APTR
) MEN_WANDERER_QUIT
},
3244 {NM_ITEM
, _(MSG_MEN_SHUTDOWN
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_SHUTDOWN
},
3245 {NM_TITLE
, _(MSG_MEN_WINDOW
), NULL
, 0 },
3246 {NM_ITEM
, _(MSG_MEN_NEWDRAW
), _(MSG_MEN_SC_NEWDRAW
) , 0 , 0, (APTR
) MEN_WINDOW_NEW_DRAWER
},
3247 {NM_ITEM
, _(MSG_MEN_OPENPAR
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_OPEN_PARENT
},
3248 {NM_ITEM
, _(MSG_MEN_CLOSE
), _(MSG_MEN_SC_CLOSE
) , 0 , 0, (APTR
) MEN_WINDOW_CLOSE
},
3249 {NM_ITEM
, _(MSG_MEN_UPDATE
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_UPDATE
},
3250 {NM_ITEM
, NM_BARLABEL
},
3251 {NM_ITEM
, _(MSG_MEN_CONTENTS
), _(MSG_MEN_SC_CONTENTS
) , 0 , 0, (APTR
) MEN_WINDOW_SELECT
},
3252 {NM_ITEM
, _(MSG_MEN_CLRSEL
), _(MSG_MEN_SC_CLRSEL
) , 0 , 0, (APTR
) MEN_WINDOW_CLEAR
},
3253 {NM_ITEM
, NM_BARLABEL
},
3254 {NM_ITEM
, _(MSG_MEN_SNAPSHT
) },
3255 {NM_SUB
, _(MSG_MEN_WINDOW
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_SNAP_WIN
},
3256 {NM_SUB
, _(MSG_MEN_ALL
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_SNAP_ALL
},
3257 {NM_ITEM
, NM_BARLABEL
},
3258 {NM_ITEM
, _(MSG_MEN_VIEW
)},
3259 {NM_SUB
, _(MSG_MEN_ICVIEW
), NULL
, CHECKIT
|CHECKED
,~((1 << 0)|(1 << 3)), (APTR
) MEN_WINDOW_VIEW_ICON
},
3260 {NM_SUB
, _(MSG_MEN_DCVIEW
), NULL
, CHECKIT
|NM_ITEMDISABLED
,~((1 << 1)|(1 << 3)), (APTR
) MEN_WINDOW_VIEW_DETAIL
},
3261 {NM_SUB
, NM_BARLABEL
},
3262 {NM_SUB
, _(MSG_MEN_ALLFIL
), NULL
, _NewWandIntMenu__OPTION_SHOWALL
, 0, (APTR
) MEN_WINDOW_VIEW_ALL
},
3263 {NM_ITEM
, _(MSG_MEN_SORTIC
)},
3264 {NM_SUB
, _(MSG_MEN_CLNUP
), _(MSG_MEN_SC_CLNUP
) , 0 , 0, (APTR
) MEN_WINDOW_SORT_NOW
},
3265 {NM_SUB
, _(MSG_MEN_ICONSORTING
), NULL
, CHECKIT
|MENUTOGGLE
|CHECKED
, 0, (APTR
) MEN_WINDOW_SORT_ENABLE
},
3266 {NM_SUB
, NM_BARLABEL
},
3267 {NM_SUB
, _(MSG_MEN_BYNAME
), NULL
, CHECKIT
, ~((1 << 3)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_NAME
},
3268 {NM_SUB
, _(MSG_MEN_BYDATE
), NULL
, CHECKIT
, ~((1 << 4)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_DATE
},
3269 {NM_SUB
, _(MSG_MEN_BYSIZE
), NULL
, CHECKIT
, ~((1 << 5)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_SIZE
},
3270 {NM_SUB
, _(MSG_MEN_BYTYPE
), NULL
, CHECKIT
|NM_ITEMDISABLED
, ~((1 << 6)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_TYPE
},
3271 {NM_SUB
, NM_BARLABEL
},
3272 {NM_SUB
, _(MSG_MEN_REVERSE
), NULL
, CHECKIT
|MENUTOGGLE
, 0, (APTR
) MEN_WINDOW_SORT_REVERSE
},
3273 {NM_SUB
, _(MSG_MEN_DRWFRST
), NULL
, CHECKIT
|MENUTOGGLE
|CHECKED
, 0, (APTR
) MEN_WINDOW_SORT_TOPDRAWERS
},
3274 {NM_SUB
, _(MSG_MEN_GROUPICONS
), NULL
, CHECKIT
|MENUTOGGLE
|NM_ITEMDISABLED
, 0, (APTR
) MEN_WINDOW_SORT_GROUP
},
3275 {NM_TITLE
, _(MSG_MEN_ICON
), NULL
, 0 },
3276 {NM_ITEM
, _(MSG_MEN_OPEN
), _(MSG_MEN_SC_OPEN
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_OPEN
},
3277 {NM_ITEM
, _(MSG_MEN_ICONSCLOSE
), "C" , NM_ITEMDISABLED
},
3278 {NM_ITEM
, _(MSG_MEN_RENAME
), _(MSG_MEN_SC_RENAME
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_RENAME
},
3279 {NM_ITEM
, _(MSG_MEN_INFO
), _(MSG_MEN_SC_INFO
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_INFORMATION
},
3280 {NM_ITEM
, _(MSG_SNAPSHOT
), "S" , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_SNAPSHOT
},
3281 {NM_ITEM
, _(MSG_UNSNAPSHOT
), "U" , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_UNSNAPSHOT
},
3282 {NM_ITEM
, _(MSG_LEAVE_OUT
), "L" , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_LEAVEOUT
},
3283 {NM_ITEM
, _(MSG_PUT_AWAY
), "P" , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_PUTAWAY
},
3284 {NM_ITEM
, NM_BARLABEL
},
3285 {NM_ITEM
, _(MSG_MEN_DELETE
), NULL
, NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_DELETE
},
3286 {NM_ITEM
, _(MSG_MEN_FORMAT
), NULL
, NM_ITEMDISABLED
},
3287 {NM_ITEM
, _(MSG_EMPTY_TRASH
), NULL
, NM_ITEMDISABLED
},
3288 {NM_TITLE
, _(MSG_MEN_TOOLS
), NULL
, NM_MENUDISABLED
},
3291 _NewWandIntMenu__menustrip
= MUI_MakeObject(MUIO_MenustripNM
, nm
, (IPTR
) NULL
);
3293 return _NewWandIntMenu__menustrip
;
3297 ///Wanderer__MUIM_Wanderer_CreateDrawerWindow()
3298 Object
*Wanderer__MUIM_Wanderer_CreateDrawerWindow
3300 Class
*CLASS
, Object
*self
,
3301 struct MUIP_Wanderer_CreateDrawerWindow
*message
3304 SETUP_WANDERER_INST_DATA
;
3306 Object
*window
= NULL
;
3307 BOOL isWorkbenchWindow
= FALSE
;
3308 BOOL useBackdrop
= FALSE
;
3309 IPTR TAG_IconWindow_Drawer
;
3311 Object
*_NewWandDrawerMenu__menustrip
;
3313 Object
*window_IconList
= NULL
;
3315 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
3317 if ((isWorkbenchWindow
= (message
->drawer
== NULL
? TRUE
: FALSE
)))
3319 useBackdrop
= data
->wd_Option_BackDropMode
;
3322 TAG_IconWindow_Drawer
= isWorkbenchWindow
? TAG_IGNORE
: MUIA_IconWindow_Location
;
3324 useFont
= (IPTR
)NULL
;
3326 data
->wd_Screen
= LockPubScreen(NULL
);
3328 if(data
->wd_Screen
== NULL
)
3330 D(bug("[Wanderer] %s: Couldn't lock screen!\n", __PRETTY_FUNCTION__
));
3331 CoerceMethod(CLASS
, self
, OM_DISPOSE
);
3334 D(bug("[Wanderer] %s: Using Screen @ %p\n", __PRETTY_FUNCTION__
, data
->wd_Screen
));
3336 if (data
->wd_PrefsIntern
)
3338 useFont
= (IPTR
)((struct WandererInternalPrefsData
*)data
->wd_PrefsIntern
)->WIPD_IconFont
;
3341 _NewWandDrawerMenu__menustrip
= Wanderer__Func_CreateWandererIntuitionMenu (isWorkbenchWindow
, useBackdrop
);
3343 /* Create a new icon drawer window with the correct drawer being set */
3345 window
= (Object
*)IconWindowObject
,
3347 MUIA_Wanderer_Prefs
, (IPTR
)data
->wd_Prefs
,
3348 MUIA_Wanderer_Screen
, (IPTR
)data
->wd_Screen
,
3349 MUIA_Window_ScreenTitle
, (IPTR
)GetUserScreenTitle(data
->wd_Prefs
),
3350 MUIA_Window_Menustrip
, (IPTR
) _NewWandDrawerMenu__menustrip
,
3351 TAG_IconWindow_Drawer
, (IPTR
) message
->drawer
,
3352 MUIA_IconWindow_Font
, useFont
,
3353 MUIA_IconWindow_ActionHook
, (IPTR
) &_WandererIntern_hook_action
,
3354 MUIA_IconWindow_IsRoot
, isWorkbenchWindow
? TRUE
: FALSE
,
3355 isWorkbenchWindow
? MUIA_IconWindow_IsBackdrop
: TAG_IGNORE
, useBackdrop
,
3356 isWorkbenchWindow
? TAG_IGNORE
: MUIA_Wanderer_FileSysNotifyPort
, (IPTR
)data
->wd_NotifyPort
,
3357 isWorkbenchWindow
? TAG_IGNORE
: MUIA_Wanderer_FileSysNotifyList
, (IPTR
)&_WandererIntern_FSHandlerList
,
3358 MUIA_Window_IsSubWindow
, isWorkbenchWindow
? FALSE
: TRUE
,
3361 window
= NewObject(IconWindow_CLASS
->mcc_Class
, NULL
,
3363 MUIA_Wanderer_Prefs
, data
->wd_Prefs
,
3364 MUIA_Wanderer_Screen
, data
->wd_Screen
,
3365 MUIA_Window_ScreenTitle
, GetUserScreenTitle(data
->wd_Prefs
),
3366 MUIA_Window_Menustrip
, (IPTR
) _NewWandDrawerMenu__menustrip
,
3367 TAG_IconWindow_Drawer
, (IPTR
) message
->drawer
,
3368 MUIA_IconWindow_Font
, useFont
,
3369 MUIA_IconWindow_ActionHook
, (IPTR
) &_WandererIntern_hook_action
,
3370 MUIA_IconWindow_IsRoot
, isWorkbenchWindow
? TRUE
: FALSE
,
3371 isWorkbenchWindow
? MUIA_IconWindow_IsBackdrop
: TAG_IGNORE
, useBackdrop
,
3372 isWorkbenchWindow
? TAG_IGNORE
: MUIA_Wanderer_FileSysNotifyPort
, data
->wd_NotifyPort
,
3373 MUIA_Window_IsSubWindow
, isWorkbenchWindow
? FALSE
: TRUE
,
3377 if (data
->wd_Screen
)
3379 D(bug("[Wanderer] %s: Unlocking access to screen @ %p\n", __PRETTY_FUNCTION__
, data
->wd_Screen
));
3380 UnlockPubScreen(NULL
, data
->wd_Screen
);
3385 D(bug("[Wanderer] %s: window != NULL\n", __PRETTY_FUNCTION__
));
3386 /* Get the drawer path back so we can use it also outside this function */
3388 BOOL freeDrwStr
= FALSE
;
3390 if (!isWorkbenchWindow
) drw
= (STRPTR
) XGET(window
, MUIA_IconWindow_Location
);
3393 D(bug("[Wanderer] %s: call AllocVec()\n", __PRETTY_FUNCTION__
));
3394 drw
= AllocVec ( 5, MEMF_CLEAR
);
3395 sprintf ( drw
, "RAM:" );
3399 if (isWorkbenchWindow
)
3401 D(bug("[Wanderer] %s: isWorkbenchWindow\n", __PRETTY_FUNCTION__
));
3404 window
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
3405 (IPTR
)self
, 3, MUIM_CallHook
, (IPTR
)&_WandererIntern_hook_standard
, (IPTR
)wanderer_menufunc_wanderer_quit
3412 window
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
3413 (IPTR
)_app(self
), 4, MUIM_Application_PushMethod
, (IPTR
)window
, 1, MUIM_IconWindow_Remove
3417 D(bug("[Wanderer] %s: call get with MUIA_IconWindow_IconList\n", __PRETTY_FUNCTION__
));
3418 GET(window
, MUIA_IconWindow_IconList
, &window_IconList
);
3420 D(bug("[Wanderer] %s: IconWindows IconList @ %p\n", __PRETTY_FUNCTION__
, window_IconList
));
3422 if (window_IconList
!= NULL
)
3424 struct Hook
*_wand_UpdateMenuStates_hook
= NULL
;
3426 if ((_wand_UpdateMenuStates_hook
= AllocMem(sizeof(struct Hook
), MEMF_CLEAR
|MEMF_PUBLIC
)) != NULL
)
3428 _wand_UpdateMenuStates_hook
->h_Entry
= ( HOOKFUNC
)Wanderer__HookFunc_UpdateMenuStatesFunc
;
3431 window_IconList
, MUIM_Notify
, MUIA_IconList_SelectionChanged
, MUIV_EveryTime
,
3433 MUIM_CallHook
, _wand_UpdateMenuStates_hook
, (IPTR
)window
3436 Wanderer__Func_UpdateMenuStates(window
, window_IconList
);
3438 D(bug("[Wanderer] %s: setup notifications\n", __PRETTY_FUNCTION__
));
3441 window
, MUIM_Notify
, MUIA_Window_Activate
, TRUE
,
3442 (IPTR
)_app(self
), 3, MUIM_Set
, MUIA_Wanderer_ActiveWindow
, (IPTR
) window
3448 window
, MUIM_Notify
, MUIA_IconWindow_IsBackdrop
, MUIV_EveryTime
,
3449 (IPTR
)_app(self
), 5, MUIM_Application_PushMethod
, (IPTR
)_app(self
), 2, MUIM_CallHook
, (IPTR
)&_WandererIntern_hook_backdrop
3454 window
, MUIM_Notify
, MUIA_IconWindow_IsBackdrop
, MUIV_EveryTime
,
3455 (IPTR
)_app(self
), 2, MUIM_CallHook
, (IPTR
) &_WandererIntern_hook_backdrop
3458 D(bug("[Wanderer] %s: execute all notifies\n", __PRETTY_FUNCTION__
));
3459 /* If "Execute Command" entry is clicked open the execute window */
3460 SetMenuDefaultNotifies(self
, _NewWandDrawerMenu__menustrip
, drw
);
3462 D(bug("[Wanderer] %s: add window to app\n", __PRETTY_FUNCTION__
));
3463 /* Add the window to the application */
3465 DoMethod(_app(self
), OM_ADDMEMBER
, (IPTR
) window
);
3467 DoMethod(self
, OM_ADDMEMBER
, (IPTR
) window
);
3469 D(bug("[Wanderer] %s: open window\n", __PRETTY_FUNCTION__
));
3470 /* And now open it */
3471 DoMethod(window
, MUIM_IconWindow_Open
);
3472 D(bug("[Wanderer] %s: clean up memory\n", __PRETTY_FUNCTION__
));
3473 /* Clean up ram string */
3474 if ( freeDrwStr
&& drw
) FreeVec ( drw
);
3476 D(bug("[Wanderer] %s: exit\n", __PRETTY_FUNCTION__
));
3480 /*** Setup ******************************************************************/
3483 Wanderer
, NULL
, MUIC_Application
, NULL
,
3484 OM_NEW
, struct opSet
*,
3486 OM_SET
, struct opSet
*,
3487 OM_GET
, struct opGet
*,
3488 MUIM_Application_Execute
, Msg
,
3489 MUIM_Wanderer_HandleTimer
, Msg
,
3490 MUIM_Wanderer_HandleCommand
, Msg
,
3491 MUIM_Wanderer_HandleNotify
, Msg
,
3492 MUIM_Wanderer_CreateDrawerWindow
, struct MUIP_Wanderer_CreateDrawerWindow
*