Menu

#1473 wxSmith which supports generating empty IDs(from github GitHubLionel)

Next_Nightly
applied
wxSmith (62)
Patch
2024-06-05
2024-05-10
ollydbg
No

GitHubLionel from github has a repo for the modification to wxSmith.

See discussion here:

code with new wxSmith · Issue #14 · GitHubLionel/wxMathPlot

I think this is a nice feature we can use.

If the wxs file was opened by our normal wxSmith plugin, the generated code will be:

-  nbConfig = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
-  Panel1 = new wxPanel(nbConfig, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
+  nbConfig = new wxNotebook(this, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, 0, _T("ID_NOTEBOOK1"));
+  Panel1 = new wxPanel(nbConfig, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));

So, its a nice feature to make the generated code more clean and compact.

1 Attachments

Discussion

  • Miguel Gimenez

    Miguel Gimenez - 2024-05-10

    A patch for the current wxSmith would be nice...

     
  • Miguel Gimenez

    Miguel Gimenez - 2024-05-10

    I have generated one, but it has more changes than expected and some regressions (like changing back nullptr to 0), probably because this changes were made after Lionel got the original code.

     
  • Morten MacFly

    Morten MacFly - 2024-05-12
    • status: open --> pending
    • assigned_to: Morten MacFly
    • Attachments has changed:

    Diff:

    --- old
    +++ new
    @@ -0,0 +1 @@
    +wxsmith.patch (19.7 kB; application/octet-stream)
    
    • Type: Undefined --> Patch
     
  • Morten MacFly

    Morten MacFly - 2024-05-12

    I've created a proper patch against SVN head that acknowledges for the changes done in SVN in the meantime. I will have a look into it... But for the sake of better understanding: What is meant with "empty IDs"? I struggle to understand why this is useful?

     
  • ollydbg

    ollydbg - 2024-05-12

    Hi, morten, "empty IDs" means the wxWidgets controls has all the ID value = wxID_ANY. It does not need to create specific IDs such as ID_NOTEBOOK1, ID_NOTEBOOK2, ID_NOTEBOOK3. This make the generated code small and clean in case that we don't need to use those IDs in the future.

     
    • Morten MacFly

      Morten MacFly - 2024-05-13

      OK, probably a but nut-picking, but isn't that then "unspecific IDs"? Because even wxID_ANY is an ID. Probably its worth renaming the option.

      And having that option enabled globally may require to override this in some controls where you may need the ID for some reason. OK for now - but I would love to see the override function, too - just to make it complete.

       
  • Morten MacFly

    Morten MacFly - 2024-05-21
    • status: pending --> applied
    • Milestone: Undefined --> Next_Nightly
     
  • Morten MacFly

    Morten MacFly - 2024-05-21

    Seems to do what it should do. Therefore, applied in SVN [r13522] . Thank you!

     

    Related

    Commit: [r13522]

  • ollydbg

    ollydbg - 2024-06-05

    Hi, guys, this patch is nice, and now in our trunk, but when I'm trying to remove all the IDs from the wxSmith, I see that I can't remove them from menu items. But a quick test shows it could.

    See my comments here:

    https://github.com/GitHubLionel/wxMathPlot/issues/14#issuecomment-2149200427

    Any ideas?

    Thanks.

     

Log in to post a comment.

MongoDB Logo MongoDB