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,
if( aCornerList.size() <= 1 )
return;
MoveTo( aCornerList[0] );
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
LineTo( aCornerList[ii] );
// Plot outlines with lines (thickness = 0) to define the polygon
if( aWidth == 0 || aFill )
{
MoveTo( aCornerList[0] );
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
LineTo( aCornerList[ii] );
}
// Close polygon if 'fill' requested
unsigned last = aCornerList.size() - 1;
if( aFill )
{
unsigned ii = aCornerList.size() - 1;
if( aCornerList[ii] != aCornerList[0] )
if( aCornerList[last] != aCornerList[0] )
LineTo( aCornerList[0] );
}
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[] =
};
bool GetAssociatedDocument( wxFrame* aFrame,
bool GetAssociatedDocument( wxWindow* aParent,
const wxString& aDocName,
const wxPathList* aPaths)
......@@ -122,7 +122,7 @@ bool GetAssociatedDocument( wxFrame* aFrame,
fullfilename,
extension,
mask,
aFrame,
aParent,
wxFD_OPEN,
true,
wxPoint( -1, -1 ) );
......@@ -133,7 +133,7 @@ bool GetAssociatedDocument( wxFrame* aFrame,
if( !wxFileExists( fullfilename ) )
{
msg.Printf( _( "Doc File '%s' not found" ), GetChars( aDocName ) );
DisplayError( aFrame, msg );
DisplayError( aParent, msg );
return false;
}
......@@ -176,7 +176,7 @@ bool GetAssociatedDocument( wxFrame* aFrame,
if( !success )
{
msg.Printf( _( "Unknown MIME type for doc file <%s>" ), GetChars( fullfilename ) );
DisplayError( aFrame, msg );
DisplayError( aParent, msg );
}
return success;
......
......@@ -141,10 +141,16 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow
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__
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
return EDA_BASE_FRAME::Destroy();
......
......@@ -37,8 +37,9 @@ END_EVENT_TABLE()
EDA_MSG_PANEL::EDA_MSG_PANEL( wxWindow* aParent, int aId,
const wxPoint& aPosition, const wxSize& aSize ) :
wxPanel( aParent, aId, aPosition, aSize )
const wxPoint& aPosition, const wxSize& aSize,
long style, const wxString &name ) :
wxPanel( aParent, aId, aPosition, aSize, style, name )
{
SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) );
SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
......
......@@ -39,7 +39,6 @@
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
#include <class_library.h>
#include <sch_component.h>
#include <libeditframe.h>
......
......@@ -19,13 +19,13 @@ int KeyWordOk( const wxString& aKeyList, const wxString& aDatabase );
/**
* Function GetAssociatedDocument
* 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)
* if \a aDocName begins with http: or ftp: or www. the default internet browser is launched
* @param aPaths = a wxPathList to explore.
* if NULL or aDocName is a full filename, aPath is not used.
*/
bool GetAssociatedDocument( wxFrame* aFrame,
bool GetAssociatedDocument( wxWindow* aParent,
const wxString& aDocName,
const wxPathList* aPaths = NULL );
......
......@@ -121,7 +121,9 @@ protected:
wxSize computeTextSize( const wxString& text ) const;
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();
/**
......
......@@ -367,7 +367,13 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
// update module in the current board,
// 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();
MODULE* source_module = NULL;
......
......@@ -208,11 +208,11 @@ TOOL_ACTION COMMON_ACTIONS::layerAlphaDec( "pcbnew.layerAlphaDec",
// Grid control
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",
AS_GLOBAL, MD_ALT + '2',
AS_GLOBAL, (int)MD_ALT + '2',
"", "" );
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",
AS_GLOBAL, MD_CTRL + '`',
AS_GLOBAL, (int)MD_CTRL + '`',
"", "" );
......@@ -248,7 +248,7 @@ TOOL_ACTION COMMON_ACTIONS::resetCoords( "pcbnew.resetCoords",
"", "" );
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",
......
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