Author Topic: Refixed wxWidget Patch: menu items with icon not correctly aligned (since wx263)  (Read 35456 times)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
UPDATE: This is the patch mentioned in the Nightly thread http://forums.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

« Last Edit: January 17, 2007, 04:50:01 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #1 on: December 29, 2006, 09:10:25 pm »
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 ....

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #2 on: December 29, 2006, 09:13:55 pm »
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++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #3 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
Code
        // 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  :
Code
        // 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).

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #4 on: December 29, 2006, 09:36:57 pm »
I read it in their group but I am not sure if anyone else read it.

Tim S

http://article.gmane.org/gmane.comp.lib.wxwidgets.devel/82394

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #5 on: December 29, 2006, 09:45:39 pm »
you are talking about the line in "wxMenu::DoInsertOrAppend", correct ?

this was how it was in wx262
Code
        // 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  :
Code
        // 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++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #6 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 ?
« Last Edit: December 29, 2006, 09:51:59 pm by killerbot »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #7 on: December 29, 2006, 09:57:19 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++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #8 on: December 29, 2006, 10:21:51 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.
« Last Edit: December 29, 2006, 10:26:00 pm by Pecan »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #9 on: December 29, 2006, 10:34:27 pm »
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.
« Last Edit: December 29, 2006, 10:52:48 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #10 on: December 29, 2006, 10:59:04 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++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #11 on: December 29, 2006, 11:07:00 pm »
90 % of my icons have vanished and I have no idea what caused it.

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

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #12 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
« Last Edit: December 29, 2006, 11:19:45 pm by killerbot »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #13 on: December 29, 2006, 11:22:44 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++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Solution To: menu items with icon not correctly aligned (since wx263)
« Reply #14 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.