Drc dialog, progress bar: fix issue on OSX.

This commit is contained in:
unknown 2015-07-08 09:33:11 +02:00 committed by jean-pierre charras
parent 169905d26e
commit fa9727b3e3
4 changed files with 20 additions and 64 deletions

View File

@ -5,9 +5,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -77,10 +77,6 @@ void DIALOG_DRC_CONTROL::InitValues()
m_DeleteCurrentMarkerButton->Enable( false );
/* this looks terrible! does not fit into text field, do it in wxformbuilder instead
m_SetClearance->SetValue( _("Netclasses values"));
*/
Layout(); // adding the units above expanded Clearance text, now resize.
// Set the initial "enabled" status of the browse button and the text
@ -89,10 +85,6 @@ void DIALOG_DRC_CONTROL::InitValues()
OnReportCheckBoxClicked( junk );
SetFocus();
// deselect the existing text, seems SetFocus() wants to emulate
// Microsoft and select all text, which is not desireable here.
// m_SetClearance->SetSelection(0,0);
}
/* accept DRC parameters (min clearance value and min sizes
@ -107,10 +99,6 @@ void DIALOG_DRC_CONTROL::SetDrcParmeters( )
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DRC_RUN
*/
void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
{
wxString reportName;
@ -146,11 +134,7 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
m_tester->m_pcb->m_Status_Pcb = 0; // Force full connectivity and ratsnest recalculations
m_tester->RunTests(m_Messages);
#if wxCHECK_VERSION( 2, 8, 0 )
m_Notebook->ChangeSelection( 0 ); // display the 1at tab "...Markers ..."
#else
m_Notebook->SetSelection( 0 ); // display the 1at tab "... Markers..."
#endif
// Generate the report
@ -175,10 +159,6 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS
*/
void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& event )
{
DelDRCMarkers();
@ -186,10 +166,6 @@ void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& event )
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED_PADS
*/
void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
{
wxString reportName;
@ -222,11 +198,7 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
m_Messages->Clear();
m_tester->ListUnconnectedPads();
#if wxCHECK_VERSION( 2, 8, 0 )
m_Notebook->ChangeSelection( 1 ); // display the 2nd tab "Unconnected..."
#else
m_Notebook->SetSelection( 1 ); // display the 2nd tab "Unconnected..."
#endif
// Generate the report
if( !reportName.IsEmpty() )
@ -274,10 +246,6 @@ void DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick( wxCommandEvent& event )
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void DIALOG_DRC_CONTROL::OnOkClick( wxCommandEvent& event )
{
SetReturnCode( wxID_OK );
@ -287,10 +255,6 @@ void DIALOG_DRC_CONTROL::OnOkClick( wxCommandEvent& event )
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
{
SetReturnCode( wxID_CANCEL );
@ -318,10 +282,6 @@ void DIALOG_DRC_CONTROL::OnReportCheckBoxClicked( wxCommandEvent& event )
}
/*!
* wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST
*/
void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
{
event.Skip();
@ -404,10 +364,6 @@ void DIALOG_DRC_CONTROL::OnPopupMenu( wxCommandEvent& event )
}
/*!
* wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
*/
void DIALOG_DRC_CONTROL::OnRightUpUnconnected( wxMouseEvent& event )
{
event.Skip();
@ -436,10 +392,6 @@ void DIALOG_DRC_CONTROL::OnRightUpUnconnected( wxMouseEvent& event )
}
/*!
* wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
*/
void DIALOG_DRC_CONTROL::OnRightUpClearance( wxMouseEvent& event )
{
event.Skip();
@ -468,10 +420,6 @@ void DIALOG_DRC_CONTROL::OnRightUpClearance( wxMouseEvent& event )
}
/*!
* wxEVT_LEFT_DCLICK event handler for ID_UNCONNECTED_LIST
*/
void DIALOG_DRC_CONTROL::OnLeftDClickUnconnected( wxMouseEvent& event )
{
event.Skip();
@ -600,10 +548,6 @@ void DIALOG_DRC_CONTROL::writeReport( FILE* fp )
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE
*/
void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& event )
{
int selectedIndex;

View File

@ -220,7 +220,7 @@ void DRC::RunTests( wxTextCtrl* aMessages )
wxSafeYield();
}
testTracks( true );
testTracks( aMessages ? aMessages->GetParent() : m_mainWindow, true );
// Before testing segments and unconnected, refill all zones:
// this is a good caution, because filled areas can be outdated.
@ -476,7 +476,7 @@ void DRC::testPad2Pad()
}
void DRC::testTracks( bool aShowProgressBar )
void DRC::testTracks( wxWindow *aActiveWindow, bool aShowProgressBar )
{
wxProgressDialog * progressDialog = NULL;
const int delta = 500; // This is the number of tests between 2 calls to the
@ -490,7 +490,7 @@ void DRC::testTracks( bool aShowProgressBar )
if( aShowProgressBar && deltamax > 3 )
{
progressDialog = new wxProgressDialog( _( "Track clearances" ), wxEmptyString,
deltamax, m_mainWindow,
deltamax, aActiveWindow,
wxPD_AUTO_HIDE | wxPD_CAN_ABORT |
wxPD_APP_MODAL | wxPD_ELAPSED_TIME );
progressDialog->Update( 0, wxEmptyString );
@ -510,6 +510,11 @@ void DRC::testTracks( bool aShowProgressBar )
{
if( !progressDialog->Update( count, wxEmptyString ) )
break; // Aborted by user
#ifdef __WXMAC__
// Work around a dialog z-order issue on OS X
if( count == deltamax )
aActiveWindow->Raise();
#endif
}
}

View File

@ -271,10 +271,11 @@ private:
* Function testTracks
* performs the DRC on all tracks.
* because this test can take a while, a progress bar can be displayed
* @param aShowProgressBar = true to show a progrsse bar
* @param aActiveWindow = the active window ued as parent for the progress bar
* @param aShowProgressBar = true to show a progress bar
* (Note: it is shown only if there are many tracks)
*/
void testTracks( bool aShowProgressBar );
void testTracks( wxWindow * aActiveWindow, bool aShowProgressBar );
void testPad2Pad();

View File

@ -171,7 +171,13 @@ int PCB_EDIT_FRAME::Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose )
}
if( progressDialog )
{
progressDialog->Update( ii+2, _( "Updating ratsnest..." ) );
#ifdef __WXMAC__
// Work around a dialog z-order issue on OS X
aActiveWindow->Raise();
#endif
}
TestConnections();
// Recalculate the active ratsnest, i.e. the unconnected links