Browse Source

Set dirty bit and handle undo for export remap

When remapping the exported symbols, we should keep this in the undo
stack (remapping, not the existence of the new elements) and set the
dirty bit for the file to ensure it is saved/autosaved

Fixes https://gitlab.com/kicad/code/kicad/issues/13493
7.0
Seth Hillbrand 3 years ago
parent
commit
8aff923710
  1. 9
      eeschema/tools/sch_editor_control.cpp

9
eeschema/tools/sch_editor_control.cpp

@ -413,6 +413,7 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
return 0;
bool map = IsOK( m_frame, _( "Update symbols in schematic to refer to new library?" ) );
bool append = false;
SYMBOL_LIB_TABLE_ROW* row = mgr.GetLibrary( targetLib );
SCH_IO_MGR::SCH_FILE_T type = SCH_IO_MGR::EnumFromStr( row->GetType() );
@ -433,11 +434,19 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
LIB_ID id = it.first;
id.SetLibNickname( targetLib );
for( SCH_SYMBOL* symbol : symbolMap[it.first] )
{
m_frame->SaveCopyInUndoList( m_frame->GetScreen(), symbol, UNDO_REDO::CHANGED, append, false);
symbol->SetLibId( id );
append = true;
}
}
}
if( append )
m_frame->OnModify();
return 0;
}

Loading…
Cancel
Save