[Tux4kids-commits] r1147 - in tuxtype/branches/gsoc-sarah: doc src

Sarah Frisk fou_fou-guest at alioth.debian.org
Mon Jul 6 11:22:40 UTC 2009


Author: fou_fou-guest
Date: 2009-07-06 11:22:39 +0000 (Mon, 06 Jul 2009)
New Revision: 1147

Modified:
   tuxtype/branches/gsoc-sarah/doc/ChangeLog
   tuxtype/branches/gsoc-sarah/src/titlescreen.c
Log:
Finished fixing bugs in functionality of ChooseWord().  Program now correctly adds/changes/deleats words without extra garbage.

Modified: tuxtype/branches/gsoc-sarah/doc/ChangeLog
===================================================================
--- tuxtype/branches/gsoc-sarah/doc/ChangeLog	2009-07-05 16:24:23 UTC (rev 1146)
+++ tuxtype/branches/gsoc-sarah/doc/ChangeLog	2009-07-06 11:22:39 UTC (rev 1147)
@@ -1,3 +1,14 @@
+6 July 2009 (svn.debian.org/tux4kids - revision 1147)
+[ Sarah Frisk <ssfrisk at gmail.com> ]
+	- Fixed spacing issue in ChooseWord()
+	- Fixed random garbage adding in ChooseWord()
+	- Simplified ChooseWord() in general
+	- For the most part ChooseWord() functionality is finished.  What is left is to had a 
+	more comprehensible GUI than what is currently there (which involves figuring out how to 
+	move the wordlist editor from the top left hand corner of the screen).  Also need to make 
+	is so ChooseFile() can create wordlists, but that should be easy since the set up of that 
+	function is very similar to ChooseWord(). 
+
 30 Jun 2009 (svn.debian.org/tux4kids - revision 1119)
 [ David Bruce <davidstuartbruce at gmail.com> ]
         - Build - changed file permissions on installed localstatedir and sysconfdir

Modified: tuxtype/branches/gsoc-sarah/src/titlescreen.c
===================================================================
--- tuxtype/branches/gsoc-sarah/src/titlescreen.c	2009-07-05 16:24:23 UTC (rev 1146)
+++ tuxtype/branches/gsoc-sarah/src/titlescreen.c	2009-07-06 11:22:39 UTC (rev 1147)
@@ -1930,8 +1930,10 @@
         switch (event.key.keysym.sym)
         {                               
           case SDLK_RETURN:
-            listening_for_new_word = 1;
-            break;
+			if (number_of_words < MAX_WORD_LISTS)
+				listening_for_new_word = 1;
+			else
+				fprintf(stderr, "Couldn't add new word, this wordlist is full.\n");	
           case SDLK_CAPSLOCK:
           case SDLK_RALT:
           case SDLK_LALT:
@@ -1947,37 +1949,27 @@
 
         if(i)
         {
-          if (event.key.keysym.sym == SDLK_RETURN)  
-          	{
-				if (listening_for_new_word == 1)
-				{
-					if (number_of_words < MAX_WORD_LISTS)
-					{
-						loc = number_of_words;
-					// need to make it not enter if word list is full
-						titles[loc] = BlackOutline(words_in_list[loc], DEFAULT_MENU_FONT_SIZE, &white );
-	            		select[loc] = BlackOutline(words_in_list[loc], DEFAULT_MENU_FONT_SIZE, &yellow);
-						number_of_words ++;
-						fprintf(stderr, "There are current: %i words\n", number_of_words);
-						fprintf(stderr, "Loc is currently: %i\n", loc);
-					}
-					else
-					{	
-					//	titles[loc] = BlackOutline(words_in_list[loc], DEFAULT_MENU_FONT_SIZE, &white );
-	            	//	select[loc] = BlackOutline(words_in_list[loc], DEFAULT_MENU_FONT_SIZE, &yellow);
-						fprintf(stderr, "This wordlist is full\n");	
-					}
-					listening_for_new_word = 0;
-			    }
-			}
-                           
-          len = ConvertFromUTF8(temp, words_in_list[loc], FNLEN);
-          temp[len] = toupper(event.key.keysym.unicode);
+		  // If it's listening for a new word, from having last pressed enter, create a whole new word
+		  // with a length of 0, else get the current length of the highlighted word
+          if (listening_for_new_word) {
+			loc = number_of_words;
+			number_of_words++;
+			listening_for_new_word = 0;
+			len = 0;
+		  } else {
+			len = ConvertFromUTF8(temp, words_in_list[loc], FNLEN);
+		  }
+		  
+		  // Add the character to the end of the existing string
+		  temp[len] = toupper(event.key.keysym.unicode);
           temp[len + 1] = 0;
           ConvertToUTF8(temp,words_in_list[loc], FNLEN);
+
+		  // Copy back to the on-screen list
           titles[loc] = BlackOutline(words_in_list[loc], DEFAULT_MENU_FONT_SIZE, &white );
           select[loc] = BlackOutline(words_in_list[loc], DEFAULT_MENU_FONT_SIZE, &yellow);
-          i = 0;
+          
+		  i = 0;
           break;
         }
     }




More information about the Tux4kids-commits mailing list