Commit f0874307 authored by Bruno Coudoin's avatar Bruno Coudoin

added an explanation on languages in GCompris fixed compile warning fixed

	* docs/website/sommaire.html: added an explanation on languages in GCompris
	* src/boards/machpuzzle.c: (minigolf_create_item),
	(create_machine_item), (minigolf_move): fixed compile warning
	* src/boards/memory.c: (end_board), (memory_destroy_all_items): fixed a crash,
	 tux_memory was not set to NULL and was reused.
	* src/gcompris/config.c: (item_event_ok): implemented instant fullscreen.
	* src/gcompris/gcompris.c: (init_background), (setup_window),
	(gcompris_set_fullscreen), (gcompris_exit), (gcompris_init): implemented instant fullscreen.
	* src/gcompris/gcompris.h: implemented instant fullscreen.
parent 7dc72432
2005-11-11 Bruno coudoin <bruno.coudoin@free.fr>
* docs/website/sommaire.html: added an explanation on languages in GCompris
* src/boards/machpuzzle.c: (minigolf_create_item),
(create_machine_item), (minigolf_move): fixed compile warning
* src/boards/memory.c: (end_board), (memory_destroy_all_items): fixed a crash,
tux_memory was not set to NULL and was reused.
* src/gcompris/config.c: (item_event_ok): implemented instant fullscreen.
* src/gcompris/gcompris.c: (init_background), (setup_window),
(gcompris_set_fullscreen), (gcompris_exit), (gcompris_init): implemented instant fullscreen.
* src/gcompris/gcompris.h: implemented instant fullscreen.
2005-11-11 Bruno coudoin <bruno.coudoin@free.fr>
* src/boards/memory.c: (memory_destroy_all_items), (hide_card): cleanup, tries to solve
......
......@@ -34,6 +34,8 @@ MM_reloadPage(true);
<div id="MAIN">
<div class="intro"><B>Welcome to #NOM_SITE_SPIP. Please, select your language... </B>
<br>
Please, note that the GCompris game is translated in more than 40 languages. The Web site is translated only in a few of them, except for the activity screenshots pages.
<br>
</div>
<div class="conteneur">
......
......@@ -30,7 +30,6 @@ typedef enum {
MACH_VERT_WALL,
MACH_HOLE,
MACH_DIAG_WALL,
MACH_BILLARD_BALL,
MACH_BASKET_BALL,
MACH_FLYING_BALL,
} MachItemType;
......@@ -234,7 +233,6 @@ static void minigolf_destroy_all_items()
/* ==================================== */
static GnomeCanvasItem *minigolf_create_item(GnomeCanvasGroup *parent)
{
int i,j;
boardRootItem = GNOME_CANVAS_GROUP(
gnome_canvas_item_new (gnome_canvas_root(gcomprisBoard->canvas),
......@@ -310,6 +308,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, MachItem *machItem)
return FALSE;
}
#if 0
static void dump_machItem(MachItem *machItem)
{
......@@ -325,15 +324,14 @@ static void dump_machItem(MachItem *machItem)
printf(" vyo = %f\n", machItem->vyo);
}
#endif
/* Create a machine item */
static MachItem *create_machine_item(MachItemType machItemType, double x, double y)
{
MachItem *machItem;
GnomeCanvasItem *item;
guint width;
guint height;
guint hs = 0;
machItem = g_new (MachItem, 1);
......@@ -617,7 +615,7 @@ static void minigolf_move(GList *item_list)
item_absolute_move(item, machItem->xpos, machItem->ypos);
if(machItem->ypos>=MIN_Y2-machItem->height-BORDER && (y1 - machItem->ypos)<=0 || collision == TRUE)
if((machItem->ypos>=MIN_Y2-machItem->height-BORDER && (y1 - machItem->ypos)<=0) || collision == TRUE)
{
machItem->vyo = machItem->vyo * -0.5;
machItem->vxo = machItem->vxo * 0.5;
......@@ -629,7 +627,7 @@ static void minigolf_move(GList *item_list)
//machItem->vxo *= 0.9;
}
if(y1<=MIN_Y1 && (y1 - machItem->ypos)>=0 || collision == TRUE)
if((y1<=MIN_Y1 && (y1 - machItem->ypos)>=0) || collision == TRUE)
{
machItem->vyo = machItem->vyo * -0.5;
machItem->vxo = machItem->vxo * 0.5;
......@@ -639,7 +637,7 @@ static void minigolf_move(GList *item_list)
}
// if(x1<=5 && (x1 - machItem->xpos)>0 || collision == TRUE)
if(x1<=MIN_X1 && machItem->vxo<0 || collision == TRUE)
if((x1<=MIN_X1 && machItem->vxo<0) || collision == TRUE)
{
machItem->vyo = machItem->vyo * 0.5;
machItem->vxo = machItem->vxo * -0.5;
......@@ -648,7 +646,7 @@ static void minigolf_move(GList *item_list)
machItem->xposo=machItem->xpos;
}
if(x2>=MIN_X2 && machItem->vxo>0 || collision == TRUE)
if((x2>=MIN_X2 && machItem->vxo>0) || collision == TRUE)
{
machItem->vyo = 0.5 * machItem->vyo;
machItem->vxo = machItem->vxo * -0.5;
......
/* gcompris - memory.c
*
* Time-stamp: <2005/11/10 01:15:36 bruno>
* Time-stamp: <2005/11/11 21:54:28 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -315,7 +315,7 @@ static GnomeCanvasItem *player_score;
static GnomeCanvasItem *tux_score_s;
static GnomeCanvasItem *player_score_s;
/* set the type of the token returned in string in type_returned */
/* set the type of the token returned in string in returned_type */
void get_random_token(int token_type, gint *returned_type, gchar **string)
{
gchar *result = NULL;
......@@ -592,17 +592,15 @@ static void start_board (GcomprisBoard *agcomprisBoard)
static void
end_board ()
{
printf("end board 1\n");
if (currentUiMode == UIMODE_SOUND)
gcompris_resume_sound();
printf("end board 2\n");
if(gcomprisBoard!=NULL)
{
pause_board(TRUE);
if (tux_id)
g_source_remove(tux_id);
if (win_id)
g_source_remove(win_id);
memory_destroy_all_items();
}
gcomprisBoard = NULL;
......@@ -747,6 +745,7 @@ static void memory_destroy_all_items()
winning_pairs = NULL;
while (g_queue_pop_head (tux_memory));
g_queue_free(tux_memory);
tux_memory = NULL;
}
}
......
/* gcompris - config.c
*
* Time-stamp: <2005/10/10 22:21:34 bruno>
* Time-stamp: <2005/11/11 14:12:35 bruno>
*
* Copyright (C) 2000-2003 Bruno Coudoin
*
......@@ -714,6 +714,14 @@ item_event_ok(GnomeCanvasItem *item, GdkEvent *event, gpointer data)
else if(!strcmp((char *)data, "fullscreen"))
{
properties->fullscreen = (properties->fullscreen ? 0 : 1);
#ifdef XRANDR
/* Changing screen without xrandr is more complex, it requires to remove the
black border we created manually.
*/
if(!properties->noxrandr)
gcompris_set_fullscreen(properties->fullscreen);
#endif
/* Warning changing the image needs to update pixbuf_ref for the focus usage */
g_object_set_data (G_OBJECT (item), "pixbuf_ref",
(properties->fullscreen ? pixmap_checked : pixmap_unchecked));
......
......@@ -189,7 +189,8 @@ typedef struct
} XRANDRData;
static SizeID xr_previous_size = -1;
static SizeID xr_previous_size;
static gboolean xr_previous_size_set = FALSE;
static XRANDRData *xrandr = NULL;
static void xrandr_init ( XRANDRData *xrandr );
......@@ -429,41 +430,28 @@ static void init_background()
gint screen_height, screen_width;
GtkWidget *vbox;
printf("init_background\n");
#ifdef XRANDR
xrandr = g_new0 (XRANDRData, 1);
#endif
gcompris_set_fullscreen(properties->fullscreen);
screen_height = gdk_screen_height();
screen_width = gdk_screen_width();
#ifdef XRANDR
gint i;
/* Search the 800x600 Resolution */
if(properties->fullscreen && !properties->noxrandr) {
g_warning("XRANDR Is compiled in. Searching a good resolution");
xrandr = g_new0 (XRANDRData, 1);
xrandr_init ( xrandr );
/* Check if XRANDR is available */
if (!properties->noxrandr) {
xrandr_get_config ( xrandr );
xr_previous_size = (SizeID)xrandr->xr_current_size;
for (i = 0; i < xrandr->xr_nsize; i++) {
if(xrandr->xr_sizes[i].width == BOARDWIDTH &&
xrandr->xr_sizes[i].height == BOARDHEIGHT+BARHEIGHT) {
xrandr->xr_current_size = (SizeID)i;
break;
}
}
screen_height = xrandr->xr_sizes[xrandr->xr_current_size].height;
screen_width = xrandr->xr_sizes[xrandr->xr_current_size].width;
}
screen_height = xrandr->xr_sizes[xrandr->xr_current_size].height;
screen_width = xrandr->xr_sizes[xrandr->xr_current_size].width;
}
#endif
yratio=screen_height/(float)(BOARDHEIGHT+BARHEIGHT);
xratio=screen_width/(float)BOARDWIDTH;
g_message("The screen_width=%f screen_height=%f\n",
(double)screen_width, (double)screen_height);
g_message("The xratio=%f yratio=%f\n", xratio, yratio);
yratio=screen_height/(float)(BOARDHEIGHT+BARHEIGHT);
xratio=screen_width/(float)BOARDWIDTH;
g_message("The screen_width=%f screen_height=%f\n",
(double)screen_width, (double)screen_height);
g_message("The xratio=%f yratio=%f\n", xratio, yratio);
yratio=xratio=MIN(xratio, yratio);
......@@ -483,10 +471,6 @@ static void init_background()
g_message("Calculated x ratio xratio=%f\n", xratio);
/* First, Remove the gnome crash dialog because it locks the user when in full screen */
signal(SIGSEGV, gcompris_terminate);
signal(SIGINT, gcompris_terminate);
/* Background area if ratio above 1 */
if(properties->fullscreen)
......@@ -715,14 +699,6 @@ static void setup_window ()
gtk_widget_show (GTK_WIDGET(canvas_bg));
if(properties->fullscreen)
{
gdk_window_set_decorations (window->window, 0);
gdk_window_set_functions (window->window, 0);
gtk_widget_set_uposition (window, 0, 0);
gtk_window_fullscreen (GTK_WINDOW(window));
}
init_plugins();
......@@ -815,6 +791,73 @@ void gcompris_end_board()
board_play (get_current_gcompris_board()->previous_board);
}
/** \brief toggle full screen mode
*
*
*/
void gcompris_set_fullscreen(gboolean state)
{
if(state)
{
#ifdef XRANDR
gint i;
/* Search the 800x600 Resolution */
if(properties->fullscreen && !properties->noxrandr) {
g_warning("XRANDR Is compiled in. Searching a good resolution");
/* Check if XRANDR is available */
if (!properties->noxrandr) {
xrandr_get_config ( xrandr );
xr_previous_size = (SizeID)xrandr->xr_current_size;
for (i = 0; i < xrandr->xr_nsize; i++) {
if(xrandr->xr_sizes[i].width == BOARDWIDTH &&
xrandr->xr_sizes[i].height == BOARDHEIGHT+BARHEIGHT)
{
xrandr->xr_current_size = (SizeID)i;
xr_previous_size_set = TRUE;
break;
}
}
}
/* Set the Fullscreen now */
if(xr_previous_size_set)
{
xrandr_set_config( xrandr );
}
}
#endif
gdk_window_set_decorations (window->window, 0);
gdk_window_set_functions (window->window, 0);
gtk_widget_set_uposition (window, 0, 0);
gtk_window_fullscreen (GTK_WINDOW(window));
}
else
{
#ifdef XRANDR
/* Set back the original screen size */
if(xr_previous_size_set && !properties->noxrandr)
{
/* Need to refresh our config or xrandr api will reject us */
if(xrandr)
{
xrandr_get_config ( xrandr );
xrandr->xr_current_size = (SizeID)xr_previous_size;
xrandr_set_config( xrandr );
}
}
xr_previous_size_set = FALSE;
#endif
gdk_window_set_decorations (window->window, 1);
gdk_window_set_functions (window->window, 1);
gtk_widget_set_uposition (window, 0, 0);
gtk_window_unfullscreen (GTK_WINDOW(window));
}
}
void gcompris_exit()
{
/* Do not loopback in exit */
......@@ -825,19 +868,7 @@ void gcompris_exit()
gcompris_db_exit();
#ifdef XRANDR
/* Set back the original screen size */
if(properties->fullscreen && !properties->noxrandr)
{
/* Need to refresh our config or xrandr api will reject us */
if(xrandr)
{
xrandr_get_config ( xrandr );
xrandr->xr_current_size = (SizeID)xr_previous_size;
xrandr_set_config( xrandr );
}
}
#endif
gcompris_set_fullscreen(FALSE);
gtk_main_quit ();
......@@ -1056,6 +1087,10 @@ gcompris_init (int argc, char *argv[])
int popt_option;
gchar *str;
/* First, Remove the gnome crash dialog because it locks the user when in full screen */
signal(SIGSEGV, gcompris_terminate);
signal(SIGINT, gcompris_terminate);
bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
......@@ -1367,13 +1402,6 @@ gcompris_init (int argc, char *argv[])
g_free(str);
/* Set the Fullscreen the last operation */
#ifdef XRANDR
if(properties->fullscreen && !properties->noxrandr) {
xrandr_set_config( xrandr );
}
#endif
gtk_main ();
return 0;
}
......
/* gcompris - gcompris.h
*
* Time-stamp: <2005/09/28 20:53:47 bruno>
* Time-stamp: <2005/11/11 12:50:47 bruno>
*
* Copyright (C) 2000,2001,2002 Bruno Coudoin
*
......@@ -141,6 +141,8 @@ void gcompris_file_selector_save (GcomprisBoard *gcomprisBoard,
FileSelectorCallBack fscb);
void gcompris_file_selector_stop (void);
void gcompris_set_fullscreen(gboolean state);
void gcompris_exit();
gchar *gcompris_get_database();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment