News:

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

Main Menu

PATCH for wxSmith, fixed the min size preview bug

Started by Loaden, April 01, 2010, 11:58:39 AM

Previous topic - Next topic

Loaden

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)

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]

Loaden

Here are test demo.


[attachment deleted by admin]