Commit 583d68a5 authored by Bruno Coudoin's avatar Bruno Coudoin

Cleanup of clockgame.c, make a good usage of it's 2 background images.

	Adapter skins to support 2 different file selector
	Added a function in skin API to accept number in skins:
	    <number id="gcompris/fileselectdiry" value="80"/>
	Updated our 2 skin.xml
	removed many warnings.
parent 0a584a65
2005-10-01 Bruno coudoin <bruno.coudoin@free.fr>
Cleanup of clockgame.c, make a good usage of it's 2 background images.
Adapter skins to support 2 different file selector
Added a function in skin API to accept number in skins:
<number id="gcompris/fileselectdiry" value="80"/>
Updated our 2 skin.xml
removed many warnings.
* boards/skins/babytoy/skin.xml:
* boards/skins/gartoon/skin.xml:
* src/boards/canal_lock.c: (canal_lock_create_item), (move_boat),
(toggle_lock), (hightlight), (item_event):
* src/boards/clockgame.c: (end_board), (clockgame_next_level),
(destroy_all_items), (display_hour), (display_minute),
(display_second), (clockgame_create_item), (time_equal):
* src/gcompris/file_selector.c: (display_file_selector),
(display_files):
* src/gcompris/images_selector.c:
* src/gcompris/skin.c: (gcompris_skin_xml_load),
(gcompris_skin_load), (gcompris_skin_get_font_default),
(gcompris_skin_get_number_default):
* src/gcompris/skin.h:
* src/gcompris/soundutil.c: (scheduler_bgnd), (thread_play_ogg):
* src/gcompris/soundutil.h:
2005-09-29 Bruno coudoin <bruno.coudoin@free.fr>
Fixed formatting of boards/wordsgame/default-*
......
......@@ -3,13 +3,19 @@
<GCompris>
<Skin>
<!-- Defines the gcompris colors -->
<color id="gcompris/title" rgba="0x0F0FC0FF"/>
<color id="gcompris/text button" rgba="0xFFFFFFFF"/>
<color id="gcompris/content" rgba="0x0D0DFAFF"/>
<color id="gcompris/subtitle" rgba="0xB00400FF"/>
<color id="gcompris/shadow" rgba="0X000000FF"/>
<color id="gcompris/fileselectbg" rgba="0xf6f9b1FF"/>
<color id="gcompris/imageselectbg" rgba="0x6280d9FF"/>
<color id="gcompris/title" rgba="0x0F0FC0FF"/>
<color id="gcompris/text button" rgba="0xFFFFFFFF"/>
<color id="gcompris/content" rgba="0x0D0DFAFF"/>
<color id="gcompris/subtitle" rgba="0xB00400FF"/>
<color id="gcompris/shadow" rgba="0X000000FF"/>
<!-- Defines the entry coordinate in your file_selector_bg.png -->
<color id="gcompris/fileselectbg" rgba="0xf6f9b1FF"/>
<color id="gcompris/fileselectcol" rgba="0X3558f0FF"/>
<number id="gcompris/fileselectx" value="55"/>
<number id="gcompris/fileselecty" value="30"/>
<number id="gcompris/fileselectdiry" value="80"/>
<!-- Defines the main gcompris fonts -->
<font id="gcompris/title" name="Sans 20"/>
......@@ -29,6 +35,9 @@
<font id="gcompris/board/huge" name="Sans 28"/>
<font id="gcompris/board/huge bold" name="Sans bold 28"/>
<color id="menu/text" rgba="0xFFFFFFFF"/>
<color id="menu/text_shadow" rgba="0x000000FF"/>
<!-- Here you may define some other properties that will -->
<!-- affect a particular game. -->
<!-- For example, in futur, the colors of the canal lock game will be -->
......@@ -50,8 +59,7 @@
<color id="erase/rectangle in3" rgba="0xf49a9a66"/>
<color id="erase/rectangle out3" rgba="0XFFFFFFFF"/>
<color id="maze/wall color" rgba="0x0000FFFF"/>
<color id="menu/text" rgba="0xFFFFFFFF"/>
<color id="menu/text_shadow" rgba="0x000000FF"/>
<color id="clockgame/text" rgba="0xFFFFFFFF"/>
</Skin>
</GCompris>
......@@ -3,16 +3,18 @@
<GCompris>
<Skin>
<!-- Defines the gcompris colors -->
<color id="gcompris/title" rgba="0Xc20200FF"/>
<color id="gcompris/text button" rgba="0Xc20200FF"/>
<color id="gcompris/content" rgba="0Xfb891bFF"/>
<color id="gcompris/subtitle" rgba="0Xf4bb00FF"/>
<color id="gcompris/shadow" rgba="0XFFFFFFFF"/>
<color id="gcompris/fileselectbg" rgba="0X1ECECEFF"/>
<color id="gcompris/imageselectbg" rgba="0X1ECECEFF"/>
<color id="gcompris/boardselectbg" rgba="0X1ECECEFF"/>
<color id="gcompris/title" rgba="0Xc20200FF"/>
<color id="gcompris/text button" rgba="0Xc20200FF"/>
<color id="gcompris/content" rgba="0Xfb891bFF"/>
<color id="gcompris/subtitle" rgba="0Xf4bb00FF"/>
<color id="gcompris/shadow" rgba="0XFFFFFFFF"/>
<color id="gcompris/imageselectbg" rgba="0X6280d9FF"/>
<color id="gcompris/fileselectbg" rgba="0X018404FF"/>
<color id="gcompris/fileselectcol" rgba="0X000000FF"/>
<number id="gcompris/fileselectx" value="85"/>
<number id="gcompris/fileselecty" value="80"/>
<number id="gcompris/fileselectdiry" value="180"/>
<!-- Defines the main gcompris fonts -->
<font id="gcompris/title" name="sans 20"/>
......@@ -32,6 +34,9 @@
<font id="gcompris/board/huge" name="sans 28"/>
<font id="gcompris/board/huge bold" name="sans 29"/>
<color id="menu/text" rgba="0x597ad7FF"/>
<color id="menu/text_shadow" rgba="0x000000FF"/>
<!-- Here you may define some other properties that will -->
<!-- affect a particular game. -->
<!-- For example, in futur, the colors of the canal lock game will be -->
......@@ -58,7 +63,7 @@
<color id="maze/wall color" rgba="0x1a1109ff"/>
<color id="menu/text" rgba="0x597ad7FF"/>
<color id="clockgame/text" rgba="0Xc20200FF"/>
</Skin>
</GCompris>
......
......@@ -261,8 +261,6 @@ static void canal_lock_destroy_all_items()
/* ==================================== */
static GnomeCanvasItem *canal_lock_create_item(GnomeCanvasGroup *parent)
{
int i,j;
GnomeCanvasItem *item = NULL;
GdkPixbuf *pixmap = NULL;
boardRootItem = GNOME_CANVAS_GROUP(
......@@ -461,9 +459,6 @@ static void game_won()
/* Move the boat to the next possible position */
static void move_boat()
{
gboolean status = TRUE;
double y1 = 0;
gint min = LEFT_CANAL_HEIGHT;
/* If there is already an animation do nothing else set animation to avoid deadlock */
if(animation)
......@@ -556,8 +551,8 @@ static void toggle_lock(GnomeCanvasItem *item)
{
gboolean status = TRUE;
double y1 = 0;
gint min;
guint animate_speed;
gint min = 0;
guint animate_speed = 0;
/* If there is already an animation do nothing else set animation to avoid deadlock */
if(animation)
......@@ -671,7 +666,7 @@ static gboolean animate_step()
/* Highlight the given item */
static void hightlight(GnomeCanvasItem *item, gboolean status)
{
guint color;
guint color = 0;
/* This is an image, not a rectangle */
if(item == tuxboat_item)
......@@ -719,7 +714,7 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data)
/* If there is already an animation do nothing */
if(animation)
return;
return FALSE;
if(item == lock_left_item)
{
......
/* gcompris - clockgame.c
*
* Time-stamp: <2005/09/24 12:30:25 bruno>
* Time-stamp: <2005/10/01 01:35:45 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -26,16 +26,18 @@
#define SOUNDLISTFILE PACKAGE
static GList *item_list = NULL;
static GcomprisBoard *gcomprisBoard = NULL;
static gboolean board_paused = TRUE;
static GnomeCanvasGroup *boardRootItem = NULL;
static GnomeCanvasItem *second_item;
static GnomeCanvasItem *hour_item;
static GnomeCanvasItem *minute_item;
static GnomeCanvasItem *digital_time_item;
static GnomeCanvasItem *digital_time_item_s;
static GnomeCanvasItem *time_to_find_item;
static GnomeCanvasItem *time_to_find_item_s;
/* Center of the clock and it's size */
double cx;
......@@ -59,15 +61,15 @@ static void process_ok(void);
static int gamewon;
static void game_won(void);
static GnomeCanvasItem *clockgame_create_item(GnomeCanvasGroup *parent);
static void clockgame_destroy_item(GnomeCanvasItem *item);
static void clockgame_destroy_all_items(void);
static void clockgame_create_item(GnomeCanvasGroup *parent);
static void destroy_all_items(void);
static void get_random_hour(GcomprisTime *time);
static void clockgame_next_level(void);
static gint item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data);
static void display_hour(guint hour);
static void display_minute(guint minute);
static void display_second(guint second);
static gboolean time_equal(GcomprisTime *time1, GcomprisTime *time2);
/* Description of this plugin */
static BoardPlugin menu_bp =
......@@ -166,7 +168,7 @@ end_board ()
{
pause_board(TRUE);
gcompris_score_end();
clockgame_destroy_all_items();
destroy_all_items();
}
gcomprisBoard = NULL;
gcompris_set_cursor(GCOMPRIS_DEFAULT_CURSOR);
......@@ -213,35 +215,33 @@ static void clockgame_next_level()
gcompris_bar_set_level(gcomprisBoard);
gcompris_score_set(gcomprisBoard->sublevel);
clockgame_destroy_all_items();
destroy_all_items();
/* Try the next level */
get_random_hour(&timeToFind);
get_random_hour(&currentTime);
clockgame_create_item(gnome_canvas_root(gcomprisBoard->canvas));
}
/* Avoid to show up the solution directly */
do {
get_random_hour(&currentTime);
} while(time_equal(&timeToFind, &currentTime));
clockgame_create_item(gnome_canvas_root(gcomprisBoard->canvas));
static void clockgame_destroy_item(GnomeCanvasItem *item)
{
item_list = g_list_remove (item_list, item);
gtk_object_destroy (GTK_OBJECT(item));
}
/* ==================================== */
/* Destroy all the items */
static void clockgame_destroy_all_items()
static void
destroy_all_items()
{
GnomeCanvasItem *item;
while(g_list_length(item_list)>0)
{
item = g_list_nth_data(item_list, 0);
clockgame_destroy_item(item);
}
if(boardRootItem!=NULL)
gtk_object_destroy (GTK_OBJECT(boardRootItem));
boardRootItem = NULL;
}
static void display_digital_time(GnomeCanvasItem *item, GcomprisTime *time)
{
gchar *text = NULL;
......@@ -292,7 +292,6 @@ static void display_hour(guint hour)
NULL);
currentTime.hour=hour;
display_digital_time(digital_time_item, &currentTime);
}
......@@ -325,7 +324,6 @@ static void display_minute(guint minute)
NULL);
currentTime.minute=minute;
display_digital_time(digital_time_item, &currentTime);
}
static void display_second(guint second)
......@@ -357,11 +355,11 @@ static void display_second(guint second)
NULL);
currentTime.second=second;
display_digital_time(digital_time_item, &currentTime);
}
static GnomeCanvasItem *clockgame_create_item(GnomeCanvasGroup *parent)
static void
clockgame_create_item(GnomeCanvasGroup *parent)
{
GnomeCanvasItem *item;
double needle_size = clock_size;
......@@ -375,6 +373,13 @@ static GnomeCanvasItem *clockgame_create_item(GnomeCanvasGroup *parent)
gchar *mtext = NULL;
gchar *font = NULL;
boardRootItem = GNOME_CANVAS_GROUP(
gnome_canvas_item_new (gnome_canvas_root(gcomprisBoard->canvas),
gnome_canvas_group_get_type (),
"x", (double) 0,
"y", (double) 0,
NULL));
canvasPoints = gnome_canvas_points_new (2);
for(min = 1 ; min <= 60 ; min += 1)
......@@ -401,20 +406,19 @@ static GnomeCanvasItem *clockgame_create_item(GnomeCanvasGroup *parent)
canvasPoints->coords[2]=cx + needle_size * sin(ang);
canvasPoints->coords[3]=cy - needle_size * cos(ang);
item = gnome_canvas_item_new (parent,
item = gnome_canvas_item_new (boardRootItem,
gnome_canvas_line_get_type (),
"points", canvasPoints,
"fill_color", color,
"width_units", (double)1,
"width_pixels", (guint) 2,
NULL);
item_list = g_list_append (item_list, item);
/* Display minute number */
if(gcomprisBoard->level<5)
{
mtext = g_strdup_printf("%d", min);
item = gnome_canvas_item_new (parent,
item = gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", mtext,
"font", font,
......@@ -425,7 +429,6 @@ static GnomeCanvasItem *clockgame_create_item(GnomeCanvasGroup *parent)
"justification", GTK_JUSTIFY_CENTER,
NULL);
g_free(mtext);
item_list = g_list_append (item_list, item);
}
/* Display hour numbers */
......@@ -433,7 +436,7 @@ static GnomeCanvasItem *clockgame_create_item(GnomeCanvasGroup *parent)
if(min%5==0)
{
mtext = g_strdup_printf( "%d", min/5);
item = gnome_canvas_item_new (parent,
item = gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", mtext,
"font", font,
......@@ -444,7 +447,6 @@ static GnomeCanvasItem *clockgame_create_item(GnomeCanvasGroup *parent)
"justification", GTK_JUSTIFY_CENTER,
NULL);
g_free(mtext);
item_list = g_list_append (item_list, item);
}
}
......@@ -452,8 +454,20 @@ static GnomeCanvasItem *clockgame_create_item(GnomeCanvasGroup *parent)
/* Create the text area for the digital time display */
if(gcomprisBoard->level<4)
{
digital_time_item_s =
gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", "",
"font", gcompris_skin_font_board_medium,
"x", (double) cx + 1.0,
"y", (double) cy + needle_size/2 + 1.0,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", 0xc4c4c4ff,
NULL);
display_digital_time(digital_time_item_s, &currentTime);
digital_time_item =
gnome_canvas_item_new (parent,
gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", "",
"font", gcompris_skin_font_board_medium,
......@@ -463,10 +477,10 @@ static GnomeCanvasItem *clockgame_create_item(GnomeCanvasGroup *parent)
"fill_color", "blue",
NULL);
display_digital_time(digital_time_item, &currentTime);
item_list = g_list_append (item_list, digital_time_item);
}
else
{
digital_time_item_s = NULL;
digital_time_item = NULL;
}
......@@ -476,7 +490,7 @@ static GnomeCanvasItem *clockgame_create_item(GnomeCanvasGroup *parent)
canvasPoints->coords[1]=0;
canvasPoints->coords[2]=0;
canvasPoints->coords[3]=0;
hour_item = gnome_canvas_item_new (parent,
hour_item = gnome_canvas_item_new (boardRootItem,
gnome_canvas_line_get_type (),
"points", canvasPoints,
"fill_color", "darkblue",
......@@ -486,12 +500,11 @@ static GnomeCanvasItem *clockgame_create_item(GnomeCanvasGroup *parent)
gtk_signal_connect(GTK_OBJECT(hour_item), "event",
(GtkSignalFunc) item_event,
NULL);
item_list = g_list_append (item_list, hour_item);
display_hour(currentTime.hour);
/* Create the minute needle */
minute_item = gnome_canvas_item_new (parent,
minute_item = gnome_canvas_item_new (boardRootItem,
gnome_canvas_line_get_type (),
"points", canvasPoints,
"fill_color", "darkblue",
......@@ -501,12 +514,11 @@ static GnomeCanvasItem *clockgame_create_item(GnomeCanvasGroup *parent)
gtk_signal_connect(GTK_OBJECT(minute_item), "event",
(GtkSignalFunc) item_event,
NULL);
item_list = g_list_append (item_list, minute_item);
display_minute(currentTime.minute);
/* Create the second needle */
second_item = gnome_canvas_item_new (parent,
second_item = gnome_canvas_item_new (boardRootItem,
gnome_canvas_line_get_type (),
"points", canvasPoints,
"fill_color", "darkblue",
......@@ -516,42 +528,60 @@ static GnomeCanvasItem *clockgame_create_item(GnomeCanvasGroup *parent)
gtk_signal_connect(GTK_OBJECT(second_item), "event",
(GtkSignalFunc) item_event,
NULL);
item_list = g_list_append (item_list, second_item);
display_second(currentTime.second);
/* Create the text area for the time to find display */
item =
gnome_canvas_item_new (parent,
gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", _("Set the watch to:"),
"font", gcompris_skin_font_board_small,
"x", (double) gcomprisBoard->width*0.17 + 1.0,
"y", (double) cy + needle_size + needle_size / 3 - 30 + 1.0,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_shadow,
NULL);
gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", _("Set the watch to:"),
"font", gcompris_skin_font_board_small,
"x", (double) gcomprisBoard->width*0.17,
"y", (double) cy + needle_size + needle_size / 3 - 30,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_get_color("clockgame/text"),
NULL);
time_to_find_item_s =
gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", _("Set the watch to:"),
"font", gcompris_skin_font_board_small,
"x", (double) gcomprisBoard->width*0.17,
"y", (double) cy + needle_size + needle_size / 3 - 30,
"text", "",
"font", gcompris_skin_font_board_big_bold,
"x", (double) gcomprisBoard->width*0.17 + 1.0,
"y", (double) cy + needle_size + needle_size / 3 + 1.0,
"anchor", GTK_ANCHOR_CENTER,
"fill_color", "white",
"fill_color_rgba", gcompris_skin_color_shadow,
NULL);
item_list = g_list_append (item_list, item);
display_digital_time(time_to_find_item_s, &timeToFind);
time_to_find_item =
gnome_canvas_item_new (parent,
gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", "",
"font", gcompris_skin_font_board_big_bold,
"x", (double) gcomprisBoard->width*0.17,
"y", (double) cy + needle_size + needle_size / 3,
"anchor", GTK_ANCHOR_CENTER,
"fill_color", "white",
"fill_color_rgba", gcompris_skin_get_color("clockgame/text"),
NULL);
display_digital_time(time_to_find_item, &timeToFind);
item_list = g_list_append (item_list, time_to_find_item);
return (item);
}
/*
* Returns true is given times are equal
*/
static gboolean time_equal(GcomprisTime *time1, GcomprisTime *time2)
static gboolean
time_equal(GcomprisTime *time1, GcomprisTime *time2)
{
/* No seconds at first levels */
if(second_item==NULL || gcomprisBoard->level<=2)
......
/* gcompris - file_selector.c
*
* Time-stamp: <2005/09/26 23:31:44 bruno>
* Time-stamp: <2005/10/01 00:19:33 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -46,9 +46,6 @@ static gint item_event_file_selector(GnomeCanvasItem *item,
static gint item_event_scroll(GnomeCanvasItem *item,
GdkEvent *event,
GnomeCanvas *canvas);
static gint item_event_fileset_selector(GnomeCanvasItem *item,
GdkEvent *event,
gpointer data);
static gint item_event_directory(GnomeCanvasItem *item,
GdkEvent *event,
char *dir);
......@@ -76,19 +73,18 @@ static GtkEntry *widget_entry = NULL;
static GList *file_list = NULL;
/* Represent the limits of control area */
#define CONTROL_AREA_X1 40.0
#define CONTROL_AREA_Y1 20.0
#define CONTROL_AREA_X2 760.0
#define CONTROL_AREA_Y2 80.0
static guint32 control_area_x1;
static guint32 control_area_y1;
static guint32 directory_label_y;
/* Represent the limits of the file area */
#define DRAWING_AREA_X1 40.0
#define DRAWING_AREA_Y1 120.0
#define DRAWING_AREA_Y1 220.0
#define DRAWING_AREA_X2 760.0
#define DRAWING_AREA_Y2 500.0
#define HORIZONTAL_NUMBER_OF_IMAGE 6
#define VERTICAL_NUMBER_OF_IMAGE 5
#define HORIZONTAL_NUMBER_OF_IMAGE 5
#define VERTICAL_NUMBER_OF_IMAGE 3
#define IMAGE_GAP 18
#define IMAGE_WIDTH (DRAWING_AREA_X2-DRAWING_AREA_X1)/HORIZONTAL_NUMBER_OF_IMAGE-IMAGE_GAP
......@@ -201,6 +197,11 @@ display_file_selector(int the_mode,
mode = the_mode;
/* Get the coordinate x y of the control area from the skin */
control_area_x1 = gcompris_skin_get_number_default("gcompris/fileselectx", 85);
control_area_y1 = gcompris_skin_get_number_default("gcompris/fileselecty", 80);
directory_label_y = gcompris_skin_get_number_default("gcompris/fileselectdiry", 180);
if(file_types) {
file_types_string = g_strdup(file_types);
}
......@@ -239,13 +240,13 @@ display_file_selector(int the_mode,
gdk_pixbuf_unref(pixmap);
/* Entry area */
widget_entry = (GtkEntry *)gtk_entry_new_with_max_length (50);
widget_entry = (GtkEntry *)gtk_entry_new_with_max_length (30);
item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
gnome_canvas_widget_get_type (),
"widget", GTK_WIDGET(widget_entry),
"x", (double) CONTROL_AREA_X1 + 10,
"y", (double) y_start + 30,
"width", 250.0,
"x", (double) control_area_x1,
"y", (double) control_area_y1,
"width", 230.0,
"height", 30.0,
"anchor", GTK_ANCHOR_NW,
"size_pixels", FALSE,
......@@ -296,8 +297,8 @@ display_file_selector(int the_mode,
gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
gnome_canvas_widget_get_type (),
"widget", GTK_WIDGET(gtk_combo_filetypes),
"x", (double) CONTROL_AREA_X1 + 450,
"y", (double) y_start + 30,
"x", (double) control_area_x1 + 400,
"y", (double) control_area_y1,
"width", 250.0,
"height", 35.0,
"anchor", GTK_ANCHOR_NW,
......@@ -508,9 +509,9 @@ static void display_files(GnomeCanvasItem *root_item, gchar *rootdir)
item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(file_root_item),
gnome_canvas_text_get_type (),
"text", rootdir,
"x", (double)CONTROL_AREA_X1 + 10,
"y", (double)CONTROL_AREA_Y1 + 50,
"fill_color_rgba", 0x0000FFFF,
"x", (double)control_area_x1,
"y", (double)directory_label_y,
"fill_color_rgba", gcompris_skin_get_color("gcompris/fileselectcol"),
"anchor", GTK_ANCHOR_NW,
NULL);
......@@ -611,7 +612,7 @@ static void display_files(GnomeCanvasItem *root_item, gchar *rootdir)
"x", (double)ix + (IMAGE_WIDTH + IMAGE_GAP)/2,
"y", (double)iy + IMAGE_HEIGHT - 5,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", 0x0000FFFF,
"fill_color_rgba", gcompris_skin_get_color("gcompris/fileselectcol"),
NULL);
if(g_file_test(allfilename, G_FILE_TEST_IS_DIR)) {
......
/* gcompris - images_selector.c
*
* Time-stamp: <2005/09/28 21:00:01 bruno>
* Time-stamp: <2005/09/29 23:09:06 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -24,6 +24,8 @@
*
*/
#include "string.h"
/* libxml includes */
#include <libxml/tree.h>
#include <libxml/parser.h>
......
......@@ -23,8 +23,9 @@
#include <libxml/tree.h>
#include <libxml/parser.h>
GHashTable* gcompris_skin_fonts = NULL;
GHashTable* gcompris_skin_colors = NULL;
GHashTable* gcompris_skin_fonts = NULL;
GHashTable* gcompris_skin_colors = NULL;
GHashTable* gcompris_skin_numbers = NULL;
guint32 gcompris_skin_color_title;
guint32 gcompris_skin_color_text_button;
......@@ -317,6 +318,17 @@ void gcompris_skin_xml_load (gchar* skin)
} else {
if(key!=NULL) g_free(key);
if(data!=NULL) g_free(data);
}
}
else if(g_strcasecmp(node->name,"number")==0){
key = xmlGetProp(node, "id");
data = xmlGetProp(node, "value");
if((key!=NULL)&&(data!=NULL)){
int number = atoi(data);
g_hash_table_insert(gcompris_skin_numbers, key, GUINT_TO_POINTER(number));
} else {
if(key!=NULL) g_free(key);
if(data!=NULL) g_free(data);
}
}
node = node->next;
......@@ -343,6 +355,9 @@ void gcompris_skin_load (gchar* skin)
gcompris_skin_colors = g_hash_table_new_full(g_str_hash, g_str_equal,
gcompris_skin_free_string,
NULL);
gcompris_skin_numbers = g_hash_table_new_full(g_str_hash, g_str_equal,
gcompris_skin_free_string,
NULL);
gcompris_skin_xml_load(DEFAULT_SKIN);
if(strcmp(skin,DEFAULT_SKIN)!=0)
gcompris_skin_xml_load(skin);
......@@ -385,3 +400,15 @@ gchar* gcompris_skin_get_font_default(gchar* id, gchar* def)
return (gchar*)result;
return def;
}
/*
* Get the skin 'number' associated to the id
*/
guint32 gcompris_skin_get_number_default(gchar* id, guint32 def)
{
gpointer result;
result = g_hash_table_lookup(gcompris_skin_numbers, (gpointer)id);
if(result!=NULL)
return GPOINTER_TO_UINT(result);
return def;
}
......@@ -54,7 +54,8 @@ void gcompris_skin_free (void);
guint32 gcompris_skin_get_color_default(gchar* id, guint32 def);
gchar* gcompris_skin_get_font_default(gchar* id, gchar* def);
#define gcompris_skin_get_color(id) gcompris_skin_get_color_default(id, 0x0D0DFA00)
#define gcompris_skin_get_font(id) gcompris_skin_get_font_default(id, "Sans 12")
#define gcompris_skin_get_color(id) gcompris_skin_get_color_default(id, 0x0D0DFA00)
#define gcompris_skin_get_font(id) gcompris_skin_get_font_default(id, "Sans 12")
#define gcompris_skin_get_number(id) gcompris_skin_get_number_default(id, 0)
#endif
......@@ -17,6 +17,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "string.h"
#include <unistd.h> /* sleep */
#ifdef __APPLE__
# include <sys/types.h>
#endif
......@@ -186,7 +189,7 @@ static gpointer scheduler_bgnd (gpointer user_data)
{
/* Music can be disabled at any time */
if ( !gcompris_get_properties()->music )
return;
return NULL;
for(i=0; i<g_list_length(musiclist); i++)
{
......@@ -240,7 +243,6 @@ static gpointer scheduler (gpointer user_data)
======================================================================*/
static void* thread_play_ogg (char *file)
{
GcomprisBoard *gcomprisBoard = get_current_gcompris_board();
gchar *tmpstr;
if (!g_file_test (file, G_FILE_TEST_EXISTS)) {
......
......@@ -44,6 +44,15 @@ void gcompris_close_sound(void);
int decode_ogg_file(char *infile);
void display_ao_devices();
/*
* SDL PLAYER
*/
int sdlplayer_init();
int sdlplayer_bg();
void sdlplayer_close();
void sdlplayer_reopen();
int sdlplayer(char *filename, int volume);
gchar *gcompris_alphabet_sound(gchar *chars);
#endif
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