Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 4915) +++ trunk/scconfig/Rev.h (revision 4916) @@ -1 +1 @@ -static const int myrev = 4904; +static const int myrev = 4916; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 4915) +++ trunk/scconfig/Rev.tab (revision 4916) @@ -1,3 +1,4 @@ +4616 configure unravel - the big cleanup, moving code 4904 make clean,configure unravel2 - regenerate action registration because regiestrator function name changed 4882 configure unravel2 - the big cleanup, renaming types 4608 configure unravel - the big cleanup, moving code and files Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 4915) +++ trunk/src/Makefile.in (revision 4916) @@ -163,7 +163,7 @@ # main: action registrations put /local/pcb/ACTION_REG_SRC { action_act.c buffer.c change_act.c conf_act.c file_act.c find_act.c - gui_act.c main_act.c move.c netlist_act.c + gui_act.c main_act.c netlist_act.c object_act.c plugins.c polygon_act.c plug_footprint_act.c rats_act.c rats_patch.c remove_act.c select_act.c undo_act.c } Index: trunk/src/move.c =================================================================== --- trunk/src/move.c (revision 4915) +++ trunk/src/move.c (revision 4916) @@ -162,111 +162,3 @@ /* passing pcb_true to above operation causes Undoserial to auto-increment */ return (changed); } - -/* --------------------------------------------------------------------------- */ - -static const char movelayer_syntax[] = "MoveLayer(old,new)"; - -static const char movelayer_help[] = "Moves/Creates/Deletes Layers."; - -/* %start-doc actions MoveLayer - -Moves a layer, creates a new layer, or deletes a layer. - -@table @code - -@item old -The is the layer number to act upon. Allowed values are: -@table @code - -@item c -Currently selected layer. - -@item -1 -Create a new layer. - -@item number -An existing layer number. - -@end table - -@item new -Specifies where to move the layer to. Allowed values are: -@table @code -@item -1 -Deletes the layer. - -@item up -Moves the layer up. - -@item down -Moves the layer down. - -@item c -Creates a new layer. - -@end table - -@end table - -%end-doc */ - -int MoveLayerAction(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) -{ - int old_index, new_index; - int new_top = -1; - - if (argc != 2) { - pcb_message(PCB_MSG_DEFAULT, "Usage; MoveLayer(old,new)"); - return 1; - } - - if (strcmp(argv[0], "c") == 0) - old_index = INDEXOFCURRENT; - else - old_index = atoi(argv[0]); - - if (strcmp(argv[1], "c") == 0) { - new_index = INDEXOFCURRENT; - if (new_index < 0) - new_index = 0; - } - else if (strcmp(argv[1], "up") == 0) { - new_index = INDEXOFCURRENT - 1; - if (new_index < 0) - return 1; - new_top = new_index; - } - else if (strcmp(argv[1], "down") == 0) { - new_index = INDEXOFCURRENT + 1; - if (new_index >= max_copper_layer) - return 1; - new_top = new_index; - } - else - new_index = atoi(argv[1]); - - if (pcb_layer_move(old_index, new_index)) - return 1; - - if (new_index == -1) { - new_top = old_index; - if (new_top >= max_copper_layer) - new_top--; - new_index = new_top; - } - if (old_index == -1) - new_top = new_index; - - if (new_top != -1) - ChangeGroupVisibility(new_index, 1, 1); - - return 0; -} - -pcb_hid_action_t move_action_list[] = { - {"MoveLayer", 0, MoveLayerAction, - movelayer_help, movelayer_syntax} -}; - -PCB_REGISTER_ACTIONS(move_action_list, NULL) Index: trunk/src/object_act.c =================================================================== --- trunk/src/object_act.c (revision 4915) +++ trunk/src/object_act.c (revision 4916) @@ -994,8 +994,108 @@ } +/* --------------------------------------------------------------------------- */ +static const char movelayer_syntax[] = "MoveLayer(old,new)"; +static const char movelayer_help[] = "Moves/Creates/Deletes Layers."; + +/* %start-doc actions MoveLayer + +Moves a layer, creates a new layer, or deletes a layer. + +@table @code + +@item old +The is the layer number to act upon. Allowed values are: +@table @code + +@item c +Currently selected layer. + +@item -1 +Create a new layer. + +@item number +An existing layer number. + +@end table + +@item new +Specifies where to move the layer to. Allowed values are: +@table @code +@item -1 +Deletes the layer. + +@item up +Moves the layer up. + +@item down +Moves the layer down. + +@item c +Creates a new layer. + +@end table + +@end table + +%end-doc */ + +int MoveLayerAction(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) +{ + int old_index, new_index; + int new_top = -1; + + if (argc != 2) { + pcb_message(PCB_MSG_DEFAULT, "Usage; MoveLayer(old,new)"); + return 1; + } + + if (strcmp(argv[0], "c") == 0) + old_index = INDEXOFCURRENT; + else + old_index = atoi(argv[0]); + + if (strcmp(argv[1], "c") == 0) { + new_index = INDEXOFCURRENT; + if (new_index < 0) + new_index = 0; + } + else if (strcmp(argv[1], "up") == 0) { + new_index = INDEXOFCURRENT - 1; + if (new_index < 0) + return 1; + new_top = new_index; + } + else if (strcmp(argv[1], "down") == 0) { + new_index = INDEXOFCURRENT + 1; + if (new_index >= max_copper_layer) + return 1; + new_top = new_index; + } + else + new_index = atoi(argv[1]); + + if (pcb_layer_move(old_index, new_index)) + return 1; + + if (new_index == -1) { + new_top = old_index; + if (new_top >= max_copper_layer) + new_top--; + new_index = new_top; + } + if (old_index == -1) + new_top = new_index; + + if (new_top != -1) + ChangeGroupVisibility(new_index, 1, 1); + + return 0; +} + + pcb_hid_action_t object_action_list[] = { {"Attributes", 0, ActionAttributes, attributes_help, attributes_syntax} @@ -1029,6 +1129,9 @@ , {"MinClearGap", 0, ActionMinClearGap, mincleargap_help, mincleargap_syntax} + , + {"MoveLayer", 0, MoveLayerAction, + movelayer_help, movelayer_syntax} }; PCB_REGISTER_ACTIONS(object_action_list, NULL)