Use hardcoded settings for VIA VT1708S (they are reported to work
[AROS.git] / workbench / prefs / reqtools / misc.c
blob143d71ede71653f2fab47091bd10d9c4cfa012d2
1 #include <libraries/gadtools.h>
2 #include <libraries/reqtools.h>
3 #include <proto/dos.h>
4 #include <proto/exec.h>
5 #include <proto/intuition.h>
6 #include <proto/locale.h>
7 #include <proto/reqtools.h>
8 #include "rtstrings.h"
10 #ifdef __AROS__
11 #include <libraries/locale.h>
12 extern struct ReqToolsBase *ReqToolsBase;
13 #endif
15 extern struct Window *WindowPtr;
16 extern struct Hook IntuiHook;
18 #ifdef __AROS__
19 struct LocaleBase *LocaleBase;
20 #define LOCALECAST (struct LocaleBase *)
21 #else
22 struct Library *LocaleBase;
23 #define LOCALECAST
24 #endif
25 struct Catalog *Catalog;
28 VOID
29 InitLocale( VOID )
31 if( ( LocaleBase = LOCALECAST OpenLibrary( "locale.library", 0 ) ) )
33 Catalog = OpenCatalogA( NULL, "System/Prefs/ReqTools.catalog", NULL );
38 VOID
39 FreeLocale( VOID )
41 if( LocaleBase )
43 CloseCatalog( Catalog );
44 CloseLibrary( (struct Library *)LocaleBase );
49 CONST_STRPTR
50 GetString( CONST_STRPTR idstr )
52 CONST_STRPTR local;
54 local = idstr + 2;
56 if( LocaleBase )
58 return GetCatalogStr( Catalog, ( ( UBYTE ) idstr[ 0 ] << 8 ) | idstr[ 1 ], local );
61 return local;
64 VOID
65 LocalizeMenus( struct NewMenu *nm )
67 CONST_STRPTR local;
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 )
77 if( *local != ' ' )
79 nm->nm_CommKey = local;
82 local += 2;
85 nm->nm_Label = local;
88 ++nm;
93 VOID
94 LocalizeLabels( CONST_STRPTR *labels )
96 CONST_STRPTR local;
98 while( *labels )
100 local = GetString( *labels );
101 *labels++ = local;
107 static struct EasyStruct EZ;
110 ULONG
111 EasyReq( CONST_STRPTR str, CONST_STRPTR gadtxt, APTR args )
113 if( ReqToolsBase )
115 struct TagItem tags[] =
117 {RT_Window , (IPTR)WindowPtr },
118 {RT_LockWindow , WindowPtr != NULL },
119 {RT_ShareIDCMP , WindowPtr != NULL },
120 {RT_IntuiMsgFunc , (IPTR)&IntuiHook },
121 {TAG_DONE }
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 ) );
137 ULONG
138 LocEZReq( CONST_STRPTR str, CONST_STRPTR gadtxt, ... )
140 return( EasyReq( GetString( str ), GetString( gadtxt ), &gadtxt + 1 ) );
143 ULONG
144 EZReq( STRPTR str, STRPTR gadtxt, ... )
146 return( EasyReq( str, gadtxt, &gadtxt + 1 ) );