Commit 23b7e766 authored by Marco Mattila's avatar Marco Mattila Committed by Dick Hollenbeck
parent 84a009f7
...@@ -38,6 +38,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -38,6 +38,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
int itmp; int itmp;
INSTALL_DC( dc, DrawPanel ); INSTALL_DC( dc, DrawPanel );
BOARD_ITEM* DrawStruct = GetCurItem(); BOARD_ITEM* DrawStruct = GetCurItem();
MODULE* module;
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
...@@ -608,6 +609,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -608,6 +609,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
g_Drag_Pistes_On = false; g_Drag_Pistes_On = false;
break; break;
} }
module = (MODULE*) GetCurItem();
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but it is locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
break;
}
GetScreen()->m_Curseur = ((MODULE*) GetCurItem())->m_Pos; GetScreen()->m_Curseur = ((MODULE*) GetCurItem())->m_Pos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMove_Module( (MODULE*) GetCurItem(), &dc ); StartMove_Module( (MODULE*) GetCurItem(), &dc );
...@@ -615,6 +625,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -615,6 +625,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: /* get module by name and move it */ case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: /* get module by name and move it */
SetCurItem( GetModuleByName() ); SetCurItem( GetModuleByName() );
module = (MODULE*) GetCurItem();
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but it is locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
break;
}
if( GetCurItem() ) if( GetCurItem() )
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
...@@ -631,6 +650,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -631,6 +650,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE ) if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
break; break;
module = (MODULE*) GetCurItem();
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but it is locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
break;
}
if( Delete_Module( (MODULE*) GetCurItem(), &dc, true ) ) if( Delete_Module( (MODULE*) GetCurItem(), &dc, true ) )
{ {
SetCurItem( NULL ); SetCurItem( NULL );
...@@ -646,7 +674,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -646,7 +674,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE ) if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
break; break;
module = (MODULE*) GetCurItem();
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but it is locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
break;
}
if( !(GetCurItem()->m_Flags & IS_MOVED) ) /* This is a simple rotation, no other edition in progress */ if( !(GetCurItem()->m_Flags & IS_MOVED) ) /* This is a simple rotation, no other edition in progress */
SaveCopyInUndoList(GetCurItem(), UR_ROTATED, ((MODULE*)GetCurItem())->m_Pos); SaveCopyInUndoList(GetCurItem(), UR_ROTATED, ((MODULE*)GetCurItem())->m_Pos);
Rotate_Module( &dc, (MODULE*) GetCurItem(), 900, true ); Rotate_Module( &dc, (MODULE*) GetCurItem(), 900, true );
...@@ -661,6 +697,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -661,6 +697,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE ) if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
break; break;
module = (MODULE*) GetCurItem();
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but it is locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
break;
}
if( !(GetCurItem()->m_Flags & IS_MOVED) ) /* This is a simple rotation, no other edition in progress */ if( !(GetCurItem()->m_Flags & IS_MOVED) ) /* This is a simple rotation, no other edition in progress */
SaveCopyInUndoList(GetCurItem(), UR_ROTATED_CLOCKWISE, ((MODULE*)GetCurItem())->m_Pos); SaveCopyInUndoList(GetCurItem(), UR_ROTATED_CLOCKWISE, ((MODULE*)GetCurItem())->m_Pos);
Rotate_Module( &dc, (MODULE*) GetCurItem(), -900, true ); Rotate_Module( &dc, (MODULE*) GetCurItem(), -900, true );
...@@ -674,10 +719,17 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -674,10 +719,17 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SetCurItem( GetCurItem()->GetParent() ); SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE ) if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
break; break;
module = (MODULE*) GetCurItem();
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but it is locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
break;
}
if( !(GetCurItem()->m_Flags & IS_MOVED) ) /* This is a simple flip, no other edition in progress */ if( !(GetCurItem()->m_Flags & IS_MOVED) ) /* This is a simple flip, no other edition in progress */
SaveCopyInUndoList(GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->m_Pos); SaveCopyInUndoList(GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->m_Pos);
Change_Side_Module( (MODULE*) GetCurItem(), &dc ); Change_Side_Module( (MODULE*) GetCurItem(), &dc );
break; break;
...@@ -693,12 +745,34 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -693,12 +745,34 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_DRAG_PAD_REQUEST: case ID_POPUP_PCB_DRAG_PAD_REQUEST:
module = (MODULE*) GetCurItem()->GetParent();
if( !module || module->Type() != TYPE_MODULE )
break;
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "The parent (%s) of the pad is locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
break;
}
g_Drag_Pistes_On = true; g_Drag_Pistes_On = true;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMovePad( (D_PAD*) GetCurItem(), &dc ); StartMovePad( (D_PAD*) GetCurItem(), &dc );
break; break;
case ID_POPUP_PCB_MOVE_PAD_REQUEST: case ID_POPUP_PCB_MOVE_PAD_REQUEST:
module = (MODULE*) GetCurItem()->GetParent();
if( !module || module->Type() != TYPE_MODULE )
break;
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "The parent (%s) of the pad is locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
break;
}
g_Drag_Pistes_On = false; g_Drag_Pistes_On = false;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMovePad( (D_PAD*) GetCurItem(), &dc ); StartMovePad( (D_PAD*) GetCurItem(), &dc );
......
...@@ -945,17 +945,6 @@ bool WinEDA_PcbFrame::OnHotkeyMoveItem( int aIdCommand ) ...@@ -945,17 +945,6 @@ bool WinEDA_PcbFrame::OnHotkeyMoveItem( int aIdCommand )
case TYPE_MODULE: case TYPE_MODULE:
{ {
MODULE* module = (MODULE*) item;
// a footprint is found, but locked or on an other layer
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
break;
}
if( aIdCommand == HK_MOVE_ITEM ) if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_MODULE_REQUEST; evt_type = ID_POPUP_PCB_MOVE_MODULE_REQUEST;
if( aIdCommand == HK_DRAG_ITEM ) if( aIdCommand == HK_DRAG_ITEM )
...@@ -1040,15 +1029,6 @@ bool WinEDA_PcbFrame::OnHotkeyRotateItem( int aIdCommand ) ...@@ -1040,15 +1029,6 @@ bool WinEDA_PcbFrame::OnHotkeyRotateItem( int aIdCommand )
{ {
case TYPE_MODULE: case TYPE_MODULE:
{ {
MODULE* module = (MODULE*) item;
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s is locked" ),
module->m_Reference->m_Text.GetData() );
DisplayInfoMessage( this, msg );
break;
}
if( aIdCommand == HK_ROTATE_ITEM ) // Rotation if( aIdCommand == HK_ROTATE_ITEM ) // Rotation
evt_type = ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE; evt_type = ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE;
if( aIdCommand == HK_FLIP_FOOTPRINT ) // move to other side if( aIdCommand == HK_FLIP_FOOTPRINT ) // move to other side
......
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