[gcompris/gcomprixogoo] Added support for forced uppercase in horizontal/vertical reading.



commit bd7b7fbcfefbabc29f470d32b8c43be2f56f4f6b
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Sun Nov 28 23:38:50 2010 +0100

    Added support for forced uppercase in horizontal/vertical reading.

 src/readingh-activity/reading.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/src/readingh-activity/reading.c b/src/readingh-activity/reading.c
index 35f3626..41eee6f 100644
--- a/src/readingh-activity/reading.c
+++ b/src/readingh-activity/reading.c
@@ -39,6 +39,8 @@ static gint textToFindIndex = 0;
 
 static GooCanvasItem *boardRootItem = NULL;
 
+static gboolean uppercase_only;
+
 typedef enum
 {
   MODE_HORIZONTAL		= 0,
@@ -171,6 +173,13 @@ static void start_board (GcomprisBoard *agcomprisBoard)
 
   gc_locale_change(g_hash_table_lookup( config, "locale"));
 
+  gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only");
+
+  if (up_init_str && (strcmp(up_init_str, "True")==0))
+    uppercase_only = TRUE;
+  else
+    uppercase_only = FALSE;
+
   g_hash_table_destroy(config);
 
   if(agcomprisBoard!=NULL)
@@ -805,6 +814,14 @@ get_random_word(const gchar* except)
 	word = gc_wordlist_random_word_get(gc_wordlist, gcomprisBoard->level);
       }
 
+  if (word && uppercase_only)
+    {
+      gchar *old = word;
+      word = g_utf8_strup(old, -1);
+      g_free(old);
+    }
+
+
   return(word);
 }
 
@@ -851,6 +868,15 @@ static void conf_ok(GHashTable *table)
 
     gc_locale_set(g_hash_table_lookup( config, "locale"));
 
+    gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only");
+    if (up_init_str)
+      {
+	if(strcmp(up_init_str, "True")==0)
+	  uppercase_only = TRUE;
+	else
+	  uppercase_only = FALSE;
+      }
+
     if (profile_conf)
       g_hash_table_destroy(config);
 
@@ -891,6 +917,18 @@ reading_config_start(GcomprisBoard *agcomprisBoard,
 
   gc_board_config_combo_locales(conf, locale);
   gc_board_config_wordlist(conf, "wordsgame/default-$LOCALE.xml");
+
+  /* upper case */
+  gboolean up_init = FALSE;
+  gchar *up_init_str = g_hash_table_lookup( config, "uppercase_only");
+
+  if (up_init_str && (strcmp(up_init_str, "True")==0))
+    up_init = TRUE;
+
+  gc_board_config_boolean_box(conf, _("Uppercase only text"),
+			      "uppercase_only",
+			      up_init);
+
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]