Improve handling of tool bar command IDs.
* Make EDA_DRAW_FRAME current tool ID member variable private. * Added global no tool selected ID to replace application specific no tool selected IDs. * Change SetToolID to prevent setting the tool ID to anything less than the new global no tool selected ID and assert on debug builds. * Change command and update user interface command event handlers to use new global no tool selected ID. * Fixed schematic library editor add pin hot key handler.
This commit is contained in:
parent
c303d3f8bd
commit
cb647737ee
|
@ -77,8 +77,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
|
||||||
DrawPanel = NULL;
|
DrawPanel = NULL;
|
||||||
MsgPanel = NULL;
|
MsgPanel = NULL;
|
||||||
m_currentScreen = NULL;
|
m_currentScreen = NULL;
|
||||||
m_ID_current_state = 0;
|
m_toolId = ID_NO_TOOL_SELECTED;
|
||||||
m_ID_last_state = 0;
|
m_ID_last_state = ID_NO_TOOL_SELECTED;
|
||||||
m_HTOOL_current_state = 0;
|
m_HTOOL_current_state = 0;
|
||||||
m_Draw_Axis = FALSE; // TRUE to draw axis.
|
m_Draw_Axis = FALSE; // TRUE to draw axis.
|
||||||
m_Draw_Sheet_Ref = FALSE; // TRUE to display reference sheet.
|
m_Draw_Sheet_Ref = FALSE; // TRUE to display reference sheet.
|
||||||
|
@ -434,20 +434,6 @@ void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function SetToolID
|
|
||||||
* Enables the icon of the selected tool in the vertical toolbar.
|
|
||||||
* (Or tool ID_NO_SELECT_BUTT default if no new selection)
|
|
||||||
* @param aId = new m_ID_current_state value (if aId >= 0)
|
|
||||||
* @param aCursor = the new cursor shape (0 = default cursor)
|
|
||||||
* @param aToolMsg = tool message in status bar
|
|
||||||
* if (aId >= 0)
|
|
||||||
* Updates all variables related:
|
|
||||||
* m_ID_current_state, cursor shape and message in status bar
|
|
||||||
* If (aId < 0)
|
|
||||||
* Only updates the cursor shape and message in status bar
|
|
||||||
* (does not the current m_ID_current_state value
|
|
||||||
*/
|
|
||||||
void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
|
void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
|
||||||
{
|
{
|
||||||
// Keep default cursor in toolbars
|
// Keep default cursor in toolbars
|
||||||
|
@ -462,7 +448,10 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
|
||||||
if( aId < 0 )
|
if( aId < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_ID_current_state = aId;
|
wxCHECK2_MSG( aId >= ID_NO_TOOL_SELECTED, aId = ID_NO_TOOL_SELECTED,
|
||||||
|
wxString::Format( wxT( "Current tool ID cannot be set to %d." ), aId ) );
|
||||||
|
|
||||||
|
m_toolId = aId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1108,7 +1108,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
|
||||||
if( IsMouseCaptured() )
|
if( IsMouseCaptured() )
|
||||||
EndMouseCapture( -1, m_defaultCursor );
|
EndMouseCapture( -1, m_defaultCursor );
|
||||||
else
|
else
|
||||||
EndMouseCapture( 0, m_cursor, wxEmptyString );
|
EndMouseCapture( ID_NO_TOOL_SELECTED, m_cursor, wxEmptyString );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1206,6 +1206,7 @@ void EDA_DRAW_PANEL::EndMouseCapture( int id, int cursor, const wxString& title
|
||||||
INSTALL_UNBUFFERED_DC( dc, this );
|
INSTALL_UNBUFFERED_DC( dc, this );
|
||||||
m_endMouseCaptureCallback( this, &dc );
|
m_endMouseCaptureCallback( this, &dc );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mouseCaptureCallback = NULL;
|
m_mouseCaptureCallback = NULL;
|
||||||
m_endMouseCaptureCallback = NULL;
|
m_endMouseCaptureCallback = NULL;
|
||||||
m_AutoPAN_Request = false;
|
m_AutoPAN_Request = false;
|
||||||
|
|
|
@ -183,7 +183,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||||
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
SetToolID( GetToolId(), DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
block->m_Command = BLOCK_IDLE;
|
block->m_Command = BLOCK_IDLE;
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||||
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
SetToolID( GetToolId(), DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( zoom_command )
|
if( zoom_command )
|
||||||
|
@ -479,7 +479,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
|
||||||
block->Clear();
|
block->Clear();
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||||
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
SetToolID( GetToolId(), DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||||
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
SetToolID( GetToolId(), DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
DrawPanel->Refresh( true );
|
DrawPanel->Refresh( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||||
DrawPanel->Refresh( true );
|
DrawPanel->Refresh( true );
|
||||||
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
SetToolID( GetToolId(), DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "class_drawpanel.h"
|
#include "class_drawpanel.h"
|
||||||
#include "wxEeschemaStruct.h"
|
#include "wxEeschemaStruct.h"
|
||||||
|
#include "id.h"
|
||||||
|
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
@ -109,7 +110,7 @@ void LIB_EDIT_FRAME::InstallFieldsEditorDialog( wxCommandEvent& event )
|
||||||
if( m_component == NULL )
|
if( m_component == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
|
|
||||||
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB dlg( this, m_component );
|
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB dlg( this, m_component );
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ enum id_eeschema_frm
|
||||||
|
|
||||||
/* Schematic editor veritcal toolbar IDs */
|
/* Schematic editor veritcal toolbar IDs */
|
||||||
ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
|
ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
|
||||||
ID_SCH_NO_TOOL,
|
|
||||||
ID_HIERARCHY_PUSH_POP_BUTT,
|
ID_HIERARCHY_PUSH_POP_BUTT,
|
||||||
ID_SCH_PLACE_COMPONENT,
|
ID_SCH_PLACE_COMPONENT,
|
||||||
ID_PLACE_POWER_BUTT,
|
ID_PLACE_POWER_BUTT,
|
||||||
|
@ -156,7 +155,6 @@ enum id_eeschema_frm
|
||||||
ID_LIBEDIT_SELECT_ALIAS,
|
ID_LIBEDIT_SELECT_ALIAS,
|
||||||
|
|
||||||
/* Library editor vertical toolbar IDs. */
|
/* Library editor vertical toolbar IDs. */
|
||||||
ID_LIBEDIT_NO_TOOL,
|
|
||||||
ID_LIBEDIT_PIN_BUTT,
|
ID_LIBEDIT_PIN_BUTT,
|
||||||
ID_LIBEDIT_BODY_LINE_BUTT,
|
ID_LIBEDIT_BODY_LINE_BUTT,
|
||||||
ID_LIBEDIT_BODY_ARC_BUTT,
|
ID_LIBEDIT_BODY_ARC_BUTT,
|
||||||
|
|
|
@ -388,8 +388,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
case HK_ADD_NEW_COMPONENT: // Add component
|
case HK_ADD_NEW_COMPONENT: // Add component
|
||||||
if( !itemInEdit )
|
if( !itemInEdit )
|
||||||
{
|
{
|
||||||
// switch to m_ID_current_state = ID_COMPONENT_BUTT;
|
if( GetToolId() != ID_SCH_PLACE_COMPONENT )
|
||||||
if( m_ID_current_state != ID_SCH_PLACE_COMPONENT )
|
|
||||||
SetToolID( ID_SCH_PLACE_COMPONENT, wxCURSOR_PENCIL, _( "Add Component" ) );
|
SetToolID( ID_SCH_PLACE_COMPONENT, wxCURSOR_PENCIL, _( "Add Component" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
|
@ -399,8 +398,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
case HK_ADD_NEW_POWER: // Add power component
|
case HK_ADD_NEW_POWER: // Add power component
|
||||||
if( !itemInEdit )
|
if( !itemInEdit )
|
||||||
{
|
{
|
||||||
// switch to m_ID_current_state = ID_PLACE_POWER_BUTT;
|
if( GetToolId() != ID_PLACE_POWER_BUTT )
|
||||||
if( m_ID_current_state != ID_PLACE_POWER_BUTT )
|
|
||||||
SetToolID( ID_PLACE_POWER_BUTT, wxCURSOR_PENCIL, _( "Add Power" ) );
|
SetToolID( ID_PLACE_POWER_BUTT, wxCURSOR_PENCIL, _( "Add Power" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
|
@ -410,8 +408,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
case HK_ADD_LABEL:
|
case HK_ADD_LABEL:
|
||||||
if( notBusy )
|
if( notBusy )
|
||||||
{
|
{
|
||||||
// switch to m_ID_current_state = ID_LABEL_BUTT;
|
if( GetToolId() != ID_LABEL_BUTT )
|
||||||
if( m_ID_current_state != ID_LABEL_BUTT )
|
|
||||||
SetToolID( ID_LABEL_BUTT, wxCURSOR_PENCIL, _( "Add Label" ) );
|
SetToolID( ID_LABEL_BUTT, wxCURSOR_PENCIL, _( "Add Label" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
|
@ -421,8 +418,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
case HK_ADD_HLABEL:
|
case HK_ADD_HLABEL:
|
||||||
if( notBusy )
|
if( notBusy )
|
||||||
{
|
{
|
||||||
// switch to m_ID_current_state = ID_HIERLABEL_BUTT;
|
if( GetToolId() != ID_HIERLABEL_BUTT )
|
||||||
if( m_ID_current_state != ID_HIERLABEL_BUTT )
|
|
||||||
SetToolID( ID_HIERLABEL_BUTT, wxCURSOR_PENCIL, _( "Add Hierarchical Label" ) );
|
SetToolID( ID_HIERLABEL_BUTT, wxCURSOR_PENCIL, _( "Add Hierarchical Label" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
|
@ -432,8 +428,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
case HK_ADD_GLABEL:
|
case HK_ADD_GLABEL:
|
||||||
if( notBusy )
|
if( notBusy )
|
||||||
{
|
{
|
||||||
// switch to m_ID_current_state = ID_GLABEL_BUTT;
|
if( GetToolId() != ID_GLABEL_BUTT )
|
||||||
if( m_ID_current_state != ID_GLABEL_BUTT )
|
|
||||||
SetToolID( ID_GLABEL_BUTT, wxCURSOR_PENCIL, _( "Add Global Label" ) );
|
SetToolID( ID_GLABEL_BUTT, wxCURSOR_PENCIL, _( "Add Global Label" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
|
@ -443,8 +438,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
case HK_ADD_JUNCTION:
|
case HK_ADD_JUNCTION:
|
||||||
if( notBusy )
|
if( notBusy )
|
||||||
{
|
{
|
||||||
// switch to m_ID_current_state = ID_JUNCTION_BUTT;
|
if( GetToolId() != ID_JUNCTION_BUTT )
|
||||||
if( m_ID_current_state != ID_JUNCTION_BUTT )
|
|
||||||
SetToolID( ID_JUNCTION_BUTT, wxCURSOR_PENCIL, _( "Add Junction" ) );
|
SetToolID( ID_JUNCTION_BUTT, wxCURSOR_PENCIL, _( "Add Junction" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
|
@ -454,8 +448,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
case HK_ADD_WIRE_ENTRY:
|
case HK_ADD_WIRE_ENTRY:
|
||||||
if( notBusy )
|
if( notBusy )
|
||||||
{
|
{
|
||||||
// switch to m_ID_current_state = ID_WIRETOBUS_ENTRY_BUTT;
|
if( GetToolId() != ID_WIRETOBUS_ENTRY_BUTT )
|
||||||
if( m_ID_current_state != ID_WIRETOBUS_ENTRY_BUTT )
|
|
||||||
SetToolID( ID_WIRETOBUS_ENTRY_BUTT, wxCURSOR_PENCIL, _( "Add Wire to Bus entry" ) );
|
SetToolID( ID_WIRETOBUS_ENTRY_BUTT, wxCURSOR_PENCIL, _( "Add Wire to Bus entry" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
|
@ -465,8 +458,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
case HK_ADD_BUS_ENTRY:
|
case HK_ADD_BUS_ENTRY:
|
||||||
if( notBusy )
|
if( notBusy )
|
||||||
{
|
{
|
||||||
// switch to m_ID_current_state = ID_BUSTOBUS_ENTRY_BUTT;
|
if( GetToolId() != ID_BUSTOBUS_ENTRY_BUTT )
|
||||||
if( m_ID_current_state != ID_BUSTOBUS_ENTRY_BUTT )
|
|
||||||
SetToolID( ID_BUSTOBUS_ENTRY_BUTT, wxCURSOR_PENCIL, _( "Add Bus to Bus entry" ) );
|
SetToolID( ID_BUSTOBUS_ENTRY_BUTT, wxCURSOR_PENCIL, _( "Add Bus to Bus entry" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
|
@ -476,8 +468,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
case HK_ADD_HIER_SHEET:
|
case HK_ADD_HIER_SHEET:
|
||||||
if( notBusy )
|
if( notBusy )
|
||||||
{
|
{
|
||||||
// switch to m_ID_current_state = ID_SHEET_SYMBOL_BUTT;
|
if( GetToolId() != ID_SHEET_SYMBOL_BUTT )
|
||||||
if( m_ID_current_state != ID_SHEET_SYMBOL_BUTT )
|
|
||||||
SetToolID( ID_SHEET_SYMBOL_BUTT, wxCURSOR_PENCIL, _( "Add Sheet" ) );
|
SetToolID( ID_SHEET_SYMBOL_BUTT, wxCURSOR_PENCIL, _( "Add Sheet" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
|
@ -487,8 +478,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
case HK_ADD_GRAPHIC_TEXT:
|
case HK_ADD_GRAPHIC_TEXT:
|
||||||
if( notBusy )
|
if( notBusy )
|
||||||
{
|
{
|
||||||
// switch to m_ID_current_state = ID_TEXT_COMMENT_BUTT;
|
if( GetToolId() != ID_TEXT_COMMENT_BUTT )
|
||||||
if( m_ID_current_state != ID_TEXT_COMMENT_BUTT )
|
|
||||||
SetToolID( ID_TEXT_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add Text" ) );
|
SetToolID( ID_TEXT_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add Text" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
|
@ -498,8 +488,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
case HK_ADD_GRAPHIC_POLYLINE:
|
case HK_ADD_GRAPHIC_POLYLINE:
|
||||||
if( notBusy )
|
if( notBusy )
|
||||||
{
|
{
|
||||||
// switch to m_ID_current_state = ID_LINE_COMMENT_BUTT;
|
if( GetToolId() != ID_LINE_COMMENT_BUTT )
|
||||||
if( m_ID_current_state != ID_LINE_COMMENT_BUTT )
|
|
||||||
SetToolID( ID_LINE_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add Lines" ) );
|
SetToolID( ID_LINE_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add Lines" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
|
@ -510,15 +499,14 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
// An item can be selected. If not a Bus, a begin command is not possible
|
// An item can be selected. If not a Bus, a begin command is not possible
|
||||||
if( notBusy )
|
if( notBusy )
|
||||||
{
|
{
|
||||||
// switch to m_ID_current_state = ID_WIRE_BUTT;
|
if( GetToolId() != ID_BUS_BUTT )
|
||||||
if( m_ID_current_state != ID_BUS_BUTT )
|
|
||||||
SetToolID( ID_BUS_BUTT, wxCURSOR_PENCIL, _( "Add Bus" ) );
|
SetToolID( ID_BUS_BUTT, wxCURSOR_PENCIL, _( "Add Bus" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aItem && aItem->IsNew() && ( m_ID_current_state == ID_BUS_BUTT ) )
|
if( aItem && aItem->IsNew() && ( GetToolId() == ID_BUS_BUTT ) )
|
||||||
{
|
{
|
||||||
if( aItem->Type() == SCH_LINE_T )
|
if( aItem->Type() == SCH_LINE_T )
|
||||||
{
|
{
|
||||||
|
@ -538,15 +526,14 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
// An item can be selected. If not a wire, a begin command is not possible
|
// An item can be selected. If not a wire, a begin command is not possible
|
||||||
if( notBusy )
|
if( notBusy )
|
||||||
{
|
{
|
||||||
// switch to m_ID_current_state = ID_WIRE_BUTT;
|
if( GetToolId() != ID_WIRE_BUTT )
|
||||||
if( m_ID_current_state != ID_WIRE_BUTT )
|
|
||||||
SetToolID( ID_WIRE_BUTT, wxCURSOR_PENCIL, _( "Add Wire" ) );
|
SetToolID( ID_WIRE_BUTT, wxCURSOR_PENCIL, _( "Add Wire" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aItem && aItem->IsNew() && ( m_ID_current_state == ID_WIRE_BUTT ) )
|
if( aItem && aItem->IsNew() && ( GetToolId() == ID_WIRE_BUTT ) )
|
||||||
{
|
{
|
||||||
if( aItem->Type() == SCH_LINE_T )
|
if( aItem->Type() == SCH_LINE_T )
|
||||||
{
|
{
|
||||||
|
@ -564,7 +551,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
case HK_ADD_NOCONN_FLAG: // Add a no connected flag
|
case HK_ADD_NOCONN_FLAG: // Add a no connected flag
|
||||||
if( notBusy )
|
if( notBusy )
|
||||||
{
|
{
|
||||||
if( m_ID_current_state != ID_NOCONN_BUTT )
|
if( GetToolId() != ID_NOCONN_BUTT )
|
||||||
SetToolID( ID_NOCONN_BUTT, wxCURSOR_PENCIL, _( "Add \"NoNonnect\" Flags" ) );
|
SetToolID( ID_NOCONN_BUTT, wxCURSOR_PENCIL, _( "Add \"NoNonnect\" Flags" ) );
|
||||||
|
|
||||||
OnLeftClick( aDC, aPosition );
|
OnLeftClick( aDC, aPosition );
|
||||||
|
@ -1032,12 +1019,9 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_LIBEDIT_CREATE_PIN:
|
case HK_LIBEDIT_CREATE_PIN:
|
||||||
{
|
SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add pin" ) );
|
||||||
wxCommandEvent evt;
|
OnLeftClick( aDC, aPosition );
|
||||||
evt.SetId( ID_LIBEDIT_PIN_BUTT );
|
|
||||||
Process_Special_Functions( evt );
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case HK_DELETE:
|
case HK_DELETE:
|
||||||
m_drawItem = LocateItemUsingCursor( aPosition );
|
m_drawItem = LocateItemUsingCursor( aPosition );
|
||||||
|
|
|
@ -66,7 +66,7 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event )
|
||||||
wxString CmpName;
|
wxString CmpName;
|
||||||
LIB_ALIAS* LibEntry = NULL;
|
LIB_ALIAS* LibEntry = NULL;
|
||||||
|
|
||||||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
|
|
||||||
if( GetScreen()->IsModify()
|
if( GetScreen()->IsModify()
|
||||||
&& !IsOK( this, _( "Current part not saved.\n\nDiscard current changes?" ) ) )
|
&& !IsOK( this, _( "Current part not saved.\n\nDiscard current changes?" ) ) )
|
||||||
|
@ -233,7 +233,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
|
|
||||||
if( GetScreen()->IsModify() )
|
if( GetScreen()->IsModify() )
|
||||||
{
|
{
|
||||||
|
@ -371,7 +371,7 @@ void LIB_EDIT_FRAME::DeleteOnePart( wxCommandEvent& event )
|
||||||
wxArrayString ListNames;
|
wxArrayString ListNames;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
|
|
||||||
m_lastDrawItem = NULL;
|
m_lastDrawItem = NULL;
|
||||||
m_drawItem = NULL;
|
m_drawItem = NULL;
|
||||||
|
@ -470,7 +470,7 @@ void LIB_EDIT_FRAME::CreateNewLibraryPart( wxCommandEvent& event )
|
||||||
lost!\n\nClear the current component from the screen?" ) ) )
|
lost!\n\nClear the current component from the screen?" ) ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
|
|
||||||
m_drawItem = NULL;
|
m_drawItem = NULL;
|
||||||
|
|
||||||
|
|
|
@ -27,38 +27,17 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
|
||||||
|
|
||||||
if( DrawEntry == NULL || DrawEntry->m_Flags == 0 )
|
if( DrawEntry == NULL || DrawEntry->m_Flags == 0 )
|
||||||
{
|
{
|
||||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
|
DrawEntry = LocateItemUsingCursor( aPosition );
|
||||||
|
|
||||||
if( DrawEntry == NULL )
|
|
||||||
{
|
|
||||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
|
|
||||||
GetScreen()->GetCrossHairPosition() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( DrawEntry )
|
if( DrawEntry )
|
||||||
DrawEntry->DisplayInfo( this );
|
DrawEntry->DisplayInfo( this );
|
||||||
|
|
||||||
else
|
else
|
||||||
DisplayCmpDoc();
|
DisplayCmpDoc();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case 0:
|
case ID_NO_TOOL_SELECTED:
|
||||||
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:
|
||||||
|
@ -91,13 +70,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
||||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
|
DrawEntry = LocateItemUsingCursor( aPosition );
|
||||||
|
|
||||||
if( DrawEntry == NULL )
|
|
||||||
{
|
|
||||||
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
|
|
||||||
GetScreen()->GetCrossHairPosition() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
|
@ -119,12 +92,12 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
|
||||||
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
|
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
|
||||||
SaveCopyInUndoList( m_component );
|
SaveCopyInUndoList( m_component );
|
||||||
PlaceAncre();
|
PlaceAncre();
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DisplayError( this, wxT( "LIB_EDIT_FRAME::OnLeftClick error" ) );
|
DisplayError( this, wxT( "LIB_EDIT_FRAME::OnLeftClick error" ) );
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,12 +117,8 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
|
||||||
|
|
||||||
if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) )
|
if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) )
|
||||||
{ // We can locate an item
|
{ // We can locate an item
|
||||||
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, aPosition );
|
m_drawItem = LocateItemUsingCursor( aPosition );
|
||||||
if( m_drawItem == NULL )
|
|
||||||
{
|
|
||||||
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
|
|
||||||
GetScreen()->GetCrossHairPosition() );
|
|
||||||
}
|
|
||||||
if( m_drawItem == NULL )
|
if( m_drawItem == NULL )
|
||||||
{
|
{
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||||
|
|
|
@ -46,14 +46,12 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
|
||||||
// If Command in progress, put menu "cancel"
|
// If Command in progress, put menu "cancel"
|
||||||
if( DrawEntry && DrawEntry->m_Flags )
|
if( DrawEntry && DrawEntry->m_Flags )
|
||||||
{
|
{
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING,
|
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel" ), cancel_xpm );
|
||||||
_( "Cancel" ), cancel_xpm );
|
|
||||||
PopMenu->AppendSeparator();
|
PopMenu->AppendSeparator();
|
||||||
}
|
}
|
||||||
else if( m_ID_current_state && m_ID_current_state != ID_LIBEDIT_NO_TOOL )
|
else if( GetToolId() != ID_NO_TOOL_SELECTED )
|
||||||
{ // If a tool is active, put menu "end tool"
|
{ // If a tool is active, put menu "end tool"
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING,
|
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "End Tool" ), cancel_tool_xpm );
|
||||||
_( "End Tool" ), cancel_tool_xpm );
|
|
||||||
PopMenu->AppendSeparator();
|
PopMenu->AppendSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,8 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||||
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnSelectAlias )
|
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnSelectAlias )
|
||||||
|
|
||||||
/* Right vertical toolbar. */
|
/* Right vertical toolbar. */
|
||||||
EVT_TOOL_RANGE( ID_LIBEDIT_NO_TOOL, ID_LIBEDIT_DELETE_ITEM_BUTT,
|
EVT_TOOL( ID_NO_TOOL_SELECTED, LIB_EDIT_FRAME::OnSelectTool )
|
||||||
|
EVT_TOOL_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_DELETE_ITEM_BUTT,
|
||||||
LIB_EDIT_FRAME::OnSelectTool )
|
LIB_EDIT_FRAME::OnSelectTool )
|
||||||
|
|
||||||
/* menubar commands */
|
/* menubar commands */
|
||||||
|
@ -155,7 +156,8 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||||
EVT_UPDATE_UI( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnUpdateSelectAlias )
|
EVT_UPDATE_UI( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnUpdateSelectAlias )
|
||||||
EVT_UPDATE_UI( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganNormal )
|
EVT_UPDATE_UI( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganNormal )
|
||||||
EVT_UPDATE_UI( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganConvert )
|
EVT_UPDATE_UI( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganConvert )
|
||||||
EVT_UPDATE_UI_RANGE( ID_LIBEDIT_NO_TOOL, ID_LIBEDIT_DELETE_ITEM_BUTT,
|
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, LIB_EDIT_FRAME::OnUpdateEditingPart )
|
||||||
|
EVT_UPDATE_UI_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_DELETE_ITEM_BUTT,
|
||||||
LIB_EDIT_FRAME::OnUpdateEditingPart )
|
LIB_EDIT_FRAME::OnUpdateEditingPart )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
@ -177,7 +179,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
|
||||||
m_drawSpecificUnit = false;
|
m_drawSpecificUnit = false;
|
||||||
m_tempCopyComponent = NULL;
|
m_tempCopyComponent = NULL;
|
||||||
m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr;
|
m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr;
|
||||||
m_ID_current_state = ID_LIBEDIT_NO_TOOL;
|
|
||||||
|
|
||||||
// Give an icon
|
// Give an icon
|
||||||
SetIcon( wxIcon( libedit_xpm ) );
|
SetIcon( wxIcon( libedit_xpm ) );
|
||||||
|
@ -442,14 +443,8 @@ void LIB_EDIT_FRAME::OnUpdateEditingPart( wxUpdateUIEvent& aEvent )
|
||||||
{
|
{
|
||||||
aEvent.Enable( m_component != NULL );
|
aEvent.Enable( m_component != NULL );
|
||||||
|
|
||||||
if( m_component != NULL )
|
if( m_component != NULL && aEvent.GetEventObject() == m_VToolBar )
|
||||||
{
|
aEvent.Check( GetToolId() == aEvent.GetId() );
|
||||||
if( m_ID_current_state == 0 )
|
|
||||||
m_ID_current_state = ID_LIBEDIT_NO_TOOL;
|
|
||||||
|
|
||||||
if( aEvent.GetEventObject() == m_VToolBar )
|
|
||||||
aEvent.Check( m_ID_current_state == aEvent.GetId() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -596,7 +591,7 @@ void LIB_EDIT_FRAME::OnViewEntryDoc( wxCommandEvent& event )
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::OnSelectBodyStyle( wxCommandEvent& event )
|
void LIB_EDIT_FRAME::OnSelectBodyStyle( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
|
|
||||||
if( event.GetId() == ID_DE_MORGAN_NORMAL_BUTT )
|
if( event.GetId() == ID_DE_MORGAN_NORMAL_BUTT )
|
||||||
m_convert = 1;
|
m_convert = 1;
|
||||||
|
@ -642,7 +637,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
if( DrawPanel->IsMouseCaptured() )
|
if( DrawPanel->IsMouseCaptured() )
|
||||||
DrawPanel->EndMouseCapture();
|
DrawPanel->EndMouseCapture();
|
||||||
else
|
else
|
||||||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_LIBEDIT_DELETE_ITEM:
|
case ID_POPUP_LIBEDIT_DELETE_ITEM:
|
||||||
|
@ -650,7 +645,8 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(),
|
||||||
|
wxEmptyString );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -874,7 +870,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
DrawPanel->m_IgnoreMouseEvents = false;
|
DrawPanel->m_IgnoreMouseEvents = false;
|
||||||
|
|
||||||
if( m_ID_current_state == 0 )
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
||||||
m_lastDrawItem = NULL;
|
m_lastDrawItem = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1032,14 +1028,15 @@ void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
int id = aEvent.GetId();
|
int id = aEvent.GetId();
|
||||||
|
|
||||||
if( m_ID_current_state == 0 )
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
||||||
m_lastDrawItem = NULL;
|
m_lastDrawItem = NULL;
|
||||||
|
|
||||||
DrawPanel->EndMouseCapture( ID_LIBEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(),
|
||||||
|
wxEmptyString );
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case ID_LIBEDIT_NO_TOOL:
|
case ID_NO_TOOL_SELECTED:
|
||||||
SetToolID( id, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( id, wxCURSOR_ARROW, wxEmptyString );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1054,7 +1051,7 @@ void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||||
cmd.SetId( ID_LIBEDIT_EDIT_PIN );
|
cmd.SetId( ID_LIBEDIT_EDIT_PIN );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_ARROW, wxEmptyString );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1085,13 +1082,13 @@ void LIB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
||||||
case ID_LIBEDIT_IMPORT_BODY_BUTT:
|
case ID_LIBEDIT_IMPORT_BODY_BUTT:
|
||||||
SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
|
SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
|
||||||
LoadOneSymbol();
|
LoadOneSymbol();
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_ARROW, wxEmptyString );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_LIBEDIT_EXPORT_BODY_BUTT:
|
case ID_LIBEDIT_EXPORT_BODY_BUTT:
|
||||||
SetToolID( id, wxCURSOR_ARROW, _( "Export" ) );
|
SetToolID( id, wxCURSOR_ARROW, _( "Export" ) );
|
||||||
SaveOneSymbol();
|
SaveOneSymbol();
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_ARROW, wxEmptyString );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
||||||
|
|
|
@ -31,9 +31,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
SCH_ITEM* item = GetScreen()->GetCurItem();
|
SCH_ITEM* item = GetScreen()->GetCurItem();
|
||||||
wxPoint gridPosition = GetGridPosition( aPosition );
|
wxPoint gridPosition = GetGridPosition( aPosition );
|
||||||
|
|
||||||
if( ( m_ID_current_state == ID_SCH_NO_TOOL )
|
if( ( GetToolId() == ID_NO_TOOL_SELECTED ) || ( item && item->m_Flags ) )
|
||||||
|| ( m_ID_current_state == 0 )
|
|
||||||
|| ( item && item->m_Flags ) )
|
|
||||||
{
|
{
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
m_itemToRepeat = NULL;
|
m_itemToRepeat = NULL;
|
||||||
|
@ -73,10 +71,9 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case 0:
|
case ID_NO_TOOL_SELECTED:
|
||||||
case ID_SCH_NO_TOOL:
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_HIERARCHY_PUSH_POP_BUTT:
|
case ID_HIERARCHY_PUSH_POP_BUTT:
|
||||||
|
@ -139,7 +136,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
case ID_BUSTOBUS_ENTRY_BUTT:
|
case ID_BUSTOBUS_ENTRY_BUTT:
|
||||||
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
item = CreateBusEntry( aDC, ( m_ID_current_state == ID_WIRETOBUS_ENTRY_BUTT ) ?
|
item = CreateBusEntry( aDC, ( GetToolId() == ID_WIRETOBUS_ENTRY_BUTT ) ?
|
||||||
WIRE_TO_BUS : BUS_TO_BUS );
|
WIRE_TO_BUS : BUS_TO_BUS );
|
||||||
GetScreen()->SetCurItem( item );
|
GetScreen()->SetCurItem( item );
|
||||||
DrawPanel->m_AutoPAN_Request = true;
|
DrawPanel->m_AutoPAN_Request = true;
|
||||||
|
@ -209,10 +206,10 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
case ID_HIERLABEL_BUTT:
|
case ID_HIERLABEL_BUTT:
|
||||||
if( (item == NULL) || (item->m_Flags == 0) )
|
if( (item == NULL) || (item->m_Flags == 0) )
|
||||||
{
|
{
|
||||||
if(m_ID_current_state == ID_GLABEL_BUTT)
|
if( GetToolId() == ID_GLABEL_BUTT )
|
||||||
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_GLOBLABEL ) );
|
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_GLOBLABEL ) );
|
||||||
|
|
||||||
if(m_ID_current_state == ID_HIERLABEL_BUTT)
|
if( GetToolId() == ID_HIERLABEL_BUTT )
|
||||||
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_HIERLABEL ) );
|
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_HIERLABEL ) );
|
||||||
|
|
||||||
DrawPanel->m_AutoPAN_Request = true;
|
DrawPanel->m_AutoPAN_Request = true;
|
||||||
|
@ -251,7 +248,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
|
|
||||||
if( (item->Type() == SCH_SHEET_T) && (item->m_Flags == 0) )
|
if( (item->Type() == SCH_SHEET_T) && (item->m_Flags == 0) )
|
||||||
{
|
{
|
||||||
if( m_ID_current_state == ID_IMPORT_HLABEL_BUTT )
|
if( GetToolId() == ID_IMPORT_HLABEL_BUTT )
|
||||||
GetScreen()->SetCurItem( Import_PinSheet( (SCH_SHEET*) item, aDC ) );
|
GetScreen()->SetCurItem( Import_PinSheet( (SCH_SHEET*) item, aDC ) );
|
||||||
else
|
else
|
||||||
GetScreen()->SetCurItem( Create_PinSheet( (SCH_SHEET*) item, aDC ) );
|
GetScreen()->SetCurItem( Create_PinSheet( (SCH_SHEET*) item, aDC ) );
|
||||||
|
@ -296,9 +293,9 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
SetToolID( ID_SCH_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick invalid tool ID <" ) +
|
wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick invalid tool ID <" ) +
|
||||||
wxString::Format( wxT( "%d> selected." ), m_ID_current_state ) );
|
wxString::Format( wxT( "%d> selected." ), GetToolId() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,10 +314,9 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
EDA_ITEM* item = GetScreen()->GetCurItem();
|
EDA_ITEM* item = GetScreen()->GetCurItem();
|
||||||
wxPoint pos = aPosition;
|
wxPoint pos = aPosition;
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case ID_SCH_NO_TOOL:
|
case ID_NO_TOOL_SELECTED:
|
||||||
case 0:
|
|
||||||
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
item = LocateAndShowItem( aPosition );
|
item = LocateAndShowItem( aPosition );
|
||||||
|
|
|
@ -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 Command in progress: add "cancel" and "end tool" menu
|
||||||
if( m_ID_current_state && m_ID_current_state != ID_SCH_NO_TOOL)
|
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
||||||
{
|
{
|
||||||
if( DrawStruct && DrawStruct->m_Flags )
|
if( DrawStruct && DrawStruct->m_Flags )
|
||||||
{
|
{
|
||||||
|
|
|
@ -134,7 +134,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
default:
|
default:
|
||||||
|
|
||||||
// Stop the current command and deselect the current tool
|
// Stop the current command and deselect the current tool
|
||||||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,8 +170,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
||||||
if( m_ID_current_state == 0 )
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_END_LINE:
|
case ID_POPUP_END_LINE:
|
||||||
|
@ -575,7 +574,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxID_COPY: // really this is a Save block for paste
|
case wxID_COPY: // really this is a Save block for paste
|
||||||
|
@ -655,7 +654,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
// End switch ( id ) (Command execution)
|
// End switch ( id ) (Command execution)
|
||||||
|
|
||||||
if( m_ID_current_state == 0 )
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
||||||
m_itemToRepeat = NULL;
|
m_itemToRepeat = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,7 +727,7 @@ void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Stop the current command (if any) but keep the current tool
|
// Stop the current command (if any) but keep the current tool
|
||||||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,11 +737,11 @@ void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
||||||
int id = aEvent.GetId();
|
int id = aEvent.GetId();
|
||||||
|
|
||||||
// Stop the current command and deselect the current tool.
|
// Stop the current command and deselect the current tool.
|
||||||
DrawPanel->EndMouseCapture( ID_SCH_NO_TOOL, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case ID_SCH_NO_TOOL:
|
case ID_NO_TOOL_SELECTED:
|
||||||
SetToolID( id, DrawPanel->GetDefaultCursor(), _( "No tool selected" ) );
|
SetToolID( id, DrawPanel->GetDefaultCursor(), _( "No tool selected" ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -826,9 +825,6 @@ void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
|
void SCH_EDIT_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
|
||||||
{
|
{
|
||||||
if( m_ID_current_state == 0 )
|
|
||||||
m_ID_current_state = ID_SCH_NO_TOOL;
|
|
||||||
|
|
||||||
if( aEvent.GetEventObject() == m_VToolBar )
|
if( aEvent.GetEventObject() == m_VToolBar )
|
||||||
aEvent.Check( m_ID_current_state == aEvent.GetId() );
|
aEvent.Check( GetToolId() == aEvent.GetId() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||||
|
|
||||||
// Tools and buttons for vertical toolbar.
|
// Tools and buttons for vertical toolbar.
|
||||||
EVT_TOOL( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
|
EVT_TOOL( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
|
||||||
|
EVT_TOOL( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnSelectTool )
|
||||||
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
||||||
SCH_EDIT_FRAME::OnSelectTool )
|
SCH_EDIT_FRAME::OnSelectTool )
|
||||||
|
|
||||||
|
@ -124,6 +125,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||||
EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste )
|
EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste )
|
||||||
EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnUpdateHiddenPins )
|
EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnUpdateHiddenPins )
|
||||||
EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation )
|
EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation )
|
||||||
|
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnUpdateSelectTool )
|
||||||
EVT_UPDATE_UI_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
EVT_UPDATE_UI_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
||||||
SCH_EDIT_FRAME::OnUpdateSelectTool )
|
SCH_EDIT_FRAME::OnUpdateSelectTool )
|
||||||
|
|
||||||
|
@ -161,7 +163,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
|
||||||
m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr;
|
m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr;
|
||||||
m_dlgFindReplace = NULL;
|
m_dlgFindReplace = NULL;
|
||||||
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
|
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
|
||||||
m_ID_current_state = ID_SCH_NO_TOOL;
|
|
||||||
|
|
||||||
CreateScreens();
|
CreateScreens();
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ LIB_DRAW_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC*
|
||||||
// This is normal when adding new items to the current component
|
// This is normal when adding new items to the current component
|
||||||
ClearTempCopyComponent();
|
ClearTempCopyComponent();
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case ID_LIBEDIT_BODY_ARC_BUTT:
|
case ID_LIBEDIT_BODY_ARC_BUTT:
|
||||||
m_drawItem = new LIB_ARC( LibEntry );
|
m_drawItem = new LIB_ARC( LibEntry );
|
||||||
|
@ -306,10 +306,10 @@ void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC )
|
||||||
if( m_component == NULL || m_drawItem == NULL )
|
if( m_component == NULL || m_drawItem == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( m_ID_current_state )
|
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
||||||
SetCursor( wxCURSOR_PENCIL );
|
SetCursor( wxCURSOR_PENCIL );
|
||||||
else
|
else
|
||||||
SetCursor( wxCURSOR_ARROW );
|
SetCursor( DrawPanel->GetDefaultCursor() );
|
||||||
|
|
||||||
if( GetTempCopyComponent() ) // used when editing an existing item
|
if( GetTempCopyComponent() ) // used when editing an existing item
|
||||||
SaveCopyInUndoList( GetTempCopyComponent() );
|
SaveCopyInUndoList( GetTempCopyComponent() );
|
||||||
|
|
|
@ -35,7 +35,7 @@ void LIB_EDIT_FRAME::ReCreateVToolbar()
|
||||||
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
|
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
|
||||||
|
|
||||||
// Set up toolbar
|
// Set up toolbar
|
||||||
m_VToolBar->AddTool( ID_LIBEDIT_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
|
m_VToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, wxBitmap( cursor_xpm ),
|
||||||
_( "Deselect current tool" ), wxITEM_CHECK );
|
_( "Deselect current tool" ), wxITEM_CHECK );
|
||||||
|
|
||||||
m_VToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString, wxBitmap( pin_xpm ),
|
m_VToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString, wxBitmap( pin_xpm ),
|
||||||
|
|
|
@ -129,7 +129,7 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
|
||||||
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
|
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
|
||||||
|
|
||||||
// Set up toolbar
|
// Set up toolbar
|
||||||
m_VToolBar->AddTool( ID_SCH_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
|
m_VToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, wxBitmap( cursor_xpm ),
|
||||||
wxEmptyString, wxITEM_CHECK );
|
wxEmptyString, wxITEM_CHECK );
|
||||||
|
|
||||||
m_VToolBar->AddTool( ID_HIERARCHY_PUSH_POP_BUTT, wxEmptyString,
|
m_VToolBar->AddTool( ID_HIERARCHY_PUSH_POP_BUTT, wxEmptyString,
|
||||||
|
|
|
@ -25,7 +25,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
|
||||||
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
|
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( m_ID_current_state == 0 )
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
||||||
{
|
{
|
||||||
if( DrawStruct && DrawStruct->m_Flags )
|
if( DrawStruct && DrawStruct->m_Flags )
|
||||||
{
|
{
|
||||||
|
@ -47,13 +47,11 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case 0:
|
case ID_NO_TOOL_SELECTED:
|
||||||
case ID_GERBVIEW_NO_TOOL:
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ID_GERBVIEW_DELETE_ITEM_BUTT:
|
case ID_GERBVIEW_DELETE_ITEM_BUTT:
|
||||||
DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
|
DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
|
||||||
|
|
||||||
|
@ -106,8 +104,8 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_ID_current_state == 0 )
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
||||||
SetToolID( 0, 0, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
else
|
else
|
||||||
DrawPanel->SetCursor( DrawPanel->GetDefaultCursor() );
|
DrawPanel->SetCursor( DrawPanel->GetDefaultCursor() );
|
||||||
|
|
||||||
|
@ -131,12 +129,12 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
ClearMsgPanel();
|
ClearMsgPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_GERBVIEW_NO_TOOL:
|
case ID_NO_TOOL_SELECTED:
|
||||||
SetToolID( 0, 0, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
||||||
SetToolID( 0, 0, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
||||||
|
|
|
@ -83,7 +83,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
|
||||||
WinEDA_GerberFrame::Process_Special_Functions )
|
WinEDA_GerberFrame::Process_Special_Functions )
|
||||||
|
|
||||||
// Vertical toolbar:
|
// Vertical toolbar:
|
||||||
EVT_TOOL( ID_GERBVIEW_NO_TOOL, WinEDA_GerberFrame::Process_Special_Functions )
|
EVT_TOOL( ID_NO_TOOL_SELECTED, WinEDA_GerberFrame::Process_Special_Functions )
|
||||||
EVT_TOOL( ID_GERBVIEW_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
|
EVT_TOOL( ID_GERBVIEW_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
|
||||||
|
|
||||||
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
||||||
|
|
|
@ -18,7 +18,6 @@ enum gerbview_ids
|
||||||
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
|
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
|
||||||
|
|
||||||
ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
|
ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
|
||||||
ID_GERBVIEW_NO_TOOL,
|
|
||||||
ID_GERBVIEW_DELETE_ITEM_BUTT,
|
ID_GERBVIEW_DELETE_ITEM_BUTT,
|
||||||
ID_GERBVIEW_GLOBAL_DELETE,
|
ID_GERBVIEW_GLOBAL_DELETE,
|
||||||
ID_GERBVIEW_OPTIONS_SETUP,
|
ID_GERBVIEW_OPTIONS_SETUP,
|
||||||
|
|
|
@ -30,12 +30,13 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu
|
||||||
}
|
}
|
||||||
|
|
||||||
// If command in progress, end command.
|
// If command in progress, end command.
|
||||||
if( m_ID_current_state )
|
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
||||||
{
|
{
|
||||||
if( DrawStruct && DrawStruct->m_Flags )
|
if( DrawStruct && DrawStruct->m_Flags )
|
||||||
PopMenu->Append( ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ) );
|
PopMenu->Append( ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ) );
|
||||||
else
|
else
|
||||||
PopMenu->Append( ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ) );
|
PopMenu->Append( ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ) );
|
||||||
|
|
||||||
PopMenu->AppendSeparator();
|
PopMenu->AppendSeparator();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -115,7 +115,7 @@ void WinEDA_GerberFrame::ReCreateVToolbar( void )
|
||||||
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE );
|
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE );
|
||||||
|
|
||||||
// Set up toolbar
|
// Set up toolbar
|
||||||
m_VToolBar->AddTool( ID_GERBVIEW_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ) );
|
m_VToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, wxBitmap( cursor_xpm ) );
|
||||||
m_VToolBar->AddSeparator();
|
m_VToolBar->AddSeparator();
|
||||||
m_VToolBar->AddTool( ID_GERBVIEW_DELETE_ITEM_BUTT, wxEmptyString, wxBitmap( delete_body_xpm ),
|
m_VToolBar->AddTool( ID_GERBVIEW_DELETE_ITEM_BUTT, wxEmptyString, wxBitmap( delete_body_xpm ),
|
||||||
_( "Delete items" ) );
|
_( "Delete items" ) );
|
||||||
|
|
|
@ -74,7 +74,7 @@ enum main_id
|
||||||
ID_KICAD_ABOUT,
|
ID_KICAD_ABOUT,
|
||||||
|
|
||||||
ID_EDIT,
|
ID_EDIT,
|
||||||
|
ID_NO_TOOL_SELECTED,
|
||||||
ID_SEL_BG_COLOR,
|
ID_SEL_BG_COLOR,
|
||||||
|
|
||||||
ID_COLORS_SETUP,
|
ID_COLORS_SETUP,
|
||||||
|
|
|
@ -194,6 +194,8 @@ public:
|
||||||
|
|
||||||
class EDA_DRAW_FRAME : public EDA_BASE_FRAME
|
class EDA_DRAW_FRAME : public EDA_BASE_FRAME
|
||||||
{
|
{
|
||||||
|
int m_toolId; ///< Id of active button on the vertical toolbar.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EDA_DRAW_PANEL* DrawPanel; // Draw area
|
EDA_DRAW_PANEL* DrawPanel; // Draw area
|
||||||
WinEDA_MsgPanel* MsgPanel; // Panel used to display some
|
WinEDA_MsgPanel* MsgPanel; // Panel used to display some
|
||||||
|
@ -211,8 +213,6 @@ public:
|
||||||
|
|
||||||
int m_CursorShape; // shape for cursor (0 = default
|
int m_CursorShape; // shape for cursor (0 = default
|
||||||
// cursor)
|
// cursor)
|
||||||
int m_ID_current_state; // Id of active button on the
|
|
||||||
// vertical toolbar
|
|
||||||
int m_ID_last_state; // Id of previous active button
|
int m_ID_last_state; // Id of previous active button
|
||||||
// on the vertical toolbar
|
// on the vertical toolbar
|
||||||
int m_HTOOL_current_state; // Id of active button on
|
int m_HTOOL_current_state; // Id of active button on
|
||||||
|
@ -298,20 +298,20 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetToolID
|
* Function SetToolID
|
||||||
* Enables the icon of the selected tool in the vertical toolbar.
|
* sets the tool command ID to \a aId and sets the cursor to \a aCursor. The
|
||||||
* (Or tool ID_NO_SELECT_BUTT default if no new selection)
|
* command ID must be greater or equal ::ID_NO_TOOL_SELECTED. If the command
|
||||||
* @param aId = new m_ID_current_state value (if aId >= 0)
|
* ID is less than ::ID_NO_TOOL_SELECTED, the tool command ID is set to
|
||||||
* @param aCursor = the new cursor shape
|
* ::ID_NO_TOOL_SELECTED. On debug builds, an assertion will be raised when
|
||||||
* @param aToolMsg = tool message in status bar
|
* \a aId is invalid.
|
||||||
* if (aId >= 0)
|
* @param aId New tool command ID if greater than or equal to ::ID_NO_TOOL_SELECTED.
|
||||||
* Updates all variables related:
|
If less than zero, the current tool command ID is retained.
|
||||||
* m_ID_current_state, cursor shape and message in status bar
|
* @param aCursor Sets the cursor shape if greater than or equal to zero.
|
||||||
* If (aId < 0)
|
* @param aToolMsg The tool message to set in the status bar.
|
||||||
* Only updates the cursor shape and message in status bar
|
|
||||||
* (does not the current m_ID_current_state value
|
|
||||||
*/
|
*/
|
||||||
virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
|
virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
|
||||||
|
|
||||||
|
int GetToolId() const { return m_toolId; }
|
||||||
|
|
||||||
/* These 4 functions provide a basic way to show/hide grid
|
/* These 4 functions provide a basic way to show/hide grid
|
||||||
* and /get/set grid color.
|
* and /get/set grid color.
|
||||||
* These parameters are saved in kicad config for each main frame
|
* These parameters are saved in kicad config for each main frame
|
||||||
|
|
|
@ -97,7 +97,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: // Abort a current command (if any)
|
default: // Abort a current command (if any)
|
||||||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -388,8 +388,8 @@ void WinEDA_BasePcbFrame::SetToolID( int aId, int aCursor, const wxString& aTool
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// handle color changes for transitions in and out of ID_TRACK_BUTT
|
// handle color changes for transitions in and out of ID_TRACK_BUTT
|
||||||
if( ( m_ID_current_state == ID_TRACK_BUTT && aId != ID_TRACK_BUTT )
|
if( ( GetToolId() == ID_TRACK_BUTT && aId != ID_TRACK_BUTT )
|
||||||
|| ( m_ID_current_state != ID_TRACK_BUTT && aId== ID_TRACK_BUTT ) )
|
|| ( GetToolId() != ID_TRACK_BUTT && aId== ID_TRACK_BUTT ) )
|
||||||
{
|
{
|
||||||
if( DisplayOpt.ContrastModeDisplay )
|
if( DisplayOpt.ContrastModeDisplay )
|
||||||
redraw = true;
|
redraw = true;
|
||||||
|
|
|
@ -194,7 +194,7 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
GetScreen()->ClearBlockCommand();
|
GetScreen()->ClearBlockCommand();
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||||
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
SetToolID( GetToolId(), DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
DrawPanel->Refresh( true );
|
DrawPanel->Refresh( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||||
DrawPanel->Refresh( true );
|
DrawPanel->Refresh( true );
|
||||||
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
SetToolID( GetToolId(), DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
|
||||||
&& DisplayOpt.ContrastModeDisplay )
|
&& DisplayOpt.ContrastModeDisplay )
|
||||||
{
|
{
|
||||||
// when routing tracks
|
// when routing tracks
|
||||||
if( frame && frame->m_ID_current_state == ID_TRACK_BUTT )
|
if( frame && frame->GetToolId() == ID_TRACK_BUTT )
|
||||||
{
|
{
|
||||||
int routeTop = screen->m_Route_Layer_TOP;
|
int routeTop = screen->m_Route_Layer_TOP;
|
||||||
int routeBot = screen->m_Route_Layer_BOTTOM;
|
int routeBot = screen->m_Route_Layer_BOTTOM;
|
||||||
|
|
|
@ -76,7 +76,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
// @todo: add switch here and add calls to PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
// @todo: add switch here and add calls to PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
// when searching is needed from a hotkey handler
|
// when searching is needed from a hotkey handler
|
||||||
}
|
}
|
||||||
else if( m_ID_current_state == 0 )
|
else if( GetToolId() == ID_NO_TOOL_SELECTED )
|
||||||
{
|
{
|
||||||
switch( m_HTOOL_current_state )
|
switch( m_HTOOL_current_state )
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch( m_ID_current_state )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case ID_PCB_SHOW_1_RATSNEST_BUTT:
|
case ID_PCB_SHOW_1_RATSNEST_BUTT:
|
||||||
scanList = GENERAL_COLLECTOR::PadsOrModules;
|
scanList = GENERAL_COLLECTOR::PadsOrModules;
|
||||||
|
@ -301,7 +301,7 @@ void WinEDA_PcbFrame::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int a
|
||||||
*/
|
*/
|
||||||
bool keep_on_grid = true;
|
bool keep_on_grid = true;
|
||||||
|
|
||||||
if( m_ID_current_state == ID_PCB_DELETE_ITEM_BUTT )
|
if( GetToolId() == ID_PCB_DELETE_ITEM_BUTT )
|
||||||
keep_on_grid = false;
|
keep_on_grid = false;
|
||||||
|
|
||||||
/* Cursor is left off grid if no block in progress and no moving object */
|
/* Cursor is left off grid if no block in progress and no moving object */
|
||||||
|
@ -321,7 +321,7 @@ void WinEDA_PcbFrame::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int a
|
||||||
grid.x = (int) GetScreen()->GetGridSize().x;
|
grid.x = (int) GetScreen()->GetGridSize().x;
|
||||||
grid.y = (int) GetScreen()->GetGridSize().y;
|
grid.y = (int) GetScreen()->GetGridSize().y;
|
||||||
|
|
||||||
if( Magnetize( m_Pcb, this, m_ID_current_state, grid, on_grid, &pos ) )
|
if( Magnetize( m_Pcb, this, GetToolId(), grid, on_grid, &pos ) )
|
||||||
{
|
{
|
||||||
GetScreen()->SetCrossHairPosition( pos );
|
GetScreen()->SetCrossHairPosition( pos );
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,8 +129,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_ID_current_state == 0 )
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
else
|
else
|
||||||
SetCursor( DrawPanel->GetDefaultCursor() );
|
SetCursor( DrawPanel->GetDefaultCursor() );
|
||||||
|
|
||||||
|
@ -140,12 +140,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
if( DrawPanel->IsMouseCaptured() )
|
if( DrawPanel->IsMouseCaptured() )
|
||||||
DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
|
DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
|
||||||
|
|
||||||
if( m_ID_current_state != id )
|
if( GetToolId() != id )
|
||||||
{
|
{
|
||||||
if( m_ID_last_state != m_ID_current_state )
|
if( m_ID_last_state != GetToolId() )
|
||||||
m_ID_last_state = m_ID_current_state;
|
m_ID_last_state = GetToolId();
|
||||||
|
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
||||||
|
@ -1154,7 +1154,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
|
||||||
EDA_ITEM* current = GetScreen()->GetCurItem();
|
EDA_ITEM* current = GetScreen()->GetCurItem();
|
||||||
|
|
||||||
// See if we are drawing a segment; if so, add a via?
|
// See if we are drawing a segment; if so, add a via?
|
||||||
if( m_ID_current_state == ID_TRACK_BUTT && current != NULL )
|
if( GetToolId() == ID_TRACK_BUTT && current != NULL )
|
||||||
{
|
{
|
||||||
if( current->Type() == TYPE_TRACK && ( current->IsNew() ) )
|
if( current->Type() == TYPE_TRACK && ( current->IsNew() ) )
|
||||||
{
|
{
|
||||||
|
@ -1195,17 +1195,17 @@ void WinEDA_PcbFrame::OnSelectTool( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
int id = aEvent.GetId();
|
int id = aEvent.GetId();
|
||||||
|
|
||||||
if( m_ID_current_state == id )
|
if( GetToolId() == id )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
||||||
|
|
||||||
// Stop the current command and deselect the current tool.
|
// Stop the current command and deselect the current tool.
|
||||||
DrawPanel->EndMouseCapture( ID_PCB_NO_TOOL, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case ID_PCB_NO_TOOL:
|
case ID_NO_TOOL_SELECTED:
|
||||||
SetToolID( id, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
SetToolID( id, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
|
||||||
|
|
||||||
if( fn != wxEmptyString )
|
if( fn != wxEmptyString )
|
||||||
{
|
{
|
||||||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
|
::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
|
||||||
LoadOnePcbFile( fn );
|
LoadOnePcbFile( fn );
|
||||||
DrawPanel->MoveCursorToCrossHair();
|
DrawPanel->MoveCursorToCrossHair();
|
||||||
|
@ -47,7 +47,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
|
||||||
if( id == ID_SAVE_BOARD )
|
if( id == ID_SAVE_BOARD )
|
||||||
DrawPanel->EndMouseCapture( -1, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( -1, DrawPanel->GetDefaultCursor() );
|
||||||
else
|
else
|
||||||
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
|
|
|
@ -243,7 +243,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ADD_MICROVIA: // Place a micro via if a track is in progress
|
case HK_ADD_MICROVIA: // Place a micro via if a track is in progress
|
||||||
if( m_ID_current_state != ID_TRACK_BUTT )
|
if( GetToolId() != ID_TRACK_BUTT )
|
||||||
return;
|
return;
|
||||||
if( !itemCurrentlyEdited ) // no track in progress: nothing to do
|
if( !itemCurrentlyEdited ) // no track in progress: nothing to do
|
||||||
break;
|
break;
|
||||||
|
@ -263,7 +263,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
|
||||||
Other_Layer_Route( NULL, aDC );
|
Other_Layer_Route( NULL, aDC );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( m_ID_current_state != ID_TRACK_BUTT )
|
if( GetToolId() != ID_TRACK_BUTT )
|
||||||
return;
|
return;
|
||||||
if( GetCurItem()->Type() != TYPE_TRACK )
|
if( GetCurItem()->Type() != TYPE_TRACK )
|
||||||
return;
|
return;
|
||||||
|
@ -283,13 +283,13 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
|
||||||
if( getActiveLayer() > LAYER_N_FRONT )
|
if( getActiveLayer() > LAYER_N_FRONT )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( m_ID_current_state != ID_TRACK_BUTT && !itemCurrentlyEdited )
|
if( GetToolId() != ID_TRACK_BUTT && !itemCurrentlyEdited )
|
||||||
{
|
{
|
||||||
cmd.SetId( ID_TRACK_BUTT );
|
cmd.SetId( ID_TRACK_BUTT );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_ID_current_state != ID_TRACK_BUTT )
|
if( GetToolId() != ID_TRACK_BUTT )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( !itemCurrentlyEdited ) // no track in progress:
|
if( !itemCurrentlyEdited ) // no track in progress:
|
||||||
|
@ -380,7 +380,7 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* aDC )
|
||||||
BOARD_ITEM* item = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
bool ItemFree = (item == NULL) || (item->m_Flags == 0);
|
bool ItemFree = (item == NULL) || (item->m_Flags == 0);
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case ID_TRACK_BUTT:
|
case ID_TRACK_BUTT:
|
||||||
if( getActiveLayer() > LAYER_N_FRONT )
|
if( getActiveLayer() > LAYER_N_FRONT )
|
||||||
|
|
|
@ -210,7 +210,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( id != ID_POPUP_CANCEL_CURRENT_COMMAND )
|
if( id != ID_POPUP_CANCEL_CURRENT_COMMAND )
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -805,10 +805,13 @@ void WinEDA_ModuleEditFrame::OnVerticalToolbar( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
int id = aEvent.GetId();
|
int id = aEvent.GetId();
|
||||||
|
|
||||||
SetToolID( ID_MODEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
|
case ID_NO_TOOL_SELECTED:
|
||||||
|
break;
|
||||||
|
|
||||||
case ID_MODEDIT_LINE_TOOL:
|
case ID_MODEDIT_LINE_TOOL:
|
||||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
|
||||||
break;
|
break;
|
||||||
|
@ -840,7 +843,7 @@ void WinEDA_ModuleEditFrame::OnVerticalToolbar( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
SetToolID( id, wxCURSOR_ARROW, _( "Pad settings" ) );
|
SetToolID( id, wxCURSOR_ARROW, _( "Pad settings" ) );
|
||||||
InstallPadOptionsFrame( NULL );
|
InstallPadOptionsFrame( NULL );
|
||||||
SetToolID( ID_MODEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -850,6 +853,6 @@ void WinEDA_ModuleEditFrame::OnVerticalToolbar( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG( wxT( "Unknown command id." ) );
|
wxFAIL_MSG( wxT( "Unknown command id." ) );
|
||||||
SetToolID( ID_MODEDIT_NO_TOOL, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
|
||||||
DrawPanel->CrossHairOff( DC );
|
DrawPanel->CrossHairOff( DC );
|
||||||
|
|
||||||
if( m_ID_current_state == 0 || m_ID_current_state == ID_MODEDIT_NO_TOOL )
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
||||||
{
|
{
|
||||||
if( item && item->m_Flags ) // Move item command in progress
|
if( item && item->m_Flags ) // Move item command in progress
|
||||||
{
|
{
|
||||||
|
@ -69,10 +69,9 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
SetCurItem( item );
|
SetCurItem( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case 0:
|
case ID_NO_TOOL_SELECTED:
|
||||||
case ID_MODEDIT_NO_TOOL:
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_MODEDIT_CIRCLE_TOOL:
|
case ID_MODEDIT_CIRCLE_TOOL:
|
||||||
|
@ -82,9 +81,9 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
{
|
{
|
||||||
int shape = S_SEGMENT;
|
int shape = S_SEGMENT;
|
||||||
|
|
||||||
if( m_ID_current_state == ID_MODEDIT_CIRCLE_TOOL )
|
if( GetToolId() == ID_MODEDIT_CIRCLE_TOOL )
|
||||||
shape = S_CIRCLE;
|
shape = S_CIRCLE;
|
||||||
if( m_ID_current_state == ID_MODEDIT_ARC_TOOL )
|
if( GetToolId() == 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 ) );
|
||||||
|
@ -141,7 +140,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
|
||||||
// Replace the module in position 0, to recalculate absolutes coordinates of items
|
// Replace the module in position 0, to recalculate absolutes coordinates of items
|
||||||
module->SetPosition( wxPoint( 0, 0 ) );
|
module->SetPosition( wxPoint( 0, 0 ) );
|
||||||
SetToolID( 0, 0, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
|
@ -173,8 +172,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DisplayError( this, wxT( "WinEDA_ModuleEditFrame::ProcessCommand error" ) );
|
DisplayError( this, wxT( "WinEDA_ModuleEditFrame::ProcessCommand error" ) );
|
||||||
SetToolID( 0, 0, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPanel->CrossHairOn( DC );
|
DrawPanel->CrossHairOn( DC );
|
||||||
|
@ -199,7 +197,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
|
||||||
}
|
}
|
||||||
|
|
||||||
// End command in progress.
|
// End command in progress.
|
||||||
if( m_ID_current_state && m_ID_current_state != ID_MODEDIT_NO_TOOL )
|
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
||||||
{
|
{
|
||||||
if( item && item->m_Flags )
|
if( item && item->m_Flags )
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
|
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
|
||||||
|
@ -375,13 +373,12 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
|
||||||
PopMenu->AppendSeparator();
|
PopMenu->AppendSeparator();
|
||||||
|
|
||||||
if( append_set_width
|
if( append_set_width
|
||||||
|| ( m_ID_current_state
|
|| ( ( GetToolId() != ID_NO_TOOL_SELECTED )
|
||||||
&& ( ( m_ID_current_state == ID_PCB_ADD_LINE_BUTT )
|
&& ( ( GetToolId() == ID_PCB_ADD_LINE_BUTT )
|
||||||
|| ( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
|
|| ( GetToolId() == ID_PCB_CIRCLE_BUTT )
|
||||||
|| ( m_ID_current_state == ID_PCB_ARC_BUTT ) ) ) )
|
|| ( GetToolId() == ID_PCB_ARC_BUTT ) ) ) )
|
||||||
{
|
{
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ENTER_EDGE_WIDTH,
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ENTER_EDGE_WIDTH, _("Set Width" ), width_segment_xpm );
|
||||||
_("Set Width" ), width_segment_xpm );
|
|
||||||
PopMenu->AppendSeparator();
|
PopMenu->AppendSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,10 +394,9 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
BOARD_ITEM* item = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
wxPoint pos = GetPosition();
|
wxPoint pos = GetPosition();
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case 0:
|
case ID_NO_TOOL_SELECTED:
|
||||||
case ID_MODEDIT_NO_TOOL:
|
|
||||||
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
item = ModeditLocateAndDisplay();
|
item = ModeditLocateAndDisplay();
|
||||||
|
|
|
@ -61,7 +61,8 @@ BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
|
||||||
EVT_TOOL( wxID_REDO, WinEDA_ModuleEditFrame::GetComponentFromRedoList )
|
EVT_TOOL( wxID_REDO, WinEDA_ModuleEditFrame::GetComponentFromRedoList )
|
||||||
|
|
||||||
// Vertical tool bar button click event handler.
|
// Vertical tool bar button click event handler.
|
||||||
EVT_TOOL_RANGE( ID_MODEDIT_NO_TOOL, ID_MODEDIT_PLACE_GRID_COORD,
|
EVT_TOOL( ID_NO_TOOL_SELECTED, WinEDA_ModuleEditFrame::OnVerticalToolbar )
|
||||||
|
EVT_TOOL_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_PLACE_GRID_COORD,
|
||||||
WinEDA_ModuleEditFrame::OnVerticalToolbar )
|
WinEDA_ModuleEditFrame::OnVerticalToolbar )
|
||||||
|
|
||||||
// Options Toolbar
|
// Options Toolbar
|
||||||
|
@ -99,7 +100,8 @@ BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
|
||||||
WinEDA_ModuleEditFrame::OnUpdateInsertModuleInBoard )
|
WinEDA_ModuleEditFrame::OnUpdateInsertModuleInBoard )
|
||||||
EVT_UPDATE_UI( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
|
EVT_UPDATE_UI( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
|
||||||
WinEDA_ModuleEditFrame::OnUpdateReplaceModuleInBoard )
|
WinEDA_ModuleEditFrame::OnUpdateReplaceModuleInBoard )
|
||||||
EVT_UPDATE_UI_RANGE( ID_MODEDIT_NO_TOOL, ID_MODEDIT_PLACE_GRID_COORD,
|
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, WinEDA_ModuleEditFrame::OnUpdateVerticalToolbar )
|
||||||
|
EVT_UPDATE_UI_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_PLACE_GRID_COORD,
|
||||||
WinEDA_ModuleEditFrame::OnUpdateVerticalToolbar )
|
WinEDA_ModuleEditFrame::OnUpdateVerticalToolbar )
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
@ -225,13 +227,10 @@ void WinEDA_ModuleEditFrame::CloseModuleEditor( wxCommandEvent& Event )
|
||||||
|
|
||||||
void WinEDA_ModuleEditFrame::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
|
void WinEDA_ModuleEditFrame::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
|
||||||
{
|
{
|
||||||
if( m_ID_current_state == 0 )
|
|
||||||
m_ID_current_state = ID_MODEDIT_NO_TOOL;
|
|
||||||
|
|
||||||
aEvent.Enable( GetBoard()->m_Modules != NULL );
|
aEvent.Enable( GetBoard()->m_Modules != NULL );
|
||||||
|
|
||||||
if( aEvent.GetEventObject() == m_VToolBar )
|
if( aEvent.GetEventObject() == m_VToolBar )
|
||||||
aEvent.Check( m_ID_current_state == aEvent.GetId() );
|
aEvent.Check( GetToolId() == aEvent.GetId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ void WinEDA_PcbFrame::MuWaveCommand( wxDC* DC, const wxPoint& MousePos )
|
||||||
{
|
{
|
||||||
MODULE* module = NULL;
|
MODULE* module = NULL;
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
||||||
Begin_Self( DC );
|
Begin_Self( DC );
|
||||||
|
@ -96,7 +96,7 @@ void WinEDA_PcbFrame::MuWaveCommand( wxDC* DC, const wxPoint& MousePos )
|
||||||
default:
|
default:
|
||||||
DrawPanel->SetCursor( wxCURSOR_ARROW );
|
DrawPanel->SetCursor( wxCURSOR_ARROW );
|
||||||
DisplayError( this, wxT( "WinEDA_PcbFrame::MuWaveCommand() id error" ) );
|
DisplayError( this, wxT( "WinEDA_PcbFrame::MuWaveCommand() id error" ) );
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,12 @@ 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;
|
bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED;
|
||||||
|
|
||||||
if( no_tool || ( DrawStruct && DrawStruct->m_Flags ) )
|
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
|
if( DrawStruct && DrawStruct->m_Flags ) // Command in progress
|
||||||
{
|
{
|
||||||
DrawPanel->m_IgnoreMouseEvents = true;
|
DrawPanel->m_IgnoreMouseEvents = true;
|
||||||
|
@ -131,11 +132,10 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case ID_MAIN_MENUBAR:
|
case ID_MAIN_MENUBAR:
|
||||||
case ID_PCB_NO_TOOL:
|
case ID_NO_TOOL_SELECTED:
|
||||||
case 0:
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
||||||
|
@ -187,9 +187,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
case ID_PCB_ADD_LINE_BUTT:
|
case ID_PCB_ADD_LINE_BUTT:
|
||||||
{
|
{
|
||||||
int shape = S_SEGMENT;
|
int shape = S_SEGMENT;
|
||||||
if( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
|
if( GetToolId() == ID_PCB_CIRCLE_BUTT )
|
||||||
shape = S_CIRCLE;
|
shape = S_CIRCLE;
|
||||||
if( m_ID_current_state == ID_PCB_ARC_BUTT )
|
if( GetToolId() == ID_PCB_ARC_BUTT )
|
||||||
shape = S_ARC;
|
shape = S_ARC;
|
||||||
|
|
||||||
if( getActiveLayer() <= LAST_COPPER_LAYER )
|
if( getActiveLayer() <= LAST_COPPER_LAYER )
|
||||||
|
@ -373,9 +373,8 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DrawPanel->SetCursor( wxCURSOR_ARROW );
|
|
||||||
DisplayError( this, wxT( "WinEDA_PcbFrame::OnLeftClick() id error" ) );
|
DisplayError( this, wxT( "WinEDA_PcbFrame::OnLeftClick() id error" ) );
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,10 +386,9 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case ID_PCB_NO_TOOL:
|
case ID_NO_TOOL_SELECTED:
|
||||||
case 0:
|
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
{
|
{
|
||||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||||
|
|
|
@ -51,12 +51,11 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
|
|
||||||
DrawPanel->CrossHairOff( &dc );
|
DrawPanel->CrossHairOff( &dc );
|
||||||
|
|
||||||
if( m_ID_current_state && m_ID_current_state != ID_PCB_NO_TOOL )
|
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
||||||
{
|
{
|
||||||
if( item && item->m_Flags )
|
if( item && item->m_Flags )
|
||||||
{
|
{
|
||||||
ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
|
||||||
_( "Cancel" ), cancel_xpm );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -270,7 +269,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display context sensitive comands: */
|
/* Display context sensitive comands: */
|
||||||
switch( m_ID_current_state )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case ID_PCB_ZONES_BUTT:
|
case ID_PCB_ZONES_BUTT:
|
||||||
if( GetBoard()->m_ZoneDescriptorList.size() > 0 )
|
if( GetBoard()->m_ZoneDescriptorList.size() > 0 )
|
||||||
|
@ -316,13 +315,12 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
aPopMenu->AppendSeparator();
|
aPopMenu->AppendSeparator();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case ID_NO_TOOL_SELECTED:
|
||||||
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_MODULE )
|
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_MODULE )
|
||||||
{
|
{
|
||||||
wxMenu* commands = new wxMenu;
|
wxMenu* commands = new wxMenu;
|
||||||
ADD_MENUITEM_WITH_SUBMENU( aPopMenu, commands,
|
ADD_MENUITEM_WITH_SUBMENU( aPopMenu, commands, ID_POPUP_PCB_AUTOPLACE_COMMANDS,
|
||||||
ID_POPUP_PCB_AUTOPLACE_COMMANDS, _(
|
_( "Glob Move and Place" ), move_xpm );
|
||||||
"Glob Move and Place" ), move_xpm );
|
|
||||||
ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES,
|
ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES,
|
||||||
_( "Unlock All Modules" ), unlocked_xpm );
|
_( "Unlock All Modules" ), unlocked_xpm );
|
||||||
ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES,
|
ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES,
|
||||||
|
|
|
@ -183,7 +183,9 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
|
||||||
WinEDA_PcbFrame::OnSelectOptionToolbar )
|
WinEDA_PcbFrame::OnSelectOptionToolbar )
|
||||||
|
|
||||||
// Vertical toolbar:
|
// Vertical toolbar:
|
||||||
EVT_TOOL_RANGE( ID_PCB_NO_TOOL, ID_PCB_PLACE_GRID_COORD_BUTT, WinEDA_PcbFrame::OnSelectTool )
|
EVT_TOOL( ID_NO_TOOL_SELECTED, WinEDA_PcbFrame::OnSelectTool )
|
||||||
|
EVT_TOOL_RANGE( ID_PCB_HIGHLIGHT_BUTT, ID_PCB_PLACE_GRID_COORD_BUTT,
|
||||||
|
WinEDA_PcbFrame::OnSelectTool )
|
||||||
|
|
||||||
EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
|
EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
|
||||||
WinEDA_PcbFrame::ProcessMuWaveFunctions )
|
WinEDA_PcbFrame::ProcessMuWaveFunctions )
|
||||||
|
@ -217,7 +219,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
|
||||||
WinEDA_PcbFrame::OnUpdateHighContrastDisplayMode )
|
WinEDA_PcbFrame::OnUpdateHighContrastDisplayMode )
|
||||||
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
|
||||||
WinEDA_PcbFrame::OnUpdateShowLayerManager )
|
WinEDA_PcbFrame::OnUpdateShowLayerManager )
|
||||||
EVT_UPDATE_UI_RANGE( ID_PCB_NO_TOOL, ID_PCB_PLACE_GRID_COORD_BUTT,
|
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, WinEDA_PcbFrame::OnUpdateVerticalToolbar )
|
||||||
|
EVT_UPDATE_UI_RANGE( ID_PCB_HIGHLIGHT_BUTT, ID_PCB_PLACE_GRID_COORD_BUTT,
|
||||||
WinEDA_PcbFrame::OnUpdateVerticalToolbar )
|
WinEDA_PcbFrame::OnUpdateVerticalToolbar )
|
||||||
EVT_UPDATE_UI_RANGE( ID_AUX_TOOLBAR_PCB_VIA_SIZE, ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
|
EVT_UPDATE_UI_RANGE( ID_AUX_TOOLBAR_PCB_VIA_SIZE, ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
|
||||||
WinEDA_PcbFrame::OnUpdateAuxilaryToolbar )
|
WinEDA_PcbFrame::OnUpdateAuxilaryToolbar )
|
||||||
|
|
|
@ -19,7 +19,6 @@ enum pcbnew_ids
|
||||||
ID_READ_NETLIST,
|
ID_READ_NETLIST,
|
||||||
|
|
||||||
// Right vertical tool bar command IDs.
|
// Right vertical tool bar command IDs.
|
||||||
ID_PCB_NO_TOOL,
|
|
||||||
ID_PCB_HIGHLIGHT_BUTT,
|
ID_PCB_HIGHLIGHT_BUTT,
|
||||||
ID_PCB_SHOW_1_RATSNEST_BUTT,
|
ID_PCB_SHOW_1_RATSNEST_BUTT,
|
||||||
ID_PCB_MODULE_BUTT,
|
ID_PCB_MODULE_BUTT,
|
||||||
|
@ -264,7 +263,6 @@ enum pcbnew_ids
|
||||||
ID_PCB_DISPLAY_OPTIONS_SETUP,
|
ID_PCB_DISPLAY_OPTIONS_SETUP,
|
||||||
|
|
||||||
// Module editor right vertical tool bar commands.
|
// Module editor right vertical tool bar commands.
|
||||||
ID_MODEDIT_NO_TOOL,
|
|
||||||
ID_MODEDIT_PAD_TOOL,
|
ID_MODEDIT_PAD_TOOL,
|
||||||
ID_MODEDIT_LINE_TOOL,
|
ID_MODEDIT_LINE_TOOL,
|
||||||
ID_MODEDIT_CIRCLE_TOOL,
|
ID_MODEDIT_CIRCLE_TOOL,
|
||||||
|
|
|
@ -127,7 +127,7 @@ void WinEDA_ModuleEditFrame::ReCreateVToolbar()
|
||||||
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
|
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
|
||||||
|
|
||||||
// Set up toolbar
|
// Set up toolbar
|
||||||
m_VToolBar->AddTool( ID_MODEDIT_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
|
m_VToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, wxBitmap( cursor_xpm ),
|
||||||
wxEmptyString, wxITEM_CHECK );
|
wxEmptyString, wxITEM_CHECK );
|
||||||
|
|
||||||
m_VToolBar->AddSeparator();
|
m_VToolBar->AddSeparator();
|
||||||
|
|
|
@ -384,7 +384,7 @@ void WinEDA_PcbFrame::ReCreateVToolbar()
|
||||||
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
|
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
|
||||||
|
|
||||||
// Set up toolbar
|
// Set up toolbar
|
||||||
m_VToolBar->AddTool( ID_PCB_NO_TOOL, wxEmptyString, wxBitmap( cursor_xpm ),
|
m_VToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, wxBitmap( cursor_xpm ),
|
||||||
wxEmptyString, wxITEM_CHECK );
|
wxEmptyString, wxITEM_CHECK );
|
||||||
m_VToolBar->AddSeparator();
|
m_VToolBar->AddSeparator();
|
||||||
|
|
||||||
|
|
|
@ -146,9 +146,6 @@ void WinEDA_PcbFrame::OnUpdateSave( wxUpdateUIEvent& aEvent )
|
||||||
|
|
||||||
void WinEDA_PcbFrame::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
|
void WinEDA_PcbFrame::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
|
||||||
{
|
{
|
||||||
if( m_ID_current_state == 0 )
|
|
||||||
m_ID_current_state = ID_PCB_NO_TOOL;
|
|
||||||
|
|
||||||
if( aEvent.GetEventObject() == m_VToolBar )
|
if( aEvent.GetEventObject() == m_VToolBar )
|
||||||
aEvent.Check( m_ID_current_state == aEvent.GetId() );
|
aEvent.Check( GetToolId() == aEvent.GetId() );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue