Commit f6962b62 authored by jean-pierre charras's avatar jean-pierre charras

minor change when deleting a pad in modedit: the pad is deleted silently

parent b3f13be3
...@@ -257,7 +257,14 @@ public: ...@@ -257,7 +257,14 @@ public:
wxDC* DC ); wxDC* DC );
void AddPad( MODULE* Module, bool draw ); 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 StartMovePad( D_PAD* Pad, wxDC* DC );
void RotatePad( D_PAD* Pad, wxDC* DC ); void RotatePad( D_PAD* Pad, wxDC* DC );
void PlacePad( D_PAD* Pad, wxDC* DC ); void PlacePad( D_PAD* Pad, wxDC* DC );
......
...@@ -118,7 +118,7 @@ void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item ) ...@@ -118,7 +118,7 @@ void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item )
switch( Item->Type() ) switch( Item->Type() )
{ {
case TYPE_PAD: case TYPE_PAD:
DeletePad( (D_PAD*) Item ); DeletePad( (D_PAD*) Item, false );
break; break;
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
......
...@@ -518,7 +518,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -518,7 +518,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DELETE_PAD: case ID_POPUP_PCB_DELETE_PAD:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
DeletePad( (D_PAD*) GetScreen()->GetCurItem() ); DeletePad( (D_PAD*) GetScreen()->GetCurItem(), false );
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
......
...@@ -116,19 +116,13 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ), ...@@ -116,19 +116,13 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
break; break;
case ID_MODEDIT_DELETE_ITEM_BUTT: case ID_MODEDIT_DELETE_ITEM_BUTT:
if( DrawStruct == NULL || // No item to delete
// Item in edit, cannot delete it (DrawStruct->m_Flags != 0) ) // Item in edit, cannot delete it
if( DrawStruct && (DrawStruct->m_Flags != 0) )
break;
DrawStruct = ModeditLocateAndDisplay();
if( DrawStruct == NULL || (DrawStruct->m_Flags != 0) )
break; 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 ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
RemoveStruct( DrawStruct ); RemoveStruct( DrawStruct );
DrawStruct = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
} }
break; break;
......
...@@ -227,30 +227,36 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw ) ...@@ -227,30 +227,36 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
} }
/* Function to delete the pad. */ /** Function DeletePad
void WinEDA_BasePcbFrame::DeletePad( D_PAD* Pad ) * 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; MODULE* Module;
wxString line;
if( Pad == NULL ) if( aPad == NULL )
return; return;
Module = (MODULE*) Pad->GetParent(); Module = (MODULE*) aPad->GetParent();
Module->m_LastEdit_Time = time( NULL ); 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_Reference->m_Text ),
GetChars( Module->m_Value->m_Text ) ); GetChars( Module->m_Value->m_Text ) );
if( !IsOK( this, line ) ) if( !IsOK( this, msg ) )
return; return;
}
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
aPad->DeleteStructure();
Pad->DeleteStructure();
DrawPanel->PostDirtyRect( Module->GetBoundingBox() ); DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
OnModify(); OnModify();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment