Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 23098) +++ trunk/scconfig/Rev.h (revision 23099) @@ -1 +1 @@ -static const int myrev = 22617; +static const int myrev = 23099; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 23098) +++ trunk/scconfig/Rev.tab (revision 23099) @@ -1,3 +1,4 @@ +23099 configure merge copy.[ch] into move.[ch] for compactness 22617 distclean enable the socket plugin in scconfig for detecting select() as an alternative to usleep() 22462 configure lesstif tree table widget code, low level 22305 configure new source files for lesstif color button Index: trunk/src/copy.c =================================================================== --- trunk/src/copy.c (revision 23098) +++ trunk/src/copy.c (nonexistent) @@ -1,76 +0,0 @@ -/* - * 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 - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Contact: - * Project page: http://repo.hu/projects/pcb-rnd - * lead developer: http://repo.hu/projects/pcb-rnd/contact.html - * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") - * - */ - -/* functions used to copy objects - * it's necessary to copy data by calling create... since the base pointer - * may change cause of dynamic memory allocation - */ - -#include "config.h" -#include "conf_core.h" - -#include "board.h" -#include "data.h" -#include "draw.h" -#include "select.h" -#include "undo.h" -#include "obj_arc_op.h" -#include "obj_line_op.h" -#include "obj_poly_op.h" -#include "obj_text_op.h" -#include "obj_subc_op.h" -#include "obj_pstk_op.h" - -static pcb_opfunc_t CopyFunctions = { - pcb_lineop_copy, - pcb_textop_copy, - pcb_polyop_copy, - NULL, - NULL, - pcb_arcop_copy, - NULL, - NULL, - pcb_subcop_copy, - pcb_pstkop_copy -}; - -void *pcb_copy_obj(int Type, void *Ptr1, void *Ptr2, void *Ptr3, pcb_coord_t DX, pcb_coord_t DY) -{ - void *ptr; - pcb_opctx_t ctx; - - ctx.copy.pcb = PCB; - ctx.copy.DeltaX = DX; - ctx.copy.DeltaY = DY; - ctx.copy.from_outside = 0; - - /* the subroutines add the objects to the undo-list */ - ptr = pcb_object_operation(&CopyFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); - pcb_undo_inc_serial(); - return ptr; -} Index: trunk/src/copy.h =================================================================== --- trunk/src/copy.h (revision 23098) +++ trunk/src/copy.h (nonexistent) @@ -1,42 +0,0 @@ -/* - * 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 - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Contact: - * Project page: http://repo.hu/projects/pcb-rnd - * lead developer: http://repo.hu/projects/pcb-rnd/contact.html - * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") - * - */ - -#ifndef PCB_COPY_H -#define PCB_COPY_H - -#include "config.h" - -#define PCB_COPY_TYPES \ - (PCB_OBJ_PSTK | PCB_OBJ_LINE | PCB_OBJ_TEXT | \ - PCB_OBJ_SUBC | PCB_OBJ_POLY | PCB_OBJ_ARC) - -/* Undoably copies (duplicates) an object; the new objects is moved by DX,DY - (operation wrapper) */ -void *pcb_copy_obj(int Type, void *Ptr1, void *Ptr2, void *Ptr3, pcb_coord_t DX, pcb_coord_t DY); - -#endif Index: trunk/src/Makefile.dep =================================================================== --- trunk/src/Makefile.dep (revision 23098) +++ trunk/src/Makefile.dep (revision 23099) @@ -4205,7 +4205,7 @@ hid.h conf.h ../src_plugins/lib_gtk_common/compat.h \ ../src_plugins/lib_gtk_common/wt_preview.h layer.h \ ../src_plugins/lib_gtk_common/ui_zoompan.h ../src_3rd/libfungw/fungw.h \ - unit.h pcb_bool.h copy.h board.h vtroutestyle.h layer_grp.h library.h \ + unit.h pcb_bool.h board.h vtroutestyle.h layer_grp.h library.h \ rats_patch.h board.h data.h crosshair.h vtonpoint.h route.h buffer.h \ obj_rat_list.h obj_rat.h obj_subc_list.h obj_subc.h \ ../src_3rd/libminuid/libminuid.h rtree.h \ @@ -5979,7 +5979,7 @@ obj_arc.h ../src_3rd/genlist/gendlist.h obj_line_list.h obj_line.h \ obj_poly_list.h obj_poly.h polyarea.h obj_text_list.h obj_text.h font.h \ ../src_3rd/genht/htip.h box.h math_helper.h misc_util.h layer_grp.h \ - library.h rats_patch.h copy.h data.h crosshair.h vtonpoint.h hid.h \ + library.h rats_patch.h data.h crosshair.h vtonpoint.h hid.h \ error.h route.h obj_rat_list.h obj_rat.h obj_subc_list.h obj_subc.h \ ../src_3rd/libminuid/libminuid.h rtree.h \ ../src_3rd/genrtree/genrtree_api.h rtree2_compat.h ht_subc.h \ @@ -7252,7 +7252,7 @@ vtroutestyle.h library.h rats_patch.h tool.h change.h undo.h \ ../src_3rd/libuundo/uundo.h undo_old.h event.h funchash_core.h \ funchash.h funchash_core_list.h search.h rats.h netlist.h route_style.h \ - draw.h copy.h move.h remove.h compat_misc.h compat_nls.h layer_vis.h \ + draw.h move.h remove.h compat_misc.h compat_nls.h layer_vis.h \ operation.h macro.h rotate.h actions.h operation.o: operation.c ../config.h operation.h global_typedefs.h \ pcb_bool.h unit.h board.h vtroutestyle.h attrib.h \ @@ -7514,7 +7514,7 @@ ../src_3rd/genrtree/genrtree_api.h rtree2_compat.h ht_subc.h \ ../src_3rd/genht/ht.h obj_pstk_list.h obj_pstk.h \ ../src_3rd/genvector/vtp0.h vtpadstack.h obj_pstk_shape.h polygon.h \ - vtpadstack_t.h copy.h compat_misc.h compat_nls.h safe_fs.h conf.h \ + vtpadstack_t.h compat_misc.h compat_nls.h safe_fs.h conf.h \ pcb-printf.h ../src_3rd/liblihata/lihata.h list_conf.h funchash_core.h \ funchash.h funchash_core_list.h search.h rats.h netlist.h route_style.h \ undo.h ../src_3rd/libuundo/uundo.h undo_old.h conf_core.h @@ -7701,7 +7701,7 @@ ../src_3rd/genht/ht.h ../src_3rd/genht/hash.h obj_pstk_list.h obj_pstk.h \ vtpadstack.h obj_pstk_shape.h polygon.h vtpadstack_t.h undo.h \ ../src_3rd/libuundo/uundo.h undo_old.h funchash_core.h funchash.h \ - funchash_core_list.h tool.h select.h operation.h draw.h remove.h copy.h \ + funchash_core_list.h tool.h select.h operation.h draw.h remove.h \ grid.h hid_attrib.h compat_misc.h compat_nls.h actions.h stub_draw.o: stub_draw.c ../config.h stub_draw.h hid.h \ ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ @@ -7843,7 +7843,7 @@ obj_text_list.h obj_text.h font.h ../src_3rd/genht/htip.h \ ../src_3rd/genht/ht.h box.h math_helper.h misc_util.h \ ../src_3rd/genvector/gds_char.h layer_grp.h library.h rats_patch.h \ - copy.h crosshair.h vtonpoint.h hid.h ../src_3rd/liblihata/dom.h \ + crosshair.h vtonpoint.h hid.h ../src_3rd/liblihata/dom.h \ ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ ../src_3rd/genht/htsp.h error.h route.h search.h rats.h netlist.h \ route_style.h tool.h ../src_3rd/genvector/vtp0.h @@ -7917,7 +7917,7 @@ obj_text_list.h obj_text.h font.h ../src_3rd/genht/htip.h \ ../src_3rd/genht/ht.h box.h math_helper.h misc_util.h \ ../src_3rd/genvector/gds_char.h layer_grp.h library.h rats_patch.h \ - compat_nls.h copy.h move.h crosshair.h vtonpoint.h hid.h \ + compat_nls.h move.h crosshair.h vtonpoint.h hid.h \ ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ ../src_3rd/liblihata/parser.h ../src_3rd/genht/htsp.h error.h route.h \ search.h rats.h netlist.h route_style.h tool.h \ Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 23098) +++ trunk/src/Makefile.in (revision 23099) @@ -67,7 +67,6 @@ compat_fs.o compat_lrealpath.o compat_misc.o - copy.o crosshair.o data.o draw.o Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 23098) +++ trunk/src/buffer.c (revision 23099) @@ -33,7 +33,7 @@ #include "buffer.h" #include "board.h" -#include "copy.h" +#include "move.h" #include "data.h" #include "plug_io.h" #include "polygon.h" Index: trunk/src/move.c =================================================================== --- trunk/src/move.c (revision 23098) +++ trunk/src/move.c (revision 23099) @@ -101,6 +101,20 @@ NULL /* padstack */ }; +static pcb_opfunc_t CopyFunctions = { + pcb_lineop_copy, + pcb_textop_copy, + pcb_polyop_copy, + NULL, + NULL, + pcb_arcop_copy, + NULL, + NULL, + pcb_subcop_copy, + pcb_pstkop_copy +}; + + void *pcb_move_obj(int Type, void *Ptr1, void *Ptr2, void *Ptr3, pcb_coord_t DX, pcb_coord_t DY) { void *result; @@ -250,3 +264,19 @@ /* passing pcb_true to above operation causes Undoserial to auto-increment */ return changed; } + +void *pcb_copy_obj(int Type, void *Ptr1, void *Ptr2, void *Ptr3, pcb_coord_t DX, pcb_coord_t DY) +{ + void *ptr; + pcb_opctx_t ctx; + + ctx.copy.pcb = PCB; + ctx.copy.DeltaX = DX; + ctx.copy.DeltaY = DY; + ctx.copy.from_outside = 0; + + /* the subroutines add the objects to the undo-list */ + ptr = pcb_object_operation(&CopyFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); + pcb_undo_inc_serial(); + return ptr; +} Index: trunk/src/move.h =================================================================== --- trunk/src/move.h (revision 23098) +++ trunk/src/move.h (revision 23099) @@ -31,7 +31,7 @@ #include "config.h" -/*** Transformation macros and constants ***/ +/*** move ***/ #define PCB_MOVE_TYPES \ (PCB_OBJ_PSTK | PCB_OBJ_LINE | PCB_OBJ_TEXT | PCB_OBJ_SUBC | \ PCB_OBJ_POLY | PCB_OBJ_POLY_POINT | PCB_OBJ_LINE_POINT | PCB_OBJ_ARC | PCB_OBJ_ARC_POINT) @@ -50,4 +50,14 @@ void *pcb_move_obj_to_layer(int Type, void *Ptr1, void *Ptr2, void *Ptr3, pcb_layer_t *Target, pcb_bool enmasse); pcb_bool pcb_move_selected_objs_to_layer(pcb_layer_t *Target); + +/*** copy ***/ +#define PCB_COPY_TYPES \ + (PCB_OBJ_PSTK | PCB_OBJ_LINE | PCB_OBJ_TEXT | \ + PCB_OBJ_SUBC | PCB_OBJ_POLY | PCB_OBJ_ARC) + +/* Undoably copies (duplicates) an object; the new objects is moved by DX,DY + (operation wrapper) */ +void *pcb_copy_obj(int Type, void *Ptr1, void *Ptr2, void *Ptr3, pcb_coord_t DX, pcb_coord_t DY); + #endif Index: trunk/src/object_act.c =================================================================== --- trunk/src/object_act.c (revision 23098) +++ trunk/src/object_act.c (revision 23099) @@ -45,7 +45,6 @@ #include "search.h" #include "draw.h" -#include "copy.h" #include "move.h" #include "remove.h" #include "compat_misc.h" Index: trunk/src/rats_patch.c =================================================================== --- trunk/src/rats_patch.c (revision 23098) +++ trunk/src/rats_patch.c (revision 23099) @@ -32,7 +32,7 @@ #include "actions.h" #include "data.h" #include "error.h" -#include "copy.h" +#include "move.h" #include "compat_misc.h" #include "compat_nls.h" #include "safe_fs.h" Index: trunk/src/select_act.c =================================================================== --- trunk/src/select_act.c (revision 23098) +++ trunk/src/select_act.c (revision 23099) @@ -44,7 +44,7 @@ #include "select.h" #include "draw.h" #include "remove.h" -#include "copy.h" +#include "move.h" #include "grid.h" #include "hid_attrib.h" #include "compat_misc.h" Index: trunk/src/tool_copy.c =================================================================== --- trunk/src/tool_copy.c (revision 23098) +++ trunk/src/tool_copy.c (revision 23099) @@ -35,7 +35,7 @@ #include "config.h" #include "board.h" -#include "copy.h" +#include "move.h" #include "crosshair.h" #include "search.h" #include "tool.h" Index: trunk/src/tool_move.c =================================================================== --- trunk/src/tool_move.c (revision 23098) +++ trunk/src/tool_move.c (revision 23099) @@ -36,7 +36,6 @@ #include "board.h" #include "compat_nls.h" -#include "copy.h" #include "move.h" #include "crosshair.h" #include "search.h"