2 Copyright 2004-2006, The AROS Development Team. All rights reserved.
6 #define MUIMASTER_YES_INLINE_STDARG
9 #include <aros/debug.h>
11 #define WANDERER_DEFAULT_BACKDROP
12 //#define WANDERER_DEFAULT_SHOWALL
13 //#define WANDERER_DEFAULT_SHOWHIDDEN
15 #include <exec/types.h>
16 #include <libraries/gadtools.h>
17 #include <libraries/mui.h>
18 #include <zune/customclasses.h>
19 #include <dos/notify.h>
20 #include <workbench/handler.h>
21 #include <proto/graphics.h>
22 #include <proto/utility.h>
23 #include <proto/intuition.h>
24 #include <proto/muimaster.h>
25 #include <proto/dos.h>
26 #include <proto/workbench.h>
27 #include <proto/layers.h>
28 #include <proto/alib.h>
34 #include <aros/detach.h>
35 #include <prefs/wanderer.h>
37 #include "iconwindow.h"
38 #include "iconwindow_attributes.h"
39 #include "iconwindowcontents.h"
40 #include "wandererprefs.h"
41 #include "wandererprefsintern.h"
42 #include "filesystems.h"
44 #include "../../libs/muimaster/classes/iconlist.h"
45 #include "../../libs/muimaster/classes/iconlist_attributes.h"
50 #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, End
52 extern IPTR
InitWandererPrefs(void);
53 VOID
DoAllMenuNotifies(Object
*strip
, STRPTR path
);
54 Object
*FindMenuitem(Object
* strip
, int id
);
55 Object
*__CreateWandererIntuitionMenu__(BOOL isRoot
, BOOL useBackdrop
);
56 void wanderer_menufunc_window_update(void);
57 void execute_open_with_command(BPTR cd
, STRPTR contents
);
58 void DisposeCopyDisplay(struct MUIDisplayObjects
*d
);
59 BOOL
CreateCopyDisplay(UWORD flags
, struct MUIDisplayObjects
*d
);
61 /* Stored in the main wanderer executable */
62 extern Object
*_WandererIntern_AppObj
;
63 extern Class
*_WandererIntern_CLASS
;
65 struct Hook _WandererIntern_hook_standard
;
66 struct Hook _WandererIntern_hook_action
;
67 struct Hook _WandererIntern_hook_backdrop
;
69 static unsigned char strtochar(STRPTR st
)
74 /*** Instance Data **********************************************************/
77 struct Screen
*wd_Screen
;
83 struct MUI_InputHandlerNode wd_TimerIHN
;
84 struct MsgPort
*wd_CommandPort
;
85 struct MUI_InputHandlerNode wd_CommandIHN
;
86 struct MsgPort
*wd_NotifyPort
;
87 struct MUI_InputHandlerNode wd_NotifyIHN
;
88 struct NotifyRequest pnr
;
91 BOOL wd_Option_BackDropMode
;
94 /*** Macros *****************************************************************/
95 #define SETUP_WANDERER_INST_DATA struct Wanderer_DATA *data = INST_DATA(CLASS, self)
97 /**************************************************************************
99 **************************************************************************/
103 BOOL
, Wanderer__HookFunc_DisplayCopyFunc
,
104 AROS_UFHA(struct Hook
*, h
, A0
),
105 AROS_UFHA(struct dCopyStruct
*, obj
, A2
),
106 AROS_UFHA(APTR
, unused_param
, A1
)
111 struct MUIDisplayObjects
*d
= (struct MUIDisplayObjects
*) obj
->userdata
;
114 if ((obj
->flags
& ACTION_UPDATE
) == 0)
118 if ((obj
->filelen
< 8192) && (d
->numfiles
> 0))
121 if (d
->smallobjects
>= 20) d
->smallobjects
= 0;
127 if (d
->smallobjects
> 0) d
->updateme
= FALSE
;
130 SET(d
->fileObject
, MUIA_Text_Contents
, obj
->file
);
131 SET(d
->sourceObject
, MUIA_Text_Contents
, obj
->spath
);
134 if (d
->action
!= ACTION_DELETE
)
137 d
->bytes
+= obj
->actlen
;
138 if ((obj
->flags
& ACTION_UPDATE
) == 0)
142 SET(d
->gauge
, MUIA_Gauge_Current
, 0);
143 SET(d
->destObject
, MUIA_Text_Contents
, obj
->dpath
);
149 if (d
->updateme
&&(obj
->totallen
<= obj
->filelen
))
151 double rate
= (double) (((double) obj
->totallen
) / (((double) obj
->difftime
) / ((double) CLOCKS_PER_SEC
))) / 1024.0;
152 if (rate
< 1024.0) sprintf(d
->SpeedBuffer
, "Speed: %.2f kBytes/s", rate
); else sprintf(d
->SpeedBuffer
, "Speed: %.2f MBytes/s", rate
/ 1024.0);
153 SetAttrs(d
->gauge
, MUIA_Gauge_Current
, (ULONG
) (32768.0 * (double) obj
->totallen
/ (double) obj
->filelen
), MUIA_Gauge_InfoText
, d
->SpeedBuffer
, TAG_DONE
);
160 if (d
->bytes
< 1048576)
162 if (obj
->filelen
< 1048576)
165 d
->Buffer
, "# of files: %ld Actual: %.2f kBytes Total: %.2f kBytes",
166 d
->numfiles
, (double) obj
->filelen
/ 1024.0, (double) d
->bytes
/ 1024.0
172 d
->Buffer
, "# of files: %ld Actual: %.2f MBytes Total: %.2f kBytes",
173 d
->numfiles
, (double) obj
->filelen
/ 1048576.0, (double) d
->bytes
/ 1024.0
179 if (obj
->filelen
< 1048576)
182 d
->Buffer
, "# of files: %ld Actual: %.2f kBytes Total: %.2f MBytes",
183 d
->numfiles
, (double) obj
->filelen
/ 1024.0, (double) d
->bytes
/ 1048576.0
189 d
->Buffer
, "# of files: %ld Actual: %.2f MBytes Total: %.2f MBytes",
190 d
->numfiles
, (double) obj
->filelen
/ 1048576.0, (double) d
->bytes
/ 1048576.0
194 SET(d
->performanceObject
, MUIA_Text_Contents
, d
->Buffer
);
198 DoMethod(d
->copyApp
, MUIM_Application_InputBuffered
);
200 /* read the stopflag and return TRUE if the user wanted to stop actionDir() */
202 if (d
->stopflag
== 1) return TRUE
; else return FALSE
;
209 ULONG
, Wanderer__HookFunc_AskDeleteFunc
,
210 AROS_UFHA(struct Hook
*, h
, A0
),
211 AROS_UFHA(struct dCopyStruct
*, obj
, A2
),
212 AROS_UFHA(APTR
, unused_param
, A1
)
217 ULONG back
= DELMODE_NONE
;
226 string
= CombineString("Really delete file\n\033b%s\033n\nlocated in\n\033b%s\033n ?",
227 obj
->file
, obj
->spath
);
229 else if (obj
->type
== 1)
231 string
= CombineString("Do you wish to unprotect file\n\033b%s\033n\nlocated in\n\033b%s\033n ?",
232 obj
->file
, obj
->spath
);
234 else if (obj
->type
== 2)
236 string
= CombineString("Really overwrite file\n\033b%s\033n\nlocated in\n\033b%s\033n ?",
237 obj
->file
, obj
->spath
);
241 string
= CombineString("Can't access file\n\033b%s\033n\nlocated in\n\033b%s\033n ?",
242 obj
->file
, obj
->spath
);
247 if (obj
->type
== 0) string
= CombineString("Really delete drawer\n\033b%s\033n ?", obj
->spath
);
248 else if (obj
->type
== 1) string
= CombineString("Do you wish to unprotect drawer\n\033b%s\033n ?", obj
->spath
);
249 else if (obj
->type
== 3) string
= CombineString("Can't access drawer\n\033b%s", obj
->spath
);
254 if (obj
->type
== 0) ret
= AskChoiceCentered("Delete Requester:", string
, "_Yes|Yes to _All|_No|No _to ALL", 0);
255 else if (obj
->type
== 1) ret
= AskChoiceCentered("Protection Requester:", string
, "_Unprotect|Unprotect _All|_No|No _to ALL", 0);
256 else if (obj
->type
== 2) ret
= AskChoiceCentered("Overwrite Requester:", string
, "_Overwrite|Overwrite _All|_No|No _to ALL", 0);
257 else ret
= AskChoiceCentered("Overwrite Requester:", string
, "_Skip|_Abort", 0);
258 freeString(NULL
, string
);
261 if (ret
== 0) back
= DELMODE_NONE
;
262 else if (ret
== 1) back
= DELMODE_DELETE
;
263 else if (ret
== 2) back
= DELMODE_ALL
;
264 else if (ret
== 3) back
= DELMODE_NO
;
272 void copy_dropentries()
274 /* get filelist from user message */
275 struct Wanderer_FilelistMsg
*message_filelist
= FindTask(NULL
)->tc_UserData
;
277 D(bug("[WANDERER COPY] CopyContent \n" ));
279 if (message_filelist
)
282 struct MUIDisplayObjects dobjects
;
283 struct Hook displayCopyHook
;
284 struct Hook displayDelHook
;
286 displayCopyHook
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_DisplayCopyFunc
;
287 displayDelHook
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_AskDeleteFunc
;
289 struct Wanderer_FileEntry
*currententry
;
291 if (CreateCopyDisplay(ACTION_COPY
, &dobjects
))
294 /* process all selected entries */
295 while ( (currententry
= (struct Wanderer_FileEntry
*)RemTail(&message_filelist
->files
)) != NULL
)
298 /* copy via filesystems.c */
299 D(bug("[WANDERER COPY] CopyContent \"%s\" to \"%s\"\n", ¤tentry
->filename
,
300 &message_filelist
->destination_string
));
302 CopyContent(NULL
, (char*)¤tentry
->filename
, (char*)&message_filelist
->destination_string
, TRUE
,
303 ACTION_COPY
, &displayCopyHook
, &displayDelHook
, (APTR
) &dobjects
);
305 FreeVec( currententry
);
308 /* delete copy window */
309 DisposeCopyDisplay(&dobjects
);
314 /* free msg memory */
315 FreeMem( message_filelist
, sizeof(struct Wanderer_FilelistMsg
) );
323 void, Wanderer__HookFunc_ActionFunc
,
324 AROS_UFHA(struct Hook
*, h
, A0
),
325 AROS_UFHA(Object
*, obj
, A2
),
326 AROS_UFHA(struct IconWindow_ActionMsg
*, msg
, A1
)
331 if (msg
->type
== ICONWINDOW_ACTION_OPEN
)
333 static unsigned char buf
[1024];
335 struct IconList_Entry
*ent
= (void*)MUIV_IconList_NextSelected_Start
;
337 DoMethod(msg
->iconlist
, MUIM_IconList_NextSelected
, (IPTR
) &ent
);
338 if ((int)ent
== MUIV_IconList_NextSelected_End
) return;
340 IPTR offset
= strlen(ent
->filename
) - 5;
342 if ((msg
->isroot
) && (!Stricmp(ent
->filename
+ offset
, ":Disk")))
344 strcpy(buf
,ent
->label
);
349 strcpy(buf
,ent
->filename
);
352 D(bug("[WANDERER] Wanderer__HookFunc_ActionFunc: ICONWINDOW_ACTION_OPEN - offset = %d, buf = %s\n", offset
, buf
);)
354 if ( (ent
->type
== ST_ROOT
) || (ent
->type
== ST_USERDIR
) )
356 Object
*cstate
= (Object
*)(((struct List
*)XGET(_app(obj
), MUIA_Application_WindowList
))->lh_Head
);
357 Object
*prefs
= (Object
*) XGET(_app(obj
), MUIA_Wanderer_Prefs
);
360 /* open new window if root or classic navigation set */
361 if ( (msg
->isroot
) || (XGET(prefs
, MUIA_IconWindowExt_Toolbar_NavigationMethod
) == WPD_NAVIGATION_CLASSIC
) )
363 while ((child
= NextObject(&cstate
)))
365 if (XGET(child
, MUIA_UserData
))
367 STRPTR child_drawer
= (STRPTR
)XGET(child
, MUIA_IconWindow_Location
);
368 if (child_drawer
&& !Stricmp(buf
,child_drawer
))
370 BOOL is_open
= ( BOOL
)XGET(child
, MUIA_Window_Open
);
374 DoMethod(child
, MUIM_IconWindow_Open
);
378 DoMethod(child
, MUIM_Window_ToFront
);
379 SET(child
, MUIA_Window_Activate
, TRUE
);
387 /* Check if the window for this drawer is already opened */
388 DoMethod(_WandererIntern_AppObj
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) buf
);
389 // FIXME: error handling
393 /* open drawer in same window */
394 SET(obj
, MUIA_IconWindow_Location
, (IPTR
) buf
);
398 else if (ent
->type
== ST_FILE
)
400 BPTR newwd
, oldwd
, file
;
402 /* Set the CurrentDir to the path of the executable to be started */
403 file
= Lock(ent
->filename
, SHARED_LOCK
);
406 newwd
= ParentDir(file
);
407 oldwd
= CurrentDir(newwd
);
409 if (!OpenWorkbenchObject(ent
->filename
, TAG_DONE
))
411 execute_open_with_command(newwd
, FilePart(ent
->filename
));
420 else if (msg
->type
== ICONWINDOW_ACTION_DIRUP
)
423 STRPTR actual_drawer
= (STRPTR
)XGET(obj
, MUIA_IconWindow_Location
);
424 STRPTR parent_drawer
= strrchr(actual_drawer
,'/');
425 STRPTR root_drawer
= strrchr(actual_drawer
,':');
427 /* check if dir is not drive root dir */
428 if ( strlen(root_drawer
) > 1 )
430 /* check if second or third level directory*/
433 (*(root_drawer
+1)) = 0;
434 SET(obj
, MUIA_IconWindow_Location
, actual_drawer
);
439 (*parent_drawer
) = 0;
440 SET(obj
, MUIA_IconWindow_Location
, actual_drawer
);
445 else if (msg
->type
== ICONWINDOW_ACTION_CLICK
)
447 if (!msg
->click
->shift
)
449 Object
*cstate
= (Object
*)(((struct List
*)XGET(_WandererIntern_AppObj
, MUIA_Application_WindowList
))->lh_Head
);
452 while ((child
= NextObject(&cstate
)))
454 if (XGET(child
, MUIA_UserData
))
456 if (child
!= obj
) DoMethod(child
, MUIM_IconWindow_UnselectAll
);
461 else if (msg
->type
== ICONWINDOW_ACTION_ICONDROP
)
463 struct Process
*child
;
465 struct IconList_Drop
*drop
= (struct IconList_Drop
*)msg
->drop
;
466 struct IconList_Entry
*ent
= (void*)MUIV_IconList_NextSelected_Start
;
467 struct Wanderer_FileEntry
*file_recordtmp
;
469 struct Wanderer_FilelistMsg
*message_filelist
= AllocMem( sizeof(struct Wanderer_FilelistMsg
), MEMF_CLEAR
|MEMF_PUBLIC
);
471 if (message_filelist
!= NULL
)
473 strcpy( (char*)&message_filelist
->destination_string
, drop
->destination_string
);
475 NEWLIST(&message_filelist
->files
);
477 /* process all selected entries */
480 DoMethod(drop
->source_iconlistobj
, MUIM_IconList_NextSelected
, (IPTR
) &ent
);
482 /* if not end of selection, process */
483 if ( (int)ent
!= MUIV_IconList_NextSelected_End
)
485 file_recordtmp
= AllocVec( sizeof(struct Wanderer_FileEntry
), MEMF_CLEAR
|MEMF_PUBLIC
);
486 strcpy( (char*)&file_recordtmp
->filename
, ent
->filename
);
487 AddTail(&message_filelist
->files
, (struct Node
*)file_recordtmp
);
490 while ( (int)ent
!= MUIV_IconList_NextSelected_End
);
492 /* create process and copy files within */
493 child
= CreateNewProcTags(
494 NP_Entry
, copy_dropentries
,
495 NP_UserData
, (IPTR
)message_filelist
,
496 NP_Name
, (ULONG
)"wanderer copy",
500 /* FIXME: update list contents */
501 /* this one should be solved through file notofications, as files are copied in a seperate process now */
508 else if (msg
->type
== ICONWINDOW_ACTION_APPWINDOWDROP
)
510 struct Screen
*wscreen
= NULL
;
513 /* get wanderers screen struct and the layer located at cursor position afterwards */
514 get( obj
, MUIA_Window_Screen
, &wscreen
);
515 layer
= WhichLayer(&wscreen
->LayerInfo
,wscreen
->MouseX
,wscreen
->MouseY
);
519 struct Window
*win
= (struct Window
*) layer
->Window
;
527 struct IconList_Entry
*ent
= (void*)MUIV_IconList_NextSelected_Start
;
528 /* process all selected entries */
531 DoMethod(msg
->iconlist
, MUIM_IconList_NextSelected
, (IPTR
) &ent
);
532 /* if not end of selection, process */
533 if ( (int)ent
!= MUIV_IconList_NextSelected_End
)
535 struct AppW
*a
= AllocVec(sizeof(struct AppW
), MEMF_CLEAR
);
538 a
->name
= AllocVec(strlen(ent
->filename
)+1, MEMF_CLEAR
);
542 strcpy(a
->name
, ent
->filename
);
543 AddTail(&AppList
, (struct Node
*) a
);
554 while ( ((int)ent
!= MUIV_IconList_NextSelected_End
) && !fail
);
556 if (!fail
&& (files
> 0))
558 STRPTR
*filelist
= AllocVec(sizeof(STRPTR
) * files
, MEMF_CLEAR
);
559 if (filelist
!= NULL
)
561 STRPTR
*flist
= filelist
;
562 if (!IsListEmpty(&AppList
))
565 struct Node
*s
= AppList
.lh_Head
;
566 while (((succ
= ((struct Node
*) s
)->ln_Succ
) != NULL
) && !fail
)
568 *flist
++ = ((struct AppW
*) s
)->name
;
572 D(bug("[WANDERER] AppWindowMsg: win:%s files:%s mx:%d my:%d\n",win
->Title
, filelist
, wscreen
->MouseX
- win
->LeftEdge
, wscreen
->MouseY
- win
->TopEdge
);)
573 /* send appwindow msg struct containing selected files to destination */
574 SendAppWindowMessage(win
, files
, filelist
, 0, wscreen
->MouseX
- win
->LeftEdge
, wscreen
->MouseY
- win
->TopEdge
, 0, 0);
580 if (!IsListEmpty(&AppList
))
583 struct Node
*s
= AppList
.lh_Head
;
584 while (((succ
= ((struct Node
*) s
)->ln_Succ
) != NULL
))
586 if ( ((struct AppW
*) s
)->name
!= NULL
)
587 FreeVec(((struct AppW
*) s
)->name
);
605 void, Wanderer__HookFunc_StandardFunc
,
606 AROS_UFHA(struct Hook
*, h
, A0
),
607 AROS_UFHA(void *, dummy
, A2
),
608 AROS_UFHA(void **, funcptr
, A1
)
613 void (*func
) (ULONG
*) = (void (*)(ULONG
*)) (*funcptr
);
614 if (func
) func((ULONG
*)(funcptr
+ 1));
621 void, Wanderer__HookFunc_BackdropFunc
,
622 AROS_UFHA(struct Hook
*, h
, A0
),
623 AROS_UFHA(void *, dummy
, A2
),
624 AROS_UFHA(void **, funcptr
, A1
)
629 D(bug("[WANDERER] Wanderer__HookFunc_BackdropFunc()\n"));
630 struct Wanderer_DATA
*data
= INST_DATA(_WandererIntern_CLASS
, _WandererIntern_AppObj
);
632 D(bug("[WANDERER] Wanderer__HookFunc_BackdropFunc: Private data @ %x\n", data
));
634 if (!data
->wd_WorkbenchWindow
)
636 D(bug("[WANDERER] Wanderer__HookFunc_BackdropFunc: No Workbench Window\n"));
640 BOOL wb_iscurrentlybd
= (BOOL
)XGET(data
->wd_WorkbenchWindow
, MUIA_IconWindow_IsBackdrop
);
642 if (wb_iscurrentlybd
!= data
->wd_Option_BackDropMode
)
644 D(bug("[WANDERER] Wanderer__HookFunc_BackdropFunc: Backdrop mode change requested!\n"));
646 BOOL isOpen
= (BOOL
)XGET(data
->wd_WorkbenchWindow
, MUIA_Window_Open
);
647 Object
*win_Active
= NULL
;
649 D(bug("[WANDERER] Wanderer__HookFunc_BackdropFunc: Disposing of existing Workbench window Obj ..\n"));
651 SET(data
->wd_WorkbenchWindow
, MUIA_Window_Open
, FALSE
);
653 if (data
->wd_WorkbenchWindow
== data
->wd_ActiveWindow
)
655 data
->wd_ActiveWindow
= NULL
;
659 win_Active
= data
->wd_ActiveWindow
;
662 /* Kill our close request notification .. */
665 data
->wd_WorkbenchWindow
, MUIM_KillNotify
, MUIA_Window_CloseRequest
668 /* .. And dispose of the window */
669 DoMethod(_WandererIntern_AppObj
, OM_REMMEMBER
, data
->wd_WorkbenchWindow
);
670 MUI_DisposeObject(data
->wd_WorkbenchWindow
);
671 data
->wd_WorkbenchWindow
= NULL
;
674 if (data
->wd_Option_BackDropMode
)
676 D(bug("[WANDERER] Wanderer__HookFunc_BackdropFunc: Creating new Workbench window Obj (BACKDROP MODE)..\n"));
680 D(bug("[WANDERER] Wanderer__HookFunc_BackdropFunc: Creating new Workbench window Obj (NORMAL MODE)..\n"));
684 data
->wd_WorkbenchWindow
= (Object
*) DoMethod
686 _WandererIntern_AppObj
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) NULL
689 if ((data
->wd_WorkbenchWindow
) && (isOpen
))
691 D(bug("[WANDERER] Wanderer__HookFunc_BackdropFunc: Making Workbench window visable..\n"));
692 DoMethod(data
->wd_WorkbenchWindow
, MUIM_IconWindow_Open
);
693 DoMethod(data
->wd_WorkbenchWindow
, MUIM_Window_ToBack
);
698 SET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
, win_Active
);
700 else if (data
->wd_WorkbenchWindow
)
702 SET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
, data
->wd_WorkbenchWindow
);
708 /******** code from workbench/c/Info.c *******************/
709 static void fmtlarge(UBYTE
*buf
, ULONG num
)
723 if (num
>= 1073741824)
725 array
.val
= num
>> 30;
726 d
= ((UQUAD
)num
* 10 + 536870912) / 1073741824;
729 ch
= strtochar((STRPTR
)_(MSG_MEM_G
));
731 else if (num
>= 1048576)
733 array
.val
= num
>> 20;
734 d
= ((UQUAD
)num
* 10 + 524288) / 1048576;
737 ch
= strtochar((STRPTR
)_(MSG_MEM_M
));
739 else if (num
>= 1024)
741 array
.val
= num
>> 10;
742 d
= (num
* 10 + 512) / 1024;
745 ch
= strtochar((STRPTR
)_(MSG_MEM_K
));
753 ch
= strtochar((STRPTR
)_(MSG_MEM_B
));
756 if (!array
.dec
&& (d
> array
.val
* 10))
761 RawDoFmt(array
.dec
? "%lu.%lu" : "%lu", &array
, NULL
, buf
);
762 while (*buf
) { buf
++; }
769 STRPTR
GetScreenTitle(VOID
)
771 STATIC TEXT title
[256];
772 UBYTE chip
[10], fast
[10];
773 fmtlarge(chip
,AvailMem(MEMF_CHIP
));
774 fmtlarge(fast
,AvailMem(MEMF_FAST
));
776 /* AROS probably don't have graphics mem but without it looks so empty */
777 sprintf(title
, _(MSG_SCREENTITLE
), chip
, fast
);
782 STRPTR
GetUserScreenTitle(Object
*self
)
784 /*Work in progress :-)
786 char *screentitlestr
;
788 GET(self
, MUIA_IconWindowExt_ScreenTitle_String
, &screentitlestr
);
790 int screentitleleng
= strlen(screentitlestr
);
792 if (screentitleleng
<1)
794 return GetScreenTitle();
796 return screentitlestr
;
800 /* Expand a passed in env: string to its full location */
801 /* Wanderer doesnt free this mem at the moment but should
802 incase it is every closed */
803 STRPTR
ExpandEnvName(STRPTR env_path
)
806 char tmp_envbuff
[1024];
807 STRPTR fullpath
= NULL
;
808 BPTR env_lock
= NULL
;
810 env_lock
= Lock("ENV:", SHARED_LOCK
);
813 if (NameFromLock(env_lock
, tmp_envbuff
, 256)) ok
= TRUE
;
819 if ((fullpath
= AllocVec(strlen(tmp_envbuff
) + strlen(env_path
) + 1 + 1 - 4, MEMF_CLEAR
| MEMF_PUBLIC
)) != NULL
)
821 strcpy(fullpath
, tmp_envbuff
);
822 AddPart(fullpath
, env_path
+ 4, 1019);
827 //We couldnt expand it so just use as is ..
834 MEN_WANDERER_BACKDROP
,
835 MEN_WANDERER_EXECUTE
,
837 MEN_WANDERER_GUISETTINGS
,
841 MEN_WINDOW_NEW_DRAWER
,
842 MEN_WINDOW_OPEN_PARENT
,
852 MEN_WINDOW_VIEW_ICON
,
853 MEN_WINDOW_VIEW_DETAIL
,
857 MEN_WINDOW_SORT_NAME
,
858 MEN_WINDOW_SORT_TYPE
,
859 MEN_WINDOW_SORT_DATE
,
860 MEN_WINDOW_SORT_SIZE
,
861 MEN_WINDOW_SORT_REVERSE
,
862 MEN_WINDOW_SORT_TOPDRAWERS
,
863 MEN_WINDOW_SORT_GROUP
,
867 MEN_ICON_INFORMATION
,
873 /**************************************************************************
874 Open the execute window. Similar to below but you can also set the
875 command. Called when item is openend
876 **************************************************************************/
877 void execute_open_with_command(BPTR cd
, STRPTR contents
)
881 if (cd
!= NULL
) lock
= cd
;
882 else lock
= Lock("RAM:", ACCESS_READ
);
886 "WANDERER:Tools/ExecuteCommand",
887 WBOPENA_ArgLock
, (IPTR
) lock
,
888 WBOPENA_ArgName
, (IPTR
) contents
,
892 if (cd
== NULL
) UnLock(lock
);
895 /**************************************************************************
896 Open the execute window
898 This function will always get the current drawer as argument
899 **************************************************************************/
900 VOID
wanderer_menufunc_wanderer_execute(STRPTR
*cdptr
)
902 //TODO: remove the STRPTR *cdptr from top
903 //TODO:remove this commented out stuff
905 //if (cdptr != NULL) lock = Lock(*cdptr, SHARED_LOCK);
906 Object
*win
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
907 STRPTR dr
= ( STRPTR
)XGET( win
, MUIA_IconWindow_Location
);
908 BPTR cd
= Lock(dr
,SHARED_LOCK
);
909 execute_open_with_command(cd
, NULL
);
913 /*******************************/
915 void wanderer_menufunc_wanderer_shell(STRPTR
*cd_ptr
)
917 //TODO: remove the STRPTR *cdptr from top
918 //TODO:remove this commented out stuff
919 //BPTR cd = Lock(*cd_ptr,ACCESS_READ);
920 Object
*win
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
921 STRPTR dr
= ( STRPTR
)XGET( win
, MUIA_IconWindow_Location
);
926 bug("wanderer_menufunc_wanderer_shell is broken, fix it please !\n");
930 cd
= Lock(dr
, ACCESS_READ
);
931 if (SystemTags("NewShell", NP_CurrentDir
, (IPTR
)cd
, TAG_DONE
) == -1)
937 void wanderer_menufunc_wanderer_backdrop(Object
**pstrip
)
939 struct Wanderer_DATA
*data
= INST_DATA(_WandererIntern_CLASS
, _WandererIntern_AppObj
);
940 Object
*strip
= *pstrip
;
941 Object
*item
= FindMenuitem(strip
, MEN_WANDERER_BACKDROP
);
943 D(bug("[WANDERER] wanderer_menufunc_wanderer_backdrop()\n"));
947 data
->wd_Option_BackDropMode
= (BOOL
)XGET(item
, MUIA_Menuitem_Checked
);
948 SET(data
->wd_WorkbenchWindow
, MUIA_IconWindow_IsBackdrop
, data
->wd_Option_BackDropMode
);
952 void wanderer_menufunc_window_newdrawer(STRPTR
*cdptr
)
954 //TODO: remove the STRPTR *cdptr from top
956 Object
*win
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
957 STRPTR dr
= ( STRPTR
)XGET( win
, MUIA_IconWindow_Location
);
958 D(bug("[wanderer] wanderer_menufunc_window_newdrawer(%s)\n", dr
));
960 Object
*actwindow
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
961 Object
*wbwindow
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_WorkbenchWindow
);
962 if (actwindow
== wbwindow
)
964 /* This check is necessary because WorkbenchWindow has path RAM: */
965 D(bug("[wanderer] wanderer_menufunc_window_newdrawer: Can't call WBNewDrawer for WorkbenchWindow\n"));
968 if ( XGET(actwindow
, MUIA_Window_Open
) == FALSE
)
970 D(bug("[wanderer] wanderer_menufunc_window_newdrawer: Can't call WBNewDrawer: the active window isn't open\n"));
974 BPTR lock
= Lock(dr
, ACCESS_READ
);
977 "WANDERER:Tools/WBNewDrawer",
978 WBOPENA_ArgLock
, (IPTR
) lock
,
985 void wanderer_menufunc_window_openparent(STRPTR
*cdptr
)
987 //TODO: Remove the **cdptr stuff from top
988 Object
*win
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
989 STRPTR dr
= ( STRPTR
)XGET( win
, MUIA_IconWindow_Location
);
992 STRPTR last_letter
=NULL
;
993 last_letter
= &dr
[ strlen(dr
) - 1 ];
995 STRPTR thispath
= FilePart(dr
);
997 if (*last_letter
==0x3a) return; /* Top Drawer has no parent to open */
999 last_letter
= &thispath
[strlen(thispath
)-1];
1001 if (*last_letter
==0x3a)
1002 path_len
= (IPTR
)(thispath
-(IPTR
)(dr
));
1004 path_len
= (IPTR
)((thispath
-(IPTR
)(dr
))-1);
1006 STRPTR buf
= AllocVec((path_len
+1),MEMF_PUBLIC
|MEMF_CLEAR
);
1007 CopyMem(dr
, buf
, path_len
);
1009 Object
*cstate
= (Object
*)(((struct List
*)XGET(_WandererIntern_AppObj
, MUIA_Application_WindowList
))->lh_Head
);
1012 // Make sure we have a correct path
1013 BOOL foundSlash
= FALSE
, foundColon
= FALSE
;
1014 int i
= 0; for ( ; i
< path_len
; i
++ )
1016 if ( buf
[ i
] == '/' ) foundSlash
= TRUE
;
1017 if ( buf
[ i
] == ':' ) foundColon
= TRUE
;
1019 if ( !foundColon
&& !foundSlash
)
1021 STRPTR newbuf
= AllocVec ((path_len
+ 2), MEMF_PUBLIC
|MEMF_CLEAR
);
1022 sprintf(newbuf
,"%s:",buf
);
1026 // Done with path correction check
1028 while ((child
= NextObject(&cstate
)))
1030 if (XGET(child
, MUIA_UserData
))
1032 STRPTR child_drawer
= (STRPTR
)XGET(child
, MUIA_IconWindow_Location
);
1033 if (child_drawer
&& !Stricmp(buf
,child_drawer
))
1035 int is_open
= XGET(child
, MUIA_Window_Open
);
1037 DoMethod(child
, MUIM_IconWindow_Open
);
1040 DoMethod(child
, MUIM_Window_ToFront
);
1041 SET(child
, MUIA_Window_Activate
, TRUE
);
1049 DoMethod(_WandererIntern_AppObj
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) buf
);
1053 void wanderer_menufunc_window_close()
1055 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1056 SET(window
, MUIA_Window_CloseRequest
, TRUE
);
1059 void wanderer_menufunc_window_update()
1061 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1062 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1064 if (iconList
!= NULL
)
1066 DoMethod(iconList
, MUIM_IconList_Update
);
1070 void wanderer_menufunc_window_clear()
1072 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1073 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1075 if (iconList
!= NULL
)
1077 DoMethod(iconList
, MUIM_IconList_UnselectAll
);
1081 void wanderer_menufunc_window_select()
1083 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1084 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1086 if (iconList
!= NULL
)
1088 DoMethod(iconList
, MUIM_IconList_SelectAll
);
1092 void wanderer_menufunc_window_view_icons(Object
**pstrip
)
1094 Object
*strip
= *pstrip
;
1095 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_VIEW_ALL
);
1096 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1097 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1099 if (item
!= NULL
&& iconList
!= NULL
)
1101 ULONG display_bits
= 0, menu_view_state
= 0;
1102 GET(iconList
, MUIA_IconList_DisplayFlags
, &display_bits
);
1104 GET(item
, MUIA_Menuitem_Checked
, &menu_view_state
);
1106 if (menu_view_state
)
1108 display_bits
&= ~ICONLIST_DISP_SHOWINFO
;
1112 display_bits
|= ICONLIST_DISP_SHOWINFO
;
1115 SET(iconList
, MUIA_IconList_DisplayFlags
, display_bits
);
1116 DoMethod(iconList
, MUIM_IconList_Sort
);
1120 void wanderer_menufunc_window_sort_name(Object
**pstrip
)
1122 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1123 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1125 if ( iconList
!= NULL
)
1127 ULONG sort_bits
= 0;
1128 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1130 /*name = date and size bit both NOT set*/
1131 if( (sort_bits
& ICONLIST_SORT_BY_DATE
) || (sort_bits
& ICONLIST_SORT_BY_SIZE
) )
1133 sort_bits
&= ~(ICONLIST_SORT_BY_DATE
| ICONLIST_SORT_BY_SIZE
);
1136 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1137 DoMethod(iconList
, MUIM_IconList_Sort
);
1141 void wanderer_menufunc_window_sort_date(Object
**pstrip
)
1143 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1144 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1146 if ( iconList
!= NULL
)
1148 ULONG sort_bits
= 0;
1149 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1151 /*exclude size bit*/
1152 if( sort_bits
& ICONLIST_SORT_BY_SIZE
)
1154 sort_bits
&= ~ICONLIST_SORT_BY_SIZE
;
1157 sort_bits
|= ICONLIST_SORT_BY_DATE
;
1159 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1160 DoMethod(iconList
, MUIM_IconList_Sort
);
1164 void wanderer_menufunc_window_sort_size(Object
**pstrip
)
1166 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1167 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1169 if ( iconList
!= NULL
)
1171 ULONG sort_bits
= 0;
1172 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1174 /*exclude date bit*/
1175 if( sort_bits
& ICONLIST_SORT_BY_DATE
)
1177 sort_bits
&= ~ICONLIST_SORT_BY_DATE
;
1180 sort_bits
|= ICONLIST_SORT_BY_SIZE
;
1182 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1183 DoMethod(iconList
, MUIM_IconList_Sort
);
1187 void wanderer_menufunc_window_sort_type(Object
**pstrip
)
1189 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1190 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1192 if ( iconList
!= NULL
)
1194 ULONG sort_bits
= 0;
1195 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1197 /*type = both date and size bits set*/
1198 sort_bits
|= (ICONLIST_SORT_BY_DATE
| ICONLIST_SORT_BY_SIZE
);
1200 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1201 DoMethod(iconList
, MUIM_IconList_Sort
);
1205 void wanderer_menufunc_window_sort_reverse(Object
**pstrip
)
1207 Object
*strip
= *pstrip
;
1208 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_REVERSE
);
1209 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1210 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1212 if (item
!= NULL
&& iconList
!= NULL
)
1214 ULONG sort_bits
= 0;
1215 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1217 if( XGET(item
, MUIA_Menuitem_Checked
) )
1219 sort_bits
|= ICONLIST_SORT_REVERSE
;
1223 sort_bits
&= ~ICONLIST_SORT_REVERSE
;
1226 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1227 DoMethod(iconList
, MUIM_IconList_Sort
);
1231 void wanderer_menufunc_window_sort_topdrawers(Object
**pstrip
)
1233 Object
*strip
= *pstrip
;
1234 Object
*item
= FindMenuitem(strip
, MEN_WINDOW_SORT_TOPDRAWERS
);
1235 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1236 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1238 if (item
!= NULL
&& iconList
!= NULL
)
1240 ULONG sort_bits
= 0;
1241 GET(iconList
, MUIA_IconList_SortFlags
, &sort_bits
);
1243 if( XGET(item
, MUIA_Menuitem_Checked
) )
1245 sort_bits
&= !ICONLIST_SORT_DRAWERS_MIXED
;
1249 sort_bits
|= ICONLIST_SORT_DRAWERS_MIXED
;
1252 SET(iconList
, MUIA_IconList_SortFlags
, sort_bits
);
1253 DoMethod(iconList
, MUIM_IconList_Sort
);
1257 void wanderer_menufunc_icon_open()
1259 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1260 DoMethod(window
, MUIM_IconWindow_DoubleClicked
);
1263 void wanderer_menufunc_icon_rename(void)
1265 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1266 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1267 struct IconList_Entry
*entry
= (APTR
) MUIV_IconList_NextSelected_Start
;
1271 DoMethod(iconList
, MUIM_IconList_NextSelected
, (IPTR
) &entry
);
1273 if ((int)entry
!= MUIV_IconList_NextSelected_End
)
1275 BPTR lock
= Lock(entry
->filename
, ACCESS_READ
);
1276 BPTR parent
= ParentDir(lock
);
1279 D(bug("[wanderer] wanderer_menufunc_icon_rename: selected = '%s'\n", entry
->filename
));
1283 "WANDERER:Tools/WBRename",
1284 WBOPENA_ArgLock
, (IPTR
) parent
,
1285 WBOPENA_ArgName
, (IPTR
) FilePart(entry
->filename
),
1289 D(bug("[wanderer] wanderer_menufunc_icon_rename: selected = '%s'\n", entry
->filename
));
1300 void wanderer_menufunc_icon_information()
1302 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1303 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1304 struct IconList_Entry
*entry
= (APTR
) MUIV_IconList_NextSelected_Start
;
1308 DoMethod(iconList
, MUIM_IconList_NextSelected
, (IPTR
) &entry
);
1310 if ((int)entry
!= MUIV_IconList_NextSelected_End
)
1312 BPTR lock
= Lock(entry
->filename
, ACCESS_READ
);
1313 BPTR parent
= ParentDir(lock
);
1316 D(bug("[wanderer] wanderer_menufunc_icon_information: selected = '%s'\n", entry
->filename
));
1318 WBInfo(parent
, entry
->filename
, NULL
);
1329 /* dispose the file copy display */
1331 void DisposeCopyDisplay(struct MUIDisplayObjects
*d
)
1335 //SET(d->win,MUIA_Window_Open,FALSE);
1336 MUI_DisposeObject(d
->copyApp
);
1340 /* create the file copy window */
1341 BOOL
CreateCopyDisplay(UWORD flags
, struct MUIDisplayObjects
*d
)
1345 Object
*group
, *fromObject
, *toObject
, *fileTextObject
, *fileLengthObject
, *gaugeGroup
;
1347 d
->stopflag
= 0; // will be set to 1 when clicking on stop, than the displayhook can tell actionDir() to stop copy
1351 d
->smallobjects
= 0;
1352 d
->copyApp
= ApplicationObject
,
1353 MUIA_Application_Title
, (IPTR
)"CopyRequester",
1354 MUIA_Application_Base
, (IPTR
)"WANDERER_COPY",
1355 SubWindow
, (IPTR
)(d
->win
= WindowObject
,
1356 MUIA_Window_Title
, (IPTR
)"Copy Filesystem",
1357 MUIA_Window_Activate
, TRUE
,
1358 MUIA_Window_DepthGadget
, TRUE
,
1359 MUIA_Window_DragBar
, TRUE
,
1360 MUIA_Window_SizeGadget
, TRUE
,
1361 MUIA_Window_AppWindow
, FALSE
,
1362 MUIA_Window_CloseGadget
, FALSE
,
1363 MUIA_Window_Borderless
, FALSE
,
1364 MUIA_Window_TopEdge
, MUIV_Window_TopEdge_Centered
,
1365 MUIA_Window_LeftEdge
, MUIV_Window_LeftEdge_Centered
,
1366 MUIA_Window_Width
, MUIV_Window_Width_Visible(60),
1367 WindowContents
, (group
= VGroup
,
1368 Child
, (IPTR
)(fromObject
= TextObject
,
1370 MUIA_Text_PreParse
, (IPTR
)"\33c",
1372 Child
, (IPTR
)(d
->sourceObject
= TextObject
,
1375 MUIA_Background
, MUII_TextBack
,
1376 MUIA_Text_PreParse
, (IPTR
)"\33c",
1377 MUIA_Text_Contents
, (IPTR
)"---",
1379 Child
, (IPTR
)(toObject
= TextObject
,
1381 MUIA_Text_PreParse
, (IPTR
)"\33c",
1383 Child
, (IPTR
)(d
->destObject
= TextObject
,
1386 MUIA_Background
, MUII_TextBack
,
1387 MUIA_Text_PreParse
, (IPTR
)"\33c",
1388 MUIA_Text_Contents
, (IPTR
)"---",
1390 Child
, (IPTR
)(fileTextObject
= TextObject
,
1392 MUIA_Text_PreParse
, (IPTR
)"\33c",
1394 Child
, (IPTR
)(d
->fileObject
= TextObject
,
1397 MUIA_Background
, MUII_TextBack
,
1398 MUIA_Text_PreParse
, (IPTR
)"\33c",
1399 MUIA_Text_Contents
, (IPTR
)"---",
1401 Child
, (IPTR
)(fileLengthObject
= TextObject
,
1403 MUIA_Text_PreParse
, (IPTR
)"\33c",
1405 Child
, (IPTR
)(gaugeGroup
= VGroup
,
1407 Child
, d
->gauge
= GaugeObject
,
1408 MUIA_Gauge_Horiz
, TRUE
,
1409 MUIA_Gauge_Max
, 32768,
1410 MUIA_Gauge_InfoText
, "Processing...",
1413 MUIA_Scale_Horiz
, TRUE
,
1416 Child
, (IPTR
)( d
->performanceObject
= TextObject
,
1419 MUIA_Background
, MUII_TextBack
,
1420 MUIA_Text_PreParse
, (IPTR
)"\33c",
1421 MUIA_Text_Contents
, (IPTR
)"...........0 Bytes...........",
1424 Child
, (IPTR
)( d
->stopObject
= SimpleButton("Stop") ),
1432 if ((flags
& (ACTION_COPY
|ACTION_DELETE
)) == (ACTION_COPY
|ACTION_DELETE
))
1434 SET(fromObject
, MUIA_Text_Contents
, (IPTR
)"move from");
1435 SET(toObject
, MUIA_Text_Contents
, (IPTR
)"move to");
1436 SET(fileTextObject
, MUIA_Text_Contents
, (IPTR
)"file");
1437 SET(fileLengthObject
, MUIA_Text_Contents
, (IPTR
)"traffic");
1439 else if ((flags
& ACTION_COPY
) == ACTION_COPY
)
1441 SET(fromObject
, MUIA_Text_Contents
, (IPTR
)"copy from");
1442 SET(toObject
, MUIA_Text_Contents
, (IPTR
)"copy to");
1443 SET(fileTextObject
, MUIA_Text_Contents
, (IPTR
)"file");
1444 SET(fileLengthObject
, MUIA_Text_Contents
, (IPTR
)"traffic");
1447 else if ((flags
& ACTION_DELETE
) == ACTION_DELETE
)
1449 SET(fromObject
, MUIA_Text_Contents
, "delete from");
1450 DoMethod(group
, MUIM_Group_InitChange
);
1451 DoMethod(group
, OM_REMMEMBER
, toObject
);
1452 DoMethod(group
, OM_REMMEMBER
, fileLengthObject
);
1453 DoMethod(group
, OM_REMMEMBER
, d
->performanceObject
);
1454 DoMethod(group
, OM_REMMEMBER
, d
->destObject
);
1455 DoMethod(group
, OM_REMMEMBER
, gaugeGroup
);
1456 DoMethod(group
, MUIM_Group_ExitChange
);
1457 SET(fileTextObject
, MUIA_Text_Contents
, "file to delete");
1460 SET(d
->win
,MUIA_Window_Open
,TRUE
);
1461 DoMethod(d
->stopObject
,MUIM_Notify
, MUIA_Pressed
, FALSE
, d
->stopObject
, 3, MUIM_WriteLong
, 1 ,&d
->stopflag
);
1467 void wanderer_menufunc_icon_delete(void)
1469 Object
*window
= (Object
*) XGET(_WandererIntern_AppObj
, MUIA_Wanderer_ActiveWindow
);
1470 Object
*iconList
= (Object
*) XGET(window
, MUIA_IconWindow_IconList
);
1471 struct IconList_Entry
*entry
= ( void*) MUIV_IconList_NextSelected_Start
;
1472 DoMethod(iconList
, MUIM_IconList_NextSelected
, (IPTR
) &entry
);
1474 struct MUIDisplayObjects dobjects
;
1475 struct Hook displayCopyHook
;
1476 struct Hook displayDelHook
;
1477 displayCopyHook
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_DisplayCopyFunc
;
1478 displayDelHook
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_AskDeleteFunc
;
1480 ULONG updatedIcons
= 0;
1482 /* Process all selected entries */
1483 if (CreateCopyDisplay(ACTION_DELETE
, &dobjects
))
1487 if ((int)entry
!= MUIV_IconList_NextSelected_End
)
1489 /* copy via filesystems.c */
1490 D(bug("[WANDERER] Delete \"%s\"\n", entry
->filename
);)
1491 CopyContent( NULL
, entry
->filename
, NULL
, TRUE
, ACTION_DELETE
, &displayCopyHook
, &displayDelHook
, (APTR
) &dobjects
);
1494 DoMethod(iconList
, MUIM_IconList_NextSelected
, (IPTR
) &entry
);
1496 while ( (int)entry
!= MUIV_IconList_NextSelected_End
);
1497 DisposeCopyDisplay(&dobjects
);
1499 // Only update list if anything happened to the icons!
1500 if ( updatedIcons
> 0 )
1502 DoMethod(window
, MUIM_IconWindow_UnselectAll
);
1503 DoMethod ( iconList
, MUIM_IconList_Update
);
1507 void wanderer_menufunc_wanderer_guisettings(void)
1509 //DoMethod(_WandererIntern_AppObj, MUIM_Application_OpenConfigWindow);
1510 OpenWorkbenchObject("SYS:Prefs/Zune",
1511 WBOPENA_ArgName
, (IPTR
) "WANDERER",
1515 void wanderer_menufunc_wanderer_about(void)
1517 OpenWorkbenchObject("SYS:System/About", TAG_DONE
);
1520 void wanderer_menufunc_wanderer_quit(void)
1522 if (OpenWorkbenchObject("WANDERER:Tools/Quit", TAG_DONE
))
1526 if (MUI_RequestA(_WandererIntern_AppObj
, NULL
, 0, "Wanderer", _(MSG_YESNO
), _(MSG_REALLYQUIT
), NULL
))
1527 DoMethod(_WandererIntern_AppObj
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
1532 /**************************************************************************
1533 This function returns a Menu Object with the given id
1534 **************************************************************************/
1535 Object
*FindMenuitem(Object
* strip
, int id
)
1537 return (Object
*)DoMethod(strip
, MUIM_FindUData
, id
);
1540 /**************************************************************************
1541 This connects a notify to the given menu entry id
1542 **************************************************************************/
1543 VOID
DoMenuNotify(Object
* strip
, int id
, void *function
, void *arg
)
1546 entry
= FindMenuitem(strip
,id
);
1551 entry
, MUIM_Notify
, MUIA_Menuitem_Trigger
, MUIV_EveryTime
,
1552 (IPTR
) entry
, 4, MUIM_CallHook
, (IPTR
) &_WandererIntern_hook_standard
,
1553 (IPTR
) function
, (IPTR
) arg
1558 VOID
DoAllMenuNotifies(Object
*strip
, STRPTR path
)
1564 DoMenuNotify(strip
, MEN_WANDERER_EXECUTE
, wanderer_menufunc_wanderer_execute
, path
);
1565 DoMenuNotify(strip
, MEN_WANDERER_SHELL
, wanderer_menufunc_wanderer_shell
, path
);
1566 DoMenuNotify(strip
, MEN_WANDERER_GUISETTINGS
, wanderer_menufunc_wanderer_guisettings
, NULL
);
1567 DoMenuNotify(strip
, MEN_WANDERER_ABOUT
, wanderer_menufunc_wanderer_about
, NULL
);
1568 DoMenuNotify(strip
, MEN_WANDERER_QUIT
, wanderer_menufunc_wanderer_quit
, NULL
);
1570 DoMenuNotify(strip
, MEN_WINDOW_NEW_DRAWER
, wanderer_menufunc_window_newdrawer
, path
);
1571 DoMenuNotify(strip
, MEN_WINDOW_OPEN_PARENT
, wanderer_menufunc_window_openparent
, path
);
1572 DoMenuNotify(strip
, MEN_WINDOW_CLOSE
, wanderer_menufunc_window_close
, NULL
);
1573 DoMenuNotify(strip
, MEN_WINDOW_UPDATE
, wanderer_menufunc_window_update
, NULL
);
1574 DoMenuNotify(strip
, MEN_WINDOW_CLEAR
, wanderer_menufunc_window_clear
, NULL
);
1575 DoMenuNotify(strip
, MEN_WINDOW_SELECT
, wanderer_menufunc_window_select
, NULL
);
1576 DoMenuNotify(strip
, MEN_WINDOW_VIEW_ALL
, wanderer_menufunc_window_view_icons
, strip
);
1577 DoMenuNotify(strip
, MEN_WINDOW_SORT_NAME
, wanderer_menufunc_window_sort_name
, strip
);
1578 DoMenuNotify(strip
, MEN_WINDOW_SORT_TYPE
, wanderer_menufunc_window_sort_type
, strip
);
1579 DoMenuNotify(strip
, MEN_WINDOW_SORT_DATE
, wanderer_menufunc_window_sort_date
, strip
);
1580 DoMenuNotify(strip
, MEN_WINDOW_SORT_SIZE
, wanderer_menufunc_window_sort_size
, strip
);
1581 DoMenuNotify(strip
, MEN_WINDOW_SORT_REVERSE
, wanderer_menufunc_window_sort_reverse
, strip
);
1582 DoMenuNotify(strip
, MEN_WINDOW_SORT_TOPDRAWERS
, wanderer_menufunc_window_sort_topdrawers
, strip
);
1584 DoMenuNotify(strip
, MEN_ICON_OPEN
, wanderer_menufunc_icon_open
, NULL
);
1585 DoMenuNotify(strip
, MEN_ICON_RENAME
, wanderer_menufunc_icon_rename
, NULL
);
1586 DoMenuNotify(strip
, MEN_ICON_INFORMATION
, wanderer_menufunc_icon_information
, NULL
);
1587 DoMenuNotify(strip
, MEN_ICON_DELETE
, wanderer_menufunc_icon_delete
, NULL
);
1589 if ((item
= FindMenuitem(strip
, MEN_WANDERER_BACKDROP
)))
1593 item
, MUIM_Notify
, MUIA_Menuitem_Trigger
, MUIV_EveryTime
,
1594 (IPTR
) _WandererIntern_AppObj
, 7, MUIM_Application_PushMethod
,
1595 (IPTR
) _WandererIntern_AppObj
, 4, MUIM_CallHook
, (IPTR
) &_WandererIntern_hook_standard
,
1596 (IPTR
) wanderer_menufunc_wanderer_backdrop
, (IPTR
) strip
1601 /*** Methods ****************************************************************/
1602 Object
*Wanderer__OM_NEW(Class
*CLASS
, Object
*self
, struct opSet
*message
)
1604 D(bug("[Wanderer] Wanderer__OM_NEW()\n"));
1606 self
= (Object
*) DoSuperNewTags
1610 MUIA_Application_Title
, (IPTR
) "Wanderer",
1611 MUIA_Application_Base
, (IPTR
) "WANDERER",
1612 MUIA_Application_Version
, (IPTR
) VERSION
,
1613 MUIA_Application_Description
, (IPTR
) _(MSG_DESCRIPTION
),
1614 MUIA_Application_SingleTask
, TRUE
,
1616 TAG_MORE
, (IPTR
) message
->ops_AttrList
1621 SETUP_WANDERER_INST_DATA
;
1623 D(bug("[Wanderer] Wanderer__OM_NEW: SELF = %d, Private data @ %x\n", self
, data
));
1625 _WandererIntern_CLASS
= CLASS
;
1627 #if defined(WANDERER_DEFAULT_BACKDROP)
1628 data
->wd_Option_BackDropMode
= TRUE
;
1630 data
->wd_Option_BackDropMode
= FALSE
;
1633 /*-- Setup hooks structures ----------------------------------------*/
1634 _WandererIntern_hook_standard
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_StandardFunc
;
1635 _WandererIntern_hook_action
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_ActionFunc
;
1636 _WandererIntern_hook_backdrop
.h_Entry
= (HOOKFUNC
) Wanderer__HookFunc_BackdropFunc
;
1639 if ((data
->wd_CommandPort
= CreateMsgPort()) == NULL
)
1641 CoerceMethod(CLASS
, self
, OM_DISPOSE
);
1645 if ((data
->wd_NotifyPort
= CreateMsgPort()) == NULL
)
1647 CoerceMethod(CLASS
, self
, OM_DISPOSE
);
1651 RegisterWorkbench(data
->wd_CommandPort
);
1653 /* Setup command port handler --------------------------------------*/
1654 data
->wd_CommandIHN
.ihn_Signals
= 1UL << data
->wd_CommandPort
->mp_SigBit
;
1655 data
->wd_CommandIHN
.ihn_Object
= self
;
1656 data
->wd_CommandIHN
.ihn_Method
= MUIM_Wanderer_HandleCommand
;
1660 self
, MUIM_Application_AddInputHandler
, (IPTR
) &data
->wd_CommandIHN
1663 /* Setup timer handler ---------------------------------------------*/
1664 data
->wd_TimerIHN
.ihn_Flags
= MUIIHNF_TIMER
;
1665 data
->wd_TimerIHN
.ihn_Millis
= 3000;
1666 data
->wd_TimerIHN
.ihn_Object
= self
;
1667 data
->wd_TimerIHN
.ihn_Method
= MUIM_Wanderer_HandleTimer
;
1671 self
, MUIM_Application_AddInputHandler
, (IPTR
) &data
->wd_TimerIHN
1674 /* Setup filesystem notification handler ---------------------------*/
1675 data
->wd_NotifyIHN
.ihn_Signals
= 1UL << data
->wd_NotifyPort
->mp_SigBit
;
1676 data
->wd_NotifyIHN
.ihn_Object
= self
;
1677 data
->wd_NotifyIHN
.ihn_Method
= MUIM_Wanderer_HandleNotify
;
1681 self
, MUIM_Application_AddInputHandler
, (IPTR
) &data
->wd_NotifyIHN
1684 // All the following should be moved to InitWandererPrefs
1686 /* Setup notification on prefs file --------------------------------*/
1687 data
->pnr
.nr_Name
= ExpandEnvName("ENV:SYS/Wanderer.prefs");
1688 data
->pnr
.nr_Flags
= NRF_SEND_MESSAGE
;
1689 data
->pnr
.nr_stuff
.nr_Msg
.nr_Port
= data
->wd_NotifyPort
;
1691 if (StartNotify(&data
->pnr
))
1693 D(bug("[Wanderer] Wanderer__OM_NEW: Prefs-notification setup on '%s'\n", data
->pnr
.nr_Name
));
1697 D(bug("[Wanderer] Wanderer__OM_NEW: FAILED to setup Prefs-notification!\n"));
1700 data
->wd_Prefs
= WandererPrefsObject
, End
; // FIXME: error handling
1702 D(bug("[Wanderer] Wanderer__OM_NEW: Prefs-SCREENTITLE IS = '%s'\n",XGET(data
->wd_Prefs
, MUIA_IconWindowExt_ScreenTitle_String
)));
1705 data
->wd_PrefsIntern
= InitWandererPrefs();
1711 IPTR
Wanderer__OM_DISPOSE(Class
*CLASS
, Object
*self
, Msg message
)
1713 SETUP_WANDERER_INST_DATA
;
1715 if (data
->wd_CommandPort
)
1718 They only have been added if the creation of the msg port was
1721 DoMethod(self
, MUIM_Application_RemInputHandler
, (IPTR
) &data
->wd_TimerIHN
);
1722 DoMethod(self
, MUIM_Application_RemInputHandler
, (IPTR
) &data
->wd_CommandIHN
);
1723 DoMethod(self
, MUIM_Application_RemInputHandler
, (IPTR
) &data
->wd_NotifyIHN
);
1725 UnregisterWorkbench(data
->wd_CommandPort
);
1727 EndNotify(&data
->pnr
);
1729 DeleteMsgPort(data
->wd_NotifyPort
);
1730 data
->wd_NotifyPort
= NULL
;
1732 DeleteMsgPort(data
->wd_CommandPort
);
1733 data
->wd_CommandPort
= NULL
;
1735 DisposeObject(data
->wd_Prefs
);
1736 data
->wd_Prefs
= NULL
;
1739 return DoSuperMethodA(CLASS
, self
, (Msg
) message
);
1742 IPTR
Wanderer__OM_SET(Class
*CLASS
, Object
*self
, struct opSet
*message
)
1744 SETUP_WANDERER_INST_DATA
;
1745 struct TagItem
*tstate
= message
->ops_AttrList
, *tag
;
1747 while ((tag
= NextTagItem((const struct TagItem
**)&tstate
)) != NULL
)
1749 switch (tag
->ti_Tag
)
1751 case MUIA_Wanderer_Screen
:
1752 D(bug("[Wanderer] Wanderer__OM_SET: MUIA_Wanderer_Screen = %p\n", tag
->ti_Data
));
1753 D(bug("[Wanderer] Wanderer__OM_SET: setting MUIA_Wanderer_Screen isnt yet handled!\n"));
1756 case MUIA_Wanderer_ActiveWindow
:
1757 data
->wd_ActiveWindow
= (Object
*) tag
->ti_Data
;
1758 D(bug("[Wanderer] Wanderer__OM_SET: MUIA_Wanderer_ActiveWindow = %p\n", tag
->ti_Data
));
1759 if (!(XGET(data
->wd_ActiveWindow
, MUIA_Window_Activate
)))
1760 NNSET(data
->wd_ActiveWindow
, MUIA_Window_Activate
, TRUE
);
1764 case MUIA_Application_Iconified
:
1765 /* Wanderer itself cannot be iconified,
1766 just hide, instead. */
1767 tag
->ti_Tag
= MUIA_ShowMe
;
1768 tag
->ti_Data
= !tag
->ti_Data
;
1773 return DoSuperMethodA(CLASS
, self
, (Msg
) message
);
1776 IPTR
Wanderer__OM_GET(Class
*CLASS
, Object
*self
, struct opGet
*message
)
1778 SETUP_WANDERER_INST_DATA
;
1779 IPTR
*store
= message
->opg_Storage
;
1782 switch (message
->opg_AttrID
)
1784 case MUIA_Wanderer_Screen
:
1785 *store
= (IPTR
) data
->wd_Screen
;
1788 case MUIA_Wanderer_Prefs
:
1789 *store
= (IPTR
) data
->wd_Prefs
;
1792 case MUIA_Wanderer_ActiveWindow
:
1793 *store
= (IPTR
) data
->wd_ActiveWindow
;
1796 case MUIA_Wanderer_WorkbenchWindow
:
1797 *store
= (IPTR
) data
->wd_WorkbenchWindow
;
1801 rv
= DoSuperMethodA(CLASS
, self
, (Msg
) message
);
1807 /* Main entry point for Wanderer Application Object */
1809 When the executable creates our object it calls zune
1810 to handle basic "control" ... which results in Zune
1811 calling this method ..
1813 IPTR Wanderer__MUIM_Application_Execute
1815 Class
*CLASS
, Object
*self
, Msg message
1818 SETUP_WANDERER_INST_DATA
;
1820 D(bug("[Wanderer] Wanderer__MUIM_Application_Execute() ##\n[Wanderer] Wanderer__MUIM_Application_Execute: Creating 'Workbench' Window..\n"));
1822 data
->wd_WorkbenchWindow
= (Object
*) DoMethod
1824 self
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) NULL
1827 if (data
->wd_WorkbenchWindow
!= NULL
)
1829 D(bug("[Wanderer] Wanderer__MUIM_Application_Execute: Workbench Window Obj @ %x\n", data
->wd_WorkbenchWindow
));
1833 D(bug("[Wanderer] Wanderer__MUIM_Application_Execute: Really handing control to Zune ..\n"));
1835 DoSuperMethodA(CLASS
, self
, message
);
1840 #warning "TODO: Report an error if we fail to create the Workbench's window ..."
1842 return RETURN_ERROR
;
1845 /*This function uses GetScreenTitle() function...*/
1847 IPTR Wanderer__MUIM_Wanderer_HandleTimer
1849 Class
*CLASS
, Object
*self
, Msg message
1852 SETUP_WANDERER_INST_DATA
;
1853 Object
*cstate
= (Object
*)(((struct List
*)XGET(self
, MUIA_Application_WindowList
))->lh_Head
);
1854 Object
*child
= NULL
;
1856 STRPTR scr_title
= GetUserScreenTitle(data
->wd_Prefs
);
1858 while ((child
= NextObject(&cstate
)))
1859 SET(child
, MUIA_Window_ScreenTitle
, (IPTR
) scr_title
);
1865 IPTR Wanderer__MUIM_Wanderer_HandleCommand
1867 Class
*CLASS
, Object
*self
, Msg message
1870 SETUP_WANDERER_INST_DATA
;
1871 struct WBHandlerMessage
*wbhm
= NULL
;
1873 D(bug("[Wanderer] Recieved signal at notify port\n"));
1875 while ((wbhm
= WBHM(GetMsg(data
->wd_CommandPort
))) != NULL
)
1877 D(bug("[Wanderer] Recieved message from handler, type = %ld\n", wbhm
->wbhm_Type
));
1879 switch (wbhm
->wbhm_Type
)
1881 case WBHM_TYPE_SHOW
:
1882 D(bug("[Wanderer] WBHM_TYPE_SHOW\n"));
1883 SET(self
, MUIA_ShowMe
, TRUE
);
1886 case WBHM_TYPE_HIDE
:
1887 D(bug("[Wanderer] WBHM_TYPE_HIDE\n"));
1888 SET(self
, MUIA_ShowMe
, FALSE
);
1891 case WBHM_TYPE_UPDATE
:
1892 D(bug("[Wanderer] WBHM_TYPE_UPDATE\n"));
1894 CONST_STRPTR name
= wbhm
->wbhm_Data
.Update
.Name
;
1897 switch (wbhm
->wbhm_Data
.Update
.Type
)
1902 length
= strlen(name
);
1906 length
= PathPart(name
) - name
;
1910 D(bug("[Wanderer] name = %s, length = %ld\n", name
, length
));
1913 Object
*cstate
= (Object
*)(((struct List
*)XGET(self
, MUIA_Application_WindowList
))->lh_Head
);
1914 Object
*child
= NULL
;
1916 while ((child
= NextObject(&cstate
)))
1918 if (XGET(child
, MUIA_UserData
))
1920 STRPTR child_drawer
= (STRPTR
)XGET(child
, MUIA_IconWindow_Location
);
1924 child_drawer
!= NULL
1925 && strncmp(name
, child_drawer
, length
) == 0
1926 && strlen(child_drawer
) == length
1929 Object
*iconlist
= (Object
*) XGET(child
, MUIA_IconWindow_IconList
);
1931 D(bug("[Wanderer] Drawer found: %s!\n", child_drawer
));
1933 if (iconlist
!= NULL
)
1935 DoMethod ( iconlist
, MUIM_IconList_Update
);
1945 case WBHM_TYPE_OPEN
:
1946 D(bug("[Wanderer] WBHM_TYPE_OPEN\n"));
1949 Object
*cstate
= (Object
*)(((struct List
*)XGET(self
, MUIA_Application_WindowList
))->lh_Head
);
1951 CONST_STRPTR buf
= wbhm
->wbhm_Data
.Open
.Name
;
1953 while ((child
= NextObject(&cstate
)))
1955 if (XGET(child
, MUIA_UserData
))
1957 STRPTR child_drawer
= (STRPTR
)XGET(child
, MUIA_IconWindow_Location
);
1958 if (child_drawer
&& !Stricmp(buf
,child_drawer
))
1960 int is_open
= XGET(child
, MUIA_Window_Open
);
1962 DoMethod(child
, MUIM_IconWindow_Open
);
1965 DoMethod(child
, MUIM_Window_ToFront
);
1966 SET(child
, MUIA_Window_Activate
, TRUE
);
1975 _WandererIntern_AppObj
, MUIM_Wanderer_CreateDrawerWindow
, (IPTR
) buf
1981 ReplyMsg((struct Message
*) wbhm
);
1988 IPTR Wanderer__MUIM_Wanderer_HandleNotify
1990 Class
*CLASS
, Object
*self
, Msg message
1993 SETUP_WANDERER_INST_DATA
;
1994 struct Message
*notifyMessage
= NULL
;
1996 D(bug("[Wanderer] Wanderer__MUIM_Wanderer_HandleNotify: got prefs change notification!\n"));
1998 while ((notifyMessage
= GetMsg(data
->wd_NotifyPort
)) != NULL
)
2000 ReplyMsg(notifyMessage
);
2003 /* reload prefs file */
2004 DoMethod(data
->wd_Prefs
, MUIM_WandererPrefs_Reload
);
2009 /* Some differences here between volumes and subwindows */
2010 Object
* __CreateWandererIntuitionMenu__ ( BOOL isRoot
, BOOL isBackdrop
)
2012 Object
*_NewWandIntMenu__menustrip
= NULL
;
2013 IPTR _NewWandIntMenu__OPTION_BACKDROP
= CHECKIT
|MENUTOGGLE
;
2014 IPTR _NewWandIntMenu__OPTION_SHOWALL
= CHECKIT
|MENUTOGGLE
;
2018 _NewWandIntMenu__OPTION_BACKDROP
|= CHECKED
;
2021 #if defined(WANDERER_DEFAULT_SHOWALL)
2022 _NewWandIntMenu__OPTION_SHOWALL
|= CHECKED
;
2027 struct NewMenu nm
[] = {
2028 {NM_TITLE
, _(MSG_MEN_WANDERER
)},
2029 {NM_ITEM
, _(MSG_MEN_BACKDROP
),_(MSG_MEN_SC_BACKDROP
), _NewWandIntMenu__OPTION_BACKDROP
, 0, (APTR
) MEN_WANDERER_BACKDROP
},
2030 {NM_ITEM
, _(MSG_MEN_EXECUTE
), _(MSG_MEN_SC_EXECUTE
) , 0 , 0, (APTR
) MEN_WANDERER_EXECUTE
},
2032 {NM_ITEM
, _(MSG_MEN_SHELL
), _(MSG_MEN_SC_SHELL
) , 0 , 0, (APTR
) MEN_WANDERER_SHELL
},
2033 {NM_ITEM
, _(MSG_MEN_GUISET
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_GUISETTINGS
},
2034 {NM_ITEM
, _(MSG_MEN_ABOUT
), _(MSG_MEN_SC_ABOUT
) , 0 , 0, (APTR
) MEN_WANDERER_ABOUT
},
2035 {NM_ITEM
, _(MSG_MEN_QUIT
) , _(MSG_MEN_SC_QUIT
) , 0 , 0, (APTR
) MEN_WANDERER_QUIT
},
2037 {NM_TITLE
, _(MSG_MEN_WINDOW
), NULL
, 0},
2039 {NM_ITEM
, _(MSG_MEN_UPDATE
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_UPDATE
},
2040 {NM_ITEM
, NM_BARLABEL
},
2041 {NM_ITEM
, _(MSG_MEN_CONTENTS
), _(MSG_MEN_SC_CONTENTS
), 0 , 0, (APTR
) MEN_WINDOW_SELECT
},
2042 {NM_ITEM
, _(MSG_MEN_CLRSEL
), _(MSG_MEN_SC_CLRSEL
) , 0 , 0, (APTR
) MEN_WINDOW_CLEAR
},
2043 {NM_ITEM
, NM_BARLABEL
},
2044 {NM_ITEM
, _(MSG_MEN_SNAPSHT
) },
2045 {NM_SUB
, _(MSG_MEN_WINDOW
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_SNAP_WIN
},
2046 {NM_SUB
, _(MSG_MEN_ALL
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_SNAP_ALL
},
2047 {NM_ITEM
, NM_BARLABEL
},
2048 {NM_ITEM
, _(MSG_MEN_VIEW
)},
2049 {NM_SUB
, _(MSG_MEN_ICVIEW
), NULL
, CHECKIT
|CHECKED
,8+16+32, (APTR
) MEN_WINDOW_VIEW_ICON
},
2050 {NM_SUB
, _(MSG_MEN_DCVIEW
), NULL
, CHECKIT
,4+16+32, (APTR
) MEN_WINDOW_VIEW_DETAIL
},
2051 {NM_SUB
, NM_BARLABEL
},
2052 {NM_SUB
, _(MSG_MEN_ALLFIL
), NULL
, _NewWandIntMenu__OPTION_SHOWALL
, 0, (APTR
) MEN_WINDOW_VIEW_ALL
},
2053 {NM_ITEM
, _(MSG_MEN_SORTIC
)},
2054 {NM_SUB
, _(MSG_MEN_CLNUP
), _(MSG_MEN_SC_CLNUP
) , 0 , 0, (APTR
) MEN_WINDOW_SORT_NOW
},
2055 {NM_SUB
, NM_BARLABEL
},
2056 {NM_SUB
, _(MSG_MEN_BYNAME
), NULL
, CHECKIT
|CHECKED
,8+16+32, (APTR
) MEN_WINDOW_SORT_NAME
},
2057 {NM_SUB
, _(MSG_MEN_BYDATE
), NULL
, CHECKIT
,4+16+32, (APTR
) MEN_WINDOW_SORT_DATE
},
2058 {NM_SUB
, _(MSG_MEN_BYSIZE
), NULL
, CHECKIT
,4+8+32, (APTR
) MEN_WINDOW_SORT_SIZE
},
2059 //{NM_SUB, "..by Type", NULL, CHECKIT,4+8+16, (APTR) MEN_WINDOW_SORT_TYPE},
2060 {NM_SUB
, NM_BARLABEL
},
2061 {NM_SUB
, _(MSG_MEN_REVERSE
), NULL
, CHECKIT
|MENUTOGGLE
, 0, (APTR
) MEN_WINDOW_SORT_REVERSE
},
2062 {NM_SUB
, _(MSG_MEN_DRWFRST
), NULL
, CHECKIT
|MENUTOGGLE
|CHECKED
, 0, (APTR
) MEN_WINDOW_SORT_TOPDRAWERS
},
2063 //{NM_SUB, "Group Icons", NULL, CHECKIT|MENUTOGGLE|CHECKED, 0, (APTR) MEN_WINDOW_SORT_GROUP},
2065 {NM_TITLE
, _(MSG_MEN_ICON
), NULL
, 0},
2066 {NM_ITEM
, _(MSG_MEN_OPEN
), _(MSG_MEN_SC_OPEN
), 0, 0, (APTR
) MEN_ICON_OPEN
},
2067 // {NM_ITEM, "Close","C" },
2068 {NM_ITEM
, _(MSG_MEN_RENAME
), _(MSG_MEN_SC_RENAME
), 0, 0, (APTR
) MEN_ICON_RENAME
},
2069 {NM_ITEM
, _(MSG_MEN_INFO
), _(MSG_MEN_SC_INFO
), 0, 0, (APTR
) MEN_ICON_INFORMATION
},
2070 // {NM_ITEM, "Snapshot", "S" },
2071 // {NM_ITEM, "Unsnapshot", "U" },
2072 // {NM_ITEM, "Leave Out", "L" },
2073 // {NM_ITEM, "Put Away", "P" },
2074 {NM_ITEM
, NM_BARLABEL
},
2075 {NM_ITEM
, _(MSG_MEN_DELETE
), NULL
, 0, 0, (APTR
) MEN_ICON_DELETE
},
2076 // {NM_ITEM, "Format Disk..." },
2077 // {NM_ITEM, "Empty Trash..." },
2079 {NM_TITLE
, _(MSG_MEN_TOOLS
), NULL
, 0},
2080 // {NM_ITEM, "ResetWanderer" },
2083 _NewWandIntMenu__menustrip
= MUI_MakeObject(MUIO_MenustripNM
, nm
, (IPTR
) NULL
);
2087 struct NewMenu nm
[] = {
2088 {NM_TITLE
, _(MSG_MEN_WANDERER
)},
2089 {NM_ITEM
, _(MSG_MEN_BACKDROP
),_(MSG_MEN_SC_BACKDROP
), _NewWandIntMenu__OPTION_BACKDROP
, 0, (APTR
) MEN_WANDERER_BACKDROP
},
2090 {NM_ITEM
, _(MSG_MEN_EXECUTE
), _(MSG_MEN_SC_EXECUTE
) , 0 , 0, (APTR
) MEN_WANDERER_EXECUTE
},
2092 {NM_ITEM
, _(MSG_MEN_SHELL
), _(MSG_MEN_SC_SHELL
) , 0 , 0, (APTR
) MEN_WANDERER_SHELL
},
2093 {NM_ITEM
, _(MSG_MEN_GUISET
), NULL
, 0 , 0, (APTR
) MEN_WANDERER_GUISETTINGS
},
2094 {NM_ITEM
, _(MSG_MEN_ABOUT
), _(MSG_MEN_SC_ABOUT
) , 0 , 0, (APTR
) MEN_WANDERER_ABOUT
},
2095 {NM_ITEM
, _(MSG_MEN_QUIT
) , _(MSG_MEN_SC_QUIT
) , 0 , 0, (APTR
) MEN_WANDERER_QUIT
},
2097 {NM_TITLE
, _(MSG_MEN_WINDOW
), NULL
, 0},
2099 {NM_ITEM
, _(MSG_MEN_NEWDRAW
), _(MSG_MEN_SC_NEWDRAW
) , 0 , 0, (APTR
) MEN_WINDOW_NEW_DRAWER
},
2100 {NM_ITEM
, _(MSG_MEN_OPENPAR
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_OPEN_PARENT
},
2101 {NM_ITEM
, _(MSG_MEN_CLOSE
), _(MSG_MEN_SC_CLOSE
) , 0 , 0, (APTR
) MEN_WINDOW_CLOSE
},
2102 {NM_ITEM
, _(MSG_MEN_UPDATE
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_UPDATE
},
2103 {NM_ITEM
, NM_BARLABEL
},
2104 {NM_ITEM
, _(MSG_MEN_CONTENTS
), _(MSG_MEN_SC_CONTENTS
), 0 , 0, (APTR
) MEN_WINDOW_SELECT
},
2105 {NM_ITEM
, _(MSG_MEN_CLRSEL
), _(MSG_MEN_SC_CLRSEL
) , 0 , 0, (APTR
) MEN_WINDOW_CLEAR
},
2106 {NM_ITEM
, NM_BARLABEL
},
2107 {NM_ITEM
, _(MSG_MEN_SNAPSHT
) },
2108 {NM_SUB
, _(MSG_MEN_WINDOW
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_SNAP_WIN
},
2109 {NM_SUB
, _(MSG_MEN_ALL
), NULL
, 0 , 0, (APTR
) MEN_WINDOW_SNAP_ALL
},
2110 {NM_ITEM
, NM_BARLABEL
},
2111 {NM_ITEM
, _(MSG_MEN_VIEW
)},
2112 {NM_SUB
, _(MSG_MEN_ICVIEW
), NULL
, CHECKIT
|CHECKED
,8+16+32, (APTR
) MEN_WINDOW_VIEW_ICON
},
2113 {NM_SUB
, _(MSG_MEN_DCVIEW
), NULL
, CHECKIT
,4+16+32, (APTR
) MEN_WINDOW_VIEW_DETAIL
},
2114 {NM_SUB
, NM_BARLABEL
},
2115 {NM_SUB
, _(MSG_MEN_ALLFIL
), NULL
, _NewWandIntMenu__OPTION_SHOWALL
, 0, (APTR
) MEN_WINDOW_VIEW_ALL
},
2116 {NM_ITEM
, _(MSG_MEN_SORTIC
)},
2117 {NM_SUB
, _(MSG_MEN_CLNUP
), _(MSG_MEN_SC_CLNUP
) , 0 , 0, (APTR
) MEN_WINDOW_SORT_NOW
},
2118 {NM_SUB
, NM_BARLABEL
},
2119 {NM_SUB
, _(MSG_MEN_BYNAME
), NULL
, CHECKIT
|CHECKED
,8+16+32, (APTR
) MEN_WINDOW_SORT_NAME
},
2120 {NM_SUB
, _(MSG_MEN_BYDATE
), NULL
, CHECKIT
,4+16+32, (APTR
) MEN_WINDOW_SORT_DATE
},
2121 {NM_SUB
, _(MSG_MEN_BYSIZE
), NULL
, CHECKIT
,4+8+32, (APTR
) MEN_WINDOW_SORT_SIZE
},
2122 //{NM_SUB, "..by Type", NULL, CHECKIT,4+8+16, (APTR) MEN_WINDOW_SORT_TYPE},
2123 {NM_SUB
, NM_BARLABEL
},
2124 {NM_SUB
, _(MSG_MEN_REVERSE
), NULL
, CHECKIT
|MENUTOGGLE
, 0, (APTR
) MEN_WINDOW_SORT_REVERSE
},
2125 {NM_SUB
, _(MSG_MEN_DRWFRST
), NULL
, CHECKIT
|MENUTOGGLE
|CHECKED
, 0, (APTR
) MEN_WINDOW_SORT_TOPDRAWERS
},
2126 //{NM_SUB, "Group Icons", NULL, CHECKIT|MENUTOGGLE|CHECKED, 0, (APTR) MEN_WINDOW_SORT_GROUP},
2128 {NM_TITLE
, _(MSG_MEN_ICON
), NULL
, 0},
2129 {NM_ITEM
, _(MSG_MEN_OPEN
), _(MSG_MEN_SC_OPEN
), 0, 0, (APTR
) MEN_ICON_OPEN
},
2130 // {NM_ITEM, "Close","C" },
2131 {NM_ITEM
, _(MSG_MEN_RENAME
), _(MSG_MEN_SC_RENAME
), 0, 0, (APTR
) MEN_ICON_RENAME
},
2132 {NM_ITEM
, _(MSG_MEN_INFO
), _(MSG_MEN_SC_INFO
), 0, 0, (APTR
) MEN_ICON_INFORMATION
},
2133 // {NM_ITEM, "Snapshot", "S" },
2134 // {NM_ITEM, "Unsnapshot", "U" },
2135 // {NM_ITEM, "Leave Out", "L" },
2136 // {NM_ITEM, "Put Away", "P" },
2137 {NM_ITEM
, NM_BARLABEL
},
2138 {NM_ITEM
, _(MSG_MEN_DELETE
), NULL
, 0, 0, (APTR
) MEN_ICON_DELETE
},
2139 // {NM_ITEM, "Format Disk..." },
2140 // {NM_ITEM, "Empty Trash..." },
2142 {NM_TITLE
, _(MSG_MEN_TOOLS
), NULL
, 0},
2143 // {NM_ITEM, "ResetWanderer" },
2146 _NewWandIntMenu__menustrip
= MUI_MakeObject(MUIO_MenustripNM
, nm
, (IPTR
) NULL
);
2148 return _NewWandIntMenu__menustrip
;
2151 Object
*Wanderer__MUIM_Wanderer_CreateDrawerWindow
2153 Class
*CLASS
, Object
*self
,
2154 struct MUIP_Wanderer_CreateDrawerWindow
*message
2157 SETUP_WANDERER_INST_DATA
;
2159 D(bug("[Wanderer] Wanderer__MUIM_Wanderer_CreateDrawerWindow()\n"));
2161 Object
*window
= NULL
;
2162 BOOL isWorkbenchWindow
= FALSE
;
2163 BOOL useBackdrop
= FALSE
;
2165 if (isWorkbenchWindow
= (message
->drawer
== NULL
? TRUE
: FALSE
))
2167 useBackdrop
= data
->wd_Option_BackDropMode
;
2170 BOOL hasToolbar
= XGET(data
->wd_Prefs
, MUIA_IconWindowExt_Toolbar_Enabled
);
2172 IPTR TAG_IconWindow_Drawer
= isWorkbenchWindow
? TAG_IGNORE
: MUIA_IconWindow_Location
;
2174 IPTR useFont
= (IPTR
)NULL
;
2176 data
->wd_Screen
= LockPubScreen(NULL
);
2177 if(data
->wd_Screen
== NULL
)
2179 D(bug("[Wanderer] Wanderer__MUIM_Wanderer_CreateDrawerWindow: Couldn't lock screen!\n"));
2180 CoerceMethod(CLASS
, self
, OM_DISPOSE
);
2183 D(bug("[Wanderer] Wanderer__MUIM_Wanderer_CreateDrawerWindow: Using Screen @ %x\n", data
->wd_Screen
));
2185 if (data
->wd_PrefsIntern
)
2187 useFont
= (IPTR
)((struct WandererInternalPrefsData
*)data
->wd_PrefsIntern
)->WIPD_IconFont
;
2190 Object
*_NewWandDrawerMenu__menustrip
= __CreateWandererIntuitionMenu__ (isWorkbenchWindow
, useBackdrop
);
2192 /* Create a new icon drawer window with the correct drawer being set */
2193 window
= IconWindowObject
,
2195 MUIA_Wanderer_Prefs
, data
->wd_Prefs
,
2196 MUIA_Wanderer_Screen
, data
->wd_Screen
,
2197 MUIA_Window_ScreenTitle
, GetUserScreenTitle(data
->wd_Prefs
),
2198 MUIA_Window_Menustrip
, (IPTR
) _NewWandDrawerMenu__menustrip
,
2199 TAG_IconWindow_Drawer
, (IPTR
) message
->drawer
,
2200 MUIA_IconWindow_Font
, useFont
,
2201 MUIA_IconWindow_ActionHook
, (IPTR
) &_WandererIntern_hook_action
,
2202 MUIA_IconWindow_IsRoot
, isWorkbenchWindow
? TRUE
: FALSE
,
2203 isWorkbenchWindow
? MUIA_IconWindow_IsBackdrop
: TAG_IGNORE
, useBackdrop
,
2204 MUIA_Window_IsSubWindow
, isWorkbenchWindow
? FALSE
: TRUE
,
2205 MUIA_IconWindowExt_Toolbar_Enabled
, hasToolbar
? TRUE
: FALSE
,
2208 if (data
->wd_Screen
)
2210 D(bug("[Wanderer] Wanderer__MUIM_Wanderer_CreateDrawerWindow: Unlocking access to screen @ %x\n", data
->wd_Screen
));
2211 UnlockPubScreen(NULL
, data
->wd_Screen
);
2216 /* Get the drawer path back so we can use it also outside this function */
2218 BOOL freeDrwStr
= FALSE
;
2220 if (!isWorkbenchWindow
) drw
= (STRPTR
) XGET(window
, MUIA_IconWindow_Location
);
2223 drw
= AllocVec ( 5, MEMF_CLEAR
);
2224 sprintf ( drw
, "RAM:" );
2228 if (isWorkbenchWindow
)
2232 window
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
2233 (IPTR
)self
, 3, MUIM_CallHook
, (IPTR
)&_WandererIntern_hook_standard
, (IPTR
)wanderer_menufunc_wanderer_quit
2240 window
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
2241 (IPTR
)_app(self
), 4, MUIM_Application_PushMethod
, (IPTR
)window
, 1, MUIM_IconWindow_Remove
2245 #if defined(WANDERER_DEFAULT_SHOWALL) || defined(WANDERER_DEFAULT_SHOWHIDDEN)
2246 Object
*window_IconList
= NULL
;
2247 ULONG current_DispFlags
= 0;
2249 GET(window
, MUIA_IconWindow_IconList
, &window_IconList
);
2251 D(bug("[Wanderer] Wanderer__MUIM_Wanderer_CreateDrawerWindow: IconWindows IconList @ %x\n", window_IconList
));
2253 if (window_IconList
!= NULL
)
2255 GET(window_IconList
, MUIA_IconList_DisplayFlags
, ¤t_DispFlags
);
2257 D(bug("[Wanderer] Wanderer__MUIM_Wanderer_CreateDrawerWindow: Old Flags : %x\n", current_DispFlags
));
2259 #if defined(WANDERER_DEFAULT_SHOWALL)
2260 D(bug("[Wanderer] Wanderer__MUIM_Wanderer_CreateDrawerWindow: Telling IconList to Show 'ALL' Files\n"));
2261 current_DispFlags
&= ~ICONLIST_DISP_SHOWINFO
;
2263 #if defined(WANDERER_DEFAULT_SHOWHIDDEN)
2264 D(bug("[Wanderer] Wanderer__MUIM_Wanderer_CreateDrawerWindow: Telling IconList to Show 'Hidden' Files\n"));
2265 current_DispFlags
|= ICONLIST_DISP_SHOWHIDDEN
;
2267 D(bug("[Wanderer] Wanderer__MUIM_Wanderer_CreateDrawerWindow: New Flags : %x\n", current_DispFlags
));
2268 SET(window_IconList
, MUIA_IconList_DisplayFlags
, current_DispFlags
);
2274 window
, MUIM_Notify
, MUIA_Window_Activate
, TRUE
,
2275 (IPTR
)_app(self
), 3, MUIM_Set
, MUIA_Wanderer_ActiveWindow
, (IPTR
) window
2281 window
, MUIM_Notify
, MUIA_IconWindow_IsBackdrop
, MUIV_EveryTime
,
2282 (IPTR
)_app(self
), 5, MUIM_Application_PushMethod
, (IPTR
)_app(self
), 2, MUIM_CallHook
, (IPTR
)&_WandererIntern_hook_backdrop
2287 window
, MUIM_Notify
, MUIA_IconWindow_IsBackdrop
, MUIV_EveryTime
,
2288 (IPTR
)_app(self
), 2, MUIM_CallHook
, (IPTR
) &_WandererIntern_hook_backdrop
2292 /* If "Execute Command" entry is clicked open the execute window */
2293 DoAllMenuNotifies(_NewWandDrawerMenu__menustrip
, drw
);
2295 /* Add the window to the application */
2296 DoMethod(_app(self
), OM_ADDMEMBER
, (IPTR
) window
);
2298 /* And now open it */
2299 DoMethod(window
, MUIM_IconWindow_Open
);
2301 /* Clean up ram string */
2302 if ( freeDrwStr
&& drw
) FreeVec ( drw
);
2308 /*** Setup ******************************************************************/
2311 Wanderer
, NULL
, MUIC_Application
, NULL
,
2312 OM_NEW
, struct opSet
*,
2314 OM_SET
, struct opSet
*,
2315 OM_GET
, struct opGet
*,
2316 MUIM_Application_Execute
, Msg
,
2317 MUIM_Wanderer_HandleTimer
, Msg
,
2318 MUIM_Wanderer_HandleCommand
, Msg
,
2319 MUIM_Wanderer_HandleNotify
, Msg
,
2320 MUIM_Wanderer_CreateDrawerWindow
, struct MUIP_Wanderer_CreateDrawerWindow
*