Browse Source

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
7.0
jean-pierre charras 3 years ago
parent
commit
9c12a6ee1d
  1. 18
      eeschema/eeschema_config.cpp
  2. 2
      eeschema/tools/sch_editor_control.cpp

18
eeschema/eeschema_config.cpp

@ -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 );
bool success = true;
if( !layoutfn.IsAbsolute() )
layoutfn = wxFileName( Prj().GetProjectPath(), BASE_SCREEN::m_DrawingSheetFileName );
success = layoutfn.MakeAbsolute( Prj().GetProjectPath() );
if( !layoutfn.FileExists() )
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() );
}
}

2
eeschema/tools/sch_editor_control.cpp

@ -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…
Cancel
Save