Index: trunk/src/layer_grp.h =================================================================== --- trunk/src/layer_grp.h (revision 16191) +++ trunk/src/layer_grp.h (revision 16192) @@ -49,6 +49,7 @@ unsigned valid:1; /* 1 if it's a new-style, valid layer group; 0 after loading old files with no layer stackup info */ unsigned vis:1; /* 1 if layer group is visible on the GUI */ unsigned open:1; /* 1 if the group is open (expanded) on the GUI */ + unsigned propedit:1; /* temporary: let propedit know this layer is being edited */ /* internal: temporary states */ int intern_id; /* for the old layer import mechanism */ Index: trunk/src/pcb-menu-default.lht =================================================================== --- trunk/src/pcb-menu-default.lht (revision 16191) +++ trunk/src/pcb-menu-default.lht (revision 16192) @@ -700,6 +700,7 @@ ha:group { li:submenu { ha:Group properties... = { action=EditGroup(@) } + ha:Group attributes... = { action={Propedit(layer_group:current)} } ha:Grouping... (layer preferences) = { action=DoWindows(Preferences, 1, "User PoV/Layers") } - ha:Insert new layer = { action={ MoveLayer(-1, gi); EditLayer() } } Index: trunk/src_plugins/propedit/propedit.c =================================================================== --- trunk/src_plugins/propedit/propedit.c (revision 16191) +++ trunk/src_plugins/propedit/propedit.c (revision 16192) @@ -37,6 +37,8 @@ /* ************************************************************ */ +extern pcb_layergrp_id_t pcb_actd_EditGroup_gid; + #warning TODO static const char propedit_syntax[] = "propedit()"; static const char propedit_help[] = "Run the property editor"; @@ -45,7 +47,9 @@ pe_ctx_t ctx; htsp_entry_t *pe; pcb_layer_t *ly = NULL; + pcb_layergrp_t *lg = NULL; pcb_layer_id_t lid; + pcb_layergrp_id_t gid; if ((pcb_gui == NULL) || (pcb_gui->propedit_start == NULL)) { pcb_message(PCB_MSG_ERROR, "Error: there's no GUI or the active GUI can't edit properties.\n"); @@ -52,10 +56,11 @@ return 1; } - ctx.core_props = pcb_props_init(); for(lid = 0; lid < PCB->Data->LayerN; lid++) PCB->Data->Layer[lid].propedit = 0; + for(gid = 0; gid < PCB->LayerGroups.len; gid++) + PCB->LayerGroups.grp[gid].propedit = 0; if (argc > 0) { int n; @@ -76,6 +81,25 @@ } ly->propedit = 1; } + if (strcmp(argv[n], "layer_groups") == 0) { + for(gid = 0; gid < PCB->LayerGroups.len; gid++) + PCB->LayerGroups.grp[gid].propedit = 1; + } + else if (strncmp(argv[n], "layer_group:", 12) == 0) { + const char *id = argv[n]+12; + if (strcmp(id, "current") == 0) { + lg = pcb_get_layergrp(PCB, pcb_actd_EditGroup_gid); + if ((lg == NULL) && (CURRENT != NULL) && (!CURRENT->is_bound)) + lg = pcb_get_layergrp(PCB, CURRENT->meta.real.grp); + } + else + lg = pcb_get_layergrp(PCB, atoi(id)); + if (lg == NULL) { + pcb_message(PCB_MSG_ERROR, "Invalid layer group index %s\n", argv[n]); + goto err; + } + lg->propedit = 1; + } } } Index: trunk/src_plugins/propedit/propsel.c =================================================================== --- trunk/src_plugins/propedit/propsel.c (revision 16191) +++ trunk/src_plugins/propedit/propsel.c (revision 16192) @@ -117,6 +117,16 @@ return 0; } +static int map_layergrp_cb(void *ctx, pcb_board_t *pcb, pcb_layergrp_t *grp) +{ + if (!grp->propedit) + return 0; + + map_add_prop(ctx, "p/layer_group/name", String, grp->name); + map_attr(ctx, &grp->Attributes); + return 0; +} + static void map_line_cb(void *ctx, pcb_board_t *pcb, pcb_layer_t *layer, pcb_line_t *line) { map_chk_skip(ctx, line); @@ -194,6 +204,7 @@ void pcb_propsel_map_core(htsp_t *props) { map_ctx_t ctx; + pcb_layergrp_id_t gid; ctx.props = props; @@ -202,6 +213,8 @@ map_subc_cb, map_pstk_cb ); + for(gid = 0; gid < PCB->LayerGroups.len; gid++) + map_layergrp_cb(&ctx, PCB, &PCB->LayerGroups.grp[gid]); } /*******************/ @@ -258,7 +271,26 @@ pcb_message(PCB_MSG_ERROR, "This property can not be changed from the property editor.\n"); } +static void set_layergrp_cb(void *ctx, pcb_board_t *pcb, pcb_layergrp_t *grp) +{ + set_ctx_t *st = (set_ctx_t *)ctx; + const char *pn = st->name + 14; + if (!grp->propedit) + return; + + if (st->is_attr) { + set_attr(st, &grp->Attributes); + return; + } + + if ((strcmp(pn, "name") == 0) && + (pcb_layergrp_rename_(grp, pcb_strdup(st->value)) == 0)) DONE; + + pcb_message(PCB_MSG_ERROR, "This property can not be changed from the property editor.\n"); +} + + static void set_line_cb(void *ctx, pcb_board_t *pcb, pcb_layer_t *layer, pcb_line_t *line) { set_ctx_t *st = (set_ctx_t *)ctx; @@ -457,6 +489,7 @@ set_ctx_t ctx; char *end; const char *start; + pcb_layergrp_id_t gid; /* sanity checks for invalid props */ if (prop[1] != '/') @@ -493,6 +526,9 @@ MAYBE_PROP(0, "p/padstack/", set_pstk_cb) ); + for(gid = 0; gid < PCB->LayerGroups.len; gid++) + set_layergrp_cb(&ctx, PCB, &PCB->LayerGroups.grp[gid]); + pcb_undo_inc_serial(); return ctx.set_cnt; }