Index: dlg_library.c =================================================================== --- dlg_library.c (revision 36175) +++ dlg_library.c (revision 36176) @@ -58,12 +58,13 @@ #define MAX_PARAMS 128 typedef struct library_ctx_s library_ctx_t; +typedef pcb_fplibrary_t library_ent_t; typedef struct { int pactive; /* already open - allow only one instance */ int pwdesc; RND_DAD_DECL_NOINIT(pdlg) - pcb_fplibrary_t *last_l; + library_ent_t *last_l; char *example, *help_params; htsi_t param_names; /* param_name -> param_idx */ int pwid[MAX_PARAMS]; /* param_idx -> widget_idx (for the input field widget) */ @@ -257,6 +258,8 @@ rnd_gui->attr_dlg_set_value(ctx->dlg_hid_ctx, ctx->wfilt, &hv); } +static const char *library_get_ent_name(library_ent_t *e) { return e->name; } + #include "dlg_library_param.c" static void library_close_cb(void *caller_data, rnd_hid_attr_ev_t ev) Index: dlg_library_param.c =================================================================== --- dlg_library_param.c (revision 36175) +++ dlg_library_param.c (revision 36176) @@ -177,7 +177,7 @@ post_append(); \ } while(0) -static int library_param_build(library_param_ctx_t *ctx, pcb_fplibrary_t *l, FILE *f) +static int library_param_build(library_param_ctx_t *ctx, library_ent_t *l, FILE *f) { char line[1024]; char *name = NULL, *help = NULL, *help_def = NULL; @@ -292,7 +292,7 @@ memset(&sres, 0, sizeof(sres)); - gds_append_str(&sres, ctx->last_l->name); + gds_append_str(&sres, library_get_ent_name(ctx->last_l)); /* cut original name at "(" */ tmp = strchr(sres.array, '('); @@ -472,7 +472,7 @@ free(parahlp); } -int pcb_library_param_fillin(library_param_ctx_t *ctx, pcb_fplibrary_t *l, const char *filter_txt) +int pcb_library_param_fillin(library_param_ctx_t *ctx, library_ent_t *l, const char *filter_txt) { rnd_hid_attr_val_t hv; @@ -479,12 +479,12 @@ if (filter_txt != NULL) { char *sep; int len; - sep = strchr(l->name, '('); + sep = strchr(library_get_ent_name(l), '('); if (sep != NULL) - len = sep - l->name; + len = sep - library_get_ent_name(l); else - len = strlen(l->name); - if (strncmp(filter_txt, l->name, len) != 0) { + len = strlen(library_get_ent_name(l)); + if (strncmp(filter_txt, library_get_ent_name(l), len) != 0) { /* clicked away from the previous parametric, but the filter text is still for that one; replace it */ filter_txt = NULL; } @@ -512,7 +512,7 @@ /* do not load parameters from the comamnd of a differently named footprint to avoid invalid mixing of similar named parameters; in that case rather fill in the dialog with the example */ - for(n1 = filter_txt, n2 = l->name;; n1++, n2++) { + for(n1 = filter_txt, n2 = library_get_ent_name(l);; n1++, n2++) { if (*n1 != *n2) { prm = ctx->example; if (prm == NULL) @@ -536,7 +536,7 @@ return 0; } -static int library_param_open(library_param_ctx_t *ctx, pcb_fplibrary_t *l, FILE *f) +static int library_param_open(library_param_ctx_t *ctx, library_ent_t *l, FILE *f) { rnd_hid_dad_buttons_t clbtn[] = {{"Close", 0}, {NULL, 0}}; int w, oversized = 0; @@ -558,7 +558,7 @@ return oversized; } -static FILE *library_param_get_help(library_param_ctx_t *ctx, pcb_fplibrary_t *l) +static FILE *library_param_get_help(library_param_ctx_t *ctx, library_ent_t *l) { FILE *f; char *cmd; @@ -584,7 +584,7 @@ return f; } -static void library_param_dialog(library_param_ctx_t *ctx, pcb_fplibrary_t *l, const char *filter_txt) +static void library_param_dialog(library_param_ctx_t *ctx, library_ent_t *l, const char *filter_txt) { FILE *f;