summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2006-10-23 20:02:46 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2006-10-23 20:02:46 +0000
commit60c80ca6de31f89d804ac9fe5b6834ccb60e0d76 (patch)
tree117943d92bff9a406f56a5ecc9eae39a8b22dfc0 /src
parentaxonomgrid: Bugfix (diff)
downloadinkscape-60c80ca6de31f89d804ac9fe5b6834ccb60e0d76.tar.gz
inkscape-60c80ca6de31f89d804ac9fe5b6834ccb60e0d76.zip
Committed double code because of the hurry to let you use the axonom-snapping stuff.
(bzr r1848)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_insert1
-rw-r--r--src/axonomgrid-snapper.cpp86
-rw-r--r--src/axonomgrid-snapper.h33
-rw-r--r--src/grid-snapper.cpp3
4 files changed, 2 insertions, 121 deletions
diff --git a/src/Makefile_insert b/src/Makefile_insert
index a6a827ead..fec782544 100644
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
@@ -40,7 +40,6 @@ libinkpre_a_SOURCES = \
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
deleted file mode 100644
index 811eb4218..000000000
--- a/src/axonomgrid-snapper.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifdef AXONOM
-
-/**
- * \file axonomgrid-snapper.cpp
- * \brief Snapping things to axonometric grids.
- *
- * Author:
- * Johan Engelen <johan@shouraizou.nl>
- *
- * Copyright (C) 2006 Authors
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include "sp-namedview.h"
-#include "inkscape.h"
-#include "desktop.h"
-#include "display/canvas-axonomgrid.h"
-
-/**
- * \return x rounded to the nearest multiple of c1 plus c0.
- *
- * \note
- * If c1==0 (and c0 is finite), then returns +/-inf. This makes grid spacing of zero
- * mean "ignore the grid in this dimention". We're currently discussing "good" semantics
- * for guide/grid snapping.
- */
-
-/* FIXME: move this somewhere else, perhaps */
-static
-
-Inkscape::AxonomGridSnapper::AxonomGridSnapper(SPNamedView const *nv, NR::Coord const d) : LineSnapper(nv, d)
-{
-
-}
-
-Inkscape::LineSnapper::LineList
-Inkscape::AxonomGridSnapper::_getSnapLines(NR::Point const &p) const
-{
- double round_to_nearest_multiple_plus(double x, double const c1, double const c0)
- {
- return floor((x - c0) / c1 + .5) * c1 + c0;
- }
-
- LineList s;
-
- if ( NULL == _named_view ) {
- return s;
- }
-
- SPCAxonomGrid *griditem = NULL;
- for (GSList *l = _named_view->gridviews; l != NULL; l = l->next) {
- // FIXME : this is a hack since there is only one view for now
- // but when we'll handle multiple views, snapping should
- // must be rethought and maybe only the current view
- // should give back it's SHOWN lines to snap to
- // For now, the last SPCGrid in _named_view->gridviews will be used.
- griditem = SP_CAXONOMGRID(l->data);
- }
-
- g_assert(griditem != NULL);
-
- for (unsigned int i = 0; i < 2; ++i) {
-
- /* This is to make sure we snap to only visible grid lines */
- double scaled_spacing = griditem->sw[i]; // this is spacing of visible lines if screen pixels
-
- // convert screen pixels to px
- // FIXME: after we switch to snapping dist in screen pixels, this will be unnecessary
- if (SP_ACTIVE_DESKTOP) {
- scaled_spacing /= SP_ACTIVE_DESKTOP->current_zoom();
- }
-
- NR::Coord const rounded = round_to_nearest_multiple_plus(p[i],
- scaled_spacing,
- _named_view->gridorigin[i]);
-
- s.push_back(std::make_pair(NR::Dim2(i), rounded));
- }
-
- return s;
-}
-
-
-
-#endif
diff --git a/src/axonomgrid-snapper.h b/src/axonomgrid-snapper.h
deleted file mode 100644
index 46090ee56..000000000
--- a/src/axonomgrid-snapper.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef SEEN_AXONOMGRID_SNAPPER_H
-#define SEEN_AXONOMGRID_SNAPPER_H
-
-/**
- * \file axonomgrid-snapper.h
- * \brief Snapping things to axonometricgrids.
- *
- * Author:
- * Johan Engelen <johan@shouraizou.nl>
- *
- * Copyright (C) 2006 Author
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include "line-snapper.h"
-
-namespace Inkscape
-{
-
-class AxonomGridSnapper : public LineSnapper
-{
-public:
- AxonomGridSnapper(SPNamedView const *nv, NR::Coord const d);
-
-private:
- LineList _getSnapLines(NR::Point const &p) const;
-};
-
-}
-
-#endif
-
diff --git a/src/grid-snapper.cpp b/src/grid-snapper.cpp
index 03f6c9d3a..2d6e8e2e3 100644
--- a/src/grid-snapper.cpp
+++ b/src/grid-snapper.cpp
@@ -127,12 +127,13 @@ Inkscape::AxonomGridSnapper::_getSnapLines(NR::Point const &p) const
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));