gschem

o_copy.c

Go to the documentation of this file.
00001 /* gEDA - GPL Electronic Design Automation
00002  * gschem - gEDA Schematic Capture
00003  * Copyright (C) 1998-2010 Ales Hvezda
00004  * Copyright (C) 1998-2011 gEDA Contributors (see ChangeLog for details)
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 #include <config.h>
00021 
00022 #include <stdio.h>
00023 #include <string.h>
00024 
00025 #include "gschem.h"
00026 
00027 #ifdef HAVE_LIBDMALLOC
00028 #include <dmalloc.h>
00029 #endif
00030 
00031 
00037 void o_copy_start(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
00038 {
00039   TOPLEVEL *toplevel = w_current->toplevel;
00040   GList *s_current;
00041 
00042   /* Copy the objects into the buffer at their current position,
00043    * with future motion relative to the mouse origin, (w_x, w_y). */
00044 
00045   w_current->first_wx = w_x;
00046   w_current->first_wy = w_y;
00047 
00048   if (!o_select_selected (w_current))
00049     return;
00050 
00051   s_current = geda_list_get_glist( toplevel->page_current->selection_list );
00052 
00053   if (toplevel->page_current->place_list != NULL) {
00054     s_delete_object_glist(toplevel, toplevel->page_current->place_list);
00055     toplevel->page_current->place_list = NULL;
00056   }
00057 
00058   toplevel->page_current->place_list =
00059     o_glist_copy_all (toplevel, s_current,
00060                       toplevel->page_current->place_list);
00061 
00062   w_current->inside_action = 1;
00063   i_set_state(w_current, COPY);
00064   o_place_start (w_current, w_x, w_y);
00065 }
00066 
00072 void o_copy_end(GSCHEM_TOPLEVEL *w_current)
00073 {
00074   o_place_end (w_current, w_current->second_wx, w_current->second_wy, FALSE,
00075                NULL, "%paste-objects-hook");
00076 }
00077 
00078 
00084 void o_copy_multiple_end(GSCHEM_TOPLEVEL *w_current)
00085 {
00086   o_place_end (w_current, w_current->second_wx, w_current->second_wy, TRUE,
00087                NULL, "%paste-objects-hook");
00088 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines