[glom] CanvasGroupGrid: Simplify rule creation.



commit 45bf09707744e78d32c9ff5942e4170879eb99ed
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Aug 7 17:36:29 2011 +0200

    CanvasGroupGrid: Simplify rule creation.
    
    * glom/utility_widgets/canvas/canvas_group_grid.[h|cc]:
    create_grid_or_rule_line(): Rename to create_rule_line(), removing
    the bool, because that is what it is used for.

 ChangeLog                                        |    8 ++++++++
 glom/utility_widgets/canvas/canvas_group_grid.cc |   14 +++++---------
 glom/utility_widgets/canvas/canvas_group_grid.h  |    2 +-
 3 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6008367..93ebea6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-08-07  Murray Cumming  <murrayc murrayc com>
 
+	CanvasGroupGrid: Simplify rule creation.
+
+	* glom/utility_widgets/canvas/canvas_group_grid.[h|cc]:
+	create_grid_or_rule_line(): Rename to create_rule_line(), removing 
+	the bool, because that is what it is used for.
+
+2011-08-07  Murray Cumming  <murrayc murrayc com>
+
 	Canvas_PrintLayout: Move all selected items when dragging.
 
 	* glom/utility_widgets/canvas/canvas_item_movable.[h|cc]:
diff --git a/glom/utility_widgets/canvas/canvas_group_grid.cc b/glom/utility_widgets/canvas/canvas_group_grid.cc
index d87f46e..18d521c 100644
--- a/glom/utility_widgets/canvas/canvas_group_grid.cc
+++ b/glom/utility_widgets/canvas/canvas_group_grid.cc
@@ -166,15 +166,11 @@ void CanvasGroupGrid::snap_position(double& x, double& y) const
   }
 }
 
-Glib::RefPtr<Goocanvas::Polyline> CanvasGroupGrid::create_grid_or_rule_line(double x1, double y1, double x2, double y2, bool is_rule)
+Glib::RefPtr<Goocanvas::Polyline> CanvasGroupGrid::create_rule_line(double x1, double y1, double x2, double y2)
 {
   Glib::RefPtr<Goocanvas::Polyline> line = Goocanvas::Polyline::create(x1, y1, x2, y2);
-  line->property_line_width() = 1.0f;
-
-  if(is_rule)
-    line->property_stroke_color() = "green";
-  else
-    line->property_stroke_color() = "gray";
+  line->property_line_width() = 0.5f;
+  line->property_stroke_color() = "green";
   return line;
 }
 
@@ -241,7 +237,7 @@ void CanvasGroupGrid::create_lines()
   for(CanvasGroupGrid::type_vec_double::const_iterator iter = m_rules_x.begin(); iter != m_rules_x.end(); ++iter)
   {
     const double x = *iter;
-    Glib::RefPtr<Goocanvas::Polyline> line = create_grid_or_rule_line(x, top, x, bottom, true);
+    Glib::RefPtr<Goocanvas::Polyline> line = create_rule_line(x, top, x, bottom);
     m_grid_rules_group->add_child(line);
   }
 
@@ -249,7 +245,7 @@ void CanvasGroupGrid::create_lines()
   for(CanvasGroupGrid::type_vec_double::const_iterator iter = m_rules_y.begin(); iter != m_rules_y.end(); ++iter)
   {
     const double y = *iter;
-    Glib::RefPtr<Goocanvas::Polyline> line = create_grid_or_rule_line(left, y, right, y, true);
+    Glib::RefPtr<Goocanvas::Polyline> line = create_rule_line(left, y, right, y);
     m_grid_rules_group->add_child(line);
   }
 }
diff --git a/glom/utility_widgets/canvas/canvas_group_grid.h b/glom/utility_widgets/canvas/canvas_group_grid.h
index 1cdae8f..d1f6606 100644
--- a/glom/utility_widgets/canvas/canvas_group_grid.h
+++ b/glom/utility_widgets/canvas/canvas_group_grid.h
@@ -72,7 +72,7 @@ public:
 
 private:
   void create_lines();
-  Glib::RefPtr<Goocanvas::Polyline> create_grid_or_rule_line(double x1, double y1, double x2, double y2, bool is_rule = false);
+  Glib::RefPtr<Goocanvas::Polyline> create_rule_line(double x1, double y1, double x2, double y2);
 
   double snap_position_grid(double a) const;
   double snap_position_rules(const type_vec_double& rules, double a) const;



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