diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 3797435185..6e46ad8e67 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -980,8 +980,16 @@ void EDA_BASE_FRAME::OnKicadAbout( wxCommandEvent& event ) void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event ) { + ShowPreferences( wxEmptyString, wxEmptyString ); +} + + +void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParentPage ) +{ + wxBeginBusyCursor( wxHOURGLASS_CURSOR ); + PAGED_DIALOG dlg( this, _( "Preferences" ), true ); - wxTreebook* book = dlg.GetTreebook(); + wxTreebook* book = dlg.GetTreebook(); PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false ); KIFACE* kiface = nullptr; @@ -1114,6 +1122,11 @@ void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event ) for( int page : expand ) book->ExpandNode( page ); + if( !aStartPage.IsEmpty() ) + dlg.SetInitialPage( aStartPage, aStartParentPage ); + + wxEndBusyCursor(); + if( dlg.ShowModal() == wxID_OK ) { Pgm().GetSettingsManager().Save(); diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h index 53ac0618a9..6d2bef2e7a 100644 --- a/include/eda_base_frame.h +++ b/include/eda_base_frame.h @@ -213,6 +213,12 @@ public: */ void OnPreferences( wxCommandEvent& event ); + /** + * Displays the preferences and settings of all opened editors paged dialog, starting with + * a particular page + */ + void ShowPreferences( wxString aStartPage, wxString aStartParentPage ); + void PrintMsg( const wxString& text ); void CreateInfoBar(); diff --git a/pcbnew/tools/zone_filler_tool.cpp b/pcbnew/tools/zone_filler_tool.cpp index 6cc5692070..28b8630c15 100644 --- a/pcbnew/tools/zone_filler_tool.cpp +++ b/pcbnew/tools/zone_filler_tool.cpp @@ -42,7 +42,7 @@ #include "pcb_actions.h" #include "zone_filler_tool.h" #include "zone_filler.h" - +#include ZONE_FILLER_TOOL::ZONE_FILLER_TOOL() : PCB_TOOL_BASE( "pcbnew.ZoneFiller" ), @@ -207,6 +207,7 @@ int ZONE_FILLER_TOOL::ZoneFillDirty( const TOOL_EVENT& aEvent ) if( m_fillInProgress ) return 0; + unsigned startTime = GetRunningMicroSecs(); m_fillInProgress = true; m_dirtyZoneIDs.clear(); @@ -261,6 +262,27 @@ int ZONE_FILLER_TOOL::ZoneFillDirty( const TOOL_EVENT& aEvent ) board()->BuildConnectivity( reporter.get() ); m_toolMgr->PostEvent( EVENTS::ConnectivityChangedEvent ); + if( GetRunningMicroSecs() - startTime > 1000000 ) + { + WX_INFOBAR* infobar = frame->GetInfoBar(); + + wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, _( "Open Preferences" ), + wxEmptyString ); + + button->Bind( wxEVT_COMMAND_HYPERLINK, std::function( + [this]( wxHyperlinkEvent& aEvent ) + { + getEditFrame()->ShowPreferences( _( "Editing Options" ), + _( "PCB Editor" ) ); + } ) ); + + infobar->RemoveAllButtons(); + infobar->AddButton( button ); + infobar->ShowMessage( _( "Automatic refill of zones can be turned off in Preferences " + "if it becomes too slow." ), + wxICON_INFORMATION ); + } + if( filler.IsDebug() ) frame->UpdateUserInterface();