Commit bb0804ec authored by jean-pierre charras's avatar jean-pierre charras
Browse files

DXF export: fix incorrect export of polygons having thick outline (like...

DXF export: fix incorrect export of polygons having thick outline (like zones): Thick segments of outline were drawn like lines with no thickness.
Fix ( workaround only) crash (Windows only) when a quasi modal frame (like footprint viewer) was called from a dialog (like the component properties dialog in schematic editor).
Very minor other fixes.
parent a1087801
Loading
Loading
Loading
Loading
+26 −5
Original line number Original line Diff line number Diff line
@@ -326,18 +326,39 @@ void DXF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
    if( aCornerList.size() <= 1 )
    if( aCornerList.size() <= 1 )
        return;
        return;


    // Plot outlines with lines (thickness = 0) to define the polygon
    if( aWidth == 0 || aFill )
    {
        MoveTo( aCornerList[0] );
        MoveTo( aCornerList[0] );

        for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
        for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
            LineTo( aCornerList[ii] );
            LineTo( aCornerList[ii] );
    }


    // Close polygon if 'fill' requested
    // Close polygon if 'fill' requested
    unsigned last = aCornerList.size() - 1;

    if( aFill )
    if( aFill )
    {
    {
        unsigned ii = aCornerList.size() - 1;
        if( aCornerList[last] != aCornerList[0] )
        if( aCornerList[ii] != aCornerList[0] )
            LineTo( aCornerList[0] );
            LineTo( aCornerList[0] );
    }
    }

    PenFinish();
    PenFinish();

    // if the polygon outline has thickness, plot outlines with thick segments
    if( aWidth > 0 )
    {
        MoveTo( aCornerList[0] );

        for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
            ThickSegment( aCornerList[ii-1], aCornerList[ii],
                          aWidth, FILLED );

        if( aCornerList[last] != aCornerList[0] )
            ThickSegment( aCornerList[last], aCornerList[0],
                          aWidth, FILLED );
    }
}
}




+4 −4
Original line number Original line Diff line number Diff line
@@ -59,7 +59,7 @@ static const wxFileTypeInfo EDAfallbacks[] =
};
};




bool GetAssociatedDocument( wxFrame* aFrame,
bool GetAssociatedDocument( wxWindow* aParent,
                            const wxString& aDocName,
                            const wxString& aDocName,
                            const wxPathList* aPaths)
                            const wxPathList* aPaths)


@@ -122,7 +122,7 @@ bool GetAssociatedDocument( wxFrame* aFrame,
                                         fullfilename,
                                         fullfilename,
                                         extension,
                                         extension,
                                         mask,
                                         mask,
                                         aFrame,
                                         aParent,
                                         wxFD_OPEN,
                                         wxFD_OPEN,
                                         true,
                                         true,
                                         wxPoint( -1, -1 ) );
                                         wxPoint( -1, -1 ) );
@@ -133,7 +133,7 @@ bool GetAssociatedDocument( wxFrame* aFrame,
    if( !wxFileExists( fullfilename ) )
    if( !wxFileExists( fullfilename ) )
    {
    {
        msg.Printf( _( "Doc File '%s' not found" ), GetChars( aDocName ) );
        msg.Printf( _( "Doc File '%s' not found" ), GetChars( aDocName ) );
        DisplayError( aFrame, msg );
        DisplayError( aParent, msg );
        return false;
        return false;
    }
    }


@@ -176,7 +176,7 @@ bool GetAssociatedDocument( wxFrame* aFrame,
    if( !success )
    if( !success )
    {
    {
        msg.Printf( _( "Unknown MIME type for doc file <%s>" ), GetChars( fullfilename ) );
        msg.Printf( _( "Unknown MIME type for doc file <%s>" ), GetChars( fullfilename ) );
        DisplayError( aFrame, msg );
        DisplayError( aParent, msg );
    }
    }


    return success;
    return success;
+8 −2
Original line number Original line Diff line number Diff line
@@ -141,10 +141,16 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow


bool KIWAY_PLAYER::Destroy()
bool KIWAY_PLAYER::Destroy()
{
{
    // Needed on Windows to leave the modal parent on top with focus
    // Reparent is needed on Windows to leave the modal parent on top with focus
    // However it works only if the caller is a main frame, not a dialog.
    // (application crashes if the new parent is a wxDialog
#ifdef __WINDOWS__
#ifdef __WINDOWS__
    if( m_modal_resultant_parent && GetParent() != m_modal_resultant_parent )
    if( m_modal_resultant_parent && GetParent() != m_modal_resultant_parent )
    {
        EDA_BASE_FRAME* parent = dynamic_cast<EDA_BASE_FRAME*>(m_modal_resultant_parent);
        if( parent )
            Reparent( m_modal_resultant_parent );
            Reparent( m_modal_resultant_parent );
    }
#endif
#endif


    return EDA_BASE_FRAME::Destroy();
    return EDA_BASE_FRAME::Destroy();
+3 −2
Original line number Original line Diff line number Diff line
@@ -37,8 +37,9 @@ END_EVENT_TABLE()




EDA_MSG_PANEL::EDA_MSG_PANEL( wxWindow* aParent, int aId,
EDA_MSG_PANEL::EDA_MSG_PANEL( wxWindow* aParent, int aId,
                              const wxPoint& aPosition, const wxSize& aSize ) :
                              const wxPoint& aPosition, const wxSize& aSize,
    wxPanel( aParent, aId, aPosition, aSize )
                              long style, const wxString &name ) :
    wxPanel( aParent, aId, aPosition, aSize, style, name )
{
{
    SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) );
    SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) );
    SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
    SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
+0 −1
Original line number Original line Diff line number Diff line
@@ -39,7 +39,6 @@
#include <msgpanel.h>
#include <msgpanel.h>


#include <general.h>
#include <general.h>
#include <protos.h>
#include <class_library.h>
#include <class_library.h>
#include <sch_component.h>
#include <sch_component.h>
#include <libeditframe.h>
#include <libeditframe.h>
Loading