News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

wxSmith and the Style woes of the future.

Started by ouch, July 28, 2018, 02:55:43 PM

Previous topic - Next topic

ouch

The new trunk version of wxWidgets is changing border style names. I know it's not a release version yet but it's been a pain to work with in the editor so I've attached a patch to fix it for those who are using the trunk version of wxwidgets.

For patches fixing version issues should we use an ifdef wall or are you directly comparing the wxwidgets version in a variable someplace?

ollydbg

Good work!
Hope some wxSmith export would give some advice. ;)
wxSmith should know which wx version does the generated code link to.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

stahta01

Quote from: ollydbg on July 28, 2018, 05:20:17 PM
Good work!
Hope some wxSmith export would give some advice. ;)
wxSmith should know which wx version does the generated code link to.

Assuming it only changes to wxBORDER_* it should work with 2.8.12 which has those defines in wx/defs.h

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

oBFusCATed

Quote from: ouch on July 28, 2018, 02:55:43 PM
For patches fixing version issues should we use an ifdef wall or are you directly comparing the wxwidgets version in a variable someplace?
At the moment wxSmith needs to be able to generate valid wx2.8.12 code. C::B uses it and we're still building for wx2.8.
The best option is to generate something that is available in both versions. If not wxCHECK_VERSION macros should be generated.

How do I test this patch if it generates correct code?
(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!]

ouch

If 2.8 has the new styles defined then it should work regardless right?

And if that is the case why not change all of them across the entire codeblocks file structure.

This patch does just that. It was done with a program that does blind search and replace. I have went through it and removed nonsense things like log and readme changes.

But this should in theory work on all versions of wxWidgets >= 2.8.

oBFusCATed

So many words, but you've failed to tell me how to test your patch.  :-\

p.s. Also how do you compile your wx, because I've compiled against current wx-master and everything builds fine.
(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!]

ouch

#6
It's not that it doesn't compile, it's that you get an assert popup every time an old style is used now. (Except for wxNO_BORDER for some reason)

Testing the patch is easy, before you apply it though. Build codeblocks against the latest trunk of wxwidgets and leave the debug asserts on. (I actually don't touch the settings in setup.h I leave them as default) Go into any codeblocks project with a .wxs layout, click on a control and try to change the border. You will get a bunch of invalid border style assert popups. Your style will also not be applied.

Now apply the patch and rebuild codeblocks, once again go find a project containing a .wxs click on a control and change it's border. The popups will be gone and the control will get the border you selected applied.

The wxsmith generated code/xrc will also have the new style listed instead of the old one as well.

I also believe I saw this popup when certain codeblocks windows get loaded. Although I don't remember which. But if you apply the second patch those will go away too.

oBFusCATed

I can't reproduce this.
What are the compile options of your wx installation?
Are you disabling some compatibility option?
(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!]

ouch

mingw32-make -j6 -f makefile.gcc MONOLITHIC=0 SHARED=0 LDFLAGS="-Wl,--allow-multiple-definition" BUILD=release

my setup.h is attached.

Compiled with:

mingw64: i686-8.1.0-posix-sjlj-rt_v6-rev0 on win 7 pro from a command line batch file.

oBFusCATed

Hm, probably it is something happening only on windows.
Can you post a backtrace from the assert dialog?
(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!]

ouch

#10
Really? what happens if you click two styles at once?

This is the message I get.

Also, is there even any reason to not update all the style tags?

oBFusCATed

Nothing. Just works. My gtk2 theme doesn't draw any boarders, so I have no idea what is the effect.

At the moment I'm investigating if this patch would break loading old wxs files. At the moment I think it will. Also xrc loading should be investigated, too.
(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!]

stahta01

#12
@ouch: I have found it is easier to get the changes to the CB Core applied/accepted without changes to the contrib plugins being part of the first patch. Your luck might very from mine.

Edit: Looking more en-depth at the problem; the wxSmith plugin needs fixed before the CB core.
It would be a good idea to add a feature to change wxs files that are opened with wxSmith to use the new names.
Because otherwise it would be a nightmare doing support for newbie users of wxSmith.

Tim S.


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

oBFusCATed

Quote from: stahta01 on July 29, 2018, 06:41:31 PM
@ouch: I have found it is easier to get the changes to the CB Core applied/accepted without changes to the contrib plugins being part of the first patch. Your luck might very from mine.
The second patch is easier to apply than the first. I don't think here we need a split.

Quote from: stahta01 on July 29, 2018, 06:41:31 PM
Edit: Looking more en-depth at the problem; the wxSmith plugin needs fixed before the CB core.
This is true.

Quote from: stahta01 on July 29, 2018, 06:41:31 PM
It would be a good idea to add a feature to change wxs files that are opened with wxSmith to use the new names.
Because otherwise it would be a nightmare doing support for newbie users of wxSmith.
What do you mean? I think we need a feature which does recreate the source code for all wxs files in a project. This way when wxsmith changes one can update the hole project he/she is working on. Currently wxsmith updates source code only when a file is edited. So the user ends with multiple unrelated changes to the source files.
(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!]

oBFusCATed

Here is a try to preserve old files. Can someone try if it works and probably do a review if I'm doing the correct thing, because I'm pretty new in the wxsmith code.
(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!]