Eeschema: fix incorrect undo behavior after a component edition using the dialog frame (some changes were not undoable).
Fix incorrect behavior after unit selection using the popup menu, and add undo command after this change (was non undoable)
This commit is contained in:
parent
a9a96c0e51
commit
20efe4f6dc
|
@ -228,12 +228,12 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
|
|||
if( !copyPanelToSelectedField() )
|
||||
return;
|
||||
|
||||
copyPanelToOptions();
|
||||
|
||||
// save old cmp in undo list if not already in edit, or moving ...
|
||||
if( m_Cmp->m_Flags == 0 )
|
||||
m_Parent->SaveCopyInUndoList( m_Cmp, UR_CHANGED );
|
||||
|
||||
copyPanelToOptions();
|
||||
|
||||
// change all field positions from relative to absolute
|
||||
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
|
||||
{
|
||||
|
|
|
@ -339,7 +339,11 @@ void SCH_EDIT_FRAME::SelPartUnit( SCH_COMPONENT* DrawComponent, int unit, wxDC*
|
|||
if( unit > m_UnitCount )
|
||||
unit = m_UnitCount;
|
||||
|
||||
if( DrawComponent->m_Flags )
|
||||
int curr_flg = DrawComponent->m_Flags;
|
||||
if( ! curr_flg ) // No command in progress: save in undo list
|
||||
SaveCopyInUndoList( DrawComponent, UR_CHANGED );
|
||||
|
||||
if( curr_flg )
|
||||
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
|
||||
else
|
||||
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
|
||||
|
@ -347,6 +351,7 @@ void SCH_EDIT_FRAME::SelPartUnit( SCH_COMPONENT* DrawComponent, int unit, wxDC*
|
|||
/* Update the unit number. */
|
||||
DrawComponent->SetUnitSelection( GetSheet(), unit );
|
||||
DrawComponent->SetUnit( unit );
|
||||
DrawComponent->m_Flags = curr_flg; // Restore m_Flag modified by SetUnit();
|
||||
|
||||
/* Redraw the component in the new position. */
|
||||
if( DrawComponent->m_Flags )
|
||||
|
|
|
@ -311,9 +311,14 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
|
|||
for( ii = 0; ii < libComponent->GetPartCount(); ii++ )
|
||||
{
|
||||
wxString num_unit;
|
||||
int unit = Component->GetUnit();
|
||||
num_unit.Printf( _( "Unit %d %c" ), ii + 1,
|
||||
"?ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ ii + 1 ] );
|
||||
sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii, num_unit );
|
||||
wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
|
||||
num_unit, wxEmptyString,
|
||||
wxITEM_CHECK );
|
||||
if( unit == ii + 1 )
|
||||
item->Check(true);
|
||||
}
|
||||
|
||||
ADD_MENUITEM_WITH_SUBMENU( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP,
|
||||
|
|
Loading…
Reference in New Issue