[Tux4kids-commits] r831 - tuxtype/trunk/src

dbruce-guest at alioth.debian.org dbruce-guest at alioth.debian.org
Fri Jan 9 12:52:18 UTC 2009


Author: dbruce-guest
Date: 2009-01-09 12:52:18 +0000 (Fri, 09 Jan 2009)
New Revision: 831

Modified:
   tuxtype/trunk/src/SDL_extras.c
   tuxtype/trunk/src/globals.h
   tuxtype/trunk/src/loaders.c
   tuxtype/trunk/src/main.c
   tuxtype/trunk/src/practice.c
   tuxtype/trunk/src/titlescreen.c
Log:
trying to fix display issues for practice activity in Windows
as well as gettext not working in Windows



Modified: tuxtype/trunk/src/SDL_extras.c
===================================================================
--- tuxtype/trunk/src/SDL_extras.c	2009-01-08 19:31:57 UTC (rev 830)
+++ tuxtype/trunk/src/SDL_extras.c	2009-01-09 12:52:18 UTC (rev 831)
@@ -575,10 +575,22 @@
     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);
 }
 

Modified: tuxtype/trunk/src/globals.h
===================================================================
--- tuxtype/trunk/src/globals.h	2009-01-08 19:31:57 UTC (rev 830)
+++ tuxtype/trunk/src/globals.h	2009-01-09 12:52:18 UTC (rev 831)
@@ -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>

Modified: tuxtype/trunk/src/loaders.c
===================================================================
--- tuxtype/trunk/src/loaders.c	2009-01-08 19:31:57 UTC (rev 830)
+++ tuxtype/trunk/src/loaders.c	2009-01-09 12:52:18 UTC (rev 831)
@@ -68,12 +68,27 @@
 /* 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;
+
 }
 
 int max(int n1, int n2)

Modified: tuxtype/trunk/src/main.c
===================================================================
--- tuxtype/trunk/src/main.c	2009-01-08 19:31:57 UTC (rev 830)
+++ tuxtype/trunk/src/main.c	2009-01-09 12:52:18 UTC (rev 831)
@@ -149,6 +149,9 @@
   }
 
   /* 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();
 

Modified: tuxtype/trunk/src/practice.c
===================================================================
--- tuxtype/trunk/src/practice.c	2009-01-08 19:31:57 UTC (rev 830)
+++ tuxtype/trunk/src/practice.c	2009-01-09 12:52:18 UTC (rev 831)
@@ -226,9 +226,19 @@
         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 @@
         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 @@
           tmpsurf = NULL;
         }
 
+        /* Update timer: */
         tmpsurf = BlackOutline(time_str, smallfont, &white);
         if (tmpsurf)
         {

Modified: tuxtype/trunk/src/titlescreen.c
===================================================================
--- tuxtype/trunk/src/titlescreen.c	2009-01-08 19:31:57 UTC (rev 830)
+++ tuxtype/trunk/src/titlescreen.c	2009-01-09 12:52:18 UTC (rev 831)
@@ -514,6 +514,7 @@
 
     if (menu_opt == LESSONS)
     {
+//      not_implemented();
       SDL_BlitSurface(CurrentBkgd(), NULL, screen, NULL);
       SDL_Flip( screen );
       unload_media();
@@ -657,6 +658,8 @@
 
     if (menu_opt == PHRASE_PRACTICE)
     {
+//      not_implemented();
+
       unload_media();
 
       Phrases(NULL);




More information about the Tux4kids-commits mailing list