diff options
author | Bruno Coudoin <bcoudoin@src.gnome.org> | 2006-10-21 23:20:49 (GMT) |
---|---|---|
committer | Bruno Coudoin <bcoudoin@src.gnome.org> | 2006-10-21 23:20:49 (GMT) |
commit | 8db3d70fc419ea0e59d9a2469f2da30bd29b9c6a (patch) | |
tree | bf0af40f01c61d444f870826ec162e8729f5d45b | |
parent | 8925dc92e49e1b201c26865771e545fc307a1929 (diff) |
*** RELEASE 8.2BETA1 ***
- fixed all boards/Makefile.am, the transformation for i18n was not good enough
and was breaking the game missing_letter.
- added support for py2exe on windows which allow us to create an embedded package
with python, pygtk and pycairo all together
- cleanup in boards/* to replace assert by g_assert and remove uneeded includes.
- fixed awele to run on windows replace font "12x24" by "sans 12"
53 files changed, 664 insertions, 735 deletions
diff --git a/boards/advanced_colors/Makefile.am b/boards/advanced_colors/Makefile.am index 6fa389b..ac93d00 100644 --- a/boards/advanced_colors/Makefile.am +++ b/boards/advanced_colors/Makefile.am @@ -20,7 +20,7 @@ xml_DATA = $(xml_in_files:.xml.in=.xml) # runtime. # $(xml_DATA): %.xml: %.xml.in - sed -e "s/\(\<\)\/*_//g" $< > $@ + sed -e "s/\(<\{1\}\/*\)_/\1/g" $< > $@ CLEANFILES = $(xml_DATA) diff --git a/boards/babymatch/Makefile.am b/boards/babymatch/Makefile.am index 959b9f5..d254c4c 100644 --- a/boards/babymatch/Makefile.am +++ b/boards/babymatch/Makefile.am @@ -18,7 +18,7 @@ xml_DATA = $(xml_in_files:.xml.in=.xml) # runtime. # $(xml_DATA): %.xml: %.xml.in - sed -e "s/\(\<\)\/*_//g" $< > $@ + sed -e "s/\(<\{1\}\/*\)_/\1/g" $< > $@ diff --git a/boards/babyshapes/Makefile.am b/boards/babyshapes/Makefile.am index 3535b44..c075d2f 100644 --- a/boards/babyshapes/Makefile.am +++ b/boards/babyshapes/Makefile.am @@ -18,7 +18,7 @@ xml_DATA = $(xml_in_files:.xml.in=.xml) # runtime. # $(xml_DATA): %.xml: %.xml.in - sed -e "s/\(\<\)\/*_//g" $< > $@ + sed -e "s/\(<\{1\}\/*\)_/\1/g" $< > $@ diff --git a/boards/chronos/Makefile.am b/boards/chronos/Makefile.am index 79857a5..fcc0f28 100644 --- a/boards/chronos/Makefile.am +++ b/boards/chronos/Makefile.am @@ -24,7 +24,7 @@ xml_DATA = $(xml_in_files:.xml.in=.xml) # runtime. # $(xml_DATA): %.xml: %.xml.in - sed -e "s/\(\<\)\/*_//g" $< > $@ + sed -e "s/\(<\{1\}\/*\)_/\1/g" $< > $@ diff --git a/boards/doubleentry/Makefile.am b/boards/doubleentry/Makefile.am index 94c81f3..95151fd 100644 --- a/boards/doubleentry/Makefile.am +++ b/boards/doubleentry/Makefile.am @@ -14,7 +14,7 @@ xml_DATA = $(xml_in_files:.xml.in=.xml) # runtime. # $(xml_DATA): %.xml: %.xml.in - sed -e "s/\(\<\)\/*_//g" $< > $@ + sed -e "s/\(<\{1\}\/*\)_/\1/g" $< > $@ diff --git a/boards/geography/Makefile.am b/boards/geography/Makefile.am index c360bd8..afa06f0 100644 --- a/boards/geography/Makefile.am +++ b/boards/geography/Makefile.am @@ -26,7 +26,7 @@ xml_DATA = $(xml_in_files:.xml.in=.xml) # runtime. # $(xml_DATA): %.xml: %.xml.in - sed -e "s/\(\<\)\/*_//g" $< > $@ + sed -e "s/\(<\{1\}\/*\)_/\1/g" $< > $@ diff --git a/boards/imageid/Makefile.am b/boards/imageid/Makefile.am index d133977..89c6987 100644 --- a/boards/imageid/Makefile.am +++ b/boards/imageid/Makefile.am @@ -12,6 +12,6 @@ xml_DATA = $(xml_in_files:.xml.in=.xml) # runtime. # $(xml_DATA): %.xml: %.xml.in - sed -e "s/\(\<\)\/*_//g" $< > $@ + sed -e "s/\(<\{1\}\/*\)_/\1/g" $< > $@ CLEANFILES = $(xml_DATA) diff --git a/boards/imagename/Makefile.am b/boards/imagename/Makefile.am index 32acb22..d16ee4a 100644 --- a/boards/imagename/Makefile.am +++ b/boards/imagename/Makefile.am @@ -17,7 +17,7 @@ xml_DATA = $(xml_in_files:.xml.in=.xml) # runtime. # $(xml_DATA): %.xml: %.xml.in - sed -e "s/\(\<\)\/*_//g" $< > $@ + sed -e "s/\(<\{1\}\/*\)_/\1/g" $< > $@ diff --git a/boards/missing_letter/Makefile.am b/boards/missing_letter/Makefile.am index cf7754f..4bffd44 100644 --- a/boards/missing_letter/Makefile.am +++ b/boards/missing_letter/Makefile.am @@ -12,7 +12,7 @@ xml_DATA = $(xml_in_files:.xml.in=.xml) # runtime. # $(xml_DATA): %.xml: %.xml.in - sed -e "s/\(\<\)\/*_//g" $< > $@ + sed -e "s/\(<\{1\}\/*\)_/\1/g" $< > $@ CLEANFILES = $(xml_DATA) diff --git a/boards/paintings/Makefile.am b/boards/paintings/Makefile.am index 4f86e92..13fd083 100644 --- a/boards/paintings/Makefile.am +++ b/boards/paintings/Makefile.am @@ -18,7 +18,7 @@ xml_DATA = $(xml_in_files:.xml.in=.xml) # runtime. # $(xml_DATA): %.xml: %.xml.in - sed -e "s/\(\<\)\/*_//g" $< > $@ + sed -e "s/\(<\{1\}\/*\)_/\1/g" $< > $@ diff --git a/boards/read_colors/Makefile.am b/boards/read_colors/Makefile.am index 4cb80d2..3c1264a 100644 --- a/boards/read_colors/Makefile.am +++ b/boards/read_colors/Makefile.am @@ -11,6 +11,6 @@ xml_DATA = $(xml_in_files:.xml.in=.xml) # runtime. # $(xml_DATA): %.xml: %.xml.in - sed -e "s/\(\<\)\/*_//g" $< > $@ + sed -e "s/\(<\{1\}\/*\)_/\1/g" $< > $@ CLEANFILES = $(xml_DATA) diff --git a/boards/scales/Makefile.am b/boards/scales/Makefile.am index da44df8..fc8a7c9 100644 --- a/boards/scales/Makefile.am +++ b/boards/scales/Makefile.am @@ -29,7 +29,7 @@ xml_DATA = $(xml_in_files:.xml.in=.xml) # runtime. # $(xml_DATA): %.xml: %.xml.in - sed -e "s/\(\<\)\/*_//g" $< > $@ + sed -e "s/\(<\{1\}\/*\)_/\1/g" $< > $@ CLEANFILES = $(xml_DATA) diff --git a/src/boards/advanced_colors.c b/src/boards/advanced_colors.c index c41eb60..fa9a581 100644 --- a/src/boards/advanced_colors.c +++ b/src/boards/advanced_colors.c @@ -17,8 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <assert.h> #include <string.h> /* libxml includes */ @@ -429,7 +427,7 @@ static void update_clock() { static void highlight_selected(int c) { int x, y; - assert(c>=0 && c<8); + g_assert(c>=0 && c<8); x = (X[c*2] + X[c*2+1]) /2; y = (Y[(int)(c/4)*2] + Y[(int)(c/4)*2+1]) /2; @@ -451,7 +449,7 @@ static void init_xml() gcomprisBoard->boarddir, gcomprisBoard->level); - assert(read_xml_file(filename)== TRUE); + g_assert(read_xml_file(filename)== TRUE); g_free(filename); } diff --git a/src/boards/algebra_guesscount.c b/src/boards/algebra_guesscount.c index d5efedf..726e636 100644 --- a/src/boards/algebra_guesscount.c +++ b/src/boards/algebra_guesscount.c @@ -17,14 +17,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> - #include "gcompris/gcompris.h" -#define SOUNDLISTFILE PACKAGE - static GcomprisBoard *gcomprisBoard = NULL; static gboolean board_paused = TRUE; @@ -67,7 +61,10 @@ static void destroy_board(void); #define HORIZONTAL_SEPARATION 20 #define VERTICAL_SEPARATION 20 -static char* background_images[] = {"gcompris/animals/tiger1_by_Ralf_Schmode","gcompris/animals/tigerdrink001.jpg","gcompris/animals/tigercub003.jpg", "gcompris/animals/tigerplay001.jpg"}; +static char* background_images[] = {"gcompris/animals/tiger1_by_Ralf_Schmode", + "gcompris/animals/tigerdrink001.jpg", + "gcompris/animals/tigercub003.jpg", + "gcompris/animals/tigerplay001.jpg"}; static const char oper_values[] = {'+', '-', 'x', ':', '='}; static const char *oper_images[] = {"plus", "minus", "by", "div", "equal"}; static const int num_values[] = {1,2,3,4,5,6,7,8,9,10,25,50,100}; @@ -285,11 +282,11 @@ static int token_result() { if (token_count < 2) return NO_RESULT; - assert(ptr_token_selected[0]->isNumber); + g_assert(ptr_token_selected[0]->isNumber); result = num_values[ptr_token_selected[0]->num]; for (i=2; i<token_count; i+=2) { - assert(!ptr_token_selected[i-1]->isNumber); + g_assert(!ptr_token_selected[i-1]->isNumber); switch (ptr_token_selected[i-1]->oper) { case '+' : result += num_values[ptr_token_selected[i]->num]; break; @@ -354,7 +351,7 @@ static int generate_numbers() { r = 2 + minus + divide; switch (RAND(1,r)) { - case 1 : + case 1 : answer_oper[i] = '+'; result += num_values[answer_num_index[i+1]]; break; @@ -372,21 +369,21 @@ static int generate_numbers() { if (minus) { answer_oper[i] = '-'; result -= num_values[answer_num_index[i+1]]; - assert(result >= 0); + g_assert(result >= 0); } else { answer_oper[i] = ':'; - assert(result%num_values[answer_num_index[i+1]] == 0); + g_assert(result%num_values[answer_num_index[i+1]] == 0); result /= num_values[answer_num_index[i+1]]; } break; - case 4 : + case 4 : if ( RAND(0,1) == 0) { answer_oper[i] = '-'; result -= num_values[answer_num_index[i+1]]; - assert(result >= 0); + g_assert(result >= 0); } else { answer_oper[i] = ':'; - assert(result%num_values[answer_num_index[i+1]] == 0); + g_assert(result%num_values[answer_num_index[i+1]] == 0); result /= num_values[answer_num_index[i+1]]; } break; @@ -567,7 +564,7 @@ static void process_time(){ static int oper_char_to_pixmap_index(char oper) { int i; - assert(oper == '+' || oper == '-' || oper == 'x' || oper == ':' || oper == '='); + g_assert(oper == '+' || oper == '-' || oper == 'x' || oper == ':' || oper == '='); for (i=0; i<5; i++) if (oper_values[i] == oper) @@ -661,7 +658,7 @@ static gint item_event_num(GnomeCanvasItem *item, GdkEvent *event, gpointer data // update result text items if (token_count != 1 && token_count % 2 == 1) { sprintf(str,"%d",token_result()); - + gnome_canvas_item_set(calcul_line_item[token_count-3], "text", str, NULL); gnome_canvas_item_set(calcul_line_item_back[token_count-3], "text", str, NULL); diff --git a/src/boards/awele.c b/src/boards/awele.c index 66a3c07..574fc90 100644 --- a/src/boards/awele.c +++ b/src/boards/awele.c @@ -1,15 +1,15 @@ /* * gcompris - awele.c Copyright (C) 2005 Frederic Mazzarol This program is - * free software; you can redistribute it and/or modify it under the terms + * free software; you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any * later version. This program is distributed in the hope that it will * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program; if not, + * copy of the GNU General Public License along with this program; if not, * write to the Free Software Foundation, Inc., 59 Temple Place, Suite - * 330, Boston, MA 02111-1307 USA + * 330, Boston, MA 02111-1307 USA */ #include "gcompris/gcompris.h" @@ -52,7 +52,7 @@ static GcomprisAnimation *animation; static GcomprisAnimCanvasItem *anim_item; /* - * Description of this plugin + * Description of this plugin */ static BoardPlugin menu_bp = { NULL, @@ -160,7 +160,7 @@ start_board (GcomprisBoard * agcomprisBoard) } /* - * ======================================= + * ======================================= */ static void end_board () @@ -182,7 +182,7 @@ is_our_board (GcomprisBoard * gcomprisBoard) if (g_strcasecmp (gcomprisBoard->type, "awele") == 0) { /* - * Set the plugin entry + * Set the plugin entry */ gcomprisBoard->plugin = &menu_bp; @@ -225,7 +225,7 @@ set_level (guint level) } } awele_next_level(); - + } } @@ -233,7 +233,7 @@ set_level (guint level) /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ /* - * set initial values for the next level + * set initial values for the next level */ static void awele_next_level () @@ -252,10 +252,10 @@ awele_next_level () computer_turn = FALSE; /* - * Create the level + * Create the level */ awele_create_item (gnome_canvas_root (gcomprisBoard->canvas)); - + if ((gcomprisBoard->level % 2) ==0){ computer_turn = TRUE; staticAwale->player = HUMAN; @@ -272,10 +272,10 @@ awele_next_level () } /* - * ==================================== + * ==================================== */ /* - * Destroy all the items + * Destroy all the items */ static void awele_destroy_all_items () @@ -302,7 +302,7 @@ awele_destroy_all_items () } /* - * ==================================== + * ==================================== */ static GnomeCanvasItem * awele_create_item (GnomeCanvasGroup * parent) @@ -323,7 +323,7 @@ awele_create_item (GnomeCanvasGroup * parent) (double) 0, "y", (double) 0, NULL)); /* - * Load the cute frame + * Load the cute frame */ pixmap = gc_pixmap_load ("awele/awele_frame.png"); @@ -413,7 +413,7 @@ awele_create_item (GnomeCanvasGroup * parent) graphsElt = (GRAPHICS_ELT *) g_malloc (sizeof (GRAPHICS_ELT)); /* - * Boucle pour creer et positionner les boutons qui serviront + * Boucle pour creer et positionner les boutons qui serviront * a selectionner la case a jouer */ for (i = 0; i < NBHOLE / 2; i++) @@ -493,11 +493,11 @@ awele_create_item (GnomeCanvasGroup * parent) graphsElt->nbBeansHole[i] = gnome_canvas_item_new (boardRootItem, gnome_canvas_text_get_type (), - "text", buffer, "font", - "12x24", "size", 14000, "x", - (double) (caseCoord[i] + 45), - "y", - (double) ((i < 6) ? 378 : 94), + "text", buffer, + "font", "sans 12", + "size", 14000, + "x", (double) (caseCoord[i] + 45), + "y", (double) ((i < 6) ? 378 : 94), "fill_color", "black", NULL); } @@ -518,7 +518,7 @@ awele_create_item (GnomeCanvasGroup * parent) (), "text", buffer, "font", - "12x24", + "sans 12", "size", 20000, "x", (double) x1, @@ -551,7 +551,7 @@ awele_create_item (GnomeCanvasGroup * parent) graphsElt->msg = gnome_canvas_item_new (boardRootItem, gnome_canvas_text_get_type (), "text", _("Choose a house"), - "font", "12x24", + "font", "sans 12", "size", 20000, "x", (double) 400, "y", (double) 500, @@ -564,33 +564,33 @@ awele_create_item (GnomeCanvasGroup * parent) /* - * ==================================== + * ==================================== */ static void game_won () { if (sublevel_finished){ gcomprisBoard->sublevel++; - + if (gcomprisBoard->sublevel > gcomprisBoard->number_of_sublevel) { /* - * Try the next level + * Try the next level */ gcomprisBoard->sublevel = 1; gcomprisBoard->level++; if (gcomprisBoard->level > gcomprisBoard->maxlevel) { // the - // current + // current // board // is - // finished + // finished // : bail // out gc_bonus_end_display (BOARD_FINISHED_RANDOM); return; } - + } } sublevel_finished = FALSE; @@ -612,7 +612,7 @@ initBoardGraphics (GRAPHICS_ELT * graphsElt) //if (graphsElt->ptBeansHoleLink != NULL) - // free(graphsElt->ptBeansHoleLink); + // free(graphsElt->ptBeansHoleLink); graphsElt->ptBeansHoleLink = (BEANHOLE_LINK *) malloc (NBTOTALBEAN * @@ -687,7 +687,7 @@ static gboolean to_computer(gpointer data) gc_bonus_display(TRUE, BONUS_FLOWER); } } else { - /* computer can't play. Why? human is hungry and i cannot give it + /* computer can't play. Why? human is hungry and i cannot give it to eat */ /* if human has 24 beans, it's draw (human win in gcompris) */ /* if not, all staying are captured by computer and computer win */ @@ -695,7 +695,7 @@ static gboolean to_computer(gpointer data) sublevel_finished = (staticAwale->CapturedBeans[HUMAN] == 24); gc_bonus_display(sublevel_finished, BONUS_FLOWER); } - + timeout = 0; return FALSE; } @@ -741,7 +741,7 @@ buttonClick (GtkWidget * item, GdkEvent * event, gpointer data) "pixbuf", graphsElt->pixbufButtonClicked[numeroCase], "y", (double) Y_BOUTONS + 3, NULL); - + g_object_set (graphsElt->msg, "text", "", NULL); AWALE *tmpaw = moveAwale (numeroCase, staticAwale); @@ -765,7 +765,7 @@ buttonClick (GtkWidget * item, GdkEvent * event, gpointer data) animation ); } } - + break; case GDK_BUTTON_RELEASE: g_object_set (GTK_OBJECT @@ -797,15 +797,15 @@ static BEANHOLE_LINK * updateNbBeans (int alpha) { - char buffer[3]; //Manipulation chaines de caracteres + char buffer[3]; //Manipulation chaines de caracteres int i, j, k, idxTabBeans = 0; //Compteur Boucle Manipulation Elements graphiques static short int nbActiveBean = NBTOTALBEAN; //nbre graine restant sur plateau static short int nbOldActiveBean; //nbre graine restant sur plateau au tour precedent BEANHOLE_LINK *ptBeansHoleLink = NULL; //pointeur sur structures stockant les item graines et la case dans laquelle elles se trouvent. - + /** - * Sauvegarde du nombre de graines restantes sur le plateau de jeu - * pour le prochain appel a la fonction. + * Sauvegarde du nombre de graines restantes sur le plateau de jeu + * pour le prochain appel a la fonction. * Mise a jour de nbActiveBean avec nouvelle configuration du plateau de jeu. */ if (alpha) @@ -816,11 +816,11 @@ updateNbBeans (int alpha) { nbOldActiveBean = nbActiveBean; } - + nbActiveBean = NBTOTALBEAN - (staticAwale->CapturedBeans[HUMAN] + staticAwale->CapturedBeans[COMPUTER]); - + /** * Destruction d'autant d'elements graphiques graines * qu'il y a eu de captures pdt ce tour de jeu @@ -830,21 +830,21 @@ updateNbBeans (int alpha) { gtk_object_destroy (GTK_OBJECT (ptBeansHoleLink->beanPixbuf)); } - - + + /** - * Allocation d'un nouvel espace memoire stockant les item graines - * et la case dans laquelle elles se trouvent. Puis liberation de la fin de + * Allocation d'un nouvel espace memoire stockant les item graines + * et la case dans laquelle elles se trouvent. Puis liberation de la fin de * l'ancien espace memoire. */ - + ptBeansHoleLink = (BEANHOLE_LINK *) realloc (graphsElt->ptBeansHoleLink, nbActiveBean * sizeof (BEANHOLE_LINK)); - + /** - * Pour chaque case du plateau, mise a jour du nbre de graines qu'elle contient. + * Pour chaque case du plateau, mise a jour du nbre de graines qu'elle contient. * Et pour chaque graine de cette case, deplacement d'un element graphique type graine * dans cette case. Et mise a jour de l'information hole dans la structure BEANHOLE_LINK. */ @@ -852,14 +852,14 @@ updateNbBeans (int alpha) { sprintf (buffer, "%d", staticAwale->board[i]); gnome_canvas_item_set (graphsElt->nbBeansHole[i], "text", buffer, NULL); - + for (j = 0; j < staticAwale->board[i] && idxTabBeans < nbActiveBean; j++, idxTabBeans++) { - + k = 0 + rand () % 4; - + gnome_canvas_item_set (ptBeansHoleLink[idxTabBeans]. beanPixbuf, "x", (double) caseCoord[i] + @@ -867,16 +867,16 @@ updateNbBeans (int alpha) (double) (((i < 6) ? 260 : 130) + rand () % 60), NULL); - + ptBeansHoleLink[idxTabBeans].hole = i; } - + } - + /** * Renvoi du pointeur sur la zone memoire retaillee (n'a probablement pas change d'adresse). */ - + graphsElt->ptBeansHoleLink = ptBeansHoleLink; return ptBeansHoleLink; } @@ -900,11 +900,11 @@ updateCapturedBeans () sprintf (buffer, "%d", staticAwale->CapturedBeans[i]); g_object_set (graphsElt->Captures[i], "text", buffer, NULL); if (staticAwale->CapturedBeans[i] > 24) - { + { gamewon = TRUE; sublevel_finished = (i==0); gc_bonus_display(sublevel_finished, BONUS_FLOWER); - } + } } } diff --git a/src/boards/canal_lock.c b/src/boards/canal_lock.c index 5c8f305..9427624 100644 --- a/src/boards/canal_lock.c +++ b/src/boards/canal_lock.c @@ -17,10 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> - #include "gcompris/gcompris.h" #define SOUNDLISTFILE PACKAGE @@ -276,7 +272,7 @@ static GnomeCanvasItem *canal_lock_create_item(GnomeCanvasGroup *parent) tuxboat_item = gnome_canvas_item_new (boardRootItem, gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, + "pixbuf", pixmap, "x", (double) (LEFT_CANAL_WIDTH - gdk_pixbuf_get_width(pixmap)) / 2, "y", (double) BASE_LINE - LEFT_CANAL_HEIGHT - gdk_pixbuf_get_height(pixmap)*0.9, NULL); @@ -406,7 +402,7 @@ static GnomeCanvasItem *canal_lock_create_item(GnomeCanvasGroup *parent) NULL); /* And to finish, the 2 canal locks */ - canallock_left_item = + canallock_left_item = gnome_canvas_item_new (boardRootItem, gnome_canvas_rect_get_type (), "x1", (double) LEFT_CANAL_WIDTH + MIDDLE_CANAL_WIDTH * 0.1, @@ -420,7 +416,7 @@ static GnomeCanvasItem *canal_lock_create_item(GnomeCanvasGroup *parent) (GtkSignalFunc) item_event, NULL); - canallock_right_item = + canallock_right_item = gnome_canvas_item_new (boardRootItem, gnome_canvas_rect_get_type (), "x1", (double) LEFT_CANAL_WIDTH + MIDDLE_CANAL_WIDTH * 0.9, @@ -498,7 +494,7 @@ static void move_boat() return; } - gnome_canvas_item_get_bounds(tuxboat_item, &timer_item_x1, &timer_item_y1, + gnome_canvas_item_get_bounds(tuxboat_item, &timer_item_x1, &timer_item_y1, &timer_item_x2, &timer_item_y2); timer_item = tuxboat_item; @@ -527,14 +523,14 @@ static void update_water() lock_water_low = !lock_water_low; y1 = BASE_LINE - RIGHT_CANAL_HEIGHT; } - else + else { /* The water level is correct */ animation = FALSE; return; } - gnome_canvas_item_get_bounds(canal_middle_item, &timer_item_x1, &timer_item_y1, + gnome_canvas_item_get_bounds(canal_middle_item, &timer_item_x1, &timer_item_y1, &timer_item_x2, &timer_item_y2); timer_item = canal_middle_item; @@ -560,7 +556,7 @@ static void toggle_lock(GnomeCanvasItem *item) return; animation = TRUE; - gnome_canvas_item_get_bounds(item, &timer_item_x1, &timer_item_y1, + gnome_canvas_item_get_bounds(item, &timer_item_x1, &timer_item_y1, &timer_item_x2, &timer_item_y2); if(item == lock_left_item) @@ -608,7 +604,7 @@ static void toggle_lock(GnomeCanvasItem *item) /* ==================================== */ -static gboolean animate_step() +static gboolean animate_step() { if(!gcomprisBoard) @@ -618,12 +614,12 @@ static gboolean animate_step() timer_item_y1 += timer_step_y1; if(GNOME_IS_CANVAS_PIXBUF(timer_item)) - gnome_canvas_item_set(timer_item, + gnome_canvas_item_set(timer_item, "x", timer_item_x1, "y", timer_item_y1, NULL); else if(GNOME_IS_CANVAS_RECT(timer_item)) - gnome_canvas_item_set(timer_item, + gnome_canvas_item_set(timer_item, "x1", timer_item_x1, "y1", timer_item_y1, NULL); @@ -633,10 +629,10 @@ static gboolean animate_step() { double item_x1, item_y1, item_x2, item_y2; - gnome_canvas_item_get_bounds(tuxboat_item, &item_x1, &item_y1, + gnome_canvas_item_get_bounds(tuxboat_item, &item_x1, &item_y1, &item_x2, &item_y2); - gnome_canvas_item_set(tuxboat_item, + gnome_canvas_item_set(tuxboat_item, "y", item_y1 + timer_step_y1, NULL); } @@ -668,7 +664,7 @@ static gboolean animate_step() static void hightlight(GnomeCanvasItem *item, gboolean status) { guint color = 0; - + /* This is an image, not a rectangle */ if(item == tuxboat_item) return; @@ -703,7 +699,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) if(board_paused) return FALSE; - switch (event->type) + switch (event->type) { case GDK_ENTER_NOTIFY: hightlight(item, TRUE); @@ -716,7 +712,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) /* If there is already an animation do nothing */ if(animation) return FALSE; - + if(item == lock_left_item) { if(lock_water_low && canallock_right_up) diff --git a/src/boards/chess.c b/src/boards/chess.c index 8bb8625..20403f6 100644 --- a/src/boards/chess.c +++ b/src/boards/chess.c @@ -17,10 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> - #include <stdarg.h> #include <stdio.h> #include <stdlib.h> diff --git a/src/boards/click_on_letter.c b/src/boards/click_on_letter.c index 2c004d5..a5a2e0b 100644 --- a/src/boards/click_on_letter.c +++ b/src/boards/click_on_letter.c @@ -17,9 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> #include <glib.h> #include <string.h> @@ -265,7 +262,7 @@ static gboolean sounds_are_fine() /* TRANSLATORS: Put here the alphabet in your language */ alphabet=_("abcdefghijklmnopqrstuvwxyz"); - assert(g_utf8_validate(alphabet, -1, NULL)); // require by all utf8-functions + g_assert(g_utf8_validate(alphabet, -1, NULL)); // require by all utf8-functions gchar *letter = g_new0(gchar, 8); g_unichar_to_utf8(g_utf8_get_char(alphabet), letter); @@ -353,7 +350,7 @@ static GnomeCanvasItem *click_on_letter_create_item(GnomeCanvasGroup *parent) int numbers[number_of_letters]; gchar *letters[number_of_letters]; - assert(number_of_letters<=length_of_aphabet); // because we must set unique letter on every "vagon" + g_assert(number_of_letters<=length_of_aphabet); // because we must set unique letter on every "vagon" for (i=0;i<number_of_letters;i++){ numbers[i]=((int)(((float)length_of_aphabet)*rand()/(RAND_MAX+1.0))); @@ -391,7 +388,7 @@ static GnomeCanvasItem *click_on_letter_create_item(GnomeCanvasGroup *parent) /* */ right_position = ((int)(((float)number_of_letters)*rand()/(RAND_MAX+1.0))); - assert(right_position >= 0 && right_position < number_of_letters); + g_assert(right_position >= 0 && right_position < number_of_letters); right_letter = g_utf8_strdown(letters[right_position],-1); repeat(); diff --git a/src/boards/colors.c b/src/boards/colors.c index 474a174..8331b29 100644 --- a/src/boards/colors.c +++ b/src/boards/colors.c @@ -17,9 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <assert.h> - #include "gcompris/gcompris.h" #define SOUNDLISTFILE PACKAGE @@ -98,7 +95,7 @@ static BoardPlugin menu_bp = * * =====================================================================*/ GET_BPLUGIN_INFO(colors) - + /* ======================= */ /* = config_start = */ @@ -113,7 +110,7 @@ static void save_table (gpointer key, { gc_db_set_board_conf ( profile_conf, board_conf, - (gchar *) key, + (gchar *) key, (gchar *) value); } @@ -127,10 +124,10 @@ conf_ok(GHashTable *table) } g_hash_table_foreach(table, (GHFunc) save_table, NULL); - + if (gcomprisBoard){ GHashTable *config = gc_db_get_board_conf(); - + if (profile_conf) config = gc_db_get_board_conf(); else @@ -138,17 +135,17 @@ conf_ok(GHashTable *table) gc_locale_reset(); gc_locale_set(g_hash_table_lookup(config, "locale_sound")); - + if (profile_conf) g_hash_table_destroy(config); colors_next_level(); pause_board(FALSE); - + } board_conf = NULL; - profile_conf = NULL; + profile_conf = NULL; } static void @@ -162,7 +159,7 @@ colors_config_start(GcomprisBoard *agcomprisBoard, if (gcomprisBoard) pause_board(TRUE); - + label = g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", agcomprisBoard->name, aProfile ? aProfile->name : ""); @@ -174,7 +171,7 @@ colors_config_start(GcomprisBoard *agcomprisBoard, GHashTable *config = gc_db_get_conf( profile_conf, board_conf); gchar *saved_locale_sound = g_hash_table_lookup( config, "locale_sound"); - + gc_board_config_combo_locales_asset( "Select sound locale", saved_locale_sound, "sounds/$LOCALE/colors/purple.ogg"); @@ -182,11 +179,11 @@ colors_config_start(GcomprisBoard *agcomprisBoard, } - + /* ======================= */ /* = config_stop = */ /* ======================= */ -static void +static void colors_config_stop() { } @@ -219,7 +216,7 @@ static void start_board (GcomprisBoard *agcomprisBoard) { GHashTable *config = gc_db_get_board_conf(); gc_locale_set(g_hash_table_lookup(config, "locale_sound")); - + g_hash_table_destroy(config); gc_sound_pause(); @@ -319,7 +316,7 @@ static void repeat (){ else { str = g_strdup_printf(gettext(colors[GPOINTER_TO_INT(g_list_nth_data(listColors, 0))*2+1])); - + gnome_canvas_item_new (boardRootItem, gnome_canvas_text_get_type (), "text", str, @@ -329,7 +326,7 @@ static void repeat (){ "anchor", GTK_ANCHOR_CENTER, "fill_color", "black", NULL); - + gnome_canvas_item_new (boardRootItem, gnome_canvas_text_get_type (), "text", str, @@ -471,7 +468,7 @@ static gint item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) { static void highlight_selected(int c) { int x, y; - assert(c>=0 && c<=9); + g_assert(c>=0 && c<=9); if (c<8) { x = (X[(c%4)*2] + X[(c%4)*2+1]) /2; diff --git a/src/boards/crane.c b/src/boards/crane.c index 43b40e0..5db70d1 100644 --- a/src/boards/crane.c +++ b/src/boards/crane.c @@ -17,11 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> #include <string.h> -#include <unistd.h> #include "gcompris/gcompris.h" @@ -209,7 +205,7 @@ static void start_board (GcomprisBoard *agcomprisBoard) img); g_free(img); - + crane_next_level(); gamewon = FALSE; @@ -236,7 +232,7 @@ static void end_board () { static void set_level (guint level) { if (gcomprisBoard != NULL) { - + gcomprisBoard->level = level; gcomprisBoard->sublevel = 1; crane_next_level(); @@ -271,7 +267,7 @@ static void crane_next_level() { /* Try the next level */ crane_create_item(); } - + /* ==================================== */ /* Destroy all the items */ static void crane_destroy_all_items() @@ -441,7 +437,7 @@ static gint arrow_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) { my_move.y = 1; break; } - + // Check if the move doesn't go out of the frame if (is_allowed_move(dx1, dy1, direction)) { @@ -470,7 +466,7 @@ static gint arrow_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) { gamewon = TRUE; timer_id = g_timeout_add (1200, (GtkFunction) bonus, NULL); } - + return FALSE; } @@ -485,7 +481,7 @@ static void draw_arrow() { arrow[0].pixmap = gc_pixmap_load("crane/arrow_down.png"); arrow[0].x = CRANE_BUTTON_DOWN_X; arrow[0].y = CRANE_BUTTON_DOWN_Y; - + arrow[1].pixmap = gc_pixmap_load("crane/arrow_up.png"); arrow[1].x = CRANE_BUTTON_UP_X; arrow[1].y = CRANE_BUTTON_UP_Y; @@ -551,12 +547,12 @@ static void draw_redhands() { "height_set", TRUE, "anchor", GTK_ANCHOR_NW, NULL); - + gdk_pixbuf_unref(pixmap); gnome_canvas_item_hide(red_hands); -} +} // Draw the drak frame (horizontal and vertical lines) that helps positionning elements static void draw_frame(int x, int y) { @@ -699,7 +695,7 @@ void shuffle_list(int list[], int size) { int rand1, rand2, buffer; for (i = 0 ; i < size ; i++) { - + rand1 = RAND(0, size-1); rand2 = RAND(0, size-1); @@ -720,13 +716,13 @@ static void select_item(GnomeCanvasItem *item, int sound) { // Place redhands in (O;O) gnome_canvas_item_get_bounds(red_hands, &dx1, &dy1, &dx2, &dy2); gnome_canvas_item_move(red_hands, -(dx1), -(dy1)); - - // Place redhands 'around' the selected item + + // Place redhands 'around' the selected item gnome_canvas_item_get_bounds(item, &dx1, &dy1, &dx2, &dy2); gnome_canvas_item_move(red_hands, dx1 - 1 , dy1 - 1); gnome_canvas_item_show(red_hands); - + crane_rope->coords[0] = (dx1 + dx2) / 2; crane_rope->coords[1] = CRANE_ROPE_Y; crane_rope->coords[2] = (dx1 + dx2) / 2; diff --git a/src/boards/enumerate.c b/src/boards/enumerate.c index b66a782..f05e604 100644 --- a/src/boards/enumerate.c +++ b/src/boards/enumerate.c @@ -17,9 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> #include <string.h> #include "gcompris/gcompris.h" @@ -201,7 +198,7 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str) case GDK_Mode_switch: case GDK_dead_circumflex: case GDK_Num_Lock: - return FALSE; + return FALSE; case GDK_KP_Enter: case GDK_Return: process_ok(); @@ -211,7 +208,7 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str) sprintf(str, "%c", keyval); item = answer_item[current_focus]; - + if(GNOME_IS_CANVAS_TEXT(item)) { gchar *oldtext; @@ -256,7 +253,7 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str) gnome_canvas_item_set (item, "text", newtext, NULL); - + g_free(oldtext); } @@ -312,7 +309,7 @@ static void enumerate_next_level() number_of_item_type = 2; number_of_item_max = 5; break; - case 3: + case 3: number_of_item_type = 3; number_of_item_max = 5; break; @@ -340,7 +337,7 @@ static void enumerate_next_level() number_of_item_type = 5; number_of_item_max = 10; } - + current_focus = 0; /* Try the next level */ @@ -392,11 +389,11 @@ static GnomeCanvasItem *enumerate_create_item(GnomeCanvasGroup *parent) item = gnome_canvas_item_new (boardRootItem, gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, + "pixbuf", pixmap, "x", (double) x, "y", (double) y, NULL); - + gtk_signal_connect(GTK_OBJECT(item), "event", (GtkSignalFunc) item_event, NULL); } @@ -410,7 +407,7 @@ static GnomeCanvasItem *enumerate_create_item(GnomeCanvasGroup *parent) item = \ gnome_canvas_item_new (boardRootItem, gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap_answer, + "pixbuf", pixmap_answer, "x", (double) ANSWER_X - ANSWER_WIDTH/2, "y", (double) current_y - ANSWER_HEIGHT/2, NULL); @@ -424,7 +421,7 @@ static GnomeCanvasItem *enumerate_create_item(GnomeCanvasGroup *parent) answer_item_focus[i] = \ gnome_canvas_item_new (boardRootItem, gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap_answer, + "pixbuf", pixmap_answer, "x", (double) ANSWER_X - ANSWER_WIDTH/2, "y", (double) current_y - ANSWER_HEIGHT/2, NULL); @@ -434,12 +431,12 @@ static GnomeCanvasItem *enumerate_create_item(GnomeCanvasGroup *parent) item = gnome_canvas_item_new (boardRootItem, gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, + "pixbuf", pixmap, "x", (double) ANSWER_X, "y", (double) current_y, "width", (double) gdk_pixbuf_get_width(pixmap)*ANSWER_HEIGHT/gdk_pixbuf_get_height(pixmap), "height", (double) ANSWER_HEIGHT, - "width_set", TRUE, + "width_set", TRUE, "height_set", TRUE, NULL); @@ -449,7 +446,7 @@ static GnomeCanvasItem *enumerate_create_item(GnomeCanvasGroup *parent) gtk_signal_connect(GTK_OBJECT(item), "event", (GtkSignalFunc) gc_item_focus_event, NULL); - + answer_item[i] = \ gnome_canvas_item_new (boardRootItem, gnome_canvas_text_get_type (), @@ -492,7 +489,7 @@ static gint item_event_focus(GnomeCanvasItem *item, GdkEvent *event, guint index) { - switch (event->type) + switch (event->type) { case GDK_BUTTON_PRESS: gnome_canvas_item_hide(answer_item_focus[current_focus]); @@ -525,20 +522,20 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) return FALSE; - switch (event->type) + switch (event->type) { case GDK_BUTTON_PRESS: - switch(event->button.button) + switch(event->button.button) { case 1: x = item_x; y = item_y; - + gnome_canvas_item_raise_to_top(item); fleur = gdk_cursor_new(GDK_FLEUR); gc_canvas_item_grab(item, - GDK_POINTER_MOTION_MASK | + GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, fleur, event->button.time); @@ -564,11 +561,11 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) break; case GDK_MOTION_NOTIFY: - if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { double x1, x2, y1, y2; - gnome_canvas_item_get_bounds(item, &x1, &y1, &x2, &y2); + gnome_canvas_item_get_bounds(item, &x1, &y1, &x2, &y2); new_x = item_x; new_y = item_y; @@ -588,9 +585,9 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) y = new_y; } break; - + case GDK_BUTTON_RELEASE: - if(dragging) + if(dragging) { gc_canvas_item_ungrab(item, event->button.time); dragging = FALSE; @@ -600,7 +597,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) default: break; } - + return FALSE; } diff --git a/src/boards/erase.c b/src/boards/erase.c index 48ed5b6..5210719 100644 --- a/src/boards/erase.c +++ b/src/boards/erase.c @@ -17,9 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> #include <string.h> #include "gcompris/gcompris.h" @@ -330,7 +327,7 @@ static GnomeCanvasItem *erase_create_item(int layer) GnomeCanvasItem *item = NULL; GdkPixbuf *pixmap[MAX_LAYERS]; - assert(layer<=MAX_LAYERS); + g_assert(layer<=MAX_LAYERS); boardRootItem = GNOME_CANVAS_GROUP( gnome_canvas_item_new (gnome_canvas_root(gcomprisBoard->canvas), diff --git a/src/boards/fifteen.c b/src/boards/fifteen.c index a1afeb9..04646c3 100644 --- a/src/boards/fifteen.c +++ b/src/boards/fifteen.c @@ -273,7 +273,7 @@ static GnomeCanvasItem *fifteen_create_item(GnomeCanvasGroup *parent) case 2: scramble(board, 50); break; - case 3: + case 3: case 4: scramble(board, 100); break; @@ -283,7 +283,7 @@ static GnomeCanvasItem *fifteen_create_item(GnomeCanvasGroup *parent) default: scramble(board, 256); } - + return NULL; } /* ==================================== */ @@ -352,7 +352,6 @@ get_piece_color (int piece) static gint piece_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data) { - GnomeCanvas *canvas; GnomeCanvasItem **board; GnomeCanvasItem *text; int num, pos, newpos; @@ -360,8 +359,7 @@ piece_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data) double dx = 0.0, dy = 0.0; int move; - canvas = GNOME_CANVAS(item->parent); - board = g_object_get_data (G_OBJECT (canvas), "board"); + board = g_object_get_data (G_OBJECT (item->parent), "board"); num = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "piece_num")); pos = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "piece_pos")); text = g_object_get_data (G_OBJECT (item), "text"); diff --git a/src/boards/gletters.c b/src/boards/gletters.c index c23efcc..1ceb498 100644 --- a/src/boards/gletters.c +++ b/src/boards/gletters.c @@ -3,7 +3,7 @@ * Time-stamp: <2006/08/21 23:33:17 bruno> * * Copyright (C) 2000 Bruno Coudoin - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -19,7 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> #include <string.h> #include "gcompris/gcompris.h" @@ -37,7 +36,7 @@ static gint drop_items_id = 0; /* Sublevels are now allocated dynamically * based on the number of chars at that level - * Set DEFAULT_SUBLEVEL to the minimum + * Set DEFAULT_SUBLEVEL to the minimum * number of sublevels you want */ @@ -65,14 +64,14 @@ static float dropRateBase = DROP_RATE_BASE; static float dropRateMult = DROP_RATE_MULT; /* both letters_array and keymap are read in - * dynamically at run-time from files based on + * dynamically at run-time from files based on * user locale */ /* letters_array contains letters you want shown * on each play level * there can be an arbitrary number of levels, - * but there are only graphics to level 9 + * but there are only graphics to level 9 * so that's where we stop */ @@ -80,8 +79,8 @@ static float dropRateMult = DROP_RATE_MULT; static int maxLevel; static char *letters_array[MAXLEVEL]; -/* keymap contains pairs of chars. The first char is - * on the keyboard map, the second is the unichar that +/* keymap contains pairs of chars. The first char is + * on the keyboard map, the second is the unichar that * is also represented by that key. That way, if there is more * than one character represented by a key, the user doesn't * have to use alternate input methods. @@ -174,9 +173,9 @@ static void level_set_score() { l = g_utf8_strlen(letters_array[gcomprisBoard->level-1],-1)/3; gcomprisBoard->number_of_sublevel = (DEFAULT_SUBLEVEL>l?DEFAULT_SUBLEVEL:l); - gc_score_start(SCORESTYLE_NOTE, - gcomprisBoard->width - 220, - gcomprisBoard->height - 50, + gc_score_start(SCORESTYLE_NOTE, + gcomprisBoard->width - 220, + gcomprisBoard->height - 50, gcomprisBoard->number_of_sublevel); gc_bar_set(GC_BAR_CONFIG|GC_BAR_LEVEL); } @@ -226,17 +225,17 @@ int load_default_charset() { /* TRANSLATORS: Put here the numbers in your language */ numbers=_("0123456789"); - assert(g_utf8_validate(numbers,-1,NULL)); // require by all utf8-functions - + g_assert(g_utf8_validate(numbers,-1,NULL)); // require by all utf8-functions + /* TRANSLATORS: Put here the alphabet lowercase in your language */ alphabet_lowercase=_("abcdefghijklmnopqrstuvwxyz"); - assert(g_utf8_validate(alphabet_lowercase,-1,NULL)); // require by all utf8-functions - + g_assert(g_utf8_validate(alphabet_lowercase,-1,NULL)); // require by all utf8-functions + g_warning("Using lowercase %s", alphabet_lowercase); - + /* TRANSLATORS: Put here the alphabet uppercase in your language */ alphabet_uppercase=_("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - assert(g_utf8_validate(alphabet_uppercase,-1,NULL)); // require by all utf8-functions + g_assert(g_utf8_validate(alphabet_uppercase,-1,NULL)); // require by all utf8-functions g_warning("Using uppercase %s", alphabet_uppercase); letters_array[0] = g_strdup(alphabet_uppercase); @@ -244,7 +243,7 @@ int load_default_charset() { alphabet_uppercase, numbers); if (!uppercase_only){ - letters_array[2] = g_strdup(alphabet_lowercase); + letters_array[2] = g_strdup(alphabet_lowercase); letters_array[3] = g_strdup_printf("%s%s", alphabet_lowercase, numbers); @@ -252,12 +251,12 @@ int load_default_charset() { alphabet_lowercase, alphabet_uppercase); letters_array[5] = g_strdup_printf("%s%s%s", - alphabet_lowercase, + alphabet_lowercase, alphabet_uppercase, numbers); } else{ g_warning("Uppercase only is set"); - letters_array[2] = g_strdup(alphabet_uppercase); + letters_array[2] = g_strdup(alphabet_uppercase); letters_array[3] = g_strdup_printf("%s%s", alphabet_uppercase, numbers); @@ -268,7 +267,7 @@ int load_default_charset() { alphabet_uppercase, numbers); } - + keyMapSize = 0; maxLevel = 6; @@ -336,10 +335,10 @@ end_board () gc_score_end(); gletters_destroy_all_items(); g_message("freeing memory"); - for (i = 0; i < maxLevel; i++) + for (i = 0; i < maxLevel; i++) g_free(letters_array[i]); - for (i = 0; i < keyMapSize; i++) + for (i = 0; i < keyMapSize; i++) g_free(keyMap[i]); g_free(keyMap); @@ -376,7 +375,7 @@ gboolean unichar_comp(gpointer key, if (*((gunichar *)key) == *target) return TRUE; - return FALSE; + return FALSE; } gint is_falling_letter(gunichar unichar) @@ -431,7 +430,7 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str) { level_uppercase = 3; /* for 2 (or all) first level don't care abour uppercase/lowercase */ - if ((gcomprisBoard->level < level_uppercase) && + if ((gcomprisBoard->level < level_uppercase) && (is_falling_letter(g_unichar_toupper(c)))){ gc_im_reset(); return TRUE; @@ -439,7 +438,7 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str) { string_passed = g_utf8_next_char (string_passed); } - + list_of_letters[0] = '\0'; /* We have to loop to concat the letters */ @@ -478,7 +477,7 @@ is_our_board (GcomprisBoard *gcomprisBoard) /*-------------------------------------------------------------------------------*/ /* set initial values for the next level */ -static void gletters_next_level() +static void gletters_next_level() { gamewon = FALSE; @@ -506,7 +505,7 @@ static void gletters_move_item(GnomeCanvasItem *item) &y1, &x2, &y2); - + if(y1>gcomprisBoard->height) { item2del_list = g_list_append (item2del_list, item); player_loose(); @@ -534,7 +533,7 @@ static void gletters_destroy_items() { GnomeCanvasItem *item; - while(g_list_length(item2del_list)>0) + while(g_list_length(item2del_list)>0) { item = g_list_nth_data(item2del_list, 0); gletters_destroy_item(item); @@ -547,7 +546,7 @@ static void gletters_destroy_all_items() GnomeCanvasItem *item; if(item_list) - while(g_list_length(item_list)>0) + while(g_list_length(item_list)>0) { item = g_list_nth_data(item_list, 0); gletters_destroy_item(item); @@ -571,7 +570,7 @@ static gint gletters_move_items (GtkWidget *widget, gpointer data) /* Destroy items that falls out of the canvas */ gletters_destroy_items(); - dummy_id = gtk_timeout_add (speed, + dummy_id = gtk_timeout_add (speed, (GtkFunction) gletters_move_items, NULL); return(FALSE); @@ -599,7 +598,7 @@ static GnomeCanvasItem *gletters_create_item(GnomeCanvasGroup *parent) } /* Beware, since we put the letters in a hash table, we do not allow the same - * letter to be displayed two times + * letter to be displayed two times */ g_warning("dump: %d, %s\n",gcomprisBoard->level,letters_array[gcomprisBoard->level-1]); @@ -688,7 +687,7 @@ static GnomeCanvasItem *gletters_create_item(GnomeCanvasGroup *parent) return (item); } -static void gletters_add_new_item() +static void gletters_add_new_item() { gletters_create_item(gnome_canvas_root(gcomprisBoard->canvas)); } @@ -769,7 +768,7 @@ item_find_by_title (const gunichar *title) { if (!letters_table) return NULL; - + return g_hash_table_lookup (letters_table, title); } @@ -792,7 +791,7 @@ static void save_table (gpointer key, { gc_db_set_board_conf ( profile_conf, board_conf, - (gchar *) key, + (gchar *) key, (gchar *) value); } @@ -805,9 +804,9 @@ static void conf_ok(GHashTable *table) pause_board(FALSE); return; } - + g_hash_table_foreach(table, save_table, NULL); - + if (gcomprisBoard){ gc_locale_reset(); @@ -817,38 +816,38 @@ static void conf_ok(GHashTable *table) config = gc_db_get_board_conf(); else config = 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 && (strcmp(up_init_str, "True")==0)) uppercase_only = TRUE; else uppercase_only = FALSE; gchar *control_sound = g_hash_table_lookup( config, "with_sound"); - + if (control_sound && strcmp(g_hash_table_lookup( config, "with_sound"),"True")==0) with_sound = TRUE; else with_sound = FALSE; - + if (profile_conf) g_hash_table_destroy(config); - load_default_charset(); - + load_default_charset(); + level_set_score(); gletters_next_level(); - + pause_board(FALSE); - + } board_conf = NULL; profile_conf = NULL; - + } static void @@ -862,7 +861,7 @@ gletter_config_start(GcomprisBoard *agcomprisBoard, if (gcomprisBoard) pause_board(TRUE); - + label = g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", agcomprisBoard->name, aProfile ? aProfile->name : ""); @@ -874,7 +873,7 @@ gletter_config_start(GcomprisBoard *agcomprisBoard, GHashTable *config = gc_db_get_conf( profile_conf, board_conf); gchar *locale = g_hash_table_lookup( config, "locale"); - + gc_board_config_combo_locales( locale); gboolean up_init = FALSE; @@ -891,22 +890,22 @@ gletter_config_start(GcomprisBoard *agcomprisBoard, with_sound = TRUE; else with_sound = FALSE; - + gc_board_config_boolean_box("Enable sounds", "with_sound", with_sound); - + gc_board_conf_separator(); gc_board_config_boolean_box(_("Uppercase only text"), "uppercase_only", up_init); - + } - + /* ======================= */ /* = config_stop = */ /* ======================= */ -static void +static void gletter_config_stop() { } diff --git a/src/boards/hanoi.c b/src/boards/hanoi.c index d3be5c0..60873c6 100644 --- a/src/boards/hanoi.c +++ b/src/boards/hanoi.c @@ -17,10 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> - #include "gcompris/gcompris.h" #define SOUNDLISTFILE PACKAGE @@ -71,7 +67,7 @@ static int number_of_item_y = 0; static int item_width; static int item_height; -static guint colorlist [] = +static guint colorlist [] = { 0x00FFFFFF, 0xA00000FF, @@ -226,7 +222,7 @@ static void hanoi_next_level() number_of_item_x = 4; number_of_item_y = 5; break; - case 3: + case 3: number_of_item_x = 5; number_of_item_y = 6; case 4: @@ -245,7 +241,7 @@ static void hanoi_next_level() number_of_item_x = 5; number_of_item_y = 7; } - + /* Try the next level */ hanoi_create_item(gnome_canvas_root(gcomprisBoard->canvas)); @@ -259,7 +255,7 @@ static void hanoi_destroy_all_items() if(boardRootItem!=NULL) { gtk_object_destroy (GTK_OBJECT(boardRootItem)); - + /* Cleanup our memory structure */ for(i=0; i<(number_of_item_x+2); i++) { @@ -283,7 +279,7 @@ static void dump_solution() { for(j=0; j<number_of_item_y; j++) { - g_warning("(%d,%d=%2d/%d) ", position[i][j]->i, position[i][j]->j, position[i][j]->color, + g_warning("(%d,%d=%2d/%d) ", position[i][j]->i, position[i][j]->j, position[i][j]->color, position[i][j]->on_top); } g_warning("\n"); @@ -309,7 +305,7 @@ static GnomeCanvasItem *hanoi_create_item(GnomeCanvasGroup *parent) GnomeCanvasPathDef *path; guint w; GdkPixbuf *pixmap = NULL; - + boardRootItem = GNOME_CANVAS_GROUP( gnome_canvas_item_new (gnome_canvas_root(gcomprisBoard->canvas), gnome_canvas_group_get_type (), @@ -321,7 +317,7 @@ static GnomeCanvasItem *hanoi_create_item(GnomeCanvasGroup *parent) if(pixmap) { gnome_canvas_item_new (boardRootItem, gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, + "pixbuf", pixmap, "x", (double)BOARDWIDTH/2, "y", (double)BOARDHEIGHT - 35, "width", (double) BOARDWIDTH - 20, @@ -378,7 +374,7 @@ static GnomeCanvasItem *hanoi_create_item(GnomeCanvasGroup *parent) guint color = (guint)RAND(0, NUMBER_OF_COLOR-1); position[number_of_item_x+1][i]->color = color; used_colors[color] = TRUE; - + } /* Randomly place the solution */ @@ -501,7 +497,7 @@ static GnomeCanvasItem *hanoi_create_item(GnomeCanvasGroup *parent) item_width * i + item_width/2, baseline + w + 10, item_width * i + item_width/2 - w, baseline); gnome_canvas_path_def_closepath_current (path); - + item = gnome_canvas_item_new (boardRootItem, GNOME_TYPE_CANVAS_SHAPE, "fill_color_rgba", 0x20FF30FF, @@ -616,12 +612,12 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) if(!data->on_top) return FALSE; - + item_x = event->button.x; item_y = event->button.y; gnome_canvas_item_w2i(item->parent, &item_x, &item_y); - - switch (event->type) + + switch (event->type) { case GDK_ENTER_NOTIFY: gnome_canvas_item_set(item, @@ -636,19 +632,19 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) NULL); break; case GDK_BUTTON_PRESS: - switch(event->button.button) + switch(event->button.button) { case 1: - + x = item_x; y = item_y; - + gnome_canvas_item_raise_to_top(data->item); gnome_canvas_item_raise_to_top(data->item_text); - + fleur = gdk_cursor_new(GDK_FLEUR); gc_canvas_item_grab(data->item, - GDK_POINTER_MOTION_MASK | + GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, fleur, event->button.time); @@ -657,22 +653,22 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) break; } break; - + case GDK_MOTION_NOTIFY: - if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { new_x = item_x; new_y = item_y; - + gnome_canvas_item_move(data->item , new_x - x, new_y - y); gnome_canvas_item_move(data->item_text, new_x - x, new_y - y); x = new_x; y = new_y; } break; - + case GDK_BUTTON_RELEASE: - if(dragging) + if(dragging) { gint i; gint tmpi, tmpj; @@ -680,10 +676,10 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) PieceItem *piece_src; PieceItem *piece_dst; gint col = 0, line; - + gc_canvas_item_ungrab(data->item, event->button.time); dragging = FALSE; - + /* Search the column (x) where this item is ungrabbed */ for(i=0; i<=number_of_item_x; i++) if(position[i][0]->x < item_x && @@ -710,7 +706,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) for(i=number_of_item_y-1; i>=0; i--) if(position[col][i]->color == -1) line = i; - + /* Bad drop / Too many pieces here */ if(line >= number_of_item_y) { @@ -727,17 +723,17 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) /* Update ontop values for the piece under the grabbed one */ if(data->j>0) position[data->i][data->j-1]->on_top = TRUE; - + /* Update ontop values for the piece under the ungrabbed one */ if(line>0) position[col][line-1]->on_top = FALSE; - + /* Move the piece */ piece_dst = position[col][line]; piece_src = data; gc_item_absolute_move (data->item , piece_dst->x , piece_dst->y); gc_item_absolute_move (data->item_text, piece_dst->xt, piece_dst->yt); - + /* FIXME : Workaround for bugged canvas */ gnome_canvas_update_now(gcomprisBoard->canvas); @@ -748,21 +744,21 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) piece_src->y = piece_dst->y; piece_dst->x = tmpx; piece_dst->y = tmpy; - + tmpx = data->xt; tmpy = data->yt; piece_src->xt = piece_dst->xt; piece_src->yt = piece_dst->yt; piece_dst->xt = tmpx; piece_dst->yt = tmpy; - + tmpi = data->i; tmpj = data->j; position[tmpi][tmpj]->i = piece_dst->i; position[tmpi][tmpj]->j = piece_dst->j; piece_dst->i = tmpi; piece_dst->j = tmpj; - + position[piece_src->i][piece_src->j] = piece_src; position[piece_dst->i][piece_dst->j] = piece_dst; @@ -775,12 +771,12 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) } } break; - + default: break; } - - + + return FALSE; } diff --git a/src/boards/hanoi_real.c b/src/boards/hanoi_real.c index 32f9341..1391cdd 100644 --- a/src/boards/hanoi_real.c +++ b/src/boards/hanoi_real.c @@ -17,10 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> - #include "gcompris/gcompris.h" #define SOUNDLISTFILE PACKAGE @@ -207,7 +203,7 @@ static void hanoi_destroy_all_items() if(boardRootItem!=NULL) { gtk_object_destroy (GTK_OBJECT(boardRootItem)); - + /* Cleanup our memory structure */ for(i=0; i<number_of_item_x; i++) { @@ -231,8 +227,8 @@ static void dump_solution() { for(j=0; j<number_of_item_y; j++) { - printf("(%d,%d= width=%d top=%d) ", position[i][j]->i, position[i][j]->j, - position[i][j]->width, + printf("(%d,%d= width=%d top=%d) ", position[i][j]->i, position[i][j]->j, + position[i][j]->width, position[i][j]->on_top); } printf("\n"); @@ -250,7 +246,7 @@ static GnomeCanvasItem *hanoi_create_item(GnomeCanvasGroup *parent) GnomeCanvasItem *item = NULL; GdkPixbuf *pixmap = NULL; gchar *filename; - + boardRootItem = GNOME_CANVAS_GROUP( gnome_canvas_item_new (gnome_canvas_root(gcomprisBoard->canvas), gnome_canvas_group_get_type (), @@ -262,7 +258,7 @@ static GnomeCanvasItem *hanoi_create_item(GnomeCanvasGroup *parent) if(pixmap) { gnome_canvas_item_new (boardRootItem, gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, + "pixbuf", pixmap, "x", (double)BOARDWIDTH/2, "y", (double)BOARDHEIGHT - 35, "width", (double) BOARDWIDTH - 20, @@ -352,7 +348,7 @@ static GnomeCanvasItem *hanoi_create_item(GnomeCanvasGroup *parent) /* The disc support */ pixmap = gc_pixmap_load ("images/disc_support.png"); - + item = gnome_canvas_item_new (boardRootItem, gnome_canvas_pixbuf_get_type (), "x", (double) item_width * i + item_width/2, @@ -448,12 +444,12 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) if(!data->on_top) return FALSE; - + item_x = event->button.x; item_y = event->button.y; gnome_canvas_item_w2i(item->parent, &item_x, &item_y); - - switch (event->type) + + switch (event->type) { case GDK_ENTER_NOTIFY: gc_item_focus_set(item, TRUE); @@ -462,18 +458,18 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) gc_item_focus_set(item, FALSE); break; case GDK_BUTTON_PRESS: - switch(event->button.button) + switch(event->button.button) { case 1: - + x = item_x; y = item_y; - + gnome_canvas_item_raise_to_top(data->item); - + fleur = gdk_cursor_new(GDK_FLEUR); gc_canvas_item_grab(data->item, - GDK_POINTER_MOTION_MASK | + GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, fleur, event->button.time); @@ -482,21 +478,21 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) break; } break; - + case GDK_MOTION_NOTIFY: - if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { new_x = item_x; new_y = item_y; - + gnome_canvas_item_move(data->item, new_x - x, new_y - y); x = new_x; y = new_y; } break; - + case GDK_BUTTON_RELEASE: - if(dragging) + if(dragging) { gint i; gint tmpi, tmpj; @@ -512,12 +508,12 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) disc_w = gdk_pixbuf_get_width(pixmap)/2; disc_h = gdk_pixbuf_get_height(pixmap)/2; gdk_pixbuf_unref(pixmap); - + gc_canvas_item_ungrab(data->item, event->button.time); dragging = FALSE; - + /* Search the column (x) where this item is ungrabbed */ - if(item_x > (position[number_of_item_x-1][0]->x + if(item_x > (position[number_of_item_x-1][0]->x - (position[number_of_item_x-1][0]->x - position[number_of_item_x-2][0]->x) / 2)) col = number_of_item_x-1; else if(item_x < position[0][0]->x) @@ -550,9 +546,9 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) for(i=number_of_item_y-1; i>=0; i--) if(position[col][i]->width == -1) line = i; - + /* Bad drop / Too many pieces here or larger disc is above */ - if(line > number_of_item_y || + if(line > number_of_item_y || (line > 0 && position[col][line-1]->width != -1 && position[col][line-1]->width < data->width)) { /* Return to the original position */ @@ -567,11 +563,11 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) /* Update ontop values for the piece under the grabbed one */ if(data->j>0) position[data->i][data->j-1]->on_top = TRUE; - + /* Update ontop values for the piece under the ungrabbed one */ if(line>0) position[col][line-1]->on_top = FALSE; - + /* Move the piece */ piece_dst = position[col][line]; piece_src = data; @@ -579,7 +575,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) gc_item_absolute_move (data->item, piece_dst->x - disc_w, piece_dst->y - disc_h); - + /* FIXME : Workaround for bugged canvas */ gnome_canvas_update_now(gcomprisBoard->canvas); @@ -590,14 +586,14 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) piece_src->y = piece_dst->y; piece_dst->x = tmpx; piece_dst->y = tmpy; - + tmpi = data->i; tmpj = data->j; position[tmpi][tmpj]->i = piece_dst->i; position[tmpi][tmpj]->j = piece_dst->j; piece_dst->i = tmpi; piece_dst->j = tmpj; - + position[piece_src->i][piece_src->j] = piece_src; position[piece_dst->i][piece_dst->j] = piece_dst; @@ -610,12 +606,12 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, PieceItem *data) } } break; - + default: break; } - - + + return FALSE; } diff --git a/src/boards/imageid.c b/src/boards/imageid.c index 6ba0b5f..e2d0068 100644 --- a/src/boards/imageid.c +++ b/src/boards/imageid.c @@ -17,9 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> #include <string.h> #include "gcompris/gcompris.h" @@ -169,7 +166,7 @@ static void start_board (GcomprisBoard *agcomprisBoard) init_xml(); gcomprisBoard->number_of_sublevel = NUMBER_OF_SUBLEVELS; - assert(NUMBER_OF_LEVELS*NUMBER_OF_SUBLEVELS == g_list_length(board_list)); + g_assert(NUMBER_OF_LEVELS*NUMBER_OF_SUBLEVELS == g_list_length(board_list)); gc_score_start(SCORESTYLE_NOTE, 50, gcomprisBoard->height - 50, @@ -195,7 +192,7 @@ end_board () destroy_board_list(); } - gc_locale_reset(); + gc_locale_reset(); gcomprisBoard = NULL; } @@ -268,9 +265,9 @@ static GnomeCanvasItem *imageid_create_item(GnomeCanvasGroup *parent) /* if (board_number >= g_list_length(board_list)) board_number = g_list_length(board_list)-1; */ - assert(board_number >= 0 && board_number < g_list_length(board_list)); + g_assert(board_number >= 0 && board_number < g_list_length(board_list)); place = ((int)(3.0*rand()/(RAND_MAX+1.0))); - assert(place >= 0 && place < 3); + g_assert(place >= 0 && place < 3); right_word = place+1; @@ -284,7 +281,7 @@ static GnomeCanvasItem *imageid_create_item(GnomeCanvasGroup *parent) button_pixmap = gc_skin_pixmap_load("button_large.png"); /* display the image */ board = g_list_nth_data(board_list, board_number); - assert(board != NULL); + g_assert(board != NULL); str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, board->pixmapfile); pixmap = gc_pixmap_load(str); @@ -471,7 +468,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) if (item == text3_item) temp = button3; - assert(temp == button1 || temp == button2 || temp == button3); + g_assert(temp == button1 || temp == button2 || temp == button3); if ( ( temp == button1 && right_word == 1) || ( temp == button2 && right_word == 2) || @@ -551,7 +548,7 @@ static void init_xml() filename = gc_file_find_absolute("%s/board1.xml", gcomprisBoard->boarddir); - assert(read_xml_file(filename)== TRUE); + g_assert(read_xml_file(filename)== TRUE); g_free(filename); } @@ -697,7 +694,7 @@ static void save_table (gpointer key, { gc_db_set_board_conf ( profile_conf, board_conf, - (gchar *) key, + (gchar *) key, (gchar *) value); } @@ -708,7 +705,7 @@ static GcomprisConfCallback conf_ok(GHashTable *table) pause_board(FALSE); return NULL; } - + g_hash_table_foreach(table, (GHFunc) save_table, NULL); if (gcomprisBoard) { @@ -722,7 +719,7 @@ static GcomprisConfCallback conf_ok(GHashTable *table) config = table; gc_locale_set(g_hash_table_lookup( config, "locale")); - + if (profile_conf) g_hash_table_destroy(config); @@ -734,7 +731,7 @@ static GcomprisConfCallback conf_ok(GHashTable *table) pause_board(FALSE); } - + board_conf = NULL; profile_conf = NULL; @@ -752,10 +749,10 @@ config_start(GcomprisBoard *agcomprisBoard, pause_board(TRUE); gchar *label = g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", - agcomprisBoard->name, + agcomprisBoard->name, aProfile ? aProfile->name : ""); - gc_board_config_window_display( label, + gc_board_config_window_display( label, (GcomprisConfCallback )conf_ok); g_free(label); @@ -764,16 +761,16 @@ config_start(GcomprisBoard *agcomprisBoard, GHashTable *config = gc_db_get_conf( profile_conf, board_conf); gchar *locale = g_hash_table_lookup( config, "locale"); - + gc_board_config_combo_locales( locale); } - + /* ======================= */ /* = config_stop = */ /* ======================= */ -static void +static void config_stop() { } diff --git a/src/boards/leftright.c b/src/boards/leftright.c index 3f55138..c7109d9 100644 --- a/src/boards/leftright.c +++ b/src/boards/leftright.c @@ -17,9 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <assert.h> - #include "gcompris/gcompris.h" #define SOUNDLISTFILE PACKAGE @@ -152,7 +149,7 @@ static void start_board (GcomprisBoard *agcomprisBoard) { gcomprisBoard=agcomprisBoard; img = gc_skin_image_get("leftright-bg.jpg"); - gc_set_background(gnome_canvas_root(gcomprisBoard->canvas), + gc_set_background(gnome_canvas_root(gcomprisBoard->canvas), img); g_free(img); gcomprisBoard->level=1; @@ -413,9 +410,9 @@ static gint item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) { process_ok(); } } - + break; - + default: break; } diff --git a/src/boards/machpuzzle.c b/src/boards/machpuzzle.c index 95d87b4..569c861 100644 --- a/src/boards/machpuzzle.c +++ b/src/boards/machpuzzle.c @@ -17,10 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> - #include "gcompris/gcompris.h" #define SOUNDLISTFILE PACKAGE @@ -289,7 +285,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, MachItem *machItem) if(board_paused) return FALSE; - switch (event->type) + switch (event->type) { case GDK_BUTTON_PRESS: @@ -303,12 +299,12 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, MachItem *machItem) machItem->vyo = ((item_y-y1)<width/2?(width/2-(item_y-y1))*20:-1*(width/2-(y2-item_y))*20); machItem->vxo = ((item_x-x1)<width/2?(width/2-(item_x-x1))*20:-1*(width/2-(x2-item_x))*20); break; - + default: break; } - - + + return FALSE; } @@ -341,7 +337,7 @@ static MachItem *create_machine_item(MachItemType machItemType, double x, double machItem->type = machItemType; - switch (machItemType) + switch (machItemType) { case MACH_HORZ_WALL: width = 100; @@ -447,7 +443,7 @@ static MachItem *create_machine_item(MachItemType machItemType, double x, double gtk_signal_connect(GTK_OBJECT(machItem->item), "event", (GtkSignalFunc) item_event, machItem); - + break; case MACH_FLYING_BALL: width = 40; @@ -493,7 +489,7 @@ static MachItem *create_machine_item(MachItemType machItemType, double x, double return machItem; } -/* +/* * Returns true if at least 3 corners of 's' rectangle are inside 'd' rectangle * */ @@ -503,7 +499,7 @@ static gint rectangle_in(double sx1, double sy1, double sx2, double sy2, guint corner_in = 0; // printf("rectangle_in %10f %10f %10f %10f\n %10f %10f %10f %10f\n", sx1,sy1,sx2,sy2,dx1,dy1,dx2,dy2); - if(sx1>dx1 && sx1<dx2 && sy1>dy1 && sy1<dy2) + if(sx1>dx1 && sx1<dx2 && sy1>dy1 && sy1<dy2) corner_in++; if(sx2>dx1 && sx2<dx2 && sy2>dy1 && sy2<dy2) @@ -543,7 +539,7 @@ static void minigolf_move(GList *item_list) gnome_canvas_item_get_bounds(item, &x1, &y1, &x2, &y2); machItem->times += times_inc; - + /* Collision detection */ for(j=0; j<g_list_length(item_list); j++) { @@ -555,7 +551,7 @@ static void minigolf_move(GList *item_list) if(collMachItem != machItem) { - if(rectangle_in(x1, y1, x2, y2, + if(rectangle_in(x1, y1, x2, y2, collMachItem->xpos, collMachItem->ypos, collMachItem->xpos + collMachItem->width, @@ -564,7 +560,7 @@ static void minigolf_move(GList *item_list) //printf("!!! Collision detected with:\n"); //dump_machItem(collMachItem); collision = TRUE; - + gamewon = TRUE; minigolf_destroy_all_items(); gc_bonus_display(gamewon, BONUS_SMILEY); @@ -573,8 +569,8 @@ static void minigolf_move(GList *item_list) } } - ypos=machItem->yposo - + (machItem->vyo*machItem->times) + ypos=machItem->yposo + + (machItem->vyo*machItem->times) + (.5*machItem->ay * (machItem->times*machItem->times)); /* Simulate going slower */ @@ -585,8 +581,8 @@ static void minigolf_move(GList *item_list) machItem->vyo = 0; } - xpos=machItem->xposo - + (machItem->vxo*machItem->times) + xpos=machItem->xposo + + (machItem->vxo*machItem->times) + (.5*machItem->ax * (machItem->times*machItem->times)); /* Simulate going slower */ @@ -603,7 +599,7 @@ static void minigolf_move(GList *item_list) /* v = u + at */ machItem->vxo += (machItem->ax * machItem->times); machItem->vyo += (machItem->ay * machItem->times); - + if(machItem->ypos >= MIN_Y2 - machItem->height -1) machItem->ypos = MIN_Y2 - machItem->height; @@ -618,7 +614,7 @@ static void minigolf_move(GList *item_list) gc_item_absolute_move(item, machItem->xpos, machItem->ypos); - + if((machItem->ypos>=MIN_Y2-machItem->height-BORDER && (y1 - machItem->ypos)<=0) || collision == TRUE) { machItem->vyo = machItem->vyo * -0.5; @@ -626,11 +622,11 @@ static void minigolf_move(GList *item_list) machItem->times = 0; machItem->yposo = machItem->ypos; machItem->xposo = machItem->xpos; - + /* Floor touch */ //machItem->vxo *= 0.9; } - + if((y1<=MIN_Y1 && (y1 - machItem->ypos)>=0) || collision == TRUE) { machItem->vyo = machItem->vyo * -0.5; diff --git a/src/boards/maze.c b/src/boards/maze.c index 6243fd7..6b5a3f2 100644 --- a/src/boards/maze.c +++ b/src/boards/maze.c @@ -17,10 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <assert.h> -#include <math.h> - #include "gcompris/gcompris.h" #define SOUNDLISTFILE PACKAGE @@ -47,7 +43,7 @@ static int position[MAX_BREEDTE*MAX_HOOGTE][2]; static int ind=0; static int begin; -static int end; +static int end; static int breedte=10; static int hoogte=20; static int cellsize=20; @@ -191,7 +187,7 @@ static void start_board (GcomprisBoard *agcomprisBoard) { gcomprisBoard->disable_im_context = TRUE; img = gc_skin_image_get("gcompris-bg.jpg"); - gc_set_background(gnome_canvas_root(gcomprisBoard->canvas), + gc_set_background(gnome_canvas_root(gcomprisBoard->canvas), img); g_free(img); gcomprisBoard->level=1; @@ -277,7 +273,7 @@ static void maze_next_level() { gamewon = FALSE; initMaze(); generateMaze((rand()%breedte),(rand()%hoogte)); - removeSet(); + removeSet(); /* Try the next level */ maze_create_item(gnome_canvas_root(gcomprisBoard->canvas)); draw_background(wallgroup); @@ -310,17 +306,17 @@ static void maze_next_level() { position[ind][0]=0; position[ind][1]=begin; - Maze[0][begin]=Maze[0][begin]+SET; + Maze[0][begin]=Maze[0][begin]+SET; viewing_direction=EAST; threeDactive=FALSE; - + if (gcomprisBoard->level==1) run_fast=FALSE; if (gcomprisBoard->level==4) run_fast=TRUE; update_tux(viewing_direction); if(!modeIs2D) - threeDdisplay(); + threeDdisplay(); } /* ======================================= */ @@ -331,20 +327,20 @@ static void setlevelproperties(){ hoogte=4; cellsize=70; buffer=8; - + board_border_x=(int) (BASE_X2-breedte*cellsize)/2; board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; } else if (gcomprisBoard->level==2) { - + breedte=9; hoogte=6; cellsize=70; buffer=7; board_border_x=(int) (BASE_X2-breedte*cellsize)/2; - board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; - } + board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; + } else if (gcomprisBoard->level==3) { breedte=13; @@ -352,8 +348,8 @@ static void setlevelproperties(){ cellsize=60; buffer=6; board_border_x=(int) (BASE_X2-breedte*cellsize)/2; - board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; - } + board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; + } else if (gcomprisBoard->level==4) { breedte=17; @@ -361,49 +357,49 @@ static void setlevelproperties(){ cellsize=45; buffer=5; board_border_x=(int) (BASE_X2-breedte*cellsize)/2; - board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; + board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; } else if (gcomprisBoard->level==5) { breedte=21; hoogte=12; - cellsize=35; + cellsize=35; buffer=4; board_border_x=(int) (BASE_X2-breedte*cellsize)/2; - board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; + board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; } else if (gcomprisBoard->level==6) { breedte=25; hoogte=14; - cellsize=30; + cellsize=30; board_border_x=(int) (BASE_X2-breedte*cellsize)/2; board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; - } + } else if (gcomprisBoard->level==7) { breedte=29; hoogte=16; - cellsize=25; + cellsize=25; board_border_x=(int) (BASE_X2-breedte*cellsize)/2; - board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; - } + board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; + } else if (gcomprisBoard->level==8) { breedte=33; hoogte=18; - cellsize=23; + cellsize=23; board_border_x=(int) (BASE_X2-breedte*cellsize)/2; - board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; - } + board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; + } else if (gcomprisBoard->level==9) { breedte=37; hoogte=20; - cellsize=20; + cellsize=20; board_border_x=(int) (BASE_X2-breedte*cellsize)/2; - board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; - } + board_border_y=(int) (BASE_Y2-hoogte*cellsize)/2; + } } /* @@ -422,7 +418,7 @@ static void repeat () { } else { gnome_canvas_item_show(GNOME_CANVAS_ITEM(wallgroup)); /* Display a warning that you can't move there */ - gnome_canvas_item_show(warning_item); + gnome_canvas_item_show(warning_item); mapActive = TRUE; } } @@ -440,7 +436,7 @@ static void repeat () { twoDdisplay(); /* Display a warning that you can't move there */ gnome_canvas_item_show(warning_item); - + } else { pixmap = gc_skin_pixmap_load("maze-2d-bubble.png"); @@ -588,12 +584,12 @@ static GnomeCanvasItem *draw_image(GnomeCanvasGroup *group, int x,int y, GdkPixb item = gnome_canvas_item_new (group, gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, + "pixbuf", pixmap, "x", (double)x1+buffer, "y", (double)y1+buffer, "width", (double)cellsize-buffer*2, "height",(double)cellsize-buffer*2, - "width_set", TRUE, + "width_set", TRUE, "height_set", TRUE, NULL); @@ -629,7 +625,7 @@ static void draw_combined_rect(GnomeCanvasGroup *group, int x1,int y1,int x2,int } else if (y1==y2 && x1>x2) { - draw_a_rect(group,xx2+cellsize-buffer,yy2+buffer,xx1+buffer,yy1+cellsize-buffer,color); + draw_a_rect(group,xx2+cellsize-buffer,yy2+buffer,xx1+buffer,yy1+cellsize-buffer,color); } else if (x1==x2 && y1<y2) { @@ -660,7 +656,7 @@ static int check(int x,int y) return 1; else return 0; } - + static int* isPossible(int x, int y) { int wall=Maze[x][y]; @@ -745,7 +741,7 @@ static void generateMaze(int x, int y) break; case WEST: Maze[x][y]&=~WEST; - Maze[x-1][y]&=~EAST; + Maze[x-1][y]&=~EAST; generateMaze(x-1,y); break; case NORTH: @@ -753,7 +749,7 @@ static void generateMaze(int x, int y) Maze[x][y-1]&=~SOUTH; generateMaze(x,y-1); break; - + } po=isPossible(x,y); } @@ -817,7 +813,7 @@ static void movePos(int x1, int y1, int x2,int y2, int richting) { if(position[i][0]==x2 && position[i][1]==y2) - { + { bo=0; move_image(mazegroup,x2,y2,tuxitem); // draw_rect(mazegroup,x2,y2,"blue"); @@ -829,8 +825,8 @@ static void movePos(int x1, int y1, int x2,int y2, int richting) draw_combined_rect(mazegroup,position[i-1][0],position[i-1][1],position[i][0],position[i][1],"red"); ind--; } - - + + } } else @@ -868,7 +864,7 @@ static guint available_direction(guint last_step) } static void one_step(guint richting) -{ +{ update_tux(richting); switch (richting) @@ -878,7 +874,7 @@ static void one_step(guint richting) case EAST: movePos(position[ind][0],position[ind][1],position[ind][0]+1,position[ind][1],richting); return; case NORTH: movePos(position[ind][0],position[ind][1],position[ind][0],position[ind][1]-1,richting); - return; + return; case SOUTH: movePos(position[ind][0],position[ind][1],position[ind][0],position[ind][1]+1,richting); return; } @@ -904,26 +900,26 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str) richting=WEST; break; - case GDK_Right: + case GDK_Right: /* When In 3D Mode, can't move tux in the 2D mode */ if(!modeIs2D || mapActive) return TRUE; - richting=EAST; + richting=EAST; break; - case GDK_Up: + case GDK_Up: /* When In 3D Mode, can't move tux in the 2D mode */ if(!modeIs2D || mapActive) return TRUE; - richting=NORTH; + richting=NORTH; break; - case GDK_Down: + case GDK_Down: /* When In 3D Mode, can't move tux in the 2D mode */ if(!modeIs2D || mapActive) return TRUE; - richting=SOUTH; + richting=SOUTH; break; case GDK_3: case GDK_space: @@ -936,14 +932,14 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str) } else { gnome_canvas_item_show(GNOME_CANVAS_ITEM(wallgroup)); /* Display a warning that you can't move there */ - gnome_canvas_item_show(warning_item); + gnome_canvas_item_show(warning_item); mapActive = TRUE; } } - + /* switch to 3D only if allowed in the mode */ if(!modeIs2D) - threeDdisplay(); + threeDdisplay(); return TRUE; default: return FALSE; } @@ -954,7 +950,7 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str) /* run until we come to a fork, (make sure to stop on next level!) */ while (run_fast && (richting=available_direction(richting)) && gcomprisBoard->level==level) - { + { one_step(richting); viewing_direction=richting; } @@ -985,20 +981,20 @@ static gint key_press_2D_relative(guint keyval, gchar *commit_str, gchar *preedi guint richting=0,level=gcomprisBoard->level; switch (keyval) - { - case GDK_Left: viewing_direction=TURN_LEFT(viewing_direction); + { + case GDK_Left: viewing_direction=TURN_LEFT(viewing_direction); update_tux(viewing_direction); return TRUE; break; - case GDK_Right: viewing_direction=TURN_RIGHT(viewing_direction); + case GDK_Right: viewing_direction=TURN_RIGHT(viewing_direction); update_tux(viewing_direction); return TRUE; break; case GDK_Up: one_step(viewing_direction); break; - case GDK_Down: - viewing_direction=TURN_RIGHT(viewing_direction); - viewing_direction=TURN_RIGHT(viewing_direction); + case GDK_Down: + viewing_direction=TURN_RIGHT(viewing_direction); + viewing_direction=TURN_RIGHT(viewing_direction); update_tux(viewing_direction); break; default: return FALSE; @@ -1009,7 +1005,7 @@ static gint key_press_2D_relative(guint keyval, gchar *commit_str, gchar *preedi /* run until we come to a fork, (make sure to stop on next level!) */ while (run_fast && (richting=available_direction(richting)) && gcomprisBoard->level==level) - { + { one_step(richting); viewing_direction=richting; } @@ -1018,24 +1014,24 @@ static gint key_press_2D_relative(guint keyval, gchar *commit_str, gchar *preedi } static gint key_press_3D(guint keyval, gchar *commit_str, gchar *preedit_str) -{ +{ switch (keyval) - { - case GDK_Left: viewing_direction=TURN_LEFT(viewing_direction); + { + case GDK_Left: viewing_direction=TURN_LEFT(viewing_direction); break; - case GDK_Right: viewing_direction=TURN_RIGHT(viewing_direction); + case GDK_Right: viewing_direction=TURN_RIGHT(viewing_direction); break; case GDK_Up: one_step(viewing_direction); break; case GDK_Down: - viewing_direction=TURN_RIGHT(viewing_direction); - viewing_direction=TURN_RIGHT(viewing_direction); + viewing_direction=TURN_RIGHT(viewing_direction); + viewing_direction=TURN_RIGHT(viewing_direction); update_tux(viewing_direction); break; - case GDK_2: - case GDK_space: + case GDK_2: + case GDK_space: /* Display a warning that you can't move there */ - gnome_canvas_item_show(warning_item); + gnome_canvas_item_show(warning_item); twoDdisplay(); return TRUE; case GDK_E: case GDK_e: eye_pos_y+=0.1; if (eye_pos_y>0.9) eye_pos_y=0.9; break; @@ -1117,7 +1113,7 @@ static gboolean is_wall2(struct vector viewpos, int viewdir) */ /* rotate a vector by specified amount */ -/* this corresponds to multiplying with ( cos a, -sin a ) +/* this corresponds to multiplying with ( cos a, -sin a ) ( sin a, cos a ) */ static struct vector vector_turn(struct vector v,int angle) /* 1=90deg, 2=180deg */ @@ -1150,7 +1146,7 @@ static struct vector invert_y(struct vector v) screen and the labyrinth are left handed systems (unlike classical vector algebra) */ -static gboolean is_visible(struct vector viewpos, int viewdir, +static gboolean is_visible(struct vector viewpos, int viewdir, struct vector distance, gboolean left_side, gboolean *is_exit) { struct vector where=vector_add(viewpos,invert_y(vector_turn(distance,angle(viewdir,NORTH)))); gint direction=left_side ? TURN_LEFT(viewdir) : viewdir; @@ -1158,7 +1154,7 @@ static gboolean is_visible(struct vector viewpos, int viewdir, if (is_wall2(where,direction)) return TRUE; if ((where.x==breedte-2 && direction==EAST && where.y==end) - || (where.x==breedte-1 + || (where.x==breedte-1 && (where.y==end || (direction==NORTH && where.y==end+1) || (direction==SOUTH && where.y==end-1)))) @@ -1201,7 +1197,7 @@ static int dx_left(struct screenparam sp, int xmin, int dy, gboolean left_side) else return dx_left(sp,xmin,dy-1,FALSE)+1; } return (int)(floorf(inverse_transform(sp.pos.x, sp.screendist.x, xmin, - dy, eye_pos_x, eye_pos_z))); + dy, eye_pos_x, eye_pos_z))); } /* rightmost wall which ('s left edge) is visible */ @@ -1216,7 +1212,7 @@ static int dx_right(struct screenparam sp, int xmax, int dy, gboolean left_side) return (int)(ceilf(inverse_transform(sp.pos.x, sp.screendist.x, xmax, dy, eye_pos_x, eye_pos_z))) - 1; } - + static struct Trapez wall_coords(struct screenparam sp, struct vector distance, gboolean left_side) { struct Trapez r; @@ -1263,9 +1259,9 @@ static struct Trapez wall_coords(struct screenparam sp, struct vector distance, r.y_right_bottom=r.y_left_bottom; } test: - assert(r.x_left<=r.x_right); - assert(r.y_left_top<=r.y_left_bottom); - assert(r.y_right_top<=r.y_right_bottom); + g_assert(r.x_left<=r.x_right); + g_assert(r.y_left_top<=r.y_left_bottom); + g_assert(r.y_right_top<=r.y_right_bottom); return r; } @@ -1287,11 +1283,11 @@ static struct Trapez Trapez_hide(const struct Trapez t, int xmin, int xmax) r.y_right_bottom=t.y_right_bottom - (t.x_right-xmax)*(t.y_right_bottom-t.y_left_bottom) /(t.x_right-t.x_left); } - assert(r.x_left<=r.x_right); - assert(xmin<=r.x_left); - assert(r.x_right<=xmax); - assert(r.y_left_top<=r.y_left_bottom); - assert(r.y_right_top<=r.y_right_bottom); + g_assert(r.x_left<=r.x_right); + g_assert(xmin<=r.x_left); + g_assert(r.x_right<=xmax); + g_assert(r.y_left_top<=r.y_left_bottom); + g_assert(r.y_right_top<=r.y_right_bottom); return r; } @@ -1301,7 +1297,7 @@ static const char *color(int dir) return "light grey"; } -static void gcDisplay(struct vector position, int viewdir, +static void gcDisplay(struct vector position, int viewdir, struct screenparam sp, int xmin, int xmax, int dy, gboolean left_wall) { int dxl=dx_left(sp,xmin,dy,left_wall), dxr=dx_right(sp,xmax,dy,left_wall), @@ -1322,7 +1318,7 @@ static void gcDisplay(struct vector position, int viewdir, // right of it ... xmin=t.x_right+1; } - + i=1; is_exit=FALSE; if (dxr>=1) // seek from the middle right for a wall @@ -1349,7 +1345,7 @@ static void gcDisplay(struct vector position, int viewdir, static void Display3(struct vector position, int viewdir, struct screenparam sp) -{ gcDisplay(position, viewdir, sp, sp.pos.x-sp.size.x, sp.pos.x+sp.size.x, +{ gcDisplay(position, viewdir, sp, sp.pos.x-sp.size.x, sp.pos.x+sp.size.x, 0, TRUE); } @@ -1387,7 +1383,7 @@ static void twoDdisplay() gc_set_background(gnome_canvas_root(gcomprisBoard->canvas), fileskin); g_free(fileskin); - if (threedgroup) + if (threedgroup) gnome_canvas_item_hide(GNOME_CANVAS_ITEM(threedgroup)); gnome_canvas_item_show(GNOME_CANVAS_ITEM(boardRootItem)); threeDactive=FALSE; @@ -1428,6 +1424,6 @@ static void update_tux(gint direction) NULL); gdk_pixbuf_unref(pixmap); } - + } diff --git a/src/boards/memory.c b/src/boards/memory.c index 4319145..1643f8d 100644 --- a/src/boards/memory.c +++ b/src/boards/memory.c @@ -3,7 +3,7 @@ * Time-stamp: <2006/08/21 23:33:28 bruno> * * Copyright (C) 2000 Bruno Coudoin - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// FIXME: Cleanup of MemoryItem created struct is not done +// FIXME: Cleanup of MemoryItem created struct is not done #include <errno.h> #include <string.h> @@ -613,13 +613,13 @@ void get_random_token(int token_type, gint *returned_type, gchar **string, gchar break; } - } while (skip || ((j < max_token ) + } while (skip || ((j < max_token ) && (passed_token && result && g_list_find_custom(passed_token, result, (GCompareFunc)strcmp)))); g_assert (j < max_token); - + passed_token = g_list_append( passed_token, result); - + *returned_type = type; *string = result; @@ -679,7 +679,7 @@ static void pause_board (gboolean pause) } } } - + } } /* @@ -696,7 +696,7 @@ static void start_board (GcomprisBoard *agcomprisBoard) gc_bar_set(GC_BAR_LEVEL); /* Default mode */ - + if(!gcomprisBoard->mode){ currentMode=MODE_NORMAL; currentUiMode=UIMODE_NORMAL; @@ -809,7 +809,7 @@ static void start_board (GcomprisBoard *agcomprisBoard) } } } - + if (currentUiMode == UIMODE_SOUND) { @@ -838,28 +838,28 @@ static void start_board (GcomprisBoard *agcomprisBoard) base_y2 = BASE_CARD_Y2; base_x1_tux = BASE_CARD_X1_TUX; } - - + + /* TRANSLATORS: Put here the numbers in your language */ numbers=_("0123456789"); - assert(g_utf8_validate(numbers,-1,NULL)); // require by all utf8-functions - + g_assert(g_utf8_validate(numbers,-1,NULL)); // require by all utf8-functions + /* TRANSLATORS: Put here the alphabet lowercase in your language */ alphabet_lowercase=_("abcdefghijklmnopqrstuvwxyz"); - assert(g_utf8_validate(alphabet_lowercase,-1,NULL)); // require by all utf8-functions - + g_assert(g_utf8_validate(alphabet_lowercase,-1,NULL)); // require by all utf8-functions + g_warning("Using lowercase %s", alphabet_lowercase); - + /* TRANSLATORS: Put here the alphabet uppercase in your language */ alphabet_uppercase=_("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - assert(g_utf8_validate(alphabet_uppercase,-1,NULL)); // require by all utf8-functions + g_assert(g_utf8_validate(alphabet_uppercase,-1,NULL)); // require by all utf8-functions g_warning("Using uppercase %s", alphabet_uppercase); - + /* TRANSLATORS: Put here the mathematical operators "+-×÷" for your language. */ operators=_("+-×÷"); g_assert(g_utf8_validate(operators,-1,NULL)); // require by all utf8-functions g_warning("Using operators %s", operators); - + op_add = g_malloc0(2*sizeof(gunichar)); g_utf8_strncpy(op_add, g_utf8_offset_to_pointer (operators,0),1); @@ -880,18 +880,18 @@ static void start_board (GcomprisBoard *agcomprisBoard) tux_memory_size = tux_memory_sizes[gcomprisBoard->level]; tux_memory = g_queue_new (); } - + Paused = FALSE; - + to_tux = FALSE; if (currentUiMode == UIMODE_SOUND){ playing_sound = TRUE; gc_sound_play_ogg_cb("sounds/LuneRouge/musique/LRBuddhist_gong_05_by_Lionel_Allorge.ogg",start_callback); } else playing_sound = FALSE; - + memory_next_level(); - } + } } static void @@ -964,10 +964,10 @@ static void update_scores() } /* set initial values for the next level */ -static void memory_next_level() +static void memory_next_level() { gc_bar_set_level(gcomprisBoard); - + memory_destroy_all_items(); boardRootItem = GNOME_CANVAS_GROUP( @@ -1031,29 +1031,29 @@ static void memory_destroy_all_items() if (memoryArray[x][y]) g_free(memoryArray[x][y]->second_value); g_free(memoryArray[x][y]); - memoryArray[x][y] = NULL; + memoryArray[x][y] = NULL; } GList *list; for (list = passed_token; list != NULL; list=list->next) g_free(list->data); - + g_list_free(passed_token); - + passed_token = NULL; - + if (currentMode == MODE_TUX){ for (list = winning_pairs; list != NULL; list=list->next) g_free(list->data); - + g_list_free(winning_pairs); - + winning_pairs = NULL; while (g_queue_pop_head (tux_memory)); //tux_memory = NULL; } - + } /* @@ -1105,19 +1105,19 @@ static void get_image(MemoryItem *memoryItem, guint x, guint y) get_random_token ( TYPE_IMAGE, &memoryItem->type, &memoryItem->data, NULL); g_assert (memoryItem->type == TYPE_IMAGE); break; - + case 5: /* Limited Text mode Numbers only */ get_random_token ( TYPE_NUMBER, &memoryItem->type, &memoryItem->data, NULL); g_assert (memoryItem->type == TYPE_NUMBER); break; - + case 6: /* Limited Text mode Numbers + Capitals */ get_random_token ( TYPE_NUMBER | TYPE_UPPERCASE, &memoryItem->type, &memoryItem->data, NULL); g_assert((memoryItem->type == TYPE_NUMBER)||(memoryItem->type==TYPE_UPPERCASE)); break; - + default: /* Text mode ALL */ get_random_token ( TYPE_NUMBER | TYPE_UPPERCASE | TYPE_LOWERCASE, &memoryItem->type, &memoryItem->data, NULL); @@ -1153,7 +1153,7 @@ static void get_image(MemoryItem *memoryItem, guint x, guint y) get_random_token ( TYPE_ADD | TYPE_MINUS |TYPE_MULT | TYPE_DIV , &memoryItem->type, &memoryItem->data, &memoryItem->second_value); g_assert (memoryItem->type & (TYPE_ADD | TYPE_MINUS |TYPE_MULT | TYPE_DIV)); break; - + default: g_error("Don't now in what mode run !"); break; @@ -1165,7 +1165,7 @@ static void get_image(MemoryItem *memoryItem, guint x, guint y) // Randomly set the pair rx = (int)(numberOfColumn*((double)rand()/RAND_MAX)); ry = (int)(numberOfLine*((double)rand()/RAND_MAX)); - + while(memoryArray[rx][ry]) { rx++; @@ -1206,7 +1206,7 @@ static void create_item(GnomeCanvasGroup *parent) GdkPixbuf *pixmap = gc_pixmap_load("images/transparent_square2.png"); gnome_canvas_item_new (GNOME_CANVAS_GROUP(parent), gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, + "pixbuf", pixmap, "x", (double) (currentMode == MODE_TUX ? base_x1_tux : base_x1) - 20, "y", (double) base_y1 - 15, NULL); @@ -1218,11 +1218,11 @@ static void create_item(GnomeCanvasGroup *parent) tux = gnome_canvas_item_new (GNOME_CANVAS_GROUP(parent), gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap_tux, + "pixbuf", pixmap_tux, "x", (double) 50, "y", (double) 20, NULL); - + tux_score_s = gnome_canvas_item_new (GNOME_CANVAS_GROUP(parent), gnome_canvas_text_get_type (), "font", gc_skin_font_board_huge_bold, @@ -1266,7 +1266,7 @@ static void create_item(GnomeCanvasGroup *parent) { memoryItem = g_malloc0(sizeof(MemoryItem)); - + memoryItem->rootItem = \ gnome_canvas_item_new (parent, gnome_canvas_group_get_type (), @@ -1282,12 +1282,12 @@ static void create_item(GnomeCanvasGroup *parent) memoryItem->backcardItem = \ gnome_canvas_item_new (GNOME_CANVAS_GROUP(memoryItem->rootItem), gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, + "pixbuf", pixmap, "x", (double) 0, "y", (double) 0, "width", (double) width2, "height", (double) height2, - "width_set", TRUE, + "width_set", TRUE, "height_set", TRUE, NULL); gdk_pixbuf_unref(pixmap); @@ -1297,18 +1297,18 @@ static void create_item(GnomeCanvasGroup *parent) memoryItem->framecardItem = \ gnome_canvas_item_new (GNOME_CANVAS_GROUP(memoryItem->rootItem), gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, + "pixbuf", pixmap, "x", (double) 0, "y", (double) 0, "width", (double) width2, "height", (double) height2, - "width_set", TRUE, + "width_set", TRUE, "height_set", TRUE, NULL); gnome_canvas_item_hide(memoryItem->framecardItem); gdk_pixbuf_unref(pixmap); } - + // Display the image itself while taking care of its size and maximize the ratio get_image(memoryItem, x, y); @@ -1318,12 +1318,12 @@ static void create_item(GnomeCanvasGroup *parent) memoryItem->frontcardItem = \ gnome_canvas_item_new (GNOME_CANVAS_GROUP(memoryItem->rootItem), gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, + "pixbuf", pixmap, "x", (double) 0, "y", (double) 0, "width", (double) width2, "height", (double) height2, - "width_set", TRUE, + "width_set", TRUE, "height_set", TRUE, NULL); gdk_pixbuf_unref(pixmap); @@ -1331,17 +1331,17 @@ static void create_item(GnomeCanvasGroup *parent) else { if(memoryItem->type == TYPE_IMAGE) { pixmap = gc_pixmap_load(memoryItem->data); - + yratio=(height2*0.8)/(float)gdk_pixbuf_get_height(pixmap); xratio=(width2*0.8)/(float)gdk_pixbuf_get_width(pixmap); yratio=xratio=MIN(xratio, yratio); card_shadow_w = width*0.05; card_shadow_h = height*0.05; - + memoryItem->frontcardItem = \ gnome_canvas_item_new (GNOME_CANVAS_GROUP(memoryItem->rootItem), gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, + "pixbuf", pixmap, "x", (double) ((width2)- gdk_pixbuf_get_width(pixmap)*xratio*0.8)/2 - card_shadow_w, @@ -1350,11 +1350,11 @@ static void create_item(GnomeCanvasGroup *parent) card_shadow_h, "width", (double) gdk_pixbuf_get_width(pixmap)*xratio*0.8, "height", (double) gdk_pixbuf_get_height(pixmap)*yratio*0.8, - "width_set", TRUE, + "width_set", TRUE, "height_set", TRUE, NULL); gdk_pixbuf_unref(pixmap); - + } else { gchar *font; if (memoryItem->type & (TYPE_ADD|TYPE_MINUS|TYPE_MULT|TYPE_DIV)) @@ -1372,7 +1372,7 @@ static void create_item(GnomeCanvasGroup *parent) "anchor", GTK_ANCHOR_CENTER, "fill_color_rgba", 0x559ADDFF, NULL); - + } } @@ -1464,7 +1464,7 @@ static gint hide_card (GtkWidget *widget, gpointer data) if ((((WINNING *) list->data)->first == firstCard) || (((WINNING *) list->data)->first == secondCard) || (((WINNING *) list->data)->second == firstCard) || (((WINNING *) list->data)->second == secondCard) ){ to_remove = g_list_append( to_remove, list->data); } - + for (list = to_remove; list != NULL; list=list->next){ void *data = list->data; winning_pairs = g_list_remove (winning_pairs, list->data); @@ -1535,7 +1535,7 @@ static void check_win() (GSourceFunc) hide_card, NULL); return; } - + if (currentMode == MODE_TUX){ /* time to tux to play, after a delay */ to_tux = TRUE; @@ -1544,7 +1544,7 @@ static void check_win() (GSourceFunc) tux_play, NULL); return; } - + } static gint @@ -1554,10 +1554,10 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, MemoryItem *memoryItem) if(!gcomprisBoard) return FALSE; - switch (event->type) + switch (event->type) { case GDK_BUTTON_PRESS: - switch(event->button.button) + switch(event->button.button) { case 1: @@ -1581,7 +1581,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, MemoryItem *memoryItem) display_card(firstCard, ON_BACK); firstCard = NULL; display_card(secondCard, ON_BACK); - secondCard = NULL; + secondCard = NULL; } if(!firstCard) @@ -1609,12 +1609,12 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, MemoryItem *memoryItem) check_win(); return TRUE; } - + } break; default: break; - } + } default: break; } @@ -1702,7 +1702,7 @@ static gint tux_play(){ display_card(firstCard, ON_BACK); firstCard = NULL; display_card(secondCard, ON_BACK); - secondCard = NULL; + secondCard = NULL; } if (winning_pairs){ @@ -1733,13 +1733,13 @@ static gint tux_play(){ // Randomly set the pair rx = (int)(numberOfColumn*((double)rand()/RAND_MAX)); ry = (int)(numberOfLine*((double)rand()/RAND_MAX)); - - gboolean stay_unknown = (remainingCards > (g_queue_get_length (tux_memory) + + gboolean stay_unknown = (remainingCards > (g_queue_get_length (tux_memory) + (firstCard ? 1 : 0))); - g_warning("remainingCards %d tux_memory %d -> stay_unknown %d ", - remainingCards, - g_queue_get_length (tux_memory), + g_warning("remainingCards %d tux_memory %d -> stay_unknown %d ", + remainingCards, + g_queue_get_length (tux_memory), stay_unknown ); while((memoryArray[rx][ry]->hidden) || (memoryArray[rx][ry] == firstCard) @@ -1756,7 +1756,7 @@ static gint tux_play(){ ry=0; } } - + if (!firstCard){ g_warning("case 3"); firstCard = memoryArray[rx][ry]; diff --git a/src/boards/missingletter.c b/src/boards/missingletter.c index 278589b..6ef2ea3 100644 --- a/src/boards/missingletter.c +++ b/src/boards/missingletter.c @@ -17,9 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> #include <string.h> #include "gcompris/gcompris.h" @@ -171,7 +168,7 @@ static void start_board (GcomprisBoard *agcomprisBoard) gcomprisBoard->sublevel=1; gcomprisBoard->number_of_sublevel=NUMBER_OF_SUBLEVELS; /* Go to next level after this number of 'play' */ init_xml(); - assert(NUMBER_OF_LEVELS*NUMBER_OF_SUBLEVELS == g_list_length(board_list)); + g_assert(NUMBER_OF_LEVELS*NUMBER_OF_SUBLEVELS == g_list_length(board_list)); gc_score_start(SCORESTYLE_NOTE, 50, gcomprisBoard->height - 50, @@ -277,9 +274,9 @@ static GnomeCanvasItem *missing_letter_create_item(GnomeCanvasGroup *parent) board_number = (gcomprisBoard->level-1) * NUMBER_OF_SUBLEVELS + gcomprisBoard->sublevel-1; - assert(board_number >= 0 && board_number < g_list_length(board_list)); + g_assert(board_number >= 0 && board_number < g_list_length(board_list)); place = ((int)(3.0*rand()/(RAND_MAX+1.0))); - assert(place >= 0 && place < 3); + g_assert(place >= 0 && place < 3); right_word = place+1; @@ -292,7 +289,7 @@ static GnomeCanvasItem *missing_letter_create_item(GnomeCanvasGroup *parent) button_pixmap = gc_skin_pixmap_load("button.png"); /* display the image */ board = g_list_nth_data(board_list, board_number); - assert(board != NULL); + g_assert(board != NULL); str = g_strdup_printf("%s/%s", "imageid"/*gcomprisBoard->boarddir*/, board->pixmapfile); pixmap = gc_pixmap_load(str); @@ -502,7 +499,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) if (item == l3_item) temp = button3; - assert(temp == button1 || temp == button2 || temp == button3); + g_assert(temp == button1 || temp == button2 || temp == button3); if ( ( temp == button1 && right_word == 1) || ( temp == button2 && right_word == 2) || @@ -575,7 +572,7 @@ static void init_xml() filename = gc_file_find_absolute("%s/board1.xml", gcomprisBoard->boarddir); - assert(read_xml_file(filename)== TRUE); + g_assert(read_xml_file(filename)== TRUE); g_free(filename); } @@ -625,7 +622,7 @@ static void add_xml_data(xmlDocPtr doc, xmlNodePtr xmlnode, GNode * child) l2 = all_answer[3]; l3 = all_answer[4]; - assert(l1 != NULL && l2 != NULL && l3 != NULL && answer != NULL && question != NULL); + g_assert(l1 != NULL && l2 != NULL && l3 != NULL && answer != NULL && question != NULL); board->pixmapfile = pixmapfile; board->question = g_strdup(question); @@ -723,7 +720,7 @@ static void save_table (gpointer key, { gc_db_set_board_conf ( profile_conf, board_conf, - (gchar *) key, + (gchar *) key, (gchar *) value); } @@ -746,7 +743,7 @@ static GcomprisConfCallback conf_ok(GHashTable *table) config = gc_db_get_board_conf(); else config = table; - + gc_locale_set(g_hash_table_lookup( config, "locale")); if (profile_conf) @@ -755,9 +752,9 @@ static GcomprisConfCallback conf_ok(GHashTable *table) destroy_board_list(); init_xml(); - + missing_letter_next_level(); - + } board_conf = NULL; @@ -777,7 +774,7 @@ config_start(GcomprisBoard *agcomprisBoard, pause_board(TRUE); gchar *label = g_strdup_printf("<b>%s</b> configuration\n for profile <b>%s</b>", - agcomprisBoard->name, + agcomprisBoard->name, aProfile ? aProfile->name : ""); gc_board_config_window_display( label, @@ -789,16 +786,16 @@ config_start(GcomprisBoard *agcomprisBoard, GHashTable *config = gc_db_get_conf( profile_conf, board_conf); gchar *locale = g_hash_table_lookup( config, "locale"); - + gc_board_config_combo_locales( locale); } - + /* ======================= */ /* = config_stop = */ /* ======================= */ -static void +static void config_stop() { } diff --git a/src/boards/money.c b/src/boards/money.c index 4b4b48c..68ca52e 100644 --- a/src/boards/money.c +++ b/src/boards/money.c @@ -17,10 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> - #include "gcompris/gcompris.h" #include "money_widget.h" @@ -266,7 +262,7 @@ static void money_next_level() money_widget_add(tux_money, MONEY_EURO_COIN_1E); money_widget_add(tux_money, MONEY_EURO_COIN_1E); break; - case 3: + case 3: number_of_item = 2; min_price = 20; max_price = 30; @@ -478,11 +474,11 @@ static void money_next_level() gnome_canvas_item_new ( boardRootItem, gnome_canvas_pixbuf_get_type (), "pixbuf", pixmap, - "x", (double) (i*BOARDWIDTH)/(number_of_item+1) + "x", (double) (i*BOARDWIDTH)/(number_of_item+1) - gdk_pixbuf_get_width(pixmap)/2, "y", (double) 200, NULL); - + /* Diplay the price */ object_price = (double) RAND(min_price/number_of_item, max_price/number_of_item); diff --git a/src/boards/python.c b/src/boards/python.c index 9bb8173..c736f08 100644 --- a/src/boards/python.c +++ b/src/boards/python.c @@ -79,7 +79,29 @@ static BoardPlugin menu_bp = pythongc_board_config_stop }; -static BoardPlugin *bp_board = NULL; +static BoardPlugin menu_bp_no_config = + { + NULL, + NULL, + N_("Python Board"), + N_("Special board that embeds python into gcompris."), + "Olivier Samyn <osamyn@ulb.ac.be>", + pythonboard_init, + NULL, + NULL, + NULL, + pythonboard_start, + pythonboard_pause, + pythonboard_end, + pythonboard_is_our_board, + pythonboard_key_press, + pythonboard_ok, + pythonboard_set_level, + pythonboard_config, + pythonboard_repeat, + NULL, + NULL + }; /* * Return the plugin structure (Common to all gcompris boards) @@ -401,58 +423,28 @@ static void pythonboard_end (void){ /* * Return TRUE if the board is a python one. */ -static gboolean pythonboard_is_our_board (GcomprisBoard *agcomprisBoard){ +static gboolean pythonboard_is_our_board (GcomprisBoard *gcomprisBoard){ - if (agcomprisBoard->plugin) + if (gcomprisBoard->plugin) return TRUE; if(pythonboard_is_ready) { - if (agcomprisBoard!=NULL) { - - if (g_ascii_strncasecmp(agcomprisBoard->type, "python", 6)==0) { - - bp_board = g_malloc0(sizeof(BoardPlugin)); - - bp_board->handle = menu_bp.handle; - bp_board->filename = menu_bp.filename; - bp_board->name = menu_bp.name; - bp_board->description = menu_bp.description; - bp_board->author = menu_bp.author; - bp_board->init = menu_bp.init; - bp_board->cleanup = menu_bp.cleanup; - bp_board->about = menu_bp.about; - bp_board->configure = menu_bp.configure; - bp_board->start_board = menu_bp.start_board; - bp_board->pause_board = menu_bp.pause_board; - bp_board->end_board = menu_bp.end_board; - bp_board->is_our_board = menu_bp.is_our_board; - bp_board->key_press = menu_bp.key_press; - bp_board->ok = menu_bp.ok; - bp_board->set_level = menu_bp.set_level; - bp_board->config = menu_bp.config; - bp_board->repeat = menu_bp.repeat; - - if (g_list_find (config_boards, agcomprisBoard)){ - bp_board->config_start = menu_bp.config_start; - bp_board->config_stop = menu_bp.config_stop; - } else { - bp_board->config_start = NULL; - bp_board->config_stop = NULL; - } + if (gcomprisBoard!=NULL) { + if (g_ascii_strncasecmp(gcomprisBoard->type, "python", 6)==0) { /* Set the plugin entry */ - agcomprisBoard->plugin = bp_board; - - bp_board = NULL; - - //g_print("pythonboard: is our board = TRUE\n"); + if (g_list_find (config_boards, gcomprisBoard)){ + gcomprisBoard->plugin = &menu_bp; + } else { + gcomprisBoard->plugin = &menu_bp_no_config; + } return TRUE; } } } - agcomprisBoard->plugin=NULL; + gcomprisBoard->plugin=NULL; return FALSE; } diff --git a/src/boards/python/anim.py b/src/boards/python/anim.py index cd9d0b0..99bb2be 100644 --- a/src/boards/python/anim.py +++ b/src/boards/python/anim.py @@ -2967,12 +2967,12 @@ class DOMProcess(BaseProcess): ############################################## -try: - import xml.parsers.expat -except ImportError: - import pyexpat +#try: +# import xml.parsers.expat +#except ImportError: +# import pyexpat -from xml.parsers import expat +#from xml.parsers import expat def svg_to_anim2(filename): """Process command line parameters and run the conversion.""" diff --git a/src/boards/python/tuxpaint.py b/src/boards/python/tuxpaint.py index e4b1236..ae0c7fa 100644 --- a/src/boards/python/tuxpaint.py +++ b/src/boards/python/tuxpaint.py @@ -133,7 +133,7 @@ class Gcompris_tuxpaint: x = gcompris.BOARD_WIDTH/2, y = 185, fill_color_rgba = 0x000000ffL, - font = gcompris.skin.get_font("gcompris/board/huge bold"), + font = gcompris.skin.get_font("gcompris/board/title bold"), ) def end(self): diff --git a/src/boards/railroad.c b/src/boards/railroad.c index 46f2df2..7387372 100644 --- a/src/boards/railroad.c +++ b/src/boards/railroad.c @@ -17,10 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> - #include "gcompris/gcompris.h" #define SOUNDLISTFILE PACKAGE @@ -147,7 +143,7 @@ static void start_board (GcomprisBoard *agcomprisBoard) if(agcomprisBoard!=NULL) { gcomprisBoard=agcomprisBoard; - gc_set_background(gnome_canvas_root(gcomprisBoard->canvas), + gc_set_background(gnome_canvas_root(gcomprisBoard->canvas), "railroad/railroad-bg.png"); for (i=0; i<ENGINES; i++) { @@ -271,7 +267,7 @@ static void railroad_next_level() reset_all_lists(); // I have big troubles with the GList API : the worst I have ever seen ! - assert(g_list_length(item_answer_list) == 0 && g_list_length(int_answer_list) == 0 && g_list_length(int_model_list) == 0); + g_assert(g_list_length(item_answer_list) == 0 && g_list_length(int_answer_list) == 0 && g_list_length(int_model_list) == 0); model_size = 0; @@ -362,11 +358,11 @@ static GnomeCanvasItem *railroad_create_item(GnomeCanvasGroup *parent) // First the cars, depending of the level for (i=0; i<model_size-1; i++) { r = (int)(((float) WAGONS)*rand()/(RAND_MAX+1.0)); - assert( r >=0 && r < WAGONS); + g_assert( r >=0 && r < WAGONS); // keep track of the answer int_model_list = g_list_append(int_model_list, GINT_TO_POINTER(r+ENGINES)); pixmap = g_list_nth_data(listPixmapWagons, r); - assert(i >= 0 && i<MODEL_MAX_SIZE); + g_assert(i >= 0 && i<MODEL_MAX_SIZE); item_model[i] =gnome_canvas_item_new (modelRootItem, gnome_canvas_pixbuf_get_type (), "pixbuf", pixmap, @@ -378,7 +374,7 @@ static GnomeCanvasItem *railroad_create_item(GnomeCanvasGroup *parent) // Then the engine r = (int)(((float) ENGINES)*rand()/(RAND_MAX+1.0)); - assert( r >=0 && r < ENGINES); + g_assert( r >=0 && r < ENGINES); // keep track of the answer int_model_list = g_list_append(int_model_list, GINT_TO_POINTER(r)); pixmap = g_list_nth_data(listPixmapEngines, r); diff --git a/src/boards/read_colors.c b/src/boards/read_colors.c index 7c71f9c..f5997ac 100644 --- a/src/boards/read_colors.c +++ b/src/boards/read_colors.c @@ -17,8 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <assert.h> #include <string.h> /* libxml includes */ @@ -392,7 +390,7 @@ static gint item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) { static void highlight_selected(int c) { int x, y; - assert(c>=0 && c<LAST_COLOR); + g_assert(c>=0 && c<LAST_COLOR); x = X[c]; y = Y[c]; @@ -412,7 +410,7 @@ static void init_xml() filename = gc_file_find_absolute("%s/board1.xml", gcomprisBoard->boarddir); - assert(read_xml_file(filename)== TRUE); + g_assert(read_xml_file(filename)== TRUE); g_free(filename); } diff --git a/src/boards/reading.c b/src/boards/reading.c index 8873b79..34cdfb8 100644 --- a/src/boards/reading.c +++ b/src/boards/reading.c @@ -21,8 +21,6 @@ // FIXME: Cleanup of LettersItem created struct is not done -#include <errno.h> -#include <stdio.h> #include <string.h> #include "gcompris/gcompris.h" @@ -366,7 +364,7 @@ static GnomeCanvasItem *display_what_to_do(GnomeCanvasGroup *parent) textToFind = get_random_word(NULL); - assert(textToFind != NULL); + g_assert(textToFind != NULL); /* Decide now if this time we will display the text to find */ /* Use this formula to have a better random number see 'man 3 rand' */ @@ -415,7 +413,7 @@ static gboolean reading_create_item(GnomeCanvasGroup *parent) gint anchor = GTK_ANCHOR_CENTER; gchar *word; - assert(textToFind!=NULL); + g_assert(textToFind!=NULL); if(toDeleteFocus.rootItem) { @@ -448,7 +446,7 @@ static gboolean reading_create_item(GnomeCanvasGroup *parent) word = g_strdup(textToFind); } - assert(word!=NULL); + g_assert(word!=NULL); if(textToFindIndex>=0) textToFindIndex--; diff --git a/src/boards/reversecount.c b/src/boards/reversecount.c index 5fb9a41..a81bf9a 100644 --- a/src/boards/reversecount.c +++ b/src/boards/reversecount.c @@ -17,10 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> - #include "gcompris/gcompris.h" #define SOUNDLISTFILE PACKAGE diff --git a/src/boards/shapegame.c b/src/boards/shapegame.c index fa8bba2..9a98e67 100644 --- a/src/boards/shapegame.c +++ b/src/boards/shapegame.c @@ -195,6 +195,31 @@ static BoardPlugin menu_bp = config_stop }; +/* Description of this plugin without configuration */ +static BoardPlugin menu_bp_no_config = +{ + NULL, + NULL, + "Make the puzzle", + "Drag and Drop the items to rebuild the object", + "Bruno Coudoin <bruno.coudoin@free.fr>", + NULL, + NULL, + NULL, + NULL, + start_board, + pause_board, + end_board, + is_our_board, + key_press, + process_ok, + set_level, + NULL, + NULL, + NULL, + NULL +}; + /* * Main entry point mandatory for each Gcompris's game * --------------------------------------------------- @@ -346,39 +371,13 @@ is_our_board (GcomprisBoard *gcomprisBoard) { if(g_strcasecmp(gcomprisBoard->type, "shapegame")==0) { - BoardPlugin *bp_board = g_malloc0(sizeof(BoardPlugin)); - - bp_board->handle = menu_bp.handle; - bp_board->filename = menu_bp.filename; - bp_board->name = menu_bp.name; - bp_board->description = menu_bp.description; - bp_board->author = menu_bp.author; - bp_board->init = menu_bp.init; - bp_board->cleanup = menu_bp.cleanup; - bp_board->about = menu_bp.about; - bp_board->configure = menu_bp.configure; - bp_board->start_board = menu_bp.start_board; - bp_board->pause_board = menu_bp.pause_board; - bp_board->end_board = menu_bp.end_board; - bp_board->is_our_board = menu_bp.is_our_board; - bp_board->key_press = menu_bp.key_press; - bp_board->ok = menu_bp.ok; - bp_board->set_level = menu_bp.set_level; - bp_board->config = menu_bp.config; - bp_board->repeat = menu_bp.repeat; - + /* Set the plugin entry */ if (strcmp(gcomprisBoard->name, "imagename")==0){ - bp_board->config_start = menu_bp.config_start; - bp_board->config_stop = menu_bp.config_stop; + gcomprisBoard->plugin = &menu_bp; } else { - bp_board->config_start = NULL; - bp_board->config_stop = NULL; + gcomprisBoard->plugin = &menu_bp_no_config; } - - /* Set the plugin entry */ - gcomprisBoard->plugin = bp_board; - return TRUE; } } diff --git a/src/boards/submarine.c b/src/boards/submarine.c index 63a0720..c4e6331 100644 --- a/src/boards/submarine.c +++ b/src/boards/submarine.c @@ -17,9 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <assert.h> - #include "gcompris/gcompris.h" #define DEG_TO_RAD(x) M_PI*(x)/180.0 @@ -953,7 +950,7 @@ static gboolean update_timeout_slow() { if(board_paused) return FALSE; - + /* speed : don't reach instantly the ordered speed */ if (speed_ordered != submarine_horizontal_speed) { submarine_horizontal_speed += (speed_ordered-submarine_horizontal_speed)/10.0; @@ -1494,7 +1491,7 @@ static void submarine_explosion() { /* display the boken submarine */ str = g_strdup_printf("%s/%s", gcomprisBoard->boarddir, "submarine-broken.png"); pixmap = gc_pixmap_load(str); - gnome_canvas_item_set(submarine_item, + gnome_canvas_item_set(submarine_item, "pixbuf", pixmap, NULL); g_free(str); diff --git a/src/boards/superbrain.c b/src/boards/superbrain.c index a77c997..769dc66 100644 --- a/src/boards/superbrain.c +++ b/src/boards/superbrain.c @@ -17,10 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> - #include "gcompris/gcompris.h" #define SOUNDLISTFILE PACKAGE @@ -238,7 +234,7 @@ static void superbrain_next_level() /* Select level difficulty : should not go above MAX_PIECES */ /* number_of_color must be upper than number_of_piece to allow unicity */ - if(gcomprisBoard->level < LEVEL_MAX_FOR_HELP) + if(gcomprisBoard->level < LEVEL_MAX_FOR_HELP) { number_of_piece = gcomprisBoard->level + 2; number_of_color = gcomprisBoard->level + 4; @@ -265,13 +261,13 @@ static void superbrain_next_level() j = (guint)RAND(1, number_of_color); while(selected_color[j]) j = (guint)RAND(1, number_of_color); - + solution[i] = j; selected_color[j] = TRUE; } - + boardRootItem = GNOME_CANVAS_GROUP( gnome_canvas_item_new (gnome_canvas_root(gcomprisBoard->canvas), gnome_canvas_group_get_type (), @@ -285,7 +281,7 @@ static void superbrain_next_level() "x", (double) 0, "y", (double) 0, NULL)); - + /* The list of the pieces */ for(i=0; i<number_of_color; i++) { @@ -343,19 +339,19 @@ static GnomeCanvasItem *superbrain_create_item(GnomeCanvasGroup *parent) points->coords[1] = (double) current_y_position + PIECE_HEIGHT + PIECE_GAP/2; points->coords[2] = (double) x2; points->coords[3] = (double) current_y_position + PIECE_HEIGHT + PIECE_GAP/2; - + gnome_canvas_item_new (boardRootItem, gnome_canvas_line_get_type (), "points", points, "fill_color", "white", "width_pixels", 1, NULL); - + points->coords[0] = (double) x1 + 2; points->coords[1] = (double) current_y_position + PIECE_HEIGHT + PIECE_GAP/2 + 1; points->coords[2] = (double) x2 + 2; points->coords[3] = (double) current_y_position + PIECE_HEIGHT + PIECE_GAP/2 + 1; - + gnome_canvas_item_new (boardRootItem, gnome_canvas_line_get_type (), "points", points, @@ -363,7 +359,7 @@ static GnomeCanvasItem *superbrain_create_item(GnomeCanvasGroup *parent) "width_pixels", 1, NULL); - /* Continuing the line */ + /* Continuing the line */ // x1 = (BOARDWIDTH + (number_of_piece+2)*(PIECE_WIDTH+PIECE_GAP))/2 + PLAYING_AREA_X; x1 = PLAYING_HELP_X; x2 = x1 + number_of_piece*PIECE_WIDTH/2; @@ -372,28 +368,28 @@ static GnomeCanvasItem *superbrain_create_item(GnomeCanvasGroup *parent) points->coords[1] = (double) current_y_position + PIECE_HEIGHT + PIECE_GAP/2; points->coords[2] = (double) x2; points->coords[3] = (double) current_y_position + PIECE_HEIGHT + PIECE_GAP/2; - + gnome_canvas_item_new (boardRootItem, gnome_canvas_line_get_type (), "points", points, "fill_color", "white", "width_pixels", 1, NULL); - + points->coords[0] = (double) x1 + 2; points->coords[1] = (double) current_y_position + PIECE_HEIGHT + PIECE_GAP/2 + 1; points->coords[2] = (double) x2 + 2; points->coords[3] = (double) current_y_position + PIECE_HEIGHT + PIECE_GAP/2 + 1; - + gnome_canvas_item_new (boardRootItem, gnome_canvas_line_get_type (), "points", points, "fill_color", "black", "width_pixels", 1, NULL); - + gnome_canvas_points_unref(points); - + /* Draw the pieces */ listPieces = g_list_alloc(); @@ -410,10 +406,10 @@ static GnomeCanvasItem *superbrain_create_item(GnomeCanvasGroup *parent) gnome_canvas_group_get_type (), "x", (double) 0, "y", (double) 0, - + NULL)); - + // Good piece->good = gnome_canvas_item_new (piece->rootitem, gnome_canvas_rect_get_type (), @@ -426,7 +422,7 @@ static GnomeCanvasItem *superbrain_create_item(GnomeCanvasGroup *parent) "width_units", (double)1, NULL); gnome_canvas_item_hide(piece->good); - + // Misplaced piece->misplaced = gnome_canvas_item_new (piece->rootitem, gnome_canvas_rect_get_type (), @@ -455,12 +451,12 @@ static GnomeCanvasItem *superbrain_create_item(GnomeCanvasGroup *parent) gnome_canvas_item_hide(item); piece->listitem = g_list_append(piece->listitem, item); - + gtk_signal_connect(GTK_OBJECT(item), "event", (GtkSignalFunc) item_event, piece); } piece->selecteditem = 1; - item = g_list_nth_data(piece->listitem, + item = g_list_nth_data(piece->listitem, piece->selecteditem); gnome_canvas_item_show(item); @@ -495,14 +491,14 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, Piece *piece) if(board_paused) return FALSE; - switch (event->type) + switch (event->type) { case GDK_BUTTON_PRESS: if(!piece->completed) { gnome_canvas_item_hide(item); - switch(event->button.button) + switch(event->button.button) { case 1: case 4: @@ -519,7 +515,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, Piece *piece) break; } - newitem = g_list_nth_data(piece->listitem, + newitem = g_list_nth_data(piece->listitem, piece->selecteditem); gnome_canvas_item_show(newitem); } @@ -527,7 +523,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, Piece *piece) default: break; } - + return FALSE; } @@ -557,7 +553,7 @@ static void mark_pieces() gnome_canvas_item_show(piece->good); nbgood++; solution_tmp[i-1] = G_MAXINT; - } + } else { gamewon = FALSE; @@ -583,7 +579,7 @@ static void mark_pieces() nbmisplaced++; solution_tmp[j-1] = G_MAXINT; if(gcomprisBoard->level<LEVEL_MAX_FOR_HELP) - gnome_canvas_item_show(piece->misplaced); + gnome_canvas_item_show(piece->misplaced); done = TRUE; } } while (!done && j++!=number_of_piece); diff --git a/src/boards/target.c b/src/boards/target.c index 2787dad..d81de24 100644 --- a/src/boards/target.c +++ b/src/boards/target.c @@ -17,10 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> - #include "gcompris/gcompris.h" #define SOUNDLISTFILE PACKAGE @@ -74,7 +70,7 @@ static void animate_items(void); static void launch_dart(double item_x, double item_y); /* - * distance to target, min wind speed, max wind speed, target1 width(center), + * distance to target, min wind speed, max wind speed, target1 width(center), * value1 (for target1), ... to target10, value10 * * a target width of 0 means no such target @@ -92,7 +88,7 @@ typedef struct { /* * Definition of targets one line by level based on TargetDefinition - */ + */ static TargetDefinition targetDefinition[] = { { 3, 100, 2, 5, { 40, 5 , 80, 3, 150, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, @@ -254,7 +250,7 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str) case GDK_Hyper_L: case GDK_Hyper_R: case GDK_Num_Lock: - return FALSE; + return FALSE; case GDK_KP_Enter: case GDK_Return: process_ok(); @@ -271,7 +267,7 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str) break; } - c = tolower(keyval); + c = tolower(keyval); /* Limit the user entry to 5 digits */ if(c>='0' && c<='9' && answer_string_index<5) @@ -447,10 +443,10 @@ static GnomeCanvasItem *target_create_item(GnomeCanvasGroup *parent) "outline_color", "black", "width_units", (double)1, NULL); - + gnome_canvas_item_lower_to_bottom(item); gtk_signal_connect(GTK_OBJECT(item), "event", (GtkSignalFunc) item_event, NULL); - + /* Display the value for this target */ tmpstr = g_strdup_printf("%d", targetDefinition[gcomprisBoard->level-1].target_width_value[i*2+1]); @@ -464,7 +460,7 @@ static GnomeCanvasItem *target_create_item(GnomeCanvasGroup *parent) "fill_color", "white", NULL); g_free(tmpstr); - + gtk_signal_connect(GTK_OBJECT(item), "event", (GtkSignalFunc) item_event, NULL); } } @@ -511,7 +507,7 @@ static void process_ok() guint answer_points = atoi(answer_string); if(answer_item) { - + if(answer_points == user_points) { gamewon = TRUE; @@ -542,7 +538,7 @@ static void request_score() button_pixmap = gc_skin_pixmap_load("button_large2.png"); gnome_canvas_item_new (boardRootItem, gnome_canvas_pixbuf_get_type (), - "pixbuf", button_pixmap, + "pixbuf", button_pixmap, "x", x_offset, "y", y_offset, NULL); @@ -604,7 +600,7 @@ static void animate_items() "x2", (double)animate_item_x + animate_item_size, "y2", (double)animate_item_y + animate_item_size, NULL); - + if(animate_item_size>MIN_DART_SIZE) animate_item_size--; @@ -624,7 +620,7 @@ static void animate_items() } /* - * + * */ static void launch_dart(double item_x, double item_y) { @@ -651,7 +647,7 @@ static void launch_dart(double item_x, double item_y) { request_score(); } - + } /* ==================================== */ @@ -659,7 +655,7 @@ static gint item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) { double item_x, item_y; - + if(board_paused) return FALSE; @@ -667,10 +663,10 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data) if(number_of_arrow == 0 || animate_item) return FALSE; - switch (event->type) + switch (event->type) { case GDK_BUTTON_PRESS: - switch(event->button.button) + switch(event->button.button) { case 1: case 2: diff --git a/src/boards/traffic.c b/src/boards/traffic.c index 6d4878e..b304f9d 100644 --- a/src/boards/traffic.c +++ b/src/boards/traffic.c @@ -3,7 +3,7 @@ * Copyright (C) 2002 Bruno Coudoin * * Based on the original code from Geoff Reedy <vader21@imsa.edu> - * Copyright (C) 2000 Geoff Reedy + * Copyright (C) 2000 Geoff Reedy * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,9 +21,6 @@ */ #include <string.h> -#include <ctype.h> -#include <math.h> -#include <assert.h> #include "traffic.h" @@ -155,9 +152,9 @@ static void start_board (GcomprisBoard *agcomprisBoard) gcomprisBoard->maxlevel=8; gcomprisBoard->sublevel=1; gcomprisBoard->number_of_sublevel=5; /* Go to next level after this number of 'play' */ - gc_score_start(SCORESTYLE_NOTE, - gcomprisBoard->width - 220, - gcomprisBoard->height - 50, + gc_score_start(SCORESTYLE_NOTE, + gcomprisBoard->width - 220, + gcomprisBoard->height - 50, gcomprisBoard->number_of_sublevel); str = gc_skin_image_get("button_reload.png"); @@ -415,7 +412,7 @@ static int car_cb(GnomeCanvasItem *item, GdkEvent *event, car *thiscar) if (thiscar->orient==CAR_ORIENT_NS) cursor=gdk_cursor_new(GDK_SB_V_DOUBLE_ARROW); - else + else cursor=gdk_cursor_new(GDK_SB_H_DOUBLE_ARROW); gc_canvas_item_grab(item, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, @@ -494,7 +491,7 @@ static int car_cb(GnomeCanvasItem *item, GdkEvent *event, car *thiscar) dy=CLAMP(item_y-start_y,-39,39); dx=CLAMP(item_x-start_x,-39,39); - if (thiscar->goal && big_x==250+OFSET_X) { + if (thiscar->goal && big_x==250+OFSET_X) { gc_canvas_item_ungrab(item,event->button.time); gnome_canvas_item_hide(item); moving=FALSE; @@ -664,7 +661,7 @@ gint cars_from_strv(char *strv) else if (y == 'F') ccar->x = 5; } - if (id == 'X') + if (id == 'X') { ccar->color = 0xFF0000FF; ccar->goal = 1; @@ -684,7 +681,7 @@ gint cars_from_strv(char *strv) else if (id == 'P') ccar->color = 0xFF80FFFF; else if (id == 'Q') ccar->color = 0x0000FFFF; else if (id == 'R') ccar->color = 0x00FFFFFF; - + } return number_of_cars; } diff --git a/src/boards/wordprocessor.c b/src/boards/wordprocessor.c index 41c6f49..768e775 100644 --- a/src/boards/wordprocessor.c +++ b/src/boards/wordprocessor.c @@ -17,9 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <math.h> -#include <assert.h> #include <string.h> #include "gcompris/gcompris.h" diff --git a/src/boards/wordsgame.c b/src/boards/wordsgame.c index b03adb0..05a5044 100644 --- a/src/boards/wordsgame.c +++ b/src/boards/wordsgame.c @@ -19,8 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <errno.h> -#include <stdio.h> #include <string.h> #include "gcompris/gcompris.h" @@ -325,7 +323,7 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str) g_static_rw_lock_reader_lock (&items_lock); item=g_ptr_array_index(items,i); g_static_rw_lock_reader_unlock (&items_lock); - assert (item!=NULL); + g_assert (item!=NULL); if (strcmp(item->letter,letter)==0) { item_on_focus=item; @@ -491,7 +489,7 @@ static void wordsgame_move_item(LettersItem *item) */ static gint wordsgame_move_items (GtkWidget *widget, gpointer data) { - assert (items!=NULL); + g_assert (items!=NULL); gint i; LettersItem *item; @@ -525,7 +523,7 @@ static gboolean wordsgame_destroy_items(GPtrArray *item_list) { LettersItem *item; - assert(item_list!=NULL); + g_assert(item_list!=NULL); @@ -651,7 +649,7 @@ static GnomeCanvasItem *wordsgame_create_item(GnomeCanvasGroup *parent) static void wordsgame_add_new_item() { - assert(gcomprisBoard->canvas!=NULL); + g_assert(gcomprisBoard->canvas!=NULL); wordsgame_create_item(gnome_canvas_root(gcomprisBoard->canvas)); } @@ -674,7 +672,7 @@ static void player_win(LettersItem *item) gc_sound_play_ogg ("sounds/gobble.ogg", NULL); - assert(gcomprisBoard!=NULL); + g_assert(gcomprisBoard!=NULL); gcomprisBoard->sublevel++; gc_score_set(gcomprisBoard->sublevel); diff --git a/src/gcompris/Makefile.am b/src/gcompris/Makefile.am index 6e01a89..6fafa87 100644 --- a/src/gcompris/Makefile.am +++ b/src/gcompris/Makefile.am @@ -27,21 +27,6 @@ endif #cairo_c = #endif -if PLATFORM_WIN32 -no_undefined = -no-undefined -endif - -if OS_WIN32 -install-libtool-import-lib: - $(INSTALL) .libs/libgcompris.dll.a $(DESTDIR)$(libdir) - -uninstall-libtool-import-lib: - -rm $(DESTDIR)$(libdir)/libgcompris.dll.a -else -install-libtool-import-lib: -uninstall-libtool-import-lib: -endif - bin_PROGRAMS = gcompris INCLUDES = \ @@ -179,9 +164,5 @@ dist-hook: rm -f $(distdir)/$$file ; \ done -install-data-local: install-libtool-import-lib - -uninstall-local: uninstall-libtool-import-lib - clean-local: rm -f $(marshal_sources) diff --git a/src/gcompris/Makefile.mingw b/src/gcompris/Makefile.mingw index baa6b7a..437ea59 100644 --- a/src/gcompris/Makefile.mingw +++ b/src/gcompris/Makefile.mingw @@ -175,7 +175,7 @@ install: all # BUILD EXE # -$(TARGET).exe: $(EXE_OBJECTS) +$(TARGET).exe: $(EXE_OBJECTS) ../boards/libboards.a $(CC) $(LDFLAGS) $(EXE_OBJECTS) $(LIB_PATHS) $(EXE_LIBS) -o $(TARGET).exe ## diff --git a/src/gcompris/menu.c b/src/gcompris/menu.c index 33ed419..da1d4cf 100644 --- a/src/gcompris/menu.c +++ b/src/gcompris/menu.c @@ -654,10 +654,6 @@ void gc_menu_load() void gc_menu_board_free(GcomprisBoard *board) { -#ifndef WIN32 /* Win32 plugins are static */ - /* Need to reference cound plugins and free them once it's no more used */ - // FIXME g_free(board->plugin); -#endif g_free(board->type); g_free(board->board_dir); g_free(board->mode); diff --git a/tools/py2exe/README b/tools/py2exe/README new file mode 100644 index 0000000..7409b22 --- /dev/null +++ b/tools/py2exe/README @@ -0,0 +1,3 @@ +This directory contains stubs needed to run py2exe and create a GCompris +binary that is self contained with python and pygtk +To run it on windows, run make -f Makefile.mingw python diff --git a/tools/py2exe/gcompris.py b/tools/py2exe/gcompris.py new file mode 100755 index 0000000..23ac7e0 --- /dev/null +++ b/tools/py2exe/gcompris.py @@ -0,0 +1,25 @@ +from gettext import gettext as _ +import site +import base64 +import copy +import cPickle as pickle +import glob +import gobject +import gtk +import gtk.gdk +import gtk.keysyms +import math +import os +import pango +import pygtk +import random +import sys +import tempfile +import time +import types +import cairo +import pangocairo +import atk +import gobject + +print "Hello gcompris world now" diff --git a/tools/py2exe/setup.py b/tools/py2exe/setup.py new file mode 100755 index 0000000..f04376f --- /dev/null +++ b/tools/py2exe/setup.py @@ -0,0 +1,25 @@ +from distutils.core import setup +import py2exe + +setup( + name = 'gcompris', + description = 'gcompris', + version = '8.2', + + windows = [ + { + 'script': 'gcompris.py', + 'icon_resources': [(1, "gcompris.ico")], + } + ], + + options = { + 'py2exe': { + 'packages':'encodings', + 'includes': 'cairo, pango, pangocairo, atk, gobject', + } + }, + + data_files=[ + ] +) |