[gnome-games/sudoku-vala] sudoku: Add padding to CellView



commit 18fdfdbe8d8ce5d3ea0266a03e25dbe2d3ee3082
Author: LubomÃr SedlÃÅ <lubomir sedlar gmail com>
Date:   Thu Jun 30 22:20:22 2011 +0200

    sudoku: Add padding to CellView

 gnome-sudoku/src/sudoku-view.vala |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gnome-sudoku/src/sudoku-view.vala b/gnome-sudoku/src/sudoku-view.vala
index 504ce65..0e5a545 100644
--- a/gnome-sudoku/src/sudoku-view.vala
+++ b/gnome-sudoku/src/sudoku-view.vala
@@ -1,7 +1,9 @@
 private class SudokuCellView : Gtk.DrawingArea
 {
     private Pango.Layout layout;
-    
+
+    private double size_ratio = 2;
+
     private Gtk.Window? popup = null;
 
     private SudokuCell _cell;
@@ -54,7 +56,7 @@ private class SudokuCellView : Gtk.DrawingArea
         int width, height, side;
         layout.get_size (out width, out height);
         side = width > height ? width : height;
-        minimal_width = natural_width = side / Pango.SCALE;
+        minimal_width = natural_width = (int) (size_ratio * side) / Pango.SCALE;
     }
 
     public override void get_preferred_height (out int minimal_height, out int natural_height)
@@ -62,7 +64,7 @@ private class SudokuCellView : Gtk.DrawingArea
         int width, height, side;
         layout.get_size (out width, out height);
         side = width > height ? width : height;
-        minimal_height = natural_height = side / Pango.SCALE;
+        minimal_height = natural_height = (int) (size_ratio * side) / Pango.SCALE;
     }
 
     public override bool button_press_event (Gdk.EventButton event)
@@ -188,7 +190,7 @@ private class SudokuCellView : Gtk.DrawingArea
         layout.get_size (out width, out height);
         height /= Pango.SCALE;
 
-        double scale = (double) get_allocated_height () / height;
+        double scale = ((double) get_allocated_height () / size_ratio) / height;
         c.move_to ((get_allocated_width () - glyph_width * scale) / 2, (get_allocated_height () - glyph_height * scale) / 2);
         c.scale (scale, scale);
         Pango.cairo_update_layout (c, layout);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]