Eeschema, Pcbnew, fix issues when creating new pins, tracks or segments.
This commit is contained in:
parent
f52ed7833d
commit
8bde66afbe
|
@ -48,6 +48,7 @@ static const wxChar* CommonConfigPath = wxT( "kicad_common" );
|
|||
/* Default font size */
|
||||
#define FONT_DEFAULT_SIZE 10 /* Default font size. */
|
||||
|
||||
static wxString languageCfgKey( wxT( "LanguageID" ) );
|
||||
|
||||
/**
|
||||
* The real font size will be computed at run time
|
||||
|
@ -336,8 +337,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& aName, id_app_type aId )
|
|||
ReadPdfBrowserInfos();
|
||||
|
||||
// Internationalization: loading the kicad suitable Dictionary
|
||||
m_EDA_CommonConfig->Read( wxT( "Language" ), &m_LanguageId,
|
||||
wxLANGUAGE_DEFAULT );
|
||||
m_EDA_CommonConfig->Read( languageCfgKey, &m_LanguageId, wxLANGUAGE_DEFAULT );
|
||||
|
||||
bool succes = SetLanguage( TRUE );
|
||||
if( !succes )
|
||||
|
@ -627,8 +627,7 @@ void WinEDA_App::GetSettings(bool aReopenLastUsedDirectory)
|
|||
m_HelpSize.x = 500;
|
||||
m_HelpSize.y = 400;
|
||||
|
||||
m_LanguageId = m_EDA_CommonConfig->Read( wxT( "Language" ),
|
||||
wxLANGUAGE_DEFAULT );
|
||||
m_LanguageId = m_EDA_CommonConfig->Read( languageCfgKey, wxLANGUAGE_DEFAULT );
|
||||
m_EditorName = m_EDA_CommonConfig->Read( wxT( "Editor" ) );
|
||||
|
||||
m_fileHistory.Load( *m_EDA_Config );
|
||||
|
@ -718,10 +717,10 @@ bool WinEDA_App::SetLanguage( bool first_time )
|
|||
|
||||
if( !first_time )
|
||||
{
|
||||
m_EDA_CommonConfig->Write( wxT( "Language" ), m_LanguageId );
|
||||
m_EDA_CommonConfig->Write( languageCfgKey, m_LanguageId );
|
||||
}
|
||||
|
||||
// Test if floating point notation is working (bug in cross compilation)
|
||||
// Test if floating point notation is working (bug in cross compilation, using wine)
|
||||
// Make a conversion double <=> string
|
||||
double dtst = 0.5;
|
||||
wxString msg;
|
||||
|
|
|
@ -25,21 +25,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
|
|||
if( m_component == NULL ) // No component loaded !
|
||||
return;
|
||||
|
||||
if( DrawEntry && DrawEntry->m_Flags )
|
||||
{
|
||||
switch( DrawEntry->Type() )
|
||||
{
|
||||
case LIB_PIN_T:
|
||||
PlacePin( DC );
|
||||
DrawEntry = NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
EndDrawGraphicItem( DC );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
if( DrawEntry == NULL || DrawEntry->m_Flags == 0 )
|
||||
{
|
||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
|
||||
|
||||
|
@ -56,80 +42,90 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
|
|||
DisplayCmpDoc();
|
||||
}
|
||||
|
||||
if( m_ID_current_state )
|
||||
switch( m_ID_current_state )
|
||||
{
|
||||
switch( m_ID_current_state )
|
||||
case 0:
|
||||
case ID_LIBEDIT_NO_TOOL:
|
||||
if( DrawEntry && DrawEntry->m_Flags ) // moved object
|
||||
{
|
||||
case 0:
|
||||
case ID_LIBEDIT_NO_TOOL:
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_PIN_BUTT:
|
||||
if( m_drawItem == NULL || m_drawItem->m_Flags == 0 )
|
||||
{
|
||||
CreatePin( DC );
|
||||
}
|
||||
else
|
||||
switch( DrawEntry->Type() )
|
||||
{
|
||||
case LIB_PIN_T:
|
||||
PlacePin( DC );
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_BODY_LINE_BUTT:
|
||||
case ID_LIBEDIT_BODY_ARC_BUTT:
|
||||
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
|
||||
case ID_LIBEDIT_BODY_RECT_BUTT:
|
||||
case ID_LIBEDIT_BODY_TEXT_BUTT:
|
||||
if( m_drawItem == NULL || m_drawItem->m_Flags == 0 )
|
||||
{
|
||||
m_drawItem = CreateGraphicItem( m_component, DC );
|
||||
}
|
||||
else if( m_drawItem )
|
||||
{
|
||||
if( m_drawItem->IsNew() )
|
||||
GraphicItemBeginDraw( DC );
|
||||
else
|
||||
EndDrawGraphicItem( DC );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
|
||||
|
||||
if( DrawEntry == NULL )
|
||||
{
|
||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
|
||||
GetScreen()->GetCrossHairPosition() );
|
||||
}
|
||||
|
||||
if( DrawEntry == NULL )
|
||||
{
|
||||
DisplayCmpDoc();
|
||||
default:
|
||||
EndDrawGraphicItem( DC );
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
SaveCopyInUndoList( m_component );
|
||||
case ID_LIBEDIT_PIN_BUTT:
|
||||
if( m_drawItem == NULL || m_drawItem->m_Flags == 0 )
|
||||
{
|
||||
CreatePin( DC );
|
||||
}
|
||||
else
|
||||
{
|
||||
PlacePin( DC );
|
||||
}
|
||||
break;
|
||||
|
||||
if( DrawEntry->Type() == LIB_PIN_T )
|
||||
DeletePin( DC, m_component, (LIB_PIN*) DrawEntry );
|
||||
case ID_LIBEDIT_BODY_LINE_BUTT:
|
||||
case ID_LIBEDIT_BODY_ARC_BUTT:
|
||||
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
|
||||
case ID_LIBEDIT_BODY_RECT_BUTT:
|
||||
case ID_LIBEDIT_BODY_TEXT_BUTT:
|
||||
if( m_drawItem == NULL || m_drawItem->m_Flags == 0 )
|
||||
{
|
||||
m_drawItem = CreateGraphicItem( m_component, DC );
|
||||
}
|
||||
else if( m_drawItem )
|
||||
{
|
||||
if( m_drawItem->IsNew() )
|
||||
GraphicItemBeginDraw( DC );
|
||||
else
|
||||
m_component->RemoveDrawItem( DrawEntry, DrawPanel, DC );
|
||||
EndDrawGraphicItem( DC );
|
||||
}
|
||||
break;
|
||||
|
||||
DrawEntry = NULL;
|
||||
OnModify( );
|
||||
break;
|
||||
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
|
||||
|
||||
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
|
||||
SaveCopyInUndoList( m_component );
|
||||
PlaceAncre();
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
if( DrawEntry == NULL )
|
||||
{
|
||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
|
||||
GetScreen()->GetCrossHairPosition() );
|
||||
}
|
||||
|
||||
default:
|
||||
DisplayError( this, wxT( "LIB_EDIT_FRAME::OnLeftClick error" ) );
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
if( DrawEntry == NULL )
|
||||
{
|
||||
DisplayCmpDoc();
|
||||
break;
|
||||
}
|
||||
|
||||
SaveCopyInUndoList( m_component );
|
||||
|
||||
if( DrawEntry->Type() == LIB_PIN_T )
|
||||
DeletePin( DC, m_component, (LIB_PIN*) DrawEntry );
|
||||
else
|
||||
m_component->RemoveDrawItem( DrawEntry, DrawPanel, DC );
|
||||
|
||||
DrawEntry = NULL;
|
||||
OnModify( );
|
||||
break;
|
||||
|
||||
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
|
||||
SaveCopyInUndoList( m_component );
|
||||
PlaceAncre();
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError( this, wxT( "LIB_EDIT_FRAME::OnLeftClick error" ) );
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -134,10 +134,9 @@ LIB_DRAW_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC*
|
|||
switch( m_ID_current_state )
|
||||
{
|
||||
case ID_LIBEDIT_BODY_ARC_BUTT:
|
||||
{
|
||||
m_drawItem = new LIB_ARC( LibEntry );
|
||||
break;
|
||||
}
|
||||
|
||||
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
|
||||
m_drawItem = new LIB_CIRCLE( LibEntry );
|
||||
break;
|
||||
|
|
|
@ -27,32 +27,35 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
|
||||
DrawPanel->CrossHairOff( DC );
|
||||
|
||||
if( item && item->m_Flags ) // Command in progress
|
||||
if( m_ID_current_state == 0 || m_ID_current_state == ID_MODEDIT_NO_TOOL )
|
||||
{
|
||||
switch( item->Type() )
|
||||
if( item && item->m_Flags ) // Move item command in progress
|
||||
{
|
||||
case TYPE_TEXTE_MODULE:
|
||||
PlaceTexteModule( (TEXTE_MODULE*) item, DC );
|
||||
break;
|
||||
switch( item->Type() )
|
||||
{
|
||||
case TYPE_TEXTE_MODULE:
|
||||
PlaceTexteModule( (TEXTE_MODULE*) item, DC );
|
||||
break;
|
||||
|
||||
case TYPE_EDGE_MODULE:
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
Place_EdgeMod( (EDGE_MODULE*) item );
|
||||
break;
|
||||
case TYPE_EDGE_MODULE:
|
||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||
Place_EdgeMod( (EDGE_MODULE*) item );
|
||||
break;
|
||||
|
||||
case TYPE_PAD:
|
||||
PlacePad( (D_PAD*) item, DC );
|
||||
break;
|
||||
case TYPE_PAD:
|
||||
PlacePad( (D_PAD*) item, DC );
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT( "WinEDA_ModEditFrame::OnLeftClick err:Struct %d, m_Flag %X" ),
|
||||
item->Type(), item->m_Flags );
|
||||
DisplayError( this, msg );
|
||||
item->m_Flags = 0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT( "WinEDA_ModEditFrame::OnLeftClick err:Struct %d, m_Flag %X" ),
|
||||
item->Type(), item->m_Flags );
|
||||
DisplayError( this, msg );
|
||||
item->m_Flags = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,9 +82,9 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
{
|
||||
int shape = S_SEGMENT;
|
||||
|
||||
if( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
|
||||
if( m_ID_current_state == ID_MODEDIT_CIRCLE_TOOL )
|
||||
shape = S_CIRCLE;
|
||||
if( m_ID_current_state == ID_PCB_ARC_BUTT )
|
||||
if( m_ID_current_state == ID_MODEDIT_ARC_TOOL )
|
||||
shape = S_ARC;
|
||||
|
||||
SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) );
|
||||
|
|
|
@ -20,84 +20,90 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
{
|
||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
||||
bool exit = false;
|
||||
bool no_tool = m_ID_current_state == 0 || m_ID_current_state == ID_PCB_NO_TOOL;
|
||||
|
||||
if( DrawStruct && DrawStruct->m_Flags ) // Command in progress
|
||||
if( no_tool || ( DrawStruct && DrawStruct->m_Flags ) )
|
||||
{
|
||||
DrawPanel->m_AutoPAN_Request = false;
|
||||
DrawPanel->m_IgnoreMouseEvents = true;
|
||||
DrawPanel->CrossHairOff( aDC );
|
||||
|
||||
switch( DrawStruct->Type() )
|
||||
if( DrawStruct && DrawStruct->m_Flags ) // Command in progress
|
||||
{
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
if( DrawStruct->IsNew() )
|
||||
{
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
Begin_Zone( aDC );
|
||||
}
|
||||
else
|
||||
End_Move_Zone_Corner_Or_Outlines( aDC, (ZONE_CONTAINER*) DrawStruct );
|
||||
exit = true;
|
||||
break;
|
||||
DrawPanel->m_IgnoreMouseEvents = true;
|
||||
DrawPanel->CrossHairOff( aDC );
|
||||
|
||||
case TYPE_TRACK:
|
||||
case TYPE_VIA:
|
||||
if( DrawStruct->m_Flags & IS_DRAGGED )
|
||||
switch( DrawStruct->Type() )
|
||||
{
|
||||
PlaceDraggedOrMovedTrackSegment( (TRACK*) DrawStruct, aDC );
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
if( DrawStruct->IsNew() )
|
||||
{
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
Begin_Zone( aDC );
|
||||
}
|
||||
else
|
||||
End_Move_Zone_Corner_Or_Outlines( aDC, (ZONE_CONTAINER*) DrawStruct );
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
case TYPE_TRACK:
|
||||
case TYPE_VIA:
|
||||
if( DrawStruct->m_Flags & IS_DRAGGED )
|
||||
{
|
||||
PlaceDraggedOrMovedTrackSegment( (TRACK*) DrawStruct, aDC );
|
||||
exit = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE:
|
||||
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, aDC );
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE_MODULE:
|
||||
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, aDC );
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
case TYPE_PAD:
|
||||
PlacePad( (D_PAD*) DrawStruct, aDC );
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
case TYPE_MODULE:
|
||||
Place_Module( (MODULE*) DrawStruct, aDC );
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
case TYPE_MIRE:
|
||||
Place_Mire( (MIREPCB*) DrawStruct, aDC );
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
case TYPE_DRAWSEGMENT:
|
||||
if( no_tool ) // when no tools: existing item moving.
|
||||
{
|
||||
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, aDC );
|
||||
exit = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_DIMENSION:
|
||||
// see above.
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError( this,
|
||||
wxT(
|
||||
"WinEDA_PcbFrame::OnLeftClick() err: DrawType %d m_Flags != 0" ),
|
||||
DrawStruct->Type() );
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE:
|
||||
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, aDC );
|
||||
exit = true;
|
||||
break;
|
||||
DrawPanel->m_IgnoreMouseEvents = false;
|
||||
DrawPanel->CrossHairOn( aDC );
|
||||
|
||||
case TYPE_TEXTE_MODULE:
|
||||
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, aDC );
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
case TYPE_PAD:
|
||||
PlacePad( (D_PAD*) DrawStruct, aDC );
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
case TYPE_MODULE:
|
||||
Place_Module( (MODULE*) DrawStruct, aDC );
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
case TYPE_MIRE:
|
||||
Place_Mire( (MIREPCB*) DrawStruct, aDC );
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
case TYPE_DRAWSEGMENT:
|
||||
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, aDC );
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
case TYPE_DIMENSION:
|
||||
// see above.
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError( this,
|
||||
wxT(
|
||||
"WinEDA_PcbFrame::OnLeftClick() err: DrawType %d m_Flags != 0" ),
|
||||
DrawStruct->Type() );
|
||||
exit = true;
|
||||
break;
|
||||
if( exit )
|
||||
return;
|
||||
}
|
||||
|
||||
DrawPanel->m_IgnoreMouseEvents = false;
|
||||
DrawPanel->CrossHairOn( aDC );
|
||||
|
||||
if( exit )
|
||||
return;
|
||||
|
||||
else if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
|
||||
&& !wxGetKeyState( WXK_CONTROL ) )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue