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

Sarah Frisk fou_fou-guest at alioth.debian.org
Tue Aug 4 00:53:46 UTC 2009


Author: fou_fou-guest
Date: 2009-08-04 00:53:46 +0000 (Tue, 04 Aug 2009)
New Revision: 1348

Modified:
   tuxtype/branches/gsoc-sarah/doc/ChangeLog
   tuxtype/branches/gsoc-sarah/src/editor.c
Log:
Fixed drawing issues

Modified: tuxtype/branches/gsoc-sarah/doc/ChangeLog
===================================================================
--- tuxtype/branches/gsoc-sarah/doc/ChangeLog	2009-08-04 00:12:50 UTC (rev 1347)
+++ tuxtype/branches/gsoc-sarah/doc/ChangeLog	2009-08-04 00:53:46 UTC (rev 1348)
@@ -1,3 +1,9 @@
+3 Aug 2009 (svn.debian.org/tux4kids - revision 1348)
+[Sarah Frisk <ssfrisk at gmail.com> ]
+	- Fixed drawing issues.  Program now correctly loads Word List Editor Main screen
+	after going to the word list editor and/or using various other buttons (New Word 
+	List)
+
 3 Aug 2009 (svn.debian.org/tux4kids - revision 1346)
 [Sarah Frisk <ssfrisk at gmail.com> ]
 	- Added button text

Modified: tuxtype/branches/gsoc-sarah/src/editor.c
===================================================================
--- tuxtype/branches/gsoc-sarah/src/editor.c	2009-08-04 00:12:50 UTC (rev 1347)
+++ tuxtype/branches/gsoc-sarah/src/editor.c	2009-08-04 00:53:46 UTC (rev 1348)
@@ -41,6 +41,7 @@
   int num_lists = 0;
   int i;
   int redraw = 0;
+  int delete = 0;
 
 
   //Arrays for the list of editable word lists:
@@ -220,12 +221,32 @@
 				redraw = 1;
 			}
 
+			if (inRect(button_rect[Remove], event.button.x, event.button.y))
+			{
+				//pop up something?
+				delete = 1;
+			}
+			
+			if (inRect(button_rect[Done], event.button.x, event.button.y)) 
+			{
+				stop = 1; 
+	            break;
+			}
+
           for (i = 0; (i < 8) && (loc - (loc % 8) + i <num_lists); i++) 
             if (inRect(titleRects[i], event.button.x, event.button.y))
             {
-              loc = loc - (loc % 8) + i;
-              EditWordList(file_names[loc]);
-			  redraw = 1;
+				if (!delete)
+				{
+              		loc = loc - (loc % 8) + i;
+              		EditWordList(file_names[loc]);
+			  		redraw = 1;
+				}
+				else
+					{
+						//do this bit of code
+						delete = 0;
+					}
               break;
             }
 			
@@ -282,34 +303,44 @@
     if (old_loc != loc || redraw == 1)
     {
       int start;
-	   redraw = 0;
+	  
 
-      //if(CurrentBkgd())
-      SDL_BlitSurface(CurrentBkgd(), NULL, screen, NULL);
+      if(CurrentBkgd())
+      	SDL_BlitSurface(CurrentBkgd(), NULL, screen, NULL);
 
-	  locText.x = screen->w/2 - (s1->w/2); locText.y = 10;
-	  SDL_BlitSurface( s1, NULL, screen, &locText);
-	  locText.x = screen->w/2 - (s2->w/2); locText.y = 50;
-	  SDL_BlitSurface( s2, NULL, screen, &locText);
-	  locText.x = screen->w/2 - (s3->w/2); locText.y = 70;
-	  SDL_BlitSurface(s3, NULL, screen, &locText);
-	  locText.x = screen->w/2 - (s4->w/2); locText.y = 90;
-	  SDL_BlitSurface( s4, NULL, screen, &locText);
+		/*FIXME: simplify this into a function*/
 
-	//  button_rect.x = screen->w/3 * 2; button_rect.y = 200;
-	//  SDL_BlitSurface(new_button, NULL, screen, &button_rect);
+		SDL_BlitSurface(CurrentBkgd(), NULL, screen, NULL);
+		locText.x = screen->w/2 - (s1->w/2); locText.y = 10;
+		SDL_BlitSurface( s1, NULL, screen, &locText);
+		locText.x = screen->w/2 - (s2->w/2); locText.y = 50;
+		SDL_BlitSurface( s2, NULL, screen, &locText);
+		locText.x = screen->w/2 - (s3->w/2); locText.y = 70;
+		SDL_BlitSurface(s3, NULL, screen, &locText);
+		locText.x = screen->w/2 - (s4->w/2); locText.y = 90;
+		SDL_BlitSurface( s4, NULL, screen, &locText);
 
+	  	SDL_BlitSurface(new_button, NULL, screen, &button_rect[New]);
+	  	SDL_BlitSurface(NEW, NULL, screen, &button_text_rect[New]);
+		SDL_BlitSurface(remove_button, NULL, screen, &button_rect[Remove]);
+		SDL_BlitSurface(REMOVE, NULL, screen, &button_text_rect[Remove]);
+		SDL_BlitSurface(done_button, NULL, screen, &button_rect[Done]);
+		SDL_BlitSurface(DONE, NULL, screen, &button_text_rect[Done]);
+
       start = loc - (loc % 8);
 
       for (i = start; i < MIN (start + 8, num_lists); i++)
       {
         //titleRects[i % 8].x = 320 - (white_titles_surf[i]->w/2);
         if (i == loc)
-          SDL_BlitSurface(yellow_titles_surf[loc], NULL, screen, &titleRects[i % 8]);
+        	SDL_BlitSurface(yellow_titles_surf[loc], NULL, screen, &titleRects[i % 8]);
         else
-          SDL_BlitSurface(white_titles_surf[i], NULL, screen, &titleRects[i % 8]);
+        	SDL_BlitSurface(white_titles_surf[i], NULL, screen, &titleRects[i % 8]);
         SDL_UpdateRect(screen, titleRects[i%8].x, titleRects[i%8].y, titleRects[i%8].w, titleRects[i%8].h);
 	  }
+		  SDL_UpdateRect(screen, 0, 0, 0, 0); 
+		 redraw = 0;
+	
     }
     SDL_Delay(40);
     old_loc = loc;




More information about the Tux4kids-commits mailing list