Index: trunk/src_plugins/lib_hid_pcbui/toolbar.c =================================================================== --- trunk/src_plugins/lib_hid_pcbui/toolbar.c (revision 26058) +++ trunk/src_plugins/lib_hid_pcbui/toolbar.c (revision 26059) @@ -27,6 +27,7 @@ #include "config.h" #include +#include #include "hid.h" #include "hid_cfg.h" @@ -75,10 +76,14 @@ pcb_tool_select_by_id(&PCB->hidlib, tid); } -static void toolbar_create_tool(pcb_toolid_t tid, pcb_tool_t *tool) +static void toolbar_create_tool(pcb_toolid_t tid, pcb_tool_t *tool, const char *menufile_help) { int wid; + const char *help = tool->help; + if (menufile_help != NULL) + help = menufile_help; + if (tool->icon != NULL) PCB_DAD_PICBUTTON(toolbar.sub.dlg, tool->icon); else @@ -85,7 +90,8 @@ PCB_DAD_BUTTON(toolbar.sub.dlg, tool->name); PCB_DAD_CHANGE_CB(toolbar.sub.dlg, toolbar_select_cb); PCB_DAD_COMPFLAG(toolbar.sub.dlg, PCB_HATF_TIGHT | PCB_HATF_TOGGLE); - PCB_DAD_HELP(toolbar.sub.dlg, "TODO: tooltip"); + if (help != NULL) + PCB_DAD_HELP(toolbar.sub.dlg, help); wid = PCB_DAD_CURRENT(toolbar.sub.dlg); toolbar.sub.dlg[wid].user_data = (void *)tid; vti0_set(&toolbar.tid2wid, tid, wid); @@ -99,13 +105,23 @@ for(t = ts->data.list.first; t != NULL; t = t->next) { pcb_toolid_t tid = pcb_tool_lookup(t->name); pcb_tool_t **tool; + const char *mf_help; + lht_node_t *nhelp; + lht_err_t err; + tool = (pcb_tool_t **)vtp0_get(&pcb_tools, tid, 0); if ((tid < 0) || (tool == NULL)) { pcb_message(PCB_MSG_ERROR, "toolbar: tool '%s' not found (referenced from the menu file %s:%d)\n", t->name, t->file_name, t->line); continue; } - toolbar_create_tool(tid, *tool); + + nhelp = lht_tree_path_(t->doc, t, "tip", 1, 0, &err); + if ((nhelp != NULL) && (nhelp->type == LHT_TEXT)) + mf_help = nhelp->data.text.value; + else + mf_help = NULL; + toolbar_create_tool(tid, *tool, mf_help); } } else { @@ -124,7 +140,7 @@ continue; /* static or inivisible */ if ((wid != NULL) && (*wid != 0)) continue; /* already has an icon */ - toolbar_create_tool(tid, *t); + toolbar_create_tool(tid, *t, NULL); } }