With V0.81, all the logic for manipulating and evaluating context
menus has been moved to a new file, menus.c
. All these functions have
been given the mnu*
prefix to make this a bit clearer.
The XWorkplace classes override wpModifyPopupMenu
and
wpMenuItem[Help]Selected
for almost every replacement class. These
overrides either handle the new context menu items in that method
code or, for XFolder and XFldDisk, call the functions in menus.c
,
because these two classes share many common menu items, so we can
share most of the code also.
All newly inserted menu items use variable menu IDs. You can tell
this from their #define names, which have an _OFS_
in their name
(check dlgids.h
). To all these values, XWorkplace adds the offset that
is specified on the "Paranoia" notebook page.
For an introduction to how the config folder menu items work, see the
"XWorkplace Internals" section in the
XWorkplace User Guide.
XWorkplace uses a fairly obscure system of global
variables to be able to relate menu items to their intended
functions. All the variable menu items are stored in a global linked
list when the context menu is opened for a folder. In each list item,
XWorkplace also stores what kind of object (template, program object,
folder content item etc.) the menu item represents. This list is then
examined by wpMenuItemSelected
to perform the corresponding action
(create a new object, start program etc.). After that, the list is
destroyed, so it only eats up memory while the context menu is open.
All this code is now (V0.81) in menus.c
.
As opposed to the "regular" new menu items,
the folder content menus are initially only inserted as empty submenu stubs.
They are only filled with items when they're opened: XWorkplace
intercepts WM_INITMENU
in the subclassed folder frame proc
(fnwpSubclassedFolderFrame
, src\filesys\folder.c
) and then
populates the menu.
These menu items are stored in the global list too and marked as
folder content menu items so that wpMenuItemSelected
will then simply
open the corresponding Desktop object. The folder content code has now
been moved to menus.c
also.
Painting the icons is then done using owner-draw menu items; the
messages which are necessary for this are also intercepted in
fnwpSubclassedFolderFrame
and then call corresponding functions in
menus.c
.
The folder content menu windows are also subclassed to be able to intercept
right-mouse button clicks. The new window proc for this is called
(suprise!) fnwpFolderContentMenu
.
The xfSelectingMenuItem
method introduced in V0.80 has been removed
again with V0.81 due to the problems with SOM multiple inheritance.