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

Pcbnew, Module Editor: fix bug 707692 and other potential crashes (when having...

Pcbnew, Module Editor: fix bug 707692 and other potential crashes (when having a block command in progress and try to make an edit command)
parent 4f3708c1
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#endif #endif
#ifndef KICAD_BUILD_VERSION #ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2011-01-25 BZR 2758)" #define KICAD_BUILD_VERSION "(2011-01-26 BZR 2759)"
#endif #endif
//#define VERSION_STABILITY "stable" //#define VERSION_STABILITY "stable"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
; General Product Description Definitions ; General Product Description Definitions
!define PRODUCT_NAME "KiCad" !define PRODUCT_NAME "KiCad"
!define PRODUCT_VERSION "2011.01.25" !define PRODUCT_VERSION "2011.01.26"
!define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/" !define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/"
!define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/" !define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/"
!define COMPANY_NAME "" !define COMPANY_NAME ""
......
...@@ -22,16 +22,16 @@ ...@@ -22,16 +22,16 @@
/*****************************************************************************************/ /*****************************************************************************************/
void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_ITEM* DrawStruct ) void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_ITEM* DrawStruct )
{
/*****************************************************************************************/ /*****************************************************************************************/
/* Hot keys. Some commands are relative to the item under the mouse cursor /* Hot keys. Some commands are relative to the item under the mouse cursor
* Commands are case insensitive * Commands are case insensitive
*/ */
{
if( hotkey == 0 ) if( hotkey == 0 )
return; return;
BOARD_ITEM* item = GetCurItem(); bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
BOARD_ITEM* item = GetCurItem();
bool ItemFree = (item == 0) || (item->m_Flags == 0); bool ItemFree = (item == 0) || (item->m_Flags == 0);
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this ); cmd.SetEventObject( this );
...@@ -60,7 +60,8 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_ITEM* DrawStru ...@@ -60,7 +60,8 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_ITEM* DrawStru
break; break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */ case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; if( !blockActive )
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:
...@@ -89,7 +90,7 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_ITEM* DrawStru ...@@ -89,7 +90,7 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_ITEM* DrawStru
case HK_UNDO: case HK_UNDO:
case HK_REDO: case HK_REDO:
if( ItemFree ) if( ItemFree && !blockActive )
{ {
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED,
HK_Descr->m_IdMenuEvent ); HK_Descr->m_IdMenuEvent );
...@@ -120,12 +121,14 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_ITEM* DrawStru ...@@ -120,12 +121,14 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_ITEM* DrawStru
} }
} }
bool WinEDA_ModuleEditFrame::OnHotkeyEditItem( int aIdCommand ) bool WinEDA_ModuleEditFrame::OnHotkeyEditItem( int aIdCommand )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags; bool itemCurrentlyEdited = item && item->m_Flags;
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
if( itemCurrentlyEdited ) if( itemCurrentlyEdited || blockActive )
return false; return false;
item = ModeditLocateAndDisplay(); item = ModeditLocateAndDisplay();
...@@ -170,12 +173,14 @@ bool WinEDA_ModuleEditFrame::OnHotkeyEditItem( int aIdCommand ) ...@@ -170,12 +173,14 @@ bool WinEDA_ModuleEditFrame::OnHotkeyEditItem( int aIdCommand )
return false; return false;
} }
bool WinEDA_ModuleEditFrame::OnHotkeyDeleteItem( int aIdCommand ) bool WinEDA_ModuleEditFrame::OnHotkeyDeleteItem( int aIdCommand )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags; bool itemCurrentlyEdited = item && item->m_Flags;
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
if( itemCurrentlyEdited ) if( itemCurrentlyEdited || blockActive )
return false; return false;
item = ModeditLocateAndDisplay(); item = ModeditLocateAndDisplay();
...@@ -220,12 +225,14 @@ bool WinEDA_ModuleEditFrame::OnHotkeyDeleteItem( int aIdCommand ) ...@@ -220,12 +225,14 @@ bool WinEDA_ModuleEditFrame::OnHotkeyDeleteItem( int aIdCommand )
return false; return false;
} }
bool WinEDA_ModuleEditFrame::OnHotkeyMoveItem( int aIdCommand ) bool WinEDA_ModuleEditFrame::OnHotkeyMoveItem( int aIdCommand )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags; bool itemCurrentlyEdited = item && item->m_Flags;
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
if( itemCurrentlyEdited ) if( itemCurrentlyEdited || blockActive )
return false; return false;
item = ModeditLocateAndDisplay(); item = ModeditLocateAndDisplay();
...@@ -270,11 +277,16 @@ bool WinEDA_ModuleEditFrame::OnHotkeyMoveItem( int aIdCommand ) ...@@ -270,11 +277,16 @@ bool WinEDA_ModuleEditFrame::OnHotkeyMoveItem( int aIdCommand )
return false; return false;
} }
bool WinEDA_ModuleEditFrame::OnHotkeyRotateItem( int aIdCommand ) bool WinEDA_ModuleEditFrame::OnHotkeyRotateItem( int aIdCommand )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags; bool itemCurrentlyEdited = item && item->m_Flags;
int evt_type = 0; // Used to post a wxCommandEvent on demand int evt_type = 0; // Used to post a wxCommandEvent on demand
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
if( blockActive )
return false;
if( !itemCurrentlyEdited ) if( !itemCurrentlyEdited )
item = ModeditLocateAndDisplay(); item = ModeditLocateAndDisplay();
......
This diff is collapsed.
...@@ -30,7 +30,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -30,7 +30,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
wxString msg; wxString msg;
int flags = 0; int flags = 0;
bool locate_track = FALSE; bool locate_track = FALSE;
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE); bool blockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel );
...@@ -42,7 +42,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -42,7 +42,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
// If a command or a block is in progress: // If a command or a block is in progress:
// Put the Cancel command (if needed) and the End command // Put the Cancel command (if needed) and the End command
if( BlockActive ) if( blockActive )
{ {
createPopUpBlockMenu( aPopMenu ); createPopUpBlockMenu( aPopMenu );
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
......
release version: release version:
2011 jan 25 2011 jan 26
files (.zip,.tgz): files (.zip,.tgz):
kicad-2011-01-25 kicad-2011-01-26
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