Index: trunk/src/action_helper.c =================================================================== --- trunk/src/action_helper.c (revision 16012) +++ trunk/src/action_helper.c (revision 16013) @@ -68,9 +68,6 @@ #include "tool.h" - -/* --------------------------------------------------------------------------- */ - /* %start-doc actions 00delta Many actions take a @code{delta} parameter as the last parameter, Index: trunk/src/data.c =================================================================== --- trunk/src/data.c (revision 16012) +++ trunk/src/data.c (revision 16013) @@ -46,9 +46,6 @@ #include "obj_pstk.h" #include "obj_subc.h" -/* --------------------------------------------------------------------------- - * some shared identifiers - */ int pcb_layer_stack[PCB_MAX_LAYER]; /* determines the layer draw order */ pcb_buffer_t pcb_buffers[PCB_MAX_BUFFER]; /* my buffers */ @@ -151,9 +148,6 @@ pcb_loop_pstk(pcb, ctx, pscb); } -/* --------------------------------------------------------------------------- - * free memory used by data struct - */ void pcb_data_free(pcb_data_t * data) { pcb_layer_t *layer; @@ -191,9 +185,6 @@ memset(data, 0, sizeof(pcb_data_t)); } -/* --------------------------------------------------------------------------- - * returns pcb_true if data area is empty - */ pcb_bool pcb_data_is_empty(pcb_data_t *Data) { pcb_cardinal_t i; Index: trunk/src/find_lookup.c =================================================================== --- trunk/src/find_lookup.c (revision 16012) +++ trunk/src/find_lookup.c (revision 16013) @@ -171,9 +171,6 @@ #include "find_intconn.c" -/* --------------------------------------------------------------------------- - * releases all allocated memory - */ void pcb_layout_lookup_uninit(void) { pcb_cardinal_t i; @@ -190,10 +187,8 @@ RatList.Data = NULL; } -/* --------------------------------------------------------------------------- - * allocates memory for component related stacks ... - * initializes index and sorts it by X1 and X2 - */ +/* allocates memory for component related stacks ... + * initializes index and sorts it by X1 and X2 */ void pcb_layout_lookup_init(void) { pcb_layer_id_t i; @@ -324,10 +319,8 @@ return PCB_R_DIR_NOT_FOUND; } -/* --------------------------------------------------------------------------- - * checks if a padstack is connected to LOs, if it is, the LO is added to - * the appropriate list and the 'used' flag is set - */ +/* checks if a padstack is connected to LOs, if it is, the LO is added to + * the appropriate list and the 'used' flag is set */ static pcb_bool LookupLOConnectionsToPSList(pcb_bool AndRats) { pcb_cardinal_t layer; @@ -387,9 +380,7 @@ return pcb_false; } -/* --------------------------------------------------------------------------- - * find all connections between LO at the current list position and new LOs - */ +/* find all connections between LO at the current list position and new LOs */ static pcb_bool LookupLOConnectionsToLOList(pcb_bool AndRats) { pcb_bool done; @@ -516,10 +507,8 @@ return PCB_R_DIR_NOT_FOUND; } -/* --------------------------------------------------------------------------- - * searches for new PVs and padstacks that are connected to NEW LOs on the list - * This routine updates the position counter of the lists too. - */ +/* searches for new PVs and padstacks that are connected to NEW LOs on the list + * This routine updates the position counter of the lists too. */ static pcb_bool LookupPSConnectionsToLOList(pcb_bool AndRats) { pcb_layer_id_t layer; @@ -655,13 +644,11 @@ return PCB_R_DIR_NOT_FOUND; } -/* --------------------------------------------------------------------------- - * searches all LOs that are connected to the given arc on the given +/* searches all LOs that are connected to the given arc on the given * layergroup. All found connections are added to the list * * the notation that is used is: - * Xij means Xj at arc i - */ + * Xij means Xj at arc i */ static pcb_bool LookupLOConnectionsToArc(pcb_arc_t *Arc, pcb_cardinal_t LayerGroup) { pcb_cardinal_t entry; @@ -761,13 +748,11 @@ return PCB_R_DIR_NOT_FOUND; } -/* --------------------------------------------------------------------------- - * searches all LOs that are connected to the given line on the given +/* searches all LOs that are connected to the given line on the given * layergroup. All found connections are added to the list * * the notation that is used is: - * Xij means Xj at line i - */ + * Xij means Xj at line i */ static pcb_bool LookupLOConnectionsToLine(pcb_line_t *Line, pcb_cardinal_t LayerGroup, pcb_bool PolysTo) { pcb_cardinal_t entry; @@ -859,13 +844,11 @@ return PCB_R_DIR_NOT_FOUND; } -/* --------------------------------------------------------------------------- - * searches all LOs that are connected to the given rat-line on the given +/* searches all LOs that are connected to the given rat-line on the given * layergroup. All found connections are added to the list * * the notation that is used is: - * Xij means Xj at line i - */ + * Xij means Xj at line i */ static pcb_bool LookupLOConnectionsToRatEnd(pcb_point_t *Point, pcb_cardinal_t LayerGroup) { pcb_cardinal_t entry; @@ -935,10 +918,8 @@ } -/* --------------------------------------------------------------------------- - * looks up LOs that are connected to the given polygon - * on the given layergroup. All found connections are added to the list - */ +/* looks up LOs that are connected to the given polygon + * on the given layergroup. All found connections are added to the list */ static pcb_bool LookupLOConnectionsToPolygon(pcb_poly_t *Polygon, pcb_cardinal_t LayerGroup) { pcb_cardinal_t entry; Index: trunk/src/find_misc.c =================================================================== --- trunk/src/find_misc.c (revision 16012) +++ trunk/src/find_misc.c (revision 16013) @@ -31,9 +31,7 @@ static void DrawNewConnections(void); -/* --------------------------------------------------------------------------- - * checks if all lists of new objects are handled - */ +/* checks if all lists of new objects are handled */ static pcb_bool ListsEmpty(pcb_bool AndRats) { pcb_bool empty; @@ -59,9 +57,7 @@ } -/* --------------------------------------------------------------------------- - * loops till no more connections are found - */ +/* loops till no more connections are found */ static pcb_bool DoIt(pcb_bool AndRats, pcb_bool AndDraw) { pcb_bool newone = pcb_false; @@ -83,10 +79,7 @@ return newone; } -/* --------------------------------------------------------------------------- - * draws all new connections which have been found since the - * routine was called the last time - */ +/* draws all new connections which have been found since the routine was called the last time */ static void DrawNewConnections(void) { int i; @@ -194,12 +187,10 @@ } -/* --------------------------------------------------------------------------- - * looks up all connections from the object at the given coordinates +/* looks up all connections from the object at the given coordinates * the TheFlag (normally 'PCB_FLAG_FOUND') is set for all objects found * the objects are re-drawn if AndDraw is pcb_true - * also the action is marked as undoable if AndDraw is pcb_true - */ + * also the action is marked as undoable if AndDraw is pcb_true */ void pcb_lookup_conn(pcb_coord_t X, pcb_coord_t Y, pcb_bool AndDraw, pcb_coord_t Range, int which_flag) { void *ptr1, *ptr2, *ptr3; @@ -306,10 +297,7 @@ } -/* --------------------------------------------------------------------------- - * find connections for rats nesting - * assumes pcb_conn_lookup_init() has already been done - */ +/* find connections for rats nesting assumes pcb_conn_lookup_init() has already been done */ void pcb_rat_find_hook(pcb_any_obj_t *obj, pcb_bool undo, pcb_bool AndRats) { User = undo; @@ -321,9 +309,7 @@ static pcb_bool pcb_reset_found_subc(pcb_subc_t *subc, pcb_bool AndDraw); -/* --------------------------------------------------------------------------- - * resets all used flags of pins and vias - */ +/* resets all used flags of pins and vias */ static pcb_bool pcb_reset_found_pins_vias_pads_(pcb_data_t *data, pcb_bool AndDraw) { pcb_bool change = pcb_false; @@ -360,9 +346,7 @@ return change; } -/* --------------------------------------------------------------------------- - * resets all used flags of LOs - */ +/* resets all used flags of LOs */ static pcb_bool pcb_reset_found_lines_polys_(pcb_data_t *data, pcb_bool AndDraw) { pcb_bool change = pcb_false; @@ -450,9 +434,7 @@ } -/* --------------------------------------------------------------------------- - * resets all found connections - */ +/* resets all found connections */ pcb_bool pcb_reset_conns(pcb_bool AndDraw) { pcb_bool change = pcb_false; Index: trunk/src/grid.c =================================================================== --- trunk/src/grid.c (revision 16012) +++ trunk/src/grid.c (revision 16013) @@ -38,6 +38,8 @@ #include "unit.h" #include "grid.h" #include "board.h" +#include "conf.h" +#include "conf_core.h" #include "compat_misc.h" #include "misc_util.h" #include "pcb_bool.h" @@ -171,3 +173,33 @@ free(dst->name); dst->name = NULL; } + +pcb_bool_t pcb_grid_list_step(int stp) +{ + const conf_listitem_t *li; + pcb_grid_t g; + int max = conflist_length((conflist_t *)&conf_core.editor.grids); + int dst = conf_core.editor.grids_idx + stp; + + if (dst < 0) + dst = 0; + if (dst >= max) + dst = max - 1; + if (dst < 0) + return; + + conf_setf(CFR_DESIGN, "editor/grids_idx", -1, "%d", dst); + + li = conflist_nth((conflist_t *)&conf_core.editor.grids, dst); + /* clamp */ + if (li == NULL) + return pcb_false; + + if (!pcb_grid_parse(&g, li->payload)) + return pcb_false; + pcb_grid_set(PCB, &g); + pcb_grid_free(&g); + + + return pcb_true; +} Index: trunk/src/grid.h =================================================================== --- trunk/src/grid.h (revision 16012) +++ trunk/src/grid.h (revision 16013) @@ -63,4 +63,8 @@ /* Apply grid settings from src to the pcb */ void pcb_grid_set(pcb_board_t *pcb, const pcb_grid_t *src); +/* Step stp steps (can be 0) on the grids list and set the resulting grid */ +pcb_bool_t pcb_grid_list_step(int stp); + + #endif Index: trunk/src/gui_act.c =================================================================== --- trunk/src/gui_act.c (revision 16012) +++ trunk/src/gui_act.c (revision 16013) @@ -1663,12 +1663,10 @@ pcb_grid_set(PCB, &dst); pcb_grid_free(&dst); } - else if ((strcmp(argv[0], "up") == 0) || (strcmp(argv[0], "+") == 0)) { - - } - else if ((strcmp(argv[0], "down") == 0) || (strcmp(argv[0], "-") == 0)) { - - } + else if ((strcmp(argv[0], "up") == 0) || (strcmp(argv[0], "+") == 0)) + pcb_grid_list_step(+1); + else if ((strcmp(argv[0], "down") == 0) || (strcmp(argv[0], "-") == 0)) + pcb_grid_list_step(-1); else PCB_ACT_FAIL(grid); Index: trunk/src/obj_common.c =================================================================== --- trunk/src/obj_common.c (revision 16012) +++ trunk/src/obj_common.c (revision 16013) @@ -98,9 +98,6 @@ pcb_bool pcb_create_being_lenient = pcb_false; -/* --------------------------------------------------------------------------- - * Set the lenience mode. - */ void pcb_create_be_lenient(pcb_bool v) { pcb_create_being_lenient = v; Index: trunk/src/obj_text.c =================================================================== --- trunk/src/obj_text.c (revision 16012) +++ trunk/src/obj_text.c (revision 16013) @@ -780,9 +780,7 @@ } -/* --------------------------------------------------------------------------- - * lowlevel drawing routine for text objects - */ +/* lowlevel drawing routine for text objects */ static void DrawTextLowLevel_(pcb_text_t *Text, pcb_coord_t min_line_width, int xordraw, pcb_coord_t xordx, pcb_coord_t xordy) { pcb_coord_t x = 0; Index: trunk/src/rats_patch.c =================================================================== --- trunk/src/rats_patch.c (revision 16012) +++ trunk/src/rats_patch.c (revision 16013) @@ -378,7 +378,6 @@ } -/* ---------------------------------------------------------------- */ static const char pcb_acts_ReplaceFootprint[] = "ReplaceFootprint()\n"; static const char pcb_acth_ReplaceFootprint[] = "Replace the footprint of the selected components with the footprint specified.";