Drc dialog: fix some issues, and mainly the fact the progress bar shown during track tests and zone filling can be sent to the background and the dialog can be closed during tests or the board edited during tests.

Add a minor change in dialog_shim only for OSX. (force raising the dialog).
Very minot other fixes: coverity warnings, better message in debug mode in baord outlines calculations.
This commit is contained in:
jean-pierre charras 2015-07-07 19:49:03 +02:00
parent 351914da9d
commit 169905d26e
6 changed files with 35 additions and 21 deletions

View File

@ -112,6 +112,9 @@ bool DIALOG_SHIM::Show( bool show )
if( show ) if( show )
{ {
ret = wxDialog::Show( show ); ret = wxDialog::Show( show );
#ifdef __WXMAC__
wxDialog::Raise(); // More wxWindows brokenness on OS X
#endif
// classname is key, returns a zeroed out default EDA_RECT if none existed before. // classname is key, returns a zeroed out default EDA_RECT if none existed before.
EDA_RECT r = class_map[ hash_key ]; EDA_RECT r = class_map[ hash_key ];

View File

@ -310,6 +310,12 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed
case SH_RECT: case SH_RECT:
switch( aB->Type() ) switch( aB->Type() )
{ {
case SH_RECT: // RECT to RECT not yet in use in p&s router
// Should be (todo) somethink like:
//return CollCaseReversed<SHAPE_RECT, SHAPE_RECT>( aA, aB, aClearance, aNeedMTV, aMTV );
assert( aB->Type() != SH_RECT );
return true;
case SH_CIRCLE: case SH_CIRCLE:
return CollCase<SHAPE_RECT, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_RECT, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV );

View File

@ -491,7 +491,8 @@ void DRC::testTracks( bool aShowProgressBar )
{ {
progressDialog = new wxProgressDialog( _( "Track clearances" ), wxEmptyString, progressDialog = new wxProgressDialog( _( "Track clearances" ), wxEmptyString,
deltamax, m_mainWindow, deltamax, m_mainWindow,
wxPD_AUTO_HIDE | wxPD_CAN_ABORT ); wxPD_AUTO_HIDE | wxPD_CAN_ABORT |
wxPD_APP_MODAL | wxPD_ELAPSED_TIME );
progressDialog->Update( 0, wxEmptyString ); progressDialog->Update( 0, wxEmptyString );
} }

View File

@ -2115,10 +2115,12 @@ void LEGACY_PLUGIN::loadNETINFO_ITEM()
m_netCodes.resize( netCode+1 ); m_netCodes.resize( netCode+1 );
m_netCodes[netCode] = net->GetNet(); m_netCodes[netCode] = net->GetNet();
net = NULL;
} }
else else
{ {
delete net; delete net;
net = NULL; // Avoid double deletion.
} }
return; // preferred exit return; // preferred exit

View File

@ -1,8 +1,8 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007-2008 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -283,7 +283,7 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, ::PCB_TYPE_COLLECTOR* item
int ndx_min = 0; int ndx_min = 0;
// find the point closest to aPoint and perhaps exactly matching aPoint. // find the point closest to aPoint and perhaps exactly matching aPoint.
for( int i = 0; i<items->GetCount(); ++i ) for( int i = 0; i < items->GetCount(); ++i )
{ {
DRAWSEGMENT* graphic = (DRAWSEGMENT*) (*items)[i]; DRAWSEGMENT* graphic = (DRAWSEGMENT*) (*items)[i];
unsigned d; unsigned d;
@ -345,19 +345,24 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, ::PCB_TYPE_COLLECTOR* item
} }
#if defined(DEBUG) #if defined(DEBUG)
printf( "Unable to find segment matching point (%d,%d)\n", if( items->GetCount() )
aPoint.x, aPoint.y );
for( int i = 0; i< items->GetCount(); ++i )
{ {
DRAWSEGMENT* graphic = (DRAWSEGMENT*) (*items)[i]; printf( "Unable to find segment matching point (%.6g,%.6g) (seg count %d)\n",
IU2um( aPoint.x )/1000, IU2um( aPoint.y )/1000,
items->GetCount());
printf( "type=%s, GetStart()=%d,%d GetEnd()=%d,%d\n", for( int i = 0; i< items->GetCount(); ++i )
TO_UTF8( BOARD_ITEM::ShowShape( (STROKE_T) graphic->GetShape() ) ), {
graphic->GetStart().x, DRAWSEGMENT* graphic = (DRAWSEGMENT*) (*items)[i];
graphic->GetStart().y,
graphic->GetEnd().x, printf( "item %d, type=%s, start=%.6g %.6g end=%.6g,%.6g\n",
graphic->GetEnd().y ); i + 1,
TO_UTF8( BOARD_ITEM::ShowShape( (STROKE_T) graphic->GetShape() ) ),
IU2um( graphic->GetStart().x )/1000,
IU2um( graphic->GetStart().y )/1000,
IU2um( graphic->GetEnd().x )/1000,
IU2um( graphic->GetEnd().y )/1000 );
}
} }
#endif #endif
@ -924,14 +929,9 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary )
for( int i = 0; i<items.GetCount(); ) for( int i = 0; i<items.GetCount(); )
{ {
if( items[i]->GetLayer() != Edge_Cuts ) if( items[i]->GetLayer() != Edge_Cuts )
{
items.Remove( i ); items.Remove( i );
}
else // remove graphics not on Edge_Cuts layer else // remove graphics not on Edge_Cuts layer
{
DBG( items[i]->Show( 0, std::cout );)
++i; ++i;
}
} }
if( items.GetCount() ) if( items.GetCount() )

View File

@ -135,10 +135,12 @@ int PCB_EDIT_FRAME::Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose )
// Create a message with a long net name, and build a wxProgressDialog // Create a message with a long net name, and build a wxProgressDialog
// with a correct size to show this long net name // with a correct size to show this long net name
msg.Printf( FORMAT_STRING, 000, areaCount, wxT("XXXXXXXXXXXXXXXXX" ) ); msg.Printf( FORMAT_STRING, 000, areaCount, wxT("XXXXXXXXXXXXXXXXX" ) );
if( aActiveWindow ) if( aActiveWindow )
progressDialog = new wxProgressDialog( _( "Fill All Zones" ), msg, progressDialog = new wxProgressDialog( _( "Fill All Zones" ), msg,
areaCount+2, aActiveWindow, areaCount+2, aActiveWindow,
wxPD_AUTO_HIDE | wxPD_CAN_ABORT ); wxPD_AUTO_HIDE | wxPD_CAN_ABORT |
wxPD_APP_MODAL | wxPD_ELAPSED_TIME );
// Display the actual message // Display the actual message
if( progressDialog ) if( progressDialog )
progressDialog->Update( 0, _( "Starting zone fill..." ) ); progressDialog->Update( 0, _( "Starting zone fill..." ) );