Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: ollydbg on May 24, 2023, 12:55:12 pm

Title: Some feature request about wxSmith on generating the code
Post by: ollydbg on May 24, 2023, 12:55:12 pm
wxMathPlot (https://github.com/GitHubLionel/wxMathPlot)

This is an improved wxMathPlot which has many good features, such as track the points(around the mouse), magnet cross lines, more powerful context menu and config dialog to tweak the plot.

In-fact, I have helped to improve this control, and when discussed with the author, he has some feature request:

https://github.com/GitHubLionel/wxMathPlot/issues/13#issuecomment-1560538840

Mainly:


Quote
    the ability (with a checkbox in the IDE) to avoid the creation of the name of the widget (suppress all the long list of wxNewId())
    the creation of an array of string for the wxChoice widget
    the use of Bind in place of Connect
    an user code for i18n string. Default code is _("string") but if you have your own function, you wish could replace it by another thing (for example _myI18N("string")).

Any ideas, and hopefully we can fix some of them.
Title: Re: Some feature request about wxSmith on generating the code
Post by: Miguel Gimenez on May 24, 2023, 02:13:49 pm
Generation of Bind() vs Connect() would be desirable, currently GCC emits a warning on every Connect() due to incorrect type for the wxObjectEventFunction parameter. This warnings appear when you activate -Wextra.

For the rest, I do not see the need:
  - wxChoice already allows entering an array of strings, and you can use the "Extra code" property for more advanced usage.
  - The custom string for translation makes little sense, the .POT files should be modified to recognize the custom string for no advantage.
  - Removal of the name of the widget may reduce code size, but I see no other advantage

wxNewId() is deprecated, but it is difficult to replace.
Title: Re: Some feature request about wxSmith on generating the code
Post by: ollydbg on May 24, 2023, 02:33:23 pm
Generation of Bind() vs Connect() would be desirable, currently GCC emits a warning on every Connect() due to incorrect type for the wxObjectEventFunction parameter. This warnings appear when you activate -Wextra.

Yes, the author of wxMathPlot also saw this issue in his IDE, see his github issue comment: https://github.com/GitHubLionel/wxMathPlot/issues/2#issuecomment-1348985032  and  https://github.com/GitHubLionel/wxMathPlot/issues/12#issuecomment-1554172051



Quote

For the rest, I do not see the need:
  - wxChoice already allows entering an array of strings, and you can use the "Extra code" property for more advanced usage.
  - The custom string for translation makes little sense, the .POT files should be modified to recognize the custom string for no advantage.
  - Removal of the name of the widget may reduce code size, but I see no other advantage

wxNewId() is deprecated, but it is difficult to replace.

OK, I see.
Title: Re: Some feature request about wxSmith on generating the code
Post by: Miguel Gimenez on May 24, 2023, 05:24:24 pm
The Connect() calls are generated inside wxsEvents::GenerateBindingCode() and the change to Bind() looks straightforward, but IMHO this is not the best moment for doing this.
Title: Re: Some feature request about wxSmith on generating the code
Post by: Miguel Gimenez on May 25, 2023, 10:42:02 am
Now wxSmith allows generation of Bind() instead of Connect() changing a setting.
Title: Re: Some feature request about wxSmith on generating the code
Post by: ollydbg on May 25, 2023, 12:52:19 pm
Now wxSmith allows generation of Bind() instead of Connect() changing a setting.

Thanks, let me building the new C::B right now.
Title: Re: Some feature request about wxSmith on generating the code
Post by: ollydbg on May 25, 2023, 01:31:57 pm
Good work! I just build the latest svn Code::Blocks, and the generating of "Bind" function call works fine, thanks!
Title: Re: Some feature request about wxSmith on generating the code
Post by: ollydbg on May 30, 2023, 09:21:12 am
Hi, the author of wxMathPlot library has built C::B himself, and he modify the wxSmith code, and it can have the features he needed.

See here:
https://github.com/GitHubLionel/wxSmith/tree/main/src

And you can see the generated code here:
Change Items array for wxChoice (https://github.com/GitHubLionel/wxMathPlot/commit/bec09c323f54e22e9c3891e8d949fa8640e9aad7)

I guess we can incorporate his contribution?

See the discussion here: code with new wxSmith Issue #14 GitHubLionel/wxMathPlot (https://github.com/GitHubLionel/wxMathPlot/issues/14)