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