Index: Makefile =================================================================== --- Makefile (nonexistent) +++ Makefile (revision 32980) @@ -0,0 +1,5 @@ +all: + +test: + @./test_patch.sh 'MenuPatch(load, test, "insert.lht");' > insert.out + @diff insert.ref insert.out \ No newline at end of file Index: insert.lht =================================================================== --- insert.lht (nonexistent) +++ insert.lht (revision 32980) @@ -0,0 +1,17 @@ +ha:rnd-menu-v1 { + li:main_menu { + ha:File = { + li:submenu { + ha:hello = { checked=foo; action=bar } + } + } + } + + li:anchored { + ha:@testanchor { + li:submenu { + ha:hallo = { action=foobar() } + } + } + } +} \ No newline at end of file Index: insert.ref =================================================================== --- insert.ref (nonexistent) +++ insert.ref (revision 32980) @@ -0,0 +1,11 @@ + END ++ ha:hello { ++ checked = foo ++ action = {bar } ++ } + } + @testanchor ++ ha:hallo { ++ action = {foobar() } ++ } + ha:POST { Index: pcb-menu-base.lht =================================================================== --- pcb-menu-base.lht (nonexistent) +++ pcb-menu-base.lht (revision 32980) @@ -0,0 +1,194 @@ +# minimal menu file for testing menu patches + +ha:rnd-menu-v1 { + li:mouse { + li:left { + li:press = { Tool(Press) } + li:press-shift = { Tool(Press) } + li:press-ctrl = { Tool(Save); Tool(arrow); Tool(Restore); Tool(Press) } + li:release = { Tool(Release) } + li:release-shift = { Tool(Release) } + li:release-ctrl = { Tool(Release) } + } + li:middle { + li:press = { Pan(1) } + li:release = { Pan(0) } + } + li:right { + li:press = { Tool(Stroke) } + li:release = { Tool(Release); Popup(popup-obj, obj-type) } + li:shift-release = { Popup(popup-obj-misc) } + } + 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) } + } + } + + li:toolbar_static { + ha:via {tip={place a via on the board}} + ha:line {tip={draw a line segment (trace) on the board}} + ha:arc {tip={draw an arc segment (trace) on the board}} + ha:text {tip={draw text on the board}} + ha:rectangle {tip={draw a rectangular polygon on the board}} + ha:poly {tip={draw a polygon on the board}} + ha:polyhole {tip={cut out a hole from existing polygons on the board}} + ha:buffer {tip={paste the current buffer on the board}} + ha:remove {tip={remove an object from the board}} + ha:rotate {tip={rotate an object on the board}} + ha:insert {tip={insert a point in a trace or polygon contour}} + ha:thermal {tip={change thermal connectivity of a pin or via}} + ha:arrow {tip={switch to arrow mode}} + ha:lock {tip={lock or unlock objects on the board}} + } + + li:main_menu { + + ha:File { + li:submenu { + ha:Start New Layout = { li:a={{f;n}; {Ctrln};}; action=New() } + ha:Revert = { a={f;r}; action=Load(Revert,none); tip=Revert to the layout stored on disk } + - + ha:Load layout... = { li:a={{f;o};{f;l};} action=Load(Layout); tip=Load a layout from a file } + - + ha:Save Layout = { li:a={{f;s}; {Ctrls};}; action=Save(Layout); tip=Saves current layout } + ha:Save Layout As... = { li:a={{f;a}; {Shift Ctrls};}; action=Save(LayoutAs); tip=Saves current layout into a new file } + - + END + } + } + + ha:Stock-Anchors { + li:submenu { + + ha:layerkeys { + li:submenu { + ha:pre {} + te:@layerkeys + ha:post {} + } + } + + ha:layerpick { + li:submenu { + ha:pre {} + te:@layerpick + ha:post {} + } + } + + ha:layerview { + li:submenu { + ha:pre {} + te:@layerview + ha:post {} + } + } + + ha:grid { + li:submenu { + ha:pre {} + te:@grid + ha:post {} + } + } + + ha:routestyles { + li:submenu { + ha:pre {} + te:@routestyles + ha:post {} + } + } + + ha:import { + li:submenu { + ha:pre {} + te:@import_top + - + te:@import_sch + - + te:@import_geo + ha:post {} + } + } + + ha:autoroute { + li:submenu { + ha:pre {} + te:@autoroute + ha:post {} + } + } + + ha:scripts { + li:submenu { + ha:pre {} + te:@scripts + ha:post {} + } + } + + ha:feature_plugins { + li:submenu { + ha:pre {} + te:@feature_plugins + ha:post {} + } + } + + ha:indications { + li:submenu { + ha:pre {} + te:@indications + ha:post {} + } + } + + ha:indications { + li:submenu { + ha:pre {} + te:@indications + ha:post {} + } + } + } + } + + + ha:Test-Anchors { + li:submenu { + ha:indications { + li:submenu { + ha:PRE {} + te:@testanchor + ha:POST {} + } + } + } + } + + } # main menu + + li:popups { +# context sensitive right click: popup per object type under the cursor + + ha:popup-obj-line { + li:submenu { + ha:Edit properties { action=propedit(object) } + ha:Edit flags... { action=FlagEdit() } + ha:Set Same Style { action=SetSame() } + - + ha:Remove line { li:action={Tool(Save); Tool(remove); Tool(Press); Tool(Restore)} } + ha:Copy to buffer { li:action={Unselect(All); Select(object); PasteBuffer(Clear); PasteBuffer(AddSelected); Unselect(All); Tool(buffer) } } + ha:Move to current layer { action=MoveToCurrentLayer(object) } + } + } + } # popups +} # root Index: test_patch.sh =================================================================== --- test_patch.sh (nonexistent) +++ test_patch.sh (revision 32980) @@ -0,0 +1,16 @@ +#!/bin/sh + +# MenuPatch(load, test, "insert.lht"); + +rm d0.lht d1.lht >/dev/null 2>&1 + +echo ' + MenuDebug(force-enable); + MenuDebug(save, "d0.lht"); +'$1' + MenuDebug(save, "d1.lht"); +' | pcb-rnd -c rc/menu_file=base --gui batch 2>&1 | grep -v "^menu debug" + +diff -U1 d0.lht d1.lht | grep "^[ +-][^+-]" + +rm d0.lht d1.lht >/dev/null 2>&1 Property changes on: test_patch.sh ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property