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

Eeschema: fix crash when starting ERC.

Fix other issues.
parent 0132ceb3
......@@ -572,7 +572,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
if( org.y < m_ClipBox.GetY() )
org.y += wxRound( gridSize.y );
#if ( defined( __WXMAC__ ) || 0 )
#if ( defined( __WXMAC__ ) || 1 )
// Use a pixel based draw to display grid. There are a lot of calls, so the cost is
// high and grid is slowly drawn on some platforms. Please note that this should
// always be enabled until the bitmap based solution below is fixed.
......
......@@ -25,8 +25,6 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
if( m_component == NULL ) // No component loaded !
return;
if( m_ID_current_state == 0 )
{
if( DrawEntry && DrawEntry->m_Flags )
{
switch( DrawEntry->Type() )
......@@ -57,7 +55,6 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
else
DisplayCmpDoc();
}
}
if( m_ID_current_state )
{
......
......@@ -50,7 +50,7 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
_( "Cancel" ), cancel_xpm );
PopMenu->AppendSeparator();
}
else if( m_ID_current_state )
else if( m_ID_current_state && m_ID_current_state != ID_LIBEDIT_NO_TOOL )
{ // If a tool is active, put menu "end tool"
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING,
_( "End Tool" ), cancel_tool_xpm );
......
......@@ -79,7 +79,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
}
// If Command in progress: add "cancel" and "end tool" menu
if( m_ID_current_state )
if( m_ID_current_state && m_ID_current_state != ID_SCH_NO_TOOL)
{
if( DrawStruct && DrawStruct->m_Flags )
{
......
......@@ -273,7 +273,6 @@ bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
* segment can be flagged */
DrawList->m_Flags |= TstDrawList->m_Flags;
EraseStruct( TstDrawList, this );
aCanvas->Refresh();
TstDrawList = GetDrawItems();
Modify = true;
}
......@@ -292,6 +291,8 @@ bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
TestDanglingEnds( aCanvas, aDC );
if( aCanvas && Modify )
aCanvas->Refresh();
return Modify;
}
......
......@@ -26,8 +26,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
BOARD_ITEM* item = GetCurItem();
DrawPanel->CrossHairOff( DC );
if( m_ID_current_state == 0 )
{
if( item && item->m_Flags ) // Command in progress
{
switch( item->Type() )
......@@ -48,16 +47,14 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
default:
{
wxString msg;
msg.Printf( wxT( "WinEDA_ModEditFrame::OnLeftClick err: \
m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
item, item->Type(), item->m_Flags );
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;
}
}
}
}
item = GetCurItem();
......@@ -199,7 +196,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
}
// End command in progress.
if( m_ID_current_state )
if( m_ID_current_state && m_ID_current_state != ID_MODEDIT_NO_TOOL )
{
if( item && item->m_Flags )
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
......
......@@ -21,12 +21,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
BOARD_ITEM* DrawStruct = GetCurItem();
bool exit = false;
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
if( DrawStruct && DrawStruct->m_Flags ) // Command in progress
{
DrawPanel->m_AutoPAN_Request = false;
if( DrawStruct && DrawStruct->m_Flags ) // "POPUP" in progress
{
DrawPanel->m_IgnoreMouseEvents = true;
DrawPanel->CrossHairOff( aDC );
......@@ -87,14 +84,11 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
default:
if( m_ID_current_state == 0 )
{
DisplayError( this,
wxT(
"WinEDA_PcbFrame::OnLeftClick() err: DrawType %d m_Flags != 0" ),
DrawStruct->Type() );
exit = true;
}
break;
}
......@@ -103,7 +97,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if( exit )
return;
}
else if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
&& !wxGetKeyState( WXK_CONTROL ) )
{
......
......@@ -51,7 +51,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
DrawPanel->CrossHairOff( &dc );
if( m_ID_current_state )
if( m_ID_current_state && m_ID_current_state != ID_PCB_NO_TOOL )
{
if( item && item->m_Flags )
{
......
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