2 Copyright 2002-2006, The AROS Development Team.
11 #include <exec/memory.h>
13 #include <libraries/asl.h>
14 #include <libraries/mui.h>
15 #include <prefs/prefhdr.h>
17 #include <clib/alib_protos.h>
18 #include <proto/exec.h>
19 #include <proto/dos.h>
20 #include <proto/intuition.h>
21 #include <proto/utility.h>
22 #include <proto/iffparse.h>
23 #include <proto/muimaster.h>
30 #include "scrollbarsp.h"
31 #include "listviewsp.h"
34 #include "navigationp.h"
36 #include "zunestuff.h"
38 /************************************************************************/
40 #ifndef MAXFILENAMELENGTH
41 #define MAXFILENAMELENGTH 255
44 /************************************************************************/
47 #define MCC_Query(x) AROS_LVO_CALL1(struct MUI_CustomClass *, \
48 AROS_LCA(LONG, (x), D0), \
49 struct Library *, mcclib, 5, lib)
54 struct MUI_CustomClass
*MCC_Query(ULONG d0
);
55 #pragma libcall mcclib MCC_Query 01e 001
59 #define ZUNEVERSION "$VER: Zune 0.2 (22.02.2006) AROS Dev Team"
63 struct TagItem prefstags
[] =
65 { ASLFR_DoPatterns
, (IPTR
)TRUE
},
66 { ASLFR_InitialPattern
, (IPTR
)"#?.prefs" },
70 /************************************************************************/
72 void load_prefs(CONST_STRPTR name
);
73 void save_prefs(CONST_STRPTR name
, BOOL envarc
);
74 void test_prefs(void);
75 void main_open_menu(void);
76 void main_saveas_menu(void);
77 void restore_prefs(CONST_STRPTR name
);
79 /************************************************************************/
82 struct Library
*ZuneMasterBase
;
83 struct ZuneMasterIFace
*IZuneMaster
;
87 /************************************************************************/
89 /****************************************************************
91 *****************************************************************/
95 if (!(ZuneMasterBase
= OpenLibrary("zunemaster.library",0)))
97 printf("Unable to open zunemaster.library\n");
101 if (!(IZuneMaster
= (struct ZuneMasterIFace
*)GetInterface(ZuneMasterBase
,"main",1,NULL
)))
103 printf("Unable to get main interface of zunemaster.library\n");
104 CloseLibrary(ZuneMasterBase
); ZuneMasterBase
= NULL
;
111 /****************************************************************
112 Close opened libraries
113 *****************************************************************/
114 void close_libs(void)
117 DropInterface((struct Interface
*)IZuneMaster
);
118 CloseLibrary(ZuneMasterBase
);
122 struct Hook hook_standard
;
125 static Object
*open_menuitem
;
126 static Object
*append_menuitem
;
127 static Object
*saveas_menuitem
;
128 static Object
*aboutzune_menuitem
;
129 static Object
*quit_menuitem
;
130 static Object
*LastSavedConfigdata
= NULL
;
131 static STRPTR appname
= NULL
;
133 static Object
*main_wnd
;
134 static Object
*main_page_list
;
135 static Object
*main_page_group
; /* contains the selelected group */
136 static Object
*main_page_group_displayed
; /* The current displayed group */
137 static Object
*main_page_space
; /* a space object */
139 void close_classes(void)
143 int open_classes(void)
160 struct MUI_CustomClass
*cl
; /* The class pointer, maybe NULL */
161 Object
*group
; /* The group which should be is displayed, maybe NULL */
162 const struct __MUIBuiltinClass
*desc
;
163 struct Library
*mcp_library
;
164 UBYTE mcp_namebuffer
[MAXFILENAMELENGTH
+ 1];
167 #define MAX_PAGE_ENTRIES 100
169 /* the name field is set in init_gui() */
170 struct page_entry main_page_entries
[MAX_PAGE_ENTRIES
+ 1] =
172 /* {"Info",NULL,NULL,NULL}, */
173 /* {"System",NULL,NULL,NULL}, */
174 { "", NULL
, NULL
, &_MUIP_Windows_desc
},
175 { "", NULL
, NULL
, &_MUIP_Groups_desc
},
176 { "", NULL
, NULL
, &_MUIP_Buttons_desc
},
177 { "", NULL
, NULL
, &_MUIP_Cycles_desc
},
178 { "", NULL
, NULL
, &_MUIP_Sliders_desc
},
179 { "", NULL
, NULL
, &_MUIP_Scrollbars_desc
},
180 { "", NULL
, NULL
, &_MUIP_Listviews_desc
},
181 { "", NULL
, NULL
, &_MUIP_Strings_desc
},
182 { "", NULL
, NULL
, &_MUIP_Navigation_desc
},
183 { "", NULL
, NULL
, &_MUIP_Special_desc
},
184 { "", NULL
, NULL
, &_MUIP_Frames_desc
},
185 { NULL
, NULL
, NULL
, NULL
},
188 struct MUI_CustomClass
*create_class(const struct __MUIBuiltinClass
*desc
)
190 return MUI_CreateCustomClass(NULL
,MUIC_Settingsgroup
,NULL
,desc
->datasize
,desc
->dispatcher
);
193 /****************************************************************
194 Our standard hook function, for easy call backs
195 *****************************************************************/
196 static void hook_func_standard(struct Hook
*h
, void *dummy
, ULONG
* funcptr
)
198 void (*func
) (ULONG
*) = (void (*)(ULONG
*)) (*funcptr
);
199 if (func
) func(funcptr
+ 1);
202 /****************************************************************
203 The display function for the page listview
204 *****************************************************************/
205 static void main_page_list_display(struct Hook
*h
, char **strings
, struct page_entry
*entry
)
209 strings
[0] = entry
->name
;
214 /****************************************************************
215 A new entry has been selected
216 *****************************************************************/
217 void main_page_active(void)
219 int new_active
= XGET(main_page_list
,MUIA_List_Active
);
222 if (new_active
== -1)
223 new_group
= main_page_space
;
226 new_group
= main_page_entries
[new_active
].group
;
228 new_group
= main_page_space
;
231 if (new_group
== main_page_group_displayed
)
234 DoMethod(main_page_group
, MUIM_Group_InitChange
);
235 DoMethod(main_page_group
, OM_REMMEMBER
, (IPTR
)main_page_group_displayed
);
236 DoMethod(main_page_group
, OM_ADDMEMBER
, (IPTR
)new_group
);
237 DoMethod(main_page_group
, MUIM_Group_ExitChange
);
238 main_page_group_displayed
= new_group
;
241 /****************************************************************
243 *****************************************************************/
244 void main_save_pressed(void)
246 save_prefs(appname
, TRUE
);
247 DoMethod(app
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
250 /****************************************************************
252 *****************************************************************/
253 void main_use_pressed(void)
255 save_prefs(appname
, FALSE
);
256 DoMethod(app
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
259 /****************************************************************
261 *****************************************************************/
262 void main_test_pressed(void)
267 /****************************************************************
269 *****************************************************************/
270 void main_cancel_pressed(void)
272 restore_prefs(appname
);
273 DoMethod(app
, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
276 /****************************************************************
279 TODO: Write for AmigaOS4
280 *****************************************************************/
284 static CONST_STRPTR
const searchpaths
[] =
287 "Classes/Zune/#?.(mcp|mcc)",
291 CONST_STRPTR
const *pathptr
;
292 struct DevProc
*dp
= NULL
;
293 struct page_entry
*pe
;
294 WORD num_page_entries
= 0;
297 for(pe
= main_page_entries
; pe
->name
; pe
++)
302 olddir
= CurrentDir(NULL
);
304 while((dp
= GetDeviceProc("LIBS:", dp
)))
306 CurrentDir(dp
->dvp_Lock
);
308 for(pathptr
= searchpaths
; *pathptr
; pathptr
++)
310 struct AnchorPath
*ap
;
313 ap
= (struct AnchorPath
*)AllocVec(sizeof(struct AnchorPath
) + 256, MEMF_CLEAR
);
318 for(match
= MatchFirst((STRPTR
)*pathptr
, ap
);
320 match
= MatchNext(ap
))
322 struct Library
*mcclib
;
324 if (num_page_entries
< MAX_PAGE_ENTRIES
)
326 if ((mcclib
= OpenLibrary(ap
->ap_Buf
, 0)))
328 struct MUI_CustomClass
*mcp
;
330 if ((mcp
= MCC_Query(1)))
335 pe
->mcp_library
= mcclib
;
338 pe
->mcp_namebuffer
[0] = 27;
339 pe
->mcp_namebuffer
[1] = '3';
340 strncpy(pe
->mcp_namebuffer
+ 2, mcp
->mcc_Class
->cl_ID
, sizeof(pe
->mcp_namebuffer
) - 3);
342 if ((sp
= strrchr(pe
->mcp_namebuffer
, '.')))
345 pe
->name
= pe
->mcp_namebuffer
;
350 } /* if ((mcp = MCC_Query(1))) */
352 if (mcclib
) CloseLibrary(mcclib
);
354 } /* if ((mcclib = OpenLibrary(ap->ap_Buf, 0))) */
356 } /* if (num_page_entries < MAX_PAGE_ENTRIES) */
358 } /* for(match = ... */
366 } /* for(pathptr = searchpaths; *pathptr; pathptr++) */
368 if (!dp
->dvp_Flags
& DVPF_ASSIGN
) break;
370 } /* while((dp = GetDeviceProc("LIBS:", dp))) */
378 /****************************************************************
379 Deallocates all gui resources
380 *****************************************************************/
381 void deinit_gui(void)
386 MUI_DisposeObject(app
);
388 for (i
= 0; main_page_entries
[i
].name
; i
++)
390 if ((main_page_entries
[i
].group
!= NULL
) &&
391 (main_page_entries
[i
].group
!= main_page_group_displayed
))
393 DisposeObject(main_page_entries
[i
].group
);
396 if (main_page_entries
[i
].mcp_library
)
398 main_page_entries
[i
].cl
= NULL
; /* Prevent MUI_DeleteCustomClass call below */
400 if ((main_page_entries
[i
].group
== NULL
) ||
401 (main_page_entries
[i
].group
!= main_page_group_displayed
))
403 /* Only close library if main_page_group_displayed is not this page,
404 because in that case the object got automatically killed through
405 MUI_DisposeObject(app) which also does the CloseLibrary()!! */
407 CloseLibrary(main_page_entries
[i
].mcp_library
);
408 main_page_entries
[i
].mcp_library
= NULL
;
412 main_page_entries
[i
].group
= NULL
;
414 if (main_page_entries
[i
].cl
!= NULL
)
416 MUI_DeleteCustomClass(main_page_entries
[i
].cl
);
417 main_page_entries
[i
].cl
= NULL
;
421 if (main_page_group_displayed
!= main_page_space
)
422 MUI_DisposeObject(main_page_space
);
425 /****************************************************************
426 Allocate resources for gui
427 *****************************************************************/
433 Object
*cancel_button
;
437 main_page_entries
[ 0].name
= (char *)_(MSG_DSC_WINDOWS
);
438 main_page_entries
[ 1].name
= (char *)_(MSG_DSC_GROUPS
);
439 main_page_entries
[ 2].name
= (char *)_(MSG_DSC_BUTTONS
);
440 main_page_entries
[ 3].name
= (char *)_(MSG_DSC_CYCLES
);
441 main_page_entries
[ 4].name
= (char *)_(MSG_DSC_SLIDERS
);
442 main_page_entries
[ 5].name
= (char *)_(MSG_DSC_SCROLLBARS
);
443 main_page_entries
[ 6].name
= (char *)_(MSG_DSC_LISTVIEWS
);
444 main_page_entries
[ 7].name
= (char *)_(MSG_DSC_STRINGS
);
445 main_page_entries
[ 8].name
= (char *)_(MSG_DSC_NAVIGATION
);
446 main_page_entries
[ 9].name
= (char *)_(MSG_DSC_SPECIAL
);
447 main_page_entries
[10].name
= (char *)_(MSG_DSC_FRAMES
);
449 static struct Hook page_display_hook
;
452 hook_standard
.h_Entry
= (HOOKFUNC
)hook_func_standard
;
453 page_display_hook
.h_Entry
= (HOOKFUNC
)main_page_list_display
;
455 hook_standard
.h_Entry
= HookEntry
;
456 hook_standard
.h_SubEntry
= (APTR
)hook_func_standard
;
457 page_display_hook
.h_Entry
= HookEntry
;
458 page_display_hook
.h_SubEntry
= (APTR
)main_page_list_display
;
461 if (!strcmp(appname
, "global"))
462 wintitle
= (STRPTR
) _(MSG_WINTITLE1
);
465 snprintf(titlebuf
, 255, _(MSG_WINTITLE2
), appname
);
469 app
= ApplicationObject
,
470 MUIA_Application_Title
, (IPTR
) "Zune",
471 MUIA_Application_Version
, (IPTR
) ZUNEVERSION
,
472 MUIA_Application_Copyright
, (IPTR
) " 2006, The AROS Development Team",
473 MUIA_Application_Description
, wintitle
,
474 MUIA_Application_Base
, "ZUNEPREF",
475 MUIA_Application_Menustrip
, MenuitemObject
,
476 MUIA_Family_Child
, MenuitemObject
,
477 MUIA_Menuitem_Title
, _(MSG_MEN_PROJECT
),
478 MUIA_Family_Child
, open_menuitem
= MenuitemObject
,
479 MUIA_Menuitem_Title
, _(MSG_MEN_OPEN
), MUIA_Menuitem_Shortcut
, _(MSG_MEN_OPEN_SC
),
481 MUIA_Family_Child
, append_menuitem
= MenuitemObject
, MUIA_Menuitem_Title
, _(MSG_MEN_APPEND
), End
,
482 MUIA_Family_Child
, saveas_menuitem
= MenuitemObject
,
483 MUIA_Menuitem_Title
, _(MSG_MEN_SAVEAS
), MUIA_Menuitem_Shortcut
, _(MSG_MEN_SAVEAS_SC
),
485 MUIA_Family_Child
, MenuitemObject
, MUIA_Menuitem_Title
, ~0, End
,
486 MUIA_Family_Child
, aboutzune_menuitem
= MenuitemObject
,
487 MUIA_Menuitem_Title
, _(MSG_MEN_ABOUT
), MUIA_Menuitem_Shortcut
, _(MSG_MEN_ABOUT_SC
),
489 MUIA_Family_Child
, MenuitemObject
, MUIA_Menuitem_Title
, ~0, End
,
490 MUIA_Family_Child
, quit_menuitem
= MenuitemObject
,
491 MUIA_Menuitem_Title
, _(MSG_MEN_QUIT
), MUIA_Menuitem_Shortcut
, _(MSG_MEN_QUIT_SC
),
495 SubWindow
, main_wnd
= WindowObject
,
496 MUIA_Window_Title
, (IPTR
)wintitle
,
497 MUIA_Window_Activate
, TRUE
,
498 MUIA_Window_CloseGadget
, FALSE
,
499 MUIA_Window_ID
, MAKE_ID('Z','W','I','N'),
501 WindowContents
, VGroup
,
502 MUIA_Group_VertSpacing
, 10,
505 Child
, ListviewObject
,
507 MUIA_Listview_List
, main_page_list
= ListObject
,
509 MUIA_List_AdjustWidth
, TRUE
,
510 MUIA_List_DisplayHook
, &page_display_hook
,
514 Child
, MUI_NewObject(MUIC_Popframe
,
516 MUIA_Window_Title
, (IPTR
) _(MSG_FRAME_CLIPBOARD
),
518 Child
, MUI_NewObject(MUIC_Popimage
,
520 MUIA_Imageadjust_Type
, MUIV_Imageadjust_Type_All
,
521 MUIA_Window_Title
, (IPTR
) _(MSG_IMAGE_CLIPBOARD
),
528 MUIA_Background
, MUII_PageBack
,
529 Child
, main_page_group
= VGroup
,
530 Child
, main_page_group_displayed
= main_page_space
= HVSpace
,
535 Child
, test_button
= MakeButton(_(MSG_GAD_TEST
)),
537 Child
, save_button
= MakeButton(_(MSG_GAD_SAVE
)),
538 Child
, use_button
= MakeButton(_(MSG_GAD_USE
)),
539 Child
, cancel_button
= MakeButton(_(MSG_GAD_CANCEL
)),
549 DoMethod(main_wnd
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
550 (IPTR
)app
, 3, MUIM_CallHook
, (IPTR
)&hook_standard
,
551 (IPTR
)main_cancel_pressed
);
552 DoMethod(cancel_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)app
, 3,
553 MUIM_CallHook
, (IPTR
)&hook_standard
, (IPTR
)main_cancel_pressed
);
554 DoMethod(save_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)app
, 3,
555 MUIM_CallHook
, (IPTR
)&hook_standard
, (IPTR
)main_save_pressed
);
556 DoMethod(use_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)app
, 3,
557 MUIM_CallHook
, (IPTR
)&hook_standard
, (IPTR
)main_use_pressed
);
558 DoMethod(test_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)app
, 6,
559 MUIM_Application_PushMethod
, (IPTR
)app
, 3, MUIM_CallHook
,
560 (IPTR
)&hook_standard
, (IPTR
)main_test_pressed
);
561 DoMethod(quit_menuitem
, MUIM_Notify
, MUIA_Menuitem_Trigger
,
562 MUIV_EveryTime
, (IPTR
)app
, 3, MUIM_CallHook
,
563 (IPTR
)&hook_standard
, (IPTR
)main_cancel_pressed
);
564 DoMethod(open_menuitem
, MUIM_Notify
, MUIA_Menuitem_Trigger
,
565 MUIV_EveryTime
, (IPTR
)app
, 3, MUIM_CallHook
,
566 (IPTR
)&hook_standard
, (IPTR
)main_open_menu
);
567 DoMethod(saveas_menuitem
, MUIM_Notify
, MUIA_Menuitem_Trigger
,
568 MUIV_EveryTime
, (IPTR
)app
, 3, MUIM_CallHook
,
569 (IPTR
)&hook_standard
, (IPTR
)main_saveas_menu
);
570 DoMethod(aboutzune_menuitem
, MUIM_Notify
, MUIA_Menuitem_Trigger
,
571 MUIV_EveryTime
, (IPTR
)app
, 2, MUIM_Application_AboutMUI
,
574 for (i
= 0; main_page_entries
[i
].name
!= NULL
; i
++)
576 struct page_entry
*p
= &main_page_entries
[i
];
578 if (!p
->cl
) p
->cl
= create_class(p
->desc
);
580 if (!(p
->cl
&& (p
->group
= NewObject(p
->cl
->mcc_Class
, NULL
, TAG_DONE
))))
586 DoMethod(main_page_list
, MUIM_List_InsertSingle
, (IPTR
)p
,
587 MUIV_List_Insert_Bottom
);
590 DoMethod(main_page_list
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
591 (IPTR
)app
, 3, MUIM_CallHook
, (IPTR
)&hook_standard
,
592 (IPTR
)main_page_active
);
594 /* Activate first entry */
595 set(main_page_list
,MUIA_List_Active
,0);
602 /****************************************************************
604 *****************************************************************/
605 void load_prefs(CONST_STRPTR name
)
609 configdata
= MUI_NewObject(MUIC_Configdata
,
610 MUIA_Configdata_ApplicationBase
, (IPTR
)name
,
612 if (configdata
!= NULL
)
616 /* D(bug("zune::load_prefs: created configdata %p\n", configdata)); */
617 LastSavedConfigdata
= configdata
;
619 /* Call MUIM_Settingsgroup_ConfigToGadgets for every group */
620 for (i
=0;main_page_entries
[i
].name
;i
++)
622 struct page_entry
*p
= &main_page_entries
[i
];
624 DoMethod(p
->group
, MUIM_Settingsgroup_ConfigToGadgets
,
628 /* D(bug("zune::save_prefs: disposed configdata %p\n", configdata)); */
632 /* write prefs to env: */
633 void test_prefs(void)
637 save_prefs(appname
, FALSE
);
639 cfg
= MUI_NewObject(MUIC_Configdata
, MUIA_Configdata_Application
, (IPTR
)app
, TAG_DONE
);
640 set(app
, MUIA_Application_Configdata
, (IPTR
)cfg
);
643 void restore_prefs(CONST_STRPTR name
)
647 snprintf(buf
, 255, "ENV:zune/%s.prefs", name
);
648 DoMethod(LastSavedConfigdata
, MUIM_Configdata_Save
, (IPTR
)buf
);
652 /****************************************************************
653 open given prefs file from menue
654 *****************************************************************/
656 void main_open_menu(void)
658 static char dirpart
[500]="ENVARC:Zune",filepart
[500],filename
[1000];
660 if (aslfilerequest ("Load a Zune Prefs File", (char *)&dirpart
, (char *)&filepart
, (char *)&filename
, prefstags
));
664 configdata
= MUI_NewObject(MUIC_Configdata
,
665 MUIA_Configdata_ApplicationBase
,appname
,
668 if (configdata
!= NULL
)
672 /* D(bug("zune::load_prefs: created configdata %p\n", configdata)); */
673 //LastSavedConfigdata = configdata;
674 DoMethod(configdata
, MUIM_Configdata_Load
,filename
);
676 /* Call MUIM_Settingsgroup_ConfigToGadgets for every group */
677 for (i
=0;main_page_entries
[i
].name
;i
++)
679 struct page_entry
*p
= &main_page_entries
[i
];
681 if (p
->group
) DoMethod(p
->group
, MUIM_Settingsgroup_ConfigToGadgets
, (IPTR
)configdata
);
684 /* activate prefs in test mode */
687 /* D(bug("zune::save_prefs: disposed configdata %p\n", configdata)); */
693 /****************************************************************
695 *****************************************************************/
696 void save_prefs(CONST_STRPTR name
, BOOL envarc
)
700 configdata
= MUI_NewObject(MUIC_Configdata
,
701 //MUIA_Configdata_ApplicationBase, name,
702 MUIA_Configdata_Application
,appaddr
,
704 if (configdata
!= NULL
)
709 /* D(bug("zune::save_prefs: created configdata %p\n", configdata)); */
711 /* Call MUIM_Settingsgroup_GadgetsToConfig for every group */
712 for (i
=0;main_page_entries
[i
].name
;i
++)
714 struct page_entry
*p
= &main_page_entries
[i
];
716 DoMethod(p
->group
, MUIM_Settingsgroup_GadgetsToConfig
,
722 snprintf(buf
, 255, "ENVARC:zune/%s.prefs", name
);
723 DoMethod(configdata
, MUIM_Configdata_Save
, (IPTR
)buf
);
725 snprintf(buf
, 255, "ENV:zune/%s.prefs", name
);
726 DoMethod(configdata
, MUIM_Configdata_Save
, (IPTR
)buf
);
728 MUI_DisposeObject(configdata
);
729 /* D(bug("zune::save_prefs: disposed configdata %p\n", configdata)); */
734 /****************************************************************
735 SaveAS the done prefs from menue
736 *****************************************************************/
738 void main_saveas_menu(void)
740 static char dirpart
[500]="ENVARC:Zune",filepart
[500],filename
[1000];
742 if (aslfilerequest("Save a Zune Prefs File", (char *)&dirpart
, (char *)&filepart
, (char *)&filename
, prefstags
));
746 configdata
= MUI_NewObject(MUIC_Configdata
,
747 MUIA_Configdata_ApplicationBase
, "dummyfile",
750 /* check for ".prefs" suffix in filename, add if not existing */
751 if ( !strstr( filename
, ".prefs") ) strcat(filename
, ".prefs");
753 if (configdata
!= NULL
)
757 /* D(bug("zune::save_prefs: created configdata %p\n", configdata)); */
759 /* Call MUIM_Settingsgroup_GadgetsToConfig for every group */
760 for (i
=0;main_page_entries
[i
].name
;i
++)
762 struct page_entry
*p
= &main_page_entries
[i
];
764 if (p
->group
) DoMethod(p
->group
, MUIM_Settingsgroup_GadgetsToConfig
, (IPTR
)configdata
);
767 DoMethod(configdata
, MUIM_Configdata_Save
, filename
);
769 MUI_DisposeObject(configdata
);
770 /* D(bug("zune::save_prefs: disposed configdata %p\n", configdata)); */
778 /****************************************************************
780 *****************************************************************/
785 while((LONG
) DoMethod(app
, MUIM_Application_NewInput
, (IPTR
)&sigs
)
786 != MUIV_Application_ReturnID_Quit
)
790 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
| SIGBREAKF_CTRL_D
);
791 if (sigs
& SIGBREAKF_CTRL_C
) break;
792 if (sigs
& SIGBREAKF_CTRL_D
) break;
797 /****************************************************************
799 *****************************************************************/
804 int retval
= RETURN_OK
;
805 struct RDArgs
*rda
= NULL
;
807 IPTR args
[] = { 0,0 };
808 enum { ARG_APPNAME
= 0,ARG_APPADDR
=1 };
814 rda
= ReadArgs("/A,/N", args
, NULL
);
815 appname
=(STRPTR
)args
[ARG_APPNAME
];
816 appaddr
=(APTR
)args
[ARG_APPADDR
];
817 if (appaddr
)appaddr
=*(appaddr
);
825 if (retval
== RETURN_OK
)
835 NewDir
= Lock("RAM:", SHARED_LOCK
);
837 OldDir
= CurrentDir(NewDir
);
840 load_prefs((STRPTR
)args
[ARG_APPNAME
]);
841 set(main_wnd
, MUIA_Window_Open
, TRUE
);
842 if (XGET(main_wnd
,MUIA_Window_Open
))
846 if (LastSavedConfigdata
)
847 MUI_DisposeObject(LastSavedConfigdata
);
860 if (rda
) FreeArgs(rda
);
862 Locale_Deinitialize();