News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Image field in wxImagePanel wxSmith tools

Started by ollydbg, October 23, 2018, 05:34:54 AM

Previous topic - Next topic

ollydbg

Quote from: oBFusCATed on November 04, 2018, 03:31:33 AM
I'm not following the topic, but please check that old wxs files still work and produce correct code!
OK, I will check it.
In-fact, my patch does not change the way the old wxs does, because the old way of wxImagePanel use an Image ID of the wxImageTool. My patch just add another option when the old way failed, which means there is no such Image ID found in the wxImageTool.
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.

ollydbg

I have confirmed that using the old way(first add a wxImage tool control, then add a wxImagePanel with the var name of the wxImage) and the new way(with my patch) generate the identical source code.

So, the patch is in trunk now.
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.

ollydbg

#17
Quote from: oBFusCATed on November 04, 2018, 03:31:33 AM
I'm not following the topic, but please check that old wxs files still work and produce correct code!
Today, I found one issue about my changes in rev11510.

I have a wxImagePanel control in wxSmith which is created by C::B 17.12.
The Image field is "<none>".
When I load this wxs file, the latest C::B will complain that there is not file named "<none>", and a MessageBox will shown.
I think I need to handle this special case for the migration.

EDIT:
+    wxBitmap ImagePanel2_bmp = wxBitmap(wxImage(("")));
+    ImagePanel2->SetBitmap(ImagePanel2_bmp);

+    wxBitmap ImagePanel1_bmp = wxBitmap(wxImage(("<none>")));
+    ImagePanel1->SetBitmap(ImagePanel1_bmp);


So, it should not create the above two code snippet if the Image field is empty or "<none>"
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.

ollydbg

#18
Quote from: ollydbg on February 01, 2019, 03:41:15 PM
Quote from: oBFusCATed on November 04, 2018, 03:31:33 AM
I'm not following the topic, but please check that old wxs files still work and produce correct code!
Today, I found one issue about my changes in rev11510.

I have a wxImagePanel control in wxSmith which is created by C::B 17.12.
The Image field is "<none>".
When I load this wxs file, the latest C::B will complain that there is not file named "<none>", and a MessageBox will shown.
I think I need to handle this special case for the migration.

EDIT:
+    wxBitmap ImagePanel2_bmp = wxBitmap(wxImage(("")));
+    ImagePanel2->SetBitmap(ImagePanel2_bmp);

+    wxBitmap ImagePanel1_bmp = wxBitmap(wxImage(("<none>")));
+    ImagePanel1->SetBitmap(ImagePanel1_bmp);


So, it should not create the above two code snippet if the Image field is empty or "<none>"

Fixed in r11569.

EDIT:
and r11570.
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.