[quadrapassel] Redo Layout as grid



commit 75fc1c39d3a942d741ffcecc61cad5ffa3268dbf
Author: Mario Wenzel <maweki gmail com>
Date:   Mon Jan 20 19:22:13 2014 +0100

    Redo Layout as grid

 src/quadrapassel.vala |   48 +++++++++++++++---------------------------------
 1 files changed, 15 insertions(+), 33 deletions(-)
---
diff --git a/src/quadrapassel.vala b/src/quadrapassel.vala
index 0dfa4d6..5f48cd1 100644
--- a/src/quadrapassel.vala
+++ b/src/quadrapassel.vala
@@ -120,9 +120,8 @@ public class Quadrapassel : Gtk.Application
         headerbar.show ();
         window.set_titlebar (headerbar);
 
-        var vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
-        vbox.show ();
-        window.add (vbox);
+        var score_grid = new Gtk.Grid ();
+        window.add (score_grid);
 
         view = new GameView ();
         view.theme = settings.get_string ("theme");
@@ -131,6 +130,8 @@ public class Quadrapassel : Gtk.Application
         view.game = new Game (20, 14, 1, 20, 10);
         view.show ();
 
+        score_grid.attach (view, 0, 0, 2, 18);
+
         bool rtl = Gtk.Widget.get_default_direction () == Gtk.TextDirection.RTL;
 
         pause_play_button = new Gtk.Button();
@@ -139,28 +140,13 @@ public class Quadrapassel : Gtk.Application
                                                                 Gtk.IconSize.DIALOG);
         pause_play_button.add (pause_play_button_image);
         pause_play_button.action_name = "app.new-game";
-        pause_play_button.hexpand = true;
+        pause_play_button.valign = Gtk.Align.CENTER;
+        pause_play_button.halign = Gtk.Align.CENTER;
         pause_play_button.relief = Gtk.ReliefStyle.NONE;
         pause_play_button_image.show ();
         pause_play_button.show ();
 
-        var hb = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
-        hb.show ();
-        vbox.pack_start (hb, true, true, 0);
-
-        var vb1 = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
-        vb1.set_border_width (10);
-        vb1.pack_start (view, true, true, 0);
-        vb1.show ();
-        hb.pack_start (vb1, true, true, 0);
-
-        var vb2 = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
-        vb2.set_border_width (10);
-        //vb2.set_homogeneous (true);
-        vb2.show ();
-        hb.pack_end (vb2, true, false, 0);
-
-        var preview_frame = new Gtk.Frame (_("Next"));
+        var preview_frame = new Gtk.AspectFrame (_("Next"), 0.5f, 0.5f, 1.0f, false);
         preview_frame.set_label_align (0.5f, 1.0f);
         preview = new Preview (preview_frame);
         preview.theme = settings.get_string ("theme");
@@ -168,45 +154,41 @@ public class Quadrapassel : Gtk.Application
         preview_frame.add (preview);
         preview_frame.show ();
         preview.show ();
-        vb2.pack_start (preview_frame, false, false, 0);
 
-        var score_grid = new Gtk.Grid ();
-        score_grid.set_row_homogeneous (true);
+        score_grid.attach (preview_frame, 2, 1, 1, 3);
         score_grid.show ();
-        vb2.pack_end (score_grid, true, false, 0);
 
         var label = new Gtk.Label (_("Score"));
         label.set_alignment (0.5f, 0.5f);
-        label.set_size_request (120, -1); // should be at least as wide as the preview area
         label.show ();
-        score_grid.attach (label, 0, 0, 1, 1);
+        score_grid.attach (label, 2, 5, 1, 1);
         score_label = new Gtk.Label ("<big>-</big>");
         score_label.set_use_markup (true);
         score_label.set_alignment (0.5f, 0.0f);
         score_label.show ();
-        score_grid.attach (score_label, 0, 1, 1, 2);
+        score_grid.attach (score_label, 2, 6, 1, 2);
 
         label = new Gtk.Label (_("Lines"));
         label.set_alignment (0.5f, 0.5f);
         label.show ();
-        score_grid.attach (label, 0, 4, 1, 1);
+        score_grid.attach (label, 2, 9, 1, 1);
         n_destroyed_label = new Gtk.Label ("<big>-</big>");
         n_destroyed_label.set_use_markup (true);
         n_destroyed_label.set_alignment (0.5f, 0.0f);
         n_destroyed_label.show ();
-        score_grid.attach (n_destroyed_label, 0, 5, 1, 2);
+        score_grid.attach (n_destroyed_label, 2, 10, 1, 2);
 
         label = new Gtk.Label (_("Level"));
         label.set_alignment (0.5f, 0.5f);
         label.show ();
-        score_grid.attach (label, 0, 8, 1, 1);
+        score_grid.attach (label, 2, 13, 1, 1);
         level_label = new Gtk.Label ("<big>-</big>");
         level_label.set_use_markup (true);
         level_label.set_alignment (0.5f, 0.0f);
         level_label.show ();
-        score_grid.attach (level_label, 0, 9, 1, 2);
+        score_grid.attach (level_label, 2, 14, 1, 2);
 
-        score_grid.attach (pause_play_button, 0, 11, 1, 2);
+        score_grid.attach (pause_play_button, 2, 16, 1, 2);
 
 
         history = new History (Path.build_filename (Environment.get_user_data_dir (), "quadrapassel", 
"history"));


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