Cleanup eeschema save as extra control creation to match pcbnew
This commit is contained in:
parent
639626fda4
commit
0bd39516c4
|
@ -812,16 +812,14 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
|
|||
|
||||
#if wxCHECK_VERSION( 3, 1, 7 )
|
||||
FILEDLG_HOOK_SAVE_PROJECT newProjectHook;
|
||||
bool checkHook = false;
|
||||
#endif
|
||||
|
||||
// Add a "Create a project" checkbox in standalone mode and one isn't loaded
|
||||
if( Kiface().IsSingle() || aSaveAs )
|
||||
{
|
||||
#if wxCHECK_VERSION( 3, 1, 7 )
|
||||
dlg.SetCustomizeHook( newProjectHook );
|
||||
checkHook = true;
|
||||
#else
|
||||
// Add a "Create a project" checkbox in standalone mode and one isn't loaded
|
||||
dlg.SetExtraControlCreator( &LEGACYFILEDLG_SAVE_PROJECT::Create );
|
||||
#endif
|
||||
}
|
||||
|
@ -847,7 +845,7 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
|
|||
}
|
||||
|
||||
#if wxCHECK_VERSION( 3, 1, 7 )
|
||||
if( checkHook )
|
||||
if( newProjectHook.IsAttachedToDialog() )
|
||||
createNewProject = newProjectHook.GetCreateNewProject();
|
||||
#else
|
||||
if( wxWindow* ec = dlg.GetExtraControl() )
|
||||
|
|
|
@ -31,6 +31,8 @@ public:
|
|||
{
|
||||
m_cb = customizer.AddCheckBox( _( "Create a new project for this schematic" ) );
|
||||
m_cb->SetValue( true );
|
||||
|
||||
m_controlsAttached = true;
|
||||
}
|
||||
|
||||
virtual void TransferDataFromCustomControls() override
|
||||
|
@ -41,12 +43,16 @@ public:
|
|||
///< Gets the selected state of the create new project option
|
||||
bool GetCreateNewProject() const { return m_createNewProject; }
|
||||
|
||||
private:
|
||||
bool m_createNewProject;
|
||||
///< Gets if this hook has attached controls to a dialog box
|
||||
bool IsAttachedToDialog() const { return m_controlsAttached; }
|
||||
|
||||
wxFileDialogCheckBox* m_cb;
|
||||
private:
|
||||
bool m_createNewProject = true;
|
||||
bool m_controlsAttached = false;
|
||||
|
||||
wxFileDialogCheckBox* m_cb = nullptr;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS( FILEDLG_HOOK_SAVE_PROJECT );
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue