Index: trunk/src_plugins/propedit/propedit.c =================================================================== --- trunk/src_plugins/propedit/propedit.c (revision 31103) +++ trunk/src_plugins/propedit/propedit.c (revision 31104) @@ -205,7 +205,7 @@ static const char pcb_acth_proptoggle[] = "Toggle the named property of scope or all selected objects, assuming the property is boolean. Scope is documented at PropEdit()."; fgw_error_t pcb_act_proptoggle(fgw_arg_t *res, int argc, fgw_arg_t *argv) { - const char *first, *name; + const char *first, *name, *create = NULL; pcb_propedit_t ctx; pcb_props_init(&ctx, PCB); @@ -213,13 +213,15 @@ RND_ACT_CONVARG(1, FGW_STR, proptoggle, first = argv[1].val.str); if (prop_scope_add(&ctx, first, 1) == 0) { RND_ACT_CONVARG(2, FGW_STR, proptoggle, name = argv[2].val.str); + RND_ACT_MAY_CONVARG(3, FGW_STR, proptoggle, create = argv[3].val.str); } else { name = first; + RND_ACT_MAY_CONVARG(2, FGW_STR, proptoggle, create = argv[2].val.str); ctx.selection = 1; } - RND_ACT_IRES(pcb_propsel_toggle(&ctx, name)); + RND_ACT_IRES(pcb_propsel_toggle(&ctx, name, rnd_istrue(create))); prop_scope_finish(&ctx); pcb_props_uninit(&ctx); Index: trunk/src_plugins/propedit/propsel.c =================================================================== --- trunk/src_plugins/propedit/propsel.c (revision 31103) +++ trunk/src_plugins/propedit/propsel.c (revision 31104) @@ -356,8 +356,14 @@ const char *orig = rnd_attribute_get(list, key); if (st->toggle) { - if (orig == NULL) /* do not create non-existing attributes */ + if (orig == NULL) { + if (st->toggle_create) { + rnd_attribute_put(list, key, "true"); + st->set_cnt++; + } + /* else do not create non-existing attributes */ return; + } if (rnd_istrue(orig)) { rnd_attribute_put(list, key, "false"); st->set_cnt++; @@ -975,7 +981,7 @@ return pcb_propsel_set(ctx, prop, &sctx); } -int pcb_propsel_toggle(pcb_propedit_t *ctx, const char *prop) +int pcb_propsel_toggle(pcb_propedit_t *ctx, const char *prop, rnd_bool create) { pcb_propset_ctx_t sctx; @@ -988,6 +994,7 @@ memset(&sctx, 0, sizeof(sctx)); sctx.toggle = 1; + sctx.toggle_create = create; sctx.set_cnt = 0; return pcb_propsel_set(ctx, prop, &sctx); Index: trunk/src_plugins/propedit/propsel.h =================================================================== --- trunk/src_plugins/propedit/propsel.h (revision 31103) +++ trunk/src_plugins/propedit/propsel.h (revision 31104) @@ -33,7 +33,8 @@ double d; rnd_color_t color; rnd_bool c_absolute, d_absolute, c_valid, d_valid, clr_valid; - unsigned toggle:1; /* when 1, ignore value and attempt to toggle */ + unsigned toggle:1; /* when 1, ignore value and attempt to toggle */ + unsigned toggle_create:1; /* when 1, create non-existing attribute on toggle, with value true */ /* private */ unsigned is_trace:1; @@ -47,7 +48,7 @@ int pcb_propsel_set_str(pcb_propedit_t *ctx, const char *prop, const char *value); int pcb_propsel_set(pcb_propedit_t *ctx, const char *prop, pcb_propset_ctx_t *sctx); -int pcb_propsel_toggle(pcb_propedit_t *ctx, const char *prop); +int pcb_propsel_toggle(pcb_propedit_t *ctx, const char *prop, rnd_bool create); int pcb_propsel_del(pcb_propedit_t *ctx, const char *attr_name); /* Allocate new string and print the value using current unit */