Author Topic: CB menu system confusion  (Read 41215 times)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2877
Re: CB menu system confusion
« Reply #30 on: January 20, 2007, 04:10:57 am »
it was a 1 liner, it all starts here :

http://forums.codeblocks.org/index.php?topic=4809.msg37667#msg37667

wx guys did it this [http://forums.codeblocks.org/index.php?topic=4809.msg38778#msg38778] way, should try that one. Will see if I can build it tomorrow on windows the patched wx.

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() */ )



I made this patch on my msw system.
It did *not* resolve the "skipping mnemonic" problem.
It didn't even resolve the mis-aligned menu items.

It also did not change the size of ...\wxWidgets263\lib\gcc_dll\wxmsw26u_gcc_custom.dll



Maybe I'm doing it wrong. I made it to the msw/menu.cpp.

Code
    // check if we have something more than a simple text item
#if wxUSE_OWNER_DRAWN
    if ( pItem->IsOwnerDrawn() )
    {
        // 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




The file on the left is the new lib. The ones on the right are the zipped up files prior to the fix. There's no change in the lib size(second from bottom). So I'd guess the patch is in code that is not seen by the compiler. Note the #if wxUSE_OWNER_DRAWN.

c:\Usr\Proj\wxWidgets263\lib\gcc_dll\mswu\wx\setup.h
looks like wxUSE_OWNER_DRAWN should be on. So why didn't the patch work?

Code
// Set this to 1 to enable support for the owner-drawn menu and listboxes. This
// is required by wxUSE_CHECKLISTBOX.
//
// Default is 1.
//
// Recommended setting: 1, set to 0 for a small library size reduction
#define wxUSE_OWNER_DRAWN 1
« Last Edit: January 20, 2007, 05:01:01 am by Pecan »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5529
Re: CB menu system confusion
« Reply #31 on: January 20, 2007, 03:14:07 pm »
see here : http://forums.codeblocks.org/index.php?topic=4809.msg38937#msg38937 on application of patches to wx [as it seems now, the dll I obtained from it might replace our hacked version of the wx dll, aka HackUpdated ;-)]

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2877
Re: CB menu system confusion
« Reply #32 on: January 20, 2007, 03:39:20 pm »
see here : http://forums.codeblocks.org/index.php?topic=4809.msg38937#msg38937 on application of patches to wx [as it seems now, the dll I obtained from it might replace our hacked version of the wx dll, aka HackUpdated ;-)]

But still, this is  providing a patched lib that I can't reproduce.
How are you doing it. Can you please provide a patch file for the rest of us to test our code.

Right now, I'm in a position where I cannot fix/debug/verify code. I cannot seem to reproduce the lib you're distributing in the nightlies.

I applied the patch you say you put into the nightly. It neither corrected the alignment problem, nor fixed the "skipping mnemonic" on my local wx2.6.3 XP system.
« Last Edit: January 20, 2007, 04:14:09 pm by Pecan »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5529
Re: CB menu system confusion
« Reply #33 on: January 20, 2007, 03:52:20 pm »
I changed the 2 files mentioned of wx, build the wx dll, and voila, fixed ;-)

uploading the dll to berlios now

it will be called : wxmsw26u_gcc_cb_wx2.6.3p2AndCbPatch(version2).7z
wxmsw26u_gcc_cb_wx2.6.3p2AndCbPatch_version2.7z
(could take a while, stupid berlios, and the fuck is, it so often fails leaving a partial file, and by ftp you can't delete it, so you publish it,  then delete and reupload, but all is so slow, so unstable and unreliable, .... grrrrrrr)

[EDIT] I didn't test  mnemonics !!

Can you give me a testcase ?
« Last Edit: January 20, 2007, 04:00:26 pm by killerbot »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2877
Re: CB menu system confusion
« Reply #34 on: January 20, 2007, 04:22:57 pm »

[EDIT] I didn't test  mnemonics !!

Can you give me a testcase ?

It doesnt matter. But...

1) Does Alt-F-O open the file selector or does it just do nothing.
2) Does Alt-F-C close an open file or does it just skip among the menuitmes beginning with the letter C

It's your patch that matters. If you would please provide a diff or patch file against wxWidgets for the patches you're applying.

The point is, the patches you're applying for the nightly build do not seem to work for my wxWidgets 2.6.3. I'd like to find out why.

Without the patches, I cannot fix any nightly complaints, cannot trace into a "nightly" wxWidgets.

I applied the forum link patches you pointed out, but they did not even fix the alignment problem as advertised. There has to be a reason. But without the diff or patch file to exactly reproduce your fixes, there no way to know why they dont work for everyone.

« Last Edit: January 20, 2007, 04:28:50 pm by Pecan »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5529
Re: CB menu system confusion
« Reply #35 on: January 20, 2007, 04:36:08 pm »
weird, I used the 2 patches.
I have put the 2 source files in a zip file you can find it here : http://users.pandora.be/lieven.de.cock/CodeBlocks/Pecan.7z

If you use the dll I build, does it solve anything for you ??


1) Alt-F-O : opens the file selector
2) Alt-F-C : closes the current file
:-)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2877
Re: CB menu system confusion
« Reply #36 on: January 20, 2007, 05:08:47 pm »
weird, I used the 2 patches.
I have put the 2 source files in a zip file you can find it here : http://users.pandora.be/lieven.de.cock/CodeBlocks/Pecan.7z

If you use the dll I build, does it solve anything for you ??


1) Alt-F-O : opens the file selector
2) Alt-F-C : closes the current file
:-)

Cool.
I see there is some change in ownerdrawn.cpp  I didn't have this patch.
Are the patches marked? I don't see and signature or "codeblocks patch" or anything.

I've downloaded the nightlib lib. It shows the .7z file as modified today, but the lib inside was only modified on Jan 05. Is that correct?

thanks
pecan

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5529
Re: CB menu system confusion
« Reply #37 on: January 20, 2007, 05:48:28 pm »
the dll should have a time stamp of today  :shock: :shock:

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2877
Re: CB menu system confusion
« Reply #38 on: January 20, 2007, 05:58:11 pm »
weird, I used the 2 patches.
I have put the 2 source files in a zip file you can find it here : http://users.pandora.be/lieven.de.cock/CodeBlocks/Pecan.7z

If you use the dll I build, does it solve anything for you ??


1) Alt-F-O : opens the file selector
2) Alt-F-C : closes the current file
:-)

Yes, indeedy! The "nightly wxlib" solves both the mis-aligned icons and the "skipping mnemonics".

But those menu.cpp and ownerdw.cpp have a lot more patches in them then just the CB "one-liners". No wonder the "forum patches" didn't work. Where did those source modules come from?

I'm working up a diff file now and will test.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5529
Re: CB menu system confusion
« Reply #39 on: January 20, 2007, 06:01:16 pm »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2877
Re: CB menu system confusion
« Reply #40 on: January 20, 2007, 06:36:45 pm »
they come from here : http://forums.codeblocks.org/index.php?topic=4809.msg38778#msg38778

Oh. So a diff file is not necessary.
How do we plan on handling this situation for SVN users?

I'm re-modifying the wxWidgets263 source to get this all to work.

EDIT: 12:59 PM

It works.
I copied the modfied menu.cpp and ownerdw.cpp built with:
I have uploaded my back port of how this problem was fixed in CVS head. The fix is patch 1637808 which updates the file menu.cpp. I would apply the patch 1637804  before doing this patch because menu uses code in the file ownerdrw.cpp.

Tim S

[ 1637808 ] MSW: menu.cpp backport to 2.6_BRANCH from cvs head
http://sourceforge.net/tracker/index.php?func=detail&aid=1637808&group_id=9863&atid=309863

[ 1637804 ] MSW: ownerdrw.cpp backport to 2.6_BRANCH from cvs head
http://sourceforge.net/tracker/index.php?func=detail&aid=1637804&group_id=9863&atid=309863

to wxWidget263, re-built wxmsw26u_gcc_custom.dll, then re-built Codeblocks and contribs against it.

With the keybinder fixes (applied svn 3443) the icons are aligned and the "skipping mnemonic" bugs have disappeared.

Still... these sources have to be applied via CB svn somehow.

thanks
« Last Edit: January 20, 2007, 07:07:37 pm by Pecan »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5529
Re: CB menu system confusion
« Reply #41 on: January 20, 2007, 10:44:30 pm »
no , they are wx sources, not CB sources. Windows people can download are special dll. Linux people need to do it themselves, but they didn't have those problems in the first place (the menu alignment and disabling of icons), so they don't need to do anything.

We don't want people using Cb to build wx themselves.

You don't even have to rebuild CB if you want to use the new dll, since no headers have changed.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2877
Re: CB menu system confusion
« Reply #42 on: January 21, 2007, 02:03:07 am »
no , they are wx sources, not CB sources. Windows people can download are special dll. Linux people need to do it themselves, but they didn't have those problems in the first place (the menu alignment and disabling of icons), so they don't need to do anything.

We don't want people using Cb to build wx themselves.

You don't even have to rebuild CB if you want to use the new dll, since no headers have changed.

Lets say we tell a new user that it's easy to build from SVN. S/he does so and ends up with the same menu problems we've just been through because s/he compiled using the usual wxWidgets.

Where can we tell him/her where to get these patches for wxWidgets?

Shall we say to just search the forum?

Or will we have a common place for the patches, and an explanation of where to apply them.

There are already other patches (Scintilla for example) that we apply to external source. How are they maintained. How does a new svn user handle all this?


Lets say a smart new user wants to debug CB using wxWidgets debug mode. Where would s/he get the patches to make the wxWidgets source mirror the nightly wxLib?
« Last Edit: January 21, 2007, 02:06:51 am by Pecan »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7790
    • My Best Post
Re: CB menu system confusion
« Reply #43 on: January 21, 2007, 06:35:21 am »

Lets say a smart new user wants to debug CB using wxWidgets debug mode. Where would s/he get the patches to make the wxWidgets source mirror the nightly wxLib?


I am working on a Wiki page for this
http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.6.3_to_develop_Code::Blocks_%28MSW%29

I still got a long way to go, but I plan to show how to apply patches to wxWidgets source.

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

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5529
Re: CB menu system confusion
« Reply #44 on: January 21, 2007, 10:45:07 am »
Pecan, Tim,
good idea.
Quote
There are already other patches (Scintilla for example) that we apply to external source. How are they maintained. How does a new svn user handle all this?
The difference here is that those sources are in our svn repo and are built as part of CB when you build CB.