Code::Blocks

User forums => General (but related to Code::Blocks) => Topic started by: BigAngryDog on June 02, 2006, 06:36:12 am

Title: Toolbar Color Bug?
Post by: BigAngryDog on June 02, 2006, 06:36:12 am
This maybe well known, but...

When using C::B in the Windows Classic Theme with various color schemes (including the "Standard" scheme) the toolbars seem to show incorrect background colors.

I often switch between color schemes, and C::B seems to showing background colours from the "Maple" scheme, which is the color scheme I had when I installed it.

Almost trivial, but looks kinda ugly. Suggests there is a color problem with the toolbars. Would it be easy to fix?

If a screen-shot would help, let me know.
Title: Re: Toolbar Color Bug?
Post by: Ceniza on June 02, 2006, 07:08:22 am
Works fine here...
Title: Re: Toolbar Color Bug?
Post by: BigAngryDog on June 02, 2006, 08:38:55 pm
Screenshot below:

(http://www.bigangrydog.com/cb_temp.gif)
Title: Re: Toolbar Color Bug?
Post by: HeroreV on June 04, 2006, 09:07:45 am
It looks even worse when installing with "Windows Classic style" and switching to "Windows XP style".

(http://www.freewebs.com/herorev/CodeBlocks%20wrong%20colors.png)

(build 20060525)
Title: Re: Toolbar Color Bug?
Post by: Vampyre_Dark on June 04, 2006, 10:07:51 am
Odd. I've often switched my schemes back and forth with C::B opened at the time and nothing like that ever happened.
Title: Re: Toolbar Color Bug?
Post by: Ceniza on June 04, 2006, 10:09:55 am
"Problem": wxDefaultDockArt initializes colours and brushes based on platform and saves them in member variables, so if you change the Windows' theme those variables won't be updated, reason it'll paint a few things with the old colours.

At least for the Gripper, the problem can be found at line 451 of wxAUI/manager.cpp.

To solve this problem, instead of initializing those members in the constructor and using them in the Draw* member functions directly, a function call should be made to set the right brush and colour. This function should be inlined and take care of all those platform dependent issues (just like the constructor does).

That way the caching is removed (would be better to keep it, but you see what we get) so the right colour is always applied.

Another approach would be updating those colours when the theme changes, but how would we know it?

Now we know it's a wxAUI's bug and we even know the cause, it should be reported to the wxAUI's developers.
Title: Re: Toolbar Color Bug?
Post by: Szabadember on June 04, 2006, 10:28:55 am
I don't know if you can use WinAPI with wxWidgets but if yes, then watch WM_SYSCOLORCHANGE messages.
Title: Re: Toolbar Color Bug?
Post by: Ceniza on June 04, 2006, 08:36:23 pm
Szabadember: Looking for that message I found wxWidgets has events for it. Thanks :)

Macro: EVT_SYS_COLOUR_CHANGED(func)
Event: wxSysColourChangedEvent

A patch would be even easier that way now :)