Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Coudoin <bcoudoin@src.gnome.org>2006-03-28 23:39:27 (GMT)
committer Bruno Coudoin <bcoudoin@src.gnome.org>2006-03-28 23:39:27 (GMT)
commit449a332f6328f0a859c2719b164dc551d29500a8 (patch)
treebe69e9b46409e0c8b7e4f32ebcc9d00e31033d9c
parentb8b81581bf7d523d6432fff3c1b3d4cf7653bac5 (diff)
- Fixed cameroon image reference.
- Better colorscheme for chess. - Now empty menu will no more be displayed.
-rw-r--r--ChangeLog13
-rw-r--r--boards/geography/board4_2.xml.in2
-rw-r--r--src/boards/chess.c16
-rw-r--r--src/gcompris/gameutil.c72
-rw-r--r--src/gcompris/profile.c5
5 files changed, 86 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 5455c43..67336f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-03-29 Bruno coudoin <bruno.coudoin@free.fr>
+
+ - Fixed cameroon image reference.
+ - Better colorscheme for chess.
+ - Now empty menu will no more be displayed.
+
+ * boards/geography/board4_2.xml.in:
+ * src/boards/chess.c: (chess_create_item), (move_piece_to),
+ (hightlight_possible_moves):
+ * src/gcompris/gameutil.c: (gcompris_board_has_activity),
+ (gcompris_get_menulist):
+ * src/gcompris/profile.c:
+
2006-03-27 Bruno coudoin <bruno.coudoin@free.fr>
Now erase has 10 sublevels to let small children play longer at the same level
diff --git a/boards/geography/board4_2.xml.in b/boards/geography/board4_2.xml.in
index 17f338c..22b97f1 100644
--- a/boards/geography/board4_2.xml.in
+++ b/boards/geography/board4_2.xml.in
@@ -23,7 +23,7 @@
<Shape name="burundi" pixmapfile="geography/afrique/burundi.png" sound="geography/burundi" x="561" y="295" zoomx="1" zoomy="1" position="0">
<_tooltip>Burundi</_tooltip>
</Shape>
-<Shape name="cameroun" pixmapfile="geography/afrique/cameroun.png" sound="geography/cameroon" x="455" y="223" zoomx="1" zoomy="1" position="0">
+<Shape name="cameroon" pixmapfile="geography/afrique/cameroon.png" sound="geography/cameroon" x="455" y="223" zoomx="1" zoomy="1" position="0">
<_tooltip>Cameroon</_tooltip>
</Shape>
<Shape name="congo" pixmapfile="geography/afrique/congo.png" sound="geography/congo" x="470" y="274" zoomx="1" zoomy="1" position="0">
diff --git a/src/boards/chess.c b/src/boards/chess.c
index ba148ef..1ae3816 100644
--- a/src/boards/chess.c
+++ b/src/boards/chess.c
@@ -68,10 +68,10 @@ static int get_square_from_coord (double x, double y);
#define CHESSBOARD_Y 20
#define SQUARE_WIDTH 60
#define SQUARE_HEIGHT 60
-#define WHITE_COLOR 0x206070FF
-#define BLACK_COLOR 0x4ACCFAFF
-#define WHITE_COLOR_H 0x6B96A2FF
-#define BLACK_COLOR_H 0xA6E7FFFF
+#define WHITE_COLOR 0xFFFF99FF
+#define BLACK_COLOR 0x9999FFFF
+#define WHITE_COLOR_H 0x99FF99FF
+#define BLACK_COLOR_H 0x99FF99FF
#define TURN_X (BOARDWIDTH-(BOARDWIDTH-(CHESSBOARD_X+(SQUARE_WIDTH*8)))/2)
#define TURN_Y (CHESSBOARD_Y+15)
@@ -413,7 +413,7 @@ static GnomeCanvasItem *chess_create_item(GnomeCanvasGroup *parent)
"y2", (double) CHESSBOARD_Y + ((7-y) * SQUARE_HEIGHT) + SQUARE_HEIGHT -1,
"fill_color_rgba", color,
"outline_color", "black",
- "width_units", (double)1,
+ "width_units", (double)2,
NULL);
chessboard[square]->square_item = item;
}
@@ -639,7 +639,7 @@ static void move_piece_to(Square from, Square to)
/* Show the moved piece */
gnome_canvas_item_set(source_square->square_item,
"outline_color",
- (BPIECE(position->square[to])?"red":"green"),
+ (BPIECE(position->square[to])?"red":"blue"),
NULL);
display_white_turn(BPIECE(position->square[to]));
@@ -654,7 +654,7 @@ static void move_piece_to(Square from, Square to)
/* Show the moved piece */
gnome_canvas_item_set(dest_square->square_item,
"outline_color",
- (BPIECE(position->square[to])?"red":"green"),
+ (BPIECE(position->square[to])?"red":"blue"),
NULL);
if(dest_square->piece_item != NULL)
@@ -796,7 +796,7 @@ void hightlight_possible_moves(GSquare *gsquare)
/* Show the current piece */
gnome_canvas_item_set(gsquare->square_item,
"outline_color",
- (BPIECE(position->square[gsquare->square])?"red":"green"),
+ (BPIECE(position->square[gsquare->square])?"red":"blue"),
NULL);
}
diff --git a/src/gcompris/gameutil.c b/src/gcompris/gameutil.c
index 0183e29..c6f6e1c 100644
--- a/src/gcompris/gameutil.c
+++ b/src/gcompris/gameutil.c
@@ -1,6 +1,6 @@
/* gcompris - gameutil.c
*
- * Time-stamp: <2006/03/02 00:30:53 bruno>
+ * Time-stamp: <2006/03/29 01:34:58 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
@@ -673,6 +673,48 @@ static int boardlist_compare_func(const void *a, const void *b)
return strcasecmp(((GcomprisBoard *) a)->difficulty, ((GcomprisBoard *) b)->difficulty);
}
+/** Return true is there are at least one activity in the given section
+ *
+ * \param section: the section to check
+ *
+ * \return 1 if there is at least one activity, 0 instead
+ *
+ */
+int
+gcompris_board_has_activity(gchar *section, gchar *name)
+{
+ GList *list = NULL;
+ GcomprisProperties *properties = gcompris_get_properties();
+ gchar *section_name = g_strdup_printf("%s/%s", section, name);
+
+ if (strlen(section)==1)
+ return 1;
+
+ for(list = boards_list; list != NULL; list = list->next) {
+ GcomprisBoard *board = list->data;
+
+ if ( (!properties->experimental) &&
+ (strcmp (board->name, "experimental") == 0))
+ continue;
+
+ if ((strcmp (section_name, board->section) == 0) &&
+ (strlen(board->name) != 0))
+ {
+ if((strcmp(board->type, "menu") == 0) &&
+ strcmp(board->section, section) != 0)
+ {
+ /* We must check this menu is not empty recursively */
+ g_free(section_name);
+ return(gcompris_board_has_activity(board->section, board->name));
+ }
+ g_free(section_name);
+ return 1;
+ }
+ }
+
+ g_free(section_name);
+ return 0;
+}
/* Return the list of boards in the given section
* Boards are sorted depending on their difficulty value
@@ -681,20 +723,17 @@ GList *gcompris_get_menulist(gchar *section)
{
GList *list = NULL;
GList *result_list = NULL;
- gchar *model;
GcomprisProperties *properties = gcompris_get_properties();
- if (strlen(section)==1)
- model = g_strdup("");
- else
- model = g_strdup(section);
-
if(!section){
- g_warning("gcompris_get_menulist called with section == NULL !");
+ g_error("gcompris_get_menulist called with section == NULL !");
return NULL;
}
+ if (strlen(section)==1)
+ section = "";
+
for(list = boards_list; list != NULL; list = list->next) {
GcomprisBoard *board = list->data;
@@ -702,14 +741,23 @@ GList *gcompris_get_menulist(gchar *section)
(strcmp (board->name, "experimental") == 0))
continue;
- if (strcmp (model, board->section) == 0) {
+ if (strcmp (section, board->section) == 0) {
if (strlen(board->name) != 0)
- result_list = g_list_append(result_list, board);
+ {
+ if(strcmp(board->type, "menu") == 0)
+ {
+ /* We must check first this menu is not empty */
+ if(gcompris_board_has_activity(board->section, board->name))
+ result_list = g_list_append(result_list, board);
+ }
+ else
+ {
+ result_list = g_list_append(result_list, board);
+ }
+ }
}
}
- g_free(model);
-
/* Sort the list now */
result_list = g_list_sort(result_list, boardlist_compare_func);
diff --git a/src/gcompris/profile.c b/src/gcompris/profile.c
index 1fab6d8..43d796b 100644
--- a/src/gcompris/profile.c
+++ b/src/gcompris/profile.c
@@ -1,6 +1,6 @@
/* gcompris - profile.c
*
- * Time-stamp: <2005/09/18 22:51:12 bruno>
+ * Time-stamp: <2006/03/29 01:33:14 bruno>
*
* Copyright (C) 2005 Bruno Coudoin
*
@@ -23,6 +23,9 @@
#include "gcompris.h"
#include "properties.h"
+/** Return the current profile or NULL if sqlite not activated
+ *
+ */
GcomprisProfile
*gcompris_get_current_profile()
{