Experiment:
[AROS-Contrib.git] / bgui / Prefs / BGUIPrefs.c
blob0d955fbe293d52e4d0edb0747fd6a72bdf9f2fbc
1 /*
2 * @(#) $Header$
4 * BGUI Prefs Editor
5 * BGUIPrefs.c
7 * (C) Copyright 1998 Manuel Lemos.
8 * (C) Copyright 1996-1997 Respect Software
9 * (C) Copyright 1996-1997 Ian J. Einman.
10 * All Rights Reserved.
12 * $Log$
13 * Revision 42.2 2003/01/18 19:10:07 chodorowski
14 * Instead of using the _AROS or __AROS preprocessor symbols, use __AROS__.
16 * Revision 42.1 2000/07/09 18:06:21 bergers
17 * Made the Preferences tool compilable for AROS. This one has an MMakefile!
19 * Revision 42.0 2000/05/09 22:16:54 mlemos
20 * Bumped to revision 42.0 before handing BGUI to AROS team
22 * Revision 41.11 2000/05/09 20:29:45 mlemos
23 * Bumped to revision 41.11
25 * Revision 1.2 2000/05/09 19:56:46 mlemos
26 * Merged with the branch Manuel_Lemos_fixes.
28 * Revision 1.1.2.4 1999/08/30 05:02:19 mlemos
29 * Updated the copyright and the version information.
31 * Revision 1.1.2.3 1999/08/29 20:42:43 mlemos
32 * Removed window opening and disposing timing code.
34 * Revision 1.1.2.2 1999/08/29 17:11:07 mlemos
35 * Made the preferences and example pages be created and added on demand.
37 * Revision 1.1.2.1 1998/09/20 17:28:35 mlemos
38 * Peter Bornhall sources.
44 #ifdef __AROS__
45 extern struct Library * BGUIBase;
46 #endif
49 // INCLUDES
51 #include "BGUIPrefs_rev.h"
52 #include "BGUIPrefs.h"
53 #include "BGUIPrefs_gui.c"
54 #include "BGUIPrefs_iff.c"
58 // CONSTANTS
60 const static char VersTag[] = VERSTAG,
61 PrefDir[] = "SYS:Prefs/Presets";
63 const static UBYTE Cycle2Frame[] = {
64 FRTYPE_BUTTON,
65 FRTYPE_FUZZ_BUTTON,
66 FRTYPE_XEN_BUTTON,
67 FRTYPE_RIDGE,
68 FRTYPE_FUZZ_RIDGE,
69 FRTYPE_DROPBOX,
70 FRTYPE_NEXT,
71 FRTYPE_NONE,
76 // EXTERNAL
78 extern Object **ar;
79 extern Object *BGUIPrefsObjs[ BGP_NUMGADS ];
81 extern Object *InitBGUIPrefs( ULONG page);
82 extern void SaveBGUIPrefs( char *dirname, char *name );
83 //extern Object *FrameFrom( Object *o );
87 // LOCAL GLOBAL
89 struct Library *BGUIBase;
90 struct Window *window = NULL;
92 struct NewMenu Menus[] = {
93 { NM_TITLE, "Project", NULL, 0, 0, NULL },
94 { NM_ITEM, "Open...", "O", 0, 0, (APTR)MNU_OPEN },
95 { NM_ITEM, "Save As...", "A", 0, 0, (APTR)MNU_SAVEAS },
96 { NM_ITEM, NM_BARLABEL, NULL, 0, 0, NULL },
97 { NM_ITEM, "About...", "?", 0, 0, (APTR)MNU_ABOUT },
98 { NM_ITEM, NM_BARLABEL, NULL, 0, 0, NULL },
99 { NM_ITEM, "Quit", "Q", 0, 0, (APTR)MNU_QUIT },
100 { NM_TITLE, "Edit", NULL, 0, 0, NULL },
101 { NM_ITEM, "Reset To Defaults", "D", 0, 0, (APTR)MNU_DEFAULTS },
102 { NM_ITEM, "Last Saved", "L", 0, 0, (APTR)MNU_LASTSAVED },
103 { NM_ITEM, "Restore", "R", 0, 0, (APTR)MNU_RESTORE },
104 { NM_TITLE, "Presets", NULL, 0, 0, NULL },
105 { NM_ITEM, "Normal", "N", 0, 0, (APTR)MNU_PRE_NORM },
106 { NM_ITEM, "Fuzzy", "F", 0, 0, (APTR)MNU_PRE_FUZZ },
107 { NM_ITEM, "XEN", "X", 0, 0, (APTR)MNU_PRE_XEN },
108 { NM_END, NULL, NULL, 0, 0, NULL }
112 ULONG prf_drawer, // = NULL,
113 prf_file; // = NULL;
115 // Spacing control
117 ULONG VSpNar1[] = { STRINGA_LongVal, SLIDER_Level, TAG_END },
118 VSpNar2[] = { SLIDER_Level, STRINGA_LongVal, TAG_END },
119 HSpNar1[] = { STRINGA_LongVal, SLIDER_Level, TAG_END },
120 HSpNar2[] = { SLIDER_Level, STRINGA_LongVal, TAG_END },
121 VSpNor1[] = { STRINGA_LongVal, SLIDER_Level, TAG_END },
122 VSpNor2[] = { SLIDER_Level, STRINGA_LongVal, TAG_END },
123 HSpNor1[] = { STRINGA_LongVal, SLIDER_Level, TAG_END },
124 HSpNor2[] = { SLIDER_Level, STRINGA_LongVal, TAG_END },
125 VSpWid1[] = { STRINGA_LongVal, SLIDER_Level, TAG_END },
126 VSpWid2[] = { SLIDER_Level, STRINGA_LongVal, TAG_END },
127 HSpWid1[] = { STRINGA_LongVal, SLIDER_Level, TAG_END },
128 HSpWid2[] = { SLIDER_Level, STRINGA_LongVal, TAG_END };
132 ** SetGadgets2( void )
134 ** Update the gadgets of the user interface to
135 ** reflect the current settings.
137 void
138 SetGadgets2( void )
140 ULONG frame = 0;
142 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_VNOR_STR ], window, NULL, STRINGA_LongVal, grp_vspnormal, TAG_DONE);
143 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_HNOR_STR ], window, NULL, STRINGA_LongVal, grp_hspnormal, TAG_DONE);
145 // GROUP PAGE [1997-02-17]
146 frame = Frame2Cycle( grp_frmtype );
147 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_GRP_FRMTYPE ], window, NULL, CYC_Active, frame, TAG_DONE);
148 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_GRP_SAMPLE ], window, NULL, FRM_Recessed, grp_recessed, TAG_DONE);
149 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_GRP_SAMPLE ], window, NULL, FRM_Type, grp_frmtype, TAG_DONE);
150 if( grp_frmtype == FRTYPE_NONE )
151 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_GRP_RECESSED ], window, NULL, GA_Selected, 0, TAG_DONE);
152 else
153 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_GRP_RECESSED ], window, NULL, GA_Selected, grp_recessed, TAG_DONE);
157 ULONG
158 GetFilename( int mode )
160 Object *filereq;
161 ULONG pf = NULL;
163 if( !prf_drawer )
164 prf_drawer = ( ULONG )&PrefDir;
166 if( !mode ) {
167 filereq = FileReqObject,
168 ASLFR_TitleText, "Load BGUI Preferences",
169 FRQ_Drawer, prf_drawer,
170 FRQ_File, prf_file,
171 EndObject;
172 } else {
173 filereq = FileReqObject,
174 ASLFR_DoSaveMode, TRUE,
175 ASLFR_TitleText, "Save BGUI Preferences",
176 FRQ_Drawer, prf_drawer,
177 FRQ_File, prf_file,
178 EndObject;
181 if( filereq ) {
183 if( !DoRequest( filereq ) ) {
185 GetAttr( FRQ_Path, filereq, &pf );
186 GetAttr( FRQ_File, filereq, &prf_file );
187 GetAttr( FRQ_Drawer, filereq, &prf_drawer );
191 return pf;
195 #ifdef __AROS__
197 struct IntuitionBase * IntuitionBase;
198 struct UtilityBase * UtilityBase;
199 struct Library * IFFParseBase;
201 BOOL openlibs(void)
203 IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0);
204 UtilityBase = (struct UtilityBase *)OpenLibrary("utility.library",0);
205 IFFParseBase = OpenLibrary("iffparse.library",0);
207 if(IntuitionBase && UtilityBase && IFFParseBase)
208 return TRUE;
210 return FALSE;
213 void closelibs(void)
215 if (IntuitionBase) CloseLibrary((struct Library *)IntuitionBase);
216 if (UtilityBase) CloseLibrary((struct Library *)UtilityBase);
217 if (IFFParseBase) CloseLibrary((struct Library *)IFFParseBase);
220 #endif
223 ** int = main( int, char ** )
225 ** Main program starts and ends here.
227 int main( int count, char **args )
230 struct bguiRequest AboutRequest = { NULL };
231 Object *WO_Window;
232 ULONG rc,
234 signal = 0,
235 frame = 0;
236 BOOL running = TRUE;
238 #ifdef __AROS__
239 if (FALSE == openlibs())
241 closelibs();
242 printf("Failed to open lib!\n");
243 return -1;
245 #endif
247 // Open the library, at least version 41 required.
248 if( BGUIBase = OpenLibrary( "bgui.library", 41 )) {
250 // Get the default settings.
251 GetDefaults();
253 // Create the window object.
254 if( WO_Window = InitBGUIPrefs(INITIAL_PAGE) ) {
256 // Open the window.
257 if( window = WindowOpen( WO_Window ) ) {
259 // Get a signal for our window.
260 GetAttr( WINDOW_SigMask, WO_Window, &signal );
262 // Main event loop.
263 do {
265 // Wait for a signal.
266 Wait( signal );
268 // Process all events.
269 while( ( rc = HandleEvent( WO_Window ) ) != WMHI_NOMORE ) {
271 // What happened?
272 switch( rc ) {
274 // Save and use settings and exit.
275 case BGP_SAVE:
277 // Use settings and exit.
278 case BGP_USE:
279 if( BGP_SAVE == rc )
280 SaveBGUIPrefs( "ENVARC:BGUI", "Default.prefs" );
281 SaveBGUIPrefs( "ENV:BGUI", "Default.prefs" );
282 running = FALSE;
283 break;
285 case MNU_DEFAULTS:
286 BGUI_DefaultPrefs();
287 GetDefaults();
288 SetGadgets2();
289 break;
291 // Save settings as
292 case MNU_OPEN:
293 pf = GetFilename( 0 );
294 if( pf ) {
295 BGUI_LoadPrefs( ( UBYTE * )pf );
296 GetDefaults();
297 //grp_defaults = BGUI_GetDefaultTags( BGUI_GROUP_GADGET );
298 //grp_vspnormal = GetTagData( GROUP_DefVSpaceNormal, grp_vspnormal, grp_defaults );
299 //grp_hspnormal = GetTagData( GROUP_DefHSpaceNormal, grp_hspnormal, grp_defaults );
300 //SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_VNOR_STR ], window, NULL, STRINGA_LongVal, grp_vspnormal, TAG_DONE);
301 //SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_HNOR_STR ], window, NULL, STRINGA_LongVal, grp_hspnormal, TAG_DONE);
302 SetGadgets2();
304 break;
306 // Save settings as
307 case MNU_SAVEAS:
308 pf = GetFilename( 1 );
309 if( pf )
310 SaveBGUIPrefs( ( char * )prf_drawer, ( char * )prf_file );
311 break;
313 // We need to quit, right now.
314 case MNU_QUIT:
315 case BGP_CANCEL:
316 running = FALSE;
317 break;
319 // User is searching for knowledge.
320 case MNU_ABOUT:
321 if( !AboutRequest.br_Title ) {
322 AboutRequest.br_Title = "About " PRGNAME;
323 AboutRequest.br_GadgetFormat = "*_OK";
324 AboutRequest.br_Underscore = '_';
325 AboutRequest.br_TextFormat = ISEQ_C ISEQ_B VSTR ISEQ_N "\n----\nCopyright ©" _COPYRIGHTYEARS_ ", BGUI Developers Team\nAll rights reserved.";
326 AboutRequest.br_Flags = BREQF_AUTO_ASPECT|BREQF_FAST_KEYS|BREQF_LOCKWINDOW;
327 AboutRequest.br_ReqPos = POS_CENTERSCREEN;
329 BGUI_RequestA( window, &AboutRequest, NULL );
330 break;
333 // Handle page switching.
334 case BGP_LISTVIEW1:
335 GetAttr( LISTV_LastClickedNum, ar[ BGP_LISTVIEW1 ], &frame );
336 SetNewPage(window,frame);
337 break;
339 // SPACING PAGE
340 case BGP_SPC_HNAR_STR:
341 GetAttr( STRINGA_LongVal, ar[ BGP_SPC_HNAR_STR ], &grp_hspnarrow );
342 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_HNAR_SLI ], window, NULL, SLIDER_Level, grp_hspnarrow, TAG_DONE);
343 break;
344 case BGP_SPC_HNAR_SLI:
345 GetAttr( SLIDER_Level, ar[ BGP_SPC_HNAR_SLI ], &grp_hspnarrow );
346 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_HNAR_STR ], window, NULL, STRINGA_LongVal, grp_hspnarrow, TAG_DONE);
347 break;
348 case BGP_SPC_VNAR_STR:
349 GetAttr( STRINGA_LongVal, ar[ BGP_SPC_VNAR_STR ], &grp_vspnarrow );
350 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_VNAR_SLI ], window, NULL, SLIDER_Level, grp_vspnarrow, TAG_DONE);
351 break;
352 case BGP_SPC_VNAR_SLI:
353 GetAttr( SLIDER_Level, ar[ BGP_SPC_VNAR_SLI ], &grp_vspnarrow );
354 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_VNAR_STR ], window, NULL, STRINGA_LongVal, grp_vspnarrow, TAG_DONE);
355 break;
356 case BGP_SPC_HNOR_STR:
357 GetAttr( STRINGA_LongVal, ar[ BGP_SPC_HNOR_STR ], &grp_hspnormal );
358 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_HNOR_SLI ], window, NULL, SLIDER_Level, grp_hspnormal, TAG_DONE);
359 break;
360 case BGP_SPC_HNOR_SLI:
361 GetAttr( SLIDER_Level, ar[ BGP_SPC_HNOR_SLI ], &grp_hspnormal );
362 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_HNOR_STR ], window, NULL, STRINGA_LongVal, grp_hspnormal, TAG_DONE);
363 break;
364 case BGP_SPC_VNOR_STR:
365 GetAttr( STRINGA_LongVal, ar[ BGP_SPC_VNOR_STR ], &grp_vspnormal );
366 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_VNOR_SLI ], window, NULL, SLIDER_Level, grp_vspnormal, TAG_DONE);
367 break;
368 case BGP_SPC_VNOR_SLI:
369 GetAttr( SLIDER_Level, ar[ BGP_SPC_VNOR_SLI ], &grp_vspnormal );
370 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_VNOR_STR ], window, NULL, STRINGA_LongVal, grp_vspnormal, TAG_DONE);
371 break;
372 case BGP_SPC_HWID_STR:
373 GetAttr( STRINGA_LongVal, ar[ BGP_SPC_HWID_STR ], &grp_hspwide );
374 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_HWID_SLI ], window, NULL, SLIDER_Level, grp_hspwide, TAG_DONE);
375 break;
376 case BGP_SPC_HWID_SLI:
377 GetAttr( SLIDER_Level, ar[ BGP_SPC_HWID_SLI ], &grp_hspwide );
378 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_HWID_STR ], window, NULL, STRINGA_LongVal, grp_hspwide, TAG_DONE);
379 break;
380 case BGP_SPC_VWID_STR:
381 GetAttr( STRINGA_LongVal, ar[ BGP_SPC_VWID_STR ], &grp_vspwide );
382 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_VWID_SLI ], window, NULL, SLIDER_Level, grp_vspwide, TAG_DONE);
383 break;
384 case BGP_SPC_VWID_SLI:
385 GetAttr( SLIDER_Level, ar[ BGP_SPC_VWID_SLI ], &grp_vspwide );
386 SetGadgetAttrs( ( struct Gadget * )ar[ BGP_SPC_VWID_STR ], window, NULL, STRINGA_LongVal, grp_vspwide, TAG_DONE);
387 break;
389 case BGP_SPC_VNAR_STR:
390 case BGP_SPC_VNAR_SLI:
391 GetAttr( STRINGA_LongVal, ar[ BGP_SPC_VNAR_STR ], &grp_vspnarrow );
392 break;
393 case BGP_SPC_HNOR_STR:
394 case BGP_SPC_HNOR_SLI:
395 GetAttr( STRINGA_LongVal, ar[ BGP_SPC_HNOR_STR ], &grp_hspnormal );
396 break;
397 case BGP_SPC_VNOR_STR:
398 case BGP_SPC_VNOR_SLI:
399 GetAttr( STRINGA_LongVal, ar[ BGP_SPC_VNOR_STR ], &grp_vspnormal );
400 break;
401 case BGP_SPC_HWID_STR:
402 case BGP_SPC_HWID_SLI:
403 GetAttr( STRINGA_LongVal, ar[ BGP_SPC_HWID_STR ], &grp_hspwide );
404 break;
405 case BGP_SPC_VWID_STR:
406 case BGP_SPC_VWID_SLI:
407 GetAttr( STRINGA_LongVal, ar[ BGP_SPC_VWID_STR ], &grp_vspwide );
408 break;
411 // GROUP PAGE
412 case BGP_GRP_RECESSED:
413 GetAttr( GA_Selected, ar[ BGP_GRP_RECESSED ], &grp_recessed );
414 SetGadgetAttrs((struct Gadget *)ar[ BGP_GRP_SAMPLE ], window, NULL, FRM_Recessed, grp_recessed, TAG_DONE);
415 break;
416 case BGP_GRP_FRMTYPE:
417 GetAttr( CYC_Active, ar[ BGP_GRP_FRMTYPE ], &frame );
418 grp_frmtype = Cycle2Frame[ frame ];
419 SetGadgetAttrs((struct Gadget *)ar[ BGP_GRP_SAMPLE ], window, NULL, FRM_Type, grp_frmtype, TAG_DONE);
420 if( grp_frmtype == FRTYPE_NONE )
421 SetGadgetAttrs((struct Gadget *)ar[ BGP_GRP_RECESSED ], window, NULL, GA_Selected, 0, TAG_DONE);
422 else
423 SetGadgetAttrs((struct Gadget *)ar[ BGP_GRP_RECESSED ], window, NULL, GA_Selected, grp_recessed, TAG_DONE);
424 break;
426 // BUTTON PAGE
427 case BGP_BUT_RECESSED:
428 GetAttr( GA_Selected, ar[ BGP_BUT_RECESSED ], &but_recessed );
429 SetGadgetAttrs((struct Gadget *)ar[ BGP_BUT_SAMPLE ], window, NULL, FRM_Recessed, but_recessed, TAG_DONE);
430 break;
431 case BGP_BUT_FRMTYPE:
432 GetAttr( CYC_Active, ar[ BGP_BUT_FRMTYPE ], &frame );
433 but_frmtype = Cycle2Frame[ frame ];
434 SetGadgetAttrs((struct Gadget *)ar[ BGP_BUT_SAMPLE ], window, NULL, FRM_Type, but_frmtype, TAG_DONE);
435 if( but_frmtype == FRTYPE_NONE )
436 SetGadgetAttrs((struct Gadget *)ar[ BGP_BUT_RECESSED ], window, NULL, GA_Selected, 0, TAG_DONE);
437 else
438 SetGadgetAttrs((struct Gadget *)ar[ BGP_BUT_RECESSED ], window, NULL, GA_Selected, but_recessed, TAG_DONE);
439 break;
441 // STRING PAGE
442 case BGP_STR_RECESSED:
443 GetAttr( GA_Selected, ar[ BGP_STR_RECESSED ], &str_recessed );
444 SetGadgetAttrs((struct Gadget *)ar[ BGP_STR_SAMPLE ], window, NULL, FRM_Recessed, str_recessed, TAG_DONE);
445 break;
446 case BGP_STR_FRMTYPE:
447 GetAttr( CYC_Active, ar[ BGP_STR_FRMTYPE ], &frame );
448 str_frmtype = Cycle2Frame[ frame ];
449 SetGadgetAttrs((struct Gadget *)ar[ BGP_STR_SAMPLE ], window, NULL, FRM_Type, str_frmtype, TAG_DONE);
450 if( str_frmtype == FRTYPE_NONE )
451 SetGadgetAttrs((struct Gadget *)ar[ BGP_STR_RECESSED ], window, NULL, GA_Selected, 0, TAG_DONE);
452 else
453 SetGadgetAttrs((struct Gadget *)ar[ BGP_STR_RECESSED ], window, NULL, GA_Selected, str_recessed, TAG_DONE);
454 break;
456 // CHECKBOX PAGE
457 case BGP_CHK_RECESSED:
458 GetAttr( GA_Selected, ar[ BGP_CHK_RECESSED ], &chk_recessed );
459 SetGadgetAttrs((struct Gadget *)ar[ BGP_CHK_SAMPLE ], window, NULL, FRM_Recessed, chk_recessed, TAG_DONE);
460 break;
461 case BGP_CHK_FRMTYPE:
462 GetAttr( CYC_Active, ar[ BGP_CHK_FRMTYPE ], &frame );
463 chk_frmtype = Cycle2Frame[ frame ];
464 SetGadgetAttrs((struct Gadget *)ar[ BGP_CHK_SAMPLE ], window, NULL, FRM_Type, chk_frmtype, TAG_DONE);
465 if( chk_frmtype == FRTYPE_NONE )
466 SetGadgetAttrs((struct Gadget *)ar[ BGP_CHK_RECESSED ], window, NULL, GA_Selected, 0, TAG_DONE);
467 else
468 SetGadgetAttrs((struct Gadget *)ar[ BGP_CHK_RECESSED ], window, NULL, GA_Selected, chk_recessed, TAG_DONE);
469 break;
471 // CYCLE PAGE
472 case BGP_CYC_RECESSED:
473 GetAttr( GA_Selected, ar[ BGP_CYC_RECESSED ], &cyc_recessed );
474 SetGadgetAttrs((struct Gadget *)ar[ BGP_CYC_SAMPLE ], window, NULL, FRM_Recessed, cyc_recessed, TAG_DONE);
475 break;
476 case BGP_CYC_FRMTYPE:
477 GetAttr( CYC_Active, ar[ BGP_CYC_FRMTYPE ], &frame );
478 cyc_frmtype = Cycle2Frame[ frame ];
479 SetGadgetAttrs((struct Gadget *)ar[ BGP_CYC_SAMPLE ], window, NULL, FRM_Type, cyc_frmtype, TAG_DONE);
480 if( cyc_frmtype == FRTYPE_NONE )
481 SetGadgetAttrs((struct Gadget *)ar[ BGP_CYC_RECESSED ], window, NULL, GA_Selected, 0, TAG_DONE);
482 else
483 SetGadgetAttrs((struct Gadget *)ar[ BGP_CYC_RECESSED ], window, NULL, GA_Selected, cyc_recessed, TAG_DONE);
484 break;
485 case BGP_CYC_POPUP:
486 GetAttr( GA_Selected, ar[ BGP_CYC_POPUP ], &cyc_popup );
487 SetGadgetAttrs((struct Gadget *)ar[ BGP_CYC_SAMPLE ], window, NULL, CYC_Popup, cyc_popup, TAG_DONE);
488 if( 0 == cyc_popup )
489 SetGadgetAttrs((struct Gadget *)ar[ BGP_CYC_POPACTIVE ], window, NULL, GA_Selected, 0, TAG_DONE);
490 else
491 SetGadgetAttrs((struct Gadget *)ar[ BGP_CYC_POPACTIVE ], window, NULL, GA_Selected, cyc_popactive, TAG_DONE);
492 break;
493 case BGP_CYC_POPACTIVE:
494 GetAttr( GA_Selected, ar[ BGP_CYC_POPACTIVE ], &cyc_popactive );
495 SetGadgetAttrs((struct Gadget *)ar[ BGP_CYC_SAMPLE ], window, NULL, CYC_PopActive, cyc_popactive, TAG_DONE);
496 break;
498 // INFO PAGE
499 case BGP_INF_RECESSED:
500 GetAttr( GA_Selected, ar[ BGP_INF_RECESSED ], &inf_recessed );
501 SetGadgetAttrs((struct Gadget *)ar[ BGP_INF_SAMPLE ], window, NULL, FRM_Recessed, inf_recessed, TAG_DONE);
502 break;
503 case BGP_INF_FRMTYPE:
504 GetAttr( CYC_Active, ar[ BGP_INF_FRMTYPE ], &frame );
505 inf_frmtype = Cycle2Frame[ frame ];
506 SetGadgetAttrs((struct Gadget *)ar[ BGP_INF_SAMPLE ], window, NULL, FRM_Type, inf_frmtype, TAG_DONE);
507 if( inf_frmtype == FRTYPE_NONE )
508 SetGadgetAttrs((struct Gadget *)ar[ BGP_INF_RECESSED ], window, NULL, GA_Selected, 0, TAG_DONE);
509 else
510 SetGadgetAttrs((struct Gadget *)ar[ BGP_INF_RECESSED ], window, NULL, GA_Selected, inf_recessed, TAG_DONE);
511 break;
513 // PROGRESS PAGE
514 case BGP_PRG_RECESSED:
515 GetAttr( GA_Selected, ar[ BGP_PRG_RECESSED ], &prg_recessed );
516 SetGadgetAttrs((struct Gadget *)ar[ BGP_PRG_SAMPLE ], window, NULL, FRM_Recessed, prg_recessed, TAG_DONE);
517 break;
518 case BGP_PRG_FRMTYPE:
519 GetAttr( CYC_Active, ar[ BGP_PRG_FRMTYPE ], &frame );
520 prg_frmtype = Cycle2Frame[ frame ];
521 SetGadgetAttrs((struct Gadget *)ar[ BGP_PRG_SAMPLE ], window, NULL, FRM_Type, prg_frmtype, TAG_DONE);
522 if( prg_frmtype == FRTYPE_NONE )
523 SetGadgetAttrs((struct Gadget *)ar[ BGP_PRG_RECESSED ], window, NULL, GA_Selected, 0, TAG_DONE);
524 else
525 SetGadgetAttrs((struct Gadget *)ar[ BGP_PRG_RECESSED ], window, NULL, GA_Selected, prg_recessed, TAG_DONE);
526 break;
528 // INDICATOR PAGE
529 case BGP_IND_RECESSED:
530 GetAttr( GA_Selected, ar[ BGP_IND_RECESSED ], &ind_recessed );
531 SetGadgetAttrs((struct Gadget *)ar[ BGP_IND_SAMPLE ], window, NULL, FRM_Recessed, ind_recessed, TAG_DONE);
532 break;
533 case BGP_IND_FRMTYPE:
534 GetAttr( CYC_Active, ar[ BGP_IND_FRMTYPE ], &frame );
535 ind_frmtype = Cycle2Frame[ frame ];
536 SetGadgetAttrs((struct Gadget *)ar[ BGP_IND_SAMPLE ], window, NULL, FRM_Type, ind_frmtype, TAG_DONE);
537 if( ind_frmtype == FRTYPE_NONE )
538 SetGadgetAttrs((struct Gadget *)ar[ BGP_IND_RECESSED ], window, NULL, GA_Selected, 0, TAG_DONE);
539 else
540 SetGadgetAttrs((struct Gadget *)ar[ BGP_IND_RECESSED ], window, NULL, GA_Selected, ind_recessed, TAG_DONE);
541 break;
544 // SLIDER PAGE
545 case BGP_SLI_RECESSED:
546 GetAttr( GA_Selected, ar[ BGP_SLI_RECESSED ], &frame );
547 SetGadgetAttrs((struct Gadget *)ar[ BGP_SLI_SAMPLE ], window, NULL, FRM_Recessed, frame, TAG_DONE);
548 break;
549 case BGP_SLIFRAME:
550 GetAttr( CYC_Active, ar[ BGP_SLIFRAME ], &frame );
551 SetGadgetAttrs((struct Gadget *)ar[ BGP_SLI_SAMPLE ], window, NULL, FRM_Type, Cycle2Frame[ frame ], TAG_DONE);
552 if( Cycle2Frame[ frame ] == FRTYPE_NONE )
553 SetGadgetAttrs((struct Gadget *)ar[ BGP_SLI_RECESSED ], window, NULL, GA_Selected, 0, TAG_DONE);
554 else
555 SetGadgetAttrs((struct Gadget *)ar[ BGP_SLI_RECESSED ], window, NULL, GA_Selected, frame, TAG_DONE);
556 break;
557 case BGP_SLINLOOK:
558 GetAttr( GA_Selected, ar[ BGP_SLINLOOK ], &frame );
559 SetGadgetAttrs((struct Gadget *)ar[ BGP_SLI_SAMPLE ], window, NULL, PGA_NewLook, frame, TAG_DONE);
560 break;
567 } while( running );
571 // Dispose (automatically close) our window object.
572 DisposeObject( WO_Window );
576 // Close the library when we're done with it.
577 CloseLibrary( BGUIBase );
580 #ifdef __AROS__
581 closelibs();
582 #endif
584 // Return error code.
585 return( 0 );