Eeschema, eeschema_config.cpp: fix incorrect *.wks file path when trying to save it.
And add tests to see if the file can be saved Fix also an issue in sch_editor_control.cpp: The page setup dlg must generate changes only if the OK button is clicked. Fixes #13599 https://gitlab.com/kicad/code/kicad/issues/13599
This commit is contained in:
parent
e900e472ce
commit
9c12a6ee1d
|
@ -130,22 +130,26 @@ void SCH_EDIT_FRAME::SaveProjectSettings()
|
|||
|
||||
RecordERCExclusions();
|
||||
|
||||
|
||||
// Save the page layout file if doesn't exist yet (e.g. if we opened a non-kicad schematic)
|
||||
|
||||
// TODO: We need to remove dependence on BASE_SCREEN
|
||||
Prj().GetProjectFile().m_SchematicSettings->m_SchDrawingSheetFileName = BASE_SCREEN::m_DrawingSheetFileName;
|
||||
Prj().GetProjectFile().m_SchematicSettings->m_SchDrawingSheetFileName
|
||||
= BASE_SCREEN::m_DrawingSheetFileName;
|
||||
|
||||
if( !BASE_SCREEN::m_DrawingSheetFileName.IsEmpty() )
|
||||
{
|
||||
// Save the page layout file if doesn't exist yet (e.g. if we opened a non-kicad schematic)
|
||||
|
||||
wxFileName layoutfn( BASE_SCREEN::m_DrawingSheetFileName );
|
||||
|
||||
if( !layoutfn.IsAbsolute() )
|
||||
layoutfn = wxFileName( Prj().GetProjectPath(), BASE_SCREEN::m_DrawingSheetFileName );
|
||||
bool success = true;
|
||||
|
||||
if( !layoutfn.FileExists() )
|
||||
if( !layoutfn.IsAbsolute() )
|
||||
success = layoutfn.MakeAbsolute( Prj().GetProjectPath() );
|
||||
|
||||
if( success && layoutfn.IsOk() && !layoutfn.FileExists() )
|
||||
{
|
||||
layoutfn.MakeAbsolute();
|
||||
DS_DATA_MODEL::GetTheInstance().Save( layoutfn.GetFullPath() );
|
||||
if( layoutfn.DirExists() && layoutfn.IsDirWritable() )
|
||||
DS_DATA_MODEL::GetTheInstance().Save( layoutfn.GetFullPath() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ int SCH_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent )
|
|||
MAX_PAGE_SIZE_EESCHEMA_MILS ) );
|
||||
dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName );
|
||||
|
||||
if( dlg.ShowModal() )
|
||||
if( dlg.ShowModal() == wxID_OK )
|
||||
{
|
||||
// Update text variables
|
||||
m_frame->GetCanvas()->GetView()->MarkDirty();
|
||||
|
|
Loading…
Reference in New Issue