Menu

#146 Codegeneration outdated for wxWidgets 3.1

v1.0_(example)
pending
nobody
None
5
2014-08-01
2014-07-30
sodev
No

The codegeneration templates and the xml files describing the object properties are out there since wxWidgets 2.8 and most of them dont have been updated for quite some time. wxWidgets is currently at version 3.1, wxFormBuilder itself cannot be compiled with wxWidgets 2.8 anymore, so i have taken the time to review ALL templates and xml files and updated them to wxWidgets 3.1 level. I have taken wxWidgets svn revision 76938 as source.

What i have done in detail:
- Reviewed all style flags, removed old ones, added new ones, renamed from old names to new names
- Reviewed all event types, added new event handlers, removed old ones. I did not add support for the new bind system, i have still to evaluate how its new features can be exposed to wxFormBuilder.
- Updated almost all help messages related to style flags and event handlers to the wording of the wxWidgets documentation
- I did not add any new controls or checked if additional parameters should be added to existing ones except i updated wxButton to support bitmaps now, wxButton is pretty much identical to wxBitmapButton now, but i kept wxBitmapButton for backward compatibility
- Updated font parameters (family, style, weight) to use the new names, this way generated code doesn't cause deprecated warnings anymore. I also updated the wxFormBuilder code itself to use the new names so compilation of wxFormBuilder also doesn't cause these warnings anymore.
- All these changes are implemented for ALL supported generation languages, including XRC, and of course the preview inside wxFormBuilder
- Updated project file version to 1.14 and implemented upgrading from the previous version

Because the codegeneration templates and the xml files had mixed whitespace and non uniform identation and because i had to edit them i took the chance to reformat every template and xml file. I have used the most commonly used style for each, that is tab inside the templates and space inside the xml files. This causes a lot of differences in the patch file but it was just too much work to seperate the whitespace changes from the functional changes.

All these changes are contained in the attached file codegen_wx31.patch.

Additionally i changed the codegeneration to use the static box of a wxStaticBoxSizer as parent for its children. However, like with the highlight patch for the designer, this was not easy and might have some side effects, therefor i made an extra patch for this, codegen_wx31_sbox.patch, this patch does not rely on the other one.

Basically the #wxparent search function now stops at a wxStaticBoxSizer and returns it, the following code generates the method call to return its static box. Usually the #wxparent macro is just used to get the name of the parent to use it as parent for the created element, but there is another case when it can be used, to extract parameters of it. This seems to be used only for the #ifnull and the like macros and it might be an issue that these return the wxStaticBoxSizer object now that isnt even a wxWindow. However the wxStaticBox is not part of the wxFormBuilder object hierarchy so there cannot be done much else. I analysed all generator templates and none seems to use #wxparent in a way that causes such a problem.

I am also not familiar with other generation languages than c++ so the method call to get the static box of the sizer might be wrong for these, but it looks pretty much like other code that gets generated for these languages :).

2 Attachments

Discussion

  • Michal Bližňák

    Thank you for the huge patch! Unforunatelly, it introduces some really big changes which IMHO could break backward compatibility of generated code with wx2.8 so I have to discus it with the other "core" developers prior to apply it. The problem is that some people (including me) still use both wx2.8 and wx3.0 and want to use the same GUI builder for both versions.

     
  • Michal Bližňák

    Code generation for wxStaticBoxSizer is fixed in wxFB 3.5.1 rev 2192. The rest of the patch will be used in upcoming wxFB 4.0.

     
  • Michal Bližňák

    • status: open --> pending