add a missing section header table index conversion
[tangerine.git] / workbench / prefs / Editor / Prefs_Strings.c
blob1fee7c29d812cc6c84c018b8608445291923d376
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 #define LocaleInfo LocaleInfoTmp
15 #include "../../tools/Edit/strings.h"
17 /* Gadget messages */
18 STRPTR PrefMsg[] = {
19 MSG_TITLEWIN_STR,
20 MSG_TAB_STR, MSG_SEPARATORS_STR, MSG_TXTFONT_STR, MSG_SCRFONT_STR, MSG_PUBSCREEN_STR, NULL,
21 MSG_BACKDROP_STR, MSG_LEFTMARGIN_STR, MSG_AUTOINDENT_STR, MSG_EXTEND_STR, NULL,
22 MSG_PREFSSAVE_STR, MSG_USEPREFS_STR, MSG_DISCARDPREFS_STR, NULL,
23 NULL, MSG_USEDEF_STR, MSG_CHOOSEIT_STR, NULL,
24 NULL, MSG_CLONEPARENT_STR, NULL, NULL, NULL,
25 MSG_COLOR_BACK_STR, MSG_COLOR_TEXT_STR, MSG_COLOR_FILLTXT_STR, MSG_COLOR_FILLSEL_STR,
26 MSG_COLOR_MARGINBACK_STR, MSG_COLOR_MARGINTXT_STR, MSG_COLOR_SHINE_STR, MSG_COLOR_SHADE_STR,
27 MSG_COLOR_PANELBACK_STR, MSG_COLOR_PANELTEXT_STR, MSG_COLOR_GLYPH_STR, MSG_COLOR_MARKEDLINES_STR, NULL
30 /* Global error messages (taken from Jano) */
31 STRPTR Errors[] = {
32 ERR_BADOS_STR, ERR_NOASLREQ_STR,
33 /*ERR_NOWRTACCESS_STR,*/ ERR_NOMEM_STR,
34 ERR_NOGUI_STR, ERR_NONAME_STR,
35 ERR_WRITECLIP_STR, ERR_OPENCLIP_STR,
36 ERR_LOADFILE_STR, ERR_NOTXTINCLIP_STR,
37 ERR_WRONG_TYPE_STR, ERR_READCLIP_STR,
38 ERR_NOBRACKET_STR, ERR_NOT_FOUND_STR,
39 ERR_LOADFONT_STR, ERR_NOPREFEDITOR_STR,
40 ERR_BADPREFSFILE_STR, ERR_FILEMODIFIED_STR,
41 ERR_SLC_STR, ERR_NOSEARCHTEXT_STR
45 struct NewMenu newmenu[] =
47 /* Part of strings are shared with Jano */
48 {NM_TITLE, MSG_PROJECTTITLE_STR, NULL, 0, 0L, NULL},
49 { NM_ITEM, MSG_OPENNEWFILE_STR, "O", 0, 0L, (APTR)101},
50 { NM_ITEM, MSG_SAVEFILEAS_STR, "A", 0, 0L, (APTR)102},
51 { NM_ITEM, (STRPTR)NM_BARLABEL, NULL,0, 0L, NULL},
52 { NM_ITEM, MSG_QUIT_STR, "Q", 0, 0L, (APTR)103},
54 {NM_TITLE, MSG_EDITTITLE_STR, NULL, 0, 0L, NULL},
55 { NM_ITEM, MSG_RESETDEFAULT_STR, "D", 0, 0L, (APTR)201},
56 { NM_ITEM, MSG_LASTSAVED_STR, "L", 0, 0L, (APTR)202},
58 {NM_END, 0, 0, 0, 0, 0}
61 /* String ID to quote from catalogs for newmenus (IDs aren't contiguous) */
62 WORD StrID[] = {
63 MSG_PROJECTTITLE, MSG_OPENNEWFILE, MSG_SAVEFILEAS,
64 MSG_QUIT, MSG_EDITTITLE, MSG_RESETDEFAULT,
65 MSG_LASTSAVED
68 #define EOT(table) (table+sizeof(table)/sizeof(table[0]))
70 static void *prefs_cat = NULL;
71 static void *jano_cat = NULL;
73 /*** Localise all strings of the program ***/
74 void prefs_local(void)
76 WORD MsgID;
77 /* Custom prefs messages */
78 if( (prefs_cat = (void *) OpenCatalogA(NULL,"System/Prefs/EditorPrefs.catalog",NULL)) &&
79 (jano_cat = (void *) OpenCatalogA(NULL,"System/Tools/Editor.catalog",NULL)) )
81 { /* Various message of pref */
82 STRPTR *str;
83 for(str = PrefMsg, MsgID=MSG_TITLEWIN; str < EOT(PrefMsg); str++)
84 if(*str != NULL)
85 *str = (STRPTR) GetCatalogStr(prefs_cat,MsgID++,*str);
87 { /* NewMenus */
88 struct NewMenu *nm;
89 for(nm=newmenu,MsgID=0; nm->nm_Type != NM_END; nm++)
90 if(nm->nm_Label != NM_BARLABEL)
91 nm->nm_Label = (STRPTR)
92 GetCatalogStr(MsgID<5 ? jano_cat : prefs_cat,StrID[MsgID],nm->nm_Label), MsgID++;
94 /* Common messages with Jano */
96 STRPTR *str;
97 for(str = Errors, MsgID=ERR_BADOS; str < EOT(Errors); str++)
98 *str = (STRPTR) GetCatalogStr(jano_cat,MsgID++,*str);
103 /*** Free allocated ressource ***/
104 void free_locale(void)
106 if(prefs_cat) CloseCatalog(prefs_cat);
107 if(jano_cat) CloseCatalog(jano_cat);