Index: excitation.c =================================================================== --- excitation.c (revision 24596) +++ excitation.c (revision 24597) @@ -26,7 +26,54 @@ #include "config.h" +#include "hid_dad.h" + static const char *pcb_openems_excitation_get(pcb_board_t *pcb) { return "DUMMY_EXCITATION"; } + +typedef struct{ + PCB_DAD_DECL_NOINIT(dlg) + int active; /* already open - allow only one instance */ +} exc_ctx_t; + +exc_ctx_t exc_ctx; + +static void exc_close_cb(void *caller_data, pcb_hid_attr_ev_t ev) +{ + exc_ctx_t *ctx = caller_data; + PCB_DAD_FREE(ctx->dlg); + memset(ctx, 0, sizeof(exc_ctx_t)); /* reset all states to the initial - includes ctx->active = 0; */ +} + +static void pcb_dlg_exc(void) +{ + pcb_hid_dad_buttons_t clbtn[] = {{"Close", 0}, {NULL, 0}}; + if (exc_ctx.active) + return; /* do not open another */ + + PCB_DAD_BEGIN_VBOX(exc_ctx.dlg); + PCB_DAD_COMPFLAG(exc_ctx.dlg, PCB_HATF_EXPFILL); + PCB_DAD_LABEL(exc_ctx.dlg, "foo"); + PCB_DAD_BUTTON_CLOSES(exc_ctx.dlg, clbtn); + PCB_DAD_END(exc_ctx.dlg); + + /* set up the context */ + exc_ctx.active = 1; + + PCB_DAD_NEW("openems_excitation", exc_ctx.dlg, "openems: excitation", &exc_ctx, pcb_false, exc_close_cb); +} + +static const char pcb_acts_OpenemsExcitation[] = + "OpenemsExcitation()\n" + "OpenemsExcitation(select, excitationname)\n" + "OpenemsExcitation(set, paramname, paramval)\n" + "OpenemsExcitation(get, paramname)\n" + ; + +static const char pcb_acth_OpenemsExcitation[] = "Select which openEMS excitation method should be exported and manipulate the associated parameters. When invoked without arguments a dialog box with the same functionality is presented."; +static fgw_error_t pcb_act_OpenemsExcitation(fgw_arg_t *res, int argc, fgw_arg_t *argv) +{ + return 0; +} Index: export_openems.c =================================================================== --- export_openems.c (revision 24596) +++ export_openems.c (revision 24597) @@ -822,7 +822,8 @@ } static pcb_action_t openems_action_list[] = { - {"mesh", pcb_act_mesh, pcb_acth_mesh, pcb_acts_mesh} + {"mesh", pcb_act_mesh, pcb_acth_mesh, pcb_acts_mesh}, + {"OpenemsExcitation", pcb_act_OpenemsExcitation, pcb_acth_OpenemsExcitation, pcb_acts_OpenemsExcitation} }; PCB_REGISTER_ACTIONS(openems_action_list, openems_cookie)