Patch #1777 2006-12-30 10:56
stahta01
keybinder RebuildMenuitem patch- Download
- 1777-keybinder_Rebu.patch (3.8 KB)
Index: src/plugins/contrib/keybinder/menuutils.cpp
===================================================================
--- src/plugins/contrib/keybinder/menuutils.cpp (revision 3442)
+++ src/plugins/contrib/keybinder/menuutils.cpp (working copy)
@@ -190,40 +190,54 @@
// ----------------------------------------------------------------------------
// RebuildMenuitem
// ----------------------------------------------------------------------------
-wxMenuItem* wxMenuCmd::RebuildMenuitem(wxMenuItem* pMnuItem)
-{//+v0.4.25 WXMSW
- // Since wxWidgets 2.6.3, we don't have to rebuild the menuitem
- // to preserve the bitmapped menu icon.
- return pMnuItem;
-
-}//RebuildMenuitem
+//wxMenuItem* wxMenuCmd::RebuildMenuitem(wxMenuItem* pMnuItem)
+//{//+v0.4.25 WXMSW
+// // Since wxWidgets 2.6.3, we don't have to rebuild the menuitem
+// // to preserve the bitmapped menu icon.
+// return pMnuItem;
+//
+//}//RebuildMenuitem
// ----------------------------------------------------------------------------
// The following routine was used when wxWidgets would not SetText()
// without clobbering the menu Bitmap icon
// ----------------------------------------------------------------------------
-//wxMenuItem* wxMenuCmd::RebuildMenuitem(wxMenuItem* pMnuItem)
-//{//+v0.4.6 WXMSW
-// // ---------------------------------------------------------------
-// // Do it the slow/hard way, remove and delete the menu item
-// // ---------------------------------------------------------------
-// wxMenu* pMenu = pMnuItem->GetMenu();
-// wxMenuItemList items = pMenu->GetMenuItems();
-// int pos = items.IndexOf(pMnuItem);
-// // rebuild the menuitem
-// wxMenuItem* pnewitem = new wxMenuItem(pMenu, m_nId, pMnuItem->GetText(),
-// pMnuItem->GetHelp(), pMnuItem->GetKind(),
-// pMnuItem->GetSubMenu() );
-// pnewitem->SetBitmap(pMnuItem->GetBitmap() );
-// pnewitem->SetFont(pMnuItem->GetFont() );
-// // remove the menuitem
-// pMenu->Destroy(pMnuItem);
-// // update keybinder array menu item pointer
-// m_pItem = pnewitem;
-// // put the menuitem back on the menu
-// pMenu->Insert(pos, pnewitem);
-// return pnewitem;
-//
-//}//RebuildMenuitem
+wxMenuItem* wxMenuCmd::RebuildMenuitem(wxMenuItem* pMnuItem)
+{ //+v0.4.6 WXMSW
+ // ---------------------------------------------------------------
+ // Do it the slow/hard way, remove and delete the menu item
+ // ---------------------------------------------------------------
+ wxMenu* pMenu = pMnuItem->GetMenu();
+ wxMenuItemList items = pMenu->GetMenuItems();
+ int pos = items.IndexOf(pMnuItem);
+ // rebuild the menuitem
+ wxMenuItem* pnewitem = new wxMenuItem(pMenu, m_nId, pMnuItem->GetText(),
+ pMnuItem->GetHelp(), pMnuItem->GetKind(),
+ pMnuItem->GetSubMenu() );
+ pnewitem->SetBitmap(pMnuItem->GetBitmap() );
+ pnewitem->SetFont(pMnuItem->GetFont() );
+#if wxUSE_OWNER_DRAWN
+ if ( pMnuItem->IsOwnerDrawn() )
+ {
+ pnewitem->SetOwnerDrawn(true);
+ pnewitem->SetMarginWidth(pMnuItem->GetMarginWidth());
+ pnewitem->SetDisabledBitmap(pMnuItem->GetDisabledBitmap());
+ if (pMnuItem->IsCheckable())
+ {
+ pnewitem->SetCheckable(true);
+ pnewitem->SetBitmaps(pMnuItem->GetBitmap(true), pMnuItem->GetBitmap(false));
+ }
+ }
+#endif
+
+ // remove the menuitem
+ pMenu->Destroy(pMnuItem);
+ // update keybinder array menu item pointer
+ m_pItem = pnewitem;
+ // put the menuitem back on the menu
+ pMenu->Insert(pos, pnewitem);
+ return pnewitem;
+
+}//RebuildMenuitem
#endif //#if defined( __WXMSW__ )
// ----------------------------------------------------------------------------
bool wxMenuCmd::IsNumericMenuItem(wxMenuItem* pwxMenuItem) //v0.2
History
stahta01 2006-12-30 10:58
This patch helps the patch to fix menu items with icon not correctly aligned (since wx263) in thread http://forums.codeblocks.org/index.php?topic=4809 work better. Tim S
stahta01 2006-12-30 11:00
wxWidgets patch below: Index: src/msw/menu.cpp =================================================================== RCS file: /pack/cvsroots/wxwidgets/wxWidgets/src/msw/menu.cpp,v retrieving revision 1.124.2.5 diff --unified -r1.124.2.5 menu.cpp --- src/msw/menu.cpp 2006/10/20 14:46:59 1.124.2.5 +++ src/msw/menu.cpp 2006/12/29 20:59:22 @@ -412,8 +412,7 @@ if ( pItem->GetBitmap().Ok() && !pItem->GetTextColour().Ok() && !pItem->GetBackgroundColour().Ok() && - !pItem->GetFont().Ok() && - !pItem->GetBitmap(true).Ok() ) + !pItem->GetFont().Ok() ) { // try to use InsertMenuItem() as it's guaranteed to look correctly // while our owner-drawning code is not
pecan 2006-12-30 16:26
Applied the keyBinder fix SVN 3443 I'll leave the rest to Lieven.
killerbot 2006-12-30 16:45
applied.