[Tux4kids-commits] r1407 - in tuxtype/branches/gsoc-sarah: doc src
Sarah Frisk
fou_fou-guest at alioth.debian.org
Mon Aug 10 22:46:47 UTC 2009
Author: fou_fou-guest
Date: 2009-08-10 22:46:47 +0000 (Mon, 10 Aug 2009)
New Revision: 1407
Modified:
tuxtype/branches/gsoc-sarah/doc/ChangeLog
tuxtype/branches/gsoc-sarah/src/editor.c
Log:
Left/Right buttons added, checks for empty wordlist names
Modified: tuxtype/branches/gsoc-sarah/doc/ChangeLog
===================================================================
--- tuxtype/branches/gsoc-sarah/doc/ChangeLog 2009-08-10 21:31:49 UTC (rev 1406)
+++ tuxtype/branches/gsoc-sarah/doc/ChangeLog 2009-08-10 22:46:47 UTC (rev 1407)
@@ -1,6 +1,11 @@
+10 Aug 2009 (svn.debian.org/tux4kids -revision 1407)
+[Sarah Frisk <ssfrisk at gmail.com> }
+ -Left and right arrows now show up
+ -adding a word list now checks for empty wordlists
+
10 Aug 2009 (svn.debian.org/tux4kids -revision 1406)
[Sarah Frisk <ssfrisk at gmail.com> }
- -Screen is redrawn properly after a wordlist is added/deleated
+ -Screen is redrawn properly after a wordlist is added/deleted
9 Aug 2009 (svn.debian.org/tux4kids -revision 1405)
[Sarah Frisk <ssfrisk at gmail.com> }
Modified: tuxtype/branches/gsoc-sarah/src/editor.c
===================================================================
--- tuxtype/branches/gsoc-sarah/src/editor.c 2009-08-10 21:31:49 UTC (rev 1406)
+++ tuxtype/branches/gsoc-sarah/src/editor.c 2009-08-10 22:46:47 UTC (rev 1407)
@@ -32,6 +32,10 @@
SDL_Surface *NEW = NULL, *REMOVE = NULL, *DONE = NULL;
//this is text:
SDL_Surface *s1 = NULL, *s2 = NULL, *s3 = NULL, *s4 = NULL;
+ //buttons for left + right
+ static SDL_Surface *left = NULL, *right = NULL;
+ static SDL_Rect leftRect, rightRect;
+
SDL_Rect locText;
SDL_Rect button_rect[3];
SDL_Rect button_text_rect[3];
@@ -133,11 +137,15 @@
DONE = BlackOutline(gettext_noop("DONE"), 25, &yellow);
REMOVE = BlackOutline(gettext_noop("REMOVE"), 25, &yellow);
- /* Load image of new word list button: */
+ /* Load image of new/remove/done buttons: */
new_button = LoadImage("wordlist_button.png", IMG_ALPHA);
remove_button = LoadImage("wordlist_button.png", IMG_ALPHA);
done_button = LoadImage("wordlist_button.png", IMG_ALPHA);
+ /*Load image for left and right buttons: */
+ left = LoadImage("left.png", IMG_ALPHA);
+ right = LoadImage("right.png", IMG_ALPHA);
+
LOG( "ChooseFile() - drawing screen\n");
@@ -153,8 +161,6 @@
SDL_BlitSurface( s4, NULL, screen, &locText);
-
-
button_rect[New].x = screen->w - new_button->w - 20;
button_rect[New].y = screen->h/3;
SDL_BlitSurface(new_button, NULL, screen, &button_rect[New]);
@@ -176,7 +182,17 @@
button_text_rect[Done].y = button_text_rect[Remove].y + done_button->h + 10;
SDL_BlitSurface(DONE, NULL, screen, &button_text_rect[Done]);
+ leftRect.w = left->w;
+ leftRect.h = left->h;
+ leftRect.x = 320 - 100 - (leftRect.w/2); //edit
+ leftRect.y = 430; //edit
+ rightRect.w = right->w;
+ rightRect.h = right->h;
+ rightRect.x = 320 + 100 - (rightRect.w/2);
+ rightRect.y = 430;
+
+
SDL_UpdateRect(screen, 0, 0, 0, 0);
@@ -217,6 +233,21 @@
break; /* out of switch-case */
case SDL_MOUSEBUTTONDOWN:
+
+ if (inRect(leftRect, event.button.x, event.button.y))
+ if (loc - (loc % 8) - 8 >= 0)
+ {
+ loc = loc - (loc % 8) - 8;
+ break;
+ }
+
+ if (inRect(rightRect, event.button.x, event.button.y))
+ if (loc - (loc % 8) + 8 < num_lists)
+ {
+ loc = loc - (loc % 8) + 8;
+ break;
+ }
+
if (inRect(button_rect[New], event.button.x, event.button.y))
{
change = CreateNewWordList();
@@ -405,6 +436,14 @@
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);
}
+
+ /* --- draw right and left arrow buttons --- */
+ if (start > 0)
+ SDL_BlitSurface( left, NULL, screen, &leftRect );
+ if (start + 8 < num_lists)
+ SDL_BlitSurface(right, NULL, screen, &rightRect);
+
+
SDL_UpdateRect(screen, 0, 0, 0, 0);
redraw = 0;
@@ -818,10 +857,8 @@
char fn[FNLEN];
//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
- //FIXME: Change size of boxes
-
+
OK = BlackOutline(gettext_noop("OK"), 25, &yellow);
CANCEL = BlackOutline(gettext_noop("CANCEL"), 25, &yellow);
@@ -844,9 +881,7 @@
Text.y = screen->h / 3;
Text.w = Text.h = 0;
Text.x = screen->w /2;
- //SDL_BlitSurface(NewWordlist, NULL, screen, &Text);
-
SDL_UpdateRect(screen, 0, 0, 0, 0);
/*Main Loop*/
@@ -865,18 +900,22 @@
{
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?
- save = 1;
- stop = 1;
- break;
+
+ if (len != 0)
+ {
+ fprintf(stderr, "Save the wordlist\n");
+ save = 1;
+ stop = 1;
+ }
+ else
+ {
+ fprintf(stderr, "Word needs an actual length\n");
+ }
}
if (inRect(CANCEL_rect, event.button.x, event.button.y))
{
- fprintf(stderr, "Check One\n");
+
stop = 1;
break;
}
@@ -921,15 +960,12 @@
{
fprintf(stderr, "Save the wordlist\n");
save = 1;
- i = 0;
stop = 1;
break;
}
else
{
fprintf(stderr, "Word needs an actual length\n");
- i = 0;
- //stop = 1;
break;
}
i = 0;
More information about the Tux4kids-commits
mailing list