[Tux4kids-commits] r1336 - in tuxtype/branches/gsoc-sarah: data/images doc src
Sarah Frisk
fou_fou-guest at alioth.debian.org
Mon Aug 3 06:59:28 UTC 2009
Author: fou_fou-guest
Date: 2009-08-03 06:59:27 +0000 (Mon, 03 Aug 2009)
New Revision: 1336
Added:
tuxtype/branches/gsoc-sarah/data/images/wordlist_button.png
Modified:
tuxtype/branches/gsoc-sarah/data/images/Makefile.am
tuxtype/branches/gsoc-sarah/doc/ChangeLog
tuxtype/branches/gsoc-sarah/src/editor.c
tuxtype/branches/gsoc-sarah/src/editor.h
Log:
Worked on the function to create new word lists
Modified: tuxtype/branches/gsoc-sarah/data/images/Makefile.am
===================================================================
--- tuxtype/branches/gsoc-sarah/data/images/Makefile.am 2009-08-03 05:29:36 UTC (rev 1335)
+++ tuxtype/branches/gsoc-sarah/data/images/Makefile.am 2009-08-03 06:59:27 UTC (rev 1336)
@@ -14,7 +14,6 @@
imagesdir = $(pkgdatadir)/images
dist_images_DATA = README_IMAGES.TXT \
- Done.png \
down.png \
fishy-.png \
fishy0.png \
@@ -51,7 +50,6 @@
num_8.png \
num_9.png \
pract.png \
- RemWordList.png \
right.png \
splat0.png \
sound.png \
@@ -67,4 +65,5 @@
tux2.png \
tux3.png \
up.png \
+ wordlist_button.png\
world.png
Added: tuxtype/branches/gsoc-sarah/data/images/wordlist_button.png
===================================================================
(Binary files differ)
Property changes on: tuxtype/branches/gsoc-sarah/data/images/wordlist_button.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: tuxtype/branches/gsoc-sarah/doc/ChangeLog
===================================================================
--- tuxtype/branches/gsoc-sarah/doc/ChangeLog 2009-08-03 05:29:36 UTC (rev 1335)
+++ tuxtype/branches/gsoc-sarah/doc/ChangeLog 2009-08-03 06:59:27 UTC (rev 1336)
@@ -1,6 +1,12 @@
-<<<<<<< .mine
-2 Aug 2009 (svn.debian.org/tux4kids - revision 1325)
+
+3 Aug 2009 (svn.debian.org/tux4kids - revision 1336)
[Sarah Frisk <ssfrisk at gmail.com> ]
+ - Worked on the function to create new word list
+ - Added buttons
+
+ -Code in editor.c is now active.
+2 Aug 2009 (svn.debian.org/tux4kids - revision 1335)
+[Sarah Frisk <ssfrisk at gmail.com> ]
- Fixed drawing issues in editor.c, everything now draws correctly in the ChooseListToEdit().
-Code in editor.c is now active.
Modified: tuxtype/branches/gsoc-sarah/src/editor.c
===================================================================
--- tuxtype/branches/gsoc-sarah/src/editor.c 2009-08-03 05:29:36 UTC (rev 1335)
+++ tuxtype/branches/gsoc-sarah/src/editor.c 2009-08-03 06:59:27 UTC (rev 1336)
@@ -180,6 +180,9 @@
break; /* out of switch-case */
case SDL_MOUSEBUTTONDOWN:
+ if (inRect(button_rect, event.button.x, event.button.y))
+ CreateNewWordList();
+
for (i = 0; (i < 8) && (loc - (loc % 8) + i <num_lists); i++)
if (inRect(titleRects[i], event.button.x, event.button.y))
{
@@ -187,6 +190,7 @@
EditWordList(file_names[loc]);
break;
}
+
break;
case SDL_KEYDOWN:
@@ -291,7 +295,6 @@
static SDL_Surface* yellow_words[MAX_NUM_WORDS] = {NULL};
static SDL_Surface *left = NULL, *right = NULL;
static SDL_Rect leftRect, rightRect;
-// SDL_Surface* bkg = NULL;
SDL_Rect word_rects[8];
int stop = 0;
int loc = 0;
@@ -310,13 +313,15 @@
//We should be able to use GenerateWordList() in place of this next block:
+ //NOTE: Works originally, but upon returning to editorlist, the word selected
+ // is not there, since all words in the wordlist are deleted
sprintf(fn , "%s/%s", settings.var_data_path, words_file);
- fp = fopen(fn,"r");
- number_of_words = 0;
- while(!feof(fp))
- if (EOF ==fscanf(fp, "%[^\n]\n", words_in_list[number_of_words++]))
+ fp = fopen(fn,"r");
+ number_of_words = 0;
+ while(!feof(fp))
+ if (EOF ==fscanf(fp, "%[^\n]\n", words_in_list[number_of_words++]))
continue;
- fclose(fp);
+ fclose(fp);
@@ -394,6 +399,7 @@
loc = loc - (loc % 8) + i;
break;
}
+
}
break;
}
@@ -621,4 +627,75 @@
}
+/** Private functions **/
+void CreateNewWordList(void)
+{
+ fprintf(stderr, "Creating a New Word List!!!");
+ int stop = 0;
+ SDL_Surface* OK_button = NULL;
+ SDL_Surface* CANCEL_button = NULL;
+ SDL_Surface *OK = NULL, *CANCEL = NULL;
+ SDL_Rect OK_rect;
+ SDL_Rect CANCEL_rect;
+ SDL_Rect OK_rect_text;
+ SDL_Rect CANCEL_rect_text;
+
+ //Creates a box thing, tells user to enter in name of list. Click OK, or CANCEL
+ //FIXME: Text in boxes needs work
+ //FIXME: Create a rect for user to enter stuff, and a pretty box to go around everything
+ //FIDME: Change size of boxes
+
+ OK = BlackOutline(gettext_noop("OK"), 25, &yellow);
+ CANCEL = BlackOutline(gettext_noop("CANCEL"), 25, &yellow);
+
+ OK_button = LoadImage("wordlist_button.png", IMG_ALPHA);
+ CANCEL_button = LoadImage("wordlist_button.png", IMG_ALPHA);
+
+
+ OK_rect.x = screen->w/4; OK_rect.y = 200;
+ SDL_BlitSurface(OK_button, NULL, screen, &OK_rect);
+ OK_rect_text.x = screen->w/4 + 150; OK_rect_text.y = 250;
+ SDL_BlitSurface(OK, NULL, screen, &OK_rect_text);
+
+ CANCEL_rect.x = screen->w/4 * 2; CANCEL_rect.y = 200;
+ SDL_BlitSurface(CANCEL_button, NULL, screen, &CANCEL_rect);
+ CANCEL_rect_text.x = screen->w/4 * 2 + 150; CANCEL_rect_text.y = 250;
+ SDL_BlitSurface(CANCEL, NULL, screen, &CANCEL_rect_text);
+
+
+ SDL_UpdateRect(screen, 0, 0, 0, 0);
+
+
+ while (!stop)
+ {
+ while (SDL_PollEvent(&event))
+ {
+ switch (event.type)
+ {
+ case SDL_MOUSEBUTTONDOWN:
+ if (inRect(OK_rect, event.button.x, event.button.y))
+ {
+ //do something else
+ // Check if anything is written
+ //if yes, save
+ //if not, don't do anything?
+ stop = 1;
+ }
+ if (inRect(CANCEL_rect, event.button.x, event.button.y))
+ stop = 1;
+ break;
+ }
+ }
+ }/*end user event handling **/
+
+ if(stop = 1)
+ {
+
+ //we free stuff
+ SDL_FreeSurface(OK_button);
+ SDL_FreeSurface(CANCEL_button);
+ }
+}
+
+
\ No newline at end of file
Modified: tuxtype/branches/gsoc-sarah/src/editor.h
===================================================================
--- tuxtype/branches/gsoc-sarah/src/editor.h 2009-08-03 05:29:36 UTC (rev 1335)
+++ tuxtype/branches/gsoc-sarah/src/editor.h 2009-08-03 06:59:27 UTC (rev 1336)
@@ -18,5 +18,6 @@
void ChooseListToEdit(void);
void EditWordList(char* words_file);
+void CreateNewWordList(void);
#endif
More information about the Tux4kids-commits
mailing list