163 m_providers.push_back( std::make_unique<STARTWIZARD_PROVIDER_SETTINGS>() );
164 m_providers.push_back( std::make_unique<STARTWIZARD_PROVIDER_LIBRARIES>() );
165 m_providers.push_back( std::make_unique<STARTWIZARD_PROVIDER_PRIVACY>() );
171 bool wizardRequired = std::ranges::any_of( std::as_const(
m_providers ),
172 [](
const std::unique_ptr<STARTWIZARD_PROVIDER>& aProvider ) ->
bool
174 return aProvider->NeedsUserInput();
177 if( !wizardRequired )
182 m_wizard =
new wxWizard( aParent, wxID_ANY,
_(
"KiCad Setup" ) );
183 m_wizard->SetWindowStyleFlag( wxRESIZE_BORDER );
186 wxWizardPageSimple* lastPage =
nullptr;
189 for( std::unique_ptr<STARTWIZARD_PROVIDER>& provider :
m_providers )
191 if( !provider->NeedsUserInput() )
194 provider->SetWasShown(
true );
197 wxPanel* panel = provider->GetWizardPanel( page->
GetContentParent(),
this );
200 if( lastPage !=
nullptr )
202 lastPage->Chain( page );
206 firstPage->Chain( page );
213 if( size.x > minPageSize.x )
214 minPageSize.x = size.x;
216 if( size.y > minPageSize.y )
217 minPageSize.y = size.y;
223 static constexpr int WIZARD_CHROME_HEIGHT = 120;
224 static constexpr int WIZARD_MARGIN = 40;
226 wxSize pageSize = minPageSize + wxSize( 20, 20 );
228 int displayIdx = wxDisplay::GetFromWindow( aParent ? aParent : wxTheApp->GetTopWindow() );
230 if( displayIdx == wxNOT_FOUND )
233 wxRect displayArea = wxDisplay( (
unsigned int) displayIdx ).GetClientArea();
234 int maxPageHeight = displayArea.GetHeight() - WIZARD_CHROME_HEIGHT - WIZARD_MARGIN;
236 if( maxPageHeight > 0 && pageSize.y > maxPageHeight )
237 pageSize.y = maxPageHeight;
240 firstPage->
SetWrap( pageSize.x );
242 m_wizard->Bind( wxEVT_WIZARD_CANCEL,
243 [&]( wxWizardEvent& aEvt )
245 if(
IsOK( aParent,
_(
"Are you sure? If you cancel KiCad setup, default settings "
246 "will be chosen for you." ) ) )
248 for( std::unique_ptr<STARTWIZARD_PROVIDER>& provider :
m_providers )
250 provider->ApplyDefaults();
261 if(
m_wizard->RunWizard( firstPage ) )
263 for( std::unique_ptr<STARTWIZARD_PROVIDER>& provider :
m_providers )
265 if( !provider->WasShown() )
277 if(
Pgm().GetSelectedLanguageIdentifier() != languageBefore && aParent )
286 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)