Author Topic: Image field in wxImagePanel wxSmith tools  (Read 2002 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5212
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Image field in wxImagePanel wxSmith tools
« Reply #15 on: November 04, 2018, 03:44:35 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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5212
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Image field in wxImagePanel wxSmith tools
« Reply #16 on: November 16, 2018, 03:58:29 pm »
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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5212
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Image field in wxImagePanel wxSmith tools
« Reply #17 on: February 01, 2019, 03:41:15 pm »
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:
Code: [Select]
+    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>"
« Last Edit: February 02, 2019, 02:16:53 am by ollydbg »
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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5212
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Image field in wxImagePanel wxSmith tools
« Reply #18 on: February 11, 2019, 04:46:50 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:
Code: [Select]
+    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.
« Last Edit: February 11, 2019, 07:43:06 am by ollydbg »
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.