summaryrefslogtreecommitdiffstats
path: root/src/display/canvas-grid.cpp
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2008-10-27 18:03:09 +0000
committerTed Gould <ted@canonical.com>2008-10-27 18:03:09 +0000
commit7dbe11bc23efa5f51a9b84e7d0f6dd16e63e0902 (patch)
tree7d3a2b95b84a03a19cb132cdf88bea0ab6dc4773 /src/display/canvas-grid.cpp
parentMerging from trunk (diff)
downloadinkscape-7dbe11bc23efa5f51a9b84e7d0f6dd16e63e0902.tar.gz
inkscape-7dbe11bc23efa5f51a9b84e7d0f6dd16e63e0902.zip
From trunk
(bzr r6885)
Diffstat (limited to 'src/display/canvas-grid.cpp')
-rw-r--r--src/display/canvas-grid.cpp39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp
index 9b6b512b0..8505426d3 100644
--- a/src/display/canvas-grid.cpp
+++ b/src/display/canvas-grid.cpp
@@ -1,10 +1,8 @@
-#define INKSCAPE_CANVAS_GRID_C
-
-/*
- *
- * Copyright (C) Johan Engelen 2006-2007 <johan@shouraizou.nl>
+/** @file
+ * @brief Cartesian grid implementation
+ */
+/* Copyright (C) Johan Engelen 2006-2007 <johan@shouraizou.nl>
* Copyright (C) Lauris Kaplinski 2000
- *
*/
/* As a general comment, I am not exactly proud of how things are done.
@@ -13,6 +11,7 @@
* Don't be shy to correct things.
*/
+#define INKSCAPE_CANVAS_GRID_C
#include "sp-canvas-util.h"
#include "util/mathfns.h"
@@ -416,17 +415,17 @@ CanvasXYGrid::CanvasXYGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, SPD
: CanvasGrid(nv, in_repr, in_doc, GRID_RECTANGULAR)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- gridunit = sp_unit_get_by_abbreviation( prefs->getString("options.grids.xy", "units").data() );
+ gridunit = sp_unit_get_by_abbreviation( prefs->getString("/options/grids/xy/units").data() );
if (!gridunit)
gridunit = &sp_unit_get_by_id(SP_UNIT_PX);
- origin[Geom::X] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "origin_x", 0.0), *gridunit);
- origin[Geom::Y] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "origin_y", 0.0), *gridunit);
- color = prefs->getInt("options.grids.xy", "color", 0x0000ff20);
- empcolor = prefs->getInt("options.grids.xy", "empcolor", 0x0000ff40);
- empspacing = prefs->getInt("options.grids.xy", "empspacing", 5);
- spacing[Geom::X] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "spacing_x", 0.0), *gridunit);
- spacing[Geom::Y] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "spacing_y", 0.0), *gridunit);
- render_dotted = prefs->getBool("options.grids.xy", "dotted", false);
+ origin[Geom::X] = sp_units_get_pixels(prefs->getDouble("/options/grids/xy/origin_x", 0.0), *gridunit);
+ origin[Geom::Y] = sp_units_get_pixels(prefs->getDouble("/options/grids/xy/origin_y", 0.0), *gridunit);
+ color = prefs->getInt("/options/grids/xy/color", 0x0000ff20);
+ empcolor = prefs->getInt("/options/grids/xy/empcolor", 0x0000ff40);
+ empspacing = prefs->getInt("/options/grids/xy/empspacing", 5);
+ spacing[Geom::X] = sp_units_get_pixels(prefs->getDouble("/options/grids/xy/spacing_x", 0.0), *gridunit);
+ spacing[Geom::Y] = sp_units_get_pixels(prefs->getDouble("/options/grids/xy/spacing_y", 0.0), *gridunit);
+ render_dotted = prefs->getBool("/options/grids/xy/dotted", false);
snapper = new CanvasXYGridSnapper(this, &namedview->snap_manager, 0);
@@ -889,7 +888,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf)
//set correct coloring, depending preference (when zoomed out, always major coloring or minor coloring)
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
guint32 _empcolor;
- bool no_emp_when_zoomed_out = prefs->getBool("options.grids", "no_emphasize_when_zoomedout", false);
+ bool no_emp_when_zoomed_out = prefs->getBool("/options/grids/no_emphasize_when_zoomedout", false);
if( (scaled[Geom::X] || scaled[Geom::Y]) && no_emp_when_zoomed_out ) {
_empcolor = color;
} else {
@@ -1000,14 +999,10 @@ void CanvasXYGridSnapper::_addSnappedLine(SnappedConstraints &sc, Geom::Point co
*/
bool CanvasXYGridSnapper::ThisSnapperMightSnap() const
{
- return _snap_enabled && _snap_from != 0;
+ return _snapmanager->snapprefs.getSnapModeBBoxOrNodes();
}
-
-
-
-
-}; /* namespace Inkscape */
+} // namespace Inkscape
/*