KeyWorksRW / wxUiEditor

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

Overhaul EmbeddedImage structure #1433

Open KeyWorksRW opened 7 months ago

KeyWorksRW commented 7 months ago

Description:

There's an issue with the auto-add setting of Image lists where only the first image of a multiple-image bundle is being added. In looking at the code for this, I'm thinking that the mechanism we used for storing bundles could use a significant overhaul.

Currently, ImageHandler contains arrays of images, bundles and EmbeddedImage structures. It's a bit confusing that the EmbeddedImage structure only contains the array data for the first file, but nothing for the other files in the bundle. That means that there is no file timestamp for the additional bundle files, and we end up storing a copy of all bundles for as long as a project is loaded.

I'm thinking that it would make more sense to store all the filename information in the EmbeddedImage structure and perhaps to get a bundle on demand from the array_data rather than storing an array of bundles. Generally speaking, we only need those bundles for the Mockup panel and possibly the preview. Loading and storing all of the bundles for the lifetime of a project doesn't really make a lot of sense since for large projects, most of the bundles will never be accessed.

Randalphwa commented 6 months ago

PR #1441 did most of this by removing the cached bundle in the map of ImageBundle structures, and by storing everything needed to create the bundle including any additional resolutions in a new vector of ImageInfo structures stored in each EmbeddedImage structure. The remaining step is to change code generation to use EmbeddedImage instead of ImageBundle.