On 1/21/2011 2:41 AM, P T Withington wrote:
On 2011-01-20, at 19:37, André Bargull wrote:
debugger.lzx:
Maybe it's easier to move the<debugmenuitem>s out of the debugger's<contextmenu>
into a separate<node>. So you've got something like:
---
<contextmenu name="menu">
<contextmenuitem name="Preferences" ... />
<contextmenuitem name="Clear" ... />
</contextmenu>
<node name="debuggeritems">
<!-- extra separatorbefore for nicer ui -->
<debugmenuitem separatorbefore="true" ... />
<debugmenuitem ... />
...
</node>
<!-- The debugger context menu items that should be added to any context menu
-->
<method name="contextMenuItems" args="menu, target"><![CDATA[
this.updateMenu(this.debuggeritems, target);
// maybe a fresh copy of 'subnodes' useful/necessary, maybe not...
return this.debuggeritems.subnodes.slice(0);
]]></method>
I considered something like that, but I really want the Preferences and Clear
items to be at the bottom of the debugger menu. So I'd have to invent a richer
protocol to let contextMenuItems indicate where to insert items. I think I
will leave that as a future improvement.
Eventually, there probably should be something like an event, that would run _all_
methods, and gather up all the menu items from various subsystems that might want
to contribute, and the menu items would have group& precedence that would
allow the menu to group and sort them to build the menu.
I suppose eventually we want to be able to have submenus of context menus, so
they don't grow unwieldy.
I'd still like to see a separator between the debugger menu items and
the user defined items. Here's a possible solution incorporating the
previous idea of splitting the context menu items and your requirement
on displaying the Clear&Preferences entries at the bottom:
<contextmenu name="menu"> empty </contextmenu>
<node name="debuggeritems"> <debugmenuitem> ... </node>
<node name="controlitems"> Clear/Preferences items </node>
<method name="contextMenuItems" args="menu, target"><![CDATA[
this.updateMenu(this.debuggeritems, target);
var dbgmenu = (this.menu === menu);
// add control items at end if displaying debugger context menu
var items = this.debuggeritems.subnodes.concat(dbgmenu ?
this.controlitems.subnodes : []);
// add separator if displaying user (= non-debugger) context menu
items[0].setAttribute("separatorbefore", ! dbgmenu);
return items;
]]></method>
---
Otherwise approved
On 1/21/2011 12:23 AM, P T Withington wrote:
Change ptw-20110120-iqT by [email protected] on 2011-01-20 18:07:07 EST
in /Users/ptw/OpenLaszlo/trunk-3
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Address review comments on r18290
Bugs Fixed: LPP-9674 Make Debug.bugReport() easier to use
Technical Reviewer: [email protected] (pending)
QA Reviewer: [email protected] (pending)
Overview:
Retooled how the debugger finds out there was a context menu
request and gets a chance to insert its own amendments into the
context menu so the debugger items will show up in _any_ context
menu.
Details:
LzContextMenuKernel.*, LzContextMenu: Eliminate addItem/clearItems
from the kernal API. The kernel now calls back to the LFC to get
the list of items to display. Revert onmenuopen to sending the
menu being opened as the delegate argument.
LzDebug: Factor out common pattern for writing.
LzBootstrapDebugService, LzDebuggerConsoleWindowBridge.*: Pass
contextMenuItems call. Make swf9 also use DebugWindow, so I stop
fooling myself.
LzNode: fix nodePath to not be confusing.
debugger: Implement contextMenuItems.
library: Add documentation
Tests:
IWFM.
Files:
M WEB-INF/lps/lfc/kernel/dhtml/LzContextMenuKernel.lzs
M WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js
M WEB-INF/lps/lfc/kernel/swf9/LzContextMenuKernel.lzs
M WEB-INF/lps/lfc/debugger/LzMessage.lzs
M WEB-INF/lps/lfc/debugger/LzDebug.lzs
M WEB-INF/lps/lfc/debugger/platform/dhtml/LzDebuggerWindowConsoleBridge.js
M WEB-INF/lps/lfc/debugger/platform/swf9/LzDebuggerWindowConsoleBridge.as
M WEB-INF/lps/lfc/core/LzNode.lzs
M WEB-INF/lps/lfc/helpers/LzContextMenu.lzs
M WEB-INF/lps/lfc/compiler/LzBootstrapDebugService.lzs
M lps/components/debugger/debugger.lzx
M lps/components/debugger/library.lzx
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/ptw-20110120-iqT.tar