Infobar for slow zone auto-refill.

This commit is contained in:
Jeff Young 2022-11-29 21:08:53 +00:00
parent 0ee7f8e2bd
commit 31eb91e9e5
3 changed files with 43 additions and 2 deletions

View File

@ -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();

View File

@ -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();

View File

@ -42,7 +42,7 @@
#include "pcb_actions.h"
#include "zone_filler_tool.h"
#include "zone_filler.h"
#include <profile.h>
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<void( wxHyperlinkEvent& aEvent )>(
[this]( wxHyperlinkEvent& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->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();