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

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
...@@ -326,18 +326,39 @@ void DXF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, ...@@ -326,18 +326,39 @@ void DXF_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
if( aCornerList.size() <= 1 ) if( aCornerList.size() <= 1 )
return; return;
MoveTo( aCornerList[0] ); // Plot outlines with lines (thickness = 0) to define the polygon
for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) if( aWidth == 0 || aFill )
LineTo( aCornerList[ii] ); {
MoveTo( aCornerList[0] );
for( unsigned ii = 1; ii < aCornerList.size(); 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 );
}
} }
......
...@@ -59,7 +59,7 @@ static const wxFileTypeInfo EDAfallbacks[] = ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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;
......
...@@ -141,10 +141,16 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow ...@@ -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 )
Reparent( m_modal_resultant_parent ); {
EDA_BASE_FRAME* parent = dynamic_cast<EDA_BASE_FRAME*>(m_modal_resultant_parent);
if( parent )
Reparent( m_modal_resultant_parent );
}
#endif #endif
return EDA_BASE_FRAME::Destroy(); return EDA_BASE_FRAME::Destroy();
......
...@@ -37,8 +37,9 @@ END_EVENT_TABLE() ...@@ -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 ) );
......
...@@ -39,7 +39,6 @@ ...@@ -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>
......
...@@ -19,13 +19,13 @@ int KeyWordOk( const wxString& aKeyList, const wxString& aDatabase ); ...@@ -19,13 +19,13 @@ int KeyWordOk( const wxString& aKeyList, const wxString& aDatabase );
/** /**
* Function GetAssociatedDocument * Function GetAssociatedDocument
* open a document (file) with the suitable browser * open a document (file) with the suitable browser
* @param aFrame = main frame * @param aParent = main frame
* @param aDocName = filename of file to open (Full filename or short filename) * @param aDocName = filename of file to open (Full filename or short filename)
* if \a aDocName begins with http: or ftp: or www. the default internet browser is launched * if \a aDocName begins with http: or ftp: or www. the default internet browser is launched
* @param aPaths = a wxPathList to explore. * @param aPaths = a wxPathList to explore.
* if NULL or aDocName is a full filename, aPath is not used. * if NULL or aDocName is a full filename, aPath is not used.
*/ */
bool GetAssociatedDocument( wxFrame* aFrame, bool GetAssociatedDocument( wxWindow* aParent,
const wxString& aDocName, const wxString& aDocName,
const wxPathList* aPaths = NULL ); const wxPathList* aPaths = NULL );
......
...@@ -121,7 +121,9 @@ protected: ...@@ -121,7 +121,9 @@ protected:
wxSize computeTextSize( const wxString& text ) const; wxSize computeTextSize( const wxString& text ) const;
public: public:
EDA_MSG_PANEL( wxWindow* aParent, int aId, const wxPoint& aPosition, const wxSize& aSize ); EDA_MSG_PANEL( wxWindow* aParent, int aId,
const wxPoint& aPosition, const wxSize& aSize,
long style=wxTAB_TRAVERSAL, const wxString &name=wxPanelNameStr);
~EDA_MSG_PANEL(); ~EDA_MSG_PANEL();
/** /**
......
...@@ -367,7 +367,13 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -367,7 +367,13 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
// update module in the current board, // update module in the current board,
// not just add it to the board with total disregard for the netlist... // not just add it to the board with total disregard for the netlist...
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, true ); PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
if( pcbframe == NULL ) // happens when the board editor is not active (or closed)
{
wxMessageBox( _("No board currently edited" ) );
break;
}
BOARD* mainpcb = pcbframe->GetBoard(); BOARD* mainpcb = pcbframe->GetBoard();
MODULE* source_module = NULL; MODULE* source_module = NULL;
......
...@@ -208,11 +208,11 @@ TOOL_ACTION COMMON_ACTIONS::layerAlphaDec( "pcbnew.layerAlphaDec", ...@@ -208,11 +208,11 @@ TOOL_ACTION COMMON_ACTIONS::layerAlphaDec( "pcbnew.layerAlphaDec",
// Grid control // Grid control
TOOL_ACTION COMMON_ACTIONS::gridFast1( "pcbnew.gridFast1", TOOL_ACTION COMMON_ACTIONS::gridFast1( "pcbnew.gridFast1",
AS_GLOBAL, MD_ALT + '1', AS_GLOBAL, (int)MD_ALT + '1',
"", "" ); "", "" );
TOOL_ACTION COMMON_ACTIONS::gridFast2( "pcbnew.gridFast2", TOOL_ACTION COMMON_ACTIONS::gridFast2( "pcbnew.gridFast2",
AS_GLOBAL, MD_ALT + '2', AS_GLOBAL, (int)MD_ALT + '2',
"", "" ); "", "" );
TOOL_ACTION COMMON_ACTIONS::gridNext( "pcbnew.gridNext", TOOL_ACTION COMMON_ACTIONS::gridNext( "pcbnew.gridNext",
...@@ -220,7 +220,7 @@ TOOL_ACTION COMMON_ACTIONS::gridNext( "pcbnew.gridNext", ...@@ -220,7 +220,7 @@ TOOL_ACTION COMMON_ACTIONS::gridNext( "pcbnew.gridNext",
"", "" ); "", "" );
TOOL_ACTION COMMON_ACTIONS::gridPrev( "pcbnew.gridPrev", TOOL_ACTION COMMON_ACTIONS::gridPrev( "pcbnew.gridPrev",
AS_GLOBAL, MD_CTRL + '`', AS_GLOBAL, (int)MD_CTRL + '`',
"", "" ); "", "" );
...@@ -248,7 +248,7 @@ TOOL_ACTION COMMON_ACTIONS::resetCoords( "pcbnew.resetCoords", ...@@ -248,7 +248,7 @@ TOOL_ACTION COMMON_ACTIONS::resetCoords( "pcbnew.resetCoords",
"", "" ); "", "" );
TOOL_ACTION COMMON_ACTIONS::switchUnits( "pcbnew.switchUnits", TOOL_ACTION COMMON_ACTIONS::switchUnits( "pcbnew.switchUnits",
AS_GLOBAL, MD_CTRL + 'U', AS_GLOBAL, (int)MD_CTRL + 'U',
"", "" ); "", "" );
TOOL_ACTION COMMON_ACTIONS::showHelp( "pcbnew.showHelp", TOOL_ACTION COMMON_ACTIONS::showHelp( "pcbnew.showHelp",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment