Index: order.h =================================================================== --- order.h (revision 36885) +++ order.h (revision 36886) @@ -35,13 +35,16 @@ typedef struct pcb_order_field_s pcb_order_field_t; -typedef struct{ +typedef struct order_ctx_s order_ctx_t; + +struct order_ctx_s { RND_DAD_DECL_NOINIT(dlg) int active; /* already open - allow only one instance */ vtp0_t names; int wtab; /* widgets */ void *odata; /* implementation-specific data of the current order */ -} order_ctx_t; + void (*field_change_cb)(order_ctx_t *octx, pcb_order_field_t *f) /* called after a field has been changed from the GUI */ +}; /* order implementation - registered by an order plugin */ typedef struct pcb_order_imp_s pcb_order_imp_t; Index: order_dlg.c =================================================================== --- order_dlg.c (revision 36885) +++ order_dlg.c (revision 36886) @@ -74,6 +74,12 @@ return imp->wid2field(imp, octx, wid); } +static void cb_notify(order_ctx_t *octx, pcb_order_field_t *f) +{ + if (octx->field_change_cb != NULL) + octx->field_change_cb(octx, f); +} + static void pcb_order_enum_chg_cb(void *hid_ctx, void *caller_data, rnd_hid_attribute_t *attr_btn) { order_ctx_t *octx = caller_data; @@ -83,6 +89,7 @@ return; } f->val.lng = attr_btn->val.lng; + cb_notify(octx, f); } static void pcb_order_int_chg_cb(void *hid_ctx, void *caller_data, rnd_hid_attribute_t *attr_btn) @@ -94,6 +101,7 @@ return; } f->val.lng = attr_btn->val.lng; + cb_notify(octx, f); } static void pcb_order_coord_chg_cb(void *hid_ctx, void *caller_data, rnd_hid_attribute_t *attr_btn) @@ -105,6 +113,7 @@ return; } f->val.crd = attr_btn->val.crd; + cb_notify(octx, f); } static void pcb_order_str_chg_cb(void *hid_ctx, void *caller_data, rnd_hid_attribute_t *attr_btn) @@ -117,6 +126,7 @@ } free(f->val.str); f->val.str = rnd_strdup(attr_btn->val.str); + cb_notify(octx, f); }