Commit 2904455a authored by Bruno Coudoin's avatar Bruno Coudoin

*** RELEASE 8.0BETA6 ***

	- Fixed clickgame and chess on windows (uses the old chess.c code)
	- chess on linux updated to use the new glib API
	- More GC API fix:
	  board_pause now gc_board_pause
	  board_play now gc_board_play
	  board_stop now gc_board_stop
parent 4b953d15
*** RELEASE 8.0BETA6 ***
2006-09-18 Bruno coudoin <bruno.coudoin@free.fr>
- Fixed clickgame and chess on windows (uses the old chess.c code)
- chess on linux updated to use the new glib API
- More GC API fix:
board_pause now gc_board_pause
board_play now gc_board_play
board_stop now gc_board_stop
* Makefile.am:
* Makefile.mingw:
* README.mingw:
* config.h.mingw:
* configure.in:
* gcompris-installer.nsi.in:
* src/boards/chess.c: (gnuchess_died), (start_board), (end_board),
(chess_create_item), (engine_local_destroy), (engine_local_cb),
(engine_local_err_cb), (start_child), (write_child):
* src/boards/click_on_letter.c: (sounds_are_fine):
* src/boards/memory.c: (start_board):
* src/boards/menu2.c: (menu_start), (create_panel),
(display_section), (display_board_icon), (next_spot),
(menu_create_item), (item_event), (set_content), (get_ratio),
(create_top), (display_welcome):
* src/boards/planegame.c: (key_press), (planegame_next_level),
(planegame_cloud_colision), (planegame_move_item),
(planegame_destroy_items), (planegame_destroy_all_items),
(planegame_create_item), (planegame_add_new_item), (item_event):
* src/boards/py-gcompris-board.c: (pyGcomprisBoardType_getattr),
(pyGcomprisBoardType_setattr):
* src/boards/shapegame.c: (item_event):
* src/boards/submarine.c: (quit_after_delay):
* src/gcompris/about.c: (gc_about_start), (gc_about_stop):
* src/gcompris/bar.c: (item_event_bar):
* src/gcompris/board.c: (init_plugins), (gc_board_check_file),
(gc_board_play), (gc_board_pause), (gc_board_stop),
(get_board_playing), (board_run_next_end), (board_run_next):
* src/gcompris/board.h:
* src/gcompris/bonus.c: (gc_bonus_end_display), (gc_bonus_display),
(end_bonus):
* src/gcompris/config.c: (gc_config_start), (gc_config_stop):
* src/gcompris/dialog.c: (gc_dialog), (item_event_ok):
* src/gcompris/file_selector.c: (gc_selector_file_stop),
(display_file_selector):
* src/gcompris/gcompris.c: (board_widget_key_press_callback),
(setup_window), (gc_board_end), (cleanup):
* src/gcompris/gcompris_confirm.c: (gc_confirm_box_stop),
(display_confirm):
* src/gcompris/help.c: (gc_help_start), (gc_help_stop):
* src/gcompris/images_selector.c: (gc_selector_images_start),
(gc_selector_images_stop):
* src/gcompris/menu.c: (_add_xml_to_data), (_read_xml_file),
(gc_menu_section_get), (gc_menu_has_activity), (gc_menu_getlist),
(gc_menu_load_dir), (gc_menu_load):
2006-09-17 Bruno coudoin <bruno.coudoin@free.fr>
- Minor resizing of some icons do make them appear smother
......
......@@ -30,7 +30,7 @@ EXTRA_DIST = \
intltool-update.in \
gnome2-macros \
README.mingw README.translators README.windows \
config.h.mingw.in Makefile.mingw global_win32.mak gcompris.ico gcompris-uninstall.ico \
config.h.mingw Makefile.mingw global_win32.mak gcompris.ico gcompris-uninstal.ico \
gcompris-installer.nsi
......
......@@ -4,7 +4,7 @@
# Description: Top Makefile for win32 (mingw) port of GCompris
#
VERSION = "8.0BETA5"
VERSION = "8.0BETA6"
pkgdatadir = gcompris
......
......@@ -64,6 +64,8 @@ GNUCHESS_TOP := /gnuchess
* Now on the windows system:
* Get a tarball or CVS snapshot of gcompris.
* untar the gcompris-win-prepack.tar.gz in it
* Manual fix draw.xml to use draw instead of python
* Manual fix, replace chess.c by chess.c.windows
* run: make -f Makefile.mingw from gcompris's top-level directory. This will take a long time.
* run: make -f Makefile.mingw prepack to include all necessary libraries in the installer directory
* run: make -f Makefile.mingw install to include the generated code in the installer directory
......
......@@ -2,7 +2,7 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Version number of package */
#define VERSION "8.0BETA5"
#define VERSION "8.0BETA6"
/* Supported languages */
#define ALL_LINGUAS "am ar az bg ca cs da de el en_CA en_GB es et fi fr ga gu he hi hr hu it lt mk ml ms nl nb nn pa pl pt pt_BR ro ru sk sl sq sr sr@Latn sv tr wa zh_CN"
......
......@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/gcompris/gcompris.c)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(gcompris, 8.0BETA5)
AM_INIT_AUTOMAKE(gcompris, 8.0BETA6)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
......
......@@ -22,6 +22,8 @@ Name $name
OutFile "gcompris-${GCOMPRIS_VERSION}.exe"
UninstallIcon ".\gcompris-uninstal.ico"
SetCompressor lzma
ShowInstDetails show
ShowUninstDetails show
......@@ -49,7 +51,7 @@ SetDateSave on
;Modern UI Configuration
!define MUI_ICON ".\gcompris.ico"
!define MUI_UNICON ".\gcompris-uninstall.ico"
!define MUI_UNICON ".\gcompris-uninstal.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\nsis\gcompris-intro.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP ".\nsis\gcompris-header.bmp"
......
......@@ -179,10 +179,8 @@ static void pause_board (gboolean pause)
void gnuchess_died(int signum)
{
if(signum == SIGTRAP)
{
gc_dialog(_("Error: The external program gnuchess died unexpectingly"), gc_board_end);
}
gnuchess_pid = 0;
gc_dialog(_("Error: The external program gnuchess died unexpectingly"), gc_board_stop);
}
/*
......@@ -190,12 +188,17 @@ void gnuchess_died(int signum)
static void start_board (GcomprisBoard *agcomprisBoard)
{
signal(SIGTRAP, gnuchess_died);
#ifndef WIN32
if (!g_file_test (GNUCHESS, G_FILE_TEST_EXISTS)) {
gc_dialog(_("Error: The external program gnuchess is mandatory\nto play chess in gcompris.\nFind this program on http://www.rpmfind.net or in your\nGNU/Linux distribution\nAnd check it is located here: "GNUCHESS), gc_board_end);
gnuchess_pid = 0;
#ifndef WIN32
signal(SIGTRAP, gnuchess_died);
signal(SIGPIPE, gnuchess_died);
if (!g_file_test (GNUCHESS, G_FILE_TEST_EXISTS))
{
gc_dialog(_("Error: The external program gnuchess is mandatory\nto play chess in gcompris.\n"
"Find this program on http://www.rpmfind.net or in your\nGNU/Linux distribution\n"
"And check it is located here: "GNUCHESS),
gc_board_stop);
return;
}
#endif
......@@ -232,12 +235,15 @@ static void start_board (GcomprisBoard *agcomprisBoard)
}
if(start_child (GNUCHESS, &read_chan,
&write_chan, &gnuchess_pid)==FALSE) {
gc_dialog(_("Error: The external program gnuchess is mandatory\nto play chess in gcompris.\nFind this program on http://www.rpmfind.net or in your\nGNU/Linux distribution\nAnd check it is in "GNUCHESS), gc_board_end);
&write_chan, &gnuchess_pid)==FALSE)
{
gc_dialog(_("Error: The external program gnuchess is mandatory\n"
"to play chess in gcompris.\n"
"First install it, and check it is in "GNUCHESS), gc_board_stop);
return;
}
read_cb = g_io_add_watch (read_chan, G_IO_IN,
read_cb = g_io_add_watch (read_chan, G_IO_IN|G_IO_PRI,
engine_local_cb, NULL);
err_cb = g_io_add_watch (read_chan, G_IO_HUP,
engine_local_err_cb, NULL);
......@@ -248,17 +254,23 @@ static void start_board (GcomprisBoard *agcomprisBoard)
write_child (write_chan, "easy\n");
write_child (write_chan, "level 100 1 0\n");
write_child (write_chan, "depth 1\n");
write_child (write_chan, "time 500\n");
chess_next_level();
gamewon = FALSE;
pause_board(FALSE);
}
}
/* ======================================= */
static void end_board ()
{
#ifndef WIN32
signal(SIGTRAP, NULL);
signal(SIGPIPE, NULL);
#endif
if(gcomprisBoard!=NULL)
{
pause_board(TRUE);
......@@ -386,7 +398,8 @@ static void chess_destroy_all_items()
}
/* ==================================== */
static GnomeCanvasItem *chess_create_item(GnomeCanvasGroup *parent)
static GnomeCanvasItem *
chess_create_item(GnomeCanvasGroup *parent)
{
guint color;
GnomeCanvasItem *item = NULL;
......@@ -956,6 +969,9 @@ static void
engine_local_destroy (GPid gnuchess_pid)
{
if(!gnuchess_pid)
return;
g_warning("engine_local_destroy () \n");
write_child (write_chan, "quit\n");
......@@ -972,26 +988,48 @@ engine_local_destroy (GPid gnuchess_pid)
g_spawn_close_pid(gnuchess_pid);
}
/** We got data back from gnuchess, we parse them here
*
*/
static gboolean
engine_local_cb (GIOChannel *source,
GIOCondition condition,
gpointer data)
{
static char buf[1024];
static char *b=buf;
gchar buf[1000];
char *b=buf;
GError *err = NULL;
char *p,*q;
gsize len;
GIOStatus status;
gsize len = 0;
GIOStatus status = G_IO_STATUS_NORMAL;
g_warning("engine_local_cb");
status = g_io_channel_read_chars(source,
buf,
1000,
&len,
&err);
g_warning("g_io_channel_read_line len=%d", len);
if(status == G_IO_STATUS_ERROR)
{
g_warning("g_io_channel_read_chars error=%s",
err->message);
/* FIXME: Not sure what to do */
return FALSE;
}
status = g_io_channel_read_chars (read_chan, b, sizeof (buf) - 1 - (b - buf), &len, NULL);
if(status != G_IO_STATUS_NORMAL)
{
g_warning("g_io_channel_read_chars status=%d\n", status);
g_warning("g_io_channel_read_chars error=%d",
status);
/* FIXME: Not sure what to do */
return FALSE;
}
g_warning("engine_local_cb read=%s\n", buf);
if (len > 0) {
b[len] = 0;
b += len;
......@@ -1038,7 +1076,7 @@ engine_local_cb (GIOChannel *source,
Square from, to;
p = strstr (buf, ":");
printf("computer moves to %s\n", p+1);
g_warning("computer moves to %s\n", p+1);
if (san_to_move (position, p+1, &from, &to))
ascii_to_move (position, p+1, &from, &to);
......@@ -1092,8 +1130,8 @@ engine_local_err_cb (GIOChannel *source,
GIOCondition condition,
gpointer data)
{
g_error ("Local Engine connection died");
gnuchess_pid = 0;
gc_dialog(_("Error: The external program gnuchess died unexpectingly"), gc_board_stop);
return FALSE;
}
......@@ -1111,7 +1149,7 @@ start_child (char *cmd,
gint Child_In, Child_Out, Child_Err;
GError *gerror = NULL;
gchar *Child_Argv[]={ cmd, NULL };
gchar *Child_Argv[]={ cmd, "-e", NULL };
g_warning("Ready to start child");
......@@ -1136,42 +1174,18 @@ start_child (char *cmd,
if(g_io_channel_set_encoding(*write_chan, NULL, NULL) != G_IO_STATUS_NORMAL)
g_warning("Failed to set NULL encoding");
if(g_io_channel_set_flags (*read_chan, G_IO_FLAG_SET_MASK, NULL) != G_IO_STATUS_NORMAL)
if(g_io_channel_set_flags (*read_chan, G_IO_FLAG_NONBLOCK, NULL) != G_IO_STATUS_NORMAL)
g_warning("Failed to set NON BLOCKING IO");
if(g_io_channel_set_flags (*write_chan, G_IO_FLAG_SET_MASK, NULL) != G_IO_STATUS_NORMAL)
if(g_io_channel_set_flags (*write_chan, G_IO_FLAG_NONBLOCK, NULL) != G_IO_STATUS_NORMAL)
g_warning("Failed to set NON BLOCKING IO");
return(TRUE);
}
static void
write_child (GIOChannel *write_chan, char *format, ...)
{
GIOError err;
va_list ap;
char *buf;
gsize len;
va_start (ap, format);
buf = g_strdup_vprintf (format, ap);
err = g_io_channel_write (write_chan, buf, strlen (buf), &len);
if (err != G_IO_ERROR_NONE)
g_warning ("Writing to child process failed");
else
g_warning ("Wrote '%s' to gnuchess", buf);
va_end (ap);
g_free (buf);
}
/* FIXME: The new API bellow should be use but for an unknown reason it doesn't work,
* Not all data are read back using this method
/** Write a command to the gnuchess backend
*
*/
/*
static void
write_child (GIOChannel *write_chan, char *format, ...)
{
......@@ -1179,19 +1193,27 @@ write_child (GIOChannel *write_chan, char *format, ...)
va_list ap;
gchar *buf;
gsize len;
GError *error = NULL;
va_start (ap, format);
buf = g_strdup_vprintf (format, ap);
err = g_io_channel_write_chars (write_chan, buf, strlen (buf), &len, NULL);
err = g_io_channel_write_chars (write_chan, buf, strlen (buf), &len, &error);
if (err == G_IO_STATUS_ERROR)
g_error ("Error writing: %s\n", error->message);
if (err != G_IO_STATUS_NORMAL)
g_warning ("Writing to child process failed");
else
g_warning ("Wrote '%s' to gnuchess", buf);
err = g_io_channel_flush (write_chan, &error);
if (err == G_IO_STATUS_ERROR)
g_error ("Error flushing: %s\n", error->message);
va_end (ap);
g_free (buf);
}
*/
......@@ -259,7 +259,7 @@ static gboolean sounds_are_fine()
if(!properties->fx)
{
gc_dialog(_("Error: this activity cannot be played with the\nsound effects disabled.\nGo to the configuration dialog to\nenable the sound"), board_stop);
gc_dialog(_("Error: this activity cannot be played with the\nsound effects disabled.\nGo to the configuration dialog to\nenable the sound"), gc_board_stop);
return(NOT_OK);
}
......@@ -288,7 +288,7 @@ static gboolean sounds_are_fine()
{
gchar *msg = g_strdup_printf( _("Error: this activity requires that you first install\nthe packages with gcompris voices for the locale '%s' or '%s'"),
locale, "en");
gc_dialog(msg, board_stop);
gc_dialog(msg, gc_board_stop);
g_free(msg);
return (NOT_OK);
}
......
......@@ -824,7 +824,7 @@ static void start_board (GcomprisBoard *agcomprisBoard)
base_x1_tux = BASE_SOUND_X1_TUX;
if(!properties->fx) {
gc_dialog(_("Error: this activity cannot be played with the\nsound effects disabled.\nGo to the configuration dialog to\nenable the sound"), board_stop);
gc_dialog(_("Error: this activity cannot be played with the\nsound effects disabled.\nGo to the configuration dialog to\nenable the sound"), gc_board_stop);
return;
}
......
......@@ -430,7 +430,7 @@ static void display_board_icon(GcomprisBoard *board, MenuItems *menuitems)
{
/* FIXME: Check board is available for the current profile */
if (board!=NULL
&& board_check_file(board))
&& gc_board_check_file(board))
{
menu_create_item(actualSectionItem, menuitems, board);
}
......
......@@ -556,7 +556,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data)
static int dragging;
double item_x, item_y;
if(!get_board_playing())
if(!gcomprisBoard)
return FALSE;
item_x = event->button.x;
......
......@@ -98,7 +98,7 @@ pyGcomprisBoardType_getattr(pyGcomprisBoardObject *self, char *name)
if(strcmp(name,"is_configurable")==0){
if (!self->cdata->plugin){
board_check_file(self->cdata);
gc_board_check_file(self->cdata);
if (!self->cdata->plugin){
g_warning("board %s/%s seems not working !", self->cdata->section, self->cdata->name);
Py_INCREF(Py_False);
......
......@@ -968,7 +968,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, Shape *shape)
static int dragging;
double item_x, item_y;
if(!get_board_playing())
if(!gcomprisBoard)
return FALSE;
if(board_paused)
......
......@@ -1148,7 +1148,7 @@ static void game_won() {
*
* =====================================================================*/
static gboolean quit_after_delay() {
board_stop();
gc_board_stop();
return FALSE;
}
static gboolean ok_timeout() {
......
......@@ -70,7 +70,7 @@ void gc_about_start ()
gchar *translators = _("translator_credits");
/* Pause the board */
board_pause(TRUE);
gc_board_pause(TRUE);
if(rootitem)
return;
......@@ -401,7 +401,7 @@ void gc_about_stop ()
/* UnPause the board */
if(is_displayed)
board_pause(FALSE);
gc_board_pause(FALSE);
gc_bar_hide (FALSE);
......
......@@ -536,7 +536,7 @@ item_event_bar(GnomeCanvasItem *item, GdkEvent *event, gchar *data)
{
gc_sound_play_ogg ("gobble", NULL);
gc_bar_hide (TRUE);
board_stop();
gc_board_stop();
}
else if(!strcmp((char *)data, "help"))
{
......
......@@ -26,6 +26,8 @@
static struct BoardPluginData *bp_data;
static gboolean get_board_playing(void);
#if defined _WIN32 || defined __WIN32__
# undef WIN32 /* avoid warning on mingw32 */
# define WIN32
......@@ -195,7 +197,8 @@ void gc_board_set_current(GcomprisBoard * gcomprisBoard)
}
#ifdef WIN32
gboolean board_check_file(GcomprisBoard *gcomprisBoard)
gboolean
gc_board_check_file(GcomprisBoard *gcomprisBoard)
{
GcomprisProperties *properties = gc_prop_get();
BoardPlugin *bp;
......@@ -251,7 +254,8 @@ gboolean board_check_file(GcomprisBoard *gcomprisBoard)
return FALSE;
}
#else
gboolean board_check_file(GcomprisBoard *gcomprisBoard)
gboolean
gc_board_check_file(GcomprisBoard *gcomprisBoard)
{
GModule *gmodule = NULL;
gchar *gmodule_file = NULL;
......@@ -328,13 +332,14 @@ gboolean board_check_file(GcomprisBoard *gcomprisBoard)
}
#endif
void board_play(GcomprisBoard *gcomprisBoard)
void
gc_board_play(GcomprisBoard *gcomprisBoard)
{
BoardPlugin *bp;
g_assert(gcomprisBoard!=NULL);
board_check_file(gcomprisBoard);
gc_board_check_file(gcomprisBoard);
if(gcomprisBoard->plugin!=NULL)
{
......@@ -355,7 +360,8 @@ void board_play(GcomprisBoard *gcomprisBoard)
bp_data->playing = TRUE;
}
void board_pause(int pause)
void
gc_board_pause(int pause)
{
if (get_board_playing() && gc_board_get_current_board_plugin())
{
......@@ -364,7 +370,8 @@ void board_pause(int pause)
}
}
void board_stop(void)
void
gc_board_stop(void)
{
if (bp_data->playing && gc_board_get_current_board_plugin())
{
......@@ -380,7 +387,8 @@ void board_stop(void)
bp_data->playing = FALSE;
}
gboolean get_board_playing(void)
static gboolean
get_board_playing(void)
{
return bp_data->playing;
}
......@@ -403,7 +411,7 @@ void board_run_next_end()
gc_im_reset();
/*run the board */
board_play(next_board);
gc_board_play(next_board);
}
void board_run_next(GcomprisBoard *board)
......
......@@ -53,11 +53,10 @@ BoardPlugin *gc_board_get_current_board_plugin(void);
void set_current_board_plugin(BoardPlugin * ip);
GcomprisBoard *gc_board_get_current(void);
void gc_board_set_current(GcomprisBoard * gcomprisBoard);
gboolean board_check_file(GcomprisBoard *gcomprisBoard);
void board_play(GcomprisBoard *gcomprisBoard);
void board_stop(void);
void board_pause(int pause);
gboolean get_board_playing(void);
gboolean gc_board_check_file(GcomprisBoard *gcomprisBoard);
void gc_board_play(GcomprisBoard *gcomprisBoard);
void gc_board_stop(void);
void gc_board_pause(int pause);
gchar *board_get_info_text(void);
void board_set_info_text(gchar * text);
......
......@@ -128,7 +128,7 @@ gc_bonus_end_display(BoardFinishedList type) {
gc_bonus_end_display_running = TRUE;
/* First pause the board */
board_pause(TRUE);
gc_board_pause(TRUE);
/* WARNING: I remove 1 to the BOARD_FINISHED_LAST because RANDOM is for GOOD end only */
if(type==BOARD_FINISHED_RANDOM)
......@@ -247,7 +247,7 @@ gc_bonus_display(BonusStatusList gamewon, BonusList bonus_id)
}
/* First pause the board */
board_pause(TRUE);
gc_board_pause(TRUE);
if(bonus_id==BONUS_RANDOM)
bonus_id = RAND(1, BONUS_LAST-2);
......@@ -381,5 +381,5 @@ end_bonus()
gc_bar_hide(FALSE);
/* Re-Start the board */
board_pause(FALSE);
gc_board_pause(FALSE);
}
......@@ -158,7 +158,7 @@ gc_config_start ()
GnomeCanvasItem *item, *item2;
/* Pause the board */
board_pause(TRUE);
gc_board_pause(TRUE);
if(rootitem)
return;
......@@ -502,7 +502,7 @@ void gc_config_stop ()
if(rootitem!=NULL)
{
gtk_object_destroy(GTK_OBJECT(rootitem));
board_pause(FALSE);
gc_board_pause(FALSE);
}
rootitem = NULL;
......@@ -518,7 +518,7 @@ void gc_config_stop ()