Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Refixed wxWidget Patch: menu items with icon not correctly aligned (since wx263)

<< < (4/11) > >>

stahta01:

--- Quote from: killerbot on December 29, 2006, 11:42:24 pm ---just keep on trying, it's a bug in the menu code [again menu code], but probably inside CB, see another thread [http://forums.codeblocks.org/index.php?topic=4754.0], with any plug-in.

--- End quote ---

I got it to turn off, I submitted a partial fix as a patch for the plugin disable issue also.

Tim S

Pecan:
If you would like to try an experiment with keybinder:
At menuutils.cpp line 190 (keybinder) there are two RebuildMenuItem() routines.
The second one was the one that solved the missing icon problem in wx2.6.2 .

With your "fixed" wxWidgets, comment out the first RebuildMenuItem and uncomment the second to see if it solves the problem.

It may cause a crash since it hasnt been used/updated in a year, but it'll tell us if the missing icons are fixed.


--- Code: ---}//Update
// ----------------------------------------------------------------------------
// 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
#endif //#if defined( __WXMSW__ )
// ----------------------------------------------------------------------------


--- End code ---

stahta01:

--- Quote from: Pecan on December 30, 2006, 04:03:51 am ---If you would like to try an experiment with keybinder:
At menuutils.cpp line 190 (keybinder) there are two RebuildMenuItem() routines.
The second one was the one that solved the missing icon problem in wx2.6.2 .

With your "fixed" wxWidgets, comment out the first RebuildMenuItem and uncomment the second to see if it solves the problem.

It may cause a crash since it hasnt been used/updated in a year, but it'll tell us if the missing icons are fixed.


--- End quote ---

This was the right way to fix this as a work around, but we might wish to find the cause, I think the cause is in wxWidgets MenuItem class.

I added code to the method RebuildMenuItem and it helps under 2.8.0, I am compiling it for 2.6.3.4 now and see if it works. Tim S

stahta01:
I think I have found a patch to wxWidgets that fixes the issue. I will have to re-test to be sure.
The re-test still has the bug where keybinder removes 90% of the icons.

Tim S

stahta01:
Here's a snippet of the keybinder logging under debug and kbLOGGING, does it give any information or is it unrelated to anything. Tim S


--- Code: ---01:59:08: wxMenuCmd::Update - Removing shortcuts [Continue Ctrl-F7] for [Continue]
01:59:08: wxMenuCmd::Update - Setting shortcuts for [Continue Ctrl-F7]
01:59:08: wxMenuCmd::Update - Removing shortcuts [Toggle breakpoint F5] for [Toggle breakpoint]
01:59:08: wxMenuCmd::Update - Setting shortcuts for [Toggle breakpoint F5]
01:59:08: CreateNew()UnMatched id:1413 name:Edit startup script
01:59:08: Debug: keybinder.cpp(602): assert "ret" failed.
01:59:18: wxMenuCmd::Update - Removing shortcuts [Goto file... Alt-G] for [Goto file...]
01:59:18: wxMenuCmd::Update - Setting shortcuts for [Goto file... Alt-G]
01:59:18: wxMenuCmd::Update - Removing shortcuts [Activate next project Alt-F6] for [Activate next project]
01:59:18: wxMenuCmd::Update - Setting shortcuts for [Activate next project Alt-F6]
01:59:18: wxMenuCmd::Update - Removing shortcuts [Activate prior project Alt-F5] for [Activate prior project]


--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version