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>2009-01-30 23:31:55 (GMT)
committer Bruno Coudoin <bcoudoin@src.gnome.org>2009-01-30 23:31:55 (GMT)
commit7fba12a9da45f893cf2fabb85a71c88989d2ff66 (patch)
treea7ebbfd1e167bb5100fea92d7f192ae94d36c54f
parent6d030564274526265803386d5f2bebe19de91423 (diff)
Added RTL support.
svn path=/trunk/; revision=3709
-rw-r--r--ChangeLog8
-rw-r--r--src/boards/reading.c44
2 files changed, 45 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c5bd34..c27b8af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
2009-01-31 Bruno coudoin <bruno.coudoin@free.fr>
Vitali Perchonok is com gmail from vitali.pe
+ Added RTL support.
+
+ * src/boards/reading.c: (start_board), (reading_next_level),
+ (reading_create_item):
+
+2009-01-31 Bruno coudoin <bruno.coudoin@free.fr>
+
+ Vitali Perchonok is com gmail from vitali.pe
Prevent an evil crash bug when the kids press 2 buttons at the same time
* src/boards/menu2.c: (item_event):
diff --git a/src/boards/reading.c b/src/boards/reading.c
index 9989cc3..d43d1e0 100644
--- a/src/boards/reading.c
+++ b/src/boards/reading.c
@@ -46,7 +46,8 @@ static GnomeCanvasGroup *boardRootItem = NULL;
typedef enum
{
MODE_HORIZONTAL = 0,
- MODE_VERTICAL = 1
+ MODE_VERTICAL = 1,
+ MODE_HORIZONTAL_RTL = 2
} Mode;
static Mode currentMode = MODE_VERTICAL;
@@ -210,10 +211,9 @@ static void start_board (GcomprisBoard *agcomprisBoard)
g_warning ("Font to display words have size %d ascent : %d, descent : %d.\n Set inerline to %d", font_size, ascent, descent, interline);
- /* Default mode */
- currentMode=MODE_VERTICAL;
- if(gcomprisBoard->mode && g_strcasecmp(gcomprisBoard->mode, "horizontal")==0)
- currentMode=MODE_HORIZONTAL;
+
+
+
gc_wordlist = gc_wordlist_get_from_file("wordsgame/default-$LOCALE.xml");
@@ -230,7 +230,17 @@ static void start_board (GcomprisBoard *agcomprisBoard)
}
}
- reading_next_level();
+
+ currentMode=MODE_VERTICAL; // Default mode
+ if(gcomprisBoard->mode && g_strcasecmp(gcomprisBoard->mode, "horizontal")==0)
+ {
+ if (pango_unichar_direction(g_utf8_get_char(gc_wordlist_random_word_get(gc_wordlist, gcomprisBoard->level))) == PANGO_DIRECTION_RTL)
+ currentMode=MODE_HORIZONTAL_RTL;
+ else
+ currentMode=MODE_HORIZONTAL;
+ }
+
+ reading_next_level();
}
}
@@ -314,7 +324,7 @@ static gint reading_next_level()
}
else
{
- current_x = BASE_X1;
+ current_x = BASE_X2;
numberOfLine=2+gcomprisBoard->level;
}
@@ -461,6 +471,8 @@ static gboolean reading_create_item(GnomeCanvasGroup *parent)
if(currentMode==MODE_HORIZONTAL)
anchor=GTK_ANCHOR_WEST;
+ else if (currentMode==MODE_HORIZONTAL_RTL)
+ anchor=GTK_ANCHOR_EAST;
previousFocus.item = \
gnome_canvas_item_new (GNOME_CANVAS_GROUP(previousFocus.rootItem),
@@ -497,6 +509,24 @@ static gboolean reading_create_item(GnomeCanvasGroup *parent)
current_y += interline;
numberOfLine--;
}
+ else if (currentMode==MODE_HORIZONTAL_RTL)
+ {
+ double x1, y1, x2, y2;
+
+ gnome_canvas_item_get_bounds(GNOME_CANVAS_ITEM(previousFocus.rootItem), &x1, &y1, &x2, &y2);
+
+ // Are we out of bound
+ if(x1<BASE_X1)
+ {
+ // Do the line Wrapping
+ gnome_canvas_item_move(GNOME_CANVAS_ITEM(previousFocus.rootItem), BASE_X2-x2, interline);
+ current_y += interline;
+ current_x = BASE_X2;
+ numberOfLine--;
+ }
+ current_x -= x2-x1 + font_size;
+ }
+
else
{
double x1, y1, x2, y2;