1 #include <libraries/gadtools.h>
2 #include <libraries/reqtools.h>
4 #include <proto/exec.h>
5 #include <proto/intuition.h>
6 #include <proto/locale.h>
7 #include <proto/reqtools.h>
11 #include <libraries/locale.h>
12 extern struct ReqToolsBase
*ReqToolsBase
;
15 extern struct Window
*WindowPtr
;
16 extern struct Hook IntuiHook
;
19 struct LocaleBase
*LocaleBase
;
20 #define LOCALECAST (struct LocaleBase *)
22 struct Library
*LocaleBase
;
25 struct Catalog
*Catalog
;
31 if( ( LocaleBase
= LOCALECAST
OpenLibrary( "locale.library", 0 ) ) )
33 Catalog
= OpenCatalogA( NULL
, "System/Prefs/ReqTools.catalog", NULL
);
43 CloseCatalog( Catalog
);
44 CloseLibrary( (struct Library
*)LocaleBase
);
50 GetString( STRPTR idstr
)
58 return( ( STRPTR
) GetCatalogStr( Catalog
, ( ( UBYTE
) idstr
[ 0 ] << 8 ) | idstr
[ 1 ], local
) );
65 LocalizeMenus( struct NewMenu
*nm
)
69 while( nm
->nm_Type
!= NM_END
)
71 if( nm
->nm_Label
&& ( nm
->nm_Label
!= NM_BARLABEL
) )
73 local
= GetString( nm
->nm_Label
);
75 if( nm
->nm_Type
!= NM_TITLE
)
79 nm
->nm_CommKey
= local
;
94 LocalizeLabels( STRPTR
*labels
)
100 local
= GetString( *labels
);
107 static struct EasyStruct EZ
;
111 EasyReq( STRPTR str
, STRPTR gadtxt
, APTR args
)
115 struct TagItem tags
[] =
117 {RT_Window
, (IPTR
)WindowPtr
},
118 {RT_LockWindow
, WindowPtr
!= NULL
},
119 {RT_ShareIDCMP
, WindowPtr
!= NULL
},
120 {RT_IntuiMsgFunc
, (IPTR
)&IntuiHook
},
125 return( rtEZRequestA( str
, gadtxt
, NULL
, args
, tags
) );
128 EZ
.es_StructSize
= sizeof( struct EasyStruct
);
129 EZ
.es_Title
= GetString( MSG_INFORMATION
);
130 EZ
.es_TextFormat
= str
;
131 EZ
.es_GadgetFormat
= gadtxt
;
133 return( ( ULONG
) EasyRequestArgs( NULL
, &EZ
, NULL
, args
) );
138 LocEZReq( STRPTR str
, STRPTR gadtxt
, ... )
140 return( EasyReq( GetString( str
), GetString( gadtxt
), &gadtxt
+ 1 ) );
144 EZReq( STRPTR str
, STRPTR gadtxt
, ... )
146 return( EasyReq( str
, gadtxt
, &gadtxt
+ 1 ) );