[glom] Print Layout: Save the rules and the various show/hides.



commit e2cd05348150df835aebe453ec4e9f0a4ed8a627
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Aug 10 19:52:00 2011 +0200

    Print Layout: Save the rules and the various show/hides.
    
    * glom/glom_document.dtd: Add the new nodes and attributes.
    * glom/libglom/document/document.cc: load_after(), save_before():
    Load and save these in the document.
    
    * glom/mode_design/print_layouts/window_print_layout_edit.cc:
    set_print_layout(): Set the menu actions from the PrintLayout
    so, for instance, the grid is shown if it was shown last time.
    * glom/print_layout/canvas_print_layout.cc:
    set_print_layout(): Load and save the rules too.
    * glom/utility_widgets/canvas/canvas_group_grid.[h|cc]:
    Added remove_rules() and get_horizontal/vertical_rules().
    * glom/utility_widgets/canvas/canvas_editable.[h|cc]:
    Added remove_rules() and get_horizontal/vertical_rules(),
    calling the same methods in the grid.
    * glom/libglom/data_structure/print_layout.[h|cc]:
    Added get/set_grid/rules/outlines() and
    get_horizontal/vertical_rules().

 ChangeLog                                          |   22 +++++++
 glom/glom_document.dtd                             |   16 ++++-
 glom/libglom/data_structure/print_layout.cc        |   67 +++++++++++++++++++-
 glom/libglom/data_structure/print_layout.h         |   28 ++++++++
 glom/libglom/document/document.cc                  |   62 ++++++++++++++++++
 .../print_layouts/window_print_layout_edit.cc      |   11 +++
 glom/print_layout/canvas_print_layout.cc           |   23 +++++++
 glom/utility_widgets/canvas/canvas_editable.cc     |   15 +++++
 glom/utility_widgets/canvas/canvas_editable.h      |    6 ++
 glom/utility_widgets/canvas/canvas_group_grid.cc   |   26 +++++++-
 glom/utility_widgets/canvas/canvas_group_grid.h    |   34 ++++++-----
 11 files changed, 287 insertions(+), 23 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 44354d8..5bfc026 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
 2011-08-10  Murray Cumming  <murrayc murrayc com>
 
+	Print Layout: Save the rules and the various show/hides.
+
+	* glom/glom_document.dtd: Add the new nodes and attributes.
+	* glom/libglom/document/document.cc: load_after(), save_before():
+	Load and save these in the document.
+	
+	* glom/mode_design/print_layouts/window_print_layout_edit.cc:
+	set_print_layout(): Set the menu actions from the PrintLayout
+	so, for instance, the grid is shown if it was shown last time.
+	* glom/print_layout/canvas_print_layout.cc:
+	set_print_layout(): Load and save the rules too.
+	* glom/utility_widgets/canvas/canvas_group_grid.[h|cc]:
+	Added remove_rules() and get_horizontal/vertical_rules().
+	* glom/utility_widgets/canvas/canvas_editable.[h|cc]:
+	Added remove_rules() and get_horizontal/vertical_rules(), 
+	calling the same methods in the grid.
+	* glom/libglom/data_structure/print_layout.[h|cc]: 
+	Added get/set_grid/rules/outlines() and 
+	get_horizontal/vertical_rules().
+
+2011-08-10  Murray Cumming  <murrayc murrayc com>
+
 	Print Layout: Allow dragging of rules from the rulers.
 
 	* glom/utility_widgets/canvas/canvas_group_grid.[h|cc]:
diff --git a/glom/glom_document.dtd b/glom/glom_document.dtd
index 71ad75e..c2c8d3d 100644
--- a/glom/glom_document.dtd
+++ b/glom/glom_document.dtd
@@ -404,14 +404,26 @@ TODO: Add 'title_singular' element.
 
 <!-- print layouts are for perfectly-positioned printing of single record details. -->
     <!ELEMENT print_layouts (print_layout*)>
-    <!ELEMENT print_layout (print_layout_groups)>
+    <!ELEMENT print_layout (print_layout_groups, horizontal_rule?, vertical_rule?)>
     <!ATTLIST print_layout
         name CDATA #REQUIRED
-        parent_table CDATA #IMPLIED>
+        parent_table CDATA #IMPLIED
+        show_table_title (true|false) "false"
+        show_grid (true|false) "false"
+        show_rules (true|false) "false"
+        show_outlines (true|false) "false">
 
     <!ELEMENT print_layout_groups (print_layout_group*)>
     <!ATTLIST print_layout_groups>
 
+    <!ELEMENT horizontal_rule EMPTY>
+    <!ATTLIST horizontal_rule
+        position CDATA #REQUIRED>
+
+    <!ELEMENT vertical_rule EMPTY>
+    <!ATTLIST vertical_rule
+        position CDATA #REQUIRED>
+
 
 <!-- The library_modules node contains python code that may be used in scripts and
      calculations via the python import keyword. -->
diff --git a/glom/libglom/data_structure/print_layout.cc b/glom/libglom/data_structure/print_layout.cc
index bf6a10c..2625060 100644
--- a/glom/libglom/data_structure/print_layout.cc
+++ b/glom/libglom/data_structure/print_layout.cc
@@ -24,7 +24,10 @@ namespace Glom
 {
 
 PrintLayout::PrintLayout()
-: m_show_table_title(true)
+: m_show_table_title(true),
+  m_show_grid(true),
+  m_show_rules(true),
+  m_show_outlines(true)
 {
   m_translatable_item_type = TRANSLATABLE_TYPE_PRINT_LAYOUT;
   m_layout_group = sharedptr<LayoutGroup>::create();
@@ -33,9 +36,14 @@ PrintLayout::PrintLayout()
 PrintLayout::PrintLayout(const PrintLayout& src)
 : TranslatableItem(src),
   m_layout_group(src.m_layout_group),
-  m_show_table_title(src.m_show_table_title)
+  m_show_table_title(src.m_show_table_title),
+  m_show_grid(src.m_show_grid),
+  m_show_rules(src.m_show_rules),
+  m_show_outlines(src.m_show_outlines)
 {
   m_page_setup = src.m_page_setup;
+  m_horizontal_rules = src.m_horizontal_rules;
+  m_vertical_rules = src.m_vertical_rules;
 }
 
 PrintLayout& PrintLayout::operator=(const PrintLayout& src)
@@ -44,7 +52,12 @@ PrintLayout& PrintLayout::operator=(const PrintLayout& src)
 
   m_layout_group = src.m_layout_group;
   m_show_table_title = src.m_show_table_title;
+  m_show_grid = src.m_show_grid;
+  m_show_rules = src.m_show_rules;
+  m_show_outlines = src.m_show_outlines;
   m_page_setup = src.m_page_setup;
+  m_horizontal_rules = src.m_horizontal_rules;
+  m_vertical_rules = src.m_vertical_rules;
   
   return *this;
 }
@@ -69,5 +82,55 @@ std::string PrintLayout::get_page_setup() const
   return m_page_setup;
 }
 
+bool PrintLayout::get_show_grid() const
+{
+  return m_show_grid;
+}
+
+void PrintLayout::set_show_grid(bool show_grid)
+{
+  m_show_grid = show_grid;
+}
+
+bool PrintLayout::get_show_rules() const
+{
+  return m_show_rules;
+}
+
+void PrintLayout::set_show_rules(bool show_rules)
+{
+  m_show_rules = show_rules;
+}
+
+bool PrintLayout::get_show_outlines() const
+{
+  return m_show_outlines;
+}
+
+void PrintLayout::set_show_outlines(bool show_outlines)
+{
+  m_show_outlines = show_outlines;
+}
+
+PrintLayout::type_vec_doubles PrintLayout::get_horizontal_rules() const
+{
+  return m_horizontal_rules;
+}
+
+void PrintLayout::set_horizontal_rules(const type_vec_doubles& rules)
+{
+  m_horizontal_rules = rules;
+}
+
+PrintLayout::type_vec_doubles PrintLayout::get_vertical_rules() const
+{
+  return m_vertical_rules;
+}
+
+void PrintLayout::set_vertical_rules(const type_vec_doubles& rules)
+{
+  m_vertical_rules = rules;
+}
+
 } //namespace Glom
 
diff --git a/glom/libglom/data_structure/print_layout.h b/glom/libglom/data_structure/print_layout.h
index bf3590c..9c9a725 100644
--- a/glom/libglom/data_structure/print_layout.h
+++ b/glom/libglom/data_structure/print_layout.h
@@ -48,10 +48,38 @@ public:
    */
   std::string get_page_setup() const;
 
+  bool get_show_grid() const;
+  void set_show_grid(bool show_grid = true);
+
+  bool get_show_rules() const;
+  void set_show_rules(bool show_rules = true);
+
+  bool get_show_outlines() const;
+  void set_show_outlines(bool show_outlines = true);
+
+  typedef std::vector<double> type_vec_doubles;
+
+  /** Get the y positions of the horizontal rule lines.
+   */
+  type_vec_doubles get_horizontal_rules() const;
+  void set_horizontal_rules(const type_vec_doubles& rules);
+
+  /** Get the x positions of the vertical rule lines.
+   */
+  type_vec_doubles get_vertical_rules() const;
+  void set_vertical_rules(const type_vec_doubles& rules);
+
 private:
   bool m_show_table_title;
 
+  bool m_show_grid;
+  bool m_show_rules;
+  bool m_show_outlines;
+
   std::string m_page_setup;
+
+  type_vec_doubles m_horizontal_rules;
+  type_vec_doubles m_vertical_rules;
 };
 
 } //namespace Glom
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index 6edc6ab..b07a965 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -171,6 +171,12 @@ static const char GLOM_ATTRIBUTE_LAYOUT_ITEM_FIELDSUMMARY_SUMMARYTYPE[] = "summa
 
 static const char GLOM_NODE_PRINT_LAYOUTS[] = "print_layouts";
 static const char GLOM_NODE_PRINT_LAYOUT[] = "print_layout";
+static const char GLOM_ATTRIBUTE_PRINT_LAYOUT_SHOW_GRID[] = "show_grid";
+static const char GLOM_ATTRIBUTE_PRINT_LAYOUT_SHOW_RULES[] = "show_rules";
+static const char GLOM_ATTRIBUTE_PRINT_LAYOUT_SHOW_OUTLINES[] = "show_outlines";
+static const char GLOM_NODE_HORIZONTAL_RULE[] = "horizonal_rule";
+static const char GLOM_NODE_VERTICAL_RULE[] = "vertical_rule";
+static const char GLOM_ATTRIBUTE_RULE_POSITION[] = "position";
 
 static const char GLOM_NODE_FORMAT[] = "formatting";
 static const char GLOM_ATTRIBUTE_FORMAT_THOUSANDS_SEPARATOR[] = "format_thousands_separator";
@@ -2896,6 +2902,41 @@ bool Document::load_after(int& failure_code)
                 print_layout->set_name(name);
                 print_layout->set_show_table_title(show_table_title);
 
+                print_layout->set_show_grid(
+                  get_node_attribute_value_as_bool(node, GLOM_ATTRIBUTE_PRINT_LAYOUT_SHOW_GRID) );
+                print_layout->set_show_rules(
+                  get_node_attribute_value_as_bool(node, GLOM_ATTRIBUTE_PRINT_LAYOUT_SHOW_RULES) );
+                print_layout->set_show_outlines(
+                  get_node_attribute_value_as_bool(node, GLOM_ATTRIBUTE_PRINT_LAYOUT_SHOW_OUTLINES) );
+
+                //Get the horizontal and vertical rules:
+                PrintLayout::type_vec_doubles vec_rules_h;
+                xmlpp::Node::NodeList listRules = node->get_children(GLOM_NODE_HORIZONTAL_RULE);
+                for(xmlpp::Node::NodeList::iterator iter = listRules.begin(); iter != listRules.end(); ++iter)
+                {
+                  const xmlpp::Element* node = dynamic_cast<const xmlpp::Element*>(*iter);
+                  if(!node)
+                    continue;
+
+                  const double pos = get_node_attribute_value_as_decimal(node, GLOM_ATTRIBUTE_RULE_POSITION);
+                  vec_rules_h.push_back(pos);
+                }
+		print_layout->set_horizontal_rules(vec_rules_h);
+
+		PrintLayout::type_vec_doubles vec_rules_v;
+                listRules = node->get_children(GLOM_NODE_VERTICAL_RULE);
+                for(xmlpp::Node::NodeList::iterator iter = listRules.begin(); iter != listRules.end(); ++iter)
+                {
+                  const xmlpp::Element* node = dynamic_cast<const xmlpp::Element*>(*iter);
+                  if(!node)
+                    continue;
+
+                  const double pos = get_node_attribute_value_as_decimal(node, GLOM_ATTRIBUTE_RULE_POSITION);
+                  vec_rules_v.push_back(pos);
+                }
+		print_layout->set_vertical_rules(vec_rules_v);
+
+
                 //Page Setup:
                 const Glib::ustring key_file_text = get_child_text_node(node, GLOM_NODE_PAGE_SETUP);
                 print_layout->set_page_setup(key_file_text);
@@ -3703,6 +3744,27 @@ bool Document::save_before()
           set_node_attribute_value(nodePrintLayout, GLOM_ATTRIBUTE_NAME, print_layout->get_name());
           set_node_attribute_value_as_bool(nodePrintLayout, GLOM_ATTRIBUTE_REPORT_SHOW_TABLE_TITLE, print_layout->get_show_table_title());
 
+          set_node_attribute_value_as_bool(nodePrintLayout, GLOM_ATTRIBUTE_PRINT_LAYOUT_SHOW_GRID, print_layout->get_show_grid());
+          set_node_attribute_value_as_bool(nodePrintLayout, GLOM_ATTRIBUTE_PRINT_LAYOUT_SHOW_RULES, print_layout->get_show_rules());
+          set_node_attribute_value_as_bool(nodePrintLayout, GLOM_ATTRIBUTE_PRINT_LAYOUT_SHOW_OUTLINES, print_layout->get_show_outlines());
+
+          //Save the rule lines:
+          const PrintLayout::type_vec_doubles h_rules = print_layout->get_horizontal_rules();
+          for(PrintLayout::type_vec_doubles::const_iterator iter = h_rules.begin();
+            iter != h_rules.end(); ++iter)
+          {
+            xmlpp::Element* child = nodePrintLayout->add_child(GLOM_NODE_HORIZONTAL_RULE);
+            set_node_attribute_value_as_decimal(child, GLOM_ATTRIBUTE_RULE_POSITION, *iter);
+          }
+
+          const PrintLayout::type_vec_doubles v_rules = print_layout->get_vertical_rules();
+          for(PrintLayout::type_vec_doubles::const_iterator iter = v_rules.begin();
+            iter != v_rules.end(); ++iter)
+          {
+            xmlpp::Element* child = nodePrintLayout->add_child(GLOM_NODE_VERTICAL_RULE);
+            set_node_attribute_value_as_decimal(child, GLOM_ATTRIBUTE_RULE_POSITION, *iter);
+          }
+
           //Page Setup:
           const std::string page_setup = print_layout->get_page_setup();
           if(!page_setup.empty())
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index c4fd3cd..b2cacdf 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -612,6 +612,10 @@ void Window_PrintLayout_Edit::set_print_layout(const Glib::ustring& table_name,
 
   set_ruler_sizes();
 
+  m_action_showgrid->set_active( print_layout->get_show_grid() );
+  m_action_showrules->set_active( print_layout->get_show_rules() );
+  m_action_showoutlines->set_active( print_layout->get_show_outlines() );
+
   m_modified = false;
 }
 
@@ -628,6 +632,13 @@ sharedptr<PrintLayout> Window_PrintLayout_Edit::get_print_layout()
   m_print_layout->set_name( m_entry_name->get_text() );
   m_print_layout->set_title( m_entry_title->get_text() );
 
+  m_print_layout->set_show_grid( m_action_showgrid->get_active() );
+  m_print_layout->set_show_rules( m_action_showrules->get_active() );
+  m_print_layout->set_show_outlines( m_action_showoutlines->get_active() );
+
+  m_print_layout->set_horizontal_rules( m_canvas.get_horizontal_rules() );
+  m_print_layout->set_vertical_rules( m_canvas.get_vertical_rules() );
+
 /*
   m_print_layout->m_layout_group->remove_all_items();
 
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index b9c4422..3ee3681 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -75,6 +75,7 @@ void Canvas_PrintLayout::set_print_layout(const Glib::ustring& table_name, const
   remove_all_items(m_items_group);
   add_layout_group(print_layout->m_layout_group, true /* is top-level */);
 
+  //Use the page setup:
   Glib::RefPtr<Gtk::PageSetup> page_setup;
   const Glib::ustring key_file_text = print_layout->get_page_setup();
   if(!key_file_text.empty())
@@ -89,6 +90,25 @@ void Canvas_PrintLayout::set_print_layout(const Glib::ustring& table_name, const
 
   set_page_setup(page_setup);
 
+
+  //Add the rule lines:
+  remove_rules();
+
+  const PrintLayout::type_vec_doubles h_rules = print_layout->get_horizontal_rules();
+  for(PrintLayout::type_vec_doubles::const_iterator iter = h_rules.begin();
+    iter != h_rules.end(); ++iter)
+  {
+    add_horizontal_rule(*iter);
+  }
+
+  const PrintLayout::type_vec_doubles v_rules = print_layout->get_vertical_rules();
+  for(PrintLayout::type_vec_doubles::const_iterator iter = v_rules.begin();
+    iter != v_rules.end(); ++iter)
+  {
+    add_vertical_rule(*iter);
+  }
+
+
   m_modified = false;
 }
 
@@ -108,6 +128,9 @@ sharedptr<PrintLayout> Canvas_PrintLayout::get_print_layout()
 
   result->set_page_setup(data);
 
+  result->set_horizontal_rules( get_horizontal_rules() );
+  result->set_vertical_rules( get_horizontal_rules() );
+
   return result;
 }
 
diff --git a/glom/utility_widgets/canvas/canvas_editable.cc b/glom/utility_widgets/canvas/canvas_editable.cc
index 150ee4e..b370dc3 100644
--- a/glom/utility_widgets/canvas/canvas_editable.cc
+++ b/glom/utility_widgets/canvas/canvas_editable.cc
@@ -162,6 +162,21 @@ void CanvasEditable::add_horizontal_rule(double y)
   m_grid->add_horizontal_rule(y);
 }
 
+void CanvasEditable::remove_rules()
+{
+  m_grid->remove_rules();
+}
+
+CanvasEditable::type_vec_doubles CanvasEditable::get_horizontal_rules() const
+{
+  return m_grid->get_horizontal_rules();
+}
+
+CanvasEditable::type_vec_doubles CanvasEditable::get_vertical_rules() const
+{
+  return m_grid->get_vertical_rules();
+}
+
 void CanvasEditable::show_temp_rule(double x, double y, bool show)
 {
   m_grid->show_temp_rule(x, y, show);
diff --git a/glom/utility_widgets/canvas/canvas_editable.h b/glom/utility_widgets/canvas/canvas_editable.h
index a2a7cce..1bca48c 100644
--- a/glom/utility_widgets/canvas/canvas_editable.h
+++ b/glom/utility_widgets/canvas/canvas_editable.h
@@ -59,6 +59,12 @@ public:
   void add_vertical_rule(double x);
   void add_horizontal_rule(double y);
 
+  void remove_rules();
+
+  typedef std::vector<double> type_vec_doubles;
+  type_vec_doubles get_horizontal_rules() const;
+  type_vec_doubles get_vertical_rules() const;
+
   /** Either @a x or @a y should be 0.
    */
   void show_temp_rule(double x, double y, bool show = true);
diff --git a/glom/utility_widgets/canvas/canvas_group_grid.cc b/glom/utility_widgets/canvas/canvas_group_grid.cc
index 13428fe..4ef449a 100644
--- a/glom/utility_widgets/canvas/canvas_group_grid.cc
+++ b/glom/utility_widgets/canvas/canvas_group_grid.cc
@@ -69,11 +69,11 @@ bool CanvasGroupGrid::is_close(double a, double b) const
   return (std::abs((long)(a - b)) < m_grid_sensitivity);
 }
 
-double CanvasGroupGrid::snap_position_rules(const type_vec_double& rules, double a) const
+double CanvasGroupGrid::snap_position_rules(const type_vec_doubles& rules, double a) const
 {
   double result = a;
 
-  for(type_vec_double::const_iterator iter = rules.begin(); iter != rules.end(); ++iter)
+  for(type_vec_doubles::const_iterator iter = rules.begin(); iter != rules.end(); ++iter)
   {
     const double rule_a = *iter;
     if(is_close(a, rule_a))
@@ -193,6 +193,24 @@ void CanvasGroupGrid::add_horizontal_rule(double y)
   create_rules();
 }
 
+void CanvasGroupGrid::remove_rules()
+{
+  m_rules_x.clear();
+  m_rules_y.clear();
+
+  create_rules();
+}
+
+CanvasGroupGrid::type_vec_doubles CanvasGroupGrid::get_horizontal_rules() const
+{
+  return m_rules_y;
+}
+
+CanvasGroupGrid::type_vec_doubles CanvasGroupGrid::get_vertical_rules() const
+{
+  return m_rules_x;
+}
+
 void CanvasGroupGrid::set_grid_gap(double gap)
 {
   m_grid_gap = gap;
@@ -222,7 +240,7 @@ void CanvasGroupGrid::create_rules()
     canvas->get_bounds(left, top, right, bottom);
 
   //Vertical rules:
-  for(CanvasGroupGrid::type_vec_double::const_iterator iter = m_rules_x.begin(); iter != m_rules_x.end(); ++iter)
+  for(CanvasGroupGrid::type_vec_doubles::const_iterator iter = m_rules_x.begin(); iter != m_rules_x.end(); ++iter)
   {
     const double x = *iter;
     Glib::RefPtr<Goocanvas::Polyline> line = create_rule_line(x, top, x, bottom);
@@ -230,7 +248,7 @@ void CanvasGroupGrid::create_rules()
   }
 
   //Horizontal rules:
-  for(CanvasGroupGrid::type_vec_double::const_iterator iter = m_rules_y.begin(); iter != m_rules_y.end(); ++iter)
+  for(CanvasGroupGrid::type_vec_doubles::const_iterator iter = m_rules_y.begin(); iter != m_rules_y.end(); ++iter)
   {
     const double y = *iter;
     Glib::RefPtr<Goocanvas::Polyline> line = create_rule_line(left, y, right, y);
diff --git a/glom/utility_widgets/canvas/canvas_group_grid.h b/glom/utility_widgets/canvas/canvas_group_grid.h
index 28f2bc1..1427f47 100644
--- a/glom/utility_widgets/canvas/canvas_group_grid.h
+++ b/glom/utility_widgets/canvas/canvas_group_grid.h
@@ -43,20 +43,6 @@ public:
    */
   void snap_position(double& x, double& y) const;
 
-  /// 0.0 means no grid.
-  double m_grid_gap;
-
-  /// How close we have to be to a grid line to snap to it:
-  double m_grid_sensitivity;
-
-  typedef std::vector<double> type_vec_double;
-
-  /// The x coordinates of any vertical rules:
-  type_vec_double m_rules_x;
-
-  /// The y coordinates of any horizontal rules:
-  type_vec_double m_rules_y;
-
   /** Set the distance between grid lines, 
    * used to snap to the grid lines when moving or resizing items.
    */
@@ -70,6 +56,12 @@ public:
   void add_vertical_rule(double x);
   void add_horizontal_rule(double x);
 
+  void remove_rules();
+
+  typedef std::vector<double> type_vec_doubles;
+  type_vec_doubles get_horizontal_rules() const;
+  type_vec_doubles get_vertical_rules() const;
+
   void set_rules_visibility(bool visible = true);
 
   /** Either @a x or @a y should be 0.
@@ -82,12 +74,24 @@ private:
   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;
+  double snap_position_rules(const type_vec_doubles& rules, double a) const;
   double snap_position_rules_x(double x) const;
   double snap_position_rules_y(double y) const;
 
   bool is_close(double a, double b) const;
 
+  /// 0.0 means no grid.
+  double m_grid_gap;
+
+  /// How close we have to be to a grid line to snap to it:
+  double m_grid_sensitivity;
+
+  /// The x coordinates of any vertical rules:
+  type_vec_doubles m_rules_x;
+
+  /// The y coordinates of any horizontal rules:
+  type_vec_doubles m_rules_y;
+
   Glib::RefPtr<Goocanvas::Grid> m_grid_lines;
   Glib::RefPtr<Goocanvas::Group> m_grid_rules_group;
   Glib::RefPtr<Goocanvas::Polyline> m_temp_rule;



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