Commit a67832e4 authored by David Bruce's avatar David Bruce

trying to fix display issues for practice activity in Windows

as well as gettext not working in Windows



git-svn-id: svn://svn.debian.org/svn/tux4kids/tuxtype/trunk@831 47d30e19-490b-0410-9d18-e851f4e465b3
parent 7db4ae0a
......@@ -575,10 +575,22 @@ SDL_Surface* BlackOutline_w(wchar_t* t, const TTF_Font* font, const SDL_Color* c
return NULL;
}
wcsncpy( wchar_tmp, t, size);
wcsncpy(wchar_tmp, t, size);
wchar_tmp[size] = 0;
i = ConvertToUTF8( wchar_tmp, tmp);
DEBUGCODE
{
fprintf(stderr, "In BlackOutline_w() - input wchar_t string is: %S\n", wchar_tmp);
}
i = ConvertToUTF8(wchar_tmp, tmp);
tmp[i] = 0;
DEBUGCODE
{
fprintf(stderr, "In BlackOutline_w() - converted UTF8 string is: %s\n", tmp);
}
return BlackOutline(tmp, font, c);
}
......
......@@ -46,6 +46,12 @@
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)
#ifdef WIN32
#define TUXLOCALE "./locale"
#else
#define TUXLOCALE LOCALEDIR
#endif
#include <string.h>
#include <wchar.h>
#include <math.h>
......
......@@ -68,11 +68,26 @@ int CheckFile(const char* file)
/* also should have return value reflect success or failure. */
void LoadLang(void)
{
const char *s1, *s2, *s3, *s4;
setlocale(LC_ALL,settings.theme_locale_name);
bindtextdomain(PACKAGE,"/usr/local/share/locale");
textdomain(PACKAGE);
return;
s1 = setlocale(LC_ALL, settings.theme_locale_name);
s2 = bindtextdomain(PACKAGE, TUXLOCALE);
s3 = bind_textdomain_codeset(PACKAGE, "UTF-8");
s4 = textdomain(PACKAGE);
DEBUGCODE
{
fprintf(stderr, "PACKAGE = %s\n", PACKAGE);
fprintf(stderr, "TUXLOCALE = %s\n", TUXLOCALE);
fprintf(stderr, "setlocale(LC_ALL, %s) returned: %s\n", settings.theme_locale_name, s1);
fprintf(stderr, "bindtextdomain(PACKAGE, TUXLOCALE) returned: %s\n", s2);
fprintf(stderr, "bind_textdomain_codeset(PACKAGE, \"UTF-8\") returned: %s\n", s3);
fprintf(stderr, "textdomain(PACKAGE) returned: %s\n", s4);
fprintf(stderr, "gettext(\"Help\"): %s\n\n", gettext("Help"));
fprintf(stderr, "After gettext() call\n");
}
return;
}
......
......@@ -149,6 +149,9 @@ int main(int argc, char *argv[])
}
/* FIXME: we should check config files/environment variables like LANG! */
/* NOTE what should we do if LANG is something without a theme - should */
/* we then default to English? */
LoadLang();
LoadKeyboard();
......
......@@ -226,9 +226,19 @@ int Phrases(wchar_t* pphrase )
SDL_BlitSurface(accuracy_label_srfc, NULL, screen, &accuracy_label);
/* Draw the phrase to be typed up to the next wrapping point: */
/* Find wrapping point: */
wrap_pt = find_next_wrap(&phrases[cur_phrase][prev_wrap],
medfont, phrase_draw_width);
/* Draw the phrase to be typed up to the next wrapping point: */
DEBUGCODE
{
wchar_t buf[200];
wcsncpy(buf, &phrases[cur_phrase][prev_wrap], wrap_pt + 1);
buf[wrap_pt + 1]= '\0';
fprintf(stderr, "Phrase to be typed is: %S\n", buf);
}
tmpsurf = BlackOutline_w(&phrases[cur_phrase][prev_wrap],
medfont, &white, wrap_pt + 1);
......@@ -243,6 +253,14 @@ int Phrases(wchar_t* pphrase )
tmpsurf = BlackOutline_w(&phrases[cur_phrase][prev_wrap],
medfont, &white,
cursor - prev_wrap);
DEBUGCODE
{
wchar_t buf[200];
wcsncpy(buf, &phrases[cur_phrase][prev_wrap], cursor - prev_wrap);
buf[cursor - prev_wrap + 1]= '\0';
fprintf(stderr, "Phrase to be typed is: %S\n", buf);
}
if (tmpsurf)
{
SDL_BlitSurface(tmpsurf, NULL, screen, &user_text_rect);
......@@ -250,6 +268,7 @@ int Phrases(wchar_t* pphrase )
tmpsurf = NULL;
}
/* Update timer: */
tmpsurf = BlackOutline(time_str, smallfont, &white);
if (tmpsurf)
{
......
......@@ -514,6 +514,7 @@ void TitleScreen(void)
if (menu_opt == LESSONS)
{
// not_implemented();
SDL_BlitSurface(CurrentBkgd(), NULL, screen, NULL);
SDL_Flip( screen );
unload_media();
......@@ -657,6 +658,8 @@ void TitleScreen(void)
if (menu_opt == PHRASE_PRACTICE)
{
// not_implemented();
unload_media();
Phrases(NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment