Author Topic: PATCH for wxSmith, fixed the min size preview bug  (Read 6478 times)

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
PATCH for wxSmith, fixed the min size preview bug
« on: April 01, 2010, 11:58:39 am »
Hi, this patch can fix 'min size' preview bug.
Let me explain this bug.

After applying this patch, if you set a minimum size of the control, you can correct real-time preview!

EDIT:
As you know, when after editing a resource file under wxSmith plugin, you can simply preview it by press the "Show preview" Toolbar buttom.

But there is a bug, when you enable the "min size" properties of a buttom control, the preview size differs from actual editing size. see the image blow. and also, I have supplied a patch to solve the problem,(see the other screen shots)

Code
Index: src/plugins/contrib/wxSmith/wxwidgets/wxsitem.cpp

===================================================================

--- src/plugins/contrib/wxSmith/wxwidgets/wxsitem.cpp (revision 6198)

+++ src/plugins/contrib/wxSmith/wxwidgets/wxsitem.cpp (working copy)

@@ -1045,6 +1045,15 @@

     return Code;
 }
 
+wxSize wxsItem::Size(wxWindow* Parent)
+{
+    const wxSize minSize = GetBaseProps()->m_MinSize.GetSize(Parent);
+    if (minSize != wxDefaultSize)
+        return minSize;
+    else
+        return GetBaseProps()->m_Size.GetSize(Parent);
+}
+
 bool wxsItem::OnMouseDClick(wxWindow* Preview,int PosX,int PosY)
 {
     // Search for first event (skip all categories)
Index: src/plugins/contrib/wxSmith/wxwidgets/wxsitem.h

===================================================================

--- src/plugins/contrib/wxSmith/wxwidgets/wxsitem.h (revision 6198)

+++ src/plugins/contrib/wxSmith/wxwidgets/wxsitem.h (working copy)

@@ -514,7 +514,7 @@

         inline wxPoint Pos(wxWindow* Parent) { return GetBaseProps()->m_Position.GetPosition(Parent); }
 
         /** \brief Easy access to size */
-        inline wxSize Size(wxWindow* Parent) { return GetBaseProps()->m_Size.GetSize(Parent); }
+        wxSize Size(wxWindow* Parent);
 
         /** \brief Easy access to style (can be used directly when generating preview) */
         inline long Style() { return m_BaseProperties.m_StyleSet ? m_BaseProperties.m_StyleSet->GetWxStyle(m_BaseProperties.m_StyleBits,false) : 0; }

[attachment deleted by admin]
« Last Edit: April 05, 2010, 05:05:09 pm by Loaden »

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: The min size BUG fixed for wxSmith
« Reply #1 on: April 01, 2010, 12:00:05 pm »
Here are test demo.


[attachment deleted by admin]