Index: trunk/src/conf.c =================================================================== --- trunk/src/conf.c (revision 2258) +++ trunk/src/conf.c (revision 2259) @@ -1385,6 +1385,16 @@ return conf_lht_dirty[target]; } +conf_role_t conf_lookup_role(const lht_node_t *nd) +{ + conf_role_t r; + for(r = 0; r < CFR_max_real; r++) + if (conf_root[r] == nd->doc) + return r; + + return CFR_invalid; +} + void conf_reset(conf_role_t target, const char *source_fn) { if (conf_root[target] != NULL) Index: trunk/src/conf.h =================================================================== --- trunk/src/conf.h (revision 2258) +++ trunk/src/conf.h (revision 2259) @@ -308,5 +308,9 @@ /* Print usage help for all nodes that have the CFF_USAGE flag and whose path starts with prefix (if prefix != NULL) */ void conf_usage(char *prefix, void (*print)(const char *name, const char *help)); + +/* Determine under which role a node is */ +conf_role_t conf_lookup_role(const lht_node_t *nd); + #endif Index: trunk/src/event.h =================================================================== --- trunk/src/event.h (revision 2258) +++ trunk/src/event.h (revision 2259) @@ -5,6 +5,8 @@ EVENT_CLI_ENTER, /* the user pressed enter on a CLI command - called before parsing the line for actions; args: (str commandline) */ EVENT_SAVE_PRE, /* called before saving the design */ EVENT_SAVE_POST, /* called after saving the design */ + EVENT_LOAD_PRE, /* called before loading a new design */ + EVENT_LOAD_POST, /* called after loading a new design, whether it was succesful or not */ EVENT_last /* not a real event */ } event_id_t; Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 2258) +++ trunk/src/plug_io.c (revision 2259) @@ -139,11 +139,18 @@ int ParsePCB(PCBTypePtr Ptr, char *Filename, int load_settings) { int res = -1; + + if (load_settings) + event(EVENT_LOAD_PRE, "s", Filename); + HOOK_CALL(plug_io_t, plug_io_chain, parse_pcb, res, == 0, Ptr, Filename, load_settings); if ((res == 0) && (load_settings)) conf_load_project(NULL, Filename); + if (load_settings) + event(EVENT_LOAD_POST, "si", Filename, res); + plug_io_err(res, "load pcb", Filename); return res; } @@ -240,7 +247,7 @@ if (p != NULL) { event(EVENT_SAVE_PRE, "s", fmt); res = p->write_pcb(p, f); - event(EVENT_SAVE_POST, "s", fmt); + event(EVENT_SAVE_POST, "si", fmt, res); } plug_io_err(res, "write pcb", NULL); return res;