News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

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

Started by stahta01, December 29, 2006, 09:07:35 PM

Previous topic - Next topic

stahta01

UPDATE: This is the patch mentioned in the Nightly thread http://forums.next.codeblocks.org/index.php?topic=4815.msg37738

I am using this thread now as a way to report on the wxWidgets patch submission pre-work.

Tim

OLD Message info follows:

Is this a windows only bug?
I found a simple change to wxWidgets that fixes the issue for windows.
Does the problem exist in Linux and Mac also?

Tim S

From http://article.gmane.org/gmane.comp.lib.wxwidgets.devel/82394
Quote
Jamie Gadd wrote:

http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/src/msw/menu.cpp.diff?r1=1.128&r2=1.129

As a result of adding "&& !pItem->GetBitmap(true).Ok()", the
::InsertMenuItem() code never gets called.

wxMenuItem derives from wxOwnerDrawn where the GetBitmap() method is
with a default parameter of true. This then effectively becomes:

if ( true && !true )
...

This explains the regression with the menu margins. As it is now we
are still not using the ::InsertMenuItem() code.

Jamie

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

killerbot

On my suse 10.2 I have wx263 and there everything is ok.

So it seems it might just be windows.


tell us , tell us ....

stahta01

Just remove the
&& !pItem->GetBitmap(true).Ok()

added to menu.cpp in version 1.129
and it is fixed.

Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

killerbot

you are talking about the line in "wxMenu::DoInsertOrAppend", correct ?

this was how it was in wx262

        // is the item owner-drawn just because of the bitmap?
        if ( pItem->GetBitmap().Ok() &&
                !pItem->GetTextColour().Ok() &&
                    !pItem->GetBackgroundColour().Ok() &&
                        !pItem->GetFont().Ok() )
        {
            // try to use InsertMenuItem() as it's guaranteed to look correctly
            // while our owner-drawning code is not


and in wx 263 they changed it into  :

        // is the item owner-drawn just because of the bitmap?
        if ( pItem->GetBitmap().Ok() &&
                !pItem->GetTextColour().Ok() &&
                    !pItem->GetBackgroundColour().Ok() &&
                        !pItem->GetFont().Ok() &&
                            !pItem->GetBitmap(true).Ok() )
        {
            // try to use InsertMenuItem() as it's guaranteed to look correctly
            // while our owner-drawning code is not



did you bring this to the attention of the wx guys.

I am gonna rebuild our wx_cb_dll, this is a nice fix (hopefully with no side effects).

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Quote from: killerbot on December 29, 2006, 09:26:20 PM
you are talking about the line in "wxMenu::DoInsertOrAppend", correct ?

this was how it was in wx262

        // is the item owner-drawn just because of the bitmap?
        if ( pItem->GetBitmap().Ok() &&
                !pItem->GetTextColour().Ok() &&
                    !pItem->GetBackgroundColour().Ok() &&
                        !pItem->GetFont().Ok() )
        {
            // try to use InsertMenuItem() as it's guaranteed to look correctly
            // while our owner-drawning code is not


and in wx 263 they changed it into  :

        // is the item owner-drawn just because of the bitmap?
        if ( pItem->GetBitmap().Ok() &&
                !pItem->GetTextColour().Ok() &&
                    !pItem->GetBackgroundColour().Ok() &&
                        !pItem->GetFont().Ok() &&
                            !pItem->GetBitmap(true).Ok() )
        {
            // try to use InsertMenuItem() as it's guaranteed to look correctly
            // while our owner-drawning code is not



did you bring this to the attention of the wx guys.

I am gonna rebuild our wx_cb_dll, this is a nice fix (hopefully with no side effects).

Correct that were I fixed it, and it worked with CVS 2.6_BRANCH with that change. I just commented out to test it like below.

        if ( pItem->GetBitmap().Ok() &&
                !pItem->GetTextColour().Ok() &&
                    !pItem->GetBackgroundColour().Ok() &&
                        !pItem->GetFont().Ok() /* &&
                            !pItem->GetBitmap(true).Ok() */ )

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

killerbot

well there's good new and bad news :

1) good news : menu entries are nicely aligned again

2) BAD news : 90% of the icons in the menus are gone (example : build : only abort has an icon, debug : only stop debugger has an icon)  [I kind of recall we have had this in the past]

Or could there be a problem with our icons ??

Tim, since you are on those wx mailing list, could you provide them with this information, maybe it will help them understand ?

stahta01

Quote from: killerbot on December 29, 2006, 09:49:55 PM
well there's good new and bad news :

1) good news : menu entries are nicely aligned again

2) BAD news : 90% of the icons in the menus are gone (example : build : only abort has an icon, debug : only stop debugger has an icon)  [I kind of recall we have had this in the past]

Or could there be a problem with our icons ??

Tim, since you are on those wx mailing list, could you provide them with this information, maybe it will help them understand ?

I don't see the 2) BAD News, when I did it. (Using CVS not 2.6.3p2)
I will check with the 2.6.3p2 version of code and see if I see the bad news.

Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Pecan

Quote from: killerbot on December 29, 2006, 09:49:55 PM
well there's good new and bad news :

1) good news : menu entries are nicely aligned again

2) BAD news : 90% of the icons in the menus are gone (example : build : only abort has an icon, debug : only stop debugger has an icon)  [I kind of recall we have had this in the past]

Or could there be a problem with our icons ??

2) was caused by keyBinder in the past. About a year ago (wx2.6.2) when images were added to the menu without telling keyBinder about it.
Turn off keyBinder (or make sure it's recompiled) and see if the problem goes away.

stahta01

Here's the only plugins I have on
BYO Games
Compiler
Copy strings to clipboard
Debugger
Dev-C++ devpak updater/installer
Dragscroll

Tim S

Note: I just enabled all of the plugins and it still looks good.
I am downloading a new copy of wxWidgets 2.6.3 because I can NOT find one that I have not patched.
I am going to rebuild it from scratch and see if I still get good results.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Quote from: killerbot on December 29, 2006, 09:49:55 PM
...
Tim, since you are on those wx mailing list, could you provide them with this information, maybe it will help them understand ?

Yes, I can provide them with the info, but first I have to understand why you are not getting the bitmaps on some menus items. So, I am going to rebuild the DLL from unmodified source except for patches that I known were applied.

Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

90 % of my icons have vanished and I have no idea what caused it.

Tim S :(
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

killerbot

indeed it seems the keybinder is related to it.

After I disabled the keybinder (be aware of the crashes that sometimes can happen when disabling plug-ins), I closed CB.
Restarted CB --> all icons there. Then I enabled the keybinder again and closed Cb and restarted CB --> keybinder said there was no profile and created a default profile, still all icons there. Closed CB, started CB [no remarks of keybinder this time] --> again 90% icons gone.

[EDIT] : tried this out twice -> reproducable
then a new test [started CB with active keybinder and 90% icons gone], Manage plugins : disable keybinder (hehe no crash ;-) ), checked the menus -> all icons back. Closing CB, and starting CB, all icons remain, but the momnt keybinder is turned on again (see above test procedure) 90% is gone again

stahta01

Quote from: killerbot on December 29, 2006, 11:16:48 PM
indeed it seems the keybinder is related to it.

After I disabled the keybinder (be aware of the crashes that sometimes can happen when disabling plug-ins), I closed CB.
Restarted CB --> all icons there. Then I enabled the keybinder again and closed Cb and restarted CB --> keybinder said there was no profile and created a default profile, still all icons there. Closed CB, started CB [no remarks of keybinder this time] --> again 90% icons gone.

[EDIT] : tried this out twice -> reproducable
then a new test [started CB with active keybinder and 90% icons gone], Manage plugins : disable keybinder (hehe no crash ;-) ), checked the menus -> all icons back. Closing CB, and starting CB, all icons remain, but the momnt keybinder is turned on again (see above test procedure) 90% is gone again

I was also able to reproduce once, I am having problems turning off keybinder a second time without crashing. Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

killerbot

just keep on trying, it's a bug in the menu code [again menu code], but probably inside CB, see another thread [http://forums.next.codeblocks.org/index.php?topic=4754.0], with any plug-in.