revert between 56095 -> 55830 in arch
[AROS.git] / workbench / prefs / Editor / Prefs_Strings.c
blobc23410c8dc12bf21b718eea413e2279dd45cb9d8
1 /*********************************************************
2 ** Prefs_Strings.c: locale library support of pref tool **
3 ** Written by T.Pierron, 24-feb-2001 **
4 *********************************************************/
6 #include <libraries/gadtools.h>
7 #include <libraries/locale.h>
9 #include <proto/locale.h>
11 #define CATCOMP_NUMBERS /* We will need the string id */
12 #define CATCOMP_STRINGS /* and the english string corresponding to the id */
13 #include "strings.h"
14 #ifdef _STRINGS_H
15 #undef _STRINGS_H
16 #endif
17 #define LocaleInfo LocaleInfoTmp
18 #include "../../tools/Edit/strings.h"
20 /* Gadget messages */
21 STRPTR PrefMsg[] = {
22 MSG_TITLEWIN_STR,
23 MSG_TAB_STR, MSG_SEPARATORS_STR, MSG_TXTFONT_STR, MSG_SCRFONT_STR, MSG_PUBSCREEN_STR, NULL,
24 MSG_BACKDROP_STR, MSG_LEFTMARGIN_STR, MSG_AUTOINDENT_STR, MSG_EXTEND_STR, NULL,
25 MSG_PREFSSAVE_STR, MSG_USEPREFS_STR, MSG_DISCARDPREFS_STR, NULL,
26 NULL, MSG_USEDEF_STR, MSG_CHOOSEIT_STR, NULL,
27 NULL, MSG_CLONEPARENT_STR, NULL, NULL, NULL,
28 MSG_COLOR_BACK_STR, MSG_COLOR_TEXT_STR, MSG_COLOR_FILLTXT_STR, MSG_COLOR_FILLSEL_STR,
29 MSG_COLOR_MARGINBACK_STR, MSG_COLOR_MARGINTXT_STR, MSG_COLOR_SHINE_STR, MSG_COLOR_SHADE_STR,
30 MSG_COLOR_PANELBACK_STR, MSG_COLOR_PANELTEXT_STR, MSG_COLOR_GLYPH_STR, MSG_COLOR_MARKEDLINES_STR, NULL
33 /* Global error messages (taken from Jano) */
34 STRPTR Errors[] = {
35 ERR_BADOS_STR, ERR_NOASLREQ_STR,
36 /*ERR_NOWRTACCESS_STR,*/ ERR_NOMEM_STR,
37 ERR_NOGUI_STR, ERR_NONAME_STR,
38 ERR_WRITECLIP_STR, ERR_OPENCLIP_STR,
39 ERR_LOADFILE_STR, ERR_NOTXTINCLIP_STR,
40 ERR_WRONG_TYPE_STR, ERR_READCLIP_STR,
41 ERR_NOBRACKET_STR, ERR_NOT_FOUND_STR,
42 ERR_LOADFONT_STR, ERR_NOPREFEDITOR_STR,
43 ERR_BADPREFSFILE_STR, ERR_FILEMODIFIED_STR,
44 ERR_SLC_STR, ERR_NOSEARCHTEXT_STR
48 struct NewMenu newmenu[] =
50 /* Part of strings are shared with Jano */
51 {NM_TITLE, MSG_PROJECTTITLE_STR, NULL, 0, 0L, NULL},
52 { NM_ITEM, MSG_OPENNEWFILE_STR, "O", 0, 0L, (APTR)101},
53 { NM_ITEM, MSG_SAVEFILEAS_STR, "A", 0, 0L, (APTR)102},
54 { NM_ITEM, (STRPTR)NM_BARLABEL, NULL,0, 0L, NULL},
55 { NM_ITEM, MSG_QUIT_STR, "Q", 0, 0L, (APTR)103},
57 {NM_TITLE, MSG_EDITTITLE_STR, NULL, 0, 0L, NULL},
58 { NM_ITEM, MSG_RESETDEFAULT_STR, "D", 0, 0L, (APTR)201},
59 { NM_ITEM, MSG_LASTSAVED_STR, "L", 0, 0L, (APTR)202},
61 {NM_END, 0, 0, 0, 0, 0}
64 /* String ID to quote from catalogs for newmenus (IDs aren't contiguous) */
65 WORD StrID[] = {
66 MSG_PROJECTTITLE, MSG_OPENNEWFILE, MSG_SAVEFILEAS,
67 MSG_QUIT, MSG_EDITTITLE, MSG_RESETDEFAULT,
68 MSG_LASTSAVED
71 #define EOT(table) (table+sizeof(table)/sizeof(table[0]))
73 static void *prefs_cat = NULL;
74 static void *jano_cat = NULL;
76 /*** Localise all strings of the program ***/
77 void prefs_local(void)
79 WORD MsgID;
80 /* Custom prefs messages */
81 if( (prefs_cat = (void *) OpenCatalogA(NULL,"System/Prefs/EditorPrefs.catalog",NULL)) &&
82 (jano_cat = (void *) OpenCatalogA(NULL,"System/Tools/Editor.catalog",NULL)) )
84 { /* Various message of pref */
85 STRPTR *str;
86 for(str = PrefMsg, MsgID=MSG_TITLEWIN; str < EOT(PrefMsg); str++)
87 if(*str != NULL)
88 *str = (STRPTR) GetCatalogStr(prefs_cat,MsgID++,*str);
90 { /* NewMenus */
91 struct NewMenu *nm;
92 for(nm=newmenu,MsgID=0; nm->nm_Type != NM_END; nm++)
93 if(nm->nm_Label != NM_BARLABEL)
94 nm->nm_Label = (STRPTR)
95 GetCatalogStr(MsgID<5 ? jano_cat : prefs_cat,StrID[MsgID],nm->nm_Label), MsgID++;
97 /* Common messages with Jano */
99 STRPTR *str;
100 for(str = Errors, MsgID=ERR_BADOS; str < EOT(Errors); str++)
101 *str = (STRPTR) GetCatalogStr(jano_cat,MsgID++,*str);
106 /*** Free allocated ressource ***/
107 void free_locale(void)
109 if(prefs_cat) CloseCatalog(prefs_cat);
110 if(jano_cat) CloseCatalog(jano_cat);