Index: trunk/src/conf_act.c =================================================================== --- trunk/src/conf_act.c (revision 29850) +++ trunk/src/conf_act.c (revision 29851) @@ -43,45 +43,6 @@ return 0; } -static const char pcb_acts_ChkMode[] = "ChkMode(expected_mode)" ; -static const char pcb_acth_ChkMode[] = "Return 1 if the currently selected mode is the expected_mode"; -static fgw_error_t pcb_act_ChkMode(fgw_arg_t *res, int argc, fgw_arg_t *argv) -{ - const char *dst; - pcb_toolid_t id; - - PCB_ACT_CONVARG(1, FGW_STR, ChkMode, dst = argv[1].val.str); - - id = pcb_tool_lookup(dst); - if (id >= 0) { - PCB_ACT_IRES(pcbhl_conf.editor.mode == id); - return 0; - } - PCB_ACT_IRES(-1); - return 0; -} - - -static const char pcb_acts_ChkGridSize[] = - "ChkGridSize(expected_size)\n" - "ChkGridSize(none)\n" - ; -static const char pcb_acth_ChkGridSize[] = "Return 1 if the currently selected grid matches the expected_size. If argument is \"none\" return 1 if there is no grid."; -static fgw_error_t pcb_act_ChkGridSize(fgw_arg_t *res, int argc, fgw_arg_t *argv) -{ - const char *dst; - - PCB_ACT_CONVARG(1, FGW_STR, ChkGridSize, dst = argv[1].val.str); - - if (strcmp(dst, "none") == 0) { - PCB_ACT_IRES(PCB_ACT_HIDLIB->grid <= 300); - return 0; - } - - PCB_ACT_IRES(PCB_ACT_HIDLIB->grid == pcb_get_value_ex(dst, NULL, NULL, NULL, NULL, NULL)); - return 0; -} - static const char pcb_acts_ChkSubcID[] = "ChkSubcID(pattern)\n"; static const char pcb_acth_ChkSubcID[] = "Return 1 if currently shown subc ID matches the requested pattern"; static fgw_error_t pcb_act_ChkSubcID(fgw_arg_t *res, int argc, fgw_arg_t *argv) @@ -110,16 +71,6 @@ return 0; } -static const char pcb_acts_ChkGridUnits[] = "ChkGridUnits(expected)"; -static const char pcb_acth_ChkGridUnits[] = "Return 1 if currently selected grid unit matches the expected (normally mm or mil)"; -static fgw_error_t pcb_act_ChkGridUnits(fgw_arg_t *res, int argc, fgw_arg_t *argv) -{ - const char *expected; - PCB_ACT_CONVARG(1, FGW_STR, ChkGridUnits, expected = argv[1].val.str); - PCB_ACT_IRES(strcmp(pcbhl_conf.editor.grid_unit->suffix, expected) == 0); - return 0; -} - static const char pcb_acts_ChkBuffer[] = "ChkBuffer(idx)"; static const char pcb_acth_ChkBuffer[] = "Return 1 if currently selected buffer's index matches idx"; static fgw_error_t pcb_act_ChkBuffer(fgw_arg_t *res, int argc, fgw_arg_t *argv) @@ -132,11 +83,8 @@ static pcb_action_t conf_action_list[] = { {"GetStyle", pcb_act_GetStyle, pcb_acth_GetStyle, pcb_acts_GetStyle}, - {"ChkMode", pcb_act_ChkMode, pcb_acth_ChkMode, pcb_acts_ChkMode}, - {"ChkGridSize", pcb_act_ChkGridSize, pcb_acth_ChkGridSize, pcb_acts_ChkGridSize}, {"ChkSubcID", pcb_act_ChkSubcID, pcb_acth_ChkSubcID, pcb_acts_ChkSubcID}, {"ChkTermID", pcb_act_ChkTermID, pcb_acth_ChkTermID, pcb_acts_ChkTermID}, - {"ChkGridUnits", pcb_act_ChkGridUnits, pcb_acth_ChkGridUnits, pcb_acts_ChkGridUnits}, {"ChkBuffer", pcb_act_ChkBuffer, pcb_acth_ChkBuffer, pcb_acts_ChkBuffer} }; Index: trunk/src/gui_act.c =================================================================== --- trunk/src/gui_act.c (revision 29850) +++ trunk/src/gui_act.c (revision 29851) @@ -1253,24 +1253,6 @@ return 0; } - -static const char pcb_acts_setunits[] = "SetUnits(mm|mil)"; -static const char pcb_acth_setunits[] = "Set the default measurement units."; -/* DOC: setunits.html */ -static fgw_error_t pcb_act_SetUnits(fgw_arg_t *res, int argc, fgw_arg_t *argv) -{ - const pcb_unit_t *new_unit; - const char *name; - - PCB_ACT_CONVARG(1, FGW_STR, setunits, name = argv[1].val.str); - PCB_ACT_IRES(0); - - new_unit = get_unit_struct(name); - pcb_hidlib_set_unit(PCB_ACT_HIDLIB, new_unit); - - return 0; -} - const char pcb_acts_chkrst[] = "ChkRst(route_style_id)\n"; const char pcb_acth_chkrst[] = "Return 1 if route_style_id matches pen."; /* DOC: chkrst.html */ @@ -1373,7 +1355,6 @@ {"DelGroup", pcb_act_DelGroup, pcb_acth_DelGroup, pcb_acts_DelGroup}, {"DupGroup", pcb_act_DupGroup, pcb_acth_DupGroup, pcb_acts_DupGroup}, {"NewGroup", pcb_act_NewGroup, pcb_acth_NewGroup, pcb_acts_NewGroup}, - {"SetUnits", pcb_act_SetUnits, pcb_acth_setunits, pcb_acts_setunits}, {"ChkRst", pcb_act_ChkRst, pcb_acth_chkrst, pcb_acts_chkrst}, {"BoardFlip", pcb_act_boardflip, pcb_acth_boardflip, pcb_acts_boardflip}, {"ClipInhibit", pcb_act_ClipInhibit, pcb_acth_ClipInhibit, pcb_acts_ClipInhibit} Index: trunk/src/librnd/core/conf_act.c =================================================================== --- trunk/src/librnd/core/conf_act.c (revision 29850) +++ trunk/src/librnd/core/conf_act.c (revision 29851) @@ -231,9 +231,80 @@ return 0; } +static const char pcb_acts_ChkMode[] = "ChkMode(expected_mode)" ; +static const char pcb_acth_ChkMode[] = "Return 1 if the currently selected mode is the expected_mode"; +static fgw_error_t pcb_act_ChkMode(fgw_arg_t *res, int argc, fgw_arg_t *argv) +{ + const char *dst; + pcb_toolid_t id; + PCB_ACT_CONVARG(1, FGW_STR, ChkMode, dst = argv[1].val.str); + + id = pcb_tool_lookup(dst); + if (id >= 0) { + PCB_ACT_IRES(pcbhl_conf.editor.mode == id); + return 0; + } + PCB_ACT_IRES(-1); + return 0; +} + + +static const char pcb_acts_ChkGridSize[] = + "ChkGridSize(expected_size)\n" + "ChkGridSize(none)\n" + ; +static const char pcb_acth_ChkGridSize[] = "Return 1 if the currently selected grid matches the expected_size. If argument is \"none\" return 1 if there is no grid."; +static fgw_error_t pcb_act_ChkGridSize(fgw_arg_t *res, int argc, fgw_arg_t *argv) +{ + const char *dst; + + PCB_ACT_CONVARG(1, FGW_STR, ChkGridSize, dst = argv[1].val.str); + + if (strcmp(dst, "none") == 0) { + PCB_ACT_IRES(PCB_ACT_HIDLIB->grid <= 300); + return 0; + } + + PCB_ACT_IRES(PCB_ACT_HIDLIB->grid == pcb_get_value_ex(dst, NULL, NULL, NULL, NULL, NULL)); + return 0; +} + + +static const char pcb_acts_ChkGridUnits[] = "ChkGridUnits(expected)"; +static const char pcb_acth_ChkGridUnits[] = "Return 1 if currently selected grid unit matches the expected (normally mm or mil)"; +static fgw_error_t pcb_act_ChkGridUnits(fgw_arg_t *res, int argc, fgw_arg_t *argv) +{ + const char *expected; + PCB_ACT_CONVARG(1, FGW_STR, ChkGridUnits, expected = argv[1].val.str); + PCB_ACT_IRES(strcmp(pcbhl_conf.editor.grid_unit->suffix, expected) == 0); + return 0; +} + +static const char pcb_acts_setunits[] = "SetUnits(mm|mil)"; +static const char pcb_acth_setunits[] = "Set the default measurement units."; +/* DOC: setunits.html */ +static fgw_error_t pcb_act_SetUnits(fgw_arg_t *res, int argc, fgw_arg_t *argv) +{ + const pcb_unit_t *new_unit; + const char *name; + + PCB_ACT_CONVARG(1, FGW_STR, setunits, name = argv[1].val.str); + PCB_ACT_IRES(0); + + new_unit = get_unit_struct(name); + pcb_hidlib_set_unit(PCB_ACT_HIDLIB, new_unit); + + return 0; +} + + static pcb_action_t rnd_conf_action_list[] = { {"conf", pcb_act_Conf, pcb_acth_Conf, pcb_acts_Conf}, + {"ChkMode", pcb_act_ChkMode, pcb_acth_ChkMode, pcb_acts_ChkMode}, + {"ChkGridSize", pcb_act_ChkGridSize, pcb_acth_ChkGridSize, pcb_acts_ChkGridSize}, + {"ChkGridUnits", pcb_act_ChkGridUnits, pcb_acth_ChkGridUnits, pcb_acts_ChkGridUnits}, + {"SetUnits", pcb_act_SetUnits, pcb_acth_setunits, pcb_acts_setunits} }; void rnd_conf_act_init2(void) Index: trunk/src/pixmap_pcb.c =================================================================== --- trunk/src/pixmap_pcb.c (revision 29850) +++ trunk/src/pixmap_pcb.c (revision 29851) @@ -107,7 +107,7 @@ for(n = 0; n < len; n += 3) { pm->p[n+0] = pm->tr; pm->p[n+1] = pm->tg; - pm->p[n+2] = pm->tb; + pm->p[n+2] = pm->tb+1; } ip = ipm->p;