Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12190/src/gui

Modified Files:
        wxMenuDefs.cpp 
Log Message:
fixed conflict between submenu and normal items ids

Index: wxMenuDefs.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMenuDefs.cpp,v
retrieving revision 1.222
retrieving revision 1.223
diff -b -u -2 -r1.222 -r1.223
--- wxMenuDefs.cpp      16 Jul 2004 22:42:00 -0000      1.222
+++ wxMenuDefs.cpp      14 Aug 2004 00:09:45 -0000      1.223
@@ -576,4 +576,13 @@
                        WrongMenuDataCount );
 
+// we don't have the menu id field for the submenus so generate "unique" ids
+// for them (can't use wxID_ANY as FindMenu() wouldn't work then)
+static inline SubmenuId(int n)
+{
+   // this is really a hack: to avoid conflicts with the real menu items, put
+   // submenus after WXMENU_END
+   return WXMENU_END + (n - WXMENU_BEGIN);
+}
+
 // ============================================================================
 // implementation
@@ -617,9 +626,5 @@
             const MenuItemInfo& mii = GetMenuItem(nSubMenu);
 
-            // we don't have the menu id field for the submenus so use their
-            // offset in the menu item array
-            //
-            // note that if this changes, FindSubmenu() will have to change too!
-            menu->Append(WXMENU_BEGIN + n,
+            menu->Append(SubmenuId(n),
                          wxGetTranslation(mii.label),
                          submenu,
@@ -822,5 +827,5 @@
    // we use the index in the array/enum as id for the submenus, see
    // AppendToMenu()
-   wxMenuItem *menuitem = mb->FindItem(WXMENU_BEGIN + id);
+   wxMenuItem *menuitem = mb->FindItem(SubmenuId(id));
    CHECK( menuitem, NULL, _T("no such menuitem in FindSubmenu") );
 



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to