minor change when deleting a pad in modedit: the pad is deleted silently
This commit is contained in:
parent
b3f13be336
commit
f6962b6202
|
@ -257,7 +257,14 @@ public:
|
|||
wxDC* DC );
|
||||
|
||||
void AddPad( MODULE* Module, bool draw );
|
||||
void DeletePad( D_PAD* Pad );
|
||||
/** Function DeletePad
|
||||
* Delete the pad aPad.
|
||||
* Refresh the modified screen area
|
||||
* Refresh modified parameters of the parent module (bounding box, last date)
|
||||
* @param aPad = the pad to delete
|
||||
* @param aQuery = true to promt for confirmation, false to delete silently
|
||||
*/
|
||||
void DeletePad( D_PAD* aPad, bool aQuery = true );
|
||||
void StartMovePad( D_PAD* Pad, wxDC* DC );
|
||||
void RotatePad( D_PAD* Pad, wxDC* DC );
|
||||
void PlacePad( D_PAD* Pad, wxDC* DC );
|
||||
|
|
|
@ -118,7 +118,7 @@ void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item )
|
|||
switch( Item->Type() )
|
||||
{
|
||||
case TYPE_PAD:
|
||||
DeletePad( (D_PAD*) Item );
|
||||
DeletePad( (D_PAD*) Item, false );
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE_MODULE:
|
||||
|
|
|
@ -518,7 +518,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_DELETE_PAD:
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
DeletePad( (D_PAD*) GetScreen()->GetCurItem() );
|
||||
DeletePad( (D_PAD*) GetScreen()->GetCurItem(), false );
|
||||
SetCurItem( NULL );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
|
|
@ -116,19 +116,13 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
|
|||
break;
|
||||
|
||||
case ID_MODEDIT_DELETE_ITEM_BUTT:
|
||||
|
||||
// Item in edit, cannot delete it
|
||||
if( DrawStruct && (DrawStruct->m_Flags != 0) )
|
||||
if( DrawStruct == NULL || // No item to delete
|
||||
(DrawStruct->m_Flags != 0) ) // Item in edit, cannot delete it
|
||||
break;
|
||||
DrawStruct = ModeditLocateAndDisplay();
|
||||
if( DrawStruct == NULL || (DrawStruct->m_Flags != 0) )
|
||||
break;
|
||||
if( DrawStruct->Type() != TYPE_MODULE ) //GetBoard()->m_Modules )
|
||||
if( DrawStruct->Type() != TYPE_MODULE ) // Cannot delete the module itself
|
||||
{
|
||||
// Cannot delete the module itself
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
RemoveStruct( DrawStruct );
|
||||
DrawStruct = NULL;
|
||||
SetCurItem( NULL );
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -227,30 +227,36 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
|
|||
}
|
||||
|
||||
|
||||
/* Function to delete the pad. */
|
||||
void WinEDA_BasePcbFrame::DeletePad( D_PAD* Pad )
|
||||
/** Function DeletePad
|
||||
* Delete the pad aPad.
|
||||
* Refresh the modified screen area
|
||||
* Refresh modified parameters of the parent module (bounding box, last date)
|
||||
* @param aPad = the pad to delete
|
||||
* @param aQuery = true to promt for confirmation, false to delete silently
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::DeletePad( D_PAD* aPad, bool aQuery )
|
||||
{
|
||||
MODULE* Module;
|
||||
wxString line;
|
||||
|
||||
if( Pad == NULL )
|
||||
if( aPad == NULL )
|
||||
return;
|
||||
|
||||
Module = (MODULE*) Pad->GetParent();
|
||||
Module = (MODULE*) aPad->GetParent();
|
||||
Module->m_LastEdit_Time = time( NULL );
|
||||
|
||||
line.Printf( _( "Delete Pad (module %s %s) " ),
|
||||
if( aQuery )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Delete Pad (module %s %s) " ),
|
||||
GetChars( Module->m_Reference->m_Text ),
|
||||
GetChars( Module->m_Value->m_Text ) );
|
||||
if( !IsOK( this, line ) )
|
||||
if( !IsOK( this, msg ) )
|
||||
return;
|
||||
}
|
||||
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
|
||||
Pad->DeleteStructure();
|
||||
|
||||
aPad->DeleteStructure();
|
||||
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
|
||||
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
|
||||
OnModify();
|
||||
|
|
Loading…
Reference in New Issue