grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / tools / WiMP / WiMP.c
blob94d732b4c58c054a5d29dc8891a50f26cd85db5e
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id: WiMP.c 41520 2011-09-21 13:56:22Z mmartinka $
5 WiMP -- Window manipulation program.
6 */
8 /******************************************************************************
10 NAME
12 WiMP
14 SYNOPSIS
17 LOCATION
19 SYS:Tools
21 FUNCTION
23 Manipulates screens and windows
25 INPUTS
27 RESULT
29 NOTES
31 EXAMPLE
33 BUGS
35 SEE ALSO
37 INTERNALS
39 ******************************************************************************/
41 #define MUIMASTER_YES_INLINE_STDARG
43 #include <libraries/mui.h>
44 #include <libraries/gadtools.h>
46 #include <proto/alib.h>
47 #include <proto/muimaster.h>
48 #include <proto/intuition.h>
49 #include <proto/exec.h>
50 #include <proto/dos.h>
51 #include <proto/utility.h>
53 #include <stdlib.h>
54 #include <string.h>
55 #include <stdio.h>
57 #include "locale.h"
59 static Object *app, *wnd, *list_gad;
61 static Object *close_gad, *front_gad, *back_gad, *origin_gad, *activate_gad, *zip_gad, *hide_gad, *show_gad;
62 static Object *update_gad, *rescue_gad, *showall_gad, *rethink_gad, *about_gad;
64 static Object *info_wnd, *page_gad;
66 static Object *info_scr_addr_gad, *info_scr_leftedge_gad, *info_scr_topedge_gad, *info_scr_width_gad, *info_scr_height_gad,
67 *info_scr_flags_gad, *info_scr_title_gad, *info_scr_deftitle_gad, *info_scr_firstwindow_gad;
70 static Object *info_win_addr_gad, *info_win_nextwin_gad, *info_win_leftedge_gad, *info_win_topedge_gad, *info_win_width_gad,
71 *info_win_height_gad, *info_win_minwidth_gad, *info_win_minheight_gad, *info_win_maxwidth_gad, *info_win_maxheight_gad,
72 *info_win_flags_gad, *info_win_idcmp_gad, *info_win_title_gad, *info_win_req_gad, *info_win_screen_gad,
73 *info_win_borderleft_gad, *info_win_bordertop_gad, *info_win_borderright_gad, *info_win_borderbottom_gad,
74 *info_win_parentwin_gad, *info_win_firstchild_gad, *info_win_parent_gad, *info_win_descendant_gad;
76 static ULONG lock;
79 static struct Hook close_hook, front_hook, back_hook, origin_hook, activate_hook, zip_hook, hide_hook, show_hook;
80 static struct Hook update_hook, rescue_hook, showall_hook, rethink_hook, about_hook;
81 static struct Hook display_hook, construct_hook, destruct_hook;
82 static struct Hook openinfo_hook, updateinfo_hook;
85 #define ABOUT_TXT (STRPTR)__(MSG_APP_ABOUT)
86 #define TITLE_TXT (STRPTR)__(MSG_WINDOW_TITLE)
87 #define INFOTITLE_TXT (STRPTR)__(MSG_INFO_TITLE)
88 #define CLOSESCREEN_TXT (STRPTR)__(MSG_CLOSE_SCREEN)
89 #define CLOSEWINDOW_TXT (STRPTR)__(MSG_CLOSE_WINDOW)
90 #define YESNO_TXT (STRPTR)__(MSG_YES_NO)
91 #define CONTINUE_TXT (STRPTR)__(MSG_CONTINUE)
94 enum {
95 None_type,
96 Window_type,
97 Screen_type,
98 Max_type
102 struct ListEntry
104 LONG type;
105 APTR aptr;
106 TEXT address[20];
107 TEXT size[12];
108 TEXT pos[12];
109 TEXT status[4];
110 TEXT title[40];
113 static const char version[] = "$VER: WiMP 0.13 (06.01.2009) © AROS Dev Team";
115 /*********************************************************************************************/
117 static void Cleanup(CONST_STRPTR txt);
118 static LONG get_selected(struct Screen **scr, struct Window **win);
119 static void MakeGUI(void);
121 /*********************************************************************************************/
123 enum {
124 MN_ABOUT=1,
125 MN_QUIT,
126 MN_UPDATE,
127 MN_KILL,
128 MN_FRONT,
129 MN_BACK,
130 MN_ORIGIN,
131 MN_ACTIVATE,
132 MN_ZIP,
133 MN_HIDE,
134 MN_SHOW,
135 MN_INFO,
136 MN_RESCUE,
137 MN_SHOWALL,
138 MN_RETHINK,
141 static struct NewMenu nm[] =
143 {NM_TITLE, NULL},
144 {NM_ITEM, NULL, NULL, 0, 0, (APTR)MN_ABOUT},
145 {NM_ITEM, NULL},
146 {NM_ITEM, NULL, "Q", 0, 0, (APTR)MN_QUIT},
147 {NM_TITLE, NULL},
148 {NM_ITEM, NULL, "U", 0, 0, (APTR)MN_UPDATE},
149 {NM_ITEM, NULL},
150 {NM_ITEM, NULL, NULL, 0, 0, (APTR)MN_KILL},
151 {NM_ITEM, NULL, NULL, 0, 0, (APTR)MN_FRONT},
152 {NM_ITEM, NULL, NULL, 0, 0, (APTR)MN_BACK},
153 {NM_ITEM, NULL, NULL, 0, 0, (APTR)MN_ORIGIN},
154 {NM_ITEM, NULL, NULL, 0, 0, (APTR)MN_ACTIVATE},
155 {NM_ITEM, NULL, NULL, 0, 0, (APTR)MN_ZIP},
156 {NM_ITEM, NULL, NULL, 0, 0, (APTR)MN_HIDE},
157 {NM_ITEM, NULL, NULL, 0, 0, (APTR)MN_SHOW},
158 {NM_ITEM, NULL},
159 {NM_ITEM, NULL, NULL, 0, 0, (APTR)MN_INFO},
160 {NM_TITLE, NULL},
161 {NM_ITEM, NULL, NULL, 0, 0, (APTR)MN_RESCUE},
162 {NM_ITEM, NULL, NULL, 0, 0, (APTR)MN_SHOWALL},
163 {NM_ITEM, NULL, NULL, 0, 0, (APTR)MN_RETHINK},
164 {NM_END}
167 /*********************************************************************************************/
169 static LONG get_selected(struct Screen **scr, struct Window **win)
171 *scr = NULL;
172 *win = NULL;
174 struct ListEntry *le;
175 DoMethod(list_gad, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, (IPTR)&le);
177 if (le)
179 lock = LockIBase ( 0 );
180 *scr = IntuitionBase->FirstScreen;
181 UnlockIBase ( lock );
182 /* Traverse through all Screens */
183 while ( *scr )
185 if ((le->type == Screen_type) && (le->aptr == *scr))
187 return Screen_type;
190 /* Traverse through all Windows of current Screen */
191 *win = (*scr)->FirstWindow;
192 while ( *win )
194 if ((le->type == Window_type) && (le->aptr == *win))
196 return Window_type;
199 *win = (*win)->NextWindow;
201 *scr = (*scr)->NextScreen;
204 return None_type;
207 /*********************************************************************************************/
209 AROS_UFH3(void, display_func,
210 AROS_UFHA(struct Hook * , h, A0),
211 AROS_UFHA(char ** , array, A2),
212 AROS_UFHA(struct ListEntry *, msg, A1))
214 AROS_USERFUNC_INIT;
216 if (msg)
218 if (msg->type == Window_type)
220 array[0] = (STRPTR)__(MSG_ARRAY_WINDOW);
222 else
224 array[0] = (STRPTR)__(MSG_ARRAY_SCREEN);
226 array[1] = msg->address;
227 array[2] = msg->size;
228 array[3] = msg->pos;
229 array[4] = msg->status;
230 array[5] = msg->title;
232 else
234 array[0] = (STRPTR)__(MSG_ARRAY_0_TYPE);
235 array[1] = (STRPTR)__(MSG_ARRAY_1_ADDRESS);
236 array[2] = (STRPTR)__(MSG_ARRAY_2_SIZE);
237 array[3] = (STRPTR)__(MSG_ARRAY_3_POSITION);
238 array[4] = (STRPTR)__(MSG_ARRAY_4_STATUS);
239 array[5] = (STRPTR)__(MSG_ARRAY_5_TITLE);
242 AROS_USERFUNC_EXIT
245 /*********************************************************************************************/
247 AROS_UFH3(APTR, construct_func,
248 AROS_UFHA(struct Hook * , h, A0),
249 AROS_UFHA(APTR , pool, A2),
250 AROS_UFHA(struct ListEntry *, msg, A1))
252 AROS_USERFUNC_INIT
254 struct ListEntry *new = AllocPooled(pool, sizeof(*msg));
255 if (new)
256 *new = *msg;
258 return new;
260 AROS_USERFUNC_EXIT
263 /*********************************************************************************************/
265 AROS_UFH3(void, destruct_func,
266 AROS_UFHA(struct Hook * , h, A0),
267 AROS_UFHA(APTR , pool, A2),
268 AROS_UFHA(struct ListEntry *, msg, A1))
270 AROS_USERFUNC_INIT
272 FreePooled(pool, msg, sizeof(*msg));
274 AROS_USERFUNC_EXIT
277 /*********************************************************************************************/
279 AROS_UFH3(void, update_func,
280 AROS_UFHA(struct Hook *, h, A0),
281 AROS_UFHA(Object * , object, A2),
282 AROS_UFHA(APTR , msg, A1))
284 AROS_USERFUNC_INIT;
286 struct Screen *scr;
287 struct Window *win;
288 struct ListEntry entry;
290 set(list_gad, MUIA_List_Quiet, TRUE);
291 DoMethod(list_gad, MUIM_List_Clear);
293 /* Get Intuition's first Screen */
294 lock = LockIBase ( 0 );
295 scr = IntuitionBase->FirstScreen;
296 UnlockIBase ( lock );
298 /* Traverse through all Screens */
299 while ( scr )
301 entry.type = Screen_type;
302 entry.aptr = scr;
303 sprintf(entry.address, "%p", scr);
304 sprintf(entry.size, "%d x %d", scr->Width, scr->Height);
305 sprintf(entry.pos, "%d x %d", scr->LeftEdge, scr->TopEdge);
306 entry.status[0] = '\0';
307 snprintf(entry.title, sizeof(entry.title) - 1, "%s", scr->Title ? (char *)scr->Title : "");
308 DoMethod(list_gad, MUIM_List_InsertSingle, &entry, MUIV_List_Insert_Bottom);
310 /* Traverse through all Windows of current Screen */
311 win = scr->FirstWindow;
312 while ( win )
314 entry.type = Window_type;
315 entry.aptr = win;
316 sprintf(entry.address, "%p", win);
317 sprintf(entry.size, "%d x %d", win->Width, win->Height);
318 sprintf(entry.pos, "%d x %d", win->LeftEdge, win->TopEdge);
319 sprintf(entry.status, "%c%c%c",
320 (IsWindowVisible(win) ? ' ' : 'H'),
321 (IS_CHILD(win) ? 'C' : ' '),
322 (HAS_CHILDREN(win) ? 'P' : ' '));
323 snprintf(entry.title, sizeof(entry.title) - 1, "%s", win->Title ? (char *)win->Title : "");
324 DoMethod(list_gad, MUIM_List_InsertSingle, &entry, MUIV_List_Insert_Bottom);
326 win = win->NextWindow;
328 scr = scr->NextScreen;
330 set(list_gad, MUIA_List_Quiet, FALSE);
332 AROS_USERFUNC_EXIT
335 /*********************************************************************************************/
337 AROS_UFH3(void, close_func,
338 AROS_UFHA(struct Hook *, h, A0),
339 AROS_UFHA(Object * , object, A2),
340 AROS_UFHA(APTR , msg, A1))
342 AROS_USERFUNC_INIT;
344 struct Screen *scr;
345 struct Window *win;
346 switch (get_selected(&scr, &win))
348 case Screen_type :
349 if (MUI_Request(app, wnd, 0, TITLE_TXT, YESNO_TXT, CLOSESCREEN_TXT))
351 CloseScreen(scr);
353 break;
354 case Window_type :
355 if (MUI_Request(app, wnd, 0, TITLE_TXT, YESNO_TXT, CLOSEWINDOW_TXT))
357 CloseWindow(win);
359 break;
362 CallHookPkt(&update_hook, 0, 0);
364 AROS_USERFUNC_EXIT
367 /*********************************************************************************************/
369 AROS_UFH3(void, front_func,
370 AROS_UFHA(struct Hook *, h, A0),
371 AROS_UFHA(Object * , object, A2),
372 AROS_UFHA(APTR , msg, A1))
374 AROS_USERFUNC_INIT;
376 struct Screen *scr;
377 struct Window *win;
378 switch (get_selected(&scr, &win))
380 case Screen_type:
381 ScreenToFront(scr);
382 break;
383 case Window_type:
384 WindowToFront(win);
385 break;
388 CallHookPkt(&update_hook, 0, 0);
390 AROS_USERFUNC_EXIT
393 /*********************************************************************************************/
395 AROS_UFH3(void, back_func,
396 AROS_UFHA(struct Hook *, h, A0),
397 AROS_UFHA(Object * , object, A2),
398 AROS_UFHA(APTR , msg, A1))
400 AROS_USERFUNC_INIT;
402 struct Screen *scr;
403 struct Window *win;
404 switch (get_selected(&scr, &win))
406 case Screen_type:
407 ScreenToBack(scr);
408 break;
409 case Window_type:
410 WindowToBack(win);
411 break;
414 CallHookPkt(&update_hook, 0, 0);
416 AROS_USERFUNC_EXIT
419 /*********************************************************************************************/
421 AROS_UFH3(void, origin_func,
422 AROS_UFHA(struct Hook *, h, A0),
423 AROS_UFHA(Object * , object, A2),
424 AROS_UFHA(APTR , msg, A1))
426 AROS_USERFUNC_INIT;
428 struct Screen *scr;
429 struct Window *win;
430 switch (get_selected(&scr, &win))
432 case Screen_type :
433 MoveScreen ( scr, -scr->LeftEdge, -scr->TopEdge );
434 break;
435 case Window_type :
436 MoveWindow ( win, -win->RelLeftEdge, -win->RelTopEdge );
437 break;
440 Delay(5);
441 CallHookPkt(&update_hook, 0, 0);
443 AROS_USERFUNC_EXIT
446 /*********************************************************************************************/
448 AROS_UFH3(void, activate_func,
449 AROS_UFHA(struct Hook *, h, A0),
450 AROS_UFHA(Object * , object, A2),
451 AROS_UFHA(APTR , msg, A1))
453 AROS_USERFUNC_INIT;
455 struct Screen *scr;
456 struct Window *win;
457 if (get_selected(&scr, &win) == Window_type )
459 ActivateWindow ( win );
462 CallHookPkt(&update_hook, 0, 0);
464 AROS_USERFUNC_EXIT
467 /*********************************************************************************************/
469 AROS_UFH3(void, hide_func,
470 AROS_UFHA(struct Hook *, h, A0),
471 AROS_UFHA(Object * , object, A2),
472 AROS_UFHA(APTR , msg, A1))
474 AROS_USERFUNC_INIT;
476 struct Screen *scr;
477 struct Window *win;
478 if (get_selected(&scr, &win) == Window_type)
480 if ((struct Window*)XGET(wnd, MUIA_Window_Window) != win) // You can't hide WiMP
482 HideWindow ( win );
486 Delay(5);
487 CallHookPkt(&update_hook, 0, 0);
489 AROS_USERFUNC_EXIT
492 /*********************************************************************************************/
494 AROS_UFH3(void, show_func,
495 AROS_UFHA(struct Hook *, h, A0),
496 AROS_UFHA(Object * , object, A2),
497 AROS_UFHA(APTR , msg, A1))
499 AROS_USERFUNC_INIT;
501 struct Screen *scr;
502 struct Window *win;
503 if (get_selected(&scr, &win) == Window_type)
505 ShowWindow (win, WINDOW_FRONTMOST);
508 Delay(5);
509 CallHookPkt(&update_hook, 0, 0);
511 AROS_USERFUNC_EXIT
514 /*********************************************************************************************/
516 AROS_UFH3(void, zip_func,
517 AROS_UFHA(struct Hook *, h, A0),
518 AROS_UFHA(Object * , object, A2),
519 AROS_UFHA(APTR , msg, A1))
521 AROS_USERFUNC_INIT;
523 struct Screen *scr;
524 struct Window *win;
525 if (get_selected(&scr, &win) == Window_type)
527 ZipWindow ( win );
530 CallHookPkt(&update_hook, 0, 0);
532 AROS_USERFUNC_EXIT
535 /*********************************************************************************************/
537 AROS_UFH3(void, showall_func,
538 AROS_UFHA(struct Hook *, h, A0),
539 AROS_UFHA(Object * , object, A2),
540 AROS_UFHA(APTR , msg, A1))
542 AROS_USERFUNC_INIT;
544 struct Screen *scr;
545 struct Window *win;
547 /* Get Intuition's first Screen */
548 lock = LockIBase ( 0 );
549 scr = IntuitionBase->FirstScreen;
550 UnlockIBase ( lock );
552 /* Traverse through all Screens */
553 while ( scr )
555 win = scr->FirstWindow;
556 /* Traverse through all Windows of current Screen */
557 while ( win )
559 /* Show Window if hidden */
560 if ( IsWindowVisible ( win ) != TRUE )
562 ShowWindow (win, WINDOW_FRONTMOST);
564 win = win->NextWindow;
566 scr = scr->NextScreen;
569 Delay(5);
570 CallHookPkt(&update_hook, 0, 0);
572 AROS_USERFUNC_EXIT
575 /*********************************************************************************************/
577 AROS_UFH3(void, rescue_func,
578 AROS_UFHA(struct Hook *, h, A0),
579 AROS_UFHA(Object * , object, A2),
580 AROS_UFHA(APTR , msg, A1))
582 AROS_USERFUNC_INIT;
584 struct Screen *scr;
585 struct Window *win;
586 WORD width, height;
588 /* Get Intuition's first Screen */
589 lock = LockIBase ( 0 );
590 scr = IntuitionBase->FirstScreen;
591 UnlockIBase ( lock );
593 /* Traverse through all Screens */
594 while ( scr )
596 win = scr->FirstWindow;
597 /* Traverse through all Windows of current Screen */
598 while ( win )
600 /* Move Window onto the Screen if outside */
601 if ( win->parent == NULL )
603 WORD dx = 0, dy = 0;
604 if (win->LeftEdge < 0)
605 dx = -win->LeftEdge;
606 else if (win->LeftEdge + win->Width > win->WScreen->Width)
607 dx = win->WScreen->Width - win->Width - win->LeftEdge;
609 if (win->TopEdge + win->Height > win->WScreen->Height)
610 dy = win->WScreen->Height - win->Height - win->TopEdge;
611 else if (win->TopEdge < win->WScreen->BarHeight)
613 // try to keep the screen title bar visible
614 if (win->WScreen->BarHeight + win->Height < win->WScreen->Height)
615 dy = -win->TopEdge + win->WScreen->BarHeight;
616 else
617 dy = win->WScreen->Height - win->Height - win->TopEdge;
619 MoveWindow(win, dx, dy);
621 else
623 width = win->parent->Width;
624 height = win->parent->Height;
625 /* TODO: calculate reasonable values:
626 eg. this way only the Close Gadget my be visible :-( */
627 if ( win->RelLeftEdge < 0
628 || win->RelTopEdge <= -(win->BorderTop)
629 || win->RelLeftEdge > width
630 || win->RelTopEdge >= (height - win->BorderTop) )
632 MoveWindow ( win, - win->RelLeftEdge, - win->RelTopEdge );
635 win = win->NextWindow;
637 scr = scr->NextScreen;
640 Delay(5);
641 CallHookPkt(&update_hook, 0, 0);
643 AROS_USERFUNC_EXIT
646 /*********************************************************************************************/
648 AROS_UFH3(void, rethink_func,
649 AROS_UFHA(struct Hook *, h, A0),
650 AROS_UFHA(Object * , object, A2),
651 AROS_UFHA(APTR , msg, A1))
653 AROS_USERFUNC_INIT
655 RethinkDisplay();
656 CallHookPkt(&update_hook, 0, 0);
658 AROS_USERFUNC_EXIT
661 /*********************************************************************************************/
663 AROS_UFH3(void, about_func,
664 AROS_UFHA(struct Hook *, h, A0),
665 AROS_UFHA(Object * , object, A2),
666 AROS_UFHA(APTR , msg, A1))
668 AROS_USERFUNC_INIT
670 MUI_Request(app, wnd, 0, TITLE_TXT, CONTINUE_TXT, ABOUT_TXT);
672 AROS_USERFUNC_EXIT
675 /*********************************************************************************************/
677 AROS_UFH3(void, update_info_func,
678 AROS_UFHA(struct Hook *, h, A0),
679 AROS_UFHA(Object * , object, A2),
680 AROS_UFHA(APTR , msg, A1))
682 AROS_USERFUNC_INIT;
684 static TEXT buffer[50];
685 struct ListEntry *le;
686 struct Window *win;
687 struct Screen *scr;
689 DoMethod(list_gad, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, (IPTR)&le);
690 if (le)
692 set(close_gad, MUIA_Disabled, FALSE);
693 set(front_gad, MUIA_Disabled, FALSE);
694 set(back_gad, MUIA_Disabled, FALSE);
695 set(origin_gad, MUIA_Disabled, FALSE);
696 set(activate_gad, MUIA_Disabled, FALSE);
697 set(zip_gad, MUIA_Disabled, FALSE);
698 set(hide_gad, MUIA_Disabled, FALSE);
699 set(show_gad, MUIA_Disabled, FALSE);
701 else
703 set(close_gad, MUIA_Disabled, TRUE);
704 set(front_gad, MUIA_Disabled, TRUE);
705 set(back_gad, MUIA_Disabled, TRUE);
706 set(origin_gad, MUIA_Disabled, TRUE);
707 set(activate_gad, MUIA_Disabled, TRUE);
708 set(zip_gad, MUIA_Disabled, TRUE);
709 set(hide_gad, MUIA_Disabled, TRUE);
710 set(show_gad, MUIA_Disabled, TRUE);
713 if (XGET(info_wnd, MUIA_Window_Open))
715 if (le)
717 switch (get_selected(&scr, &win))
719 case Screen_type:
721 scr = le->aptr;
722 set(page_gad, MUIA_Group_ActivePage, 0);
724 sprintf(buffer, "%p", scr);
725 set(info_scr_addr_gad, MUIA_Text_Contents, buffer);
727 sprintf(buffer, "%d", scr->LeftEdge);
728 set(info_scr_leftedge_gad, MUIA_Text_Contents, buffer);
730 sprintf(buffer, "%d", scr->TopEdge);
731 set(info_scr_topedge_gad, MUIA_Text_Contents, buffer);
733 sprintf(buffer, "%d", scr->Width);
734 set(info_scr_width_gad, MUIA_Text_Contents, buffer);
736 sprintf(buffer, "%d", scr->Height);
737 set(info_scr_height_gad, MUIA_Text_Contents, buffer);
739 sprintf(buffer, "0x%08x", scr->Flags);
740 set(info_scr_flags_gad, MUIA_Text_Contents, buffer);
742 set(info_scr_title_gad, MUIA_Text_Contents, scr->Title);
743 set(info_scr_deftitle_gad, MUIA_Text_Contents, scr->DefaultTitle);
745 sprintf(buffer, "%p", scr->FirstWindow);
746 set(info_scr_firstwindow_gad, MUIA_Text_Contents, buffer);
748 break;
750 case Window_type:
751 win = le->aptr;
752 set(page_gad, MUIA_Group_ActivePage, 1);
754 sprintf(buffer, "%p", win);
755 set(info_win_addr_gad, MUIA_Text_Contents, buffer);
757 sprintf(buffer, "%p", win->NextWindow);
758 set(info_win_nextwin_gad, MUIA_Text_Contents, buffer);
760 sprintf(buffer, "%d", win->LeftEdge);
761 set(info_win_leftedge_gad, MUIA_Text_Contents, buffer);
763 sprintf(buffer, "%d", win->TopEdge);
764 set(info_win_topedge_gad, MUIA_Text_Contents, buffer);
766 sprintf(buffer, "%d", win->Height);
767 set(info_win_height_gad, MUIA_Text_Contents, buffer);
769 sprintf(buffer, "%d", win->Width);
770 set(info_win_width_gad, MUIA_Text_Contents, buffer);
772 sprintf(buffer, "%d", win->MinWidth);
773 set(info_win_minwidth_gad, MUIA_Text_Contents, buffer);
775 sprintf(buffer, "%d", win->MinHeight);
776 set(info_win_minheight_gad, MUIA_Text_Contents, buffer);
778 sprintf(buffer, "%d", win->MaxWidth);
779 set(info_win_maxwidth_gad, MUIA_Text_Contents, buffer);
781 sprintf(buffer, "%d", win->MaxHeight);
782 set(info_win_maxheight_gad, MUIA_Text_Contents, buffer);
784 sprintf(buffer, "0x%08x", (unsigned int)win->Flags);
785 set(info_win_flags_gad, MUIA_Text_Contents, buffer);
787 sprintf(buffer, "0x%08x", (unsigned int)win->IDCMPFlags);
788 set(info_win_idcmp_gad, MUIA_Text_Contents, buffer);
790 set(info_win_title_gad, MUIA_Text_Contents, win->Title);
792 sprintf(buffer, "%d", win->ReqCount);
793 set(info_win_req_gad, MUIA_Text_Contents, buffer);
795 sprintf(buffer, "%p", win->WScreen);
796 set(info_win_screen_gad, MUIA_Text_Contents, buffer);
798 sprintf(buffer, "%d", win->BorderLeft);
799 set(info_win_borderleft_gad, MUIA_Text_Contents, buffer);
801 sprintf(buffer, "%d", win->BorderTop);
802 set(info_win_bordertop_gad, MUIA_Text_Contents, buffer);
804 sprintf(buffer, "%d", win->BorderRight);
805 set(info_win_borderright_gad, MUIA_Text_Contents, buffer);
807 sprintf(buffer, "%d", win->BorderBottom);
808 set(info_win_borderbottom_gad, MUIA_Text_Contents, buffer);
810 sprintf(buffer, "%p", win->parent);
811 set(info_win_parentwin_gad, MUIA_Text_Contents, buffer);
813 sprintf(buffer, "%p", win->firstchild);
814 set(info_win_firstchild_gad, MUIA_Text_Contents, buffer);
816 sprintf(buffer, "%p", win->Parent);
817 set(info_win_parent_gad, MUIA_Text_Contents, buffer);
819 sprintf(buffer, "%p", win->Descendant);
820 set(info_win_descendant_gad, MUIA_Text_Contents, buffer);
822 break;
823 default:
824 // selected screen/window doesn't exist anymore
825 CallHookPkt(&update_hook, 0, 0);
826 break;
829 else // window is open but no entry is selected
831 set(info_scr_addr_gad, MUIA_Text_Contents, NULL);
832 set(info_scr_leftedge_gad, MUIA_Text_Contents, NULL);
833 set(info_scr_topedge_gad, MUIA_Text_Contents, NULL);
834 set(info_scr_width_gad, MUIA_Text_Contents, NULL);
835 set(info_scr_height_gad, MUIA_Text_Contents, NULL);
836 set(info_scr_flags_gad, MUIA_Text_Contents, NULL);
837 set(info_scr_title_gad, MUIA_Text_Contents, NULL);
838 set(info_scr_deftitle_gad, MUIA_Text_Contents, NULL);
839 set(info_scr_firstwindow_gad, MUIA_Text_Contents, NULL);
840 set(info_win_addr_gad, MUIA_Text_Contents, NULL);
841 set(info_win_nextwin_gad, MUIA_Text_Contents, NULL);
842 set(info_win_leftedge_gad, MUIA_Text_Contents, NULL);
843 set(info_win_topedge_gad, MUIA_Text_Contents, NULL);
844 set(info_win_height_gad, MUIA_Text_Contents, NULL);
845 set(info_win_width_gad, MUIA_Text_Contents, NULL);
846 set(info_win_minwidth_gad, MUIA_Text_Contents, NULL);
847 set(info_win_minheight_gad, MUIA_Text_Contents, NULL);
848 set(info_win_maxwidth_gad, MUIA_Text_Contents, NULL);
849 set(info_win_maxheight_gad, MUIA_Text_Contents, NULL);
850 set(info_win_flags_gad, MUIA_Text_Contents, NULL);
851 set(info_win_idcmp_gad, MUIA_Text_Contents, NULL);
852 set(info_win_title_gad, MUIA_Text_Contents, NULL);
853 set(info_win_req_gad, MUIA_Text_Contents, NULL);
854 set(info_win_screen_gad, MUIA_Text_Contents, NULL);
855 set(info_win_borderleft_gad, MUIA_Text_Contents, NULL);
856 set(info_win_bordertop_gad, MUIA_Text_Contents, NULL);
857 set(info_win_borderright_gad, MUIA_Text_Contents, NULL);
858 set(info_win_borderbottom_gad, MUIA_Text_Contents, NULL);
859 set(info_win_parentwin_gad, MUIA_Text_Contents, NULL);
860 set(info_win_firstchild_gad, MUIA_Text_Contents, NULL);
861 set(info_win_parent_gad, MUIA_Text_Contents, NULL);
862 set(info_win_descendant_gad, MUIA_Text_Contents, NULL);
866 AROS_USERFUNC_EXIT
869 /*********************************************************************************************/
871 AROS_UFH3(void, openinfo_func,
872 AROS_UFHA(struct Hook *, h, A0),
873 AROS_UFHA(Object * , object, A2),
874 AROS_UFHA(APTR , msg, A1))
876 AROS_USERFUNC_INIT
878 set(info_wnd, MUIA_Window_Open, TRUE);
879 CallHookPkt(&updateinfo_hook, 0, 0);
880 AROS_USERFUNC_EXIT
883 /*********************************************************************************************/
885 static void MakeGUI(void)
887 nm[ 0].nm_Label = _(MSG_MENU_PROJECT);
888 nm[ 1].nm_Label = _(MSG_MENU_ABOUT);
889 nm[ 2].nm_Label = NM_BARLABEL;
890 nm[ 3].nm_Label = _(MSG_MENU_QUIT);
891 nm[ 4].nm_Label = _(MSG_MENU_WIN_LIST);
892 nm[ 5].nm_Label = _(MSG_MENU_UPDATE_LIST);
893 nm[ 6].nm_Label = NM_BARLABEL;
894 nm[ 7].nm_Label = _(MSG_MENU_KILL);
895 nm[ 8].nm_Label = _(MSG_MENU_TO_FRONT);
896 nm[ 9].nm_Label = _(MSG_MENU_TO_BACK);
897 nm[10].nm_Label = _(MSG_MENU_TO_ORIGIN);
898 nm[11].nm_Label = _(MSG_MENU_ACTIVATE);
899 nm[12].nm_Label = _(MSG_MENU_ZIP);
900 nm[13].nm_Label = _(MSG_MENU_HIDE);
901 nm[14].nm_Label = _(MSG_MENU_SHOW);
902 nm[15].nm_Label = NM_BARLABEL;
903 nm[16].nm_Label = _(MSG_MENU_INFO);
904 nm[17].nm_Label = _(MSG_MENU_GENERIC);
905 nm[18].nm_Label = _(MSG_MENU_RESCUE_ALL);
906 nm[19].nm_Label = _(MSG_MENU_SHOW_ALL);
907 nm[20].nm_Label = _(MSG_MENU_RETHINGDISPLAY);
909 Object *menu = MUI_MakeObject(MUIO_MenustripNM, &nm, 0);
911 display_hook.h_Entry = (HOOKFUNC)display_func;
912 construct_hook.h_Entry = (HOOKFUNC)construct_func;
913 destruct_hook.h_Entry = (HOOKFUNC)destruct_func;
915 close_hook.h_Entry = (HOOKFUNC)close_func;
916 front_hook.h_Entry = (HOOKFUNC)front_func;
917 back_hook.h_Entry = (HOOKFUNC)back_func;
918 origin_hook.h_Entry = (HOOKFUNC)origin_func;
919 activate_hook.h_Entry = (HOOKFUNC)activate_func;
920 zip_hook.h_Entry = (HOOKFUNC)zip_func;
921 hide_hook.h_Entry = (HOOKFUNC)hide_func;
922 show_hook.h_Entry = (HOOKFUNC)show_func;
924 update_hook.h_Entry = (HOOKFUNC)update_func;
925 rescue_hook.h_Entry = (HOOKFUNC)rescue_func;
926 showall_hook.h_Entry = (HOOKFUNC)showall_func;
927 rethink_hook.h_Entry = (HOOKFUNC)rethink_func;
928 about_hook.h_Entry = (HOOKFUNC)about_func;
930 openinfo_hook.h_Entry = (HOOKFUNC)openinfo_func;
931 updateinfo_hook.h_Entry = (HOOKFUNC)update_info_func;
933 app = (Object *)ApplicationObject,
934 MUIA_Application_Title, (IPTR)__(MSG_APP_NAME),
935 MUIA_Application_Version, (IPTR)version,
936 MUIA_Application_Copyright, (IPTR)__(MSG_APP_COPYRIGHT),
937 MUIA_Application_Author, (IPTR)__(MSG_APP_AUTOR),
938 MUIA_Application_Description, (IPTR)__(MSG_APP_TITLE),
939 MUIA_Application_Base, (IPTR)__(MSG_APP_BASE),
940 MUIA_Application_SingleTask, TRUE,
941 MUIA_Application_Menustrip, (IPTR)menu,
942 SubWindow, (IPTR)(wnd = (Object *)WindowObject,
943 MUIA_Window_Title, (IPTR)TITLE_TXT,
944 MUIA_Window_ID, MAKE_ID('W', 'I', 'M', 'P'),
945 WindowContents, (IPTR)(VGroup,
946 Child, (IPTR)(VGroup,
947 GroupFrameT(__(MSG_SCREEN_WINDOW_LIST)),
948 Child, (IPTR)(ListviewObject,
949 MUIA_Listview_List, (IPTR)(list_gad = (Object *)ListObject,
950 InputListFrame,
951 MUIA_List_Format, (IPTR)"BAR,BAR,P=\033c BAR,P=\033c BAR,BAR,BAR",
952 MUIA_List_ConstructHook, (IPTR)&construct_hook,
953 MUIA_List_DestructHook, (IPTR)&destruct_hook,
954 MUIA_List_DisplayHook, (IPTR)&display_hook,
955 MUIA_List_Title, TRUE,
956 MUIA_CycleChain, 1,
957 End),
958 End),
959 Child, (IPTR)(HGroup,
960 Child, (IPTR)(close_gad = SimpleButton(__(MSG_BTN_KILL))),
961 Child, (IPTR)(front_gad = SimpleButton(__(MSG_BTN_FRONT))),
962 Child, (IPTR)(back_gad = SimpleButton(__(MSG_BTN_BACK))),
963 Child, (IPTR)(origin_gad = SimpleButton(__(MSG_BTN_MOVE))),
964 Child, (IPTR)(activate_gad = SimpleButton(__(MSG_BTN_ACTIVATE))),
965 Child, (IPTR)(zip_gad = SimpleButton(__(MSG_BTN_ZIP))),
966 Child, (IPTR)(hide_gad = SimpleButton(__(MSG_BTN_HIDE))),
967 Child, (IPTR)(show_gad = SimpleButton(__(MSG_BTN_SHOW))),
968 End),
969 Child, (IPTR)(HGroup,
970 Child, (IPTR)(update_gad = SimpleButton(__(MSG_BTN_UPDATE_LIST))),
971 Child, (IPTR)(rescue_gad = SimpleButton(__(MSG_BTN_RESCUE_ALL))),
972 Child, (IPTR)(showall_gad = SimpleButton(__(MSG_BTN_SHOW_ALL))),
973 Child, (IPTR)(rethink_gad = SimpleButton(__(MSG_BTN_RETHING))),
974 Child, (IPTR)(about_gad = SimpleButton(__(MSG_BTN_ABOUT))),
975 End),
976 End),
977 End),
978 End), // wnd
979 SubWindow, (IPTR)(info_wnd = (Object *)WindowObject,
980 MUIA_Window_Title, (IPTR)INFOTITLE_TXT,
981 MUIA_Window_ID, MAKE_ID('W', 'I', 'N', 'F'),
982 WindowContents, (IPTR)(page_gad = (Object *)PageGroup,
983 Child, (IPTR)(HGroup,
984 Child, (IPTR)(ColGroup(2),
985 GroupFrameT(__(MSG_COL_SCREEN)),
987 Child, (IPTR)Label(__(MSG_COL_SCR_ADDRESS)),
988 Child, (IPTR)(info_scr_addr_gad = (Object *)TextObject,
989 TextFrame,
990 MUIA_Text_Contents, (IPTR)"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW",
991 MUIA_Text_SetMin, TRUE,
992 End),
993 Child, (IPTR)Label(__(MSG_COL_SCR_LEFTEDGE)),
994 Child, (IPTR)(info_scr_leftedge_gad = (Object *)TextObject, TextFrame, End),
995 Child, (IPTR)Label(__(MSG_COL_SCR_TOPEDGE)),
996 Child, (IPTR)(info_scr_topedge_gad = (Object *)TextObject, TextFrame, End),
997 Child, (IPTR)Label(__(MSG_COL_SCR_WIDTH)),
998 Child, (IPTR)(info_scr_width_gad = (Object *)TextObject, TextFrame, End),
999 Child, (IPTR)Label(__(MSG_COL_SCR_HEIGHT)),
1000 Child, (IPTR)(info_scr_height_gad = (Object *)TextObject, TextFrame, End),
1001 Child, (IPTR)Label(__(MSG_COL_SCR_FLAGS)),
1002 Child, (IPTR)(info_scr_flags_gad = (Object *)TextObject, TextFrame, End),
1003 Child, (IPTR)Label(__(MSG_COL_SCR_TITLE)),
1004 Child, (IPTR)(info_scr_title_gad = (Object *)TextObject, TextFrame, End),
1005 Child, (IPTR)Label(__(MSG_COL_SCR_DEFAULTIT)),
1006 Child, (IPTR)(info_scr_deftitle_gad = (Object *)TextObject, TextFrame, End),
1007 Child, (IPTR)Label(__(MSG_COL_SCR_FRSTWIN)),
1008 Child, (IPTR)(info_scr_firstwindow_gad = (Object *)TextObject, TextFrame, End),
1009 End),
1010 End),
1011 Child, (IPTR)(HGroup,
1012 Child, (IPTR)(ColGroup(2),
1013 GroupFrameT(__(MSG_COL_WIDOW)),
1014 Child, (IPTR)Label(__(MSG_COL_WIN_ADDRESS)),
1015 Child, (IPTR)(info_win_addr_gad = (Object *)TextObject,
1016 TextFrame,
1017 MUIA_Text_Contents, (IPTR)"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW",
1018 MUIA_Text_SetMin, TRUE,
1019 End),
1020 Child, (IPTR)Label(__(MSG_COL_WIN_NEXTWIN)),
1021 Child, (IPTR)(info_win_nextwin_gad = (Object *)TextObject, TextFrame, End),
1022 Child, (IPTR)Label(__(MSG_COL_WIN_LEFTEDGE)),
1023 Child, (IPTR)(info_win_leftedge_gad = (Object *)TextObject, TextFrame, End),
1024 Child, (IPTR)Label(__(MSG_COL_WIN_TOPEDGE)),
1025 Child, (IPTR)(info_win_topedge_gad = (Object *)TextObject, TextFrame, End),
1026 Child, (IPTR)Label(__(MSG_COL_WIN_WIDTH)),
1027 Child, (IPTR)(info_win_width_gad = (Object *)TextObject, TextFrame, End),
1028 Child, (IPTR)Label(__(MSG_COL_WIN_HEIGHT)),
1029 Child, (IPTR)(info_win_height_gad = (Object *)TextObject, TextFrame, End),
1030 Child, (IPTR)Label(__(MSG_COL_WIN_MINWIDTH)),
1031 Child, (IPTR)(info_win_minwidth_gad = (Object *)TextObject, TextFrame, End),
1032 Child, (IPTR)Label(__(MSG_COL_WIN_MINHEIGHT)),
1033 Child, (IPTR)(info_win_minheight_gad = (Object *)TextObject, TextFrame, End),
1034 Child, (IPTR)Label(__(MSG_COL_WIN_MAXWIDTH)),
1035 Child, (IPTR)(info_win_maxwidth_gad = (Object *)TextObject, TextFrame, End),
1036 Child, (IPTR)Label(__(MSG_COL_WIN_MAXHEIGHT)),
1037 Child, (IPTR)(info_win_maxheight_gad = (Object *)TextObject, TextFrame, End),
1038 Child, (IPTR)Label(__(MSG_COL_WIN_FLAGS)),
1039 Child, (IPTR)(info_win_flags_gad = (Object *)TextObject, TextFrame, End),
1040 Child, (IPTR)Label(__(MSG_COL_WIN_IDCMPFLAGS)),
1041 Child, (IPTR)(info_win_idcmp_gad = (Object *)TextObject, TextFrame, End),
1042 Child, (IPTR)Label(__(MSG_COL_WIN_TITLE)),
1043 Child, (IPTR)(info_win_title_gad = (Object *)TextObject, TextFrame, End),
1044 Child, (IPTR)Label(__(MSG_COL_WIN_REQCOUNT)),
1045 Child, (IPTR)(info_win_req_gad = (Object *)TextObject, TextFrame, End),
1046 Child, (IPTR)Label(__(MSG_COL_WIN_WSCREEN)),
1047 Child, (IPTR)(info_win_screen_gad = (Object *)TextObject, TextFrame, End),
1048 Child, (IPTR)Label(__(MSG_COL_WIN_BORDERLEFT)),
1049 Child, (IPTR)(info_win_borderleft_gad = (Object *)TextObject, TextFrame, End),
1050 Child, (IPTR)Label(__(MSG_COL_WIN_BORDERTOP)),
1051 Child, (IPTR)(info_win_bordertop_gad = (Object *)TextObject, TextFrame, End),
1052 Child, (IPTR)Label(__(MSG_COL_WIN_BORDERRIGHT)),
1053 Child, (IPTR)(info_win_borderright_gad = (Object *)TextObject, TextFrame, End),
1054 Child, (IPTR)Label(__(MSG_COL_WIN_BORDERBOTTOM)),
1055 Child, (IPTR)(info_win_borderbottom_gad = (Object *)TextObject, TextFrame, End),
1056 Child, (IPTR)Label(__(MSG_COL_WIN_PARENTWIN)),
1057 Child, (IPTR)(info_win_parentwin_gad = (Object *)TextObject, TextFrame, End),
1058 Child, (IPTR)Label(__(MSG_COL_WIN_FIRSTCHILD)),
1059 Child, (IPTR)(info_win_firstchild_gad = (Object *)TextObject, TextFrame, End),
1060 Child, (IPTR)Label(__(MSG_COL_WIN_PARENT)),
1061 Child, (IPTR)(info_win_parent_gad = (Object *)TextObject, TextFrame, End),
1062 Child, (IPTR)Label(__(MSG_COL_WIN_DESCENDANT)),
1063 Child, (IPTR)(info_win_descendant_gad = (Object *)TextObject, TextFrame, End),
1064 End),
1065 End),
1066 End),
1067 End), // infownd
1068 End; // app
1070 if (! app)
1071 Cleanup(NULL); // Probably double start
1073 DoMethod(wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
1074 app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
1076 DoMethod(info_wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
1077 info_wnd, 3, MUIM_Set, MUIA_Window_Open, FALSE);
1079 DoMethod(list_gad, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
1080 (IPTR)app, 2, MUIM_CallHook, (IPTR)&updateinfo_hook);
1082 DoMethod(list_gad, MUIM_Notify, MUIA_Listview_DoubleClick, TRUE,
1083 (IPTR)app, 2, MUIM_CallHook, (IPTR)&openinfo_hook);
1086 // menu bar
1087 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_QUIT,
1088 (IPTR)app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
1090 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_ABOUT,
1091 (IPTR)app, 2, MUIM_CallHook, (IPTR)&about_hook);
1093 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_UPDATE,
1094 (IPTR)app, 2, MUIM_CallHook, (IPTR)&update_hook);
1096 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_KILL,
1097 (IPTR)app, 2, MUIM_CallHook, (IPTR)&close_hook);
1099 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_FRONT,
1100 (IPTR)app, 2, MUIM_CallHook, (IPTR)&front_hook);
1102 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_BACK,
1103 (IPTR)app, 2, MUIM_CallHook, (IPTR)&back_hook);
1105 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_ORIGIN,
1106 (IPTR)app, 2, MUIM_CallHook, (IPTR)&origin_hook);
1108 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_ACTIVATE,
1109 (IPTR)app, 2, MUIM_CallHook, (IPTR)&activate_hook);
1111 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_ZIP,
1112 (IPTR)app, 2, MUIM_CallHook, (IPTR)&zip_hook);
1114 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_HIDE,
1115 (IPTR)app, 2, MUIM_CallHook, (IPTR)&hide_hook);
1117 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_SHOW,
1118 (IPTR)app, 2, MUIM_CallHook, (IPTR)&show_hook);
1120 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_INFO,
1121 (IPTR)app, 2, MUIM_CallHook, (IPTR)&openinfo_hook);
1123 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_RESCUE,
1124 (IPTR)app, 2, MUIM_CallHook, (IPTR)&rescue_hook);
1126 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_SHOWALL,
1127 (IPTR)app, 2, MUIM_CallHook, (IPTR)&showall_hook);
1129 DoMethod(app, MUIM_Notify, MUIA_Application_MenuAction, MN_RETHINK,
1130 (IPTR)app, 2, MUIM_CallHook, (IPTR)&rethink_hook);
1133 // buttons first row
1134 DoMethod(close_gad, MUIM_Notify, MUIA_Pressed, FALSE,
1135 (IPTR)app, 2, MUIM_CallHook, (IPTR)&close_hook);
1137 DoMethod(front_gad, MUIM_Notify, MUIA_Pressed, FALSE,
1138 (IPTR)app, 2, MUIM_CallHook, (IPTR)&front_hook);
1140 DoMethod(back_gad, MUIM_Notify, MUIA_Pressed, FALSE,
1141 (IPTR)app, 2, MUIM_CallHook, (IPTR)&back_hook);
1143 DoMethod(origin_gad, MUIM_Notify, MUIA_Pressed, FALSE,
1144 (IPTR)app, 2, MUIM_CallHook, (IPTR)&origin_hook);
1146 DoMethod(activate_gad, MUIM_Notify, MUIA_Pressed, FALSE,
1147 (IPTR)app, 2, MUIM_CallHook, (IPTR)&activate_hook);
1149 DoMethod(zip_gad, MUIM_Notify, MUIA_Pressed, FALSE,
1150 (IPTR)app, 2, MUIM_CallHook, (IPTR)&zip_hook);
1152 DoMethod(hide_gad, MUIM_Notify, MUIA_Pressed, FALSE,
1153 (IPTR)app, 2, MUIM_CallHook, (IPTR)&hide_hook);
1155 DoMethod(show_gad, MUIM_Notify, MUIA_Pressed, FALSE,
1156 (IPTR)app, 2, MUIM_CallHook, (IPTR)&show_hook);
1159 // buttons second row
1160 DoMethod(update_gad, MUIM_Notify, MUIA_Pressed, FALSE,
1161 (IPTR)app, 2, MUIM_CallHook, (IPTR)&update_hook);
1163 DoMethod(rescue_gad, MUIM_Notify, MUIA_Pressed, FALSE,
1164 (IPTR)app, 2, MUIM_CallHook, (IPTR)&rescue_hook);
1166 DoMethod(showall_gad, MUIM_Notify, MUIA_Pressed, FALSE,
1167 (IPTR)app, 2, MUIM_CallHook, (IPTR)&showall_hook);
1169 DoMethod(rethink_gad, MUIM_Notify, MUIA_Pressed, FALSE,
1170 (IPTR)app, 2, MUIM_CallHook, (IPTR)&rethink_hook);
1172 DoMethod(about_gad, MUIM_Notify, MUIA_Pressed, FALSE,
1173 (IPTR)app, 2, MUIM_CallHook, (IPTR)&about_hook);
1175 set(wnd, MUIA_Window_Open, TRUE);
1176 CallHookPkt(&update_hook, 0, 0);
1177 CallHookPkt(&updateinfo_hook, 0, 0);
1178 DoMethod(app, MUIM_Application_Execute);
1181 /*********************************************************************************************/
1183 static void Cleanup(CONST_STRPTR txt)
1185 MUI_DisposeObject(app);
1186 if (txt)
1188 MUI_Request(app, wnd, 0, TITLE_TXT, "OK", txt);
1189 exit(RETURN_ERROR);
1191 Locale_Deinitialize();
1192 exit(RETURN_OK);
1195 /*********************************************************************************************/
1197 int main(int argc, char **argv)
1199 Locale_Initialize();
1200 MakeGUI();
1201 Cleanup(NULL);
1202 return RETURN_OK;