6 #include <exec/types.h>
7 #include <exec/execbase.h>
8 #include <libraries/locale.h>
12 #include <proto/dos.h>
13 #include <proto/exec.h>
14 #include <proto/intuition.h>
15 #include <proto/utility.h>
16 #include <proto/locale.h>
18 #include <proto/scalos.h>
20 #include <clib/alib_protos.h>
23 #include <Year.h> // +jmc+
25 #include <scalos/scalos.h>
32 #include "scalos_structures.h"
34 #include "functions.h"
35 #include "Variables.h"
37 //----------------------------------------------------------------------------
39 void NewLocalePrefs(struct internalScaWindowTask
*iwt
, struct NotifyMessage
*msg
)
41 struct SM_NewPreferences
*smnp
;
43 d1(KPrintF("%s/%s/%ld: smnp_PrefsFlags=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, SMNPFLAGF_LOCALEPREFS
));
45 smnp
= (struct SM_NewPreferences
*) SCA_AllocMessage(MTYP_NewPreferences
, 0);
48 smnp
->smnp_PrefsFlags
= SMNPFLAGF_LOCALEPREFS
;
49 PutMsg(iInfos
.xii_iinfos
.ii_MainMsgPort
, &smnp
->ScalosMessage
.sm_Message
);
54 BOOL
ChangedLocalePrefs(struct MainTask
*mt
)
57 struct internalScaWindowTask
*iwtMain
= (struct internalScaWindowTask
*) iInfos
.xii_iinfos
.ii_MainWindowStruct
->ws_WindowTask
;
62 Delay(3 * 50); // Wait till locale.libary took notice of changed locale preferences
66 // AppIcons will not get re-created like other icons,
67 // so we do a ReLayout here
68 DoMethod(iwtMain
->iwt_WindowTask
.mt_MainObject
, SCCM_IconWin_Redraw
, REDRAWF_ReLayoutIcons
);
78 d1(kprintf("%s/%s/%ld: LocaleBase=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, LocaleBase
));
80 if (NULL
== LocaleBase
)
83 ScalosLocale
= OpenLocale(NULL
);
84 d1(kprintf("%s/%s/%ld: ScalosLocale=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, ScalosLocale
));
85 if (NULL
== ScalosLocale
)
88 d1(kprintf("%s/%s/%ld: LocaleName=<%s> Language=<%s>\n", \
89 __FILE__
, __FUNC__
, __LINE__
, ScalosLocale
->loc_LocaleName
, ScalosLocale
->loc_LanguageName
));
91 if (ScalosLocale
->loc_GroupSeparator
)
92 CurrentPrefs
.pref_GroupSeparator
= *ScalosLocale
->loc_GroupSeparator
;
94 ScalosCatalog
= OpenCatalogA(ScalosLocale
, (STRPTR
) "Scalos/Scalos.catalog", NULL
);
96 d1(kprintf("%s/%s/%ld: ScalosCatalog=%08lx\n", __FILE__
, __FUNC__
, __LINE__
, ScalosCatalog
));
99 d1(kprintf("%s/%s/%ld: cat_Version=%ld\n", __FILE__
, __FUNC__
, __LINE__
, ScalosCatalog
->cat_Version
));
101 if (ScalosCatalog
->cat_Version
< 40)
103 CloseCatalog(ScalosCatalog
);
104 ScalosCatalog
= NULL
;
111 void CleanupLocale(void)
116 CloseCatalog(ScalosCatalog
);
118 CloseLocale(ScalosLocale
);
120 ScalosCatalog
= NULL
;