Pcbnew, Module Editor: fix bug 707692 and other potential crashes (when having a block command in progress and try to make an edit command)
This commit is contained in:
parent
4f3708c13f
commit
c63908b5bd
|
@ -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 @@
|
||||||
|
|
||||||
; 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,15 +22,15 @@
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
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;
|
||||||
|
|
||||||
|
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
|
||||||
BOARD_ITEM* item = GetCurItem();
|
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 );
|
||||||
|
@ -60,6 +60,7 @@ 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 */
|
||||||
|
if( !blockActive )
|
||||||
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
|
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 )
|
||||||
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 )
|
||||||
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 )
|
||||||
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();
|
||||||
|
|
|
@ -23,26 +23,26 @@
|
||||||
*/
|
*/
|
||||||
void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
|
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( DC );
|
||||||
if( m_ID_current_state == 0 )
|
if( m_ID_current_state == 0 )
|
||||||
{
|
{
|
||||||
if( DrawStruct && DrawStruct->m_Flags ) // Command in progress
|
if( item && item->m_Flags ) // Command in progress
|
||||||
{
|
{
|
||||||
switch( DrawStruct->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_TEXTE_MODULE:
|
case TYPE_TEXTE_MODULE:
|
||||||
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, DC );
|
PlaceTexteModule( (TEXTE_MODULE*) item, DC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_EDGE_MODULE:
|
case TYPE_EDGE_MODULE:
|
||||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||||
Place_EdgeMod( (EDGE_MODULE*) DrawStruct );
|
Place_EdgeMod( (EDGE_MODULE*) item );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_PAD:
|
case TYPE_PAD:
|
||||||
PlacePad( (D_PAD*) DrawStruct, DC );
|
PlacePad( (D_PAD*) item, DC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -50,23 +50,22 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( wxT( "WinEDA_ModEditFrame::OnLeftClick err: \
|
msg.Printf( wxT( "WinEDA_ModEditFrame::OnLeftClick err: \
|
||||||
m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
|
m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
|
||||||
DrawStruct, DrawStruct->Type(),
|
item, item->Type(), item->m_Flags );
|
||||||
DrawStruct->m_Flags );
|
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
DrawStruct->m_Flags = 0;
|
item->m_Flags = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawStruct = GetCurItem();
|
item = GetCurItem();
|
||||||
if( !DrawStruct || (DrawStruct->m_Flags == 0) )
|
if( !item || (item->m_Flags == 0) )
|
||||||
{
|
{
|
||||||
if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
|
if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
|
||||||
&& !wxGetKeyState( WXK_CONTROL ) )
|
&& !wxGetKeyState( WXK_CONTROL ) )
|
||||||
DrawStruct = ModeditLocateAndDisplay();
|
item = ModeditLocateAndDisplay();
|
||||||
SetCurItem( DrawStruct );
|
SetCurItem( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( m_ID_current_state )
|
||||||
|
@ -80,7 +79,7 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
|
||||||
case ID_PCB_CIRCLE_BUTT:
|
case ID_PCB_CIRCLE_BUTT:
|
||||||
case ID_PCB_ARC_BUTT:
|
case ID_PCB_ARC_BUTT:
|
||||||
case ID_PCB_ADD_LINE_BUTT:
|
case ID_PCB_ADD_LINE_BUTT:
|
||||||
if( !DrawStruct || DrawStruct->m_Flags == 0 )
|
if( !item || item->m_Flags == 0 )
|
||||||
{
|
{
|
||||||
int shape = S_SEGMENT;
|
int shape = S_SEGMENT;
|
||||||
if( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
|
if( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
|
||||||
|
@ -91,39 +90,39 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
|
||||||
SetCurItem(
|
SetCurItem(
|
||||||
Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) );
|
Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) );
|
||||||
}
|
}
|
||||||
else if( (DrawStruct->m_Flags & IS_NEW) )
|
else if( (item->m_Flags & IS_NEW) )
|
||||||
{
|
{
|
||||||
if( ( (EDGE_MODULE*) DrawStruct )->m_Shape == S_CIRCLE )
|
if( ( (EDGE_MODULE*) item )->m_Shape == S_CIRCLE )
|
||||||
{
|
{
|
||||||
End_Edge_Module( (EDGE_MODULE*) DrawStruct );
|
End_Edge_Module( (EDGE_MODULE*) item );
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
else if( ( (EDGE_MODULE*) DrawStruct )->m_Shape == S_ARC )
|
else if( ( (EDGE_MODULE*) item )->m_Shape == S_ARC )
|
||||||
{
|
{
|
||||||
End_Edge_Module( (EDGE_MODULE*) DrawStruct );
|
End_Edge_Module( (EDGE_MODULE*) item );
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
else if( ( (EDGE_MODULE*) DrawStruct )->m_Shape == S_SEGMENT )
|
else if( ( (EDGE_MODULE*) item )->m_Shape == S_SEGMENT )
|
||||||
{
|
{
|
||||||
SetCurItem(
|
SetCurItem(
|
||||||
Begin_Edge_Module( (EDGE_MODULE*) DrawStruct, DC, 0 ) );
|
Begin_Edge_Module( (EDGE_MODULE*) item, DC, 0 ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DisplayError( this,
|
DisplayError( this,
|
||||||
wxT( "ProcessCommand error: DrawStruct flags error" ) );
|
wxT( "ProcessCommand error: item flags error" ) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_MODEDIT_DELETE_ITEM_BUTT:
|
case ID_MODEDIT_DELETE_ITEM_BUTT:
|
||||||
if( DrawStruct == NULL || // No item to delete
|
if( item == NULL || // No item to delete
|
||||||
(DrawStruct->m_Flags != 0) ) // Item in edit, cannot delete it
|
(item->m_Flags != 0) ) // Item in edit, cannot delete it
|
||||||
break;
|
break;
|
||||||
if( DrawStruct->Type() != TYPE_MODULE ) // Cannot delete the module itself
|
if( item->Type() != TYPE_MODULE ) // Cannot delete the module itself
|
||||||
{
|
{
|
||||||
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
||||||
RemoveStruct( DrawStruct );
|
RemoveStruct( item );
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -190,22 +189,21 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
|
||||||
bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
wxMenu* PopMenu )
|
wxMenu* PopMenu )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
wxString msg;
|
wxString msg;
|
||||||
bool append_set_width = FALSE;
|
bool append_set_width = FALSE;
|
||||||
bool BlockActive =
|
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
|
||||||
( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE );
|
|
||||||
|
|
||||||
// Simple location of elements where possible.
|
// Simple location of elements where possible.
|
||||||
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
SetCurItem( DrawStruct = ModeditLocateAndDisplay() );
|
SetCurItem( item = ModeditLocateAndDisplay() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// End command in progress.
|
// End command in progress.
|
||||||
if( m_ID_current_state )
|
if( m_ID_current_state )
|
||||||
{
|
{
|
||||||
if( DrawStruct && DrawStruct->m_Flags )
|
if( item && item->m_Flags )
|
||||||
{
|
{
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||||
_( "Cancel" ), cancel_xpm );
|
_( "Cancel" ), cancel_xpm );
|
||||||
|
@ -217,9 +215,9 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( (DrawStruct && DrawStruct->m_Flags) || BlockActive )
|
if( (item && item->m_Flags) || blockActive )
|
||||||
{
|
{
|
||||||
if( BlockActive ) // Put block commands in list
|
if( blockActive ) // Put block commands in list
|
||||||
{
|
{
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||||
_( "Cancel Block" ), cancel_xpm );
|
_( "Cancel Block" ), cancel_xpm );
|
||||||
|
@ -251,12 +249,12 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DrawStruct == NULL )
|
if( (item == NULL) || blockActive )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int flags = DrawStruct->m_Flags;
|
int flags = item->m_Flags;
|
||||||
|
|
||||||
switch( DrawStruct->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_MODULE:
|
case TYPE_MODULE:
|
||||||
{
|
{
|
||||||
|
@ -321,7 +319,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
HK_EDIT_ITEM );
|
HK_EDIT_ITEM );
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE,
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE,
|
||||||
msg, edit_text_xpm );
|
msg, edit_text_xpm );
|
||||||
if( ( (TEXTE_MODULE*) DrawStruct )->m_Type == TEXT_is_DIVERS )
|
if( ( (TEXTE_MODULE*) item )->m_Type == TEXT_is_DIVERS )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
||||||
HK_DELETE );
|
HK_DELETE );
|
||||||
|
@ -380,13 +378,13 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
case TYPE_NOT_INIT:
|
case TYPE_NOT_INIT:
|
||||||
case TYPE_PCB:
|
case TYPE_PCB:
|
||||||
msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d" ),
|
msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d" ),
|
||||||
DrawStruct->Type() );
|
item->Type() );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: unknown DrawType %d" ),
|
msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: unknown DrawType %d" ),
|
||||||
DrawStruct->Type() );
|
item->Type() );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -413,33 +411,33 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
*/
|
*/
|
||||||
void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
wxPoint pos = GetPosition();
|
wxPoint pos = GetPosition();
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( m_ID_current_state )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
DrawStruct = ModeditLocateAndDisplay();
|
item = ModeditLocateAndDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags != 0 ) )
|
if( ( item == NULL ) || ( item->m_Flags != 0 ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Item found
|
// Item found
|
||||||
SetCurItem( DrawStruct );
|
SetCurItem( item );
|
||||||
|
|
||||||
switch( DrawStruct->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case TYPE_PAD:
|
case TYPE_PAD:
|
||||||
InstallPadOptionsFrame( (D_PAD*) DrawStruct );
|
InstallPadOptionsFrame( (D_PAD*) item );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MODULE:
|
case TYPE_MODULE:
|
||||||
{
|
{
|
||||||
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) DrawStruct );
|
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) item );
|
||||||
int ret = dialog.ShowModal();
|
int ret = dialog.ShowModal();
|
||||||
GetScreen()->GetCurItem()->m_Flags = 0;
|
GetScreen()->GetCurItem()->m_Flags = 0;
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
|
@ -449,7 +447,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_TEXTE_MODULE:
|
case TYPE_TEXTE_MODULE:
|
||||||
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, DC );
|
InstallTextModOptionsFrame( (TEXTE_MODULE*) item, DC );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -461,9 +459,9 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
|
||||||
case ID_PCB_ADD_LINE_BUTT:
|
case ID_PCB_ADD_LINE_BUTT:
|
||||||
{
|
{
|
||||||
if( DrawStruct && ( DrawStruct->m_Flags & IS_NEW ) )
|
if( item && ( item->m_Flags & IS_NEW ) )
|
||||||
{
|
{
|
||||||
End_Edge_Module( (EDGE_MODULE*) DrawStruct );
|
End_Edge_Module( (EDGE_MODULE*) item );
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 )
|
||||||
// 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();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
release version:
|
release version:
|
||||||
2011 jan 25
|
2011 jan 26
|
||||||
files (.zip,.tgz):
|
files (.zip,.tgz):
|
||||||
kicad-2011-01-25
|
kicad-2011-01-26
|
||||||
|
|
Loading…
Reference in New Issue