2 Copyright © 2004-2018, 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 "filesystems.h"
80 #include "Classes/iconlist.h"
81 #include "Classes/iconlist_attributes.h"
82 #include "Classes/icon_attributes.h"
84 #include "appobjects.h"
92 #define D(x) if (DEBUG) x
94 #define bug DebugPrintF
103 #ifndef NO_ICON_POSITION
104 #define NO_ICON_POSITION (0x8000000) /* belongs to workbench/workbench.h */
107 #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)
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 wanderer_menufunc_window_cleanup(void);
113 void wanderer_menufunc_window_find(void);
114 void execute_open_with_command(BPTR cd
, STRPTR contents
);
115 void DisposeCopyDisplay(struct MUIDisplayObjects
*d
);
116 BOOL
CreateCopyDisplay(UWORD flags
, struct MUIDisplayObjects
*d
);
118 static struct List _WandererIntern_FSHandlerList
;
120 /* Stored in the main wanderer executable */
121 extern Object
*_WandererIntern_AppObj
;
122 extern Class
*_WandererIntern_CLASS
;
125 struct Hook _WandererIntern_hook_standard
;
126 struct Hook _WandererIntern_hook_action
;
127 struct Hook _WandererIntern_hook_backdrop
;
129 struct Hook
*_WandererIntern_hook_standard
;
130 struct Hook
*_WandererIntern_hook_action
;
131 struct Hook
*_WandererIntern_hook_backdrop
;
134 /*** Instance Data **********************************************************/
137 struct Screen
*wd_Screen
;
144 struct MUI_InputHandlerNode wd_TimerIHN
;
145 struct MsgPort
*wd_CommandPort
;
146 struct MUI_InputHandlerNode wd_CommandIHN
;
147 struct MsgPort
*wd_NotifyPort
;
148 struct MUI_InputHandlerNode wd_NotifyIHN
;
150 BOOL wd_Option_BackDropMode
;
153 const UBYTE wand_titlestr
[] = WANDERERSTR
;
154 const UBYTE wand_versionstr
[] = VERSION
;
155 const UBYTE wand_copyrightstr
[] = WANDERERCOPY
;
156 const UBYTE wand_authorstr
[] = WANDERERAUTH
;
157 const UBYTE wand_namestr
[] = WANDERERNAME
;
159 const UBYTE wand_copyprocnamestr
[] = WANDERERNAME
" FileCopy Operation";
161 const UBYTE wand_backdropprefs
[] = "SYS/Wanderer/backdrop.prefs";
163 /*** Macros *****************************************************************/
164 #define SETUP_WANDERER_INST_DATA struct Wanderer_DATA *data = INST_DATA(CLASS, self)
166 /**************************************************************************
168 **************************************************************************/
169 ///Wanderer__HookFunc_DisplayCopyFunc()
173 BOOL
, Wanderer__HookFunc_DisplayCopyFunc
,
174 AROS_UFHA(struct Hook
*, hook
, A0
),
175 AROS_UFHA(struct dCopyStruct
*, obj
, A2
),
176 AROS_UFHA(APTR
, unused_param
, A1
)
180 HOOKPROTO(Wanderer__HookFunc_DisplayCopyFunc
, BOOL
, struct dCopyStruct
*obj
, APTR unused_param
)
185 struct MUIDisplayObjects
*d
= (struct MUIDisplayObjects
*) obj
->userdata
;
187 if ((obj
->flags
& ACTION_UPDATE
) == 0)
191 if ((obj
->filelen
< 8192) && (d
->numfiles
> 0))
194 if (d
->smallobjects
>= 20) d
->smallobjects
= 0;
201 if (d
->smallobjects
> 0)
206 SET(d
->fileObject
, MUIA_Text_Contents
, obj
->file
);
207 SET(d
->sourceObject
, MUIA_Text_Contents
, obj
->spath
);
210 if (d
->action
!= ACTION_DELETE
)
212 d
->bytes
+= obj
->actlen
;
214 if ((obj
->flags
& ACTION_UPDATE
) == 0)
218 SET(d
->gauge
, MUIA_Gauge_Current
, 0);
219 SET(d
->destObject
, MUIA_Text_Contents
, obj
->dpath
);
225 if (d
->updateme
&&(obj
->totallen
<= obj
->filelen
))
227 double rate
= (double) (((double) obj
->totallen
) / (((double) obj
->difftime
) / ((double) CLOCKS_PER_SEC
))) / 1024.0;
228 if (rate
< 1024.0) sprintf(d
->SpeedBuffer
, "%.2f kBytes/s", rate
); else sprintf(d
->SpeedBuffer
, "%.2f MBytes/s", rate
/ 1024.0);
229 SetAttrs(d
->gauge
, MUIA_Gauge_Current
, (ULONG
) (32768.0 * (double) obj
->totallen
/ (double) obj
->filelen
), MUIA_Gauge_InfoText
, d
->SpeedBuffer
, TAG_DONE
);
235 if (d
->bytes
< 1048576)
237 if (obj
->filelen
< 1048576)
240 d
->Buffer
, "%s %ld %s %.2f kBytes %s %.2f kBytes",
241 _(MSG_WANDERER_FILEACCESS_NOOFFILES
), (long)d
->numfiles
, _(MSG_WANDERER_FILEACCESS_ACTUAL
), (double) obj
->filelen
/ 1024.0, _(MSG_WANDERER_FILEACCESS_TOTAL
), (double) d
->bytes
/ 1024.0
247 d
->Buffer
, "%s %ld %s %.2f MBytes %s %.2f kBytes",
248 _(MSG_WANDERER_FILEACCESS_NOOFFILES
), (long)d
->numfiles
, _(MSG_WANDERER_FILEACCESS_ACTUAL
), (double) obj
->filelen
/ 1048576.0, _(MSG_WANDERER_FILEACCESS_TOTAL
), (double) d
->bytes
/ 1024.0
254 if (obj
->filelen
< 1048576)
257 d
->Buffer
, "%s %ld %s %.2f kBytes %s %.2f MBytes",
258 _(MSG_WANDERER_FILEACCESS_NOOFFILES
), (long)d
->numfiles
, _(MSG_WANDERER_FILEACCESS_ACTUAL
), (double) obj
->filelen
/ 1024.0, _(MSG_WANDERER_FILEACCESS_TOTAL
), (double) d
->bytes
/ 1048576.0
264 d
->Buffer
, "%s %ld %s %.2f MBytes %s %.2f MBytes",
265 _(MSG_WANDERER_FILEACCESS_NOOFFILES
), (long)d
->numfiles
, _(MSG_WANDERER_FILEACCESS_ACTUAL
), (double) obj
->filelen
/ 1048576.0, _(MSG_WANDERER_FILEACCESS_TOTAL
), (double) d
->bytes
/ 1048576.0
269 SET(d
->performanceObject
, MUIA_Text_Contents
, d
->Buffer
);
273 DoMethod(d
->copyApp
, MUIM_Application_InputBuffered
);
275 /* read the stopflag and return TRUE if the user wanted to stop actionDir() */
276 if (d
->stopflag
== 1)
284 MakeStaticHook(Hook_DisplayCopyFunc
,Wanderer__HookFunc_DisplayCopyFunc
);
288 ///Wanderer__HookFunc_AskModeFunc()
292 ULONG
, Wanderer__HookFunc_AskModeFunc
,
293 AROS_UFHA(struct Hook
*, hook
, A0
),
294 AROS_UFHA(struct dCopyStruct
*, obj
, A2
),
295 AROS_UFHA(APTR
, unused_param
, A1
)
299 HOOKPROTO(Wanderer__HookFunc_AskModeFunc
, ULONG
, struct dCopyStruct
*obj
, APTR unused_param
)
304 ULONG back
= OPMODE_NONE
;
313 string
= CombineString("%s\n\033b%s\033n\n%s\n\033b%s\033n %s",
314 _(MSG_REQU_DELETE_FILE_S
), obj
->file
, _(MSG_REQU_DELETE_FILE_M
), obj
->spath
, _(MSG_REQU_DELETE_FILE_E
) );
316 else if (obj
->type
== 1)
318 string
= CombineString("%s\n\033b%s\033n\n%s\n\033b%s\033n %s",
319 _(MSG_REQU_FILEUNPROTECT_S
), obj
->file
, _(MSG_REQU_FILEUNPROTECT_M
), obj
->spath
, _(MSG_REQU_FILEUNPROTECT_E
) );
321 else if (obj
->type
== 2)
323 string
= CombineString("%s\n\033b%s\033n\n%s\n\033b%s\033n %s",
324 _(MSG_REQU_OVERWRITE_S
), obj
->file
, _(MSG_REQU_OVERWRITE_M
), obj
->spath
, _(MSG_REQU_OVERWRITE_E
) );
328 string
= CombineString("%s\n\033b%s\033n\n%s\n\033b%s\033n%s",
329 _(MSG_NOFILEACCESS_S
), obj
->file
, _(MSG_NOFILEACCESS_M
), obj
->spath
, _(MSG_NOFILEACCESS_E
) );
334 if (obj
->type
== 0) string
= CombineString("%s \033b%s\033n %s", _(MSG_REQU_DELETE_DRAWER_S
), obj
->spath
, _(MSG_REQU_DELETE_DRAWER_E
) );
335 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
) );
336 else if (obj
->type
== 3) string
= CombineString("%s\n\033b%s %s", _(MSG_NODRAWERACCESS_S
), obj
->spath
, _(MSG_NODRAWERACCESS_E
) );
341 if (obj
->type
== 0) ret
= AskChoiceCentered( _(MSG_REQU_DELETE
), string
, _(MSG_REQU_DELETE_YESNO
), 0);
342 else if (obj
->type
== 1) ret
= AskChoiceCentered( _(MSG_REQU_PROTECTION
), string
, _(MSG_REQU_PROTECTION_UNPROTECT
), 0);
343 else if (obj
->type
== 2) ret
= AskChoiceCentered( _(MSG_REQU_OVERWRITE
), string
, _(MSG_REQU_OVERWRITE_YESNO
), 0);
344 else ret
= AskChoiceCentered( _(MSG_REQU_OVERWRITE
), string
, _(MSG_REQU_OVERWRITE_SKIPABORT
), 0);
345 freeString(NULL
, string
);
348 if (ret
== 0) back
= OPMODE_NONE
;
349 else if (ret
== 1) back
= OPMODE_YES
;
350 else if (ret
== 2) back
= OPMODE_ALL
;
351 else if (ret
== 3) back
= OPMODE_NO
;
358 MakeStaticHook(Hook_AskModeFunc
,Wanderer__HookFunc_AskModeFunc
);
362 ///Wanderer__Func_CopyDropEntries()
363 AROS_UFH3(void, Wanderer__Func_CopyDropEntries
,
364 AROS_UFHA(STRPTR
, argPtr
, A0
),
365 AROS_UFHA(ULONG
, argSize
, D0
),
366 AROS_UFHA(struct ExecBase
*, SysBase
, A6
))
370 struct IconList_Drop_Event
*copyFunc_DropEvent
= FindTask(NULL
)->tc_UserData
;
372 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
374 if (copyFunc_DropEvent
)
376 struct MUIDisplayObjects dobjects
;
377 struct IconList_Drop_SourceEntry
*currententry
;
378 struct OpModes opModes
;
379 ULONG updatedIcons
= 0;
381 opModes
.deletemode
= OPMODE_ASK
;
382 opModes
.protectmode
= OPMODE_ASK
;
383 opModes
.overwritemode
= OPMODE_ASK
;
385 struct Hook displayCopyHook
;
386 struct Hook displayAskHook
;
387 displayCopyHook
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_DisplayCopyFunc
;
388 displayAskHook
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_AskModeFunc
;
389 opModes
.askhook
= &displayAskHook
;
391 struct Hook
*displayCopyHook
;
392 struct Hook
*displayAskHook
;
393 displayCopyHook
= &Hook_DisplayCopyFunc
;
394 displayAskHook
= &Hook_AskModeFunc
;
395 opModes
.askhook
= displayAskHook
;
398 if (CreateCopyDisplay(ACTION_COPY
, &dobjects
))
400 while ((currententry
= (struct IconList_Drop_SourceEntry
*)RemTail(©Func_DropEvent
->drop_SourceList
)) != NULL
)
402 D(bug("[Wanderer] %s: Copying '%s' to '%s'\n", __PRETTY_FUNCTION__
,
403 currententry
->dropse_Node
.ln_Name
, copyFunc_DropEvent
->drop_TargetPath
));
406 currententry
->dropse_Node
.ln_Name
, copyFunc_DropEvent
->drop_TargetPath
,
407 TRUE
, ACTION_COPY
, &displayCopyHook
, &opModes
, (APTR
) &dobjects
);
410 FreeVec(currententry
->dropse_Node
.ln_Name
);
411 FreeMem(currententry
, sizeof(struct IconList_Drop_SourceEntry
));
413 /* delete copy window */
414 DisposeCopyDisplay(&dobjects
);
417 if (updatedIcons
> 0)
419 /* Update state of target object after copying */
420 DoMethod(_app(copyFunc_DropEvent
->drop_TargetObj
), MUIM_Application_PushMethod
,
421 copyFunc_DropEvent
->drop_TargetObj
, 1, MUIM_IconList_Update
);
422 DoMethod(_app(copyFunc_DropEvent
->drop_TargetObj
), MUIM_Application_PushMethod
,
423 copyFunc_DropEvent
->drop_TargetObj
, 1, MUIM_IconList_Sort
);
426 FreeVec(copyFunc_DropEvent
->drop_TargetPath
);
427 FreeMem(copyFunc_DropEvent
, sizeof(struct IconList_Drop_Event
));
435 ///Wanderer__HookFunc_ActionFunc()
439 void, Wanderer__HookFunc_ActionFunc
,
440 AROS_UFHA(struct Hook
*, hook
, A0
),
441 AROS_UFHA(Object
*, obj
, A2
),
442 AROS_UFHA(struct IconWindow_ActionMsg
*, msg
, A1
)
446 HOOKPROTO(Wanderer__HookFunc_ActionFunc
, void, Object
*obj
, struct IconWindow_ActionMsg
*msg
)
451 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
453 if (msg
->type
== ICONWINDOW_ACTION_OPEN
)
455 static unsigned char buf
[1024];
457 struct IconList_Entry
*ent
= (void*)MUIV_IconList_NextIcon_Start
;
459 DoMethod(msg
->iconlist
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&ent
);
460 if ((IPTR
)ent
== (IPTR
)MUIV_IconList_NextIcon_End
)
462 D(bug("[Wanderer] %s: ICONWINDOW_ACTION_OPEN: NextIcon returned MUIV_IconList_NextIcon_TAG_DONE)\n", __PRETTY_FUNCTION__
));
466 D(offset
= strlen(ent
->ile_IconEntry
->ie_IconNode
.ln_Name
) - 5);
468 if ((msg
->isroot
) && (ent
->type
== ST_ROOT
))
470 strcpy((STRPTR
)buf
, ent
->label
);
474 strcpy((STRPTR
)buf
, ent
->ile_IconEntry
->ie_IconNode
.ln_Name
);
477 D(bug("[Wanderer] %s: ICONWINDOW_ACTION_OPEN: offset = %d, buf = %s\n", __PRETTY_FUNCTION__
, offset
, buf
));
479 if ((ent
->type
== ST_ROOT
) || (ent
->type
== ST_USERDIR
) || (ent
->type
== ST_LINKDIR
))
481 Object
*cstate
= (Object
*)(((struct List
*)XGET(_app(obj
), MUIA_Application_WindowList
))->lh_Head
);
482 Object
*prefs
= (Object
*) XGET(_app(obj
), MUIA_Wanderer_Prefs
);
485 /* open new window if root or classic navigation set */
486 if ( (msg
->isroot
) || (XGET(prefs
, MUIA_IconWindow_WindowNavigationMethod
) == WPD_NAVIGATION_CLASSIC
) )
488 /* Check if the window for this drawer is already opened */
489 while ((child
= NextObject(&cstate
)))
491 if (XGET(child
, MUIA_UserData
))
493 STRPTR child_drawer
= (STRPTR
)XGET(child
, MUIA_IconWindow_Location
);
494 if (child_drawer
&& !Stricmp(buf
,(CONST_STRPTR
)child_drawer
))
496 BOOL is_open
= ( BOOL
)XGET(child
, MUIA_Window_Open
);
500 DoMethod(child
, MUIM_IconWindow_Open
);
504 DoMethod(child
, MUIM_Window_ToFront
);
505 SET(child
, MUIA_Window_Activate
, TRUE
);
512 DoMethod(_app(obj
), MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) buf
);
513 // FIXME: error handling
517 /* Open drawer in same window */
518 SET(obj
, MUIA_IconWindow_Location
, (IPTR
) buf
);
521 else if ((ent
->type
== ST_FILE
) || (ent
->type
== ST_LINKFILE
))
526 path
= StrDup(ent
->ile_IconEntry
->ie_IconNode
.ln_Name
);
529 /* Set the CurrentDir to the path of the executable to be started */
532 newwd
= Lock(path
, SHARED_LOCK
);
535 struct IconList_Entry
*ent2
= (void*)MUIV_IconList_NextIcon_Start
;
538 struct TagItem
*argsTagList
= NULL
;
539 Object
*firstWindow
= (Object
*) (((struct List
*)XGET(_app(obj
), MUIA_Application_WindowList
))->lh_Head
);
543 oldwd
= CurrentDir(newwd
);
545 ** If we have more than one icon selected, the first one
546 ** is our command, and the next ones are the arguments.
547 ** We take care of icons selected on other windows.
550 /* Count the selected icons */
551 while ( (windowItem
= NextObject(&firstWindow
)) )
553 iconList
= (Object
*) XGET(windowItem
, MUIA_IconWindow_IconList
);
554 if (iconList
!= NULL
) /* Wanderer has non-iconlist windows as well */
556 ent2
= (void*) MUIV_IconList_NextIcon_Start
;
557 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&ent2
);
560 if ((IPTR
)ent2
!= MUIV_IconList_NextIcon_End
)
562 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&ent2
);
564 while ((IPTR
)ent2
!= MUIV_IconList_NextIcon_End
);
566 } /* while ( (windowItem = NextObject(&firstWindow)) ) */
567 D(bug("[Wanderer] argsCounted = %d\n", argsCounted
));
569 /* If we have arguments, populate argsTagList with them */
570 if ( argsCounted
> 1 ) /* "ent" is selected and has been counted */
573 argsTagList
= AllocateTagItems((argsCounted
* 2) - 1); /* first time for wa_Name, second wa_Lock */
574 firstWindow
= (Object
*) (((struct List
*)XGET(_app(obj
), MUIA_Application_WindowList
))->lh_Head
);
575 while ( (windowItem
= NextObject(&firstWindow
)) )
577 iconList
= (Object
*) XGET(windowItem
, MUIA_IconWindow_IconList
);
578 if (iconList
!= NULL
) /* Wanderer has non-iconlist windows as well */
580 ent2
= (void*) MUIV_IconList_NextIcon_Start
;
581 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&ent2
);
583 while ((IPTR
)ent2
!= MUIV_IconList_NextIcon_End
)
585 if (ent2
->ile_IconEntry
->ie_IconNode
.ln_Name
!= ent
->ile_IconEntry
->ie_IconNode
.ln_Name
)
587 argLock
= Lock(ent2
->ile_IconEntry
->ie_IconNode
.ln_Name
, ACCESS_READ
);
588 argsTagList
[i
].ti_Tag
= WBOPENA_ArgLock
;
589 argsTagList
[i
].ti_Data
= (IPTR
) ParentDir(argLock
);
590 D(bug("[Wanderer] argsTagList[%d]: Lock = %lx\n", i
, argsTagList
[i
].ti_Data
));
592 argsTagList
[++i
].ti_Tag
= WBOPENA_ArgName
;
593 argsTagList
[i
].ti_Data
= (IPTR
) FilePart(ent2
->ile_IconEntry
->ie_IconNode
.ln_Name
);
594 D(bug("[Wanderer] argsTagList[%d]: Name = %s\n", i
, argsTagList
[i
].ti_Data
));
597 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&ent2
);
600 } /* while ( (windowItem = NextObject(&cstate)) ) */
601 argsTagList
[i
].ti_Tag
= TAG_DONE
;
603 ** TODO: the user should be able to select the tool in one window, and some arguments
604 ** in other windows, in that very order. For now Wanderer only handles selected icons
605 ** per window, and so doesn't provide an easy way to know about _all_ selected icons.
606 ** At least we can browse all windows and keep track of all selected icons on each of
607 ** them. But then we don't have a way to know which icon was selected first (which is
608 ** the tool one). The trick for the user is to select first all arguments that aren't
609 ** in the tool's window, and only then select the tool on its window and the last
610 ** arguments in the tool's window, and of course double-click the very last icon.
612 } /* if (argsCounted > 1) */
614 if ( !OpenWorkbenchObjectA(ent
->ile_IconEntry
->ie_IconNode
.ln_Name
, argsTagList
) )
616 execute_open_with_command(newwd
, FilePart(ent
->ile_IconEntry
->ie_IconNode
.ln_Name
));
618 struct TagItem
* tag
= argsTagList
;
619 while ((tag
= FindTagItem(WBOPENA_ArgLock
, tag
)))
621 D(bug("[Wanderer] UnLocking %lx\n", tag
->ti_Data
));
622 UnLock((BPTR
)tag
->ti_Data
);
625 FreeTagItems(argsTagList
); /* FreeTagItems() only frees memory if non NULL */
632 else if (ent
->type
== ILE_TYPE_APPICON
)
634 SendAppIconMessage((struct AppIcon
*)ent
->ile_IconEntry
->ie_User1
, 0, NULL
);
637 else if (msg
->type
== ICONWINDOW_ACTION_DIRUP
)
639 STRPTR actual_drawer
= (STRPTR
)XGET(obj
, MUIA_IconWindow_Location
);
640 STRPTR parent_drawer
= strrchr(actual_drawer
,'/');
641 STRPTR root_drawer
= strrchr(actual_drawer
,':');
643 /* check if dir is not drive root dir */
644 if ( strlen(root_drawer
) > 1 )
646 /* check if second or third level directory*/
649 (*(root_drawer
+1)) = 0;
650 SET(obj
, MUIA_IconWindow_Location
, actual_drawer
);
655 (*parent_drawer
) = 0;
656 SET(obj
, MUIA_IconWindow_Location
, actual_drawer
);
661 else if (msg
->type
== ICONWINDOW_ACTION_CLICK
)
663 if (!msg
->click
->shift
)
665 Object
*cstate
= (Object
*)(((struct List
*)XGET(_app(obj
), MUIA_Application_WindowList
))->lh_Head
);
668 while ((child
= NextObject(&cstate
)))
670 if (XGET(child
, MUIA_UserData
))
672 if (child
!= obj
) DoMethod(child
, MUIM_IconWindow_UnselectAll
);
677 else if (msg
->type
== ICONWINDOW_ACTION_ICONDROP
)
679 struct Process
*wandererCopyProcess
;
680 struct IconList_Drop_Event
*dropevent
= (struct IconList_Drop_Event
*)msg
->drop
;
683 wandererCopyProcess
= CreateNewProcTags(
684 NP_Entry
, (IPTR
)Wanderer__Func_CopyDropEntries
,
685 NP_Name
, (IPTR
)wand_copyprocnamestr
,
686 NP_Synchronous
, FALSE
,
687 NP_UserData
, (IPTR
)dropevent
,
690 if (wandererCopyProcess
== NULL
) {
691 /* TODO: Handle failure to create the copy process */
695 else if (msg
->type
== ICONWINDOW_ACTION_APPWINDOWDROP
)
697 struct Screen
*wscreen
= NULL
;
700 /* get wanderers screen struct and the layer located at cursor position afterwards */
701 get( obj
, MUIA_Window_Screen
, &wscreen
);
702 LockLayerInfo(&wscreen
->LayerInfo
);
703 layer
= WhichLayer(&wscreen
->LayerInfo
,wscreen
->MouseX
,wscreen
->MouseY
);
704 UnlockLayerInfo(&wscreen
->LayerInfo
);
708 struct Window
*win
= (struct Window
*) layer
->Window
;
714 struct IconList_Entry
*ent
;
718 ent
= (void*)MUIV_IconList_NextIcon_Start
;
719 /* process all selected entries */
722 DoMethod(msg
->iconlist
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
) &ent
);
723 /* if not end of selection, process */
724 if ((IPTR
)ent
!= MUIV_IconList_NextIcon_End
)
726 struct AppW
*a
= AllocVec(sizeof(struct AppW
), MEMF_CLEAR
);
729 a
->name
= AllocVec(strlen(ent
->ile_IconEntry
->ie_IconNode
.ln_Name
)+2, MEMF_CLEAR
);
733 strcpy(a
->name
, ent
->ile_IconEntry
->ie_IconNode
.ln_Name
);
734 if((ent
->type
== ST_LINKDIR
) || (ent
->type
== ST_USERDIR
))
736 D(bug("[Wanderer] %s: ent->type=%d\n", __PRETTY_FUNCTION__
, ent
->type
));
737 strcat (a
->name
, "/");
739 AddTail(&AppList
, (struct Node
*) a
);
750 while (((IPTR
)ent
!= MUIV_IconList_NextIcon_End
) && !fail
);
752 if (!fail
&& (files
> 0))
754 STRPTR
*filelist
= AllocVec(sizeof(STRPTR
) * files
, MEMF_CLEAR
);
755 if (filelist
!= NULL
)
757 STRPTR
*flist
= filelist
;
758 if (!IsListEmpty(&AppList
))
761 struct Node
*s
= AppList
.lh_Head
;
762 while (((succ
= ((struct Node
*) s
)->ln_Succ
) != NULL
) && !fail
)
764 *flist
++ = ((struct AppW
*) s
)->name
;
768 D(bug("[Wanderer] %s: win:<%s> first file:<%s> mx=%d my=%d\n", __PRETTY_FUNCTION__
,
769 win
->Title
, *filelist
,
770 wscreen
->MouseX
- win
->LeftEdge
, wscreen
->MouseY
- win
->TopEdge
);)
772 /* send appwindow msg struct containing selected files to destination */
773 SendAppWindowMessage(win
, files
, (char **)filelist
, 0, wscreen
->MouseX
- win
->LeftEdge
, wscreen
->MouseY
- win
->TopEdge
, 0, 0);
779 if (!IsListEmpty(&AppList
))
782 struct Node
*s
= AppList
.lh_Head
;
783 while (((succ
= ((struct Node
*) s
)->ln_Succ
) != NULL
))
785 FreeVec(((struct AppW
*) s
)->name
);
797 MakeStaticHook(Hook_ActionFunc
,Wanderer__HookFunc_ActionFunc
);
801 ///Wanderer__HookFunc_StandardFunc()
805 void, Wanderer__HookFunc_StandardFunc
,
806 AROS_UFHA(struct Hook
*, hook
, A0
),
807 AROS_UFHA(void *, dummy
, A2
),
808 AROS_UFHA(void **, funcptr
, A1
)
812 HOOKPROTO(Wanderer__HookFunc_StandardFunc
, void, void *dummy
, void **funcptr
)
817 void (*func
) (ULONG
*) = (void (*)(ULONG
*)) (*funcptr
);
818 if (func
) func((ULONG
*)(funcptr
+ 1));
823 MakeStaticHook(Hook_StandardFunc
,Wanderer__HookFunc_StandardFunc
);
827 ///Wanderer__HookFunc_BackdropFunc()
831 void, Wanderer__HookFunc_BackdropFunc
,
832 AROS_UFHA(struct Hook
*, hook
, A0
),
833 AROS_UFHA(void *, dummy
, A2
),
834 AROS_UFHA(void **, funcptr
, A1
)
838 HOOKPROTO(Wanderer__HookFunc_BackdropFunc
, void, void *dummy
, void **funcptr
)
843 struct Wanderer_DATA
*data
= INST_DATA(_WandererIntern_CLASS
, _WandererIntern_AppObj
);
844 BOOL wb_iscurrentlybd
;
846 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
848 D(bug("[Wanderer] %s: Private data @ %x\n", __PRETTY_FUNCTION__
, data
));
850 if (!data
->wd_WorkbenchWindow
)
852 D(bug("[Wanderer] %s: No Workbench Window\n", __PRETTY_FUNCTION__
));
856 wb_iscurrentlybd
= (BOOL
)XGET(data
->wd_WorkbenchWindow
, MUIA_IconWindow_IsBackdrop
);
858 if (wb_iscurrentlybd
!= data
->wd_Option_BackDropMode
)
860 BOOL isOpen
= (BOOL
)XGET(data
->wd_WorkbenchWindow
, MUIA_Window_Open
);
861 Object
*win_Active
= NULL
;
863 D(bug("[Wanderer] %s: Backdrop mode change requested!\n", __PRETTY_FUNCTION__
));
864 D(bug("[Wanderer] %s: Disposing of existing Workbench window Obj ..\n", __PRETTY_FUNCTION__
));
866 SET(data
->wd_WorkbenchWindow
, MUIA_Window_Open
, FALSE
);
868 if (data
->wd_WorkbenchWindow
== data
->wd_ActiveWindow
)
870 data
->wd_ActiveWindow
= NULL
;
874 win_Active
= data
->wd_ActiveWindow
;
877 /* Kill our close request notification .. */
880 data
->wd_WorkbenchWindow
, MUIM_KillNotify
, MUIA_Window_CloseRequest
883 /* .. And dispose of the window */
884 DoMethod(_WandererIntern_AppObj
, OM_REMMEMBER
, data
->wd_WorkbenchWindow
);
885 MUI_DisposeObject(data
->wd_WorkbenchWindow
);
886 data
->wd_WorkbenchWindow
= NULL
;
889 if (data
->wd_Option_BackDropMode
)
891 D(bug("[Wanderer] %s: Creating new Workbench window Obj (BACKDROP MODE)..\n", __PRETTY_FUNCTION__
));
895 D(bug("[Wanderer] %s: Creating new Workbench window Obj (NORMAL MODE)..\n", __PRETTY_FUNCTION__
));
898 SetVar(wand_backdropprefs
, data
->wd_Option_BackDropMode
? "True" : "False", -1, GVF_GLOBAL_ONLY
| GVF_SAVE_VAR
);
900 data
->wd_WorkbenchWindow
= (Object
*) DoMethod
902 _WandererIntern_AppObj
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) NULL
905 if ((data
->wd_WorkbenchWindow
) && (isOpen
))
907 D(bug("[Wanderer] %s: Making Workbench window visable..\n", __PRETTY_FUNCTION__
));
908 DoMethod(data
->wd_WorkbenchWindow
, MUIM_IconWindow_Open
);
909 DoMethod(data
->wd_WorkbenchWindow
, MUIM_Window_ToBack
);
914 SET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
, win_Active
);
916 else if (data
->wd_WorkbenchWindow
)
918 SET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
, data
->wd_WorkbenchWindow
);
924 MakeStaticHook(Hook_BackdropFunc
,Wanderer__HookFunc_BackdropFunc
);
927 /******** code from workbench/c/Info.c *******************/
929 static void fmtlarge(UBYTE
*buf
, IPTR num
)
943 if (num
>= 0x40000000)
945 array
.val
= num
>> 30;
946 d
= ((UQUAD
)num
* 100 + 0x20000000) / 0x40000000;
951 else if (num
>= 0x100000)
953 array
.val
= num
>> 20;
954 d
= ((UQUAD
)num
* 100 + 0x80000) / 0x100000;
959 else if (num
>= 0x400)
961 array
.val
= num
>> 10;
962 d
= (num
* 100 + 0x200) / 0x400;
976 if (!array
.dec
&& (d
> array
.val
* 100))
981 RawDoFmt(array
.dec
? "%lu.%02lu" : "%lu", (RAWARG
)&array
, NULL
, buf
);
982 while (*buf
) { buf
++; }
989 STRPTR
GetScreenTitle(VOID
)
991 static TEXT title
[256];
992 UBYTE chip
[14], fast
[14];
995 __availMem
= AvailMem(MEMF_CHIP
);
996 fmtlarge(chip
, __availMem
);
997 __availMem
= AvailMem(MEMF_FAST
);
998 fmtlarge(fast
, __availMem
);
1000 sprintf(title
, _(MSG_SCREENTITLE
), chip
, fast
);
1006 ///GetUserScreenTitle()
1007 STRPTR
GetUserScreenTitle(Object
*self
)
1009 /*Work in progress :-)
1011 char *screentitlestr
= NULL
;
1012 int screentitleleng
;
1014 GET(self
, MUIA_IconWindowExt_ScreenTitle_String
, &screentitlestr
);
1016 if (screentitlestr
== NULL
)
1017 screentitlestr
= "";
1019 screentitleleng
= strlen(screentitlestr
);
1021 if (screentitleleng
<1)
1023 return GetScreenTitle();
1025 return screentitlestr
;
1033 MEN_WANDERER_BACKDROP
,
1034 MEN_WANDERER_EXECUTE
,
1036 MEN_WANDERER_AROS_GUISETTINGS
,
1037 MEN_WANDERER_AROS_ABOUT
,
1040 MEN_WANDERER_SHUTDOWN
,
1042 MEN_WINDOW_NEW_DRAWER
,
1043 MEN_WINDOW_OPEN_PARENT
,
1050 MEN_WINDOW_SNAP_WIN
,
1051 MEN_WINDOW_SNAP_ALL
,
1053 MEN_WINDOW_VIEW_ICON
,
1054 MEN_WINDOW_VIEW_DETAIL
,
1055 MEN_WINDOW_VIEW_ALL
,
1056 MEN_WINDOW_VIEW_HIDDEN
,
1058 MEN_WINDOW_SORT_ENABLE
,
1059 MEN_WINDOW_SORT_NOW
,
1060 MEN_WINDOW_SORT_NAME
,
1061 MEN_WINDOW_SORT_TYPE
,
1062 MEN_WINDOW_SORT_DATE
,
1063 MEN_WINDOW_SORT_SIZE
,
1064 MEN_WINDOW_SORT_REVERSE
,
1065 MEN_WINDOW_SORT_TOPDRAWERS
,
1066 MEN_WINDOW_SORT_GROUP
,
1072 MEN_ICON_INFORMATION
,
1074 MEN_ICON_UNSNAPSHOT
,
1083 ///execute_open_with_command()
1084 /**************************************************************************
1085 Open the execute window. Similar to below but you can also set the
1086 command. Called when item is openend
1087 **************************************************************************/
1088 void execute_open_with_command(BPTR cd
, STRPTR contents
)
1092 if (cd
!=(BPTR
) NULL
) lock
= cd
;
1093 else lock
= Lock("RAM:", ACCESS_READ
);
1097 "WANDERER:Tools/ExecuteCommand",
1098 WBOPENA_ArgLock
, (IPTR
) lock
,
1099 WBOPENA_ArgName
, (IPTR
) contents
,
1103 if (cd
==(BPTR
) NULL
) UnLock(lock
);
1107 ///wanderer_menufunc_wanderer_execute()
1108 /**************************************************************************
1109 Open the execute window
1111 This function will always get the current drawer as argument
1112 **************************************************************************/
1113 VOID
wanderer_menufunc_wanderer_execute(STRPTR
*cdptr
)
1115 //TODO: remove the STRPTR *cdptr from top
1116 //TODO:remove this commented out stuff
1118 //if (cdptr != NULL) lock = Lock(*cdptr, SHARED_LOCK);
1119 Object
*win
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1120 STRPTR dr
= ( STRPTR
)XGET( win
, MUIA_IconWindow_Location
);
1121 BPTR cd
= Lock(dr
,SHARED_LOCK
);
1122 execute_open_with_command(cd
, NULL
);
1125 /*******************************/
1128 ///wanderer_menufunc_wanderer_shell()
1129 void wanderer_menufunc_wanderer_shell(STRPTR
*cd_ptr
)
1131 Object
*win
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1132 STRPTR dr
= ( STRPTR
)XGET( win
, MUIA_IconWindow_Location
);
1140 cd
= Lock(dr
, ACCESS_READ
);
1141 olddir
= CurrentDir(cd
);
1142 Execute("", BNULL
, BNULL
);
1148 ///wanderer_menufunc_wanderer_backdrop()
1149 void wanderer_menufunc_wanderer_backdrop(Object
**pstrip
)
1151 struct Wanderer_DATA
*data
= INST_DATA(_WandererIntern_CLASS
, _WandererIntern_AppObj
);
1152 Object
*strip
= *pstrip
;
1153 Object
*item
= FindMenuitem(strip
, MEN_WANDERER_BACKDROP
);
1155 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1159 data
->wd_Option_BackDropMode
= (BOOL
)XGET(item
, MUIA_Menuitem_Checked
);
1160 SET(data
->wd_WorkbenchWindow
, MUIA_IconWindow_IsBackdrop
, data
->wd_Option_BackDropMode
);
1165 ///wanderer_menufunc_window_find()
1166 void wanderer_menufunc_window_find(void)
1169 Object
*win
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1170 STRPTR dr
= ( STRPTR
)XGET( win
, MUIA_IconWindow_Location
);
1171 Object
*actwindow
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1172 Object
*wbwindow
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_WorkbenchWindow
);
1175 D(bug("[Wanderer]: %s('%s')\n", __PRETTY_FUNCTION__
, dr
));
1177 if (actwindow
== wbwindow
)
1179 /* This check is necessary because WorkbenchWindow has path RAM: */
1180 D(bug("[Wanderer] %s: Can't call WBNewDrawer for WorkbenchWindow\n", __PRETTY_FUNCTION__
));
1183 if ( XGET(actwindow
, MUIA_Window_Open
) == FALSE
)
1185 D(bug("[Wanderer] %s: Can't call WBNewDrawer: the active window isn't open\n", __PRETTY_FUNCTION__
));
1189 lock
= Lock(dr
, ACCESS_READ
);
1195 // WBOPENA_ArgLock, (IPTR) lock,
1196 // WBOPENA_ArgName, 0,
1204 ///wanderer_menufunc_window_newdrawer()
1205 void wanderer_menufunc_window_newdrawer(STRPTR
*cdptr
)
1207 //TODO: remove the STRPTR *cdptr from top
1209 Object
*win
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1210 STRPTR dr
= ( STRPTR
)XGET( win
, MUIA_IconWindow_Location
);
1211 Object
*actwindow
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1212 Object
*wbwindow
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_WorkbenchWindow
);
1215 D(bug("[Wanderer]: %s('%s')\n", __PRETTY_FUNCTION__
, dr
));
1217 if (actwindow
== wbwindow
)
1219 /* This check is necessary because WorkbenchWindow has path RAM: */
1220 D(bug("[Wanderer] %s: Can't call WBNewDrawer for WorkbenchWindow\n", __PRETTY_FUNCTION__
));
1223 if ( XGET(actwindow
, MUIA_Window_Open
) == FALSE
)
1225 D(bug("[Wanderer] %s: Can't call WBNewDrawer: the active window isn't open\n", __PRETTY_FUNCTION__
));
1229 lock
= Lock(dr
, ACCESS_READ
);
1232 "WANDERER:Tools/WBNewDrawer",
1233 WBOPENA_ArgLock
, (IPTR
) lock
,
1241 ///wanderer_menufunc_window_openparent()
1242 void wanderer_menufunc_window_openparent(STRPTR
*cdptr
)
1244 //TODO: Remove the **cdptr stuff from top
1245 Object
*win
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1246 STRPTR dr
= ( STRPTR
)XGET( win
, MUIA_IconWindow_Location
);
1249 STRPTR last_letter
=NULL
;
1254 BOOL foundSlash
, foundColon
;
1257 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1259 last_letter
= &dr
[ strlen(dr
) - 1 ];
1261 thispath
= FilePart(dr
);
1263 if (*last_letter
==0x3a) return; /* Top Drawer has no parent to open */
1265 last_letter
= &thispath
[strlen(thispath
)-1];
1267 if (*last_letter
==0x3a)
1268 path_len
= (IPTR
)(thispath
-(IPTR
)(dr
));
1270 path_len
= (IPTR
)((thispath
-(IPTR
)(dr
))-1);
1272 buf
= AllocVec((path_len
+1),MEMF_PUBLIC
|MEMF_CLEAR
);
1275 CopyMem(dr
, buf
, path_len
);
1277 // Make sure we have a correct path
1278 foundSlash
= FALSE
, foundColon
= FALSE
;
1279 i
= 0; for ( ; i
< path_len
; i
++ )
1281 if ( buf
[ i
] == '/' ) foundSlash
= TRUE
;
1282 if ( buf
[ i
] == ':' ) foundColon
= TRUE
;
1284 if ( !foundColon
&& !foundSlash
)
1286 STRPTR newbuf
= AllocVec ((path_len
+ 2), MEMF_PUBLIC
|MEMF_CLEAR
);
1289 sprintf(newbuf
,"%s:",buf
);
1293 // Done with path correction check
1295 /* Check if window already exists. If so, ensure it's open and brought to the front */
1296 cstate
= (Object
*)(((struct List
*)XGET(_WandererIntern_AppObj
, MUIA_Application_WindowList
))->lh_Head
);
1297 while ((child
= NextObject(&cstate
)))
1299 if (XGET(child
, MUIA_UserData
))
1301 STRPTR child_drawer
= (STRPTR
)XGET(child
, MUIA_IconWindow_Location
);
1302 if (child_drawer
&& !Stricmp(buf
,child_drawer
))
1304 int is_open
= XGET(child
, MUIA_Window_Open
);
1306 DoMethod(child
, MUIM_IconWindow_Open
);
1309 DoMethod(child
, MUIM_Window_ToFront
);
1310 SET(child
, MUIA_Window_Activate
, TRUE
);
1318 /* Open a new window */
1319 DoMethod(_WandererIntern_AppObj
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) buf
);
1324 ///wanderer_menufunc_window_close()
1325 void wanderer_menufunc_window_close()
1327 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1329 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1331 SET(window
, MUIA_Window_CloseRequest
, TRUE
);
1335 ///wanderer_menufunc_window_update()
1336 void wanderer_menufunc_window_update()
1338 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1339 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1340 struct IconList_Entry
*entry
= (APTR
) MUIV_IconList_NextIcon_Start
;
1342 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1344 if (iconList
!= NULL
)
1347 * Reset the ie_Provided[X|Y] to DiskObject values. This will cause all icons to return to their
1348 * snapshoted position or get layouted. This is bahavior only present in this menu action. This is Wanderer
1349 * function, not IconList function, thus the implementation is here.
1353 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Visible
, (IPTR
) &entry
);
1355 if ((IPTR
)entry
!= MUIV_IconList_NextIcon_End
)
1358 LONG x
= NO_ICON_POSITION
, y
= NO_ICON_POSITION
;
1360 if (entry
->ile_IconEntry
->ie_DiskObj
)
1362 x
= entry
->ile_IconEntry
->ie_DiskObj
->do_CurrentX
;
1363 y
= entry
->ile_IconEntry
->ie_DiskObj
->do_CurrentY
;
1366 entry
->ile_IconEntry
->ie_IconX
= x
;
1367 entry
->ile_IconEntry
->ie_IconY
= y
;
1369 DoMethod(iconList
, MUIM_IconList_PropagateEntryPos
, entry
->ile_IconEntry
);
1374 DoMethod(iconList
, MUIM_IconList_Update
);
1375 DoMethod(iconList
, MUIM_IconList_Sort
);
1380 ///wanderer_menufunc_window_cleanup()
1381 void wanderer_menufunc_window_cleanup()
1383 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1384 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1386 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1388 if (iconList
!= NULL
)
1391 * Cleanup ignores all snapshoted / provided positions and re-layouts all icons. To enable this,
1392 * temporarilly set the AutoSort flag. This is Wanderer function, not IconList function, thus the
1393 * implementation is here.
1397 get(iconList
, MUIA_IconList_SortFlags
, &sortFlags
);
1399 if ((sortFlags
& MUIV_IconList_Sort_AutoSort
) == 0)
1401 sortFlags
|= MUIV_IconList_Sort_AutoSort
;
1402 set(iconList
, MUIA_IconList_SortFlags
, sortFlags
);
1404 DoMethod(iconList
, MUIM_IconList_Sort
);
1406 get(iconList
, MUIA_IconList_SortFlags
, &sortFlags
);
1407 sortFlags
&= ~MUIV_IconList_Sort_AutoSort
;
1408 set(iconList
, MUIA_IconList_SortFlags
, sortFlags
);
1412 DoMethod(iconList
, MUIM_IconList_Sort
);
1420 ///wanderer_menufunc_window_clear()
1421 void wanderer_menufunc_window_clear()
1423 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1424 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1426 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1428 if (iconList
!= NULL
)
1430 DoMethod(iconList
, MUIM_IconList_UnselectAll
);
1435 ///wanderer_menufunc_window_select()
1436 void wanderer_menufunc_window_select()
1438 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1439 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1441 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1443 if (iconList
!= NULL
)
1445 DoMethod(iconList
, MUIM_IconList_SelectAll
);
1450 ///wanderer_menufunc_window_snapshot()
1451 void wanderer_menufunc_window_snapshot(IPTR
*flags
)
1453 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1454 BOOL snapshot_all
= *flags
;
1456 DoMethod(window
, MUIM_IconWindow_Snapshot
, snapshot_all
);
1460 ///wanderer_menufunc_window_view_iconsonly(Object **pstrip)
1461 void wanderer_menufunc_window_view_iconsonly(Object
**pstrip
)
1463 Object
*strip
= *pstrip
;
1464 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_VIEW_ALL
);
1465 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1466 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1468 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1470 if ((item
!= NULL
) && (iconList
!= NULL
))
1472 IPTR display_bits
= 0, menu_view_state
= 0;
1473 GET(iconList
, MUIA_IconList_DisplayFlags
, &display_bits
);
1475 GET(item
, MUIA_Menuitem_Checked
, &menu_view_state
);
1477 if (menu_view_state
)
1479 display_bits
&= ~ICONLIST_DISP_SHOWINFO
;
1483 display_bits
|= ICONLIST_DISP_SHOWINFO
;
1486 SET(iconList
, MUIA_IconList_DisplayFlags
, display_bits
);
1487 DoMethod(iconList
, MUIM_IconList_Sort
);
1492 void wanderer_menufunc_window_view_modeicon(Object
**pstrip
)
1494 Object
*strip
= *pstrip
;
1495 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_VIEW_ICON
);
1496 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1497 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1499 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1501 if ((item
!= NULL
) && (iconList
!= NULL
))
1503 IPTR display_bits
= 0, menu_view_state
= 0;
1504 GET(iconList
, MUIA_IconList_DisplayFlags
, &display_bits
);
1506 display_bits
&= ~(ICONLIST_DISP_MODEDEFAULT
| ICONLIST_DISP_MODELABELRIGHT
| ICONLIST_DISP_MODELIST
);
1508 GET(item
, MUIA_Menuitem_Checked
, &menu_view_state
);
1510 if (menu_view_state
== TRUE
)
1512 // if ( != LABELRIGHT)
1513 display_bits
|= ICONLIST_DISP_MODEDEFAULT
;
1515 // display_bits |= ICONLIST_DISP_MODELABELRIGHT;
1518 SET(iconList
, MUIA_IconList_DisplayFlags
, display_bits
);
1519 DoMethod(iconList
, MUIM_IconList_Sort
);
1523 void wanderer_menufunc_window_view_modelist(Object
**pstrip
)
1525 Object
*strip
= *pstrip
;
1526 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_VIEW_DETAIL
);
1527 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1528 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1530 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1532 if ((item
!= NULL
) && (iconList
!= NULL
))
1534 IPTR display_bits
= 0, menu_view_state
= 0;
1535 GET(iconList
, MUIA_IconList_DisplayFlags
, &display_bits
);
1537 display_bits
&= ~(ICONLIST_DISP_MODEDEFAULT
| ICONLIST_DISP_MODELABELRIGHT
| ICONLIST_DISP_MODELIST
);
1539 GET(item
, MUIA_Menuitem_Checked
, &menu_view_state
);
1541 if (menu_view_state
== TRUE
)
1543 display_bits
|= ICONLIST_DISP_MODELIST
;
1546 SET(iconList
, MUIA_IconList_DisplayFlags
, display_bits
);
1547 DoMethod(iconList
, MUIM_IconList_Sort
);
1551 ///wanderer_menufunc_window_view_hidden(Object **pstrip)
1552 void wanderer_menufunc_window_view_hidden(Object
**pstrip
)
1554 Object
*strip
= *pstrip
;
1555 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_VIEW_HIDDEN
);
1556 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1557 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1559 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1561 if ((item
!= NULL
) && (iconList
!= NULL
))
1563 IPTR display_bits
= 0, menu_view_state
= 0;
1564 GET(iconList
, MUIA_IconList_DisplayFlags
, &display_bits
);
1566 GET(item
, MUIA_Menuitem_Checked
, &menu_view_state
);
1568 if (menu_view_state
)
1570 display_bits
|= ICONLIST_DISP_SHOWHIDDEN
;
1574 display_bits
&= ~ICONLIST_DISP_SHOWHIDDEN
;
1577 SET(iconList
, MUIA_IconList_DisplayFlags
, display_bits
);
1578 DoMethod(iconList
, MUIM_IconList_Sort
);
1582 ///wanderer_menufunc_window_sort_enable()
1583 void wanderer_menufunc_window_sort_enable(Object
**pstrip
)
1585 Object
*strip
= *pstrip
;
1586 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_ENABLE
);
1587 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1588 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1590 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1594 if (!XGET(item
, MUIA_Disabled
) && (iconList
!= NULL
))
1598 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1600 if( XGET(item
, MUIA_Menuitem_Checked
) )
1602 sort_bits
&= ~(MUIV_IconList_Sort_Orders
|MUIV_IconList_Sort_Reverse
);
1603 sort_bits
|= MUIV_IconList_Sort_DrawersMixed
;
1604 sort_bits
|= MUIV_IconList_Sort_AutoSort
;
1606 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_DATE
)) != NULL
)
1608 NNSET(item
, MUIA_Disabled
, FALSE
);
1609 if( XGET(item
, MUIA_Menuitem_Checked
) )
1611 sort_bits
|= MUIV_IconList_Sort_ByDate
;
1614 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_SIZE
)) != NULL
)
1616 NNSET(item
, MUIA_Disabled
, FALSE
);
1617 if( XGET(item
, MUIA_Menuitem_Checked
) )
1619 sort_bits
|= MUIV_IconList_Sort_BySize
;
1622 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_TYPE
)) != NULL
)
1624 NNSET(item
, MUIA_Disabled
, FALSE
);
1625 if( XGET(item
, MUIA_Menuitem_Checked
) )
1627 sort_bits
|= MUIV_IconList_Sort_ByType
;
1630 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_NAME
)) != NULL
)
1632 NNSET(item
, MUIA_Disabled
, FALSE
);
1633 if( XGET(item
, MUIA_Menuitem_Checked
) )
1635 sort_bits
|= MUIV_IconList_Sort_ByName
;
1638 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_REVERSE
)) != NULL
)
1640 NNSET(item
, MUIA_Disabled
, FALSE
);
1641 if( XGET(item
, MUIA_Menuitem_Checked
) )
1643 sort_bits
|= MUIV_IconList_Sort_Reverse
;
1646 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_TOPDRAWERS
)) != NULL
)
1648 NNSET(item
, MUIA_Disabled
, FALSE
);
1649 if( XGET(item
, MUIA_Menuitem_Checked
) )
1651 sort_bits
&= ~MUIV_IconList_Sort_DrawersMixed
;
1654 D(bug("[Wanderer] %s: (enable) Setting sort flags %08x\n", __PRETTY_FUNCTION__
, sort_bits
));
1658 sort_bits
&= ~MUIV_IconList_Sort_AutoSort
;
1660 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_DATE
)) != NULL
)
1662 NNSET(item
, MUIA_Disabled
, TRUE
);
1664 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_SIZE
)) != NULL
)
1666 NNSET(item
, MUIA_Disabled
, TRUE
);
1668 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_TYPE
)) != NULL
)
1670 NNSET(item
, MUIA_Disabled
, TRUE
);
1672 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_NAME
)) != NULL
)
1674 NNSET(item
, MUIA_Disabled
, TRUE
);
1676 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_REVERSE
)) != NULL
)
1678 NNSET(item
, MUIA_Disabled
, TRUE
);
1680 if ((item
= FindMenuitem(strip
, MEN_WINDOW_SORT_TOPDRAWERS
)) != NULL
)
1682 NNSET(item
, MUIA_Disabled
, TRUE
);
1684 D(bug("[Wanderer] %s: (disable) Setting sort flags %08x\n", __PRETTY_FUNCTION__
, sort_bits
));
1687 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1688 DoMethod(iconList
, MUIM_IconList_Sort
);
1694 ///wanderer_menufunc_window_sort_name()
1695 void wanderer_menufunc_window_sort_name(Object
**pstrip
)
1697 Object
*strip
= *pstrip
;
1698 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_NAME
);
1699 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1700 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1702 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1704 if (item
!= NULL
&& iconList
!= NULL
)
1706 IPTR sort_bits
= 0, checked
= FALSE
;
1707 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1708 GET(item
, MUIA_Menuitem_Checked
, &checked
);
1710 sort_bits
&= ~MUIV_IconList_Sort_Orders
;
1711 if (checked
== TRUE
)
1713 sort_bits
|= MUIV_IconList_Sort_ByName
;
1715 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1716 DoMethod(iconList
, MUIM_IconList_Sort
);
1721 ///wanderer_menufunc_window_sort_date()
1722 void wanderer_menufunc_window_sort_date(Object
**pstrip
)
1724 Object
*strip
= *pstrip
;
1725 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_DATE
);
1726 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1727 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1729 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1731 if (item
!= NULL
&& iconList
!= NULL
)
1733 IPTR sort_bits
= 0, checked
= FALSE
;
1734 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1735 GET(item
, MUIA_Menuitem_Checked
, &checked
);
1737 sort_bits
&= ~MUIV_IconList_Sort_Orders
;
1738 if (checked
== TRUE
)
1740 sort_bits
|= MUIV_IconList_Sort_ByDate
;
1742 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1743 DoMethod(iconList
, MUIM_IconList_Sort
);
1748 ///wanderer_menufunc_window_sort_size()
1749 void wanderer_menufunc_window_sort_size(Object
**pstrip
)
1751 Object
*strip
= *pstrip
;
1752 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_SIZE
);
1753 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1754 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1756 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1758 if (item
!= NULL
&& iconList
!= NULL
)
1760 IPTR sort_bits
= 0, checked
= FALSE
;
1761 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1762 GET(item
, MUIA_Menuitem_Checked
, &checked
);
1764 D(bug("[Wanderer]: %s: (start) sort flags %08x\n", __PRETTY_FUNCTION__
, sort_bits
));
1765 sort_bits
&= ~MUIV_IconList_Sort_Orders
;
1766 if (checked
== TRUE
)
1768 sort_bits
|= MUIV_IconList_Sort_BySize
;
1770 D(bug("[Wanderer]: %s: (end) sort flags %08x\n", __PRETTY_FUNCTION__
, sort_bits
));
1771 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1772 DoMethod(iconList
, MUIM_IconList_Sort
);
1777 ///wanderer_menufunc_window_sort_type()
1778 void wanderer_menufunc_window_sort_type(Object
**pstrip
)
1780 Object
*strip
= *pstrip
;
1781 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_TYPE
);
1782 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1783 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1785 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1787 if (item
!= NULL
&& iconList
!= NULL
)
1789 IPTR sort_bits
= 0, checked
= FALSE
;
1790 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1791 GET(item
, MUIA_Menuitem_Checked
, &checked
);
1793 sort_bits
&= ~MUIV_IconList_Sort_Orders
;
1794 if (checked
== TRUE
)
1796 sort_bits
|= MUIV_IconList_Sort_ByType
;
1798 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1799 DoMethod(iconList
, MUIM_IconList_Sort
);
1804 ///wanderer_menufunc_window_sort_reverse()
1805 void wanderer_menufunc_window_sort_reverse(Object
**pstrip
)
1807 Object
*strip
= *pstrip
;
1808 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_REVERSE
);
1809 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1810 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1812 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1814 if (item
!= NULL
&& iconList
!= NULL
)
1816 IPTR sort_bits
= 0, checked
= FALSE
;
1817 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1818 GET(item
, MUIA_Menuitem_Checked
, &checked
);
1820 if (checked
== TRUE
)
1822 sort_bits
|= MUIV_IconList_Sort_Reverse
;
1826 sort_bits
&= ~MUIV_IconList_Sort_Reverse
;
1829 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1830 DoMethod(iconList
, MUIM_IconList_Sort
);
1835 ///wanderer_menufunc_window_sort_topdrawers()
1836 void wanderer_menufunc_window_sort_topdrawers(Object
**pstrip
)
1838 Object
*strip
= *pstrip
;
1839 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_TOPDRAWERS
);
1840 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1841 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1843 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
1845 if (item
!= NULL
&& iconList
!= NULL
)
1847 IPTR sort_bits
= 0, checked
= FALSE
;
1848 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1849 GET(item
, MUIA_Menuitem_Checked
, &checked
);
1851 if (checked
== TRUE
)
1853 sort_bits
&= ~MUIV_IconList_Sort_DrawersMixed
;
1857 sort_bits
|= MUIV_IconList_Sort_DrawersMixed
;
1860 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1861 DoMethod(iconList
, MUIM_IconList_Sort
);
1866 ///wanderer_menufunc_icon_open()
1867 void wanderer_menufunc_icon_open()
1869 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1870 DoMethod(window
, MUIM_IconWindow_DoubleClicked
);
1874 ///wanderer_menufunc_icon_rename()
1875 void wanderer_menufunc_icon_rename(void)
1877 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1878 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1879 struct IconList_Entry
*entry
= (APTR
) MUIV_IconList_NextIcon_Start
;
1883 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
) &entry
);
1885 if ((IPTR
)entry
!= MUIV_IconList_NextIcon_End
)
1887 if (entry
->type
== ILE_TYPE_APPICON
)
1888 continue; /* TODO: Implement */
1891 BPTR lock
= Lock(entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, ACCESS_READ
);
1892 BPTR parent
= ParentDir(lock
);
1895 D(bug("[Wanderer] %s: selected = '%s'\n", __PRETTY_FUNCTION__
,
1896 entry
->ile_IconEntry
->ie_IconNode
.ln_Name
));
1900 "WANDERER:Tools/WBRename",
1901 WBOPENA_ArgLock
, (IPTR
) parent
,
1902 WBOPENA_ArgName
, (IPTR
) FilePart(entry
->ile_IconEntry
->ie_IconNode
.ln_Name
),
1906 D(bug("[Wanderer] %s: selected = '%s'\n", __PRETTY_FUNCTION__
,
1907 entry
->ile_IconEntry
->ie_IconNode
.ln_Name
));
1920 ///wanderer_menufunc_icon_information()
1921 void wanderer_menufunc_icon_information()
1923 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1924 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1925 struct IconList_Entry
*entry
= (IPTR
)MUIV_IconList_NextIcon_Start
;
1927 D(bug("[Wanderer] %s: Window @ %p, IconList @ %p\n", __PRETTY_FUNCTION__
, window
, iconList
));
1931 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&entry
);
1933 if ((IPTR
)entry
!= MUIV_IconList_NextIcon_End
)
1935 if (entry
->type
== ILE_TYPE_APPICON
)
1936 continue; /* TODO: Implement */
1942 file
= entry
->ile_IconEntry
->ie_IconNode
.ln_Name
;
1943 D(bug("[Wanderer] %s: selected = '%s'\n", __PRETTY_FUNCTION__
, file
));
1947 D(bug("[Wanderer] %s: Trying with '%s'\n", __PRETTY_FUNCTION__
, file
));
1949 if ((lock
= Lock(file
, ACCESS_READ
)) == BNULL
)
1951 D(bug("[Wanderer] %s: couldnt lock '%s'\n", __PRETTY_FUNCTION__
, file
));
1952 if ((strlen(file
) > 5)
1953 && (strcmp(file
+ strlen(file
) - 5, ".info") != 0)
1954 && (file
[strlen(file
) -1] != ':'))
1956 D(bug("[Wanderer] %s: not a '.info' file or device - check if there is a '.info'..\n",
1957 __PRETTY_FUNCTION__
));
1958 file
= AllocVec(strlen(entry
->ile_IconEntry
->ie_IconNode
.ln_Name
) + 6, MEMF_CLEAR
);
1964 sprintf(file
, "%s.info", entry
->ile_IconEntry
->ie_IconNode
.ln_Name
);
1970 name
= FilePart(file
);
1973 parent
= ParentDir(lock
);
1981 D(bug("[Wanderer] %s: Calling WBInfo(name = '%s' parent lock = 0x%p)\n",
1982 __PRETTY_FUNCTION__
, name
, lock
));
1983 WBInfo(parent
, name
, NULL
);
1987 if (file
!= (STRPTR
)entry
->ile_IconEntry
->ie_IconNode
.ln_Name
)
2001 ///wanderer_menufunc_icon_snapshot()
2002 void wanderer_menufunc_icon_snapshot(IPTR
*flags
)
2004 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
2005 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
2006 struct IconList_Entry
*entry
= (IPTR
)MUIV_IconList_NextIcon_Start
;
2007 struct IconEntry
*node
= NULL
;
2008 BOOL snapshot
= *flags
;
2009 struct TagItem icontags
[] =
2011 { ICONPUTA_OnlyUpdatePosition
, TRUE
},
2015 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
2019 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&entry
);
2021 if ((IPTR
)entry
!= MUIV_IconList_NextIcon_End
)
2023 if (entry
->type
== ILE_TYPE_APPICON
)
2025 struct AppIcon
* ai
= (struct AppIcon
*)entry
->ile_IconEntry
->ie_User1
;
2028 SendAppIconMenuMessage(ai
, AMCLASSICON_Snapshot
);
2030 SendAppIconMenuMessage(ai
, AMCLASSICON_UnSnapshot
);
2036 /* On 3.1 Workbench it is not possible to snapshot an object that does not have icon file. Wanderer in such
2037 * case automatically creates and icon because user explicitly request icon snapshot operation
2038 * (see window snapshoting comment) */
2040 node
= (struct IconEntry
*)((IPTR
)entry
- ((IPTR
)&node
->ie_IconListEntry
- (IPTR
)node
));
2041 D(bug("[Wanderer] %s: %s entry = '%s' @ %p, (%p)\n", __PRETTY_FUNCTION__
,
2042 (snapshot
) ? "SNAPSHOT" : "UNSNAPSHOT", entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, entry
, node
));
2043 if (node
->ie_DiskObj
)
2047 node
->ie_DiskObj
->do_CurrentX
= node
->ie_IconX
;
2048 node
->ie_DiskObj
->do_CurrentY
= node
->ie_IconY
;
2052 node
->ie_DiskObj
->do_CurrentX
= NO_ICON_POSITION
;
2053 node
->ie_DiskObj
->do_CurrentY
= NO_ICON_POSITION
;
2055 if (node
->ie_Flags
& ICONENTRY_FLAG_HASICON
)
2056 PutIconTagList(entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, node
->ie_DiskObj
, icontags
);
2058 PutIconTagList(entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, node
->ie_DiskObj
, TAG_DONE
);
2059 D(bug("[Wanderer] %s: saved ..\n", __PRETTY_FUNCTION__
));
2063 D(bug("[Wanderer] %s: icon has no diskobj!\n", __PRETTY_FUNCTION__
));
2071 D(bug("[Wanderer] %s: finished ..\n", __PRETTY_FUNCTION__
));
2074 static char * get_volume(char * path
)
2076 char * _return
= NULL
;
2077 char * sep
= strchr(path
, ':');
2081 int i
= (int)(sep
- path
);
2082 _return
= AllocVec(i
+ 2, MEMF_CLEAR
);
2083 if (_return
!= NULL
)
2084 CopyMem(path
, _return
, i
+ 1);
2090 #define BDRPLINELEN_MAX 1024
2092 struct DesktopLinkIcon_Entry
2094 struct Node dlie_Node
;
2097 ///wanderer_menufunc_icon_leaveout()
2098 void wanderer_menufunc_icon_leaveout(void)
2100 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
2101 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
2102 Object
*rootwindow
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_WorkbenchWindow
);
2103 Object
*rooticonList
= (Object
*) XGET(rootwindow
, MUIA_IconWindow_IconList
);
2104 struct IconList_Entry
*entry
= (IPTR
)MUIV_IconList_NextIcon_Start
;
2105 // struct IconEntry *node = NULL;
2106 char *leavout_dir
= NULL
;
2107 struct DesktopLinkIcon_Entry
*bdrpeNode
= NULL
, *bdrpeNext
, *loiEntry
= NULL
;
2109 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
2111 GET(window
, MUIA_IconWindow_Location
, &leavout_dir
);
2113 if (leavout_dir
!= NULL
)
2115 D(bug("[Wanderer] %s: dir '%s'\n", __PRETTY_FUNCTION__
, leavout_dir
));
2117 char *entryVolume
= get_volume(leavout_dir
);
2119 if (entryVolume
!= NULL
)
2121 D(bug("[Wanderer] %s: Updating .backdrop file for volume '%s'.. \n", __PRETTY_FUNCTION__
, entryVolume
));
2122 char * bdrp_file
= NULL
;
2124 if ((bdrp_file
= AllocVec(strlen(entryVolume
) + 9 + 1, MEMF_CLEAR
|MEMF_PUBLIC
)) != NULL
)
2126 struct List bdrp_Entries
;
2127 BPTR bdrp_lock
= BNULL
;
2128 BOOL bdrp_changed
= FALSE
;
2129 char *linebuf
= NULL
;
2131 sprintf(bdrp_file
, "%s.backdrop", entryVolume
);
2133 NEWLIST(&bdrp_Entries
);
2135 if ((bdrp_lock
= Open(bdrp_file
, MODE_OLDFILE
)))
2137 D(bug("[Wanderer] %s: Parsing backdrop file: '%s'\n", __PRETTY_FUNCTION__
, bdrp_file
));
2139 if ((linebuf
= AllocMem(BDRPLINELEN_MAX
, MEMF_PUBLIC
)) != NULL
)
2141 while (FGets(bdrp_lock
, linebuf
, BDRPLINELEN_MAX
))
2143 bdrpeNode
= AllocMem(sizeof(struct DesktopLinkIcon_Entry
), MEMF_CLEAR
);
2144 if (bdrpeNode
!= NULL
)
2146 bdrpeNode
->dlie_Node
.ln_Name
= AllocVec(strlen(linebuf
) + 1, MEMF_CLEAR
);
2147 if (bdrpeNode
->dlie_Node
.ln_Name
!= NULL
)
2149 CopyMem(linebuf
, bdrpeNode
->dlie_Node
.ln_Name
, strlen(linebuf
) - 1);
2151 D(bug("[Wanderer] %s: Existing entry '%s'\n", __PRETTY_FUNCTION__
,
2152 bdrpeNode
->dlie_Node
.ln_Name
));
2154 AddTail(&bdrp_Entries
, &bdrpeNode
->dlie_Node
);
2157 FreeMem(bdrpeNode
, sizeof(struct DesktopLinkIcon_Entry
));
2160 FreeMem(linebuf
, BDRPLINELEN_MAX
);
2167 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&entry
);
2169 if (((IPTR
)entry
!= MUIV_IconList_NextIcon_End
) && ((entry
->type
== ST_FILE
) || (entry
->type
== ST_USERDIR
)))
2171 char *entryDIEString
= (entry
->ile_IconEntry
->ie_IconNode
.ln_Name
+ strlen(entryVolume
) - 1);
2172 D(bug("[Wanderer] %s: Leave-Out Entry = '%s' @ %p ('%s')\n", __PRETTY_FUNCTION__
,
2173 entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, entry
, entryDIEString
));
2176 ForeachNode(&bdrp_Entries
, bdrpeNode
)
2179 if (strcmp(bdrpeNode
->dlie_Node
.ln_Name
, entryDIEString
) == 0)
2181 loiEntry
= bdrpeNode
;
2186 if (loiEntry
== NULL
)
2188 bdrpeNode
= AllocMem(sizeof(struct DesktopLinkIcon_Entry
), MEMF_CLEAR
);
2189 if (bdrpeNode
!= NULL
)
2191 bdrpeNode
->dlie_Node
.ln_Name
= AllocVec(strlen(entryDIEString
) + 2, MEMF_CLEAR
);
2192 if (bdrpeNode
->dlie_Node
.ln_Name
!= NULL
)
2194 CopyMem(entryDIEString
, bdrpeNode
->dlie_Node
.ln_Name
, strlen(entryDIEString
));
2196 D(bug("[Wanderer] %s: Created new .backdrop entry for '%s'\n",
2197 __PRETTY_FUNCTION__
, bdrpeNode
->dlie_Node
.ln_Name
));
2199 AddTail(&bdrp_Entries
, &bdrpeNode
->dlie_Node
);
2200 bdrp_changed
= TRUE
;
2203 FreeMem(bdrpeNode
, sizeof(struct DesktopLinkIcon_Entry
));
2215 D(bug("[Wanderer] %s: Updating backdrop file for '%s' ..\n", __PRETTY_FUNCTION__
, entryVolume
));
2216 // Write out the new backdrop file :
2217 // this will cause a filesystem notification in the iconwindow_volumeiconlist
2218 // class that will cause the changes to be noticed if the underlying
2219 // filesystem supports it....
2221 if ((bdrp_lock
= Open(bdrp_file
, MODE_NEWFILE
)))
2223 ForeachNode(&bdrp_Entries
, bdrpeNode
)
2225 D(bug("[Wanderer] %s: Writing entry '%s'\n", __PRETTY_FUNCTION__
,
2226 bdrpeNode
->dlie_Node
.ln_Name
));
2227 bdrpeNode
->dlie_Node
.ln_Name
[strlen(bdrpeNode
->dlie_Node
.ln_Name
)] = '\n';
2228 FPuts(bdrp_lock
, bdrpeNode
->dlie_Node
.ln_Name
);
2232 struct List
*iconList
= NULL
;
2233 struct IconEntry
*entry
= NULL
;
2235 GET(rooticonList
, MUIA_Family_List
, &iconList
);
2236 ForeachNode(iconList
, entry
)
2238 if ((entry
->ie_IconListEntry
.type
== ST_ROOT
)
2239 && (strncmp(entry
->ie_IconListEntry
.label
, entryVolume
, strlen(entry
->ie_IconListEntry
.label
)) == 0))
2241 struct VolumeIcon_Private
*volPrivate
= entry
->ie_IconListEntry
.udata
;;
2242 if (volPrivate
&& (volPrivate
->vip_FSNotifyRequest
.nr_Name
== NULL
))
2244 // Volume's filesystem couldn't handle fs notifications so we will have to force the update...
2245 D(bug("[Wanderer] %s: Forcing desktop redraw for volume '%s'\n",
2246 __PRETTY_FUNCTION__
, entryVolume
));
2247 DoMethod(rooticonList
, MUIM_IconList_Update
);
2248 DoMethod(rooticonList
, MUIM_IconList_Sort
);
2254 ForeachNodeSafe(&bdrp_Entries
, bdrpeNode
, bdrpeNext
)
2256 Remove(&bdrpeNode
->dlie_Node
);
2257 FreeVec(bdrpeNode
->dlie_Node
.ln_Name
);
2258 FreeMem(bdrpeNode
, sizeof(struct DesktopLinkIcon_Entry
));
2262 FreeVec(entryVolume
);
2266 D(bug("[Wanderer] %s: finished ..\n", __PRETTY_FUNCTION__
));
2269 struct PutAwayIcon_Volume
2271 struct Node paiv_Node
;
2272 struct List paiv_Entries
;
2275 ///wanderer_menufunc_icon_putaway()
2276 void wanderer_menufunc_icon_putaway(void)
2278 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
2279 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
2280 Object
*rootwindow
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_WorkbenchWindow
);
2281 Object
*rooticonList
= (Object
*) XGET(rootwindow
, MUIA_IconWindow_IconList
);
2282 struct IconList_Entry
*entry
= (IPTR
)MUIV_IconList_NextIcon_Start
;
2283 struct IconEntry
*node
= NULL
;
2284 struct PutAwayIcon_Volume
*paivNode
= NULL
, *paivNext
, *paiVolume
= NULL
;
2285 struct DesktopLinkIcon_Entry
*bdrpeNode
= NULL
, *paieNode
= NULL
, *paieNext
, *paiEntry
= NULL
;
2286 struct List putawayiconlists
;
2288 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
2290 NEWLIST(&putawayiconlists
);
2294 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&entry
);
2296 if (((IPTR
)entry
!= MUIV_IconList_NextIcon_End
) && ((entry
->type
== ST_LINKFILE
) || (entry
->type
== ST_LINKDIR
)))
2298 node
= (struct IconEntry
*)((IPTR
)entry
- ((IPTR
)&node
->ie_IconListEntry
- (IPTR
)node
));
2299 D(bug("[Wanderer] %s: entry = '%s' @ %p, (%p)\n", __PRETTY_FUNCTION__
,
2300 entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, entry
, node
));
2302 char *entryVolume
= get_volume(entry
->ile_IconEntry
->ie_IconNode
.ln_Name
);
2304 if (entryVolume
== NULL
)
2306 D(bug("[Wanderer] %s: couldnt figure out the volume name.. ?????\n", __PRETTY_FUNCTION__
));
2310 ForeachNode(&putawayiconlists
, paivNode
)
2312 if (strcmp(paivNode
->paiv_Node
.ln_Name
, entryVolume
) == 0)
2314 paiVolume
= paivNode
;
2318 if (paiVolume
== NULL
)
2320 paiVolume
= AllocMem(sizeof(struct PutAwayIcon_Volume
), MEMF_CLEAR
);
2321 if (paiVolume
!= NULL
)
2323 paiVolume
->paiv_Node
.ln_Name
= entryVolume
;
2324 NEWLIST(&paiVolume
->paiv_Entries
);
2325 AddTail(&putawayiconlists
, &paiVolume
->paiv_Node
);
2329 FreeVec(entryVolume
);
2334 FreeVec(entryVolume
);
2337 if (paiVolume
!= NULL
)
2339 paiEntry
= AllocMem(sizeof(struct DesktopLinkIcon_Entry
), MEMF_CLEAR
);
2340 if (paiEntry
!= NULL
)
2342 paiEntry
->dlie_Node
.ln_Name
= entry
->ile_IconEntry
->ie_IconNode
.ln_Name
+ strlen(paiVolume
->paiv_Node
.ln_Name
) - 1;
2343 AddTail(&paiVolume
->paiv_Entries
, &paiEntry
->dlie_Node
);
2347 else if ((IPTR
)entry
== MUIV_IconList_NextIcon_End
)
2353 ForeachNodeSafe(&putawayiconlists
, paivNode
, paivNext
)
2355 // Open the Backdrop file and read in the existing contents...
2356 char *bdrp_file
= NULL
;
2358 D(bug("[Wanderer] %s: Processing entries in .backdrop file for '%s' ..\n", __PRETTY_FUNCTION__
, paivNode
->paiv_Node
.ln_Name
));
2359 if ((bdrp_file
= AllocVec(strlen(paivNode
->paiv_Node
.ln_Name
) + 9 + 1, MEMF_CLEAR
|MEMF_PUBLIC
)) != NULL
)
2361 struct List bdrp_Entries
;
2362 BPTR bdrp_lock
= BNULL
;
2363 BOOL bdrp_changed
= FALSE
;
2364 char *linebuf
= NULL
;
2366 sprintf(bdrp_file
, "%s.backdrop", paivNode
->paiv_Node
.ln_Name
);
2368 NEWLIST(&bdrp_Entries
);
2370 if ((bdrp_lock
= Open(bdrp_file
, MODE_OLDFILE
)))
2372 D(bug("[Wanderer] %s: Parsing backdrop file: '%s'\n", __PRETTY_FUNCTION__
, bdrp_file
));
2374 if ((linebuf
= AllocMem(BDRPLINELEN_MAX
, MEMF_PUBLIC
)) != NULL
)
2376 while (FGets(bdrp_lock
, linebuf
, BDRPLINELEN_MAX
))
2378 bdrpeNode
= AllocMem(sizeof(struct DesktopLinkIcon_Entry
), MEMF_CLEAR
);
2379 if (bdrpeNode
!= NULL
)
2381 bdrpeNode
->dlie_Node
.ln_Name
= AllocVec(strlen(linebuf
) + 1, MEMF_CLEAR
);
2382 if(bdrpeNode
->dlie_Node
.ln_Name
!= NULL
)
2384 CopyMem(linebuf
, bdrpeNode
->dlie_Node
.ln_Name
, strlen(linebuf
) - 1);
2386 D(bug("[Wanderer] %s: Existing entry '%s'\n", __PRETTY_FUNCTION__
,
2387 bdrpeNode
->dlie_Node
.ln_Name
));
2389 AddTail(&bdrp_Entries
, &bdrpeNode
->dlie_Node
);
2395 FreeMem(linebuf
, BDRPLINELEN_MAX
);
2400 ForeachNodeSafe(&paivNode
->paiv_Entries
, paieNode
, paieNext
)
2404 D(bug("[Wanderer] %s: Checking for '%s' ..\n", __PRETTY_FUNCTION__
, paieNode
->dlie_Node
.ln_Name
));
2406 // Find and remove the entry...
2407 ForeachNode(&bdrp_Entries
, bdrpeNode
)
2410 if (strcmp(paieNode
->dlie_Node
.ln_Name
, bdrpeNode
->dlie_Node
.ln_Name
) == 0)
2412 paiEntry
= bdrpeNode
;
2417 if (paiEntry
!= NULL
)
2419 D(bug("[Wanderer] %s: Removing entry '%s'\n", __PRETTY_FUNCTION__
, paiEntry
->dlie_Node
.ln_Name
));
2420 Remove(&paiEntry
->dlie_Node
);
2421 FreeVec(paiEntry
->dlie_Node
.ln_Name
);
2422 FreeMem(paiEntry
, sizeof(struct DesktopLinkIcon_Entry
));
2423 bdrp_changed
= TRUE
;
2425 Remove(&paieNode
->dlie_Node
);
2426 FreeMem(paieNode
, sizeof(struct DesktopLinkIcon_Entry
));
2430 D(bug("[Wanderer] %s: Updating backdrop file for '%s' ..\n", __PRETTY_FUNCTION__
,
2431 paivNode
->paiv_Node
.ln_Name
));
2432 // Write out the new backdrop file :
2433 // this will cause a filesystem notification in the iconwindow_volumeiconlist
2434 // class that will cause the changes to be noticed ....
2435 if ((bdrp_lock
= Open(bdrp_file
, MODE_NEWFILE
)))
2437 ForeachNode(&bdrp_Entries
, bdrpeNode
)
2439 D(bug("[Wanderer] %s: Writing entry '%s'\n", __PRETTY_FUNCTION__
,
2440 bdrpeNode
->dlie_Node
.ln_Name
));
2441 bdrpeNode
->dlie_Node
.ln_Name
[strlen(bdrpeNode
->dlie_Node
.ln_Name
)] = '\n';
2442 FPuts(bdrp_lock
, bdrpeNode
->dlie_Node
.ln_Name
);
2446 struct List
*iconList
= NULL
;
2447 struct IconEntry
*entry
= NULL
;
2449 GET(rooticonList
, MUIA_Family_List
, &iconList
);
2450 ForeachNode(iconList
, entry
)
2452 if ((entry
->ie_IconListEntry
.type
== ST_ROOT
)
2453 && (strncmp(entry
->ie_IconListEntry
.label
, paivNode
->paiv_Node
.ln_Name
, strlen(entry
->ie_IconListEntry
.label
)) == 0))
2455 struct VolumeIcon_Private
*volPrivate
= entry
->ie_IconListEntry
.udata
;;
2456 if (volPrivate
&& (volPrivate
->vip_FSNotifyRequest
.nr_Name
== NULL
))
2458 // Volume's filesystem couldn't handle fs notifications so we will have to force the update...
2459 D(bug("[Wanderer] %s: Forcing desktop redraw for volume '%s'\n", __PRETTY_FUNCTION__
,
2460 paivNode
->paiv_Node
.ln_Name
));
2461 DoMethod(rooticonList
, MUIM_IconList_Update
);
2462 DoMethod(rooticonList
, MUIM_IconList_Sort
);
2468 ForeachNodeSafe(&bdrp_Entries
, bdrpeNode
, paieNext
)
2470 Remove(&bdrpeNode
->dlie_Node
);
2471 FreeVec(bdrpeNode
->dlie_Node
.ln_Name
);
2472 FreeMem(bdrpeNode
, sizeof(struct DesktopLinkIcon_Entry
));
2476 Remove(&paivNode
->paiv_Node
);
2477 FreeVec(paivNode
->paiv_Node
.ln_Name
);
2478 FreeMem(paivNode
, sizeof(struct PutAwayIcon_Volume
));
2480 D(bug("[Wanderer] %s: Finished\n", __PRETTY_FUNCTION__
));
2483 ///DisposeCopyDisplay()
2484 /* dispose the file copy display */
2485 void DisposeCopyDisplay(struct MUIDisplayObjects
*d
)
2489 //SET(d->win,MUIA_Window_Open,FALSE);
2490 MUI_DisposeObject(d
->copyApp
);
2495 ///CreateCopyDisplay()
2496 /* create the file copy window */
2497 BOOL
CreateCopyDisplay(UWORD flags
, struct MUIDisplayObjects
*d
)
2501 Object
*group
, *fromObject
, *toObject
, *fileTextObject
, *fileLengthObject
, *gaugeGroup
;
2503 d
->stopflag
= 0; // will be set to 1 when clicking on stop, than the displayhook can tell actionDir() to stop copy
2507 d
->smallobjects
= 0;
2508 d
->copyApp
= MUI_NewObject(MUIC_Application
,
2509 MUIA_Application_Title
, (IPTR
)wand_copyprocnamestr
,
2510 MUIA_Application_Base
, (IPTR
)"WANDERER_COPY",
2511 MUIA_Application_Copyright
, (IPTR
) wand_copyrightstr
,
2512 MUIA_Application_Author
, (IPTR
) wand_authorstr
,
2513 MUIA_Application_SingleTask
, (IPTR
)FALSE
,
2514 MUIA_Application_Window
, (IPTR
)(d
->win
= MUI_NewObject(MUIC_Window
,
2515 MUIA_Window_Title
, (IPTR
)_(MSG_WANDERER_FILEACCESS
),
2516 MUIA_Window_ID
, (IPTR
)MAKE_ID('W','F','C','R'),
2517 MUIA_Window_Activate
, TRUE
,
2518 MUIA_Window_DepthGadget
, TRUE
,
2519 MUIA_Window_DragBar
, TRUE
,
2520 MUIA_Window_SizeGadget
, TRUE
,
2521 MUIA_Window_AppWindow
, FALSE
,
2522 MUIA_Window_CloseGadget
, FALSE
,
2523 MUIA_Window_Borderless
, FALSE
,
2524 MUIA_Window_TopEdge
, MUIV_Window_TopEdge_Centered
,
2525 MUIA_Window_LeftEdge
, MUIV_Window_LeftEdge_Centered
,
2526 MUIA_Window_Width
, MUIV_Window_Width_Visible(60),
2527 WindowContents
, (group
= MUI_NewObject(MUIC_Group
,
2528 Child
, (IPTR
)(fromObject
= MUI_NewObject(MUIC_Text
,
2530 MUIA_InnerRight
,(8),
2532 MUIA_InnerBottom
,(2),
2533 MUIA_Text_PreParse
, (IPTR
)"\33c",
2535 Child
, (IPTR
)(d
->sourceObject
= MUI_NewObject(MUIC_Text
,
2538 MUIA_InnerRight
,(8),
2540 MUIA_InnerBottom
,(2),
2541 MUIA_Background
, MUII_TextBack
,
2542 MUIA_Text_PreParse
, (IPTR
)"\33c",
2543 MUIA_Text_Contents
, (IPTR
)"---",
2545 Child
, (IPTR
)(toObject
= MUI_NewObject(MUIC_Text
,
2547 MUIA_InnerRight
,(8),
2549 MUIA_InnerBottom
,(2),
2550 MUIA_Text_PreParse
, (IPTR
)"\33c",
2552 Child
, (IPTR
)(d
->destObject
= MUI_NewObject(MUIC_Text
,
2555 MUIA_InnerRight
,(8),
2557 MUIA_InnerBottom
,(2),
2558 MUIA_Background
, MUII_TextBack
,
2559 MUIA_Text_PreParse
, (IPTR
)"\33c",
2560 MUIA_Text_Contents
, (IPTR
)"---",
2562 Child
, (IPTR
)(fileTextObject
= MUI_NewObject(MUIC_Text
,
2564 MUIA_InnerRight
,(8),
2566 MUIA_InnerBottom
,(2),
2567 MUIA_Text_PreParse
, (IPTR
)"\33c",
2569 Child
, (IPTR
)(d
->fileObject
= MUI_NewObject(MUIC_Text
,
2572 MUIA_InnerRight
,(8),
2574 MUIA_InnerBottom
,(2),
2575 MUIA_Background
, MUII_TextBack
,
2576 MUIA_Text_PreParse
, (IPTR
)"\33c",
2577 MUIA_Text_Contents
, (IPTR
)"---",
2579 Child
, (IPTR
)(fileLengthObject
= MUI_NewObject(MUIC_Text
,
2581 MUIA_InnerRight
,(8),
2583 MUIA_InnerBottom
,(2),
2584 MUIA_Text_PreParse
, (IPTR
)"\33c",
2586 Child
, (IPTR
)(gaugeGroup
= MUI_NewObject(MUIC_Group
,
2588 Child
, d
->gauge
= MUI_NewObject(MUIC_Gauge
,
2589 MUIA_Gauge_Horiz
, TRUE
,
2590 MUIA_Gauge_Max
, 32768,
2591 MUIA_Gauge_InfoText
, _(MSG_WANDERER_FILEACCESS_PROCESSING
),
2593 Child
, MUI_NewObject(MUIC_Scale
,
2594 MUIA_Scale_Horiz
, TRUE
,
2597 Child
, (IPTR
)( d
->performanceObject
= MUI_NewObject(MUIC_Text
,
2600 MUIA_InnerRight
,(8),
2602 MUIA_InnerBottom
,(2),
2603 MUIA_Background
, MUII_TextBack
,
2604 MUIA_Text_PreParse
, (IPTR
)"\33c",
2605 MUIA_Text_Contents
, (IPTR
)"...........0 Bytes...........",
2608 Child
, (IPTR
)( d
->stopObject
= SimpleButton( _(MSG_WANDERER_FILEACCESS_STOP
) ) ),
2615 if ((flags
& (ACTION_COPY
|ACTION_DELETE
)) == (ACTION_COPY
|ACTION_DELETE
))
2617 SET(fromObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_MOVEFROM
) );
2618 SET(toObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_MOVETO
) );
2619 SET(fileTextObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_FILE
) );
2620 SET(fileLengthObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_TRAFFIC
) );
2622 else if ((flags
& ACTION_COPY
) == ACTION_COPY
)
2624 SET(fromObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_COPYFROM
) );
2625 SET(toObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_COPYTO
) );
2626 SET(fileTextObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_FILE
) );
2627 SET(fileLengthObject
, MUIA_Text_Contents
, (IPTR
) _(MSG_WANDERER_FILEACCESS_TRAFFIC
) );
2630 else if ((flags
& ACTION_DELETE
) == ACTION_DELETE
)
2632 SET(fromObject
, MUIA_Text_Contents
, _(MSG_WANDERER_FILEACCESS_DELETEFROM
) );
2633 DoMethod(group
, MUIM_Group_InitChange
);
2634 DoMethod(group
, OM_REMMEMBER
, toObject
);
2635 DoMethod(group
, OM_REMMEMBER
, fileLengthObject
);
2636 DoMethod(group
, OM_REMMEMBER
, d
->performanceObject
);
2637 DoMethod(group
, OM_REMMEMBER
, d
->destObject
);
2638 DoMethod(group
, OM_REMMEMBER
, gaugeGroup
);
2639 DoMethod(group
, MUIM_Group_ExitChange
);
2640 SET(fileTextObject
, MUIA_Text_Contents
, _(MSG_WANDERER_FILEACCESS_FILETODELETE
) );
2643 SET(d
->win
,MUIA_Window_Open
,TRUE
);
2644 DoMethod(d
->stopObject
,MUIM_Notify
, MUIA_Pressed
, FALSE
, d
->stopObject
, 3, MUIM_WriteLong
, 1 ,&d
->stopflag
);
2651 ///wanderer_menufunc_icon_delete()
2652 void wanderer_menufunc_icon_delete(void)
2654 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
2655 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
2656 struct IconList_Entry
*entry
= ( void*) MUIV_IconList_NextIcon_Start
;
2657 struct MUIDisplayObjects dobjects
;
2658 struct Hook displayCopyHook
;
2659 struct Hook displayAskHook
;
2660 struct OpModes opModes
;
2663 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
) &entry
);
2664 displayCopyHook
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_DisplayCopyFunc
;
2665 displayAskHook
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_AskModeFunc
;
2666 opModes
.askhook
= &displayAskHook
;
2667 opModes
.deletemode
= OPMODE_ASK
;
2668 opModes
.protectmode
= OPMODE_ASK
;
2669 opModes
.overwritemode
= OPMODE_ASK
;
2673 /* Process all selected entries */
2674 if (CreateCopyDisplay(ACTION_DELETE
, &dobjects
))
2678 if ((IPTR
)entry
!= MUIV_IconList_NextIcon_End
)
2680 if (entry
->type
!= ILE_TYPE_APPICON
)
2682 /* copy via filesystems.c */
2683 D(bug("[Wanderer] Delete \"%s\"\n", entry
->ile_IconEntry
->ie_IconNode
.ln_Name
);)
2684 CopyContent( NULL
, entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, NULL
, TRUE
,
2685 ACTION_DELETE
, &displayCopyHook
, &opModes
, (APTR
) &dobjects
);
2690 SendAppIconMenuMessage((struct AppIcon
*)entry
->ile_IconEntry
->ie_User1
, AMCLASSICON_Delete
);
2693 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
) &entry
);
2695 while ((IPTR
)entry
!= MUIV_IconList_NextIcon_End
);
2696 DisposeCopyDisplay(&dobjects
);
2698 // Only update list if anything happened to the icons!
2699 if ( updatedIcons
> 0 )
2701 DoMethod(window
, MUIM_IconWindow_UnselectAll
);
2702 DoMethod(iconList
, MUIM_IconList_Update
);
2703 DoMethod(iconList
, MUIM_IconList_Sort
);
2708 ///wanderer_menufunc_icon_format()
2709 void wanderer_menufunc_icon_format(void)
2711 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
2712 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
2713 struct IconList_Entry
*entry
= ( void*) MUIV_IconList_NextIcon_Start
;
2715 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
) &entry
);
2717 /* Process only first selected entry */
2718 if ((IPTR
)entry
!= MUIV_IconList_NextIcon_End
)
2720 if (entry
->type
!= ILE_TYPE_APPICON
) /* TODO: Implement */
2722 BPTR lock
= Lock(entry
->ile_IconEntry
->ie_IconNode
.ln_Name
, ACCESS_READ
);
2723 D(bug("[Wanderer]: %s('%s')\n", __PRETTY_FUNCTION__
, entry
->ile_IconEntry
->ie_IconNode
.ln_Name
));
2724 /* Usually we pass object name and parent lock. Here we do the same thing.
2725 Just object name is empty string and its parent is device's root. */
2728 "SYS:System/Format",
2729 WBOPENA_ArgLock
, (IPTR
) lock
,
2730 WBOPENA_ArgName
, lock
? (IPTR
)"" : (IPTR
)entry
->ile_IconEntry
->ie_IconNode
.ln_Name
,
2740 ///wanderer_menufunc_icon_emptytrash
2741 void wanderer_menufunc_icon_emptytrash(void)
2743 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
2744 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
2745 struct IconList_Entry
*entry
= ( void*) MUIV_IconList_NextIcon_Start
;
2747 D(bug("[Wanderer]: %s\n", __PRETTY_FUNCTION__
));
2749 DoMethod(iconList
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
) &entry
);
2751 /* Process only first selected entry */
2752 if ((IPTR
)entry
!= MUIV_IconList_NextIcon_End
)
2754 if (entry
->type
== ILE_TYPE_APPICON
)
2756 struct AppIcon
*ai
= (struct AppIcon
*)entry
->ile_IconEntry
->ie_User1
;
2757 SendAppIconMenuMessage(ai
, AMCLASSICON_EmptyTrash
);
2761 // TODO: Implement for icons(!=ILE_TYPE_APPICON) of disks having a trashcan
2768 ///wanderer_menufunc_wanderer_AROS_guisettings()
2769 void wanderer_menufunc_wanderer_AROS_guisettings(void)
2771 //DoMethod(_WandererIntern_AppObj, MUIM_Application_OpenConfigWindow);
2772 OpenWorkbenchObject("SYS:Prefs/Zune",
2773 WBOPENA_ArgName
, (IPTR
) "WANDERER",
2778 ///wanderer_menufunc_wanderer_AROS_about()
2779 void wanderer_menufunc_wanderer_AROS_about(void)
2781 OpenWorkbenchObject("SYS:System/About",
2786 ///wanderer_menufunc_wanderer_about()
2787 void wanderer_menufunc_wanderer_about(Object
**pwand
)
2789 Object
*self
= *pwand
;
2790 Class
*CLASS
= _WandererIntern_CLASS
;
2791 SETUP_WANDERER_INST_DATA
;
2793 /* Display Information about this version of wanderer */
2794 if (data
->wd_AboutWindow
== NULL
)
2796 data
->wd_AboutWindow
= WindowObject
,
2797 MUIA_Window_Title
, (IPTR
)"About Wanderer...",
2798 MUIA_Window_ID
, (IPTR
)MAKE_ID('W','A','B','T'),
2799 WindowContents
, (IPTR
)VGroup
,
2800 Child
, (IPTR
)HGroup
,
2801 Child
, (IPTR
) IconImageObject
,
2802 MUIA_InputMode
, MUIV_InputMode_Toggle
,
2803 MUIA_IconImage_File
, (IPTR
)"PROGDIR:Wanderer",
2805 Child
, (IPTR
)VGroup
,
2806 Child
, (IPTR
)TextObject
,
2807 MUIA_Text_PreParse
, (IPTR
)"\33c\33b",
2808 MUIA_Text_Contents
, (IPTR
)wand_titlestr
,
2810 Child
, (IPTR
)TextObject
,
2811 MUIA_Text_PreParse
, (IPTR
)"\33c",
2812 MUIA_Text_Contents
, (IPTR
)wand_copyrightstr
,
2817 Child
, (IPTR
)VGroup
,
2818 MUIA_Frame
, MUIV_Frame_Group
,
2819 Child
, (IPTR
)TextObject
,
2820 MUIA_Text_PreParse
, (IPTR
)"\33b",
2821 MUIA_Text_Contents
, (IPTR
)"Internal Classes:",
2823 Child
, (IPTR
)HVSpace
,
2824 Child
, (IPTR
)ColGroup(2),
2825 Child
, (IPTR
)TextObject
,
2826 MUIA_Text_Contents
, (IPTR
)"IconWindow",
2828 Child
, (IPTR
)TextObject
,
2829 MUIA_Text_Contents
, (IPTR
)"",
2831 Child
, (IPTR
)TextObject
,
2832 MUIA_Text_Contents
, (IPTR
)"IconWindowVolumeList",
2834 Child
, (IPTR
)TextObject
,
2835 MUIA_Text_Contents
, (IPTR
)"",
2837 Child
, (IPTR
)TextObject
,
2838 MUIA_Text_Contents
, (IPTR
)"IconWindowDrawerList",
2840 Child
, (IPTR
)TextObject
,
2841 MUIA_Text_Contents
, (IPTR
)"",
2844 Child
, (IPTR
)HVSpace
,
2845 Child
, (IPTR
)TextObject
,
2846 MUIA_Text_PreParse
, (IPTR
)"\33b",
2847 MUIA_Text_Contents
, (IPTR
)"External Classes:",
2849 Child
, (IPTR
)HVSpace
,
2850 Child
, (IPTR
)ColGroup(2),
2851 Child
, (IPTR
)TextObject
,
2852 MUIA_Text_Contents
, (IPTR
)"IconList.mui",
2854 Child
, (IPTR
)TextObject
,
2855 MUIA_Text_Contents
, (IPTR
)"",
2857 Child
, (IPTR
)TextObject
,
2858 MUIA_Text_Contents
, (IPTR
)"IconListView.mui",
2860 Child
, (IPTR
)TextObject
,
2861 MUIA_Text_Contents
, (IPTR
)"",
2863 Child
, (IPTR
)TextObject
,
2864 MUIA_Text_Contents
, (IPTR
)"IconVolumeList.mui",
2866 Child
, (IPTR
)TextObject
,
2867 MUIA_Text_Contents
, (IPTR
)"",
2869 Child
, (IPTR
)TextObject
,
2870 MUIA_Text_Contents
, (IPTR
)"IconDrawerList.mui",
2872 Child
, (IPTR
)TextObject
,
2873 MUIA_Text_Contents
, (IPTR
)"",
2876 Child
, (IPTR
)HVSpace
,
2882 DoMethod(_app(self
), OM_ADDMEMBER
, (IPTR
) data
->wd_AboutWindow
);
2884 DoMethod(self
, OM_ADDMEMBER
, (IPTR
) data
->wd_AboutWindow
);
2888 data
->wd_AboutWindow
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
2889 (IPTR
)data
->wd_AboutWindow
, 3, MUIM_Set
, MUIA_Window_Open
, FALSE
2893 if (data
->wd_AboutWindow
)
2895 IPTR isOpen
= (IPTR
)FALSE
;
2896 GET(data
->wd_AboutWindow
, MUIA_Window_Open
, &isOpen
);
2905 SET(data
->wd_AboutWindow
, MUIA_Window_Open
, isOpen
);
2910 ///wanderer_menufunc_wanderer_quit()
2911 void wanderer_menufunc_wanderer_quit(void)
2913 if (OpenWorkbenchObject("WANDERER:Tools/Quit", TAG_DONE
))
2919 if (MUI_RequestA(_WandererIntern_AppObj
, NULL
, 0, wand_namestr
, _(MSG_YESNO
), _(MSG_REALLYQUIT
), NULL
))
2920 DoMethod(_WandererIntern_AppObj
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
2926 ///wanderer_menufunc_wanderer_shutdown()
2927 void wanderer_menufunc_wanderer_shutdown(void)
2931 action
= MUI_RequestA(_WandererIntern_AppObj
, NULL
, 0,
2932 _(MSG_SHUTDOWN_TITLE
), _(MSG_SHUTDOWN_BUTTONS
),
2933 _(MSG_SHUTDOWN_BODY
), NULL
);
2938 ShutdownA(SD_ACTION_POWEROFF
);
2941 ShutdownA(SD_ACTION_COLDREBOOT
);
2946 MUI_RequestA(_WandererIntern_AppObj
, NULL
, 0, _(MSG_SHUTDOWN_TITLE
), _(MSG_OK
), _(MSG_ACTION_NOT_SUPPORTED
), NULL
);
2952 /**************************************************************************
2953 This function returns a Menu Object with the given id
2954 **************************************************************************/
2955 Object
*FindMenuitem(Object
* strip
, int id
)
2957 return (Object
*)DoMethod(strip
, MUIM_FindUData
, id
);
2962 /**************************************************************************
2963 This connects a notify to the given menu entry id
2964 **************************************************************************/
2965 VOID
DoMenuNotify(Object
* strip
, int id
, IPTR trigattrib
, void *function
, void *arg
)
2968 entry
= FindMenuitem(strip
,id
);
2973 entry
, MUIM_Notify
, trigattrib
, MUIV_EveryTime
,
2974 (IPTR
) entry
, 4, MUIM_CallHook
, (IPTR
) &_WandererIntern_hook_standard
,
2975 (IPTR
) function
, (IPTR
) arg
2981 ///SetMenuDefaultNotifies()
2982 VOID
SetMenuDefaultNotifies(Object
*wanderer
, Object
*strip
, STRPTR path
)
2988 DoMenuNotify(strip
, MEN_WANDERER_EXECUTE
, MUIA_Menuitem_Trigger
,
2989 wanderer_menufunc_wanderer_execute
, path
);
2990 DoMenuNotify(strip
, MEN_WANDERER_SHELL
, MUIA_Menuitem_Trigger
,
2991 wanderer_menufunc_wanderer_shell
, path
);
2992 DoMenuNotify(strip
, MEN_WANDERER_AROS_GUISETTINGS
, MUIA_Menuitem_Trigger
,
2993 wanderer_menufunc_wanderer_AROS_guisettings
, NULL
);
2994 DoMenuNotify(strip
, MEN_WANDERER_AROS_ABOUT
, MUIA_Menuitem_Trigger
,
2995 wanderer_menufunc_wanderer_AROS_about
, NULL
);
2996 DoMenuNotify(strip
, MEN_WANDERER_ABOUT
, MUIA_Menuitem_Trigger
,
2997 wanderer_menufunc_wanderer_about
, wanderer
);
2998 DoMenuNotify(strip
, MEN_WANDERER_QUIT
, MUIA_Menuitem_Trigger
,
2999 wanderer_menufunc_wanderer_quit
, NULL
);
3000 DoMenuNotify(strip
, MEN_WANDERER_SHUTDOWN
, MUIA_Menuitem_Trigger
,
3001 wanderer_menufunc_wanderer_shutdown
, NULL
);
3003 DoMenuNotify(strip
, MEN_WINDOW_NEW_DRAWER
, MUIA_Menuitem_Trigger
,
3004 wanderer_menufunc_window_newdrawer
, path
);
3005 DoMenuNotify(strip
, MEN_WINDOW_OPEN_PARENT
, MUIA_Menuitem_Trigger
,
3006 wanderer_menufunc_window_openparent
, path
);
3007 DoMenuNotify(strip
, MEN_WINDOW_CLOSE
, MUIA_Menuitem_Trigger
,
3008 wanderer_menufunc_window_close
, NULL
);
3009 DoMenuNotify(strip
, MEN_WINDOW_UPDATE
, MUIA_Menuitem_Trigger
,
3010 wanderer_menufunc_window_update
, NULL
);
3011 DoMenuNotify(strip
, MEN_WINDOW_CLEAR
, MUIA_Menuitem_Trigger
,
3012 wanderer_menufunc_window_clear
, NULL
);
3014 DoMenuNotify(strip
, MEN_WINDOW_SNAP_WIN
, MUIA_Menuitem_Trigger
,
3015 wanderer_menufunc_window_snapshot
, FALSE
);
3016 DoMenuNotify(strip
, MEN_WINDOW_SNAP_ALL
, MUIA_Menuitem_Trigger
,
3017 wanderer_menufunc_window_snapshot
, (APTR
)TRUE
);
3019 DoMenuNotify(strip
, MEN_WINDOW_SELECT
, MUIA_Menuitem_Trigger
,
3020 wanderer_menufunc_window_select
, NULL
);
3022 DoMenuNotify(strip
, MEN_WINDOW_VIEW_ICON
, MUIA_Menuitem_Trigger
,
3023 wanderer_menufunc_window_view_modeicon
, strip
);
3024 DoMenuNotify(strip
, MEN_WINDOW_VIEW_DETAIL
, MUIA_Menuitem_Trigger
,
3025 wanderer_menufunc_window_view_modelist
, strip
);
3026 DoMenuNotify(strip
, MEN_WINDOW_VIEW_ALL
, MUIA_Menuitem_Trigger
,
3027 wanderer_menufunc_window_view_iconsonly
, strip
);
3028 // DoMenuNotify(strip, MEN_WINDOW_VIEW_HIDDEN, MUIA_Menuitem_Trigger,
3029 // wanderer_menufunc_window_view_hidden, strip);
3032 DoMenuNotify(strip
, MEN_WINDOW_SORT_NOW
, MUIA_Menuitem_Trigger
,
3033 wanderer_menufunc_window_cleanup
, NULL
);
3034 DoMenuNotify(strip
, MEN_WINDOW_SORT_ENABLE
, MUIA_Menuitem_Trigger
,
3035 wanderer_menufunc_window_sort_enable
, strip
);
3036 DoMenuNotify(strip
, MEN_WINDOW_SORT_NAME
, MUIA_Menuitem_Trigger
,
3037 wanderer_menufunc_window_sort_name
, strip
);
3038 DoMenuNotify(strip
, MEN_WINDOW_SORT_TYPE
, MUIA_Menuitem_Trigger
,
3039 wanderer_menufunc_window_sort_type
, strip
);
3040 DoMenuNotify(strip
, MEN_WINDOW_SORT_DATE
, MUIA_Menuitem_Trigger
,
3041 wanderer_menufunc_window_sort_date
, strip
);
3042 DoMenuNotify(strip
, MEN_WINDOW_SORT_SIZE
, MUIA_Menuitem_Trigger
,
3043 wanderer_menufunc_window_sort_size
, strip
);
3044 DoMenuNotify(strip
, MEN_WINDOW_SORT_REVERSE
, MUIA_Menuitem_Trigger
,
3045 wanderer_menufunc_window_sort_reverse
, strip
);
3046 DoMenuNotify(strip
, MEN_WINDOW_SORT_TOPDRAWERS
, MUIA_Menuitem_Trigger
,
3047 wanderer_menufunc_window_sort_topdrawers
, strip
);
3049 DoMenuNotify(strip
, MEN_WINDOW_FIND
, MUIA_Menuitem_Trigger
,
3050 wanderer_menufunc_window_find
, strip
);
3052 DoMenuNotify(strip
, MEN_ICON_OPEN
, MUIA_Menuitem_Trigger
,
3053 wanderer_menufunc_icon_open
, NULL
);
3054 DoMenuNotify(strip
, MEN_ICON_RENAME
, MUIA_Menuitem_Trigger
,
3055 wanderer_menufunc_icon_rename
, NULL
);
3056 DoMenuNotify(strip
, MEN_ICON_INFORMATION
, MUIA_Menuitem_Trigger
,
3057 wanderer_menufunc_icon_information
, NULL
);
3058 DoMenuNotify(strip
, MEN_ICON_SNAPSHOT
, MUIA_Menuitem_Trigger
,
3059 wanderer_menufunc_icon_snapshot
, (APTR
)TRUE
);
3060 DoMenuNotify(strip
, MEN_ICON_UNSNAPSHOT
, MUIA_Menuitem_Trigger
,
3061 wanderer_menufunc_icon_snapshot
, FALSE
);
3062 DoMenuNotify(strip
, MEN_ICON_LEAVEOUT
, MUIA_Menuitem_Trigger
,
3063 wanderer_menufunc_icon_leaveout
, NULL
);
3064 DoMenuNotify(strip
, MEN_ICON_PUTAWAY
, MUIA_Menuitem_Trigger
,
3065 wanderer_menufunc_icon_putaway
, NULL
);
3066 DoMenuNotify(strip
, MEN_ICON_DELETE
, MUIA_Menuitem_Trigger
,
3067 wanderer_menufunc_icon_delete
, NULL
);
3068 DoMenuNotify(strip
, MEN_ICON_FORMAT
, MUIA_Menuitem_Trigger
,
3069 wanderer_menufunc_icon_format
, NULL
);
3070 DoMenuNotify(strip
, MEN_ICON_EMPTYTRASH
, MUIA_Menuitem_Trigger
,
3071 wanderer_menufunc_icon_emptytrash
, NULL
);
3073 if ((item
= FindMenuitem(strip
, MEN_WANDERER_BACKDROP
)))
3077 item
, MUIM_Notify
, MUIA_Menuitem_Trigger
, MUIV_EveryTime
,
3078 (IPTR
) _WandererIntern_AppObj
, 7, MUIM_Application_PushMethod
,
3079 (IPTR
) _WandererIntern_AppObj
, 4, MUIM_CallHook
, (IPTR
) &_WandererIntern_hook_standard
,
3080 (IPTR
) wanderer_menufunc_wanderer_backdrop
, (IPTR
) strip
3086 #define MENF_ICON_OPEN (1 << 0)
3087 #define MENF_ICON_RENAME (1 << 1)
3088 #define MENF_ICON_INFORMATION (1 << 2)
3089 #define MENF_ICON_SNAPSHOT (1 << 3)
3090 #define MENF_ICON_UNSNAPSHOT (1 << 4)
3091 #define MENF_ICON_LEAVEOUT (1 << 5)
3092 #define MENF_ICON_PUTAWAY (1 << 6)
3093 #define MENF_ICON_DELETE (1 << 7)
3094 #define MENF_ICON_FORMAT (1 << 8)
3095 #define MENF_ICON_EMPTYTRASH (1 << 9)
3097 ///Wanderer__Func_UpdateMenuStates()
3098 VOID
Wanderer__Func_UpdateMenuStates(Object
*WindowObj
, Object
*IconlistObj
)
3100 IPTR isRoot
= 0, current_DispFlags
= 0, current_SortFlags
= 0;
3101 Object
*current_Menustrip
= NULL
, *current_MenuItem
= NULL
;
3102 struct IconList_Entry
*icon_entry
= (IPTR
)MUIV_IconList_NextIcon_Start
;
3103 ULONG iconmenustate
= 0xFFFFFFFF; /* All enabled */
3104 LONG selectedcount
= 0;
3106 if (IconlistObj
== NULL
)
3109 D(bug("[Wanderer]: %s(IconList @ %p)\n", __PRETTY_FUNCTION__
, IconlistObj
));
3111 GET(IconlistObj
, MUIA_IconList_SortFlags
, ¤t_SortFlags
);
3112 GET(IconlistObj
, MUIA_IconList_DisplayFlags
, ¤t_DispFlags
);
3113 GET(WindowObj
, MUIA_Window_Menustrip
, ¤t_Menustrip
);
3114 GET(WindowObj
, MUIA_IconWindow_IsRoot
, &isRoot
);
3116 D(bug("[Wanderer] %s: Menu @ %p, Display Flags : %x, Sort Flags : %x\n", __PRETTY_FUNCTION__
, current_Menustrip
, current_DispFlags
, current_SortFlags
));
3120 DoMethod(IconlistObj
, MUIM_IconList_NextIcon
, MUIV_IconList_NextIcon_Selected
, (IPTR
)&icon_entry
);
3122 if ((IPTR
)icon_entry
!= MUIV_IconList_NextIcon_End
)
3124 if (isRoot
&& (icon_entry
->type
== ST_ROOT
))
3126 /* Disks can't be: */
3127 iconmenustate
&= ~MENF_ICON_LEAVEOUT
;
3128 iconmenustate
&= ~MENF_ICON_PUTAWAY
;
3129 iconmenustate
&= ~MENF_ICON_DELETE
;
3130 iconmenustate
&= ~MENF_ICON_EMPTYTRASH
;
3132 if (isRoot
&& ((icon_entry
->type
== ST_LINKDIR
) || (icon_entry
->type
== ST_LINKFILE
)))
3134 /* Leave outed icons can't be: */
3135 iconmenustate
&= ~MENF_ICON_LEAVEOUT
;
3136 iconmenustate
&= ~MENF_ICON_DELETE
;
3137 iconmenustate
&= ~MENF_ICON_FORMAT
;
3138 iconmenustate
&= ~MENF_ICON_EMPTYTRASH
;
3140 if (!(isRoot
) && ((icon_entry
->type
== ST_USERDIR
) || (icon_entry
->type
== ST_FILE
)))
3142 /* Normal files/drawers can't be: */
3143 iconmenustate
&= ~MENF_ICON_PUTAWAY
;
3144 iconmenustate
&= ~MENF_ICON_FORMAT
;
3145 iconmenustate
&= ~MENF_ICON_EMPTYTRASH
;
3147 if (isRoot
&& (icon_entry
->type
== ILE_TYPE_APPICON
))
3150 struct AppIcon
* ai
= (struct AppIcon
*)icon_entry
->ile_IconEntry
->ie_User1
;
3151 if (!AppIcon_Supports(ai
, WBAPPICONA_SupportsOpen
))
3152 iconmenustate
&= ~MENF_ICON_OPEN
;
3153 if (!AppIcon_Supports(ai
, WBAPPICONA_SupportsRename
))
3154 iconmenustate
&= ~MENF_ICON_RENAME
;
3155 if (!AppIcon_Supports(ai
, WBAPPICONA_SupportsInformation
))
3156 iconmenustate
&= ~MENF_ICON_INFORMATION
;
3157 if (!AppIcon_Supports(ai
, WBAPPICONA_SupportsSnapshot
))
3158 iconmenustate
&= ~MENF_ICON_SNAPSHOT
;
3159 if (!AppIcon_Supports(ai
, WBAPPICONA_SupportsUnSnapshot
))
3160 iconmenustate
&= ~MENF_ICON_UNSNAPSHOT
;
3161 if (!AppIcon_Supports(ai
, WBAPPICONA_SupportsLeaveOut
))
3162 iconmenustate
&= ~MENF_ICON_LEAVEOUT
;
3163 if (!AppIcon_Supports(ai
, WBAPPICONA_SupportsPutAway
))
3164 iconmenustate
&= ~MENF_ICON_PUTAWAY
;
3165 if (!AppIcon_Supports(ai
, WBAPPICONA_SupportsDelete
))
3166 iconmenustate
&= ~MENF_ICON_DELETE
;
3167 if (!AppIcon_Supports(ai
, WBAPPICONA_SupportsFormatDisk
))
3168 iconmenustate
&= ~MENF_ICON_FORMAT
;
3169 if (!AppIcon_Supports(ai
, WBAPPICONA_SupportsEmptyTrash
))
3170 iconmenustate
&= ~MENF_ICON_EMPTYTRASH
;
3180 if (selectedcount
== 0) iconmenustate
= 0x00000000;
3182 if (current_Menustrip
!= NULL
)
3185 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_OPEN
)) != NULL
)
3187 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, !!(iconmenustate
& MENF_ICON_OPEN
));
3189 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_RENAME
)) != NULL
)
3191 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, !!(iconmenustate
& MENF_ICON_RENAME
));
3193 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_INFORMATION
)) != NULL
)
3195 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, !!(iconmenustate
& MENF_ICON_INFORMATION
));
3197 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_SNAPSHOT
)) != NULL
)
3199 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, !!(iconmenustate
& MENF_ICON_SNAPSHOT
));
3201 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_UNSNAPSHOT
)) != NULL
)
3203 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, !!(iconmenustate
& MENF_ICON_UNSNAPSHOT
));
3205 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_DELETE
)) != NULL
)
3207 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, !!(iconmenustate
& MENF_ICON_DELETE
));
3209 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_FORMAT
)) != NULL
)
3211 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, !!(iconmenustate
& MENF_ICON_FORMAT
));
3213 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_LEAVEOUT
)) != NULL
)
3215 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, !!(iconmenustate
& MENF_ICON_LEAVEOUT
));
3217 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_PUTAWAY
)) != NULL
)
3219 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, !!(iconmenustate
& MENF_ICON_PUTAWAY
));
3221 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_ICON_EMPTYTRASH
)) != NULL
)
3223 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, !!(iconmenustate
& MENF_ICON_EMPTYTRASH
));
3225 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_CLEAR
)) != NULL
)
3227 NNSET(current_MenuItem
, MUIA_Menuitem_Enabled
, TRUE
);
3231 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_VIEW_ALL
)) != NULL
)
3233 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, !(current_DispFlags
& ICONLIST_DISP_SHOWINFO
) ? TRUE
: FALSE
);
3235 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_VIEW_ICON
)) != NULL
)
3237 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, (current_DispFlags
& ICONLIST_DISP_MODEDEFAULT
) ? TRUE
: FALSE
);
3239 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_VIEW_DETAIL
)) != NULL
)
3241 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, (current_DispFlags
& ICONLIST_DISP_MODELIST
) ? TRUE
: FALSE
);
3243 // if ((current_MenuItem = FindMenuitem(current_Menustrip, MEN_WINDOW_VIEW_HIDDEN)) != NULL)
3245 // NNSET(current_MenuItem, MUIA_Menuitem_Checked, (current_DispFlags & ICONLIST_DISP_SHOWHIDDEN) ? TRUE : FALSE);
3247 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_NAME
)) != NULL
)
3249 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& MUIV_IconList_Sort_ByName
) ? TRUE
: FALSE
));
3251 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_DATE
)) != NULL
)
3253 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& MUIV_IconList_Sort_ByDate
) ? TRUE
: FALSE
));
3255 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_SIZE
)) != NULL
)
3257 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& MUIV_IconList_Sort_BySize
) ? TRUE
: FALSE
));
3259 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_TYPE
)) != NULL
)
3261 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& MUIV_IconList_Sort_ByType
) ? TRUE
: FALSE
));
3263 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_REVERSE
)) != NULL
)
3265 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& MUIV_IconList_Sort_Reverse
) == MUIV_IconList_Sort_Reverse
) ? TRUE
: FALSE
);
3267 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_TOPDRAWERS
)) != NULL
)
3269 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& MUIV_IconList_Sort_DrawersMixed
) == MUIV_IconList_Sort_DrawersMixed
) ? FALSE
: TRUE
);
3271 if ((current_MenuItem
= FindMenuitem(current_Menustrip
, MEN_WINDOW_SORT_ENABLE
)) != NULL
)
3273 NNSET(current_MenuItem
, MUIA_Menuitem_Checked
, ((current_SortFlags
& MUIV_IconList_Sort_AutoSort
) == 0) ? FALSE
: TRUE
);
3278 ///Wanderer__HookFunc_UpdateMenuStatesFunc()
3282 ULONG
, Wanderer__HookFunc_UpdateMenuStatesFunc
,
3283 AROS_UFHA(struct Hook
*, hook
, A0
),
3284 AROS_UFHA(APTR
*, obj
, A2
),
3285 AROS_UFHA(APTR
, param
, A1
)
3289 HOOKPROTO(Wanderer__HookFunc_UpdateMenuStatesFunc
, ULONG
, struct dCopyStruct
*obj
, APTR param
)
3294 __unused Object
*self
= ( Object
*)obj
;
3295 Object
*window
= *( Object
**)param
;
3296 Object
*iconlist
= NULL
;
3298 D(bug("[Wanderer]: %s(self @ %p, window @ %p)\n", __PRETTY_FUNCTION__
, self
, window
));
3300 GET(window
, MUIA_IconWindow_IconList
, &iconlist
);
3302 D(bug("[Wanderer] %s: iconlist @ %p\n", __PRETTY_FUNCTION__
, iconlist
));
3304 Wanderer__Func_UpdateMenuStates(window
, iconlist
);
3306 D(bug("[Wanderer] %s: Update Complete.\n", __PRETTY_FUNCTION__
));
3313 /*** Methods ****************************************************************/
3315 Object
*Wanderer__OM_NEW(Class
*CLASS
, Object
*self
, struct opSet
*message
)
3317 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
3319 self
= (Object
*) DoSuperNewTags
3323 MUIA_Application_Title
, (IPTR
) wand_namestr
,
3324 MUIA_Application_Base
, (IPTR
) "WANDERER",
3325 MUIA_Application_Version
, (IPTR
) VERSION
,
3326 MUIA_Application_Description
, (IPTR
) _(MSG_DESCRIPTION
),
3327 MUIA_Application_SingleTask
, TRUE
,
3329 MUIA_Application_Version
, (IPTR
) wand_versionstr
,
3330 MUIA_Application_Copyright
, (IPTR
) wand_copyrightstr
,
3331 MUIA_Application_Author
, (IPTR
) wand_authorstr
,
3333 TAG_MORE
, (IPTR
) message
->ops_AttrList
3338 SETUP_WANDERER_INST_DATA
;
3342 // ULONG updatedIcons;
3343 D(bug("[Wanderer] %s: Wanderer Obj @ %p, Instance data @ %p\n", __PRETTY_FUNCTION__
, self
, data
));
3345 _WandererIntern_CLASS
= CLASS
;
3347 NewList(&_WandererIntern_FSHandlerList
);
3349 D(bug("[Wanderer] %s: FSHandlerList @ %p\n", __PRETTY_FUNCTION__
, &_WandererIntern_FSHandlerList
));
3351 if (GetVar(wand_backdropprefs
, buff
, sizeof(buff
), GVF_GLOBAL_ONLY
) != -1) {
3352 data
->wd_Option_BackDropMode
= (Stricmp(buff
, "True") == 0) ? TRUE
: FALSE
;
3354 #if defined(WANDERER_DEFAULT_BACKDROP)
3355 data
->wd_Option_BackDropMode
= TRUE
;
3357 data
->wd_Option_BackDropMode
= FALSE
;
3361 /*-- Setup hooks structures ----------------------------------------*/
3363 _WandererIntern_hook_standard
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_StandardFunc
;
3364 _WandererIntern_hook_action
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_ActionFunc
;
3365 _WandererIntern_hook_backdrop
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_BackdropFunc
;
3367 _WandererIntern_hook_standard
= &Hook_StandardFunc
;
3368 _WandererIntern_hook_action
= &Hook_ActionFunc
;
3369 _WandererIntern_hook_backdrop
= &Hook_BackdropFunc
;
3373 if ((data
->wd_CommandPort
= CreateMsgPort()) == NULL
)
3375 CoerceMethod(CLASS
, self
, OM_DISPOSE
);
3379 if ((data
->wd_NotifyPort
= CreateMsgPort()) == NULL
)
3381 CoerceMethod(CLASS
, self
, OM_DISPOSE
);
3385 RegisterWorkbench(data
->wd_CommandPort
);
3387 /* Setup command port handler --------------------------------------*/
3388 data
->wd_CommandIHN
.ihn_Signals
= 1UL << data
->wd_CommandPort
->mp_SigBit
;
3389 data
->wd_CommandIHN
.ihn_Object
= self
;
3390 data
->wd_CommandIHN
.ihn_Method
= MUIM_Wanderer_HandleCommand
;
3394 self
, MUIM_Application_AddInputHandler
, (IPTR
) &data
->wd_CommandIHN
3397 /* Setup timer handler ---------------------------------------------*/
3398 data
->wd_TimerIHN
.ihn_Flags
= MUIIHNF_TIMER
;
3399 data
->wd_TimerIHN
.ihn_Millis
= 1000;
3400 data
->wd_TimerIHN
.ihn_Object
= self
;
3401 data
->wd_TimerIHN
.ihn_Method
= MUIM_Wanderer_HandleTimer
;
3405 self
, MUIM_Application_AddInputHandler
, (IPTR
) &data
->wd_TimerIHN
3408 /* Setup filesystem notification handler ---------------------------*/
3409 data
->wd_NotifyIHN
.ihn_Signals
= 1UL << data
->wd_NotifyPort
->mp_SigBit
;
3410 data
->wd_NotifyIHN
.ihn_Object
= self
;
3411 data
->wd_NotifyIHN
.ihn_Method
= MUIM_Wanderer_HandleNotify
;
3415 self
, MUIM_Application_AddInputHandler
, (IPTR
) &data
->wd_NotifyIHN
3418 // All the following should be moved to InitWandererPrefs
3421 data
->wd_Prefs
= (Object
*)WandererPrefsObject
,
3422 MUIA_Wanderer_FileSysNotifyPort
, (IPTR
)data
->wd_NotifyPort
,
3423 End
; // FIXME: error handling
3425 data
->wd_Prefs
= NewObject(WandererPrefs_CLASS
->mcc_Class
, NULL
, TAG_DONE
); // FIXME: error handling
3430 D(bug("[Wanderer] %s: Prefs-Screentitle = '%s'\n", __PRETTY_FUNCTION__
, XGET(data
->wd_Prefs
, MUIA_IconWindowExt_ScreenTitle_String
)));
3434 D(bug("[Wanderer] %s: WandererObj @ %p\n", __PRETTY_FUNCTION__
, self
));
3440 IPTR
Wanderer__OM_DISPOSE(Class
*CLASS
, Object
*self
, Msg message
)
3442 SETUP_WANDERER_INST_DATA
;
3444 if (data
->wd_CommandPort
)
3446 /* InputHandler's have only been added if the creation
3447 of the msg port was successful */
3448 DoMethod(self
, MUIM_Application_RemInputHandler
, (IPTR
) &data
->wd_TimerIHN
);
3449 DoMethod(self
, MUIM_Application_RemInputHandler
, (IPTR
) &data
->wd_CommandIHN
);
3450 DoMethod(self
, MUIM_Application_RemInputHandler
, (IPTR
) &data
->wd_NotifyIHN
);
3452 UnregisterWorkbench(data
->wd_CommandPort
);
3454 DeleteMsgPort(data
->wd_NotifyPort
);
3455 data
->wd_NotifyPort
= NULL
;
3457 DeleteMsgPort(data
->wd_CommandPort
);
3458 data
->wd_CommandPort
= NULL
;
3460 DisposeObject(data
->wd_Prefs
);
3461 data
->wd_Prefs
= NULL
;
3462 return DoSuperMethodA(CLASS
, self
, (Msg
) message
);
3465 // FIXME: Temporary solution to avoid a crash if there's no SDL (I know this shouldn't happen)
3466 // (I hope this won't bring any unwanted bugs)
3467 return (IPTR
) NULL
;//DoSuperMethodA(CLASS, self, (Msg) message);
3472 IPTR
Wanderer__OM_SET(Class
*CLASS
, Object
*self
, struct opSet
*message
)
3474 SETUP_WANDERER_INST_DATA
;
3475 struct TagItem
*tstate
= message
->ops_AttrList
, *tag
;
3477 while ((tag
= NextTagItem((TAGITEM
)&tstate
)) != NULL
)
3479 switch (tag
->ti_Tag
)
3481 case MUIA_Wanderer_Screen
:
3482 D(bug("[Wanderer] %s: MUIA_Wanderer_Screen = %p\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
3483 D(bug("[Wanderer] %s: setting MUIA_Wanderer_Screen isnt yet handled!\n", __PRETTY_FUNCTION__
));
3486 case MUIA_Wanderer_ActiveWindow
:
3487 data
->wd_ActiveWindow
= (Object
*) tag
->ti_Data
;
3488 D(bug("[Wanderer] %s: MUIA_Wanderer_ActiveWindow = %p\n", __PRETTY_FUNCTION__
, tag
->ti_Data
));
3489 if (!(XGET(data
->wd_ActiveWindow
, MUIA_Window_Activate
)))
3491 NNSET(data
->wd_ActiveWindow
, MUIA_Window_Activate
, TRUE
);
3493 Object
*activatewin_Iconlist
= NULL
;
3495 GET(data
->wd_ActiveWindow
, MUIA_IconWindow_IconList
, &activatewin_Iconlist
);
3496 Wanderer__Func_UpdateMenuStates(data
->wd_ActiveWindow
, activatewin_Iconlist
);
3499 case MUIA_Application_Iconified
:
3500 /* Wanderer does not allow iconifying of itself */
3501 tag
->ti_Tag
= TAG_IGNORE
;
3506 return DoSuperMethodA(CLASS
, self
, (Msg
) message
);
3511 IPTR
Wanderer__OM_GET(Class
*CLASS
, Object
*self
, struct opGet
*message
)
3513 SETUP_WANDERER_INST_DATA
;
3514 IPTR
*store
= message
->opg_Storage
;
3517 switch (message
->opg_AttrID
)
3519 case MUIA_Wanderer_Screen
:
3520 *store
= (IPTR
)data
->wd_Screen
;
3523 case MUIA_Wanderer_Prefs
:
3524 *store
= (IPTR
)data
->wd_Prefs
;
3527 case MUIA_Wanderer_ActiveWindow
:
3528 *store
= (IPTR
)data
->wd_ActiveWindow
;
3531 case MUIA_Wanderer_WorkbenchWindow
:
3532 *store
= (IPTR
)data
->wd_WorkbenchWindow
;
3535 case MUIA_Wanderer_FileSysNotifyPort
:
3536 *store
= (IPTR
)data
->wd_NotifyPort
;
3539 case MUIA_Wanderer_FileSysNotifyList
:
3540 *store
= (IPTR
)&_WandererIntern_FSHandlerList
;
3544 *store
= (IPTR
)WANDERERVERS
;
3548 *store
= (IPTR
)WANDERERREV
;
3551 case MUIA_Application_Iconified
:
3552 /* Wanderer does not allow iconifying of itself */
3553 *store
= (IPTR
)FALSE
;
3557 rv
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
3564 ///Wanderer__MUIM_Application_Execute()
3565 /* Main entry point for Wanderer Application Object */
3567 When the executable creates our object it calls zune
3568 to handle basic "control" ... which results in Zune
3569 calling this method ..
3571 IPTR Wanderer__MUIM_Application_Execute
3573 Class
*CLASS
, Object
*self
, Msg message
3576 SETUP_WANDERER_INST_DATA
;
3578 D(bug("[Wanderer] %s() ##\n[Wanderer] %s: Creating 'Workbench' Window..\n", __PRETTY_FUNCTION__
, __PRETTY_FUNCTION__
));
3580 data
->wd_WorkbenchWindow
= (Object
*) DoMethod
3582 self
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) NULL
3585 if (data
->wd_WorkbenchWindow
!= NULL
)
3587 D(bug("[Wanderer] %s: Workbench Window Obj @ %x\n", __PRETTY_FUNCTION__
, data
->wd_WorkbenchWindow
));
3592 D(bug("[Wanderer] %s: Really handing control to Zune ..\n", __PRETTY_FUNCTION__
));
3594 DoSuperMethodA(CLASS
, self
, message
);
3598 while (DoMethod(self
,MUIM_Application_NewInput
,&sigs
) != MUIV_Application_ReturnID_Quit
)
3602 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
);
3603 if (sigs
& SIGBREAKF_CTRL_C
) break;
3612 /* TODO: Report an error if we fail to create the Workbench's window ... */
3614 return RETURN_ERROR
;
3618 ///Wanderer__MUIM_Wanderer_HandleTimer()
3619 /*This function uses GetScreenTitle() function...*/
3621 IPTR Wanderer__MUIM_Wanderer_HandleTimer
3623 Class
*CLASS
, Object
*self
, Msg message
3626 SETUP_WANDERER_INST_DATA
;
3627 Object
*cstate
= (Object
*)(((struct List
*)XGET(self
, MUIA_Application_WindowList
))->lh_Head
);
3628 Object
*child
= NULL
;
3630 STRPTR scr_title
= GetUserScreenTitle(data
->wd_Prefs
);
3632 // D(bug("[Wanderer] Timer event, user screen title %s\n", scr_title));
3634 while ((child
= NextObject(&cstate
)))
3636 /* Set the Wanderer title to each window's screen title */
3637 STRPTR current_title
= NULL
;
3639 GET(child
, MUIA_Window_ScreenTitle
, ¤t_title
);
3640 // D(bug("[Wanderer] Current title %s\n", current_title));
3642 if ((current_title
== NULL
) || (strcmp(current_title
, scr_title
) != 0))
3644 /* Limit the menu bar flickering */
3645 SET(child
, MUIA_Window_ScreenTitle
, (IPTR
) scr_title
);
3648 /* Request rate-limited, conditional refresh */
3649 DoMethod(child
, MUIM_IconWindow_RateLimitRefresh
);
3652 CleanAppIconReplyMessages();
3658 ///Wanderer__MUIM_Wanderer_HandleCommand()
3659 IPTR Wanderer__MUIM_Wanderer_HandleCommand
3661 Class
*CLASS
, Object
*self
, Msg message
3664 SETUP_WANDERER_INST_DATA
;
3665 struct WBHandlerMessage
*wbhm
= NULL
;
3666 struct List
*pub_screen_list
;
3667 struct PubScreenNode
*pub_screen_node
;
3668 WORD visitor_count
= 0;
3669 D(bug("[Wanderer] %s()\n", __PRETTY_FUNCTION__
));
3670 D(bug("[Wanderer] %s: Received signal at notification port\n", __PRETTY_FUNCTION__
));
3672 while ((wbhm
= WBHM(GetMsg(data
->wd_CommandPort
))) != NULL
)
3674 D(bug("[Wanderer] %s: Received message from handler, type = %ld\n", __PRETTY_FUNCTION__
, wbhm
->wbhm_Type
));
3676 switch (wbhm
->wbhm_Type
)
3678 case WBHM_TYPE_SHOW
:
3679 D(bug("[Wanderer] %s: WBHM_TYPE_SHOW\n", __PRETTY_FUNCTION__
));
3680 if ((data
->wd_Screen
= LockPubScreen(NULL
)) != NULL
)
3682 D(bug("[Wanderer] %s: Unlocking access to screen @ %x\n", __PRETTY_FUNCTION__
, data
->wd_Screen
));
3683 UnlockPubScreen(NULL
, data
->wd_Screen
);
3684 SET(self
, MUIA_ShowMe
, TRUE
);
3688 /* TODO: We need to handle the possiblity that we fail to lock the pubscreen... */
3689 D(bug("[Wanderer] %s: Couldnt Lock WB Screen!!\n", __PRETTY_FUNCTION__
));
3693 case WBHM_TYPE_HIDE
:
3694 D(bug("[Wanderer] %s: WBHM_TYPE_HIDE\n", __PRETTY_FUNCTION__
));
3695 pub_screen_list
= LockPubScreenList();
3698 ForeachNode (pub_screen_list
, pub_screen_node
)
3700 Foreach_Node(pub_screen_list
, pub_screen_node
);
3703 if (pub_screen_node
->psn_Screen
== data
->wd_Screen
)
3704 visitor_count
= pub_screen_node
->psn_VisitorCount
;
3706 UnlockPubScreenList();
3707 if (visitor_count
== 0)
3708 SET(self
, MUIA_ShowMe
, FALSE
);
3711 case WBHM_TYPE_UPDATE
:
3712 D(bug("[Wanderer] %s: WBHM_TYPE_UPDATE\n", __PRETTY_FUNCTION__
));
3714 CONST_STRPTR name
= wbhm
->wbhm_Data
.Update
.Name
;
3716 BOOL windowned
= FALSE
, refreshroot
= FALSE
;
3718 switch (wbhm
->wbhm_Data
.Update
.Type
)
3723 length
= strlen(name
);
3730 length
= PathPart(name
) - name
;
3734 D(bug("[Wanderer] %s: name = %s, length = %ld\n", __PRETTY_FUNCTION__
, name
, length
));
3738 Object
*cstate
= (Object
*)(((struct List
*)XGET(self
, MUIA_Application_WindowList
))->lh_Head
);
3739 Object
*child
= NULL
;
3741 while ((child
= NextObject(&cstate
)))
3743 if (XGET(child
, MUIA_UserData
))
3745 STRPTR child_drawer
= (STRPTR
)XGET(child
, MUIA_IconWindow_Location
);
3749 child_drawer
!= NULL
3750 && strncmp(name
, child_drawer
, length
) == 0
3751 && strlen(child_drawer
) == length
3754 Object
*iconlist
= (Object
*) XGET(child
, MUIA_IconWindow_IconList
);
3756 D(bug("[Wanderer] %s: Drawer found: %s!\n", __PRETTY_FUNCTION__
, child_drawer
));
3758 if (iconlist
!= NULL
)
3760 DoMethod(iconlist
, MUIM_IconList_Update
);
3761 DoMethod(iconlist
, MUIM_IconList_Sort
);
3771 Object
* root
= (Object
*)XGET(self
, MUIA_Wanderer_WorkbenchWindow
);
3774 Object
*iconlist
= (Object
*)XGET(root
, MUIA_IconWindow_IconList
);
3775 if (iconlist
!= NULL
)
3777 DoMethod(iconlist
, MUIM_IconList_Update
);
3778 DoMethod(iconlist
, MUIM_IconList_Sort
);
3785 case WBHM_TYPE_OPEN
:
3786 D(bug("[Wanderer] %s: WBHM_TYPE_OPEN\n", __PRETTY_FUNCTION__
));
3789 Object
*cstate
= (Object
*)(((struct List
*)XGET(self
, MUIA_Application_WindowList
))->lh_Head
);
3791 CONST_STRPTR buf
= wbhm
->wbhm_Data
.Open
.Name
;
3793 while ((child
= NextObject(&cstate
)))
3795 if (XGET(child
, MUIA_UserData
))
3797 STRPTR child_drawer
= (STRPTR
)XGET(child
, MUIA_IconWindow_Location
);
3798 if (child_drawer
&& !Stricmp(buf
,child_drawer
))
3800 int is_open
= XGET(child
, MUIA_Window_Open
);
3802 DoMethod(child
, MUIM_IconWindow_Open
);
3805 DoMethod(child
, MUIM_Window_ToFront
);
3806 SET(child
, MUIA_Window_Activate
, TRUE
);
3815 self
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) buf
3821 ReplyMsg((struct Message
*) wbhm
);
3828 ///Wanderer__MUIM_Wanderer_HandleNotify()
3829 IPTR Wanderer__MUIM_Wanderer_HandleNotify
3831 Class
*CLASS
, Object
*self
, Msg message
3834 SETUP_WANDERER_INST_DATA
;
3835 struct Message
*plainMessage
= NULL
;
3836 struct Wanderer_FSHandler
*nodeFSHandler
;
3838 while ((plainMessage
= GetMsg(data
->wd_NotifyPort
)) != NULL
)
3840 struct NotifyMessage
*notifyMessage
= (struct NotifyMessage
*) plainMessage
;
3841 IPTR notifyMessage_UserData
= notifyMessage
->nm_NReq
->nr_UserData
;
3842 D(bug("[Wanderer] %s: got FS notification ('%s' @ 0x%p) userdata = 0x%p!\n", __PRETTY_FUNCTION__
, notifyMessage
->nm_NReq
->nr_Name
, notifyMessage
, notifyMessage_UserData
));
3844 if (notifyMessage_UserData
!= (IPTR
)NULL
)
3846 /* Only IconWindowDrawerList, IconWindowVolumeList class at the moment */
3847 D(bug("[Wanderer] %s: Icon Window contents changed .. Updating\n", __PRETTY_FUNCTION__
));
3848 nodeFSHandler
= (struct Wanderer_FSHandler
*)notifyMessage_UserData
;
3849 nodeFSHandler
->HandleFSUpdate(nodeFSHandler
->target
, notifyMessage
);
3853 ForeachNode(&_WandererIntern_FSHandlerList
, nodeFSHandler
)
3855 if ((notifyMessage_UserData
== (IPTR
)NULL
) && (strcmp(notifyMessage
->nm_NReq
->nr_Name
, nodeFSHandler
->fshn_Node
.ln_Name
) == 0))
3857 D(bug("[Wanderer] %s: Notification for special handler for '%s'\n", __PRETTY_FUNCTION__
, notifyMessage
->nm_NReq
->nr_Name
));
3859 nodeFSHandler
->HandleFSUpdate(self
, notifyMessage
);
3862 ReplyMsg((struct Message
*)notifyMessage
);
3869 ///Wanderer__Func_CreateWandererIntuitionMenu()
3870 /* Some differences here between volumes and subwindows */
3871 Object
* Wanderer__Func_CreateWandererIntuitionMenu( BOOL isRoot
, BOOL isBackdrop
)
3873 Object
*_NewWandIntMenu__menustrip
= NULL
;
3874 IPTR _NewWandIntMenu__OPTION_BACKDROP
= CHECKIT
|MENUTOGGLE
;
3875 IPTR _NewWandIntMenu__OPTION_SHOWALL
= CHECKIT
|MENUTOGGLE
;
3879 _NewWandIntMenu__OPTION_BACKDROP
|= CHECKED
;
3884 struct NewMenu nm
[] = {
3885 {NM_TITLE
, _(MSG_MEN_WANDERER
) },
3886 {NM_ITEM
, _(MSG_MEN_BACKDROP
), _(MSG_MEN_SC_BACKDROP
) , _NewWandIntMenu__OPTION_BACKDROP
, 0, (APTR
) MEN_WANDERER_BACKDROP
},
3887 {NM_ITEM
, _(MSG_MEN_EXECUTE
), _(MSG_MEN_SC_EXECUTE
) , 0 , 0, (APTR
) MEN_WANDERER_EXECUTE
},
3888 {NM_ITEM
, _(MSG_MEN_SHELL
), _(MSG_MEN_SC_SHELL
) , 0 , 0, (APTR
) MEN_WANDERER_SHELL
},
3889 #if defined(__AROS__)
3891 {NM_SUB
, _(MSG_MEN_ABOUT
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_AROS_ABOUT
},
3892 {NM_SUB
, _(MSG_MEN_GUISET
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_AROS_GUISETTINGS
},
3894 {NM_ITEM
, _(MSG_MEN_ABOUT
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_ABOUT
},
3895 {NM_ITEM
, _(MSG_MEN_QUIT
) , _(MSG_MEN_SC_QUIT
) , 0 , 0, (APTR
) MEN_WANDERER_QUIT
},
3896 {NM_ITEM
, _(MSG_MEN_SHUTDOWN
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_SHUTDOWN
},
3897 {NM_TITLE
, _(MSG_MEN_WINDOW
), NULL
, 0 },
3898 {NM_ITEM
, _(MSG_MEN_UPDATE
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_UPDATE
},
3899 {NM_ITEM
, NM_BARLABEL
},
3900 {NM_ITEM
, _(MSG_MEN_CONTENTS
), _(MSG_MEN_SC_CONTENTS
) , 0 , 0, (APTR
) MEN_WINDOW_SELECT
},
3901 {NM_ITEM
, _(MSG_MEN_CLRSEL
), _(MSG_MEN_SC_CLRSEL
) , 0 , 0, (APTR
) MEN_WINDOW_CLEAR
},
3902 {NM_ITEM
, NM_BARLABEL
},
3903 {NM_ITEM
, _(MSG_MEN_SNAPSHT
) },
3904 {NM_SUB
, _(MSG_MEN_WINDOW
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_SNAP_WIN
},
3905 {NM_SUB
, _(MSG_MEN_ALL
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_SNAP_ALL
},
3906 {NM_ITEM
, NM_BARLABEL
},
3907 {NM_ITEM
, _(MSG_MEN_VIEW
) },
3908 {NM_SUB
, _(MSG_MEN_ICVIEW
), NULL
, CHECKIT
|CHECKED
, ~((1 << 0)|(1 << 3)), (APTR
) MEN_WINDOW_VIEW_ICON
},
3909 {NM_SUB
, _(MSG_MEN_DCVIEW
), NULL
, CHECKIT
|NM_ITEMDISABLED
, ~((1 << 1)|(1 << 3)), (APTR
) MEN_WINDOW_VIEW_DETAIL
},
3910 {NM_SUB
, NM_BARLABEL
},
3911 {NM_SUB
, _(MSG_MEN_ALLFIL
), NULL
, _NewWandIntMenu__OPTION_SHOWALL
|NM_ITEMDISABLED
, 0, (APTR
) MEN_WINDOW_VIEW_ALL
},
3912 {NM_ITEM
, _(MSG_MEN_SORTIC
) },
3913 {NM_SUB
, _(MSG_MEN_CLNUP
), _(MSG_MEN_SC_CLNUP
) , 0 , 0, (APTR
) MEN_WINDOW_SORT_NOW
},
3914 {NM_SUB
, _(MSG_MEN_ICONSORTING
), NULL
, CHECKIT
|MENUTOGGLE
|CHECKED
, 0, (APTR
) MEN_WINDOW_SORT_ENABLE
},
3915 {NM_SUB
, NM_BARLABEL
},
3916 {NM_SUB
, _(MSG_MEN_BYNAME
), NULL
, CHECKIT
, ~((1 << 3)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_NAME
},
3917 {NM_SUB
, _(MSG_MEN_BYDATE
), NULL
, CHECKIT
|NM_ITEMDISABLED
, ~((1 << 4)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_DATE
},
3918 {NM_SUB
, _(MSG_MEN_BYSIZE
), NULL
, CHECKIT
|NM_ITEMDISABLED
, ~((1 << 5)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_SIZE
},
3919 {NM_SUB
, _(MSG_MEN_BYTYPE
), NULL
, CHECKIT
|NM_ITEMDISABLED
, ~((1 << 6)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_TYPE
},
3920 {NM_SUB
, NM_BARLABEL
},
3921 {NM_SUB
, _(MSG_MEN_REVERSE
), NULL
, CHECKIT
|MENUTOGGLE
, 0, (APTR
) MEN_WINDOW_SORT_REVERSE
},
3922 {NM_SUB
, _(MSG_MEN_DRWFRST
), NULL
, CHECKIT
|MENUTOGGLE
|NM_ITEMDISABLED
, 0, (APTR
) MEN_WINDOW_SORT_TOPDRAWERS
},
3923 {NM_SUB
, _(MSG_MEN_GROUPICONS
), NULL
, CHECKIT
|MENUTOGGLE
|NM_ITEMDISABLED
, 0, (APTR
) MEN_WINDOW_SORT_GROUP
},
3924 {NM_ITEM
, NM_BARLABEL
},
3925 {NM_ITEM
, _(MSG_MEN_FIND
), _(MSG_MEN_SC_FIND
) , 0 , 0, (APTR
) MEN_WINDOW_FIND
},
3926 {NM_TITLE
, _(MSG_MEN_ICON
), NULL
, 0 },
3927 {NM_ITEM
, _(MSG_MEN_OPEN
), _(MSG_MEN_SC_OPEN
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_OPEN
},
3928 {NM_ITEM
, _(MSG_MEN_RENAME
), _(MSG_MEN_SC_RENAME
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_RENAME
},
3929 {NM_ITEM
, _(MSG_MEN_INFO
), _(MSG_MEN_SC_INFO
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_INFORMATION
},
3930 {NM_ITEM
, _(MSG_MEN_SNAPSHOT
), _(MSG_MEN_SC_SNAPSHOT
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_SNAPSHOT
},
3931 {NM_ITEM
, _(MSG_MEN_UNSNAPSHOT
), _(MSG_MEN_SC_UNSNAPSHOT
), NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_UNSNAPSHOT
},
3932 {NM_ITEM
, _(MSG_MEN_LEAVE_OUT
), _(MSG_MEN_SC_LEAVE_OUT
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_LEAVEOUT
},
3933 {NM_ITEM
, _(MSG_MEN_PUT_AWAY
), _(MSG_MEN_SC_PUT_AWAY
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_PUTAWAY
},
3934 {NM_ITEM
, NM_BARLABEL
},
3935 {NM_ITEM
, _(MSG_MEN_DELETE
), NULL
, NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_DELETE
},
3936 {NM_ITEM
, _(MSG_MEN_FORMAT
), NULL
, NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_FORMAT
},
3937 {NM_ITEM
, _(MSG_EMPTY_TRASH
), NULL
, NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_EMPTYTRASH
},
3938 {NM_TITLE
, _(MSG_MEN_TOOLS
), NULL
, NM_MENUDISABLED
},
3941 _NewWandIntMenu__menustrip
= MUI_MakeObject(MUIO_MenustripNM
, nm
, (IPTR
) NULL
);
3945 struct NewMenu nm
[] = {
3946 {NM_TITLE
, _(MSG_MEN_WANDERER
) },
3947 {NM_ITEM
, _(MSG_MEN_BACKDROP
), _(MSG_MEN_SC_BACKDROP
) , _NewWandIntMenu__OPTION_BACKDROP
, 0, (APTR
) MEN_WANDERER_BACKDROP
},
3948 {NM_ITEM
, _(MSG_MEN_EXECUTE
), _(MSG_MEN_SC_EXECUTE
) , 0 , 0, (APTR
) MEN_WANDERER_EXECUTE
},
3949 {NM_ITEM
, _(MSG_MEN_SHELL
), _(MSG_MEN_SC_SHELL
) , 0 , 0, (APTR
) MEN_WANDERER_SHELL
},
3950 #if defined(__AROS__)
3952 {NM_SUB
, _(MSG_MEN_ABOUT
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_AROS_ABOUT
},
3953 {NM_SUB
, _(MSG_MEN_GUISET
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_AROS_GUISETTINGS
},
3955 {NM_ITEM
, _(MSG_MEN_ABOUT
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_ABOUT
},
3956 {NM_ITEM
, _(MSG_MEN_QUIT
) , _(MSG_MEN_SC_QUIT
) , 0 , 0, (APTR
) MEN_WANDERER_QUIT
},
3957 {NM_ITEM
, _(MSG_MEN_SHUTDOWN
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_SHUTDOWN
},
3958 {NM_TITLE
, _(MSG_MEN_WINDOW
), NULL
, 0 },
3959 {NM_ITEM
, _(MSG_MEN_NEWDRAW
), _(MSG_MEN_SC_NEWDRAW
) , 0 , 0, (APTR
) MEN_WINDOW_NEW_DRAWER
},
3960 {NM_ITEM
, _(MSG_MEN_OPENPAR
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_OPEN_PARENT
},
3961 {NM_ITEM
, _(MSG_MEN_CLOSE
), _(MSG_MEN_SC_CLOSE
) , 0 , 0, (APTR
) MEN_WINDOW_CLOSE
},
3962 {NM_ITEM
, _(MSG_MEN_UPDATE
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_UPDATE
},
3963 {NM_ITEM
, NM_BARLABEL
},
3964 {NM_ITEM
, _(MSG_MEN_CONTENTS
), _(MSG_MEN_SC_CONTENTS
) , 0 , 0, (APTR
) MEN_WINDOW_SELECT
},
3965 {NM_ITEM
, _(MSG_MEN_CLRSEL
), _(MSG_MEN_SC_CLRSEL
) , 0 , 0, (APTR
) MEN_WINDOW_CLEAR
},
3966 {NM_ITEM
, NM_BARLABEL
},
3967 {NM_ITEM
, _(MSG_MEN_SNAPSHT
) },
3968 {NM_SUB
, _(MSG_MEN_WINDOW
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_SNAP_WIN
},
3969 {NM_SUB
, _(MSG_MEN_ALL
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_SNAP_ALL
},
3970 {NM_ITEM
, NM_BARLABEL
},
3971 {NM_ITEM
, _(MSG_MEN_VIEW
)},
3972 {NM_SUB
, _(MSG_MEN_ICVIEW
), NULL
, CHECKIT
|CHECKED
,~((1 << 0)|(1 << 3)), (APTR
) MEN_WINDOW_VIEW_ICON
},
3973 {NM_SUB
, _(MSG_MEN_DCVIEW
), NULL
, CHECKIT
,~((1 << 1)|(1 << 3)), (APTR
) MEN_WINDOW_VIEW_DETAIL
},
3974 {NM_SUB
, NM_BARLABEL
},
3975 {NM_SUB
, _(MSG_MEN_ALLFIL
), NULL
, _NewWandIntMenu__OPTION_SHOWALL
, 0, (APTR
) MEN_WINDOW_VIEW_ALL
},
3976 {NM_ITEM
, _(MSG_MEN_SORTIC
)},
3977 {NM_SUB
, _(MSG_MEN_CLNUP
), _(MSG_MEN_SC_CLNUP
) , 0 , 0, (APTR
) MEN_WINDOW_SORT_NOW
},
3978 {NM_SUB
, _(MSG_MEN_ICONSORTING
), NULL
, CHECKIT
|MENUTOGGLE
|CHECKED
, 0, (APTR
) MEN_WINDOW_SORT_ENABLE
},
3979 {NM_SUB
, NM_BARLABEL
},
3980 {NM_SUB
, _(MSG_MEN_BYNAME
), NULL
, CHECKIT
, ~((1 << 3)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_NAME
},
3981 {NM_SUB
, _(MSG_MEN_BYDATE
), NULL
, CHECKIT
, ~((1 << 4)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_DATE
},
3982 {NM_SUB
, _(MSG_MEN_BYSIZE
), NULL
, CHECKIT
, ~((1 << 5)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_SIZE
},
3983 {NM_SUB
, _(MSG_MEN_BYTYPE
), NULL
, CHECKIT
|NM_ITEMDISABLED
, ~((1 << 6)|(1 << 1)|(1 << 8)|(1 << 9)|(1 << 10)), (APTR
) MEN_WINDOW_SORT_TYPE
},
3984 {NM_SUB
, NM_BARLABEL
},
3985 {NM_SUB
, _(MSG_MEN_REVERSE
), NULL
, CHECKIT
|MENUTOGGLE
, 0, (APTR
) MEN_WINDOW_SORT_REVERSE
},
3986 {NM_SUB
, _(MSG_MEN_DRWFRST
), NULL
, CHECKIT
|MENUTOGGLE
|CHECKED
, 0, (APTR
) MEN_WINDOW_SORT_TOPDRAWERS
},
3987 {NM_SUB
, _(MSG_MEN_GROUPICONS
), NULL
, CHECKIT
|MENUTOGGLE
|NM_ITEMDISABLED
, 0, (APTR
) MEN_WINDOW_SORT_GROUP
},
3988 {NM_ITEM
, NM_BARLABEL
},
3989 {NM_ITEM
, _(MSG_MEN_FIND
), _(MSG_MEN_SC_FIND
) , 0 , 0, (APTR
) MEN_WINDOW_FIND
},
3990 {NM_TITLE
, _(MSG_MEN_ICON
), NULL
, 0 },
3991 {NM_ITEM
, _(MSG_MEN_OPEN
), _(MSG_MEN_SC_OPEN
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_OPEN
},
3992 {NM_ITEM
, _(MSG_MEN_RENAME
), _(MSG_MEN_SC_RENAME
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_RENAME
},
3993 {NM_ITEM
, _(MSG_MEN_INFO
), _(MSG_MEN_SC_INFO
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_INFORMATION
},
3994 {NM_ITEM
, _(MSG_MEN_SNAPSHOT
), _(MSG_MEN_SC_SNAPSHOT
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_SNAPSHOT
},
3995 {NM_ITEM
, _(MSG_MEN_UNSNAPSHOT
), _(MSG_MEN_SC_UNSNAPSHOT
), NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_UNSNAPSHOT
},
3996 {NM_ITEM
, _(MSG_MEN_LEAVE_OUT
), _(MSG_MEN_SC_LEAVE_OUT
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_LEAVEOUT
},
3997 {NM_ITEM
, _(MSG_MEN_PUT_AWAY
), _(MSG_MEN_SC_PUT_AWAY
) , NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_PUTAWAY
},
3998 {NM_ITEM
, NM_BARLABEL
},
3999 {NM_ITEM
, _(MSG_MEN_DELETE
), NULL
, NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_DELETE
},
4000 {NM_ITEM
, _(MSG_MEN_FORMAT
), NULL
, NM_ITEMDISABLED
},
4001 {NM_ITEM
, _(MSG_EMPTY_TRASH
), NULL
, NM_ITEMDISABLED
, 0, (APTR
) MEN_ICON_EMPTYTRASH
},
4002 {NM_TITLE
, _(MSG_MEN_TOOLS
), NULL
, NM_MENUDISABLED
},
4005 _NewWandIntMenu__menustrip
= MUI_MakeObject(MUIO_MenustripNM
, nm
, (IPTR
) NULL
);
4007 return _NewWandIntMenu__menustrip
;
4011 ///Wanderer__MUIM_Wanderer_CreateDrawerWindow()
4012 Object
*Wanderer__MUIM_Wanderer_CreateDrawerWindow
4014 Class
*CLASS
, Object
*self
,
4015 struct MUIP_Wanderer_CreateDrawerWindow
*message
4018 SETUP_WANDERER_INST_DATA
;
4020 Object
*window
= NULL
;
4021 BOOL isWorkbenchWindow
= FALSE
;
4022 BOOL useBackdrop
= FALSE
;
4023 IPTR TAG_IconWindow_Drawer
;
4024 Object
*_NewWandDrawerMenu__menustrip
;
4026 Object
*window_IconList
= NULL
;
4028 D(bug("[Wanderer]: %s()\n", __PRETTY_FUNCTION__
));
4030 if ((isWorkbenchWindow
= (message
->drawer
== NULL
? TRUE
: FALSE
)))
4032 useBackdrop
= data
->wd_Option_BackDropMode
;
4035 TAG_IconWindow_Drawer
= isWorkbenchWindow
? TAG_IGNORE
: MUIA_IconWindow_Location
;
4037 data
->wd_Screen
= LockPubScreen(NULL
);
4039 if(data
->wd_Screen
== NULL
)
4041 D(bug("[Wanderer] %s: Couldn't lock screen!\n", __PRETTY_FUNCTION__
));
4042 CoerceMethod(CLASS
, self
, OM_DISPOSE
);
4045 D(bug("[Wanderer] %s: Using Screen @ %p\n", __PRETTY_FUNCTION__
, data
->wd_Screen
));
4047 _NewWandDrawerMenu__menustrip
= Wanderer__Func_CreateWandererIntuitionMenu (isWorkbenchWindow
, useBackdrop
);
4049 /* Create a new icon drawer window with the correct drawer being set */
4051 window
= (Object
*)IconWindowObject
,
4053 MUIA_Wanderer_Prefs
, (IPTR
)data
->wd_Prefs
,
4054 MUIA_Wanderer_Screen
, (IPTR
)data
->wd_Screen
,
4055 MUIA_Window_ScreenTitle
, (IPTR
)GetUserScreenTitle(data
->wd_Prefs
),
4056 MUIA_Window_Menustrip
, (IPTR
) _NewWandDrawerMenu__menustrip
,
4057 TAG_IconWindow_Drawer
, (IPTR
) message
->drawer
,
4058 MUIA_IconWindow_ActionHook
, (IPTR
) &_WandererIntern_hook_action
,
4059 MUIA_IconWindow_IsRoot
, isWorkbenchWindow
? TRUE
: FALSE
,
4060 isWorkbenchWindow
? MUIA_IconWindow_IsBackdrop
: TAG_IGNORE
, useBackdrop
,
4061 MUIA_Wanderer_FileSysNotifyPort
, (IPTR
)data
->wd_NotifyPort
,
4062 isWorkbenchWindow
? TAG_IGNORE
: MUIA_Wanderer_FileSysNotifyList
, (IPTR
)&_WandererIntern_FSHandlerList
,
4063 MUIA_Window_IsSubWindow
, isWorkbenchWindow
? FALSE
: TRUE
,
4066 window
= NewObject(IconWindow_CLASS
->mcc_Class
, NULL
,
4068 MUIA_Wanderer_Prefs
, data
->wd_Prefs
,
4069 MUIA_Wanderer_Screen
, data
->wd_Screen
,
4070 MUIA_Window_ScreenTitle
, GetUserScreenTitle(data
->wd_Prefs
),
4071 MUIA_Window_Menustrip
, (IPTR
) _NewWandDrawerMenu__menustrip
,
4072 TAG_IconWindow_Drawer
, (IPTR
) message
->drawer
,
4073 MUIA_IconWindow_ActionHook
, (IPTR
) &_WandererIntern_hook_action
,
4074 MUIA_IconWindow_IsRoot
, isWorkbenchWindow
? TRUE
: FALSE
,
4075 isWorkbenchWindow
? MUIA_IconWindow_IsBackdrop
: TAG_IGNORE
, useBackdrop
,
4076 MUIA_Wanderer_FileSysNotifyPort
, data
->wd_NotifyPort
,
4077 isWorkbenchWindow
? TAG_IGNORE
: MUIA_Wanderer_FileSysNotifyList
, (IPTR
)&_WandererIntern_FSHandlerList
,
4078 MUIA_Window_IsSubWindow
, isWorkbenchWindow
? FALSE
: TRUE
,
4082 if (data
->wd_Screen
)
4084 D(bug("[Wanderer] %s: Unlocking access to screen @ %p\n", __PRETTY_FUNCTION__
, data
->wd_Screen
));
4085 UnlockPubScreen(NULL
, data
->wd_Screen
);
4090 D(bug("[Wanderer] %s: window != NULL\n", __PRETTY_FUNCTION__
));
4091 /* Get the drawer path back so we can use it also outside this function */
4093 BOOL freeDrwStr
= FALSE
;
4095 if (!isWorkbenchWindow
) drw
= (STRPTR
) XGET(window
, MUIA_IconWindow_Location
);
4098 D(bug("[Wanderer] %s: call AllocVec()\n", __PRETTY_FUNCTION__
));
4099 drw
= AllocVec ( 5, MEMF_CLEAR
);
4100 sprintf ( drw
, "RAM:" );
4104 if (isWorkbenchWindow
)
4106 D(bug("[Wanderer] %s: isWorkbenchWindow\n", __PRETTY_FUNCTION__
));
4109 window
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
4110 (IPTR
)self
, 3, MUIM_CallHook
, (IPTR
)&_WandererIntern_hook_standard
, (IPTR
)wanderer_menufunc_wanderer_quit
4117 window
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
4118 (IPTR
)_app(self
), 4, MUIM_Application_PushMethod
, (IPTR
)window
, 1, MUIM_IconWindow_Remove
4122 D(bug("[Wanderer] %s: call get with MUIA_IconWindow_IconList\n", __PRETTY_FUNCTION__
));
4123 GET(window
, MUIA_IconWindow_IconList
, &window_IconList
);
4125 D(bug("[Wanderer] %s: IconWindows IconList @ %p\n", __PRETTY_FUNCTION__
, window_IconList
));
4127 if (window_IconList
!= NULL
)
4129 struct Hook
*_wand_UpdateMenuStates_hook
= NULL
;
4131 if ((_wand_UpdateMenuStates_hook
= AllocMem(sizeof(struct Hook
), MEMF_CLEAR
|MEMF_PUBLIC
)) != NULL
)
4133 _wand_UpdateMenuStates_hook
->h_Entry
= ( HOOKFUNC
)Wanderer__HookFunc_UpdateMenuStatesFunc
;
4136 window_IconList
, MUIM_Notify
, MUIA_IconList_SelectionChanged
, MUIV_EveryTime
,
4138 MUIM_CallHook
, _wand_UpdateMenuStates_hook
, (IPTR
)window
4141 Wanderer__Func_UpdateMenuStates(window
, window_IconList
);
4143 D(bug("[Wanderer] %s: setup notifications\n", __PRETTY_FUNCTION__
));
4146 window
, MUIM_Notify
, MUIA_Window_Activate
, TRUE
,
4147 (IPTR
)_app(self
), 3, MUIM_Set
, MUIA_Wanderer_ActiveWindow
, (IPTR
) window
4153 window
, MUIM_Notify
, MUIA_IconWindow_IsBackdrop
, MUIV_EveryTime
,
4154 (IPTR
)_app(self
), 5, MUIM_Application_PushMethod
, (IPTR
)_app(self
), 2, MUIM_CallHook
, (IPTR
)&_WandererIntern_hook_backdrop
4159 window
, MUIM_Notify
, MUIA_IconWindow_IsBackdrop
, MUIV_EveryTime
,
4160 (IPTR
)_app(self
), 2, MUIM_CallHook
, (IPTR
) &_WandererIntern_hook_backdrop
4163 D(bug("[Wanderer] %s: execute all notifies\n", __PRETTY_FUNCTION__
));
4164 /* If "Execute Command" entry is clicked open the execute window */
4165 SetMenuDefaultNotifies(self
, _NewWandDrawerMenu__menustrip
, drw
);
4167 D(bug("[Wanderer] %s: add window to app\n", __PRETTY_FUNCTION__
));
4168 /* Add the window to the application */
4170 DoMethod(_app(self
), OM_ADDMEMBER
, (IPTR
) window
);
4172 DoMethod(self
, OM_ADDMEMBER
, (IPTR
) window
);
4174 D(bug("[Wanderer] %s: open window\n", __PRETTY_FUNCTION__
));
4175 /* And now open it */
4176 DoMethod(window
, MUIM_IconWindow_Open
);
4177 D(bug("[Wanderer] %s: clean up memory\n", __PRETTY_FUNCTION__
));
4178 /* Clean up ram string */
4179 if ( freeDrwStr
&& drw
) FreeVec ( drw
);
4181 D(bug("[Wanderer] %s: exit\n", __PRETTY_FUNCTION__
));
4185 /*** Setup ******************************************************************/
4188 Wanderer
, NULL
, MUIC_Application
, NULL
,
4189 OM_NEW
, struct opSet
*,
4191 OM_SET
, struct opSet
*,
4192 OM_GET
, struct opGet
*,
4193 MUIM_Application_Execute
, Msg
,
4194 MUIM_Wanderer_HandleTimer
, Msg
,
4195 MUIM_Wanderer_HandleCommand
, Msg
,
4196 MUIM_Wanderer_HandleNotify
, Msg
,
4197 MUIM_Wanderer_CreateDrawerWindow
, struct MUIP_Wanderer_CreateDrawerWindow
*