glom r1781 - in trunk: . glom/utility_widgets/canvas



Author: murrayc
Date: Mon Dec  8 09:10:40 2008
New Revision: 1781
URL: http://svn.gnome.org/viewvc/glom?rev=1781&view=rev

Log:
2008-12-08  Murray Cumming  <murrayc murrayc com>

* glom/utility_widgets/canvas/canvas_group_grid.cc (Glom.create_lines):
Do not create a GooCanvasGrid with 0 steps, so Glom works with versions 
of GooCanvas without the bug fix.

Modified:
   trunk/ChangeLog
   trunk/glom/utility_widgets/canvas/canvas_group_grid.cc

Modified: trunk/glom/utility_widgets/canvas/canvas_group_grid.cc
==============================================================================
--- trunk/glom/utility_widgets/canvas/canvas_group_grid.cc	(original)
+++ trunk/glom/utility_widgets/canvas/canvas_group_grid.cc	Mon Dec  8 09:10:40 2008
@@ -207,7 +207,10 @@
 {
   //Remove any existing lines:
   if(m_grid_lines)
+  {
     m_grid_lines->remove();
+    m_grid_lines.clear(); //Null the RefPtr.
+  }
 
   while(m_grid_rules_group && m_grid_rules_group->get_n_children())
     m_grid_rules_group->remove_child(0);
@@ -222,12 +225,15 @@
   const double height = bottom - top;
   
   //Vertical and horizontal grid lines:
-  m_grid_lines = Goocanvas::Grid::create(0, 0, width, height, m_grid_gap, m_grid_gap);
-  m_grid_lines->property_horz_grid_line_width() = 1.0f;
-  m_grid_lines->property_vert_grid_line_width() = 1.0f;
-  m_grid_lines->property_horz_grid_line_color() = "gray";
-  m_grid_lines->property_vert_grid_line_color() = "gray";
-  add_child(m_grid_lines);
+  if(m_grid_gap > 0) //0 steps cause a crash in older versions of goocanvas.
+  {
+    m_grid_lines = Goocanvas::Grid::create(0, 0, width, height, m_grid_gap, m_grid_gap);
+    m_grid_lines->property_horz_grid_line_width() = 1.0f;
+    m_grid_lines->property_vert_grid_line_width() = 1.0f;
+    m_grid_lines->property_horz_grid_line_color() = "gray";
+    m_grid_lines->property_vert_grid_line_color() = "gray";
+    add_child(m_grid_lines);
+  }
 
   //Vertical rules:
   for(CanvasGroupGrid::type_vec_double::const_iterator iter = m_rules_x.begin(); iter != m_rules_x.end(); ++iter)



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