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-11-02 16:15:31 (GMT)
committer Bruno Coudoin <bcoudoin@src.gnome.org>2006-11-02 16:15:31 (GMT)
commit81fbfe99fbd79f1653ec79cf9fcf158ed55c24af (patch)
tree0d33731d890129b00d0b535ecd5c5762f557cb2c
parent7ccc980874f29c90adadcceffc5e4e2aac4f075b (diff)
- new date system, untested.
- Now in clockgame hours and minutes turns to the next one or previous one when dragging http://bugzilla.gnome.org/show_bug.cgi?id=368549 - In shapegame, the green dot is now resseted properly when the item is no more in sight (reported by Joshua N Pritikin)
-rw-r--r--ChangeLog16
-rw-r--r--configure.in3
-rw-r--r--src/boards/clockgame.c15
-rw-r--r--src/boards/shapegame.c17
-rw-r--r--src/gcompris/board.c14
-rw-r--r--src/gcompris/gcompris.c92
6 files changed, 108 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index 07446d2..262711c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2006-11-02 Bruno Coudoin
+
+ - new date system, untested.
+ - Now in clockgame hours and minutes turns to the next one
+ or previous one when dragging
+ http://bugzilla.gnome.org/show_bug.cgi?id=368549
+ - In shapegame, the green dot is now resseted properly
+ when the item is no more in sight (reported by Joshua N Pritikin)
+
+ * configure.in:
+ * src/boards/clockgame.c: (display_hour), (item_event):
+ * src/boards/shapegame.c: (item_event):
+ * src/gcompris/board.c: (gc_board_init), (gc_board_check_file):
+ * src/gcompris/gcompris.c: (gc_activation_check),
+ (activation_enter_callback):
+
2006-10-31 Bruno Coudoin
- Fixed unaligned in the main menu the strategy icon
diff --git a/configure.in b/configure.in
index 8260146..3fc510b 100644
--- a/configure.in
+++ b/configure.in
@@ -122,6 +122,9 @@ AC_SUBST(GETTEXT_PACKAGE)
AM_GLIB_GNU_GETTEXT
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package name])
+BUILD_DATE=`date +%y%m`
+AC_DEFINE_UNQUOTED(BUILD_DATE,"$BUILD_DATE", [Date at which GCompris has been built])
+
dnl Define myprefix depending on wether our user gives us one or not
if test "x${prefix}" = "xNONE"; then
myprefix=${ac_default_prefix}
diff --git a/src/boards/clockgame.c b/src/boards/clockgame.c
index eac8802..c1a45a2 100644
--- a/src/boards/clockgame.c
+++ b/src/boards/clockgame.c
@@ -297,6 +297,7 @@ static void display_hour(guint hour)
currentTime.hour=hour;
display_digital_time(digital_time_item, &currentTime);
+ display_digital_time(digital_time_item_s, &currentTime);
}
@@ -691,12 +692,24 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data)
if(item==hour_item)
display_hour(angle * 6 / M_PI);
else if(item==minute_item)
- {
+ {
+ if(currentTime.minute > 45 && angle * 30 / M_PI < 15)
+ currentTime.hour++;
+
+ if(currentTime.minute < 15 && angle * 30 / M_PI > 45)
+ currentTime.hour--;
+
display_minute(angle * 30 / M_PI);
display_hour(currentTime.hour);
}
else if(item==second_item)
{
+ if(currentTime.second > 45 && angle * 30 / M_PI < 15)
+ currentTime.minute++;
+
+ if(currentTime.second < 15 && angle * 30 / M_PI > 45)
+ currentTime.minute--;
+
display_second(angle * 30 / M_PI);
display_minute(currentTime.minute);
display_hour(currentTime.hour);
diff --git a/src/boards/shapegame.c b/src/boards/shapegame.c
index 9a98e67..c5326ee 100644
--- a/src/boards/shapegame.c
+++ b/src/boards/shapegame.c
@@ -31,7 +31,7 @@
#define SOUNDLISTFILE PACKAGE
#define UNDEFINED "Undefined"
-#define SQUARE_LIMIT_DISTANCE 50.0
+#define SQUARE_LIMIT_DISTANCE 100.0
static int gamewon;
@@ -476,8 +476,6 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str)
return TRUE;
}
-
-
/*-------------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------*/
@@ -1159,6 +1157,19 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, Shape *shape)
else
target_point_previous = targetshape->targetitem;
}
+ else
+ {
+ if(target_point_previous)
+ {
+ if(strcmp(shape->targetfile, UNDEFINED)==0)
+ gnome_canvas_item_set(GNOME_CANVAS_ITEM(target_point_previous),
+ "fill_color_rgba", POINT_COLOR_OFF,
+ NULL);
+ else
+ gc_item_focus_set(target_point_previous, FALSE);
+ }
+ target_point_previous = NULL;
+ }
}
break;
diff --git a/src/gcompris/board.c b/src/gcompris/board.c
index 67193f2..e86d776 100644
--- a/src/gcompris/board.c
+++ b/src/gcompris/board.c
@@ -29,7 +29,7 @@ static struct BoardPluginData *bp_data;
static gboolean get_board_playing(void);
#ifdef WIN32
-extern gchar *keycode[];
+int gc_activation_check(char *code);
extern BoardPlugin * get_advanced_colors_bplugin_info();
extern BoardPlugin * get_algebra_bplugin_info();
extern BoardPlugin * get_algebra_guesscount_bplugin_info();
@@ -176,7 +176,7 @@ void gc_board_init(void)
void gc_board_init(void)
{
- /* Fist make sure the module loading is supported on this platform */
+ /* First make sure the module loading is supported on this platform */
if (!g_module_supported())
g_error( _("Dynamic module loading is not supported. gcompris cannot load.\n") );
@@ -220,16 +220,10 @@ gc_board_check_file(GcomprisBoard *gcomprisBoard)
return TRUE;
}
- while(keycode[i++])
- {
- if(strncmp(properties->key, keycode[i-1], 5) == 0)
- {
- key_is_valid = 1;
- }
- }
+ key_is_valid = gc_activation_check(properties->key);
i = 0;
- if(key_is_valid)
+ if(key_is_valid == 1)
{
while(static_boards[i++] != NULL) {
diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c
index 9a4c18e..49166e3 100644
--- a/src/gcompris/gcompris.c
+++ b/src/gcompris/gcompris.c
@@ -61,20 +61,6 @@ void gc_terminate(int signum);
* For the Activation dialog
*/
#ifdef WIN32
- /* List of keycodes */
- gchar *keycode[] =
- {
- "83640",
- "33251",
- "99301",
- "71848",
- "79657",
- "47561",
- "84175",
- "15987",
- NULL
- };
-
static void activation_enter_callback(GtkWidget *widget,
GtkWidget *entry );
static void activation_done();
@@ -861,6 +847,53 @@ display_activation_dialog()
g_free(msg);
}
+/**
+ * Return -1 if the code is not valid
+ * 0 if the code is valid but out of date
+ * 1 if the code is valid and under 2 years
+ */
+int gc_activation_check(char *code)
+{
+ int value = 0;
+ int i;
+ char crc1 = 0;
+ char crc2 = 0;
+ char codeddate[4];
+
+ if(strlen(code) != 6)
+ return -1;
+
+ for(i=3; i>=0; i--)
+ {
+ value |= code[i] & 0x07;
+ value = value << 3;
+ crc1 = crc1 ^ code[i] & 0x07;
+ }
+ value = value >> 3;
+ crc1 = 0x30 | crc1;
+ crc2 = 0x30 | (code[2] ^ code[3]);
+
+ crc1 != code[4] ? return(-1);
+ crc2 != code[5] ? return(-1);
+
+ codeddate[3] = 0x30 | value & 0x000F;
+ value = value >> 4;
+
+ codeddate[2] = 0x30 | value & 0x0001;
+ value = value >> 1;
+
+ codeddate[1] = 0x30 | value & 0x000F;
+ value = value >> 4;
+
+ codeddate[0] = 0x30 | value & 0x0003;
+ codeddate[4] = '\0';
+
+ if(atoi(codeddate) + 200 >= atoi(BUILD_DATE))
+ return(1);
+ else
+ return(0);
+}
+
/* Check the activation code
*
*/
@@ -868,29 +901,18 @@ static void
activation_enter_callback( GtkWidget *entry,
GtkWidget *notused )
{
- gchar *entry_text;
-
- entry_text = (char *)gtk_entry_get_text(GTK_ENTRY(entry));
-
- if(strlen(entry_text) == 5)
+ switch(gc_activation_check((char *)gtk_entry_get_text(GTK_ENTRY(entry))))
{
- int i = 0;
- while(keycode[i++])
- {
- if(strncmp(entry_text, keycode[i-1], 5) == 0)
- {
- g_free(properties->key);
- properties->key=strdup( keycode[i-1]);
- gc_prop_save(properties);
- gc_menu_load();
-
- gtk_entry_set_text(GTK_ENTRY(entry), "GOOD");
- return;
- }
- }
+ case 1:
+ gtk_entry_set_text(GTK_ENTRY(entry), "GOOD");
+ break;
+ case 0:
+ gtk_entry_set_text(GTK_ENTRY(entry), "EXPIRE");
+ break;
+ case -1:
+ gtk_entry_set_text(GTK_ENTRY(entry), "WRONG");
+ break;
}
-
- gtk_entry_set_text(GTK_ENTRY(entry), "WRONG");
}
/* Callback for the activation dialog