164 m_providers.push_back( std::make_unique<STARTWIZARD_PROVIDER_SETTINGS>() );
165 m_providers.push_back( std::make_unique<STARTWIZARD_PROVIDER_LIBRARIES>() );
166 m_providers.push_back( std::make_unique<STARTWIZARD_PROVIDER_PRIVACY>() );
172 bool wizardRequired = std::ranges::any_of( std::as_const(
m_providers ),
173 [](
const std::unique_ptr<STARTWIZARD_PROVIDER>& aProvider ) ->
bool
175 return aProvider->NeedsUserInput();
178 if( !wizardRequired )
185 wxLog::FlushActive();
187 m_wizard =
new wxWizard( aParent, wxID_ANY,
_(
"KiCad Setup" ) );
188 m_wizard->SetWindowStyleFlag( wxRESIZE_BORDER );
191 wxWizardPageSimple* lastPage =
nullptr;
194 for( std::unique_ptr<STARTWIZARD_PROVIDER>& provider :
m_providers )
196 if( !provider->NeedsUserInput() )
199 provider->SetWasShown(
true );
202 wxPanel* panel = provider->GetWizardPanel( page->
GetContentParent(),
this );
205 if( lastPage !=
nullptr )
207 lastPage->Chain( page );
211 firstPage->Chain( page );
218 if( size.x > minPageSize.x )
219 minPageSize.x = size.x;
221 if( size.y > minPageSize.y )
222 minPageSize.y = size.y;
228 static constexpr int WIZARD_CHROME_HEIGHT = 120;
229 static constexpr int WIZARD_MARGIN = 40;
231 wxSize pageSize = minPageSize + wxSize( 20, 20 );
233 int displayIdx = wxDisplay::GetFromWindow( aParent ? aParent : wxTheApp->GetTopWindow() );
235 if( displayIdx == wxNOT_FOUND )
238 wxRect displayArea = wxDisplay( (
unsigned int) displayIdx ).GetClientArea();
239 int maxPageHeight = displayArea.GetHeight() - WIZARD_CHROME_HEIGHT - WIZARD_MARGIN;
241 if( maxPageHeight > 0 && pageSize.y > maxPageHeight )
242 pageSize.y = maxPageHeight;
245 firstPage->
SetWrap( pageSize.x );
247 m_wizard->Bind( wxEVT_WIZARD_CANCEL,
248 [&]( wxWizardEvent& aEvt )
250 if(
IsOK( aParent,
_(
"Are you sure? If you cancel KiCad setup, default settings "
251 "will be chosen for you." ) ) )
253 for( std::unique_ptr<STARTWIZARD_PROVIDER>& provider :
m_providers )
255 provider->ApplyDefaults();
266 if(
m_wizard->RunWizard( firstPage ) )
268 for( std::unique_ptr<STARTWIZARD_PROVIDER>& provider :
m_providers )
270 if( !provider->WasShown() )
282 if(
Pgm().GetSelectedLanguageIdentifier() != languageBefore && aParent )
291 wxCommandEvent e( EDA_LANG_CHANGED );
STARTWIZARD_PAGE(wxWizard *aParent, const wxString &aPageTitle)
wxScrolledWindow * m_scrolledWindow
void AddContent(wxPanel *aContent)
wxSize GetContentMinSize() const
wxWindow * GetContentParent() const
void SetWrap(int aWidth) const
wxStaticText * m_welcomeText
STARTWIZARD_WELCOME_PAGE(wxWizard *aParent)