Index: hidlib-menu.lht =================================================================== --- hidlib-menu.lht (nonexistent) +++ hidlib-menu.lht (revision 25573) @@ -0,0 +1,58 @@ +ha:{ + li:mouse { + li:left { + li:press = { Mode(Notify) } + li:press-shift = { Mode(Notify) } + li:press-ctrl = { Mode(Notify) } + li:release = { Mode(Release) } + li:release-shift = { Mode(Release) } + li:release-ctrl = { Mode(Release) } + } + li:middle { + li:press = { Pan(1) } + li:release = { Pan(0) } + } + li:right { + li:press = { Mode(Stroke) } + li:release = { Mode(Release); Popup(popup-obj, obj-type) } + li:shift-release = { Popup(popup-obj-misc) } + li:press-ctrl = { Display(CycleCrosshair) } + } + li:scroll-up { + li:press = { Zoom(0.8) } + li:press-shift = { Scroll(up) } + li:press-ctrl = { Scroll(left) } + } + li:scroll-down { + li:press = { Zoom(1.25) } + li:press-shift = { Scroll(down) } + li:press-ctrl = { Scroll(right) } + } + } + + # List of tool names for the toolbar. + # Do not specify keys here, they are specified in the menu; the GUI will + # not pick up keys from this subtree. There's also no action here: the + # plugin handling this subtree will always pick the tool. + li:toolbar_static { + ha:via {tip={place a via on the board}} + ha:line {tip={draw a line segment (trace) on the board}} + ha:arrow {tip={switch to arrow mode}} + } + + li:main_menu { + ### File Menu + ha:File { + li:submenu { + ha:New = { li:a={{f;n}; {Ctrln};}; action=New() } + ha:Quit = { a={f;q}; action=Quit() } + } + } + ha:Help { + li:submenu { + ha:About = { action=About() } + } + } + } + +} # root Index: main.c =================================================================== --- main.c (revision 25572) +++ main.c (revision 25573) @@ -10,6 +10,8 @@ const char *pcb_hidlib_default_embedded_menu = ""; const char *conf_internal = ""; +const char *pcbhl_menu_file_paths[] = { "./", "~/.hidlib/", NULL }; +const char *pcbhl_menu_name_fmt = "hidlib-menu.lht"; void pcb_tool_gui_init(void) { @@ -86,10 +88,25 @@ design_t design; -int main() +int main(int argc, char *argv[]) { + const char *gui_name = "gtk2_gdk"; + + design.hidlib.size_x = PCB_MM_TO_COORD(100); + design.hidlib.size_y = PCB_MM_TO_COORD(100); + pcb_hidlib_init1(conf_core_init); pcb_hidlib_init2(pup_buildins); - pcb_gui = pcb_hid_find_gui("hid_gtk2_gdk"); + pcb_gui = pcb_hid_find_gui(gui_name); + if (pcb_gui == NULL) { + pcb_message(PCB_MSG_ERROR, "can't find HID '%s'\n", gui_name); + pcbhl_log_print_uninit_errs(""); + exit(1); + } + if (pcb_gui->parse_arguments(&argc, &argv) != 0) { + pcb_message(PCB_MSG_ERROR, "can't init HID '%s'\n", gui_name); + pcbhl_log_print_uninit_errs(""); + exit(1); + } pcb_gui->do_export(&design.hidlib, 0); }