Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 15994) +++ trunk/scconfig/Rev.h (revision 15995) @@ -1 +1 @@ -static const int myrev = 15944; +static const int myrev = 15995; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 15994) +++ trunk/scconfig/Rev.tab (revision 15995) @@ -1,3 +1,4 @@ +15995 configure split off grid code from crosshair code 15944 configure new default menu file preparation: embed the new menu, do not embed the old menus 15910 configure old data model removal 15352 configure typo in LIBDIR_INSTALLED Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 15994) +++ trunk/src/Makefile.in (revision 15995) @@ -56,6 +56,7 @@ flag.o flag_str.o funchash.o + grid.o gui_act.o heap.o hid_actions.o Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 15994) +++ trunk/src/crosshair.c (revision 15995) @@ -46,6 +46,7 @@ #include "event.h" #include "action_helper.h" #include "macro.h" +#include "grid.h" #include "obj_line_draw.h" #include "obj_arc_draw.h" @@ -506,18 +507,6 @@ } /* --------------------------------------------------------------------------- - * Returns the nearest grid-point to the given Coord - */ -pcb_coord_t pcb_grid_fit(pcb_coord_t x, pcb_coord_t grid_spacing, pcb_coord_t grid_offset) -{ - x -= grid_offset; - x = grid_spacing * pcb_round((double) x / grid_spacing); - x += grid_offset; - return x; -} - - -/* --------------------------------------------------------------------------- * notify the GUI that data relating to the crosshair is being changed. * * The argument passed is pcb_false to notify "changes are about to happen", Index: trunk/src/crosshair.h =================================================================== --- trunk/src/crosshair.h (revision 15994) +++ trunk/src/crosshair.h (revision 15995) @@ -102,8 +102,6 @@ extern pcb_crosshair_t pcb_crosshair; extern pcb_mark_t pcb_marked; - -pcb_coord_t pcb_grid_fit(pcb_coord_t x, pcb_coord_t grid_spacing, pcb_coord_t grid_offset); void pcb_notify_crosshair_change(pcb_bool changes_complete); void pcb_notify_mark_change(pcb_bool changes_complete); void pcb_draw_attached(void); Index: trunk/src/grid.c =================================================================== --- trunk/src/grid.c (nonexistent) +++ trunk/src/grid.c (revision 15995) @@ -0,0 +1,42 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * (this file is based on PCB, interactive printed circuit board design) + * Copyright (C) 1994,1995,1996 Thomas Nau + * 15 Oct 2008 Ineiev: add different crosshair shapes + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/pcb-rnd + * lead developer: email to pcb-rnd (at) igor2.repo.hu + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + * + */ + +#include "config.h" +#include "unit.h" +#include "grid.h" +#include "compat_misc.h" + +pcb_coord_t pcb_grid_fit(pcb_coord_t x, pcb_coord_t grid_spacing, pcb_coord_t grid_offset) +{ + x -= grid_offset; + x = grid_spacing * pcb_round((double) x / grid_spacing); + x += grid_offset; + return x; +} Index: trunk/src/grid.h =================================================================== --- trunk/src/grid.h (nonexistent) +++ trunk/src/grid.h (revision 15995) @@ -0,0 +1,31 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * (this file is based on PCB, interactive printed circuit board design) + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/pcb-rnd + * lead developer: email to pcb-rnd (at) igor2.repo.hu + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + * + */ + +/* Returns the nearest grid-point to the given coord x */ +pcb_coord_t pcb_grid_fit(pcb_coord_t x, pcb_coord_t grid_spacing, pcb_coord_t grid_offset); Index: trunk/src/select_act.c =================================================================== --- trunk/src/select_act.c (revision 15994) +++ trunk/src/select_act.c (revision 15995) @@ -46,6 +46,7 @@ #include "draw.h" #include "remove.h" #include "copy.h" +#include "grid.h" #include "hid_attrib.h" #include "compat_misc.h" #include "compat_nls.h" Index: trunk/src/tool.c =================================================================== --- trunk/src/tool.c (revision 15994) +++ trunk/src/tool.c (revision 15995) @@ -32,6 +32,7 @@ #include "conf_core.h" #include "error.h" #include "event.h" +#include "grid.h" #warning tool TODO: remove this when pcb_crosshair_set_mode() got moved here #include "crosshair.h" Index: trunk/src_plugins/hid_gtk2_gdk/gtkhid-gdk.c =================================================================== --- trunk/src_plugins/hid_gtk2_gdk/gtkhid-gdk.c (revision 15994) +++ trunk/src_plugins/hid_gtk2_gdk/gtkhid-gdk.c (revision 15995) @@ -7,6 +7,7 @@ #include "clip.h" #include "data.h" #include "layer.h" +#include "grid.h" #include "hid_draw_helpers.h" #include "hid_attrib.h" #include "hid_helper.h" Index: trunk/src_plugins/hid_gtk3_cairo/gtkhid-cairo.c =================================================================== --- trunk/src_plugins/hid_gtk3_cairo/gtkhid-cairo.c (revision 15994) +++ trunk/src_plugins/hid_gtk3_cairo/gtkhid-cairo.c (revision 15995) @@ -35,6 +35,7 @@ #include "clip.h" #include "data.h" #include "layer.h" +#include "grid.h" #include "hid_draw_helpers.h" #include "hid_attrib.h" #include "hid_helper.h" Index: trunk/src_plugins/hid_lesstif/main.c =================================================================== --- trunk/src_plugins/hid_lesstif/main.c (revision 15994) +++ trunk/src_plugins/hid_lesstif/main.c (revision 15995) @@ -43,6 +43,7 @@ #include "hid_flags.h" #include "hid_actions.h" #include "stdarg.h" +#include "grid.h" #include "misc_util.h" #include "compat_misc.h" #include "compat_nls.h" Index: trunk/src_plugins/lib_hid_gl/hidgl.c =================================================================== --- trunk/src_plugins/lib_hid_gl/hidgl.c (revision 15994) +++ trunk/src_plugins/lib_hid_gl/hidgl.c (revision 15995) @@ -37,6 +37,7 @@ #include "crosshair.h" #include "data.h" #include "board.h" +#include "grid.h" #include "hid.h" #include "hidgl.h"