2009/12/31 Alex Leone <acleone@...400...>:
The only problem with the current implementation is that it isn't possible to pass temporary data. All that needs to be added to the current code is to free the pdata pointer if it isn't null:
- To trigger an action that passes data to the listeners:
void *pdata = malloc(sizeof(data_struct)); data_struct *d = (data_struct *)pdata; data_struct->x0 = 4.0; data_struct->y0 = 5.5; sp_perform_action(ACTION_EXPORT_AREA, pdata);
This is very, very ugly. Verbs are not intended as a way to expose the internal API, and as such they aren't intended to take parameters. You should just remove the verb call, modify the function that resizes the page to take the extra margin parameters, and call it directly from the button callback. Don't forget to call sp_document_done() to add an undo stack entry.
Regards, Krzysztof