summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4cc63b0)
raw | patch | inline | side by side (parent: 4cc63b0)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Mon, 23 Oct 2006 20:02:46 +0000 (20:02 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Mon, 23 Oct 2006 20:02:46 +0000 (20:02 +0000) |
src/Makefile_insert | patch | blob | history | |
src/axonomgrid-snapper.cpp | [deleted file] | patch | blob | history |
src/axonomgrid-snapper.h | [deleted file] | patch | blob | history |
src/grid-snapper.cpp | patch | blob | history |
diff --git a/src/Makefile_insert b/src/Makefile_insert
index a6a827ead030e4819ece8d5733cffb8ef51595c1..fec782544d394d65f5d4b88cf364fea0ddd2845e 100644 (file)
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
approx-equal.h remove-last.h \
arc-context.cpp arc-context.h \
attributes.cpp attributes.h \
- axonomgrid-snapper.cpp axonomgrid-snapper.h \
bad-uri-exception.h \
brokenimage.xpm \
color-rgba.h \
diff --git a/src/axonomgrid-snapper.cpp b/src/axonomgrid-snapper.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifdef AXONOM\r
-\r
-/**\r
- * \file axonomgrid-snapper.cpp\r
- * \brief Snapping things to axonometric grids.\r
- *\r
- * Author:\r
- * Johan Engelen <johan@shouraizou.nl>\r
- *\r
- * Copyright (C) 2006 Authors\r
- *\r
- * Released under GNU GPL, read the file 'COPYING' for more information\r
- */\r
-\r
-#include "sp-namedview.h"\r
-#include "inkscape.h"\r
-#include "desktop.h"\r
-#include "display/canvas-axonomgrid.h"\r
-\r
-/**\r
- * \return x rounded to the nearest multiple of c1 plus c0.\r
- *\r
- * \note\r
- * If c1==0 (and c0 is finite), then returns +/-inf. This makes grid spacing of zero\r
- * mean "ignore the grid in this dimention". We're currently discussing "good" semantics\r
- * for guide/grid snapping.\r
- */\r
-\r
-/* FIXME: move this somewhere else, perhaps */\r
-static \r
-\r
-Inkscape::AxonomGridSnapper::AxonomGridSnapper(SPNamedView const *nv, NR::Coord const d) : LineSnapper(nv, d)\r
-{\r
-\r
-}\r
-\r
-Inkscape::LineSnapper::LineList \r
-Inkscape::AxonomGridSnapper::_getSnapLines(NR::Point const &p) const\r
-{\r
- double round_to_nearest_multiple_plus(double x, double const c1, double const c0)\r
- {\r
- return floor((x - c0) / c1 + .5) * c1 + c0;\r
- } \r
- \r
- LineList s;\r
-\r
- if ( NULL == _named_view ) {\r
- return s;\r
- }\r
-\r
- SPCAxonomGrid *griditem = NULL;\r
- for (GSList *l = _named_view->gridviews; l != NULL; l = l->next) {\r
- // FIXME : this is a hack since there is only one view for now\r
- // but when we'll handle multiple views, snapping should\r
- // must be rethought and maybe only the current view\r
- // should give back it's SHOWN lines to snap to\r
- // For now, the last SPCGrid in _named_view->gridviews will be used.\r
- griditem = SP_CAXONOMGRID(l->data);\r
- }\r
-\r
- g_assert(griditem != NULL);\r
-\r
- for (unsigned int i = 0; i < 2; ++i) {\r
-\r
- /* This is to make sure we snap to only visible grid lines */\r
- double scaled_spacing = griditem->sw[i]; // this is spacing of visible lines if screen pixels\r
-\r
- // convert screen pixels to px\r
- // FIXME: after we switch to snapping dist in screen pixels, this will be unnecessary\r
- if (SP_ACTIVE_DESKTOP) {\r
- scaled_spacing /= SP_ACTIVE_DESKTOP->current_zoom();\r
- }\r
-\r
- NR::Coord const rounded = round_to_nearest_multiple_plus(p[i],\r
- scaled_spacing,\r
- _named_view->gridorigin[i]);\r
-\r
- s.push_back(std::make_pair(NR::Dim2(i), rounded));\r
- }\r
-\r
- return s;\r
-}\r
-\r
-\r
-\r
-#endif \r
diff --git a/src/axonomgrid-snapper.h b/src/axonomgrid-snapper.h
--- a/src/axonomgrid-snapper.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef SEEN_AXONOMGRID_SNAPPER_H\r
-#define SEEN_AXONOMGRID_SNAPPER_H\r
-\r
-/**\r
- * \file axonomgrid-snapper.h\r
- * \brief Snapping things to axonometricgrids.\r
- *\r
- * Author:\r
- * Johan Engelen <johan@shouraizou.nl>\r
- *\r
- * Copyright (C) 2006 Author\r
- *\r
- * Released under GNU GPL, read the file 'COPYING' for more information\r
- */\r
-\r
-#include "line-snapper.h"\r
-\r
-namespace Inkscape\r
-{\r
-\r
-class AxonomGridSnapper : public LineSnapper \r
-{ \r
-public: \r
- AxonomGridSnapper(SPNamedView const *nv, NR::Coord const d); \r
-\r
-private: \r
- LineList _getSnapLines(NR::Point const &p) const;\r
-};\r
-\r
-}\r
-\r
-#endif \r
-\r
diff --git a/src/grid-snapper.cpp b/src/grid-snapper.cpp
index 03f6c9d3a22028a75db28aa4b2b78c36cb5dba9b..2d6e8e2e30d80926f908c6b981a424a80ed324b6 100644 (file)
--- a/src/grid-snapper.cpp
+++ b/src/grid-snapper.cpp
NR::Coord const rounded = round_to_nearest_multiple_plus(p[0], scaled_spacing, griditem->origin[0]);
+ /*
int a = round(scaled_spacing);
int b = round(p[0]);
int c = round(rounded);
g_message("hier %d; %d; %d",a,b,c);
-
+ */
s.push_back(std::make_pair(NR::Dim2(0), rounded));