[gnome-sudoku] Print the good "current puzzle" in RTL.
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku] Print the good "current puzzle" in RTL.
- Date: Fri, 5 Sep 2014 14:07:46 +0000 (UTC)
commit d3e65146b8eec2700eccf32014e751ac600f959c
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri Sep 5 02:17:46 2014 +0200
Print the good "current puzzle" in RTL.
https://bugzilla.gnome.org/show_bug.cgi?id=735157
src/sudoku-printer.vala | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/sudoku-printer.vala b/src/sudoku-printer.vala
index e2ebb03..3116fed 100644
--- a/src/sudoku-printer.vala
+++ b/src/sudoku-printer.vala
@@ -185,18 +185,21 @@ public class SudokuPrinter : GLib.Object {
Cairo.TextExtents extents;
var sudoku = sudoku_board.get_cells ();
+ var invert = Gtk.Widget.get_default_direction () == Gtk.TextDirection.RTL;
+
for (var x = 0; x < SUDOKU_SIZE; x++)
{
+ var real_x = invert ? SUDOKU_SIZE - x - 1 : x;
for (var y = 0; y < SUDOKU_SIZE; y++)
{
cr.move_to (pos[x] + offset_x, pos[y] + offset_y);
letter = "";
- if (sudoku[y,x] != 0)
+ if (sudoku[y,real_x] != 0)
{
- letter = (sudoku[y,x]).to_string ();
+ letter = (sudoku[y,real_x]).to_string ();
- if (sudoku_board.is_fixed[y,x])
+ if (sudoku_board.is_fixed[y,real_x])
{
cr.select_font_face ("Sans", Cairo.FontSlant.NORMAL, FONT_WEIGHT);
cr.set_source_rgb (0, 0, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]