[cheese] calculate the dimension of the effect previews automatically



commit bfd8e877a5970f02932a65daff475cda7c512608
Author: daniel g. siegel <dgsiegel gnome org>
Date:   Sun Dec 5 15:18:36 2010 +0100

    calculate the dimension of the effect previews automatically
    
    this is done by getting the viewport dimension, subtracting
    the borders and then dividing by three. if there are less than
    9 effects on the last effects pane, we want to still start
    putting the previews in the upper left corner. in fullscreen
    we simply use the same size.

 src/cheese-window.vala |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index e01a678..26a6cc4 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -864,9 +864,10 @@ public class Cheese.MainWindow : Gtk.Window
         Clutter.TableLayout table_layout = new TableLayout();
         Clutter.Box grid = new Clutter.Box (table_layout);
         effects_grids.add (grid);
+        grid.set_size (viewport.width, viewport.height);
 
-        table_layout.set_column_spacing (20);
-        table_layout.set_row_spacing (20);
+        table_layout.set_column_spacing (10);
+        table_layout.set_row_spacing (10);
       }
 
       for (int i = 0; i < effects_manager.effects.size; i++)
@@ -882,9 +883,6 @@ public class Cheese.MainWindow : Gtk.Window
         rect.opacity = 128;
         rect.color   = Clutter.Color.from_string ("black");
 
-        box.width  = 160;
-        box.height = 120;
-
         box.pack ((Clutter.Actor) texture,
                   "x-align", Clutter.BinAlignment.FILL,
                   "y-align", Clutter.BinAlignment.FILL, null);
@@ -907,6 +905,9 @@ public class Cheese.MainWindow : Gtk.Window
                   "y-align", Clutter.BinAlignment.END, null);
 
         Clutter.TableLayout table_layout = (Clutter.TableLayout) effects_grids[i / EFFECTS_PER_PAGE].layout_manager;
+        box.width = (viewport.width - 2 * table_layout.get_column_spacing ()) / 3;
+        box.height = (viewport.height - 2 * table_layout.get_row_spacing ()) / 3;
+
         table_layout.pack ((Clutter.Actor) box,
                            (i % EFFECTS_PER_PAGE) % 3,
                            (i % EFFECTS_PER_PAGE) / 3);



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