Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 1087) +++ trunk/src/Makefile.in (revision 1088) @@ -56,6 +56,7 @@ rats_act.o rats_patch.o remove.o + remove_act.o report.o rotate.o rtree.o @@ -98,7 +99,8 @@ # main: action registrations put /local/pcb/ACTION_REG_SRC { action.c buffer.c change_act.c command.c file_act.c flags.c gui_act.c - import_sch.c main.c misc.c move.c netlist.c plugins.c report.c rats_act.c + import_sch.c main.c misc.c move.c netlist.c plugins.c rats_act.c + remove_act.c report.c select_act.c undo_act.c } Index: trunk/src/action.c =================================================================== --- trunk/src/action.c (revision 1087) +++ trunk/src/action.c (revision 1088) @@ -1944,52 +1944,6 @@ /* --------------------------------------------------------------------------- */ -static const char delete_syntax[] = "Delete(Object|Selected)\n" "Delete(AllRats|SelectedRats)"; - -static const char delete_help[] = "Delete stuff."; - -/* %start-doc actions Delete - -%end-doc */ - -static int ActionDelete(int argc, char **argv, Coord x, Coord y) -{ - char *function = ARG(0); - int id = GetFunctionID(function); - - Note.X = Crosshair.X; - Note.Y = Crosshair.Y; - - if (id == -1) { /* no arg */ - if (RemoveSelected() == false) - id = F_Object; - } - - switch (id) { - case F_Object: - SaveMode(); - SetMode(REMOVE_MODE); - NotifyMode(); - RestoreMode(); - break; - case F_Selected: - RemoveSelected(); - break; - case F_AllRats: - if (DeleteRats(false)) - SetChangedFlag(true); - break; - case F_SelectedRats: - if (DeleteRats(true)) - SetChangedFlag(true); - break; - } - - return 0; -} - -/* --------------------------------------------------------------------------- */ - static const char markcrosshair_syntax[] = "MarkCrosshair()\n" "MarkCrosshair(Center)"; static const char markcrosshair_help[] = "Set/Reset the Crosshair mark."; @@ -2803,23 +2757,6 @@ /* --------------------------------------------------------------------------- */ -static const char removeselected_syntax[] = "RemoveSelected()"; - -static const char removeselected_help[] = "Removes any selected objects."; - -/* %start-doc actions RemoveSelected - -%end-doc */ - -static int ActionRemoveSelected(int argc, char **argv, Coord x, Coord y) -{ - if (RemoveSelected()) - SetChangedFlag(true); - return 0; -} - -/* --------------------------------------------------------------------------- */ - static ElementType *element_cache = NULL; static ElementType *find_element_by_refdes(char *refdes) @@ -3295,9 +3232,6 @@ {"Attributes", 0, ActionAttributes, attributes_help, attributes_syntax} , - {"Delete", 0, ActionDelete, - delete_help, delete_syntax} - , {"DisperseElements", 0, ActionDisperseElements, disperseelements_help, disperseelements_syntax} , @@ -3328,9 +3262,6 @@ {"PasteBuffer", 0, ActionPasteBuffer, pastebuffer_help, pastebuffer_syntax} , - {"RemoveSelected", 0, ActionRemoveSelected, - removeselected_help, removeselected_syntax} - , #ifdef BA_TODO {"Renumber", 0, ActionRenumber, renumber_help, renumber_syntax} Index: trunk/src/action_list.h =================================================================== --- trunk/src/action_list.h (revision 1087) +++ trunk/src/action_list.h (revision 1088) @@ -14,6 +14,9 @@ /* select_act.c () */ REGISTER_ACTIONS(select_action_list) +/* remove_act.c () */ +REGISTER_ACTIONS(remove_action_list) + /* file_act.c () */ REGISTER_ACTIONS(file_action_list) Index: trunk/src/remove_act.c =================================================================== --- trunk/src/remove_act.c (nonexistent) +++ trunk/src/remove_act.c (revision 1088) @@ -0,0 +1,108 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton + * + * 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 addresses for paper mail and Email: + * Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA + * haceaton@aplcomm.jhuapl.edu + * + */ +#include "config.h" +#include "global.h" +#include "data.h" +#include "action.h" +#include "change.h" +#include "error.h" +#include "undo.h" + +/* --------------------------------------------------------------------------- */ + +static const char delete_syntax[] = "Delete(Object|Selected)\n" "Delete(AllRats|SelectedRats)"; + +static const char delete_help[] = "Delete stuff."; + +/* %start-doc actions Delete + +%end-doc */ + +static int ActionDelete(int argc, char **argv, Coord x, Coord y) +{ + char *function = ARG(0); + int id = GetFunctionID(function); + + Note.X = Crosshair.X; + Note.Y = Crosshair.Y; + + if (id == -1) { /* no arg */ + if (RemoveSelected() == false) + id = F_Object; + } + + switch (id) { + case F_Object: + SaveMode(); + SetMode(REMOVE_MODE); + NotifyMode(); + RestoreMode(); + break; + case F_Selected: + RemoveSelected(); + break; + case F_AllRats: + if (DeleteRats(false)) + SetChangedFlag(true); + break; + case F_SelectedRats: + if (DeleteRats(true)) + SetChangedFlag(true); + break; + } + + return 0; +} + +/* --------------------------------------------------------------------------- */ + +static const char removeselected_syntax[] = "RemoveSelected()"; + +static const char removeselected_help[] = "Removes any selected objects."; + +/* %start-doc actions RemoveSelected + +%end-doc */ + +static int ActionRemoveSelected(int argc, char **argv, Coord x, Coord y) +{ + if (RemoveSelected()) + SetChangedFlag(true); + return 0; +} + + +HID_Action remove_action_list[] = { + {"Delete", 0, ActionDelete, + delete_help, delete_syntax} + , + {"RemoveSelected", 0, ActionRemoveSelected, + removeselected_help, removeselected_syntax} + , +}; + +REGISTER_ACTIONS(remove_action_list)