Commit 8bde66af authored by jean-pierre charras's avatar jean-pierre charras

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

parent f52ed783
...@@ -48,6 +48,7 @@ static const wxChar* CommonConfigPath = wxT( "kicad_common" ); ...@@ -48,6 +48,7 @@ static const wxChar* CommonConfigPath = wxT( "kicad_common" );
/* Default font size */ /* Default font size */
#define FONT_DEFAULT_SIZE 10 /* 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 * 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 ) ...@@ -336,8 +337,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& aName, id_app_type aId )
ReadPdfBrowserInfos(); ReadPdfBrowserInfos();
// Internationalization: loading the kicad suitable Dictionary // Internationalization: loading the kicad suitable Dictionary
m_EDA_CommonConfig->Read( wxT( "Language" ), &m_LanguageId, m_EDA_CommonConfig->Read( languageCfgKey, &m_LanguageId, wxLANGUAGE_DEFAULT );
wxLANGUAGE_DEFAULT );
bool succes = SetLanguage( TRUE ); bool succes = SetLanguage( TRUE );
if( !succes ) if( !succes )
...@@ -627,8 +627,7 @@ void WinEDA_App::GetSettings(bool aReopenLastUsedDirectory) ...@@ -627,8 +627,7 @@ void WinEDA_App::GetSettings(bool aReopenLastUsedDirectory)
m_HelpSize.x = 500; m_HelpSize.x = 500;
m_HelpSize.y = 400; m_HelpSize.y = 400;
m_LanguageId = m_EDA_CommonConfig->Read( wxT( "Language" ), m_LanguageId = m_EDA_CommonConfig->Read( languageCfgKey, wxLANGUAGE_DEFAULT );
wxLANGUAGE_DEFAULT );
m_EditorName = m_EDA_CommonConfig->Read( wxT( "Editor" ) ); m_EditorName = m_EDA_CommonConfig->Read( wxT( "Editor" ) );
m_fileHistory.Load( *m_EDA_Config ); m_fileHistory.Load( *m_EDA_Config );
...@@ -718,10 +717,10 @@ bool WinEDA_App::SetLanguage( bool first_time ) ...@@ -718,10 +717,10 @@ bool WinEDA_App::SetLanguage( bool first_time )
if( !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 // Make a conversion double <=> string
double dtst = 0.5; double dtst = 0.5;
wxString msg; wxString msg;
......
...@@ -25,21 +25,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) ...@@ -25,21 +25,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
if( m_component == NULL ) // No component loaded ! if( m_component == NULL ) // No component loaded !
return; return;
if( DrawEntry && DrawEntry->m_Flags ) if( DrawEntry == NULL || DrawEntry->m_Flags == 0 )
{
switch( DrawEntry->Type() )
{
case LIB_PIN_T:
PlacePin( DC );
DrawEntry = NULL;
break;
default:
EndDrawGraphicItem( DC );
break;
}
}
else
{ {
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition ); 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 ) ...@@ -56,12 +42,23 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
DisplayCmpDoc(); DisplayCmpDoc();
} }
if( m_ID_current_state )
{
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case 0: case 0:
case ID_LIBEDIT_NO_TOOL: 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; break;
case ID_LIBEDIT_PIN_BUTT: case ID_LIBEDIT_PIN_BUTT:
...@@ -130,7 +127,6 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) ...@@ -130,7 +127,6 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
} }
}
} }
......
...@@ -134,10 +134,9 @@ LIB_DRAW_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* ...@@ -134,10 +134,9 @@ LIB_DRAW_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC*
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case ID_LIBEDIT_BODY_ARC_BUTT: case ID_LIBEDIT_BODY_ARC_BUTT:
{
m_drawItem = new LIB_ARC( LibEntry ); m_drawItem = new LIB_ARC( LibEntry );
break; break;
}
case ID_LIBEDIT_BODY_CIRCLE_BUTT: case ID_LIBEDIT_BODY_CIRCLE_BUTT:
m_drawItem = new LIB_CIRCLE( LibEntry ); m_drawItem = new LIB_CIRCLE( LibEntry );
break; break;
......
...@@ -27,7 +27,9 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -27,7 +27,9 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawPanel->CrossHairOff( DC ); 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() ) switch( item->Type() )
{ {
...@@ -55,6 +57,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -55,6 +57,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
} }
} }
}
item = GetCurItem(); item = GetCurItem();
...@@ -79,9 +82,9 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -79,9 +82,9 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
int shape = S_SEGMENT; 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; shape = S_CIRCLE;
if( m_ID_current_state == ID_PCB_ARC_BUTT ) if( m_ID_current_state == ID_MODEDIT_ARC_TOOL )
shape = S_ARC; shape = S_ARC;
SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) ); SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) );
......
...@@ -20,10 +20,13 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -20,10 +20,13 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{ {
BOARD_ITEM* DrawStruct = GetCurItem(); BOARD_ITEM* DrawStruct = GetCurItem();
bool exit = false; 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_AutoPAN_Request = false;
if( DrawStruct && DrawStruct->m_Flags ) // Command in progress
{
DrawPanel->m_IgnoreMouseEvents = true; DrawPanel->m_IgnoreMouseEvents = true;
DrawPanel->CrossHairOff( aDC ); DrawPanel->CrossHairOff( aDC );
...@@ -75,8 +78,11 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -75,8 +78,11 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break; break;
case TYPE_DRAWSEGMENT: case TYPE_DRAWSEGMENT:
if( no_tool ) // when no tools: existing item moving.
{
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, aDC ); Place_DrawItem( (DRAWSEGMENT*) DrawStruct, aDC );
exit = true; exit = true;
}
break; break;
case TYPE_DIMENSION: case TYPE_DIMENSION:
...@@ -97,7 +103,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -97,7 +103,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if( exit ) if( exit )
return; return;
}
else if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT ) else if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
&& !wxGetKeyState( WXK_CONTROL ) ) && !wxGetKeyState( WXK_CONTROL ) )
{ {
......
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