KeyWorksRW / wxUiEditor

RAD tool used to create and maintain wxWidgets UI elements.
Apache License 2.0
63 stars 7 forks source link

Add m_internal_data and getInternalData() to Node #1337

Closed Randalphwa closed 8 months ago

Randalphwa commented 8 months ago

See PR for description

This PR looks fairly simple, but years from now when I or someone else tries to figure out why Nodes have a std::unique_ptr<std::vector<tt_string>> they might be able to find this PR for when it was added and get an explanation of the rationale.

I have often wished there was a way to store data in a Node that would not get written to the project. For example, once a project is read, it would be really helpful to know if an image file has been changed before the project gets generated, but without having to reread the file. Storing size and/or timedate stamp would solve that problem, but there is no reason to store it in the project file since all image files are read in when the project is loaded.

The issue has always been that sometimes I need to store a size_t, or wxSize, or a string, or something else entirely. There can be thousands of nodes in a project, so adding more members to every single node is not a good idea. All project data is stored as strings no matter what it is used for, so we're already using strings to store non-string data. Adding a vector of strings might be inefficient for storing data, but is the most flexible way to store unknown data types.