Eeschema, Pcbnew, fix issues when creating new pins, tracks or segments.

This commit is contained in:
jean-pierre charras 2011-02-24 13:35:14 +01:00
parent f52ed7833d
commit 8bde66afbe
5 changed files with 175 additions and 172 deletions

View File

@ -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;

View File

@ -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,12 +42,23 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
DisplayCmpDoc();
}
if( m_ID_current_state )
{
switch( m_ID_current_state )
{
case 0:
case ID_LIBEDIT_NO_TOOL:
if( DrawEntry && DrawEntry->m_Flags ) // moved object
{
switch( DrawEntry->Type() )
{
case LIB_PIN_T:
PlacePin( DC );
break;
default:
EndDrawGraphicItem( DC );
break;
}
}
break;
case ID_LIBEDIT_PIN_BUTT:
@ -130,7 +127,6 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
}
}
}

View File

@ -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;

View File

@ -27,7 +27,9 @@ 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 )
{
if( item && item->m_Flags ) // Move item command in progress
{
switch( item->Type() )
{
@ -55,6 +57,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
}
}
}
item = GetCurItem();
@ -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 ) );

View File

@ -20,10 +20,13 @@ 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;
if( DrawStruct && DrawStruct->m_Flags ) // Command in progress
{
DrawPanel->m_IgnoreMouseEvents = true;
DrawPanel->CrossHairOff( aDC );
@ -75,8 +78,11 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case TYPE_DRAWSEGMENT:
if( no_tool ) // when no tools: existing item moving.
{
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, aDC );
exit = true;
}
break;
case TYPE_DIMENSION:
@ -97,7 +103,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if( exit )
return;
}
else if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
&& !wxGetKeyState( WXK_CONTROL ) )
{