2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
5 WiMP -- Window manipulation program.
8 /******************************************************************************
23 Manipulates screens and windows
39 ******************************************************************************/
41 #define MUIMASTER_YES_INLINE_STDARG
43 #include <libraries/mui.h>
44 #include <libraries/gadtools.h>
45 #include <proto/muimaster.h>
46 #include <proto/intuition.h>
47 #include <proto/exec.h>
48 #include <proto/dos.h>
49 #include <proto/utility.h>
56 static Object
*app
, *wnd
, *list_gad
;
58 static Object
*close_gad
, *front_gad
, *back_gad
, *origin_gad
, *activate_gad
, *zip_gad
, *hide_gad
, *show_gad
;
59 static Object
*update_gad
, *rescue_gad
, *showall_gad
, *rethink_gad
, *about_gad
;
61 static Object
*info_wnd
, *page_gad
;
63 static Object
*info_scr_addr_gad
, *info_scr_leftedge_gad
, *info_scr_topedge_gad
, *info_scr_width_gad
, *info_scr_height_gad
,
64 *info_scr_flags_gad
, *info_scr_title_gad
, *info_scr_deftitle_gad
, *info_scr_firstwindow_gad
;
67 static Object
*info_win_addr_gad
, *info_win_nextwin_gad
, *info_win_leftedge_gad
, *info_win_topedge_gad
, *info_win_width_gad
,
68 *info_win_height_gad
, *info_win_minwidth_gad
, *info_win_minheight_gad
, *info_win_maxwidth_gad
, *info_win_maxheight_gad
,
69 *info_win_flags_gad
, *info_win_idcmp_gad
, *info_win_title_gad
, *info_win_req_gad
, *info_win_screen_gad
,
70 *info_win_borderleft_gad
, *info_win_bordertop_gad
, *info_win_borderright_gad
, *info_win_borderbottom_gad
,
71 *info_win_parentwin_gad
, *info_win_firstchild_gad
, *info_win_parent_gad
, *info_win_descendant_gad
;
76 static struct Hook close_hook
, front_hook
, back_hook
, origin_hook
, activate_hook
, zip_hook
, hide_hook
, show_hook
;
77 static struct Hook update_hook
, rescue_hook
, showall_hook
, rethink_hook
, about_hook
;
78 static struct Hook display_hook
, construct_hook
, destruct_hook
;
79 static struct Hook openinfo_hook
, updateinfo_hook
;
82 static const STRPTR ABOUT_TXT
= "WiMP - The Window Manipulation Program\n\n"
83 "Copyright © 2000-2006 by The AROS Development Team";
84 static const STRPTR TITLE_TXT
= "WiMP - The Window Manipulation Program";
85 static const STRPTR INFOTITLE_TXT
= "WiMP - InfoWindow";
86 static const STRPTR CLOSESCREEN_TXT
= "Do you really want to Close the selected Screen?";
87 static const STRPTR CLOSEWINDOW_TXT
= "Do you really want to Close the selected Window?";
88 static const STRPTR YESNO_TXT
= "Yes.|No!";
89 static const STRPTR CONTINUE_TXT
= "Continue";
111 static const char version
[] = "$VER: WiMP 0.12 (04.05.2006) © AROS Dev Team";
113 /*********************************************************************************************/
115 static void Cleanup(CONST_STRPTR txt
);
116 static LONG
get_selected(struct Screen
**scr
, struct Window
**win
);
117 static void MakeGUI(void);
119 /*********************************************************************************************/
139 static struct NewMenu nm
[] =
141 {NM_TITLE
, "Project"},
142 {NM_ITEM
, "About...", NULL
, 0, 0, (APTR
)MN_ABOUT
},
143 {NM_ITEM
, NM_BARLABEL
},
144 {NM_ITEM
, "Quit", "Q", 0, 0, (APTR
)MN_QUIT
},
145 {NM_TITLE
, "Window List"},
146 {NM_ITEM
, "Update List", "U", 0, 0, (APTR
)MN_UPDATE
},
147 {NM_ITEM
, NM_BARLABEL
},
148 {NM_ITEM
, "Kill", NULL
, 0, 0, (APTR
)MN_KILL
},
149 {NM_ITEM
, "To Front", NULL
, 0, 0, (APTR
)MN_FRONT
},
150 {NM_ITEM
, "To Back", NULL
, 0, 0, (APTR
)MN_BACK
},
151 {NM_ITEM
, "To Origin", NULL
, 0, 0, (APTR
)MN_ORIGIN
},
152 {NM_ITEM
, "Activate", NULL
, 0, 0, (APTR
)MN_ACTIVATE
},
153 {NM_ITEM
, "Zip", NULL
, 0, 0, (APTR
)MN_ZIP
},
154 {NM_ITEM
, "Hide", NULL
, 0, 0, (APTR
)MN_HIDE
},
155 {NM_ITEM
, "Show", NULL
, 0, 0, (APTR
)MN_SHOW
},
156 {NM_ITEM
, NM_BARLABEL
},
157 {NM_ITEM
, "Info", NULL
, 0, 0, (APTR
)MN_INFO
},
158 {NM_TITLE
, "Generic"},
159 {NM_ITEM
, "Rescue All", NULL
, 0, 0, (APTR
)MN_RESCUE
},
160 {NM_ITEM
, "Show All", NULL
, 0, 0, (APTR
)MN_SHOWALL
},
161 {NM_ITEM
, "RethinkDisplay", NULL
, 0, 0, (APTR
)MN_RETHINK
},
165 /*********************************************************************************************/
167 static LONG
get_selected(struct Screen
**scr
, struct Window
**win
)
172 struct ListEntry
*le
;
173 DoMethod(list_gad
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, (IPTR
)&le
);
177 lock
= LockIBase ( 0 );
178 *scr
= IntuitionBase
->FirstScreen
;
179 UnlockIBase ( lock
);
180 /* Traverse through all Screens */
183 if ((le
->type
== Screen_type
) && (le
->aptr
== *scr
))
188 /* Traverse through all Windows of current Screen */
189 *win
= (*scr
)->FirstWindow
;
192 if ((le
->type
== Window_type
) && (le
->aptr
== *win
))
197 *win
= (*win
)->NextWindow
;
199 *scr
= (*scr
)->NextScreen
;
205 /*********************************************************************************************/
207 AROS_UFH3(void, display_func
,
208 AROS_UFHA(struct Hook
* , h
, A0
),
209 AROS_UFHA(char ** , array
, A2
),
210 AROS_UFHA(struct ListEntry
*, msg
, A1
))
216 if (msg
->type
== Window_type
)
218 array
[0] = " \033bWindow";
222 array
[0] = "\033b\033uScreen";
224 array
[1] = msg
->address
;
225 array
[2] = msg
->size
;
227 array
[4] = msg
->status
;
228 array
[5] = msg
->title
;
233 array
[1] = "Address";
235 array
[3] = "Position";
243 /*********************************************************************************************/
245 AROS_UFH3(APTR
, construct_func
,
246 AROS_UFHA(struct Hook
* , h
, A0
),
247 AROS_UFHA(APTR
, pool
, A2
),
248 AROS_UFHA(struct ListEntry
*, msg
, A1
))
252 struct ListEntry
*new = AllocPooled(pool
, sizeof(*msg
));
261 /*********************************************************************************************/
263 AROS_UFH3(void, destruct_func
,
264 AROS_UFHA(struct Hook
* , h
, A0
),
265 AROS_UFHA(APTR
, pool
, A2
),
266 AROS_UFHA(struct ListEntry
*, msg
, A1
))
270 FreePooled(pool
, msg
, sizeof(*msg
));
275 /*********************************************************************************************/
277 AROS_UFH3(void, update_func
,
278 AROS_UFHA(struct Hook
*, h
, A0
),
279 AROS_UFHA(Object
* , object
, A2
),
280 AROS_UFHA(APTR
, msg
, A1
))
286 struct ListEntry entry
;
288 set(list_gad
, MUIA_List_Quiet
, TRUE
);
289 DoMethod(list_gad
, MUIM_List_Clear
);
291 /* Get Intuition's first Screen */
292 lock
= LockIBase ( 0 );
293 scr
= IntuitionBase
->FirstScreen
;
294 UnlockIBase ( lock
);
296 /* Traverse through all Screens */
299 entry
.type
= Screen_type
;
301 sprintf(entry
.address
, "%p", scr
);
302 sprintf(entry
.size
, "%d x %d", scr
->Width
, scr
->Height
);
303 sprintf(entry
.pos
, "%d x %d", scr
->LeftEdge
, scr
->TopEdge
);
304 entry
.status
[0] = '\0';
305 snprintf(entry
.title
, sizeof(entry
.title
) - 1, "%s", scr
->Title
? scr
->Title
: "");
306 DoMethod(list_gad
, MUIM_List_InsertSingle
, &entry
, MUIV_List_Insert_Bottom
);
308 /* Traverse through all Windows of current Screen */
309 win
= scr
->FirstWindow
;
312 entry
.type
= Window_type
;
314 sprintf(entry
.address
, "%p", win
);
315 sprintf(entry
.size
, "%d x %d", win
->Width
, win
->Height
);
316 sprintf(entry
.pos
, "%d x %d", win
->LeftEdge
, win
->TopEdge
);
317 sprintf(entry
.status
, "%c%c%c",
318 (IsWindowVisible(win
) ? ' ' : 'H'),
319 (IS_CHILD(win
) ? 'C' : ' '),
320 (HAS_CHILDREN(win
) ? 'P' : ' '));
321 snprintf(entry
.title
, sizeof(entry
.title
) - 1, "%s", win
->Title
? win
->Title
: "");
322 DoMethod(list_gad
, MUIM_List_InsertSingle
, &entry
, MUIV_List_Insert_Bottom
);
324 win
= win
->NextWindow
;
326 scr
= scr
->NextScreen
;
328 set(list_gad
, MUIA_List_Quiet
, FALSE
);
333 /*********************************************************************************************/
335 AROS_UFH3(void, close_func
,
336 AROS_UFHA(struct Hook
*, h
, A0
),
337 AROS_UFHA(Object
* , object
, A2
),
338 AROS_UFHA(APTR
, msg
, A1
))
344 switch (get_selected(&scr
, &win
))
347 if (MUI_Request(app
, wnd
, 0, TITLE_TXT
, YESNO_TXT
, CLOSESCREEN_TXT
))
353 if (MUI_Request(app
, wnd
, 0, TITLE_TXT
, YESNO_TXT
, CLOSEWINDOW_TXT
))
360 CallHookPkt(&update_hook
, 0, 0);
365 /*********************************************************************************************/
367 AROS_UFH3(void, front_func
,
368 AROS_UFHA(struct Hook
*, h
, A0
),
369 AROS_UFHA(Object
* , object
, A2
),
370 AROS_UFHA(APTR
, msg
, A1
))
376 switch (get_selected(&scr
, &win
))
386 CallHookPkt(&update_hook
, 0, 0);
391 /*********************************************************************************************/
393 AROS_UFH3(void, back_func
,
394 AROS_UFHA(struct Hook
*, h
, A0
),
395 AROS_UFHA(Object
* , object
, A2
),
396 AROS_UFHA(APTR
, msg
, A1
))
402 switch (get_selected(&scr
, &win
))
412 CallHookPkt(&update_hook
, 0, 0);
417 /*********************************************************************************************/
419 AROS_UFH3(void, origin_func
,
420 AROS_UFHA(struct Hook
*, h
, A0
),
421 AROS_UFHA(Object
* , object
, A2
),
422 AROS_UFHA(APTR
, msg
, A1
))
428 switch (get_selected(&scr
, &win
))
431 MoveScreen ( scr
, -scr
->LeftEdge
, -scr
->TopEdge
);
434 MoveWindow ( win
, -win
->RelLeftEdge
, -win
->RelTopEdge
);
439 CallHookPkt(&update_hook
, 0, 0);
444 /*********************************************************************************************/
446 AROS_UFH3(void, activate_func
,
447 AROS_UFHA(struct Hook
*, h
, A0
),
448 AROS_UFHA(Object
* , object
, A2
),
449 AROS_UFHA(APTR
, msg
, A1
))
455 if (get_selected(&scr
, &win
) == Window_type
)
457 ActivateWindow ( win
);
460 CallHookPkt(&update_hook
, 0, 0);
465 /*********************************************************************************************/
467 AROS_UFH3(void, hide_func
,
468 AROS_UFHA(struct Hook
*, h
, A0
),
469 AROS_UFHA(Object
* , object
, A2
),
470 AROS_UFHA(APTR
, msg
, A1
))
476 if (get_selected(&scr
, &win
) == Window_type
)
478 if ((struct Window
*)XGET(wnd
, MUIA_Window_Window
) != win
) // You can't hide WiMP
485 CallHookPkt(&update_hook
, 0, 0);
490 /*********************************************************************************************/
492 AROS_UFH3(void, show_func
,
493 AROS_UFHA(struct Hook
*, h
, A0
),
494 AROS_UFHA(Object
* , object
, A2
),
495 AROS_UFHA(APTR
, msg
, A1
))
501 if (get_selected(&scr
, &win
) == Window_type
)
507 CallHookPkt(&update_hook
, 0, 0);
512 /*********************************************************************************************/
514 AROS_UFH3(void, zip_func
,
515 AROS_UFHA(struct Hook
*, h
, A0
),
516 AROS_UFHA(Object
* , object
, A2
),
517 AROS_UFHA(APTR
, msg
, A1
))
523 if (get_selected(&scr
, &win
) == Window_type
)
528 CallHookPkt(&update_hook
, 0, 0);
533 /*********************************************************************************************/
535 AROS_UFH3(void, showall_func
,
536 AROS_UFHA(struct Hook
*, h
, A0
),
537 AROS_UFHA(Object
* , object
, A2
),
538 AROS_UFHA(APTR
, msg
, A1
))
545 /* Get Intuition's first Screen */
546 lock
= LockIBase ( 0 );
547 scr
= IntuitionBase
->FirstScreen
;
548 UnlockIBase ( lock
);
550 /* Traverse through all Screens */
553 win
= scr
->FirstWindow
;
554 /* Traverse through all Windows of current Screen */
557 /* Show Window if hidden */
558 if ( IsWindowVisible ( win
) != TRUE
)
562 win
= win
->NextWindow
;
564 scr
= scr
->NextScreen
;
568 CallHookPkt(&update_hook
, 0, 0);
573 /*********************************************************************************************/
575 AROS_UFH3(void, rescue_func
,
576 AROS_UFHA(struct Hook
*, h
, A0
),
577 AROS_UFHA(Object
* , object
, A2
),
578 AROS_UFHA(APTR
, msg
, A1
))
586 /* Get Intuition's first Screen */
587 lock
= LockIBase ( 0 );
588 scr
= IntuitionBase
->FirstScreen
;
589 UnlockIBase ( lock
);
591 /* Traverse through all Screens */
594 win
= scr
->FirstWindow
;
595 /* Traverse through all Windows of current Screen */
598 /* Move Window onto the Screen if outside */
599 if ( win
->parent
== NULL
)
602 height
= scr
->Height
;
606 width
= win
->parent
->Width
;
607 height
= win
->parent
->Height
;
609 /* TODO: calculate reasonable values:
610 eg. this way only the Close Gadget my be visible :-( */
611 if ( win
->RelLeftEdge
< 0
612 || win
->RelTopEdge
<= -(win
->BorderTop
)
613 || win
->RelLeftEdge
> width
614 || win
->RelTopEdge
>= (height
- win
->BorderTop
) )
616 MoveWindow ( win
, - win
->RelLeftEdge
, - win
->RelTopEdge
);
618 win
= win
->NextWindow
;
620 scr
= scr
->NextScreen
;
624 CallHookPkt(&update_hook
, 0, 0);
629 /*********************************************************************************************/
631 AROS_UFH3(void, rethink_func
,
632 AROS_UFHA(struct Hook
*, h
, A0
),
633 AROS_UFHA(Object
* , object
, A2
),
634 AROS_UFHA(APTR
, msg
, A1
))
639 CallHookPkt(&update_hook
, 0, 0);
644 /*********************************************************************************************/
646 AROS_UFH3(void, about_func
,
647 AROS_UFHA(struct Hook
*, h
, A0
),
648 AROS_UFHA(Object
* , object
, A2
),
649 AROS_UFHA(APTR
, msg
, A1
))
653 MUI_Request(app
, wnd
, 0, TITLE_TXT
, CONTINUE_TXT
, ABOUT_TXT
);
658 /*********************************************************************************************/
660 AROS_UFH3(void, update_info_func
,
661 AROS_UFHA(struct Hook
*, h
, A0
),
662 AROS_UFHA(Object
* , object
, A2
),
663 AROS_UFHA(APTR
, msg
, A1
))
667 static TEXT buffer
[50];
668 struct ListEntry
*le
;
672 DoMethod(list_gad
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, (IPTR
)&le
);
675 set(close_gad
, MUIA_Disabled
, FALSE
);
676 set(front_gad
, MUIA_Disabled
, FALSE
);
677 set(back_gad
, MUIA_Disabled
, FALSE
);
678 set(origin_gad
, MUIA_Disabled
, FALSE
);
679 set(activate_gad
, MUIA_Disabled
, FALSE
);
680 set(zip_gad
, MUIA_Disabled
, FALSE
);
681 set(hide_gad
, MUIA_Disabled
, FALSE
);
682 set(show_gad
, MUIA_Disabled
, FALSE
);
686 set(close_gad
, MUIA_Disabled
, TRUE
);
687 set(front_gad
, MUIA_Disabled
, TRUE
);
688 set(back_gad
, MUIA_Disabled
, TRUE
);
689 set(origin_gad
, MUIA_Disabled
, TRUE
);
690 set(activate_gad
, MUIA_Disabled
, TRUE
);
691 set(zip_gad
, MUIA_Disabled
, TRUE
);
692 set(hide_gad
, MUIA_Disabled
, TRUE
);
693 set(show_gad
, MUIA_Disabled
, TRUE
);
696 if (XGET(info_wnd
, MUIA_Window_Open
))
700 switch (get_selected(&scr
, &win
))
705 set(page_gad
, MUIA_Group_ActivePage
, 0);
707 sprintf(buffer
, "%p", scr
);
708 set(info_scr_addr_gad
, MUIA_Text_Contents
, buffer
);
710 sprintf(buffer
, "%d", scr
->LeftEdge
);
711 set(info_scr_leftedge_gad
, MUIA_Text_Contents
, buffer
);
713 sprintf(buffer
, "%d", scr
->TopEdge
);
714 set(info_scr_topedge_gad
, MUIA_Text_Contents
, buffer
);
716 sprintf(buffer
, "%d", scr
->Width
);
717 set(info_scr_width_gad
, MUIA_Text_Contents
, buffer
);
719 sprintf(buffer
, "%d", scr
->Height
);
720 set(info_scr_height_gad
, MUIA_Text_Contents
, buffer
);
722 sprintf(buffer
, "0x%08x", scr
->Flags
);
723 set(info_scr_flags_gad
, MUIA_Text_Contents
, buffer
);
725 set(info_scr_title_gad
, MUIA_Text_Contents
, scr
->Title
);
726 set(info_scr_deftitle_gad
, MUIA_Text_Contents
, scr
->DefaultTitle
);
728 sprintf(buffer
, "%p", scr
->FirstWindow
);
729 set(info_scr_firstwindow_gad
, MUIA_Text_Contents
, buffer
);
735 set(page_gad
, MUIA_Group_ActivePage
, 1);
737 sprintf(buffer
, "%p", win
);
738 set(info_win_addr_gad
, MUIA_Text_Contents
, buffer
);
740 sprintf(buffer
, "%p", win
->NextWindow
);
741 set(info_win_nextwin_gad
, MUIA_Text_Contents
, buffer
);
743 sprintf(buffer
, "%d", win
->LeftEdge
);
744 set(info_win_leftedge_gad
, MUIA_Text_Contents
, buffer
);
746 sprintf(buffer
, "%d", win
->TopEdge
);
747 set(info_win_topedge_gad
, MUIA_Text_Contents
, buffer
);
749 sprintf(buffer
, "%d", win
->Height
);
750 set(info_win_height_gad
, MUIA_Text_Contents
, buffer
);
752 sprintf(buffer
, "%d", win
->Width
);
753 set(info_win_width_gad
, MUIA_Text_Contents
, buffer
);
755 sprintf(buffer
, "%d", win
->MinWidth
);
756 set(info_win_minwidth_gad
, MUIA_Text_Contents
, buffer
);
758 sprintf(buffer
, "%d", win
->MinHeight
);
759 set(info_win_minheight_gad
, MUIA_Text_Contents
, buffer
);
761 sprintf(buffer
, "%d", win
->MaxWidth
);
762 set(info_win_maxwidth_gad
, MUIA_Text_Contents
, buffer
);
764 sprintf(buffer
, "%d", win
->MaxHeight
);
765 set(info_win_maxheight_gad
, MUIA_Text_Contents
, buffer
);
767 sprintf(buffer
, "0x%08lx", win
->Flags
);
768 set(info_win_flags_gad
, MUIA_Text_Contents
, buffer
);
770 sprintf(buffer
, "0x%08lx", win
->IDCMPFlags
);
771 set(info_win_idcmp_gad
, MUIA_Text_Contents
, buffer
);
773 set(info_win_title_gad
, MUIA_Text_Contents
, win
->Title
);
775 sprintf(buffer
, "%d", win
->ReqCount
);
776 set(info_win_req_gad
, MUIA_Text_Contents
, buffer
);
778 sprintf(buffer
, "%p", win
->WScreen
);
779 set(info_win_screen_gad
, MUIA_Text_Contents
, buffer
);
781 sprintf(buffer
, "%d", win
->BorderLeft
);
782 set(info_win_borderleft_gad
, MUIA_Text_Contents
, buffer
);
784 sprintf(buffer
, "%d", win
->BorderTop
);
785 set(info_win_bordertop_gad
, MUIA_Text_Contents
, buffer
);
787 sprintf(buffer
, "%d", win
->BorderRight
);
788 set(info_win_borderright_gad
, MUIA_Text_Contents
, buffer
);
790 sprintf(buffer
, "%d", win
->BorderBottom
);
791 set(info_win_borderbottom_gad
, MUIA_Text_Contents
, buffer
);
793 sprintf(buffer
, "%p", win
->parent
);
794 set(info_win_parentwin_gad
, MUIA_Text_Contents
, buffer
);
796 sprintf(buffer
, "%p", win
->firstchild
);
797 set(info_win_firstchild_gad
, MUIA_Text_Contents
, buffer
);
799 sprintf(buffer
, "%p", win
->Parent
);
800 set(info_win_parent_gad
, MUIA_Text_Contents
, buffer
);
802 sprintf(buffer
, "%p", win
->Descendant
);
803 set(info_win_descendant_gad
, MUIA_Text_Contents
, buffer
);
807 // selected screen/window doesn't exist anymore
808 CallHookPkt(&update_hook
, 0, 0);
812 else // window is open but no entry is selected
814 set(info_scr_addr_gad
, MUIA_Text_Contents
, NULL
);
815 set(info_scr_leftedge_gad
, MUIA_Text_Contents
, NULL
);
816 set(info_scr_topedge_gad
, MUIA_Text_Contents
, NULL
);
817 set(info_scr_width_gad
, MUIA_Text_Contents
, NULL
);
818 set(info_scr_height_gad
, MUIA_Text_Contents
, NULL
);
819 set(info_scr_flags_gad
, MUIA_Text_Contents
, NULL
);
820 set(info_scr_title_gad
, MUIA_Text_Contents
, NULL
);
821 set(info_scr_deftitle_gad
, MUIA_Text_Contents
, NULL
);
822 set(info_scr_firstwindow_gad
, MUIA_Text_Contents
, NULL
);
823 set(info_win_addr_gad
, MUIA_Text_Contents
, NULL
);
824 set(info_win_nextwin_gad
, MUIA_Text_Contents
, NULL
);
825 set(info_win_leftedge_gad
, MUIA_Text_Contents
, NULL
);
826 set(info_win_topedge_gad
, MUIA_Text_Contents
, NULL
);
827 set(info_win_height_gad
, MUIA_Text_Contents
, NULL
);
828 set(info_win_width_gad
, MUIA_Text_Contents
, NULL
);
829 set(info_win_minwidth_gad
, MUIA_Text_Contents
, NULL
);
830 set(info_win_minheight_gad
, MUIA_Text_Contents
, NULL
);
831 set(info_win_maxwidth_gad
, MUIA_Text_Contents
, NULL
);
832 set(info_win_maxheight_gad
, MUIA_Text_Contents
, NULL
);
833 set(info_win_flags_gad
, MUIA_Text_Contents
, NULL
);
834 set(info_win_idcmp_gad
, MUIA_Text_Contents
, NULL
);
835 set(info_win_title_gad
, MUIA_Text_Contents
, NULL
);
836 set(info_win_req_gad
, MUIA_Text_Contents
, NULL
);
837 set(info_win_screen_gad
, MUIA_Text_Contents
, NULL
);
838 set(info_win_borderleft_gad
, MUIA_Text_Contents
, NULL
);
839 set(info_win_bordertop_gad
, MUIA_Text_Contents
, NULL
);
840 set(info_win_borderright_gad
, MUIA_Text_Contents
, NULL
);
841 set(info_win_borderbottom_gad
, MUIA_Text_Contents
, NULL
);
842 set(info_win_parentwin_gad
, MUIA_Text_Contents
, NULL
);
843 set(info_win_firstchild_gad
, MUIA_Text_Contents
, NULL
);
844 set(info_win_parent_gad
, MUIA_Text_Contents
, NULL
);
845 set(info_win_descendant_gad
, MUIA_Text_Contents
, NULL
);
852 /*********************************************************************************************/
854 AROS_UFH3(void, openinfo_func
,
855 AROS_UFHA(struct Hook
*, h
, A0
),
856 AROS_UFHA(Object
* , object
, A2
),
857 AROS_UFHA(APTR
, msg
, A1
))
861 set(info_wnd
, MUIA_Window_Open
, TRUE
);
862 CallHookPkt(&updateinfo_hook
, 0, 0);
866 /*********************************************************************************************/
868 static void MakeGUI(void)
870 Object
*menu
= MUI_MakeObject(MUIO_MenustripNM
, &nm
, 0);
872 display_hook
.h_Entry
= (HOOKFUNC
)display_func
;
873 construct_hook
.h_Entry
= (HOOKFUNC
)construct_func
;
874 destruct_hook
.h_Entry
= (HOOKFUNC
)destruct_func
;
876 close_hook
.h_Entry
= (HOOKFUNC
)close_func
;
877 front_hook
.h_Entry
= (HOOKFUNC
)front_func
;
878 back_hook
.h_Entry
= (HOOKFUNC
)back_func
;
879 origin_hook
.h_Entry
= (HOOKFUNC
)origin_func
;
880 activate_hook
.h_Entry
= (HOOKFUNC
)activate_func
;
881 zip_hook
.h_Entry
= (HOOKFUNC
)zip_func
;
882 hide_hook
.h_Entry
= (HOOKFUNC
)hide_func
;
883 show_hook
.h_Entry
= (HOOKFUNC
)show_func
;
885 update_hook
.h_Entry
= (HOOKFUNC
)update_func
;
886 rescue_hook
.h_Entry
= (HOOKFUNC
)rescue_func
;
887 showall_hook
.h_Entry
= (HOOKFUNC
)showall_func
;
888 rethink_hook
.h_Entry
= (HOOKFUNC
)rethink_func
;
889 about_hook
.h_Entry
= (HOOKFUNC
)about_func
;
891 openinfo_hook
.h_Entry
= (HOOKFUNC
)openinfo_func
;
892 updateinfo_hook
.h_Entry
= (HOOKFUNC
)update_info_func
;
894 app
= ApplicationObject
,
895 MUIA_Application_Title
, (IPTR
)"WiMP",
896 MUIA_Application_Version
, (IPTR
)version
,
897 MUIA_Application_Copyright
, (IPTR
)"Copyright © 1995-2006, The AROS Development Team",
898 MUIA_Application_Author
, (IPTR
)"The AROS Development Team",
899 MUIA_Application_Description
, (IPTR
)"Window Manipulator",
900 MUIA_Application_Base
, (IPTR
)"WIMP",
901 MUIA_Application_SingleTask
, TRUE
,
902 MUIA_Application_Menustrip
, (IPTR
)menu
,
903 SubWindow
, (IPTR
)(wnd
= WindowObject
,
904 MUIA_Window_Title
, (IPTR
)TITLE_TXT
,
905 MUIA_Window_ID
, MAKE_ID('W', 'I', 'M', 'P'),
906 WindowContents
, (IPTR
)(VGroup
,
907 Child
, (IPTR
)(VGroup
,
908 GroupFrameT("Screen/Window List"),
909 Child
, (IPTR
)(ListviewObject
,
910 MUIA_Listview_List
, (IPTR
)(list_gad
= ListObject
,
912 MUIA_List_Format
, (IPTR
)"BAR,BAR,P=\033c BAR,P=\033c BAR,BAR,BAR",
913 MUIA_List_ConstructHook
, (IPTR
)&construct_hook
,
914 MUIA_List_DestructHook
, (IPTR
)&destruct_hook
,
915 MUIA_List_DisplayHook
, (IPTR
)&display_hook
,
916 MUIA_List_Title
, TRUE
,
920 Child
, (IPTR
)(HGroup
,
921 Child
, (IPTR
)(close_gad
= SimpleButton("\033iKill")),
922 Child
, (IPTR
)(front_gad
= SimpleButton("To _Front")),
923 Child
, (IPTR
)(back_gad
= SimpleButton("To _Back")),
924 Child
, (IPTR
)(origin_gad
= SimpleButton("Move to _Origin")),
925 Child
, (IPTR
)(activate_gad
= SimpleButton("_Activate")),
926 Child
, (IPTR
)(zip_gad
= SimpleButton("_Zip")),
927 Child
, (IPTR
)(hide_gad
= SimpleButton("_Hide")),
928 Child
, (IPTR
)(show_gad
= SimpleButton("_Show")),
930 Child
, (IPTR
)(HGroup
,
931 Child
, (IPTR
)(update_gad
= SimpleButton("_Update List")),
932 Child
, (IPTR
)(rescue_gad
= SimpleButton("_Rescue all Windows")),
933 Child
, (IPTR
)(showall_gad
= SimpleButton("Show all Windows")),
934 Child
, (IPTR
)(rethink_gad
= SimpleButton("Rethink Display")),
935 Child
, (IPTR
)(about_gad
= SimpleButton("About")),
940 SubWindow
, (IPTR
)(info_wnd
= WindowObject
,
941 MUIA_Window_Title
, (IPTR
)INFOTITLE_TXT
,
942 MUIA_Window_ID
, MAKE_ID('W', 'I', 'N', 'F'),
943 WindowContents
, (IPTR
)(page_gad
= PageGroup
,
944 Child
, (IPTR
)(HGroup
,
945 Child
, (IPTR
)(ColGroup(2),
946 GroupFrameT("Screen"),
948 Child
, (IPTR
)Label("Address"),
949 Child
, (IPTR
)(info_scr_addr_gad
= TextObject
,
951 MUIA_Text_Contents
, (IPTR
)"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW",
952 MUIA_Text_SetMin
, TRUE
,
954 Child
, (IPTR
)Label("LeftEdge"),
955 Child
, (IPTR
)(info_scr_leftedge_gad
= TextObject
, TextFrame
, End
),
956 Child
, (IPTR
)Label("TopEdge"),
957 Child
, (IPTR
)(info_scr_topedge_gad
= TextObject
, TextFrame
, End
),
958 Child
, (IPTR
)Label("Width"),
959 Child
, (IPTR
)(info_scr_width_gad
= TextObject
, TextFrame
, End
),
960 Child
, (IPTR
)Label("Height"),
961 Child
, (IPTR
)(info_scr_height_gad
= TextObject
, TextFrame
, End
),
962 Child
, (IPTR
)Label("Flags"),
963 Child
, (IPTR
)(info_scr_flags_gad
= TextObject
, TextFrame
, End
),
964 Child
, (IPTR
)Label("Title"),
965 Child
, (IPTR
)(info_scr_title_gad
= TextObject
, TextFrame
, End
),
966 Child
, (IPTR
)Label("DefaultTitle"),
967 Child
, (IPTR
)(info_scr_deftitle_gad
= TextObject
, TextFrame
, End
),
968 Child
, (IPTR
)Label("FirstWindow"),
969 Child
, (IPTR
)(info_scr_firstwindow_gad
= TextObject
, TextFrame
, End
),
972 Child
, (IPTR
)(HGroup
,
973 Child
, (IPTR
)(ColGroup(2),
974 GroupFrameT("Window"),
975 Child
, (IPTR
)Label("Address"),
976 Child
, (IPTR
)(info_win_addr_gad
= TextObject
,
978 MUIA_Text_Contents
, (IPTR
)"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW",
979 MUIA_Text_SetMin
, TRUE
,
981 Child
, (IPTR
)Label("NextWindow"),
982 Child
, (IPTR
)(info_win_nextwin_gad
= TextObject
, TextFrame
, End
),
983 Child
, (IPTR
)Label("LeftEdge"),
984 Child
, (IPTR
)(info_win_leftedge_gad
= TextObject
, TextFrame
, End
),
985 Child
, (IPTR
)Label("TopEdge"),
986 Child
, (IPTR
)(info_win_topedge_gad
= TextObject
, TextFrame
, End
),
987 Child
, (IPTR
)Label("Width"),
988 Child
, (IPTR
)(info_win_width_gad
= TextObject
, TextFrame
, End
),
989 Child
, (IPTR
)Label("Height"),
990 Child
, (IPTR
)(info_win_height_gad
= TextObject
, TextFrame
, End
),
991 Child
, (IPTR
)Label("MinWidth"),
992 Child
, (IPTR
)(info_win_minwidth_gad
= TextObject
, TextFrame
, End
),
993 Child
, (IPTR
)Label("MinHeight"),
994 Child
, (IPTR
)(info_win_minheight_gad
= TextObject
, TextFrame
, End
),
995 Child
, (IPTR
)Label("MaxWidth"),
996 Child
, (IPTR
)(info_win_maxwidth_gad
= TextObject
, TextFrame
, End
),
997 Child
, (IPTR
)Label("MaxHeight"),
998 Child
, (IPTR
)(info_win_maxheight_gad
= TextObject
, TextFrame
, End
),
999 Child
, (IPTR
)Label("Flags"),
1000 Child
, (IPTR
)(info_win_flags_gad
= TextObject
, TextFrame
, End
),
1001 Child
, (IPTR
)Label("IDCMPFlags"),
1002 Child
, (IPTR
)(info_win_idcmp_gad
= TextObject
, TextFrame
, End
),
1003 Child
, (IPTR
)Label("Title"),
1004 Child
, (IPTR
)(info_win_title_gad
= TextObject
, TextFrame
, End
),
1005 Child
, (IPTR
)Label("ReqCount"),
1006 Child
, (IPTR
)(info_win_req_gad
= TextObject
, TextFrame
, End
),
1007 Child
, (IPTR
)Label("WScreen"),
1008 Child
, (IPTR
)(info_win_screen_gad
= TextObject
, TextFrame
, End
),
1009 Child
, (IPTR
)Label("BorderLeft"),
1010 Child
, (IPTR
)(info_win_borderleft_gad
= TextObject
, TextFrame
, End
),
1011 Child
, (IPTR
)Label("BorderTop"),
1012 Child
, (IPTR
)(info_win_bordertop_gad
= TextObject
, TextFrame
, End
),
1013 Child
, (IPTR
)Label("BorderRight"),
1014 Child
, (IPTR
)(info_win_borderright_gad
= TextObject
, TextFrame
, End
),
1015 Child
, (IPTR
)Label("BoderBottom"),
1016 Child
, (IPTR
)(info_win_borderbottom_gad
= TextObject
, TextFrame
, End
),
1017 Child
, (IPTR
)Label("Parent Window"),
1018 Child
, (IPTR
)(info_win_parentwin_gad
= TextObject
, TextFrame
, End
),
1019 Child
, (IPTR
)Label("First Child"),
1020 Child
, (IPTR
)(info_win_firstchild_gad
= TextObject
, TextFrame
, End
),
1021 Child
, (IPTR
)Label("Parent"),
1022 Child
, (IPTR
)(info_win_parent_gad
= TextObject
, TextFrame
, End
),
1023 Child
, (IPTR
)Label("Descendant"),
1024 Child
, (IPTR
)(info_win_descendant_gad
= TextObject
, TextFrame
, End
),
1032 Cleanup(NULL
); // Probably double start
1034 DoMethod(wnd
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
1035 app
, 2, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
1037 DoMethod(info_wnd
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
1038 info_wnd
, 3, MUIM_Set
, MUIA_Window_Open
, FALSE
);
1040 DoMethod(list_gad
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
1041 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&updateinfo_hook
);
1043 DoMethod(list_gad
, MUIM_Notify
, MUIA_Listview_DoubleClick
, TRUE
,
1044 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&openinfo_hook
);
1048 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_QUIT
,
1049 (IPTR
)app
, 2, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
1051 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_ABOUT
,
1052 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&about_hook
);
1054 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_UPDATE
,
1055 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&update_hook
);
1057 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_KILL
,
1058 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&close_hook
);
1060 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_FRONT
,
1061 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&front_hook
);
1063 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_BACK
,
1064 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&back_hook
);
1066 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_ORIGIN
,
1067 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&origin_hook
);
1069 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_ACTIVATE
,
1070 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&activate_hook
);
1072 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_ZIP
,
1073 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&zip_hook
);
1075 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_HIDE
,
1076 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&hide_hook
);
1078 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_SHOW
,
1079 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&show_hook
);
1081 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_INFO
,
1082 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&openinfo_hook
);
1084 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_RESCUE
,
1085 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&rescue_hook
);
1087 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_SHOWALL
,
1088 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&showall_hook
);
1090 DoMethod(app
, MUIM_Notify
, MUIA_Application_MenuAction
, MN_RETHINK
,
1091 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&rethink_hook
);
1094 // buttons first row
1095 DoMethod(close_gad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1096 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&close_hook
);
1098 DoMethod(front_gad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1099 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&front_hook
);
1101 DoMethod(back_gad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1102 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&back_hook
);
1104 DoMethod(origin_gad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1105 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&origin_hook
);
1107 DoMethod(activate_gad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1108 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&activate_hook
);
1110 DoMethod(zip_gad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1111 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&zip_hook
);
1113 DoMethod(hide_gad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1114 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&hide_hook
);
1116 DoMethod(show_gad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1117 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&show_hook
);
1120 // buttons second row
1121 DoMethod(update_gad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1122 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&update_hook
);
1124 DoMethod(rescue_gad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1125 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&rescue_hook
);
1127 DoMethod(showall_gad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1128 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&showall_hook
);
1130 DoMethod(rethink_gad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1131 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&rethink_hook
);
1133 DoMethod(about_gad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1134 (IPTR
)app
, 2, MUIM_CallHook
, (IPTR
)&about_hook
);
1136 set(wnd
, MUIA_Window_Open
, TRUE
);
1137 CallHookPkt(&update_hook
, 0, 0);
1138 CallHookPkt(&updateinfo_hook
, 0, 0);
1139 DoMethod(app
, MUIM_Application_Execute
);
1142 /*********************************************************************************************/
1144 static void Cleanup(CONST_STRPTR txt
)
1146 MUI_DisposeObject(app
);
1149 MUI_Request(app
, wnd
, 0, TITLE_TXT
, "OK", txt
);
1155 /*********************************************************************************************/
1157 int main(int argc
, char **argv
)