Author Topic: Compilation error against wxWidgets 3.1.2 reveals code defect in wxSmith  (Read 217 times)

Offline sodev

  • Almost regular
  • **
  • Posts: 141
The problem is in the file \src\plugins\contrib\wxSmith\wxwidgets\properties\wxscolourproperty.cpp:

Code: [Select]
...

namespace
{
#if wxCHECK_VERSION(3, 1, 0)
    static const char* wxsColourLabels[] = {
#else
    static const wxChar* wxsColourLabels[] = {
#endif // wxCHECK_VERSION
        _("Default"),
        _("Custom"),
        _("Scrollbar"),
        _("Desktop"),
        _("Active window caption"),
        _("Inactive window caption"),
        _("Menu background"),
        _("Window background"),
        _("Window frame"),
        _("Menu text"),
        _("Text in window"),
        _("Text in window caption"),
        _("Active window border"),
        _("Inactive window border"),
        _("Background for MDI apps"),
        _("Selected item"),
        _("Text of selected item"),
        _("Face of button"),
        _("Edge of button"),
        _("Grayed (disabled) text"),
        _("Text on buttons"),
        _("Text of inactive caption"),
        _("Highlight colour for buttons"),
        _("Dark shadow for 3D items"),
        _("Light for 3D items"),
        _("Tooltip text"),
        _("Tooltip background"),
        _("Listbox"),
        _("Hot light"),
        _("Gradient of active caption"),
        _("Gradnent of inactive caption"),
        _("Selected menu item"),
        _("Menu bar"),
        0
    };

...

This does not compile against my wxWidgets 3.1.2 (current master) library because i use #define wxUSE_UNSAFE_WXSTRING_CONV 0 and this code fragment does require that disabled unsafe conversion. However, this code doesn't work as intended anyway, these strings will never get translated. These are static const in global scope and therefore the _() macro gets executed before main(), before any message catalogs are loaded, so the translation does not happen.

I fixed the compilation error by replacing _() with wxTRANSLATE() but i cannot easily repair the translation to happen because as far as i understand the code this array gets passed to an external object that uses it directly to populate a wxChoice so i cannot insert the translation calls there.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10809
    • Travis build status
Have you logged an issue on the tracker about this?

p.s. Using non default wxwidgets settings is not really supported. :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline sodev

  • Almost regular
  • **
  • Posts: 141
I'm still used to that post-stuff-on-forum-if-u-dont-have-a-patch workflow, created a ticked now ;D.

I don't want to build another wxWidgets version just for CodeBlocks so i use the one we use for our applications as well, the only non-default settings are that i disable all compatibility settings (we use bleeding-edge trunk versions for many years now and keep our code updated) and enable IPv6 (mostly to make Boost::ASIO happy). CodeBlocks did improve in that area, previously it was not easy to use wxWidgets without that compatibility stuff :).