Index: trunk/src/tool.c =================================================================== --- trunk/src/tool.c (revision 29316) +++ trunk/src/tool.c (revision 29317) @@ -93,7 +93,7 @@ } -int pcb_tool_reg(pcb_tool_t *tool, const char *cookie) +pcb_toolid_t pcb_tool_reg(pcb_tool_t *tool, const char *cookie) { pcb_toolid_t id; if (pcb_tool_lookup(tool->name) != PCB_TOOLID_INVALID) /* don't register two tools with the same name */ @@ -104,7 +104,7 @@ if (pcb_gui != NULL) pcb_gui->reg_mouse_cursor(pcb_gui, id, tool->cursor.name, tool->cursor.pixel, tool->cursor.mask); pcb_event(NULL, PCB_EVENT_TOOL_REG, "p", tool); - return 0; + return id; } void pcb_tool_unreg_by_cookie(const char *cookie) Index: trunk/src/tool.h =================================================================== --- trunk/src/tool.h (revision 29316) +++ trunk/src/tool.h (revision 29317) @@ -98,8 +98,8 @@ void pcb_tool_uninit(); void pcb_tool_uninit_conf(void); /* call this one before hidlib uninit for conf uninit */ -/* Insert a new tool in pcb_tools; returns 0 on success */ -int pcb_tool_reg(pcb_tool_t *tool, const char *cookie); +/* Insert a new tool in pcb_tools; returns -1 on failure */ +pcb_toolid_t pcb_tool_reg(pcb_tool_t *tool, const char *cookie); /* Unregister all tools that has matching cookie */ void pcb_tool_unreg_by_cookie(const char *cookie); Index: trunk/src_plugins/ddraft/ddraft.c =================================================================== --- trunk/src_plugins/ddraft/ddraft.c (revision 29316) +++ trunk/src_plugins/ddraft/ddraft.c (revision 29317) @@ -557,10 +557,8 @@ PCB_REGISTER_ACTIONS(ddraft_action_list, ddraft_cookie) pcb_event_bind(PCB_EVENT_DRAW_CROSSHAIR_CHATT, cnst_enforce, NULL, ddraft_cookie); - pcb_tool_reg(&tool_ddraft, ddraft_cookie); - pcb_ddraft_tool = pcb_tool_lookup(tool_ddraft.name); + pcb_ddraft_tool = pcb_tool_reg(&tool_ddraft, ddraft_cookie); - confid = pcb_conf_hid_reg(ddraft_cookie, NULL); cn = pcb_conf_get_field("editor/all_direction_lines"); pcb_conf_hid_set_cb(cn, confid, &conf_cbs_adl);