[glom] Print Layout: Work around some weirdness in portal tables.



commit b7258bad9753815189f6ab7fcdf531c6979f3e90
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Aug 12 09:09:15 2011 +0200

    Print Layout: Work around some weirdness in portal tables.
    
    * glom/print_layout/canvas_layout_item.cc:
    create_canvas_item_for_layout_item() Do not set the height of
    items in tables, because that leads to them disappearing when the
    table is moved in certain ways. I am still investigating why.
    We probably really do want to set the height.

 ChangeLog                                          |   10 ++++++++++
 glom/print_layout/canvas_layout_item.cc            |   11 ++++++++---
 .../utility_widgets/canvas/test_canvas_editable.cc |    8 +++++---
 3 files changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2c21a49..22d533e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-08-12  Murray Cumming  <murrayc murrayc com>
+
+	Print Layout: Work around some weirdness in portal tables.
+
+	* glom/print_layout/canvas_layout_item.cc:
+	create_canvas_item_for_layout_item() Do not set the height of 
+	items in tables, because that leads to them disappearing when the 
+	table is moved in certain ways. I am still investigating why.
+	We probably really do want to set the height.
+
 2011-08-11  Murray Cumming  <murrayc murrayc com>
 
 	Print Layout: Only show grid lines on mouseover.
diff --git a/glom/print_layout/canvas_layout_item.cc b/glom/print_layout/canvas_layout_item.cc
index 9c66a3d..5bcbe7b 100644
--- a/glom/print_layout/canvas_layout_item.cc
+++ b/glom/print_layout/canvas_layout_item.cc
@@ -290,7 +290,7 @@ Glib::RefPtr<CanvasItemMovable> CanvasLayoutItem::create_canvas_item_for_layout_
             //Show as many rows as can fit in the height.
             double row_height = 0;
             const int max_rows = get_rows_count_for_portal(portal, row_height);
-            std::cout << "DEBUG: max_rows=" << max_rows << std::endl;
+            std::cout << "DEBUG: max_rows=" << max_rows << ", row_height=" << row_height << std::endl;
 
             const LayoutGroup::type_list_items child_items = portal->get_items();
 
@@ -309,15 +309,20 @@ Glib::RefPtr<CanvasItemMovable> CanvasLayoutItem::create_canvas_item_for_layout_
                 if(cell)
                 {
                   //Make sure that the width is sensible:
+                  
                   guint width = layout_item->get_display_width();
                   width = std::max(width, (guint)10);
-                  cell->set_width_height(width, row_height);
-                  std::cout << "DEBUG: width=" << width << std::endl;
+                  //cell->set_width_height(width, row_height);
 
                   //TODO: Add/Remove rows when resizing, instead of resizing the rows:
                   Glib::RefPtr<Goocanvas::Item> cell_as_item = CanvasItemMovable::cast_to_item(cell);
                   if(cell_as_item)
                   {
+                    //TODO: Setting the height too cause weird problems in the GooCanvasTable,
+                    //making child items disappear as the table is moved around.
+                    cell_as_item->property_width() = width;
+                    //cell_as_item->set_width_height(width, row_height);
+
                     canvas_item->attach(cell_as_item,
                       col /* left_attach */, col + 1 /* right_attach */,
                       row /* top_attach */, row + 1 /* right_attach */,
diff --git a/glom/utility_widgets/canvas/test_canvas_editable.cc b/glom/utility_widgets/canvas/test_canvas_editable.cc
index c1a2b8e..aeb7664 100644
--- a/glom/utility_widgets/canvas/test_canvas_editable.cc
+++ b/glom/utility_widgets/canvas/test_canvas_editable.cc
@@ -127,12 +127,14 @@ public:
                                        "x-fill", TRUE, 
                                        "x-expand", TRUE, 
                                        (void*)0);
-    Glib::RefPtr<Glom::CanvasTextMovable> innerrect3 = Glom::CanvasTextMovable::create();
+    Glib::RefPtr<Goocanvas::Text> innerrect3 = Goocanvas::Text::create();
     innerrect3->property_fill_color() = "yellow"; //This makes the whole area clickable, not just the outline stroke.
     innerrect3->property_line_width() = 1;
     innerrect3->property_stroke_color() = "black";
-    innerrect3->set_text("yadda");
-    innerrect3->set_width_height(20, 20);
+    innerrect3->property_text() = "yadda";
+    innerrect3->property_width() = 20;
+    //innerrect3->property_height() = 20;
+    //innerrect3->set_width_height(20, 20);
     table->add_child(innerrect3);
     goo_canvas_item_set_child_properties(GOO_CANVAS_ITEM(table->gobj()), GOO_CANVAS_ITEM(innerrect3->gobj()),
                                        "row", 2,



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