Move some more menu & toolbar items to modern toolset.

This commit is contained in:
Jeff Young 2019-05-15 23:49:48 +01:00
parent eba892009d
commit fbb807f3bb
70 changed files with 917 additions and 4528 deletions

View File

@ -131,7 +131,7 @@ a cursor change and by setting a status string.
auto& frame = *getEditFrame<PCB_EDIT_FRAME>();
// set tool hint and cursor (actually looks like a crosshair)
frame.SetToolID( ID_PCB_SHOW_1_RATSNEST_BUTT,
frame.SetToolID( ID_LOCAL_RATSNEST_BUTT,
wxCURSOR_PENCIL, _( "Select item to move left" ) );
getViewControls()->ShowCursor( true );

View File

@ -81,9 +81,6 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
EVT_CHAR_HOOK( EDA_DRAW_FRAME::OnCharHook )
EVT_MOUSEWHEEL( EDA_DRAW_FRAME::OnMouseEvent )
EVT_UPDATE_UI( wxID_UNDO, EDA_DRAW_FRAME::OnUpdateUndo )
EVT_UPDATE_UI( wxID_REDO, EDA_DRAW_FRAME::OnUpdateRedo )
END_EVENT_TABLE()

View File

@ -113,9 +113,6 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
EDA_DRAW_FRAME::OnSelectGrid )
EVT_UPDATE_UI( wxID_UNDO, EDA_DRAW_FRAME::OnUpdateUndo )
EVT_UPDATE_UI( wxID_REDO, EDA_DRAW_FRAME::OnUpdateRedo )
END_EVENT_TABLE()
@ -360,20 +357,6 @@ void EDA_DRAW_FRAME::OnToggleCrossHairStyle( wxCommandEvent& aEvent )
}
void EDA_DRAW_FRAME::OnUpdateUndo( wxUpdateUIEvent& aEvent )
{
if( GetScreen() )
aEvent.Enable( GetScreen()->GetUndoCommandCount() > 0 );
}
void EDA_DRAW_FRAME::OnUpdateRedo( wxUpdateUIEvent& aEvent )
{
if( GetScreen() )
aEvent.Enable( GetScreen()->GetRedoCommandCount() > 0 );
}
void EDA_DRAW_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
{
// No need to update the grid select box if it doesn't exist or the grid setting change

View File

@ -46,13 +46,19 @@ void ACTION_TOOLBAR::Add( const TOOL_ACTION& aAction, bool aIsToggleEntry )
AddTool( toolId, wxEmptyString, KiBitmap( aAction.GetIcon() ), aAction.GetDescription(),
aIsToggleEntry ? wxITEM_CHECK : wxITEM_NORMAL );
m_toolKinds[ toolId ] = aIsToggleEntry;
m_toolActions[ toolId ] = &aAction;
}
void ACTION_TOOLBAR::Toggle( const TOOL_ACTION& aAction, bool aState )
{
ToggleTool( aAction.GetId() + ACTION_ID, aState );
int toolId = aAction.GetId() + ACTION_ID;
if( m_toolKinds[ toolId ] )
ToggleTool( toolId, aState );
else
EnableTool( toolId, aState );
}

View File

@ -24,20 +24,30 @@ TOOL_ACTION ACTIONS::redo( "common.Interactive.redo",
redo_xpm );
TOOL_ACTION ACTIONS::cut( "common.Interactive.cut",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_CUT ),
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CUT ),
_( "Cut" ), _( "Cut selected item(s) to clipboard" ),
cut_xpm );
TOOL_ACTION ACTIONS::copy( "common.Interactive.copy",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_COPY ),
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_COPY ),
_( "Copy" ), _( "Copy selected item(s) to clipboard" ),
copy_xpm );
TOOL_ACTION ACTIONS::paste( "common.Interactive.paste",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_PASTE ),
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_PASTE ),
_( "Paste" ), _( "Paste clipboard into schematic" ),
paste_xpm );
TOOL_ACTION ACTIONS::find( "common.Interactive.find",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_FIND ),
_( "Find" ), _( "Find text" ),
find_xpm );
TOOL_ACTION ACTIONS::replace( "common.Interactive.findAndReplace",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_REPLACE ),
_( "Find and Replace" ), _( "Find and replace text" ),
find_replace_xpm );
// View Controls
TOOL_ACTION ACTIONS::zoomRedraw( "common.Control.zoomRedraw",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_REDRAW ),
@ -165,7 +175,8 @@ TOOL_ACTION ACTIONS::gridPrev( "common.Control.gridPrev",
TOOL_ACTION ACTIONS::gridSetOrigin( "common.Control.gridSetOrigin",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SET_GRID_ORIGIN ),
"", "" );
_( "Grid Origin" ), _( "Set the grid origin point" ),
grid_select_axis_xpm );
TOOL_ACTION ACTIONS::gridResetOrigin( "common.Control.gridResetOrigin",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_GRID_ORIGIN ),

View File

@ -84,41 +84,32 @@
// Fit on Screen
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomAuto( _HKI( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME,
ID_ZOOM_PAGE );
static EDA_HOTKEY HkZoomAuto( _HKI( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME );
#else
static EDA_HOTKEY HkZoomAuto( _HKI( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0',
ID_ZOOM_PAGE );
static EDA_HOTKEY HkZoomAuto( _HKI( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0' );
#endif
static EDA_HOTKEY HkZoomCenter( _HKI( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4,
ID_POPUP_ZOOM_CENTER );
static EDA_HOTKEY HkZoomCenter( _HKI( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
// Refresh Screen
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3,
ID_ZOOM_REDRAW );
static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
#else
static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL + 'R',
ID_ZOOM_REDRAW );
static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL + 'R' );
#endif
// Zoom In
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1,
ID_KEY_ZOOM_IN );
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
#else
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+',
ID_KEY_ZOOM_IN );
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+' );
#endif
// Zoom Out
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2,
ID_KEY_ZOOM_OUT );
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
#else
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-',
ID_KEY_ZOOM_OUT );
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-' );
#endif
static EDA_HOTKEY HkSwitchUnits( _HKI( "Switch Units" ), HK_SWITCH_UNITS, 'U' + GR_KB_CTRL );
@ -127,8 +118,7 @@ static EDA_HOTKEY HkHelp( _HKI( "List Hotkeys" ), HK_HELP, GR_KB_CTRL + WXK_F1 )
static EDA_HOTKEY HkPreferences( _HKI( "Preferences" ), HK_PREFERENCES, GR_KB_CTRL + ',',
wxID_PREFERENCES );
static EDA_HOTKEY HkResetLocalCoord( _HKI( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
static EDA_HOTKEY HkLeaveSheet( _HKI( "Leave Sheet" ), HK_LEAVE_SHEET, GR_KB_ALT + WXK_BACK,
ID_SCH_LEAVE_SHEET );
static EDA_HOTKEY HkLeaveSheet( _HKI( "Leave Sheet" ), HK_LEAVE_SHEET, GR_KB_ALT + WXK_BACK );
static EDA_HOTKEY HkSwitchGridToNext( _HKI( "Switch Grid To Next" ),
HK_SWITCH_GRID_TO_NEXT, 'N' );
@ -142,36 +132,22 @@ static EDA_HOTKEY HkMouseLeftDClick( _HKI( "Mouse Left Double Click" ), HK_LEFT_
ID_MOUSE_DOUBLECLICK );
// Schematic editor
static EDA_HOTKEY HkBeginWire( _HKI( "Begin Wire" ), HK_BEGIN_WIRE, 'W',
ID_WIRE_TOOL );
static EDA_HOTKEY HkBeginBus( _HKI( "Begin Bus" ), HK_BEGIN_BUS, 'B',
ID_BUS_TOOL );
static EDA_HOTKEY HkBeginWire( _HKI( "Begin Wire" ), HK_BEGIN_WIRE, 'W' );
static EDA_HOTKEY HkBeginBus( _HKI( "Begin Bus" ), HK_BEGIN_BUS, 'B' );
static EDA_HOTKEY HkEndLineWireBus( _HKI( "End Line Wire Bus" ), HK_END_CURR_LINEWIREBUS, 'K' );
static EDA_HOTKEY HkAddLabel( _HKI( "Add Label" ), HK_ADD_LABEL, 'L',
ID_LABEL_TOOL );
static EDA_HOTKEY HkAddHierarchicalLabel( _HKI( "Add Hierarchical Label" ), HK_ADD_HLABEL, 'H',
ID_HIERLABEL_TOOL );
static EDA_HOTKEY HkAddGlobalLabel( _HKI( "Add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'H',
ID_GLOBALLABEL_TOOL );
static EDA_HOTKEY HkAddJunction( _HKI( "Add Junction" ), HK_ADD_JUNCTION, 'J',
ID_JUNCTION_TOOL );
static EDA_HOTKEY HkAddComponent( _HKI( "Add Symbol" ), HK_ADD_NEW_COMPONENT, 'A',
ID_PLACE_SYMBOL_TOOL );
static EDA_HOTKEY HkAddPower( _HKI( "Add Power" ), HK_ADD_NEW_POWER, 'P',
ID_PLACE_POWER_TOOL );
static EDA_HOTKEY HkAddNoConn( _HKI( "Add No Connect Flag" ), HK_ADD_NOCONN_FLAG, 'Q',
ID_NOCONNECT_TOOL );
static EDA_HOTKEY HkAddHierSheet( _HKI( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S',
ID_SHEET_TOOL );
static EDA_HOTKEY HkAddBusEntry( _HKI( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/',
ID_BUSTOBUS_ENTRY_TOOL );
static EDA_HOTKEY HkAddWireEntry( _HKI( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z',
ID_WIRETOBUS_ENTRY_TOOL );
static EDA_HOTKEY HkAddGraphicPolyLine( _HKI( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE, 'I',
ID_SCHEMATIC_LINE_TOOL );
static EDA_HOTKEY HkAddGraphicText( _HKI( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T',
ID_SCHEMATIC_TEXT_TOOL );
static EDA_HOTKEY HkAddLabel( _HKI( "Add Label" ), HK_ADD_LABEL, 'L' );
static EDA_HOTKEY HkAddHierarchicalLabel( _HKI( "Add Hierarchical Label" ), HK_ADD_HLABEL, 'H' );
static EDA_HOTKEY HkAddGlobalLabel( _HKI( "Add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'H' );
static EDA_HOTKEY HkAddJunction( _HKI( "Add Junction" ), HK_ADD_JUNCTION, 'J' );
static EDA_HOTKEY HkAddComponent( _HKI( "Add Symbol" ), HK_ADD_NEW_COMPONENT, 'A' );
static EDA_HOTKEY HkAddPower( _HKI( "Add Power" ), HK_ADD_NEW_POWER, 'P' );
static EDA_HOTKEY HkAddNoConn( _HKI( "Add No Connect Flag" ), HK_ADD_NOCONN_FLAG, 'Q' );
static EDA_HOTKEY HkAddHierSheet( _HKI( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S' );
static EDA_HOTKEY HkAddBusEntry( _HKI( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/' );
static EDA_HOTKEY HkAddWireEntry( _HKI( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z' );
static EDA_HOTKEY HkAddGraphicPolyLine( _HKI( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE, 'I' );
static EDA_HOTKEY HkAddGraphicText( _HKI( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T' );
static EDA_HOTKEY HkMirrorY( _HKI( "Mirror Y" ), HK_MIRROR_Y, 'Y' );
static EDA_HOTKEY HkMirrorX( _HKI( "Mirror X" ), HK_MIRROR_X, 'X' );
static EDA_HOTKEY HkRotate( _HKI( "Rotate Item" ), HK_ROTATE, 'R' );
@ -179,33 +155,28 @@ static EDA_HOTKEY HkEdit( _HKI( "Edit Item" ), HK_EDIT, 'E' );
static EDA_HOTKEY HkEditValue( _HKI( "Edit Symbol Value" ), HK_EDIT_COMPONENT_VALUE, 'V' );
static EDA_HOTKEY HkEditReference( _HKI( "Edit Symbol Reference" ), HK_EDIT_COMPONENT_REFERENCE, 'U' );
static EDA_HOTKEY HkEditFootprint( _HKI( "Edit Symbol Footprint" ), HK_EDIT_COMPONENT_FOOTPRINT, 'F' );
static EDA_HOTKEY HkShowDatasheet( _HKI( "Show Symbol Datasheet" ), HK_SHOW_COMPONENT_DATASHEET, 'D',
ID_SCH_DISPLAYDOC_CMP );
static EDA_HOTKEY HkEditWithLibedit( _HKI( "Edit with Symbol Editor" ), HK_EDIT_COMPONENT_WITH_LIBEDIT, 'E' + GR_KB_CTRL,
ID_SCH_CALL_LIBEDIT_AND_LOAD_CMP );
static EDA_HOTKEY HkMove( _HKI( "Move Schematic Item" ), HK_MOVE, 'M' );
static EDA_HOTKEY HkShowDatasheet( _HKI( "Show Symbol Datasheet" ), HK_SHOW_COMPONENT_DATASHEET, 'D' );
static EDA_HOTKEY HkEditWithLibedit( _HKI( "Edit with Symbol Editor" ), HK_EDIT_COMPONENT_WITH_LIBEDIT, 'E' + GR_KB_CTRL );
static EDA_HOTKEY HkDuplicateItem( _HKI( "Duplicate" ), HK_DUPLICATE, 'D' + GR_KB_CTRL );
static EDA_HOTKEY HkMove( _HKI( "Move Schematic Item" ), HK_MOVE, 'M' );
static EDA_HOTKEY HkDrag( _HKI( "Drag Item" ), HK_DRAG, 'G' );
static EDA_HOTKEY HkInsert( _HKI( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
static EDA_HOTKEY HkDelete( _HKI( "Delete Item" ), HK_DELETE, WXK_DELETE );
static EDA_HOTKEY HkFindItem( _HKI( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL,
ID_FIND_ITEMS );
static EDA_HOTKEY HkFind( _HKI( "Find" ), HK_FIND, 'F' + GR_KB_CTRL );
static EDA_HOTKEY HkReplace( _HKI( "Find and Replace" ), HK_REPLACE, 'F' + GR_KB_CTRL + GR_KB_ALT );
static EDA_HOTKEY HkFindNextItem( _HKI( "Find Next Item" ), HK_FIND_NEXT_ITEM, WXK_F5,
wxEVT_COMMAND_FIND );
static EDA_HOTKEY HkFindReplace( _HKI( "Find and Replace" ), HK_FIND_REPLACE, 'F' + GR_KB_CTRL + GR_KB_ALT,
wxID_REPLACE );
static EDA_HOTKEY HkFindNextMarker( _HKI( "Find Next Marker" ), HK_FIND_NEXT_DRC_MARKER, WXK_F5 + GR_KB_SHIFT,
EVT_COMMAND_FIND_DRC_MARKER );
static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), HK_ZOOM_SELECTION, GR_KB_CTRL + WXK_F5,
ID_ZOOM_SELECTION );
// Special keys for library editor:
static EDA_HOTKEY HkCreatePin( _HKI( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P',
ID_LIBEDIT_PIN_BUTT );
static EDA_HOTKEY HkCreatePin( _HKI( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' );
static EDA_HOTKEY HkInsertPin( _HKI( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
static EDA_HOTKEY HkViewDoc( _HKI( "Show Datasheet" ), HK_LIBEDIT_VIEW_DOC, 'D' + GR_KB_ALT,
ID_LIBEDIT_VIEW_DOC );
@ -217,47 +188,32 @@ static EDA_HOTKEY HkUpdatePcbFromSch( _HKI( "Update PCB from Schematic" ), HK_UP
ID_UPDATE_PCB_FROM_SCH );
// Selection
static EDA_HOTKEY HkSelectNode( _HKI( "Select Node" ), HK_SELECT_NODE, GR_KB_ALT + '3',
ID_HOTKEY_SELECT_NODE);
static EDA_HOTKEY HkSelectConnection( _HKI( "Select Connection" ), HK_SELECT_CONNECTION, GR_KB_ALT + '4',
ID_HOTKEY_SELECT_CONNECTION );
static EDA_HOTKEY HkSelectNode( _HKI( "Select Node" ), HK_SELECT_NODE, GR_KB_ALT + '3' );
static EDA_HOTKEY HkSelectConnection( _HKI( "Select Connection" ), HK_SELECT_CONNECTION, GR_KB_ALT + '4' );
// Higtlight connection
static EDA_HOTKEY HkHighlightConnection( _HKI( "Highlight Net" ), ID_HOTKEY_HIGHLIGHT, 'B' + GR_KB_CTRL,
ID_HIGHLIGHT_NET );
static EDA_HOTKEY HkHighlightConnection( _HKI( "Highlight Net" ), ID_HOTKEY_HIGHLIGHT, 'B' + GR_KB_CTRL );
static EDA_HOTKEY HkUnfoldBus( _HKI( "Unfold from Bus" ), HK_UNFOLD_BUS, 'C',
ID_SCH_UNFOLD_BUS );
static EDA_HOTKEY HkUnfoldBus( _HKI( "Unfold from Bus" ), HK_UNFOLD_BUS, 'C', ID_SCH_UNFOLD_BUS );
// Common: hotkeys_basic.h
static EDA_HOTKEY HkNew( _HKI( "New" ), HK_NEW, GR_KB_CTRL + 'N',
wxID_NEW );
static EDA_HOTKEY HkOpen( _HKI( "Open" ), HK_OPEN, GR_KB_CTRL + 'O',
wxID_OPEN );
static EDA_HOTKEY HkSave( _HKI( "Save" ), HK_SAVE, GR_KB_CTRL + 'S',
wxID_SAVE );
static EDA_HOTKEY HkSaveAs( _HKI( "Save As" ), HK_SAVEAS, GR_KB_SHIFT + GR_KB_CTRL + 'S',
wxID_SAVEAS );
static EDA_HOTKEY HkPrint( _HKI( "Print" ), HK_PRINT, GR_KB_CTRL + 'P',
wxID_PRINT );
static EDA_HOTKEY HkNew( _HKI( "New" ), HK_NEW, GR_KB_CTRL + 'N', wxID_NEW );
static EDA_HOTKEY HkOpen( _HKI( "Open" ), HK_OPEN, GR_KB_CTRL + 'O', wxID_OPEN );
static EDA_HOTKEY HkSave( _HKI( "Save" ), HK_SAVE, GR_KB_CTRL + 'S', wxID_SAVE );
static EDA_HOTKEY HkSaveAs( _HKI( "Save As" ), HK_SAVEAS, GR_KB_SHIFTCTRL + 'S', wxID_SAVEAS );
static EDA_HOTKEY HkPrint( _HKI( "Print" ), HK_PRINT, GR_KB_CTRL + 'P', wxID_PRINT );
static EDA_HOTKEY HkUndo( _HKI( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z',
wxID_UNDO );
static EDA_HOTKEY HkUndo( _HKI( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z' );
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y',
wxID_REDO );
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y' );
#else
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_SHIFTCTRL + 'Z',
wxID_REDO );
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_SHIFTCTRL + 'Z' );
#endif
static EDA_HOTKEY HkEditCut( _HKI( "Cut" ), HK_EDIT_CUT, GR_KB_CTRL + 'X',
wxID_CUT );
static EDA_HOTKEY HkEditCopy( _HKI( "Copy" ), HK_EDIT_COPY, GR_KB_CTRL + 'C',
wxID_COPY );
static EDA_HOTKEY HkEditPaste( _HKI( "Paste" ), HK_EDIT_PASTE, GR_KB_CTRL + 'V',
wxID_PASTE );
static EDA_HOTKEY HkCut( _HKI( "Cut" ), HK_CUT, GR_KB_CTRL + 'X' );
static EDA_HOTKEY HkCopy( _HKI( "Copy" ), HK_COPY, GR_KB_CTRL + 'C' );
static EDA_HOTKEY HkPaste( _HKI( "Paste" ), HK_PASTE, GR_KB_CTRL + 'V' );
static EDA_HOTKEY HkCanvasOpenGL( _HKI( "Switch to Modern Toolset with hardware-accelerated graphics (recommended)" ),
HK_CANVAS_OPENGL,
@ -277,7 +233,8 @@ static EDA_HOTKEY* common_Hotkey_List[] =
{
&HkNew, &HkOpen, &HkSave, &HkSaveAs, &HkPrint,
&HkUndo, &HkRedo,
&HkEditCut, &HkEditCopy, &HkEditPaste,
&HkCut, &HkCopy, &HkPaste,
&HkFind, &HkReplace,
&HkHelp,
&HkPreferences,
&HkZoomIn,
@ -306,6 +263,7 @@ static EDA_HOTKEY* common_Hotkey_List[] =
// List of common hotkey descriptors, for the library viewer
static EDA_HOTKEY* common_basic_Hotkey_List[] =
{
&HkCut, &HkCopy, &HkPaste,
&HkHelp,
&HkZoomIn,
&HkZoomOut,
@ -328,10 +286,8 @@ static EDA_HOTKEY* common_basic_Hotkey_List[] =
// List of hotkey descriptors for schematic
static EDA_HOTKEY* schematic_Hotkey_List[] =
{
&HkFindItem,
&HkFindNextItem,
&HkFindNextMarker,
&HkFindReplace,
&HkInsert,
&HkAddComponent,
&HkAddPower,
@ -483,10 +439,8 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_UNDO: // Hot keys that map to command IDs that cannot be called
case HK_REDO: // while busy performing another command.
case HK_FIND_ITEM:
case HK_FIND_REPLACE:
case HK_FIND:
case HK_REPLACE:
if( EE_CONDITIONS::Idle( selection ) )
{
cmd.SetId( hotKey->m_IdMenuEvent );
@ -576,22 +530,6 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case HK_RESET_LOCAL_COORD: // Reset the relative coord
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_EDIT_PASTE:
case HK_EDIT_COPY:
case HK_EDIT_CUT:
cmd.SetId( hotKey->m_IdMenuEvent );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_UNDO:
case HK_REDO:
if( EE_CONDITIONS::Idle( selection ) )
{
cmd.SetId( hotKey->m_IdMenuEvent );
GetEventHandler()->ProcessEvent( cmd );
}
break;
}
// Hot key handled.
@ -645,31 +583,6 @@ bool LIB_VIEW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_ZOOM_IN:
cmd.SetId( ID_KEY_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
cmd.SetId( ID_KEY_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_AUTO:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_CANVAS_CAIRO:
case HK_CANVAS_OPENGL:
cmd.SetInt( HK_Descr->m_Idcommand );

View File

@ -36,15 +36,10 @@
enum hotkey_id_command {
HK_FIND_NEXT_ITEM = HK_COMMON_END,
HK_FIND_NEXT_DRC_MARKER,
HK_FIND_ITEM,
HK_FIND_REPLACE,
HK_DELETE,
HK_REPEAT_LAST,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM,
HK_MOVEBLOCK_TO_DRAGBLOCK,
HK_LIBEDIT_CREATE_PIN,
HK_LIBEDIT_VIEW_DOC,
HK_DELETE_PIN,
HK_ROTATE,
HK_EDIT,
HK_EDIT_COMPONENT_VALUE,
@ -76,7 +71,6 @@ enum hotkey_id_command {
HK_ADD_GRAPHIC_POLYLINE,
HK_ADD_NOCONN_FLAG,
HK_LEAVE_SHEET,
HK_DELETE_NODE,
HK_AUTOPLACE_FIELDS,
HK_UPDATE_PCB_FROM_SCH,
HK_SELECT_ITEMS_ON_PCB,

View File

@ -66,7 +66,6 @@ enum id_eeschema_frm
ID_EDIT_COMPONENTS_TO_SYMBOLS_LIB_ID,
/* Schematic editor horizontal toolbar IDs */
ID_SCH_LEAVE_SHEET,
ID_TO_LIBVIEW,
ID_GET_ANNOTATE,
ID_GET_ERC,
@ -99,9 +98,6 @@ enum id_eeschema_frm
ID_POPUP_SCH_UNFOLD_BUS,
ID_POPUP_SCH_UNFOLD_BUS_END = ID_POPUP_SCH_UNFOLD_BUS + 64,
ID_SCH_DISPLAYDOC_CMP,
ID_SCH_CALL_LIBEDIT_AND_LOAD_CMP,
// Unit select context menus command IDs.
ID_POPUP_SCH_SELECT_UNIT_CMP,
ID_POPUP_SCH_SELECT_UNIT1,
@ -118,10 +114,7 @@ enum id_eeschema_frm
// events (menus, toolbar, context menu, etc.) that result in the same event handler.
ID_CANCEL_CURRENT_COMMAND,
ID_HOTKEY_SELECT_NODE,
ID_HOTKEY_SELECT_CONNECTION,
ID_HOTKEY_HIGHLIGHT,
ID_HIGHLIGHT_NET,
ID_ADD_PART_TO_SCHEMATIC,
/* Library editor: edit events */

View File

@ -145,12 +145,10 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
auto enableUndoCondition = [ this ] ( const SELECTION& sel ) {
return GetCurPart() && GetScreen() && GetScreen()->GetUndoCommandCount() != 0
&& EE_CONDITIONS::Idle( sel );
return GetCurPart() && GetScreen() && GetScreen()->GetUndoCommandCount() != 0;
};
auto enableRedoCondition = [ this ] ( const SELECTION& sel ) {
return GetCurPart() && GetScreen() && GetScreen()->GetRedoCommandCount() != 0
&& EE_CONDITIONS::Idle( sel );
return GetCurPart() && GetScreen() && GetScreen()->GetRedoCommandCount() != 0;
};
auto havePartCondition = [ this ] ( const SELECTION& sel ) {
return GetCurPart();

View File

@ -52,6 +52,8 @@ void LIB_EDIT_FRAME::ReCreateVToolbar()
// Set up toolbar
m_drawToolBar->Add( EE_ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->Add( EE_ACTIONS::placeSymbolPin, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeSymbolText, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::drawSymbolRectangle, ACTION_TOOLBAR::TOGGLE );
@ -179,19 +181,19 @@ void LIB_EDIT_FRAME::ReCreateOptToolbar()
void LIB_EDIT_FRAME::SyncMenusAndToolbars()
{
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 );
m_mainToolBar->Toggle( ACTIONS::redo, GetScreen() && GetScreen()->GetRedoCommandCount() > 0 );
m_mainToolBar->Toggle( ACTIONS::zoomTool, GetToolId() == ID_ZOOM_SELECTION );
m_mainToolBar->Refresh();
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( EE_ACTIONS::showElectricalTypes, GetShowElectricalType() );
m_optionsToolBar->Toggle( EE_ACTIONS::showComponentTree, IsSearchTreeShown() );
m_optionsToolBar->Toggle( EE_ACTIONS::showComponentTree, IsSearchTreeShown() );
m_optionsToolBar->Refresh();
m_drawToolBar->Toggle( EE_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED );
@ -202,6 +204,5 @@ void LIB_EDIT_FRAME::SyncMenusAndToolbars()
m_drawToolBar->Toggle( EE_ACTIONS::drawSymbolArc, GetToolId() == ID_LIBEDIT_BODY_ARC_BUTT );
m_drawToolBar->Toggle( EE_ACTIONS::drawSymbolLines, GetToolId() == ID_LIBEDIT_BODY_LINE_BUTT );
m_drawToolBar->Toggle( EE_ACTIONS::placeSymbolAnchor, GetToolId() == ID_LIBEDIT_ANCHOR_ITEM_BUTT );
m_drawToolBar->Refresh();
}

View File

@ -56,9 +56,6 @@ static void prepareToolsMenu( wxMenu* aParentMenu );
// Build the help menu
static void prepareHelpMenu( wxMenu* aParentMenu );
// Build the edit menu
static void prepareEditMenu( wxMenu* aParentMenu );
// Build the preferences menu
static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu );
@ -81,8 +78,39 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
//
// Menu Edit:
//
wxMenu* editMenu = new wxMenu;
prepareEditMenu( editMenu );
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
auto enableUndoCondition = [ this ] ( const SELECTION& sel ) {
return GetScreen() && GetScreen()->GetUndoCommandCount() > 0;
};
auto enableRedoCondition = [ this ] ( const SELECTION& sel ) {
return GetScreen() && GetScreen()->GetRedoCommandCount() > 0;
};
auto noActiveToolCondition = [ this ] ( const SELECTION& aSelection ) {
return GetToolId() == ID_NO_TOOL_SELECTED;
};
editMenu->AddItem( ACTIONS::undo, enableUndoCondition );
editMenu->AddItem( ACTIONS::redo, enableRedoCondition );
editMenu->AddSeparator();
editMenu->AddItem( ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty );
editMenu->AddItem( ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty );
editMenu->AddItem( ACTIONS::paste, noActiveToolCondition );
editMenu->AddSeparator();
editMenu->AddItem( EE_ACTIONS::deleteItemCursor, SELECTION_CONDITIONS::ShowAlways );
// Find
editMenu->AddSeparator();
editMenu->AddItem( ACTIONS::find, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( ACTIONS::replace, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddSeparator();
// Update field values
editMenu->AddItem( ID_UPDATE_FIELDS, _( "Update Fields from Library..." ),
_( "Sets symbol fields to original library values" ),
update_fields_xpm, SELECTION_CONDITIONS::ShowAlways );
//
// Menu View:
@ -321,64 +349,6 @@ void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject )
}
void prepareEditMenu( wxMenu* aParentMenu )
{
wxString text;
// Undo
text = AddHotkeyName( _( "&Undo" ), g_Schematic_Hotkeys_Descr, HK_UNDO );
AddMenuItem( aParentMenu, wxID_UNDO, text, HELP_UNDO, KiBitmap( undo_xpm ) );
// Redo
text = AddHotkeyName( _( "&Redo" ), g_Schematic_Hotkeys_Descr, HK_REDO );
AddMenuItem( aParentMenu, wxID_REDO, text, HELP_REDO, KiBitmap( redo_xpm ) );
aParentMenu->AppendSeparator();
text = AddHotkeyName( _( "&Cut" ), g_Schematic_Hotkeys_Descr, HK_EDIT_CUT );
AddMenuItem( aParentMenu, wxID_CUT, text,
_( "Cuts the selected item(s) to the Clipboard" ),
KiBitmap( cut_xpm ) );
text = AddHotkeyName( _( "&Copy" ), g_Schematic_Hotkeys_Descr, HK_EDIT_COPY );
AddMenuItem( aParentMenu, wxID_COPY, text,
_( "Copies the selected item(s) to the Clipboard" ),
KiBitmap( copy_xpm ) );
text = AddHotkeyName( _( "&Paste" ), g_Schematic_Hotkeys_Descr, HK_EDIT_PASTE );
AddMenuItem( aParentMenu, wxID_PASTE, text,
_( "Pastes item(s) from the Clipboard" ),
KiBitmap( paste_xpm ) );
// Delete
aParentMenu->AppendSeparator();
AddMenuItem( aParentMenu, ID_DELETE_TOOL,
_( "&Delete Tool" ), HELP_DELETE_ITEMS,
KiBitmap( delete_xpm ) );
// Find
aParentMenu->AppendSeparator();
text = AddHotkeyName( _( "&Find..." ), g_Schematic_Hotkeys_Descr, HK_FIND_ITEM );
AddMenuItem( aParentMenu, ID_FIND_ITEMS, text, HELP_FIND, KiBitmap( find_xpm ) );
// Find/Replace
text = AddHotkeyName( _( "Find and Re&place..." ), g_Schematic_Hotkeys_Descr,
HK_FIND_REPLACE );
AddMenuItem( aParentMenu, wxID_REPLACE, text, HELP_REPLACE,
KiBitmap( find_replace_xpm ) );
aParentMenu->AppendSeparator();
// Update field values
AddMenuItem( aParentMenu, ID_UPDATE_FIELDS,
_( "Update Fields from Library..." ),
_( "Sets symbol fields to original library values" ),
KiBitmap( update_fields_xpm ) );
}
void prepareInspectMenu( wxMenu* aParentMenu )
{
AddMenuItem( aParentMenu, ID_GET_ERC,

View File

@ -260,8 +260,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials )
EVT_TOOL( ID_OPEN_CMP_TABLE, SCH_EDIT_FRAME::OnLaunchBomManager )
EVT_TOOL( ID_BUS_MANAGER, SCH_EDIT_FRAME::OnLaunchBusManager )
EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems )
EVT_TOOL( wxID_REPLACE, SCH_EDIT_FRAME::OnFindItems )
EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile )
EVT_TOOL( ID_UPDATE_FIELDS, SCH_EDIT_FRAME::OnUpdateFields )
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
@ -829,7 +827,7 @@ void SCH_EDIT_FRAME::OnLaunchBusManager( wxCommandEvent& )
}
void SCH_EDIT_FRAME::OnFindItems( wxCommandEvent& aEvent )
void SCH_EDIT_FRAME::DoFindReplace( bool aReplace )
{
wxCHECK_RET( m_findReplaceData != NULL,
wxT( "Forgot to create find/replace data. Bad Programmer!" ) );
@ -842,7 +840,7 @@ void SCH_EDIT_FRAME::OnFindItems( wxCommandEvent& aEvent )
int style = 0;
if( aEvent.GetId() == wxID_REPLACE )
if( aReplace )
style = wxFR_REPLACEDIALOG;
m_dlgFindReplace = new DIALOG_SCH_FIND( this, m_findReplaceData, m_findReplaceStatus,

View File

@ -359,6 +359,11 @@ public:
SCH_SEARCH_T aSearchType,
const wxString& aSearchText );
/**
* Run the Find or Find & Replace dialog.
*/
void DoFindReplace( bool aReplace );
/**
* Breaks a single segment into two at the specified point.
*
@ -754,7 +759,6 @@ private:
void OnCreateBillOfMaterials( wxCommandEvent& event );
void OnLaunchBomManager( wxCommandEvent& event );
void OnLaunchBusManager( wxCommandEvent& event );
void OnFindItems( wxCommandEvent& event );
void OnFindDialogClose( wxFindDialogEvent& event );
void OnFindDrcMarker( wxFindDialogEvent& event );

View File

@ -83,13 +83,8 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( ACTIONS::redo );
KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( HELP_FIND, g_Schematic_Hotkeys_Descr, HK_FIND_ITEM, IS_COMMENT );
m_mainToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, KiScaledBitmap( find_xpm, this ), msg );
m_mainToolBar->AddTool( wxID_REPLACE, wxEmptyString, KiScaledBitmap( find_replace_xpm, this ),
wxNullBitmap, wxITEM_NORMAL, _( "Find and replace text" ),
HELP_REPLACE, nullptr );
m_mainToolBar->Add( ACTIONS::find );
m_mainToolBar->Add( ACTIONS::replace );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( ACTIONS::zoomRedraw );
@ -126,7 +121,6 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddTool( ID_OPEN_CMP_TABLE, wxEmptyString,
KiScaledBitmap( spreadsheet_xpm, this ), _( "Edit symbol fields" ) );
m_mainToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, KiScaledBitmap( bom_xpm, this ),
HELP_GENERATE_BOM );
@ -157,6 +151,8 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
// Set up toolbar
m_drawToolBar->Add( EE_ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::highlightNetCursor, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->Add( EE_ACTIONS::placeSymbol, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placePower, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::drawWire, ACTION_TOOLBAR::TOGGLE );
@ -171,6 +167,8 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->Add( EE_ACTIONS::drawSheet, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::importSheetPin, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeSheetPin, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->Add( EE_ACTIONS::drawLines, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeSchematicText, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeImage, ACTION_TOOLBAR::TOGGLE );
@ -204,21 +202,21 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
void SCH_EDIT_FRAME::SyncMenusAndToolbars()
{
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 );
m_mainToolBar->Toggle( ACTIONS::redo, GetScreen() && GetScreen()->GetRedoCommandCount() > 0 );
m_mainToolBar->Toggle( ACTIONS::zoomTool, GetToolId() == ID_ZOOM_SELECTION );
m_mainToolBar->Refresh();
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( EE_ACTIONS::toggleHiddenPins, GetShowAllPins() );
m_optionsToolBar->Toggle( EE_ACTIONS::toggleForceHV, GetForceHVLines() );
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( EE_ACTIONS::toggleHiddenPins, GetShowAllPins() );
m_optionsToolBar->Toggle( EE_ACTIONS::toggleForceHV, GetForceHVLines() );
m_optionsToolBar->Refresh();
m_drawToolBar->Toggle( EE_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED );
m_drawToolBar->Toggle( EE_ACTIONS::highlightNetCursor, GetToolId() == ID_HIGHLIGHT_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::placeSymbol, GetToolId() == ID_COMPONENT_BUTT );
@ -239,6 +237,5 @@ void SCH_EDIT_FRAME::SyncMenusAndToolbars()
m_drawToolBar->Toggle( EE_ACTIONS::placeSchematicText, GetToolId() == ID_SCHEMATIC_TEXT_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::placeImage, GetToolId() == ID_PLACE_IMAGE_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::deleteItemCursor, GetToolId() == ID_DELETE_TOOL );
m_drawToolBar->Refresh();
}

View File

@ -36,21 +36,12 @@ OPT<TOOL_EVENT> EE_ACTIONS::TranslateLegacyId( int aId )
case ID_CANCEL_CURRENT_COMMAND:
return ACTIONS::cancelInteractive.MakeEvent();
case ID_DELETE_TOOL:
return EE_ACTIONS::deleteItemCursor.MakeEvent();
case ID_SIM_PROBE:
return EE_ACTIONS::simProbe.MakeEvent();
case ID_SIM_TUNE:
return EE_ACTIONS::simTune.MakeEvent();
case ID_HOTKEY_SELECT_NODE:
return EE_ACTIONS::selectNode.MakeEvent();
case ID_HOTKEY_SELECT_CONNECTION:
return EE_ACTIONS::selectConnection.MakeEvent();
case ID_SCH_UNFOLD_BUS:
return EE_ACTIONS::unfoldBus.MakeEvent();

View File

@ -70,12 +70,12 @@ TOOL_ACTION EE_ACTIONS::drawSymbolCircle( "libedit.InteractiveDrawing.drawSymbol
TOOL_ACTION EE_ACTIONS::drawSymbolArc( "libedit.InteractiveDrawing.drawSymbolArc",
AS_GLOBAL, 0,
_( "Add Arc" ), _( "Add an arc" ),
add_circle_xpm, AF_ACTIVATE );
add_arc_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::drawSymbolLines( "libedit.InteractiveDrawing.drawSymbolLines",
AS_GLOBAL, 0,
_( "Add Lines" ), _( "Add connected graphic lines" ),
add_circle_xpm, AF_ACTIVATE );
add_polygon_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeSymbolAnchor( "libedit.InteractiveDrawing.placeSymbolAnchor",
AS_GLOBAL, 0,

View File

@ -159,7 +159,7 @@ TOOL_ACTION EE_ACTIONS::doDelete( "eeschema.InteractiveEdit.doDelete",
_( "Delete" ), _( "Deletes selected item(s)" ),
delete_xpm );
TOOL_ACTION EE_ACTIONS::deleteItemCursor( "eeschema.InteractiveEdit.deleteItemCursor",
TOOL_ACTION EE_ACTIONS::deleteItemCursor( "eeschema.InteractiveEdit.deleteTool",
AS_GLOBAL, 0,
_( "DoDelete Items" ), _( "DoDelete clicked items" ),
delete_xpm, AF_ACTIVATE );

View File

@ -71,7 +71,7 @@ TOOL_ACTION EE_ACTIONS::clearHighlight( "eeschema.EditorControl.clearHighlight",
TOOL_ACTION EE_ACTIONS::updateNetHighlighting( "eeschema.EditorControl.updateNetHighlighting",
AS_GLOBAL, 0, "", "" );
TOOL_ACTION EE_ACTIONS::highlightNetCursor( "eeschema.EditorControl.highlightNetCursor",
TOOL_ACTION EE_ACTIONS::highlightNetCursor( "eeschema.EditorControl.highlightNetTool",
AS_GLOBAL, 0,
_( "Highlight Nets" ), _( "Highlight wires and pins of a net" ),
net_highlight_schematic_xpm, AF_ACTIVATE );
@ -698,6 +698,13 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
}
int SCH_EDITOR_CONTROL::FindReplace( const TOOL_EVENT& aEvent )
{
m_frame->DoFindReplace( aEvent.IsAction( &ACTIONS::replace ) );
return 0;
}
int SCH_EDITOR_CONTROL::EditWithSymbolEditor( const TOOL_EVENT& aEvent )
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
@ -820,6 +827,8 @@ void SCH_EDITOR_CONTROL::setTransitions()
Go( &SCH_EDITOR_CONTROL::Cut, ACTIONS::cut.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Copy, ACTIONS::copy.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::FindReplace, ACTIONS::find.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::FindReplace, ACTIONS::replace.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::EditWithSymbolEditor, EE_ACTIONS::editWithSymbolEditor.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowSymbolEditor, EE_ACTIONS::showSymbolEditor.MakeEvent() );

View File

@ -81,6 +81,8 @@ public:
int Copy( const TOOL_EVENT& aEvent );
int Paste( const TOOL_EVENT& aEvent );
int FindReplace( const TOOL_EVENT& aEvent );
int EditWithSymbolEditor( const TOOL_EVENT& aEvent );
int ShowSymbolEditor( const TOOL_EVENT& aEvent );
int ShowLibraryBrowser( const TOOL_EVENT& aEvent );

View File

@ -75,7 +75,7 @@ TOOL_ACTION EE_ACTIONS::startLines( "eeschema.WireBusDrawing.startLines",
TOOL_ACTION EE_ACTIONS::drawLines( "eeschema.WireBusDrawing.drawLines",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_GRAPHIC_POLYLINE ),
_( "Add Lines" ), _( "Add connected graphic lines" ),
add_graphical_segments_xpm, AF_ACTIVATE );
add_dashed_line_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::finishLineWireOrBus( "eeschema.WireBusDrawing.finishLineWireOrBus",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_END_CURR_LINEWIREBUS ),

View File

@ -105,29 +105,19 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
EVT_MENU( wxID_ABOUT, EDA_DRAW_FRAME::GetKicadAbout )
EVT_TOOL( wxID_UNDO, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_PRINT, GERBVIEW_FRAME::ToPrinter )
EVT_COMBOBOX( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
GERBVIEW_FRAME::OnSelectActiveLayer )
EVT_COMBOBOX( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, GERBVIEW_FRAME::OnSelectActiveLayer )
EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnSelectActiveDCode )
// Vertical toolbar:
EVT_TOOL( ID_NO_TOOL_SELECTED, GERBVIEW_FRAME::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
GERBVIEW_FRAME::Process_Special_Functions )
// Option toolbar
EVT_TOOL( ID_TB_MEASUREMENT_TOOL, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnToggleCoordType )
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnTogglePolygonDrawMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, GERBVIEW_FRAME::OnToggleFlashItemDrawMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnToggleLineDrawMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
GERBVIEW_FRAME::OnToggleShowLayerManager )
EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, GERBVIEW_FRAME::OnSelectOptionToolbar )
EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
GERBVIEW_FRAME::OnSelectDisplayMode )
EVT_TOOL( ID_TB_OPTIONS_DIFF_MODE, GERBVIEW_FRAME::OnSelectOptionToolbar )
@ -147,22 +137,7 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_HIGHLIGHT_APER_ATTRIBUTE_ITEMS, GERBVIEW_FRAME::Process_Special_Functions )
EVT_MENU( ID_HIGHLIGHT_REMOVE_ALL, GERBVIEW_FRAME::Process_Special_Functions )
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, GERBVIEW_FRAME::OnUpdateSelectTool )
EVT_UPDATE_UI( ID_TB_MEASUREMENT_TOOL, GERBVIEW_FRAME::OnUpdateSelectTool )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnUpdateCoordType )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnUpdateLineDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnUpdatePolygonDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnUpdateShowDCodes )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, GERBVIEW_FRAME::OnUpdateShowNegativeItems )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
GERBVIEW_FRAME::OnUpdateShowLayerManager )
EVT_UPDATE_UI( ID_TB_OPTIONS_DIFF_MODE, GERBVIEW_FRAME::OnUpdateDiffMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, GERBVIEW_FRAME::OnUpdateHighContrastMode )
EVT_UPDATE_UI( ID_ON_GRID_SELECT, GERBVIEW_FRAME::OnUpdateSelectGrid )
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, GERBVIEW_FRAME::OnUpdateSelectZoom )
EVT_UPDATE_UI( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnUpdateSelectDCode )
EVT_UPDATE_UI( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
GERBVIEW_FRAME::OnUpdateLayerSelectBox )
@ -215,10 +190,6 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
ClearMsgPanel();
break;
case ID_NO_TOOL_SELECTED:
SetNoToolSelected();
break;
case ID_TB_MEASUREMENT_TOOL:
SetToolID( id, wxCURSOR_DEFAULT, _( "Unsupported tool in this canvas" ) );
break;
@ -448,16 +419,6 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id )
{
case ID_TB_OPTIONS_SHOW_DCODES:
SetElementVisibility( LAYER_DCODES, !IsElementVisible( LAYER_DCODES ) );
m_canvas->Refresh( true );
break;
case ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS:
SetElementVisibility( LAYER_NEGATIVE_OBJECTS, !IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
m_canvas->Refresh( true );
break;
case ID_TB_OPTIONS_DIFF_MODE:
options.m_DiffMode = !options.m_DiffMode;
needs_refresh = true;
@ -482,39 +443,6 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
}
void GERBVIEW_FRAME::OnTogglePolygonDrawMode( wxCommandEvent& aEvent )
{
GBR_DISPLAY_OPTIONS options = m_DisplayOptions;
options.m_DisplayPolygonsFill = !m_DisplayOptions.m_DisplayPolygonsFill;
UpdateDisplayOptions( options );
}
void GERBVIEW_FRAME::OnToggleLineDrawMode( wxCommandEvent& aEvent )
{
GBR_DISPLAY_OPTIONS options = m_DisplayOptions;
options.m_DisplayLinesFill = !m_DisplayOptions.m_DisplayLinesFill;
UpdateDisplayOptions( options );
}
void GERBVIEW_FRAME::OnToggleFlashItemDrawMode( wxCommandEvent& aEvent )
{
GBR_DISPLAY_OPTIONS options = m_DisplayOptions;
options.m_DisplayFlashedItemsFill = !m_DisplayOptions.m_DisplayFlashedItemsFill;
UpdateDisplayOptions( options );
}
void GERBVIEW_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
{
aEvent.Check( GetToolId() == aEvent.GetId() );
}
void GERBVIEW_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
{
switch( aEvent.GetId() )

View File

@ -233,7 +233,6 @@ public:
void OnLeftClick( wxDC* aDC, const wxPoint& aMousePos ) override;
void OnLeftDClick( wxDC* aDC, const wxPoint& aMousePos ) override;
bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) override;
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
double BestZoom() override;
void UpdateStatusBar() override;
@ -486,17 +485,8 @@ public:
void Process_Config( wxCommandEvent& event );
void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
void OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdatePolygonDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateShowDCodes( wxUpdateUIEvent& aEvent );
void OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent );
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
void OnUpdateDiffMode( wxUpdateUIEvent& aEvent );
void OnUpdateHighContrastMode( wxUpdateUIEvent& aEvent );
/**
* Function BlockCommand

View File

@ -182,76 +182,10 @@ bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_IN:
cmd.SetId( ID_KEY_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
cmd.SetId( ID_KEY_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_SELECTION:
//cmd.SetId( ID_ZOOM_SELECTION );
//GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_AUTO:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_RESET_LOCAL_COORD: // Reset the relative coord
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_SWITCH_UNITS:
cmd.SetId( (GetUserUnits() == INCHES) ?
ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_GBR_LINES_DISPLAY_MODE:
CHANGE( m_DisplayOptions.m_DisplayLinesFill );
m_canvas->Refresh();
break;
case HK_GBR_FLASHED_DISPLAY_MODE:
CHANGE( m_DisplayOptions.m_DisplayFlashedItemsFill );
m_canvas->Refresh( true );
break;
case HK_GBR_POLYGON_DISPLAY_MODE:
CHANGE( m_DisplayOptions.m_DisplayPolygonsFill );
m_canvas->Refresh();
break;
case HK_GBR_NEGATIVE_DISPLAY_ONOFF:
SetElementVisibility( LAYER_NEGATIVE_OBJECTS, not IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
m_canvas->Refresh();
break;
case HK_GBR_DCODE_DISPLAY_ONOFF:
SetElementVisibility( LAYER_DCODES, not IsElementVisible( LAYER_DCODES ) );
m_canvas->Refresh();
break;
case HK_SWITCH_HIGHCONTRAST_MODE:
CHANGE( m_DisplayOptions.m_HighContrastMode );
m_canvas->Refresh();
break;
case HK_SWITCH_LAYER_TO_PREVIOUS:
if( GetActiveLayer() > 0 )
{

View File

@ -33,14 +33,18 @@
#include <advanced_config.h>
#include <kiface_i.h>
#include <pgm_base.h>
#include "gerbview_id.h"
#include "hotkeys.h"
#include <menus_helpers.h>
#include <tool/actions.h>
#include <tool/tool_manager.h>
#include <tool/conditional_menu.h>
#include <tools/gerbview_selection_tool.h>
#include <tools/gerbview_actions.h>
void GERBVIEW_FRAME::ReCreateMenuBar()
{
GERBVIEW_SELECTION_TOOL* selTool = m_toolManager->GetTool<GERBVIEW_SELECTION_TOOL>();
// wxWidgets handles the Mac Application menu behind the scenes, but that means
// we always have to start from scratch with a new wxMenuBar.
wxMenuBar* oldMenuBar = GetMenuBar();
@ -180,120 +184,91 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
KiBitmap( exit_xpm ) );
//--------- View menu ----------------
wxMenu* viewMenu = new wxMenu;
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
auto gridShownCondition = [ this ] ( const SELECTION& aSel ) {
return IsGridVisible();
};
auto polarCoordsCondition = [ this ] ( const SELECTION& aSel ) {
return m_DisplayOptions.m_DisplayPolarCood;
};
auto layersManagerShownCondition = [ this ] ( const SELECTION& aSel ) {
return m_show_layer_manager_tools;
};
auto imperialUnitsCondition = [ this ] ( const SELECTION& aSel ) {
return GetUserUnits() == INCHES;
};
auto metricUnitsCondition = [ this ] ( const SELECTION& aSel ) {
return GetUserUnits() == MILLIMETRES;
};
auto sketchFlashedCondition = [ this ] ( const SELECTION& aSel ) {
return !m_DisplayOptions.m_DisplayFlashedItemsFill;
};
auto sketchLinesCondition = [ this ] ( const SELECTION& aSel ) {
return !m_DisplayOptions.m_DisplayLinesFill;
};
auto sketchPolygonsCondition = [ this ] ( const SELECTION& aSel ) {
return !m_DisplayOptions.m_DisplayPolygonsFill;
};
auto showDcodes = [ this ] ( const SELECTION& aSel ) {
return IsElementVisible( LAYER_DCODES );
};
auto showNegativeObjects = [ this ] ( const SELECTION& aSel ) {
return IsElementVisible( LAYER_NEGATIVE_OBJECTS );
};
auto diffModeCondition = [ this ] ( const SELECTION& aSel ) {
return m_DisplayOptions.m_DiffMode;
};
auto contrastModeCondition = [ this ] ( const SELECTION& aSel ) {
return m_DisplayOptions.m_HighContrastMode;
};
// Hide layer manager
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
_( "Show &Layers Manager" ), _( "Show or hide the layer manager" ),
KiBitmap( layers_manager_xpm ), wxITEM_CHECK );
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
_( "Show &Layers Manager" ), _( "Show or hide the layer manager" ),
layers_manager_xpm, layersManagerShownCondition );
viewMenu->AppendSeparator();
/* Important Note for ZOOM IN and ZOOM OUT commands from menubar:
* we cannot add hotkey info here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT
* events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command:
* zoom in and out from hotkeys are equivalent to the pop up menu zoom
* From here, zooming is made around the screen center
* From hotkeys, zooming is made around the mouse cursor position
* (obviously not possible from the toolbar or menubar command)
*
* in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators
* for Zoom in and Zoom out sub menus
*/
text = AddHotkeyName( _( "Zoom &In" ), GerbviewHotkeysDescr,
HK_ZOOM_IN, IS_ACCELERATOR );
AddMenuItem( viewMenu, ID_ZOOM_IN, text, _( "Zoom in" ), KiBitmap( zoom_in_xpm ) );
text = AddHotkeyName( _( "Zoom &Out" ), GerbviewHotkeysDescr,
HK_ZOOM_OUT, IS_ACCELERATOR );
AddMenuItem( viewMenu, ID_ZOOM_OUT, text, _( "Zoom out" ), KiBitmap( zoom_out_xpm ) );
text = AddHotkeyName( _( "Zoom to &Fit" ), GerbviewHotkeysDescr, HK_ZOOM_AUTO );
AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, _( "Zoom to fit" ),
KiBitmap( zoom_fit_in_page_xpm ) );
text = AddHotkeyName( _( "Zoom to Selection" ), GerbviewHotkeysDescr, HK_ZOOM_SELECTION );
AddMenuItem( viewMenu, ID_ZOOM_SELECTION, text, KiBitmap( zoom_area_xpm ), wxITEM_CHECK );
text = AddHotkeyName( _( "&Redraw" ), GerbviewHotkeysDescr, HK_ZOOM_REDRAW );
AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text,
_( "Refresh screen" ), KiBitmap( zoom_redraw_xpm ) );
viewMenu->AddSeparator();
viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AppendSeparator();
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_GRID,
_( "Show &Grid" ), wxEmptyString,
KiBitmap( grid_xpm ), wxITEM_CHECK );
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_POLAR_COORD,
_( "Display &Polar Coordinates" ), wxEmptyString,
KiBitmap( polar_coord_xpm ), wxITEM_CHECK );
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_POLAR_COORD,
_( "Display &Polar Coordinates" ), wxEmptyString,
polar_coord_xpm, polarCoordsCondition );
// Units submenu
wxMenu* unitsSubMenu = new wxMenu;
AddMenuItem( unitsSubMenu, ID_TB_OPTIONS_SELECT_UNIT_INCH,
_( "&Imperial" ), _( "Use imperial units" ),
KiBitmap( unit_inch_xpm ), wxITEM_RADIO );
AddMenuItem( unitsSubMenu, ID_TB_OPTIONS_SELECT_UNIT_MM,
_( "&Metric" ), _( "Use metric units" ),
KiBitmap( unit_mm_xpm ), wxITEM_RADIO );
AddMenuItem( viewMenu, unitsSubMenu,
-1, _( "&Units" ),
_( "Select which units are displayed" ),
KiBitmap( unit_mm_xpm ) );
CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool );
unitsSubMenu->SetTitle( _( "&Units" ) );
unitsSubMenu->SetIcon( unit_mm_xpm );
unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition );
unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition );
viewMenu->AddMenu( unitsSubMenu );
viewMenu->AppendSeparator();
viewMenu->AddCheckItem( GERBVIEW_ACTIONS::flashedDisplayOutlines, sketchFlashedCondition );
viewMenu->AddCheckItem( GERBVIEW_ACTIONS::linesDisplayOutlines, sketchLinesCondition );
viewMenu->AddCheckItem( GERBVIEW_ACTIONS::polygonsDisplayOutlines, sketchPolygonsCondition );
viewMenu->AddCheckItem( GERBVIEW_ACTIONS::dcodeDisplay, showDcodes );
viewMenu->AddCheckItem( GERBVIEW_ACTIONS::negativeObjectDisplay, showNegativeObjects );
text = AddHotkeyName( _( "Sketch F&lashed Items" ), GerbviewHotkeysDescr, HK_GBR_FLASHED_DISPLAY_MODE );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, text,
_( "Show flashed items in outline mode" ),
KiBitmap( pad_sketch_xpm ), wxITEM_CHECK );
viewMenu->AddCheckItem( ID_TB_OPTIONS_DIFF_MODE,
_( "Show in Differential Mode" ),
_( "Show layers in differential mode" ),
gbr_select_mode2_xpm, diffModeCondition );
text = AddHotkeyName( _( "Sketch &Lines" ), GerbviewHotkeysDescr, HK_GBR_LINES_DISPLAY_MODE );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_LINES_SKETCH, text,
_( "Show lines in outline mode" ),
KiBitmap( showtrack_xpm ), wxITEM_CHECK );
text = AddHotkeyName( _( "Sketch Pol&ygons" ), GerbviewHotkeysDescr, HK_GBR_POLYGON_DISPLAY_MODE );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, text,
_( "Show polygons in outline mode" ),
KiBitmap( opt_show_polygon_xpm ), wxITEM_CHECK );
text = AddHotkeyName( _( "Show &DCodes" ), GerbviewHotkeysDescr, HK_GBR_DCODE_DISPLAY_ONOFF );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_DCODES, text,
_( "Show or hide DCodes" ),
KiBitmap( show_dcodenumber_xpm ), wxITEM_CHECK );
text = AddHotkeyName( _( "Show &Negative Objects" ), GerbviewHotkeysDescr, HK_GBR_NEGATIVE_DISPLAY_ONOFF );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, text,
_( "Show negative objects in ghost color" ),
KiBitmap( gerbview_show_negative_objects_xpm ), wxITEM_CHECK );
if( IsGalCanvasActive() )
{
AddMenuItem( viewMenu, ID_TB_OPTIONS_DIFF_MODE,
_( "Show in Differential Mode" ), _( "Show layers in differential mode" ),
KiBitmap( gbr_select_mode2_xpm ), wxITEM_CHECK );
text = AddHotkeyName( _( "Show in High Contrast" ), GerbviewHotkeysDescr, HK_SWITCH_HIGHCONTRAST_MODE );
AddMenuItem( viewMenu, ID_TB_OPTIONS_HIGH_CONTRAST_MODE, text,
_( "Show in high contrast mode" ),
KiBitmap( contrast_mode_xpm ), wxITEM_CHECK );
}
else
{
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_GBR_MODE_0,
_( "Show Normal Mode" ), _( "Show layers in normal mode" ),
KiBitmap( gbr_select_mode0_xpm ), wxITEM_RADIO );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_GBR_MODE_1,
_( "Show Stacked Mode" ), _( "Show layers in stacked mode" ),
KiBitmap( gbr_select_mode1_xpm ), wxITEM_RADIO );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
_( "Show Transparency Mode" ), _( "Show layers in transparency mode" ),
KiBitmap( gbr_select_mode2_xpm ), wxITEM_RADIO );
}
text = AddHotkeyName( _( "Show in High Contrast" ), GerbviewHotkeysDescr, HK_SWITCH_HIGHCONTRAST_MODE );
viewMenu->AddCheckItem( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, text,
_( "Show in high contrast mode" ),
contrast_mode_xpm, contrastModeCondition );
// Menu for configuration and preferences
wxMenu* configMenu = new wxMenu;

View File

@ -36,6 +36,7 @@
#include <kicad_string.h>
#include <wx/wupdlock.h>
#include <tool/actions.h>
#include <tools/gerbview_actions.h>
void GERBVIEW_FRAME::ReCreateHToolbar( void )
{
@ -201,8 +202,7 @@ void GERBVIEW_FRAME::ReCreateVToolbar()
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, _( "Select item" ),
KiScaledBitmap( cursor_xpm, this ) );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->AddSeparator();
m_drawToolBar->Realize();
@ -220,14 +220,8 @@ void GERBVIEW_FRAME::ReCreateOptToolbar()
// TODO: these can be moved to the 'proper' vertical toolbar if and when there are
// actual tools to put there. That, or I'll get around to implementing configurable
// toolbars.
m_optionsToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString,
KiScaledBitmap( cursor_xpm, this ),
wxEmptyString, wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_MEASUREMENT_TOOL, wxEmptyString,
KiScaledBitmap( measurement_xpm, this ),
_( "Measure distance between two points" ),
wxITEM_CHECK );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
@ -236,32 +230,16 @@ void GERBVIEW_FRAME::ReCreateOptToolbar()
KiScaledBitmap( polar_coord_xpm, this ),
_( "Display polar coordinates" ), wxITEM_CHECK );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, wxEmptyString,
KiScaledBitmap( pad_sketch_xpm, this ),
_( "Show flashed items in outline mode" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_LINES_SKETCH, wxEmptyString,
KiScaledBitmap( showtrack_xpm, this ),
_( "Show lines in outline mode" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, wxEmptyString,
KiScaledBitmap( opt_show_polygon_xpm, this ),
_( "Show polygons in outline mode" ),
wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, wxEmptyString,
KiScaledBitmap( gerbview_show_negative_objects_xpm, this ),
_( "Show negatives objects in ghost color" ),
wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_DCODES, wxEmptyString,
KiScaledBitmap( show_dcodenumber_xpm, this ),
_( "Show dcode number" ), wxITEM_CHECK );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::flashedDisplayOutlines, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::linesDisplayOutlines, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::polygonsDisplayOutlines, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::negativeObjectDisplay, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::dcodeDisplay, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_DIFF_MODE, wxEmptyString,
KiScaledBitmap( gbr_select_mode2_xpm, this ),
@ -476,115 +454,6 @@ void GERBVIEW_FRAME::OnToggleCoordType( wxCommandEvent& aEvent )
}
void GERBVIEW_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
{
aEvent.Check( m_DisplayOptions.m_DisplayPolarCood );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
m_DisplayOptions.m_DisplayPolarCood ?
_( "Turn on rectangular coordinates" ) :
_( "Turn on polar coordinates" ) );
}
void GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( !m_DisplayOptions.m_DisplayFlashedItemsFill );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
m_DisplayOptions.m_DisplayFlashedItemsFill ?
_( "Show flashed items in outline mode" ) :
_( "Show flashed items in fill mode" ) );
}
void GERBVIEW_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( !m_DisplayOptions.m_DisplayLinesFill );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_LINES_SKETCH,
m_DisplayOptions.m_DisplayFlashedItemsFill ?
_( "Show lines in outline mode" ) :
_( "Show lines in fill mode" ) );
}
void GERBVIEW_FRAME::OnUpdatePolygonDrawMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( !m_DisplayOptions.m_DisplayPolygonsFill );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
m_DisplayOptions.m_DisplayFlashedItemsFill ?
_( "Show polygons in outline mode" ) :
_( "Show polygons in fill mode" ) );
}
void GERBVIEW_FRAME::OnUpdateShowDCodes( wxUpdateUIEvent& aEvent )
{
aEvent.Check( IsElementVisible( LAYER_DCODES ) );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_DCODES,
IsElementVisible( LAYER_DCODES ) ?
_( "Hide DCodes" ) : _( "Show DCodes" ) );
}
void GERBVIEW_FRAME::OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent )
{
aEvent.Check( IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS,
IsElementVisible( LAYER_NEGATIVE_OBJECTS ) ?
_( "Show negative objects in normal color" ) :
_( "Show negative objects in ghost color" ) );
}
void GERBVIEW_FRAME::OnUpdateDiffMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( m_DisplayOptions.m_DiffMode );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DIFF_MODE,
m_DisplayOptions.m_DiffMode ?
_( "Show layers in normal mode" ) :
_( "Show layers in differential mode" ) );
}
void GERBVIEW_FRAME::OnUpdateHighContrastMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( m_DisplayOptions.m_HighContrastMode );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIGH_CONTRAST_MODE,
m_DisplayOptions.m_HighContrastMode ?
_( "Disable high contrast mode" ) :
_( "Enable high contrast mode" ) );
}
void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
{
aEvent.Check( m_show_layer_manager_tools );
if( m_optionsToolBar )
{
if( m_show_layer_manager_tools )
m_optionsToolBar->SetToolShortHelp( aEvent.GetId(), _( "Hide layers manager" ) );
else
m_optionsToolBar->SetToolShortHelp( aEvent.GetId(), _( "Show layers manager" ) );
}
}
void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
{
if( !m_DCodeSelector )
@ -610,23 +479,31 @@ void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
void GERBVIEW_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
{
if( m_SelLayerBox->GetSelection() != GetActiveLayer() )
{
m_SelLayerBox->SetSelection( GetActiveLayer() );
}
}
void GERBVIEW_FRAME::SyncMenusAndToolbars()
{
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
m_mainToolBar->Toggle( ACTIONS::zoomTool, GetToolId() == ID_ZOOM_SELECTION );
m_mainToolBar->Refresh();
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( GERBVIEW_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED );
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, !galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( GERBVIEW_ACTIONS::flashedDisplayOutlines,
!m_DisplayOptions.m_DisplayFlashedItemsFill );
m_optionsToolBar->Toggle( GERBVIEW_ACTIONS::linesDisplayOutlines,
!m_DisplayOptions.m_DisplayLinesFill );
m_optionsToolBar->Toggle( GERBVIEW_ACTIONS::polygonsDisplayOutlines,
!m_DisplayOptions.m_DisplayPolygonsFill );
m_optionsToolBar->Toggle( GERBVIEW_ACTIONS::negativeObjectDisplay,
IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
m_optionsToolBar->Toggle( GERBVIEW_ACTIONS::dcodeDisplay,
IsElementVisible( LAYER_DCODES ) );
m_optionsToolBar->Refresh();
}

View File

@ -27,24 +27,6 @@ OPT<TOOL_EVENT> GERBVIEW_ACTIONS::TranslateLegacyId( int aId )
{
switch( aId )
{
case ID_ZOOM_IN: // toolbar button "Zoom In"
return ACTIONS::zoomInCenter.MakeEvent();
case ID_ZOOM_OUT: // toolbar button "Zoom In"
return ACTIONS::zoomOutCenter.MakeEvent();
case ID_ZOOM_PAGE: // toolbar button "Fit on Screen"
return ACTIONS::zoomFitScreen.MakeEvent();
case ID_ZOOM_SELECTION:
return ACTIONS::zoomTool.MakeEvent();
case ID_TB_MEASUREMENT_TOOL:
return GERBVIEW_ACTIONS::measureTool.MakeEvent();
case ID_NO_TOOL_SELECTED:
return GERBVIEW_ACTIONS::selectionTool.MakeEvent();
case ID_HIGHLIGHT_REMOVE_ALL:
return GERBVIEW_ACTIONS::highlightClear.MakeEvent();

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -31,27 +31,33 @@
TOOL_ACTION GERBVIEW_ACTIONS::selectionTool( "gerbview.Control.selectionTool",
AS_GLOBAL, 0,
"", "", NULL, AF_ACTIVATE );
_( "Select item(s)" ), "",
cursor_xpm, AF_ACTIVATE );
TOOL_ACTION GERBVIEW_ACTIONS::layerChanged( "gerbview.Control.layerChanged",
AS_GLOBAL, 0,
"", "", NULL, AF_NOTIFY );
"", "",
NULL, AF_NOTIFY );
TOOL_ACTION GERBVIEW_ACTIONS::highlightClear( "gerbview.Control.highlightClear",
AS_GLOBAL, 0,
_( "Clear Highlight" ), "", highlight_remove_xpm );
_( "Clear Highlight" ), "",
highlight_remove_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::highlightNet( "gerbview.Control.highlightNet",
AS_GLOBAL, 0,
_( "Highlight Net" ), "", general_ratsnest_xpm );
_( "Highlight Net" ), "",
general_ratsnest_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::highlightComponent( "gerbview.Control.highlightComponent",
AS_GLOBAL, 0,
_( "Highlight Component" ), "", file_footprint_xpm );
_( "Highlight Component" ), "",
file_footprint_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::highlightAttribute( "gerbview.Control.highlightAttribute",
AS_GLOBAL, 0,
_( "Highlight Attribute" ), "", flag_xpm );
_( "Highlight Attribute" ), "",
flag_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::layerNext( "gerbview.Control.layerNext",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_NEXT ),
@ -63,23 +69,28 @@ TOOL_ACTION GERBVIEW_ACTIONS::layerPrev( "gerbview.Control.layerPrev",
TOOL_ACTION GERBVIEW_ACTIONS::linesDisplayOutlines( "gerbview.Control.linesDisplayOutlines",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GBR_LINES_DISPLAY_MODE ),
"", "" );
_( "Sketch Lines" ), _( "Show lines in outline mode" ),
showtrack_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::flashedDisplayOutlines( "gerbview.Control.flashedDisplayOutlines",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GBR_FLASHED_DISPLAY_MODE ),
"", "" );
_( "Sketch Flashed Items" ), _( "Show flashed items in outline mode" ),
pad_sketch_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::polygonsDisplayOutlines( "gerbview.Control.polygonsDisplayOutlines",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GBR_POLYGON_DISPLAY_MODE ),
"", "" );
_( "Sketch Polygons" ), _( "Show polygons in outline mode" ),
opt_show_polygon_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::negativeObjectDisplay( "gerbview.Control.negativeObjectDisplay",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GBR_NEGATIVE_DISPLAY_ONOFF ),
"", "" );
_( "Ghost Negative Objects" ), _( "Show negative objects in ghost color" ),
gerbview_show_negative_objects_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::dcodeDisplay( "gerbview.Control.dcodeDisplay",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GBR_DCODE_DISPLAY_ONOFF ),
"", "" );
_( "Show DCodes" ), _( "Show dcode number" ),
show_dcodenumber_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::resetCoords( "gerbview.Control.resetCoords",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_LOCAL_COORD ),

View File

@ -72,7 +72,7 @@ TOOL_ACTION GERBVIEW_ACTIONS::selectionClear( "gerbview.InteractiveSelection.Cle
TOOL_ACTION GERBVIEW_ACTIONS::measureTool( "gerbview.InteractiveSelection.measureTool",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MEASURE_TOOL ),
_( "Measure Tool" ), _( "Interactively measure distance between points" ),
nullptr, AF_ACTIVATE );
measurement_xpm, AF_ACTIVATE );
class HIGHLIGHT_MENU: public ACTION_MENU

View File

@ -952,7 +952,7 @@ public:
* Update the toolbars and menus (mostly settings/check buttons/checkboxes)
* with the current controller state
*/
virtual void SyncMenusAndToolbars() {};
virtual void SyncMenusAndToolbars() { };
bool GetShowAxis() const { return m_showAxis; }
bool GetShowGridAxis() const { return m_showGridAxis; }

View File

@ -267,9 +267,11 @@ enum common_hotkey_id_command {
HK_PRINT,
HK_UNDO,
HK_REDO,
HK_EDIT_CUT,
HK_EDIT_COPY,
HK_EDIT_PASTE,
HK_CUT,
HK_COPY,
HK_PASTE,
HK_FIND,
HK_REPLACE,
HK_RESET_LOCAL_COORD,
HK_SET_GRID_ORIGIN,
HK_RESET_GRID_ORIGIN,

View File

@ -267,8 +267,6 @@ enum main_id
ID_EDA_SOCKET_EVENT,
// Common to all
ID_TB_OPTIONS_SELECT_UNIT_MM,
ID_TB_OPTIONS_SELECT_UNIT_INCH,
ID_TB_OPTIONS_SELECT_CURSOR,
ID_TB_OPTIONS_SHOW_POLAR_COORD,
ID_TB_OPTIONS_SHOW_GRID,

View File

@ -66,6 +66,7 @@ protected:
static const int ACTION_ID = 10000;
TOOL_MANAGER* m_toolManager;
std::map<int, bool> m_toolKinds;
std::map<int, const TOOL_ACTION*> m_toolActions;
};

View File

@ -52,6 +52,8 @@ public:
static TOOL_ACTION cut;
static TOOL_ACTION copy;
static TOOL_ACTION paste;
static TOOL_ACTION find;
static TOOL_ACTION replace;
// View controls
static TOOL_ACTION zoomRedraw;

View File

@ -286,7 +286,6 @@ set( PCBNEW_CLASS_SRCS
muwave_command.cpp
netlist.cpp
onleftclick.cpp
onrightclick.cpp
pad_edit_functions.cpp
pad_naming.cpp
pcb_base_edit_frame.cpp
@ -313,7 +312,6 @@ set( PCBNEW_CLASS_SRCS
toolbars_footprint_viewer.cpp
toolbar_onrightclick.cpp
toolbars_pcb_editor.cpp
toolbars_update_user_interface.cpp
tracks_cleaner.cpp
undo_redo.cpp
zone_filler.cpp

View File

@ -51,12 +51,16 @@
TOOL_ACTION PCB_ACTIONS::autoplaceSelectedComponents( "pcbnew.Autoplacer.autoplaceSelected",
AS_GLOBAL, 0, _( "Auto-place selected components" ),
_( "Performs automatic placement of selected components" ) );
AS_GLOBAL, 0,
_( "Place Selected Footprints" ),
_( "Performs automatic placement of selected components" )
/* // fixme: icon */ );
TOOL_ACTION PCB_ACTIONS::autoplaceOffboardComponents( "pcbnew.Autoplacer.autoplaceOffboard",
AS_GLOBAL, 0, _( "Auto-place off-board components" ),
_( "Performs automatic placement of components outside board area" ) );
AS_GLOBAL, 0,
_( "Place Off-Board Footprints" ),
_( "Performs automatic placement of components outside board area" )
/* // fixme: icon */ );
AUTOPLACE_TOOL::AUTOPLACE_TOOL() : PCB_TOOL_BASE( "pcbnew.Autoplacer" )
{

View File

@ -126,7 +126,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
{
switch( GetToolId() )
{
case ID_PCB_SHOW_1_RATSNEST_BUTT:
case ID_LOCAL_RATSNEST_BUTT:
scanList = GENERAL_COLLECTOR::PadsOrModules;
break;
@ -139,7 +139,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
break;
case ID_PCB_ZONES_BUTT:
case ID_PCB_KEEPOUT_AREA_BUTT:
case ID_PCB_KEEPOUT_BUTT:
scanList = GENERAL_COLLECTOR::Zones;
break;

View File

@ -194,9 +194,3 @@ void DIALOG_FIND::onClose( wxCloseEvent& aEvent )
}
void PCB_EDIT_FRAME::InstallFindFrame()
{
DIALOG_FIND dlg( this );
dlg.ShowModal();
}

View File

@ -79,18 +79,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case wxID_COPY:
case ID_TOOLBARH_PCB_SELECT_LAYER:
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
case ID_POPUP_PCB_ROTATE_TEXTEPCB:
case ID_POPUP_PCB_FLIP_TEXTEPCB:
case ID_POPUP_PCB_COPY_TEXTEPCB:
case ID_POPUP_PCB_EDIT_TEXTEPCB:
case ID_POPUP_PCB_EDIT_PCB_TARGET:
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
case ID_POPUP_PCB_EDIT_MODULE_PRMS:
case ID_POPUP_PCB_EDIT_MODULE_WITH_MODEDIT:
case ID_POPUP_PCB_EDIT_TEXTMODULE:
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
case ID_POPUP_PCB_BEGIN_TRACK:
case ID_POPUP_PCB_END_TRACK:
@ -126,7 +117,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_LAYER_PAIR:
case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
case ID_POPUP_PCB_MOVE_TRACK_NODE:
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
@ -141,18 +131,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_LOCK_OFF_TRACK:
case ID_POPUP_PCB_LOCK_ON_NET:
case ID_POPUP_PCB_LOCK_OFF_NET:
case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_ZOOM_BLOCK:
case ID_POPUP_FLIP_BLOCK:
case ID_POPUP_ROTATE_BLOCK:
case ID_POPUP_DUPLICATE_BLOCK:
case ID_POPUP_PCB_EDIT_DRAWING:
case ID_POPUP_PCB_GETINFO_MARKER:
case ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST:
case ID_POPUP_PCB_DRAG_MODULE_REQUEST:
case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
case ID_POPUP_PCB_MOVE_PCB_TARGET_REQUEST:
break;
@ -302,10 +282,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
InstallNetlistFrame( &dc );
break;
case ID_FIND_ITEMS:
InstallFindFrame();
break;
case ID_POPUP_CLOSE_CURRENT_TOOL:
SetNoToolSelected();
break;
@ -647,40 +623,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
}
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
StartMoveTextePcb( (TEXTE_PCB*) GetCurItem(), &dc );
m_canvas->SetAutoPanRequest( true );
break;
case ID_POPUP_PCB_DRAG_MODULE_REQUEST:
case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
if( GetCurItem() == NULL )
break;
// If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != PCB_MODULE_T )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
break;
module = (MODULE*) GetCurItem();
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but it is locked" ),
module->GetReference().GetData() );
DisplayInfoMessage( this, msg );
break;
}
SendMessageToEESCHEMA( module );
SetCrossHairPosition( module->GetPosition() );
m_canvas->MoveCursorToCrossHair();
StartMoveModule( module, &dc, id == ID_POPUP_PCB_DRAG_MODULE_REQUEST );
break;
case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: // get module by name and move it
SetCurItem( GetFootprintFromBoardByReference() );
module = (MODULE*) GetCurItem();
@ -702,118 +644,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
StartMoveModule( module, &dc, false );
break;
case ID_POPUP_PCB_DELETE_MODULE:
m_canvas->MoveCursorToCrossHair();
// If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != PCB_MODULE_T )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
break;
module = (MODULE*) GetCurItem();
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but it is locked" ),
module->GetReference().GetData() );
DisplayInfoMessage( this, msg );
break;
}
if( Delete_Module( (MODULE*) GetCurItem(), &dc ) )
{
SetCurItem( NULL );
}
break;
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
m_canvas->MoveCursorToCrossHair();
// If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != PCB_MODULE_T )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
break;
module = (MODULE*) GetCurItem();
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but it is locked" ),
module->GetReference().GetData() );
DisplayInfoMessage( this, msg );
break;
}
// This is a simple rotation, no other editing in progress
if( !GetCurItem()->IsMoving() )
SaveCopyInUndoList( GetCurItem(), UR_CHANGED, ((MODULE*)GetCurItem())->GetPosition() );
Rotate_Module( &dc, (MODULE*) GetCurItem(), m_rotationAngle, true );
break;
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
m_canvas->MoveCursorToCrossHair();
// If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != PCB_MODULE_T )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
break;
module = (MODULE*) GetCurItem();
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but it is locked" ),
module->GetReference().GetData() );
DisplayInfoMessage( this, msg );
break;
}
// This is a simple rotation, no other editing in progress
if( !GetCurItem()->IsMoving() )
SaveCopyInUndoList( GetCurItem(), UR_CHANGED, ((MODULE*)GetCurItem())->GetPosition() );
Rotate_Module( &dc, (MODULE*) GetCurItem(), -m_rotationAngle, true );
break;
case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
m_canvas->MoveCursorToCrossHair();
// If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != PCB_MODULE_T )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
break;
module = (MODULE*) GetCurItem();
if( module->IsLocked() )
{
wxString msg;
msg.Printf( _( "Footprint %s found, but it is locked" ),
module->GetReference().GetData() );
DisplayInfoMessage( this, msg );
break;
}
// This is a simple flip, no other editing in progress
if( !GetCurItem()->IsMoving() )
SaveCopyInUndoList( GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->GetPosition() );
Change_Side_Module( (MODULE*) GetCurItem(), &dc );
break;
case ID_POPUP_PCB_UPDATE_FOOTPRINTS:
if( GetCurItem() && GetCurItem()->Type() == PCB_MODULE_T )
{
@ -929,37 +759,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
Export_Pad_Settings( (D_PAD*) GetCurItem() );
break;
case ID_POPUP_PCB_DELETE_PAD:
SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
DeletePad( (D_PAD*) GetCurItem() );
SetCurItem( NULL );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_EDIT_TEXTMODULE:
InstallTextOptionsFrame( GetCurItem(), &dc );
break;
case ID_POPUP_PCB_RESET_TEXT_SIZE:
ResetTextSize( GetCurItem(), &dc );
break;
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
m_canvas->MoveCursorToCrossHair();
StartMoveTexteModule( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
break;
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
RotateTextModule( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_DELETE_TEXTMODULE:
DeleteTextModule( static_cast<TEXTE_MODULE*>( GetCurItem() ) );
SetCurItem( NULL );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_SELECT_LAYER:
{
PCB_LAYER_ID itmp = SelectLayer( GetActiveLayer() );
@ -1015,31 +814,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->Refresh( true );
break;
case ID_POPUP_PCB_EDIT_TEXTEPCB:
InstallTextOptionsFrame( GetCurItem(), &dc );
break;
case ID_POPUP_PCB_ROTATE_TEXTEPCB:
Rotate_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_COPY_TEXTEPCB:
CreateTextePcb( &dc, (TEXTE_PCB*) GetCurItem() );
m_canvas->MoveCursorToCrossHair();
m_canvas->SetAutoPanRequest( true );
break;
case ID_POPUP_PCB_FLIP_TEXTEPCB:
FlipTextePcb( (TEXTE_PCB*) GetCurItem(), &dc );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_DELETE_TEXTEPCB:
Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_MOVE_PCB_TARGET_REQUEST:
BeginMoveTarget( (PCB_TARGET*) GetCurItem(), &dc );
m_canvas->MoveCursorToCrossHair();
@ -1071,11 +845,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
BeginMoveDimensionText( (DIMENSION*) GetCurItem(), &dc );
break;
case ID_POPUP_PCB_DELETE_DRAWING:
Delete_Segment_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_DELETE_MARKER:
RemoveStruct( GetCurItem(), &dc );
m_canvas->MoveCursorToCrossHair();
@ -1098,15 +867,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->Refresh();
break;
case ID_POPUP_PCB_EDIT_DRAWING:
InstallGraphicItemPropertiesDialog( GetCurItem() );
break;
case ID_POPUP_PCB_MOVE_DRAWING_REQUEST:
m_canvas->MoveCursorToCrossHair();
Start_Move_DrawItem( (DRAWSEGMENT*) GetCurItem(), &dc );
break;
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
m_canvas->MoveCursorToCrossHair();
@ -1429,7 +1189,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
break;
case ID_PCB_KEEPOUT_AREA_BUTT:
case ID_PCB_KEEPOUT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add keepout" ) );
break;
@ -1477,7 +1237,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
SetToolID( id, wxCURSOR_HAND, _( "Highlight net" ) );
break;
case ID_PCB_SHOW_1_RATSNEST_BUTT:
case ID_LOCAL_RATSNEST_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) );
Compile_Ratsnest( &dc, true );

View File

@ -115,8 +115,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, FOOTPRINT_EDIT_FRAME::LoadModuleFromBoard )
EVT_TOOL( ID_ADD_FOOTPRINT_TO_BOARD, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_UNDO, FOOTPRINT_EDIT_FRAME::RestoreCopyFromUndoList )
EVT_TOOL( wxID_REDO, FOOTPRINT_EDIT_FRAME::RestoreCopyFromRedoList )
// Vertical tool bar button click event handler.
EVT_TOOL( ID_NO_TOOL_SELECTED, FOOTPRINT_EDIT_FRAME::OnVerticalToolbar )
@ -124,11 +122,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_MEASUREMENT_TOOL,
FOOTPRINT_EDIT_FRAME::OnVerticalToolbar )
// Options Toolbar
// ID_TB_OPTIONS_SHOW_PADS_SKETCH id is managed in PCB_BASE_FRAME
// ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH id is managed in PCB_BASE_FRAME
// ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH id is managed in PCB_BASE_FRAME
EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_MODEDIT_SHOW_HIDE_SEARCH_TREE, FOOTPRINT_EDIT_FRAME::OnToggleSearchTree )
// Preferences and option menus
@ -185,8 +178,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard )
EVT_UPDATE_UI( ID_ADD_FOOTPRINT_TO_BOARD,
FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard )
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, FOOTPRINT_EDIT_FRAME::OnUpdateSelectTool )
EVT_UPDATE_UI( ID_ZOOM_SELECTION, FOOTPRINT_EDIT_FRAME::OnUpdateSelectTool )
EVT_UPDATE_UI_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_MEASUREMENT_TOOL,
FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
@ -194,10 +185,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_UPDATE_UI( ID_MODEDIT_EDIT_MODULE_PROPERTIES, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
EVT_UPDATE_UI( ID_MODEDIT_PAD_SETTINGS, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
// Option toolbar:
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
EVT_UPDATE_UI( ID_GEN_IMPORT_GRAPHICS_FILE, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
END_EVENT_TABLE()
@ -583,13 +570,6 @@ void FOOTPRINT_EDIT_FRAME::CloseModuleEditor( wxCommandEvent& Event )
}
void FOOTPRINT_EDIT_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetEventObject() == m_drawToolBar || aEvent.GetEventObject() == m_mainToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() );
}
void FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( GetBoard()->m_Modules != NULL );
@ -599,28 +579,6 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
}
void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent )
{
int id = aEvent.GetId();
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
bool state = false;
switch( id )
{
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
state = displ_opts->m_ContrastModeDisplay;
break;
default:
wxMessageBox( "FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar error" );
break;
}
aEvent.Check( state );
}
void FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( GetBoard()->m_Modules != NULL );

View File

@ -179,13 +179,6 @@ public:
BOARD_ITEM* PrepareItemForHotkey( bool failIfCurrentlyEdited );
bool OnHotkeyEditItem( int aIdCommand );
bool OnHotkeyDeleteItem( int aIdCommand );
bool OnHotkeyMoveItem( int aIdCommand );
bool OnHotkeyMoveItemExact();
bool OnHotkeyRotateItem( int aIdCommand );
bool OnHotkeyDuplicateItem( int aIdCommand );
/**
* Display 3D view of the footprint (module) being edited.
*/
@ -194,17 +187,11 @@ public:
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
void OnVerticalToolbar( wxCommandEvent& aEvent );
/**
* Handle ID_ZOOM_SELECTION and ID_NO_TOOL_SELECTED tools
*/
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
/**
* Handle most of tools og the vertical right toolbar ("Tools" toolbar)
*/
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateModuleSelected( wxUpdateUIEvent& aEvent );
void OnUpdateModuleTargeted( wxUpdateUIEvent& aEvent );
void OnUpdateSave( wxUpdateUIEvent& aEvent );

View File

@ -209,253 +209,6 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
{
BOARD_ITEM* item = GetCurItem();
wxString msg;
bool blockActive = !GetScreen()->m_BlockLocate.IsIdle();
// Simple location of elements where possible.
if( item == NULL || item->GetEditFlags() == 0 )
SetCurItem( item = ModeditLocateAndDisplay() );
// End command in progress.
if( GetToolId() != ID_NO_TOOL_SELECTED )
{
if( item && item->GetEditFlags() )
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
KiBitmap( cancel_xpm ) );
else
AddMenuItem( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ),
KiBitmap( cursor_xpm ) );
PopMenu->AppendSeparator();
}
else
{
if( (item && item->GetEditFlags()) || blockActive )
{
if( blockActive ) // Put block commands in list
{
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel Block" ), KiBitmap( cancel_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK,
_( "Zoom Block" ),
KiBitmap( zoom_area_xpm ) );
PopMenu->AppendSeparator();
AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK,
_( "Place Block" ), KiBitmap( checked_ok_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK,
_( "Duplicate Block (shift + drag mouse)" ),
KiBitmap( copy_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK,
_( "Mirror Block (alt + drag mouse)" ),
KiBitmap( mirror_h_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK,
_( "Rotate Block (ctrl + drag mouse)" ),
KiBitmap( rotate_ccw_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK,
_( "Delete Block (shift+ctrl + drag mouse)" ),
KiBitmap( delete_xpm ) );
msg = AddHotkeyName( _("Move Block Exactly..." ),
g_Module_Editor_Hotkeys_Descr, HK_MOVE_ITEM_EXACT );
AddMenuItem( PopMenu, ID_POPUP_MOVE_BLOCK_EXACT,
msg, KiBitmap( move_xpm ) );
}
else
{
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), KiBitmap( cancel_xpm ) );
}
PopMenu->AppendSeparator();
}
}
if( blockActive )
return true;
if( item )
{
STATUS_FLAGS flags = item->GetEditFlags();
switch( item->Type() )
{
case PCB_MODULE_T:
{
wxMenu* transform_choice = new wxMenu;
AddMenuItem( transform_choice, ID_MODEDIT_MODULE_ROTATE, _( "Rotate Counterclockwise" ),
KiBitmap( rotate_ccw_xpm ) );
AddMenuItem( transform_choice, ID_MODEDIT_MODULE_MIRROR, _( "Mirror" ),
KiBitmap( mirror_h_xpm ) );
AddMenuItem( transform_choice, ID_MODEDIT_MODULE_MOVE_EXACT, _( "Move Exactly..." ),
KiBitmap( move_exactly_xpm ) );
msg = AddHotkeyName( _( "Edit Footprint" ), g_Module_Editor_Hotkeys_Descr, HK_EDIT_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_MODULE_PRMS, msg, KiBitmap( edit_module_xpm ) );
AddMenuItem( PopMenu, transform_choice, ID_MODEDIT_TRANSFORM_MODULE,
_( "Transform Footprint" ), KiBitmap( edit_xpm ) );
break;
}
case PCB_PAD_T:
if( !flags )
{
msg = AddHotkeyName( _("Move Pad" ), g_Module_Editor_Hotkeys_Descr, HK_MOVE_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST, msg, KiBitmap( move_pad_xpm ) );
}
msg = AddHotkeyName( _("Edit Pad..." ), g_Module_Editor_Hotkeys_Descr, HK_EDIT_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_PAD, msg, KiBitmap( options_pad_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_PCB_COPY_PAD_SETTINGS,
_( "Copy Pad Properties" ), KiBitmap( copy_pad_settings_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_PCB_APPLY_PAD_SETTINGS,
_( "Paste Pad Properties" ), KiBitmap( apply_pad_settings_xpm ) );
msg = AddHotkeyName( _("Delete Pad" ), g_Module_Editor_Hotkeys_Descr, HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_PAD, msg, KiBitmap( delete_pad_xpm ) );
msg = AddHotkeyName( _( "Duplicate Pad" ), g_Module_Editor_Hotkeys_Descr, HK_DUPLICATE );
AddMenuItem( PopMenu, ID_POPUP_PCB_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
msg = AddHotkeyName( _("Move Pad Exactly..." ), g_Module_Editor_Hotkeys_Descr, HK_MOVE_ITEM_EXACT );
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_EXACT, msg, KiBitmap( move_pad_xpm ) );
msg = AddHotkeyName( _("Create Pad Array..." ), g_Module_Editor_Hotkeys_Descr, HK_CREATE_ARRAY );
AddMenuItem( PopMenu, ID_POPUP_PCB_CREATE_ARRAY, msg, KiBitmap( array_xpm ) );
if( !flags )
{
PopMenu->AppendSeparator();
AddMenuItem( PopMenu, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
_( "Push Pad Properties..." ), KiBitmap( push_pad_settings_xpm ) );
}
break;
case PCB_MODULE_TEXT_T:
if( !flags )
{
msg = AddHotkeyName( _("Move" ), g_Module_Editor_Hotkeys_Descr,
HK_MOVE_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, msg,
KiBitmap( move_xpm ) );
}
msg = AddHotkeyName( _("Rotate Clockwise" ), g_Module_Editor_Hotkeys_Descr,
HK_ROTATE_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_ROTATE_TEXTMODULE, msg, KiBitmap( rotate_cw_xpm ) );
{
// Do not show option to replicate value or reference fields
// (there can only be one of each)
const MODULE* module = static_cast<MODULE*>( item->GetParent() );
const TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
if( &module->Reference() != text && &module->Value() != text )
{
msg = AddHotkeyName( _( "Duplicate" ),
g_Module_Editor_Hotkeys_Descr, HK_DUPLICATE );
AddMenuItem( PopMenu, ID_POPUP_PCB_DUPLICATE_ITEM,
msg, KiBitmap( duplicate_xpm ) );
msg = AddHotkeyName( _("Create Array..." ),
g_Module_Editor_Hotkeys_Descr, HK_CREATE_ARRAY );
AddMenuItem( PopMenu, ID_POPUP_PCB_CREATE_ARRAY,
msg, KiBitmap( array_xpm ) );
}
}
msg = AddHotkeyName( _("Move Exactly..." ), g_Module_Editor_Hotkeys_Descr, HK_MOVE_ITEM_EXACT );
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_EXACT, msg, KiBitmap( move_exactly_xpm ) );
if( !flags )
{
msg = AddHotkeyName( _("Edit..." ), g_Module_Editor_Hotkeys_Descr,
HK_EDIT_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, KiBitmap( edit_text_xpm ) );
if( ( static_cast<TEXTE_MODULE*>( item ) )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
{
msg = AddHotkeyName( _("Delete" ), g_Module_Editor_Hotkeys_Descr,
HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_TEXTMODULE, msg,
KiBitmap( delete_xpm ) );
}
}
break;
case PCB_MODULE_EDGE_T:
{
if( (flags & IS_NEW) )
AddMenuItem( PopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, _( "End Edge" ),
KiBitmap( checked_ok_xpm ) );
if( !flags )
{
msg = AddHotkeyName( _("Move" ), g_Module_Editor_Hotkeys_Descr, HK_MOVE_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_EDGE, msg, KiBitmap( move_xpm ) );
msg = AddHotkeyName( _( "Duplicate" ), g_Module_Editor_Hotkeys_Descr, HK_DUPLICATE );
AddMenuItem( PopMenu, ID_POPUP_PCB_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
msg = AddHotkeyName( _("Move Exactly..." ), g_Module_Editor_Hotkeys_Descr, HK_MOVE_ITEM_EXACT );
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_EXACT, msg, KiBitmap( move_exactly_xpm ) );
msg = AddHotkeyName( _("Create Array..." ), g_Module_Editor_Hotkeys_Descr, HK_CREATE_ARRAY );
AddMenuItem( PopMenu, ID_POPUP_PCB_CREATE_ARRAY, msg, KiBitmap( array_xpm ) );
}
if( ( flags & (IS_NEW | IS_MOVED) ) == IS_MOVED )
AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_EDGE, _( "Place Edge" ),
KiBitmap( checked_ok_xpm ) );
if( !flags )
{
msg = AddHotkeyName( _("Edit..." ), g_Module_Editor_Hotkeys_Descr, HK_EDIT_ITEM );
AddMenuItem( PopMenu, ID_POPUP_MODEDIT_EDIT_BODY_ITEM,
msg, KiBitmap( options_segment_xpm ) );
msg = AddHotkeyName( _("Delete" ), g_Module_Editor_Hotkeys_Descr, HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, KiBitmap( delete_xpm ) );
wxMenu* edit_global_mnu = new wxMenu;
AddMenuItem( PopMenu, edit_global_mnu, ID_POPUP_MODEDIT_GLOBAL_EDIT_EDGE,
_( "Global Changes" ), KiBitmap( edit_xpm ) );
AddMenuItem( edit_global_mnu, ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE,
_( "Change Body Items Width" ), KiBitmap( width_segment_xpm ) );
AddMenuItem( edit_global_mnu, ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE,
_( "Change Body Items Layer..." ), KiBitmap( select_layer_pair_xpm ) );
}
}
break;
case PCB_LINE_T:
case PCB_TEXT_T:
case PCB_VIA_T:
case PCB_TRACE_T:
case PCB_MARKER_T:
case PCB_DIMENSION_T:
case PCB_TARGET_T:
wxLogDebug( wxT( "FOOTPRINT_EDIT_FRAME::OnRightClick Error: Unexpected DrawType %d" ),
item->Type() );
break;
case SCREEN_T:
case TYPE_NOT_INIT:
case PCB_T:
wxLogDebug( wxT( "FOOTPRINT_EDIT_FRAME::OnRightClick Error: illegal DrawType %d" ),
item->Type() );
break;
default:
wxLogDebug( wxT( "FOOTPRINT_EDIT_FRAME::OnRightClick Error: unknown DrawType %d" ),
item->Type() );
break;
}
PopMenu->AppendSeparator();
}
return true;
}

View File

@ -40,46 +40,6 @@
#include <pcbnew_id.h>
void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{
int id = event.GetId();
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
bool state = m_optionsToolBar->GetToolToggled( id );
switch( id )
{
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
displ_opts->m_DisplayPadFill = !state;
m_canvas->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
displ_opts->m_DisplayViaFill = !state;
m_canvas->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
displ_opts->m_DisplayModTextFill = state ? SKETCH : FILLED;
m_canvas->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
displ_opts->m_DisplayModEdgeFill = state ? SKETCH : FILLED;
m_canvas->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
displ_opts->m_ContrastModeDisplay = state;
m_canvas->Refresh( );
break;
default:
wxLogDebug( wxT( "FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar error" ) );
break;
}
}
PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings()
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();

View File

@ -254,12 +254,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case wxID_COPY:
case ID_TOOLBARH_PCB_SELECT_LAYER:
case ID_MODEDIT_PAD_SETTINGS:
case ID_POPUP_PCB_ROTATE_TEXTEPCB:
case ID_POPUP_PCB_EDIT_TEXTEPCB:
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
case ID_POPUP_PCB_EDIT_TEXTMODULE:
case ID_POPUP_PCB_APPLY_PAD_SETTINGS:
case ID_POPUP_PCB_COPY_PAD_SETTINGS:
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
@ -268,8 +262,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE:
case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE:
case ID_POPUP_PCB_DELETE_EDGE:
case ID_POPUP_PCB_DELETE_TEXTMODULE:
case ID_POPUP_PCB_DELETE_PAD:
case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_ZOOM_BLOCK:
@ -623,18 +615,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_CANCEL_CURRENT_COMMAND:
break;
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
m_canvas->MoveCursorToCrossHair();
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true );
m_canvas->Refresh();
break;
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
m_canvas->MoveCursorToCrossHair();
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), -900, true );
m_canvas->Refresh();
break;
case ID_POPUP_PCB_EDIT_MODULE_PRMS:
editFootprintProperties( (MODULE*) GetScreen()->GetCurItem() );
m_canvas->MoveCursorToCrossHair();
@ -651,13 +631,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_DELETE_PAD:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
DeletePad( (D_PAD*) GetScreen()->GetCurItem(), false );
SetCurItem( NULL );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_DUPLICATE_ITEM:
duplicateItems( false );
break;
@ -692,32 +665,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
Export_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem() );
break;
case ID_POPUP_PCB_EDIT_TEXTMODULE:
InstallTextOptionsFrame( GetScreen()->GetCurItem(), &dc );
break;
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
m_canvas->MoveCursorToCrossHair();
StartMoveTexteModule( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
break;
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
RotateTextModule( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_DELETE_TEXTMODULE:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
DeleteTextModule( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ) );
SetCurItem( NULL );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_MOVE_EDGE:
Start_Move_EdgeMod( static_cast<EDGE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
m_canvas->MoveCursorToCrossHair();
break;
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
m_canvas->MoveCursorToCrossHair();

View File

@ -93,7 +93,8 @@ static EDA_HOTKEY HkSwitch2NextCopperLayer( _HKI( "Switch to Next Layer" ),
static EDA_HOTKEY HkSwitch2PreviousCopperLayer( _HKI( "Switch to Previous Layer" ),
HK_SWITCH_LAYER_TO_PREVIOUS, '-' );
static EDA_HOTKEY HkFindItem( _HKI( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL );
static EDA_HOTKEY HkFind( _HKI( "Find" ), HK_FIND, 'F' + GR_KB_CTRL );
static EDA_HOTKEY HkReplace( _HKI( "Find and Replace" ), HK_REPLACE, 'F' + GR_KB_CTRL + GR_KB_ALT );
static EDA_HOTKEY HkBackspace( _HKI( "Delete Track Segment" ), HK_BACK_SPACE, WXK_BACK );
static EDA_HOTKEY HkAddNewTrack( _HKI( "Add New Track" ), HK_ADD_NEW_TRACK, 'X' );
@ -148,7 +149,6 @@ static EDA_HOTKEY HkDuplicateItemAndIncrement( _HKI( "Duplicate Item and Increme
HK_DUPLICATE_ITEM_AND_INCREMENT,
'D' + GR_KB_SHIFTCTRL );
static EDA_HOTKEY HkCreateArray( _HKI( "Create Array" ), HK_CREATE_ARRAY, 'T' + GR_KB_CTRL );
static EDA_HOTKEY HkCopyItem( _HKI( "Copy Item" ), HK_COPY_ITEM, 'C' );
static EDA_HOTKEY HkDragFootprint( _HKI( "Drag Item" ), HK_DRAG_ITEM, 'G' );
static EDA_HOTKEY HkGetAndMoveFootprint( _HKI( "Get and Move Footprint" ),
HK_GET_AND_MOVE_FOOTPRINT, 'T' );
@ -317,17 +317,18 @@ static EDA_HOTKEY HkSaveAs( _HKI( "Save As" ), HK_SAVEAS, GR_KB_SHIFT + GR_KB_CT
(int) wxID_SAVEAS );
static EDA_HOTKEY HkPrint( _HKI( "Print" ), HK_PRINT, GR_KB_CTRL + 'P', (int) wxID_PRINT );
static EDA_HOTKEY HkUndo( _HKI( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
static EDA_HOTKEY HkUndo( _HKI( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z' );
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y' );
#else
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL + 'Z', (int) wxID_REDO );
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL + 'Z' );
#endif
static EDA_HOTKEY HkEditCut( _HKI( "Cut" ), HK_EDIT_CUT, GR_KB_CTRL + 'X', (int) wxID_CUT );
static EDA_HOTKEY HkEditCopy( _HKI( "Copy" ), HK_EDIT_COPY, GR_KB_CTRL + 'C', (int) wxID_COPY );
static EDA_HOTKEY HkEditPaste( _HKI( "Paste" ), HK_EDIT_PASTE, GR_KB_CTRL + 'V', (int) wxID_PASTE );
static EDA_HOTKEY HkCut( _HKI( "Cut" ), HK_CUT, GR_KB_CTRL + 'X' );
static EDA_HOTKEY HkCopy( _HKI( "Copy" ), HK_COPY, GR_KB_CTRL + 'C' );
static EDA_HOTKEY HkPaste( _HKI( "Paste" ), HK_PASTE, GR_KB_CTRL + 'V' );
static EDA_HOTKEY HkPreferences( _HKI( "Preferences" ),
HK_PREFERENCES, GR_KB_CTRL + ',', (int) wxID_PREFERENCES );
@ -344,7 +345,8 @@ EDA_HOTKEY* common_Hotkey_List[] =
{
&HkNew, &HkOpen, &HkSave, &HkSaveAs, &HkPrint,
&HkUndo, &HkRedo,
&HkEditCut, &HkEditCopy, &HkEditPaste,
&HkCut, &HkCopy, &HkPaste,
&HkFind, &HkReplace,
&HkHelp, &HkPreferences,
&HkZoomIn, &HkZoomOut,
&HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &HkZoomSelection,
@ -364,6 +366,8 @@ EDA_HOTKEY* common_basic_Hotkey_List[] =
&HkHelp, &HkZoomIn, &HkZoomOut,
&HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &Hk3DViewer,
&HkSwitchUnits, &HkResetLocalCoord,
&HkCut, &HkCopy, &HkPaste,
&HkFind, &HkReplace,
&HkMouseLeftClick,
&HkMouseLeftDClick,
NULL
@ -437,7 +441,6 @@ EDA_HOTKEY* board_edit_Hotkey_List[] =
// Edit placement
&HkDragFootprint,
&HkCopyItem,
&HkMoveItem,
&HkGetAndMoveFootprint,
&HkMoveItemExact,
@ -454,7 +457,6 @@ EDA_HOTKEY* board_edit_Hotkey_List[] =
&HkCreateArray,
&HkLock_Unlock_Footprint,
&HkFindItem,
&HkEditBoardItem,
&HkEditWithModedit,
@ -625,37 +627,6 @@ bool FOOTPRINT_VIEWER_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aP
OnLeftClick( aDC, aPosition );
OnLeftDClick( aDC, aPosition );
break;
case HK_SWITCH_UNITS:
cmd.SetId( (GetUserUnits() == INCHES) ?
ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_IN:
cmd.SetId( ID_KEY_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
cmd.SetId( ID_KEY_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_AUTO:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
break;
}
return true;
@ -712,38 +683,6 @@ bool FOOTPRINT_WIZARD_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aP
OnLeftClick( aDC, aPosition );
OnLeftDClick( aDC, aPosition );
break;
case HK_SWITCH_UNITS:
cmd.SetId( (GetUserUnits() == INCHES) ?
ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_IN:
cmd.SetId( ID_KEY_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
cmd.SetId( ID_KEY_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_AUTO:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
break;
}
return true;
}

View File

@ -40,7 +40,6 @@ enum hotkey_id_command {
HK_ROTATE_ITEM,
HK_ROTATE_ITEM_CLOCKWISE,
HK_FLIP_ITEM,
HK_COPY_ITEM,
HK_MOVE_ITEM,
HK_MOVE_ITEM_EXACT,
HK_POSITION_RELATIVE,
@ -66,7 +65,6 @@ enum hotkey_id_command {
HK_DRAG_TRACK_KEEP_SLOPE,
HK_SWITCH_TRACK_DISPLAY_MODE,
HK_3D_VIEWER,
HK_FIND_ITEM,
HK_EDIT_ITEM,
HK_EDIT_MODULE_WITH_MODEDIT,
HK_DUPLICATE,

View File

@ -225,44 +225,10 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
evt_type = wxID_PREFERENCES;
break;
case HK_ZOOM_IN:
evt_type = ID_KEY_ZOOM_IN;
break;
case HK_ZOOM_OUT:
evt_type = ID_KEY_ZOOM_OUT;
break;
case HK_ZOOM_REDRAW:
evt_type = ID_ZOOM_REDRAW;
break;
case HK_ZOOM_AUTO:
evt_type = ID_ZOOM_PAGE;
break;
case HK_ZOOM_CENTER:
evt_type = ID_POPUP_ZOOM_CENTER;
break;
case HK_ZOOM_SELECTION:
evt_type = ID_ZOOM_SELECTION;
break;
case HK_ADD_MODULE:
evt_type = ID_PCB_MODULE_BUTT;
break;
case HK_UNDO:
case HK_REDO:
if( !itemCurrentlyEdited )
{
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
wxPostEvent( this, event );
}
break;
case HK_RESET_LOCAL_COORD: // Set the relative coord
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
@ -281,20 +247,11 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
m_canvas->Refresh();
break;
case HK_SWITCH_UNITS:
evt_type = (GetUserUnits() == INCHES) ?
ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH;
break;
case HK_SWITCH_TRACK_DISPLAY_MODE:
displ_opts->m_DisplayPcbTrackFill = !displ_opts->m_DisplayPcbTrackFill;
m_canvas->Refresh();
break;
case HK_DELETE:
OnHotkeyDeleteItem( aDC );
break;
case HK_BACK_SPACE:
if( IsCopperLayer( GetActiveLayer() ) )
{
@ -333,12 +290,6 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break;
case HK_FIND_ITEM:
if( !itemCurrentlyEdited )
evt_type = ID_FIND_ITEMS;
break;
case HK_OPEN:
if( !itemCurrentlyEdited )
evt_type = ID_LOAD_FILE ;
@ -417,26 +368,10 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
evt_type = ID_POPUP_PCB_SWITCH_TRACK_POSTURE ;
break;
case HK_DRAG_TRACK_KEEP_SLOPE:
OnHotkeyMoveItem( HK_DRAG_TRACK_KEEP_SLOPE );
break;
case HK_PLACE_ITEM:
OnHotkeyPlaceItem( aDC );
break;
case HK_ADD_NEW_TRACK: // Start new track, if possible
OnHotkeyBeginRoute( aDC );
break;
case HK_EDIT_ITEM: // Edit board item
OnHotkeyEditItem( HK_EDIT_ITEM );
break;
case HK_EDIT_MODULE_WITH_MODEDIT: // Edit module with module editor
OnHotkeyEditItem( HK_EDIT_MODULE_WITH_MODEDIT );
break;
case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status:
// get any module, locked or not locked and toggle its locked status
if( !itemCurrentlyEdited )
@ -458,26 +393,6 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
}
break;
case HK_DRAG_ITEM: // Start drag module or track segment
OnHotkeyMoveItem( HK_DRAG_ITEM );
break;
case HK_MOVE_ITEM: // Start move item
OnHotkeyMoveItem( HK_MOVE_ITEM );
break;
case HK_COPY_ITEM:
evt_type = OnHotkeyCopyItem();
break;
case HK_ROTATE_ITEM: // Rotation
OnHotkeyRotateItem( HK_ROTATE_ITEM );
break;
case HK_FLIP_ITEM:
OnHotkeyFlipItem( HK_FLIP_ITEM );
break;
case HK_MOVE_ITEM_EXACT:
case HK_DUPLICATE:
case HK_DUPLICATE_ITEM_AND_INCREMENT:
@ -523,380 +438,6 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
}
bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
{
BOARD_ITEM* item = GetCurItem();
bool ItemFree = ( !item || item->GetEditFlags() == 0 );
switch( GetToolId() )
{
case ID_TRACK_BUTT:
if( !IsCopperLayer ( GetActiveLayer() ) )
return false;
if( ItemFree )
{
item = PcbGeneralLocateAndDisplay();
if( item && !item->IsTrack() )
return false;
Delete_Track( aDC, (TRACK*) item );
}
else if( item->IsTrack( ) )
{
// simple lines for debugger:
TRACK* track = (TRACK*) item;
track = Delete_Segment( aDC, track );
SetCurItem( track );
OnModify();
return true;
}
break;
case ID_PCB_MODULE_BUTT:
if( ItemFree )
{
wxPoint pos = RefPos( false );
MODULE* module = GetBoard()->GetFootprint( pos, UNDEFINED_LAYER, false );
if( module == NULL || module->IsLocked() )
return false;
RemoveStruct( module, aDC );
}
else
return false;
break;
default:
if( ItemFree )
{
item = PcbGeneralLocateAndDisplay();
// Shouldn't there be a check for locked tracks and vias here?
if( item == NULL || (item->Type() == PCB_MODULE_T && (MODULE*)item->IsLocked()) )
return false;
RemoveStruct( item, aDC );
}
else
return false;
}
OnModify();
SetCurItem( NULL );
return true;
}
bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetEditFlags();
if( itemCurrentlyEdited )
return false;
item = PcbGeneralLocateAndDisplay();
if( item == NULL )
return false;
SetCurItem( item );
int evt_type = 0; //Used to post a wxCommandEvent on demand
switch( item->Type() )
{
case PCB_TRACE_T:
case PCB_VIA_T:
if( aIdCommand == HK_EDIT_ITEM )
{
// Be sure the corresponding netclass is selected before edit:
SetCurrentNetClass( ( (BOARD_CONNECTED_ITEM*)item )->GetNetClassName() );
evt_type = ID_POPUP_PCB_EDIT_TRACKSEG;
}
break;
case PCB_TEXT_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_TEXTEPCB;
break;
case PCB_MODULE_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_MODULE_PRMS;
else if( aIdCommand == HK_EDIT_MODULE_WITH_MODEDIT )
evt_type = ID_POPUP_PCB_EDIT_MODULE_WITH_MODEDIT;
break;
case PCB_PAD_T:
// Until dec 2012 a EDIT_MODULE event is posted here to prevent pads
// from being edited by hotkeys.
// Process_Special_Functions takes care of finding the parent.
// After dec 2012 a EDIT_PAD event is posted, because there is no
// reason to not allow pad edit by hotkey
// (pad coordinates are no more modified by rounding, in nanometer version
// when using inches or mm in dialog)
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_PAD;
break;
case PCB_TARGET_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_PCB_TARGET;
break;
case PCB_DIMENSION_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_DIMENSION;
break;
case PCB_MODULE_TEXT_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_TEXTMODULE;
break;
case PCB_LINE_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_DRAWING;
break;
case PCB_ZONE_AREA_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_ZONE_PARAMS;
break;
default:
break;
}
if( evt_type != 0 )
{
wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
evt.SetEventObject( this );
evt.SetId( evt_type );
GetEventHandler()->ProcessEvent( evt );
return true;
}
return false;
}
int PCB_EDIT_FRAME::OnHotkeyCopyItem()
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetEditFlags();
if( itemCurrentlyEdited )
return 0;
item = PcbGeneralLocateAndDisplay();
if( item == NULL )
return 0;
SetCurItem( item );
int eventId = 0;
switch( item->Type() )
{
case PCB_TEXT_T:
eventId = ID_POPUP_PCB_COPY_TEXTEPCB;
break;
default:
eventId = 0;
break;
}
return eventId;
}
bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetEditFlags();
if( itemCurrentlyEdited )
return false;
item = PcbGeneralLocateAndDisplay();
if( item == NULL )
return false;
SetCurItem( item );
int evt_type = 0; // Used to post a wxCommandEvent on demand
switch( item->Type() )
{
case PCB_TRACE_T:
case PCB_VIA_T:
if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_TRACK_NODE;
if( aIdCommand == HK_DRAG_ITEM )
evt_type = ID_POPUP_PCB_DRAG_TRACK_SEGMENT;
if( aIdCommand == HK_DRAG_TRACK_KEEP_SLOPE )
evt_type = ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE;
break;
case PCB_MODULE_T:
{
if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_MODULE_REQUEST;
if( aIdCommand == HK_DRAG_ITEM )
evt_type = ID_POPUP_PCB_DRAG_MODULE_REQUEST;
}
break;
case PCB_PAD_T:
// Post MODULE_REQUEST events here to prevent pads
// from being moved or dragged by hotkeys.
// Process_Special_Functions takes care of finding
// the parent.
if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_MODULE_REQUEST;
if( aIdCommand == HK_DRAG_ITEM )
evt_type = ID_POPUP_PCB_DRAG_MODULE_REQUEST;
break;
case PCB_TEXT_T:
if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST;
break;
case PCB_TARGET_T:
if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_PCB_TARGET_REQUEST;
break;
case PCB_ZONE_AREA_T:
if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_ZONE_OUTLINES;
if( aIdCommand == HK_DRAG_ITEM )
evt_type = ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT;
break;
case PCB_MODULE_TEXT_T:
if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST;
break;
case PCB_LINE_T:
if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_DRAWING_REQUEST;
break;
case PCB_DIMENSION_T:
if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST;
break;
default:
break;
}
if( evt_type != 0 )
{
wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
evt.SetEventObject( this );
evt.SetId( evt_type );
GetEventHandler()->ProcessEvent( evt );
return true;
}
return false;
}
bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC )
{
BOARD_ITEM* item = GetCurItem();
bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED;
bool itemCurrentlyEdited = item && item->GetEditFlags();
m_canvas->SetAutoPanRequest( false );
if( itemCurrentlyEdited )
{
m_canvas->SetIgnoreMouseEvents( true );
m_canvas->CrossHairOff( aDC );
switch( item->Type() )
{
case PCB_TRACE_T:
case PCB_VIA_T:
if( item->IsDragging() )
PlaceDraggedOrMovedTrackSegment( static_cast<TRACK*>( item ), aDC );
break;
case PCB_TEXT_T:
Place_Texte_Pcb( static_cast<TEXTE_PCB*>( item ), aDC );
break;
case PCB_MODULE_TEXT_T:
PlaceTexteModule( static_cast<TEXTE_MODULE*>( item ), aDC );
break;
case PCB_PAD_T:
PlacePad( static_cast<D_PAD*>( item ), aDC );
break;
case PCB_MODULE_T:
PlaceModule( static_cast<MODULE*>( item ), aDC );
break;
case PCB_TARGET_T:
PlaceTarget( static_cast<PCB_TARGET*>( item ), aDC );
break;
case PCB_LINE_T:
if( no_tool ) // when no tools: existing item moving.
Place_DrawItem( static_cast<DRAWSEGMENT*>( item ), aDC );
break;
default:
break;
}
m_canvas->SetIgnoreMouseEvents( false );
m_canvas->CrossHairOn( aDC );
return true;
}
return false;
}
TRACK * PCB_EDIT_FRAME::OnHotkeyBeginRoute( wxDC* aDC )
{
if( !IsCopperLayer( GetActiveLayer() ) )
@ -942,113 +483,6 @@ TRACK * PCB_EDIT_FRAME::OnHotkeyBeginRoute( wxDC* aDC )
}
bool PCB_EDIT_FRAME::OnHotkeyFlipItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetEditFlags();
int evt_type = 0; // Used to post a wxCommandEvent on demand
wxASSERT( aIdCommand == HK_FLIP_ITEM );
if( GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{
evt_type = ID_POPUP_FLIP_BLOCK;
}
else
{
if( !itemCurrentlyEdited )
item = PcbGeneralLocateAndDisplay();
if( item == NULL )
return false;
SetCurItem( item );
switch( item->Type() )
{
case PCB_MODULE_T:
evt_type = ID_POPUP_PCB_CHANGE_SIDE_MODULE;
break;
case PCB_TEXT_T:
evt_type = ID_POPUP_PCB_FLIP_TEXTEPCB;
break;
default:
break;
}
}
if( evt_type != 0 )
{
wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
evt.SetEventObject( this );
evt.SetId( evt_type );
GetEventHandler()->ProcessEvent( evt );
return true;
}
else
{
return false;
}
}
bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetEditFlags();
int evt_type = 0; // Used to post a wxCommandEvent on demand
wxASSERT( aIdCommand == HK_ROTATE_ITEM );
// Allows block rotate operation on hot key.
if( GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{
evt_type = ID_POPUP_ROTATE_BLOCK;
}
else
{
if( !itemCurrentlyEdited )
item = PcbGeneralLocateAndDisplay();
if( item == NULL )
return false;
SetCurItem( item );
switch( item->Type() )
{
case PCB_MODULE_T:
evt_type = ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE;
break;
case PCB_TEXT_T:
evt_type = ID_POPUP_PCB_ROTATE_TEXTEPCB;
break;
case PCB_MODULE_TEXT_T:
evt_type = ID_POPUP_PCB_ROTATE_TEXTMODULE;
break;
default:
break;
}
}
if( evt_type != 0 )
{
wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
evt.SetEventObject( this );
evt.SetId( evt_type );
GetEventHandler()->ProcessEvent( evt );
return true;
}
return false;
}
bool PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();

View File

@ -59,9 +59,6 @@ bool FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
if( aHotKey == 0 )
return false;
bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
BOARD_ITEM* item = GetCurItem();
bool ItemFree = ( !item || item->GetEditFlags() == 0 );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
@ -120,84 +117,6 @@ bool FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
m_canvas->Refresh();
break;
case HK_SWITCH_UNITS:
cmd.SetId( (GetUserUnits() == INCHES) ? ID_TB_OPTIONS_SELECT_UNIT_MM
: ID_TB_OPTIONS_SELECT_UNIT_INCH );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_IN:
cmd.SetId( ID_KEY_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
cmd.SetId( ID_KEY_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_SELECTION:
cmd.SetId( ID_ZOOM_SELECTION );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_UNDO:
case HK_REDO:
if( ItemFree && !blockActive )
{
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
wxPostEvent( this, event );
}
break;
case HK_ZOOM_AUTO:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_EDIT_ITEM:
OnHotkeyEditItem( HK_EDIT_ITEM );
break;
case HK_DELETE:
OnHotkeyDeleteItem( HK_DELETE );
break;
case HK_MOVE_ITEM:
OnHotkeyMoveItem( HK_MOVE_ITEM );
break;
case HK_MOVE_ITEM_EXACT:
if( blockActive )
{
cmd.SetId( ID_POPUP_MOVE_BLOCK_EXACT );
GetEventHandler()->ProcessEvent( cmd );
}
else
{
OnHotkeyMoveItemExact();
}
break;
case HK_ROTATE_ITEM:
OnHotkeyRotateItem( HK_ROTATE_ITEM );
break;
case HK_DUPLICATE:
case HK_DUPLICATE_ITEM_AND_INCREMENT:
OnHotkeyDuplicateItem( HK_Descr->m_Idcommand );
break;
case HK_CREATE_ARRAY:
PostCommandMenuEvent( ID_POPUP_PCB_CREATE_ARRAY );
}
@ -236,196 +155,3 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey( bool aFailIfCurrentlyEdi
}
bool FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
{
BOARD_ITEM* item = PrepareItemForHotkey( true );
if( item == NULL )
return false;
int evt_type = 0; // Used to post a wxCommandEvent on demand
switch( item->Type() )
{
case PCB_MODULE_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_MODULE_PRMS;
break;
case PCB_PAD_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_PAD;
break;
case PCB_MODULE_TEXT_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_TEXTMODULE;
break;
case PCB_MODULE_EDGE_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_MODEDIT_EDIT_BODY_ITEM;
break;
default:
break;
}
return PostCommandMenuEvent( evt_type );
}
bool FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem( int aIdCommand )
{
BOARD_ITEM* item = PrepareItemForHotkey( true );
if( item == NULL )
return false;
int evt_type = 0; // Used to post a wxCommandEvent on demand
switch( item->Type() )
{
case PCB_PAD_T:
if( aIdCommand == HK_DELETE )
evt_type = ID_POPUP_PCB_DELETE_PAD;
break;
case PCB_MODULE_TEXT_T:
if( aIdCommand == HK_DELETE )
evt_type = ID_POPUP_PCB_DELETE_TEXTMODULE;
break;
case PCB_MODULE_EDGE_T:
if( aIdCommand == HK_DELETE )
evt_type = ID_POPUP_PCB_DELETE_EDGE;
break;
default:
break;
}
return PostCommandMenuEvent( evt_type );
}
bool FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
{
BOARD_ITEM* item = PrepareItemForHotkey( true );
if( item == NULL )
return false;
int evt_type = 0; // Used to post a wxCommandEvent on demand
switch( item->Type() )
{
case PCB_PAD_T:
if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_PAD_REQUEST;
break;
case PCB_MODULE_TEXT_T:
if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST;
break;
case PCB_MODULE_EDGE_T:
if( aIdCommand == HK_MOVE_ITEM )
evt_type = ID_POPUP_PCB_MOVE_EDGE;
break;
default:
break;
}
return PostCommandMenuEvent( evt_type );
}
bool FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItemExact()
{
BOARD_ITEM* item = PrepareItemForHotkey( false );
if( item == NULL )
return false;
int evt_type = 0; // Used to post a wxCommandEvent on demand
switch( item->Type() )
{
case PCB_PAD_T:
case PCB_MODULE_EDGE_T:
case PCB_MODULE_TEXT_T:
evt_type = ID_POPUP_PCB_MOVE_EXACT;
break;
default:
break;
}
return PostCommandMenuEvent( evt_type );
}
bool FOOTPRINT_EDIT_FRAME::OnHotkeyDuplicateItem( int aIdCommand )
{
BOARD_ITEM* item = PrepareItemForHotkey( true );
if( item == NULL )
return false;
int evt_type = 0; // Used to post a wxCommandEvent on demand
switch( item->Type() )
{
case PCB_PAD_T:
case PCB_MODULE_EDGE_T:
case PCB_MODULE_TEXT_T:
if( aIdCommand == HK_DUPLICATE )
evt_type = ID_POPUP_PCB_DUPLICATE_ITEM;
else
evt_type = ID_POPUP_PCB_DUPLICATE_ITEM_AND_INCREMENT;
break;
default:
break;
}
return PostCommandMenuEvent( evt_type );
}
bool FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
{
BOARD_ITEM* item = PrepareItemForHotkey( false );
if( item == NULL )
return false;
int evt_type = 0; // Used to post a wxCommandEvent on demand
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
if( aIdCommand == HK_ROTATE_ITEM ) // Rotation
evt_type = ID_POPUP_PCB_ROTATE_TEXTMODULE;
break;
default:
break;
}
return PostCommandMenuEvent( evt_type );
}

View File

@ -33,6 +33,7 @@
#include <tool/conditional_menu.h>
#include <tool/actions.h>
#include <tools/selection_tool.h>
#include <tools/pcb_actions.h>
#include "help_common_strings.h"
#include "hotkeys.h"
#include "pcbnew.h"
@ -145,38 +146,26 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( exit_xpm ) );
//----- Edit menu ------------------
wxMenu* editMenu = new wxMenu;
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
// Undo
text = AddHotkeyName( _( "&Undo" ), m_hotkeysDescrList, HK_UNDO );
AddMenuItem( editMenu, wxID_UNDO,
text, _( "Undo last action" ),
KiBitmap( undo_xpm ) );
auto enableUndoCondition = [ this ] ( const SELECTION& sel ) {
return GetScreen() && GetScreen()->GetUndoCommandCount() > 0;
};
auto enableRedoCondition = [ this ] ( const SELECTION& sel ) {
return GetScreen() && GetScreen()->GetRedoCommandCount() > 0;
};
auto noActiveToolCondition = [ this ] ( const SELECTION& aSelection ) {
return GetToolId() == ID_NO_TOOL_SELECTED;
};
// Redo
text = AddHotkeyName( _( "&Redo" ), m_hotkeysDescrList, HK_REDO );
AddMenuItem( editMenu, wxID_REDO,
text, _( "Redo last action" ),
KiBitmap( redo_xpm ) );
text = AddHotkeyName( _( "&Undo" ), g_Board_Editor_Hotkeys_Descr, HK_UNDO );
editMenu->AddItem( ACTIONS::undo, enableUndoCondition );
editMenu->AddItem( ACTIONS::redo, enableRedoCondition );
// Separator
editMenu->AppendSeparator();
if( IsGalCanvasActive() )
{
// JEY TODO: move to ACTIONS...
text = AddHotkeyName( _( "Cu&t" ), m_hotkeysDescrList, HK_EDIT_CUT );
AddMenuItem( editMenu, ID_EDIT_CUT, text,
_( "Cuts the selected item(s) to the Clipboard" ), KiBitmap( cut_xpm ) );
text = AddHotkeyName( _( "&Copy" ), m_hotkeysDescrList, HK_EDIT_COPY );
AddMenuItem( editMenu, ID_EDIT_COPY, text,
_( "Copies the selected item(s) to the Clipboard" ), KiBitmap( copy_xpm ) );
text = AddHotkeyName( _( "&Paste" ), m_hotkeysDescrList, HK_EDIT_PASTE );
AddMenuItem( editMenu, ID_EDIT_PASTE, text,
_( "Pastes item(s) from the Clipboard" ), KiBitmap( paste_xpm ) );
editMenu->AppendSeparator();
}
editMenu->AddSeparator();
editMenu->AddItem( ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty );
editMenu->AddItem( ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty );
editMenu->AddItem( ACTIONS::paste, noActiveToolCondition );
// Properties
AddMenuItem( editMenu, ID_MODEDIT_EDIT_MODULE_PROPERTIES,
@ -220,6 +209,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
auto sketchEdgesCondition = [ this ] ( const SELECTION& aSel ) {
return !( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayModEdgeFill;
};
auto contrastModeCondition = [ this ] ( const SELECTION& aSel ) {
return !( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_ContrastModeDisplay;
};
auto searchTreeShownCondition = [ this ] ( const SELECTION& aSel ) {
return IsSearchTreeShown();
};
@ -268,39 +260,21 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) );
drawingModeSubMenu->SetIcon( add_zone_xpm );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
_( "Sketch &Pads" ), _( "Show pads in outline mode" ),
pad_sketch_xpm, sketchPadsCondition );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
_( "Sketch Footprint &Edges" ), _( "Show footprint edges in outline mode" ),
show_mod_edge_xpm, sketchEdgesCondition );
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::padDisplayMode, sketchPadsCondition );
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::moduleEdgeOutlines, sketchEdgesCondition );
viewMenu->AddMenu( drawingModeSubMenu );
// Contrast Mode Submenu
ACTION_MENU* contrastModeSubMenu = new ACTION_MENU;
CONDITIONAL_MENU* contrastModeSubMenu = new CONDITIONAL_MENU( false, selTool );
contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) );
contrastModeSubMenu->SetIcon( contrast_mode_xpm );
contrastModeSubMenu->SetTool( selTool );
text = AddHotkeyName( _( "&High Contrast Mode" ), m_hotkeysDescrList,
HK_SWITCH_HIGHCONTRAST_MODE );
AddMenuItem( contrastModeSubMenu, ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
text, _( "Use high contrast display mode" ),
KiBitmap( contrast_mode_xpm ), wxITEM_CHECK );
contrastModeSubMenu->AddCheckItem( PCB_ACTIONS::highContrastMode, contrastModeCondition );
contrastModeSubMenu->AppendSeparator();
text = AddHotkeyName( _( "&Decrease Layer Opacity" ), g_Pcbnew_Editor_Hotkeys_Descr,
HK_DEC_LAYER_ALPHA );
AddMenuItem( contrastModeSubMenu, ID_DEC_LAYER_ALPHA,
text, _( "Make the current layer more transparent" ),
KiBitmap( contrast_mode_xpm ) );
text = AddHotkeyName( _( "&Increase Layer Opacity" ), g_Pcbnew_Editor_Hotkeys_Descr,
HK_INC_LAYER_ALPHA );
AddMenuItem( contrastModeSubMenu, ID_INC_LAYER_ALPHA,
text, _( "Make the current layer less transparent" ),
KiBitmap( contrast_mode_xpm ) );
contrastModeSubMenu->AddSeparator();
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaDec, SELECTION_CONDITIONS::ShowAlways );
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaInc, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddMenu( contrastModeSubMenu );
@ -313,58 +287,20 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
//-------- Place menu --------------------
wxMenu* placeMenu = new wxMenu;
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
// Pad
AddMenuItem( placeMenu, ID_MODEDIT_PAD_TOOL,
_( "&Pad" ), _( "Add pad" ),
KiBitmap( pad_xpm ) );
placeMenu->AddItem( PCB_ACTIONS::placePad, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AppendSeparator();
// Text
text = AddHotkeyName( _( "&Text" ), m_hotkeysDescrList, HK_ADD_TEXT );
AddMenuItem( placeMenu, ID_MODEDIT_TEXT_TOOL,
text, _( "Add graphic text" ),
KiBitmap( text_xpm ) );
// Arc
text = AddHotkeyName( _( "&Arc" ), m_hotkeysDescrList, HK_ADD_ARC );
AddMenuItem( placeMenu, ID_MODEDIT_ARC_TOOL,
text, _( "Add graphic arc" ),
KiBitmap( add_arc_xpm ) );
// Circle
text = AddHotkeyName( _( "&Circle" ), m_hotkeysDescrList, HK_ADD_CIRCLE );
AddMenuItem( placeMenu, ID_MODEDIT_CIRCLE_TOOL,
text, _( "Add graphic circle" ),
KiBitmap( add_circle_xpm ) );
// Line
text = AddHotkeyName( _( "&Line" ), m_hotkeysDescrList, HK_ADD_LINE );
AddMenuItem( placeMenu, ID_MODEDIT_LINE_TOOL,
text, _( "Add graphic line" ),
KiBitmap( add_graphical_segments_xpm ) );
// Polygon
text = AddHotkeyName( _( "&Polygon" ), m_hotkeysDescrList, HK_ADD_POLYGON );
AddMenuItem( placeMenu, ID_MODEDIT_POLYGON_TOOL,
text, _( "Add graphic polygon" ),
KiBitmap( add_graphical_polygon_xpm ) );
placeMenu->AddItem( PCB_ACTIONS::placeText, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( PCB_ACTIONS::drawArc, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( PCB_ACTIONS::drawCircle, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( PCB_ACTIONS::drawLine, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( PCB_ACTIONS::drawPolygon, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AppendSeparator();
// Anchor
text = AddHotkeyName( _( "A&nchor" ), m_hotkeysDescrList, HK_ADD_ANCHOR );
AddMenuItem( placeMenu, ID_MODEDIT_ANCHOR_TOOL,
text, _( "Place footprint reference anchor" ),
KiBitmap( anchor_xpm ) );
// Origin
AddMenuItem( placeMenu, ID_MODEDIT_PLACE_GRID_COORD,
_( "&Grid Origin" ),
_( "Set grid origin point" ),
KiBitmap( grid_select_axis_xpm ) );
placeMenu->AddItem( PCB_ACTIONS::setAnchor, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( ACTIONS::gridSetOrigin, SELECTION_CONDITIONS::ShowAlways );
//----- Inspect menu ---------------------

View File

@ -35,6 +35,7 @@
#include <tool/actions.h>
#include <tool/selection_conditions.h>
#include <tools/selection_tool.h>
#include <tools/pcb_actions.h>
#include "help_common_strings.h"
#include "hotkeys.h"
#include "pcbnew.h"
@ -49,9 +50,6 @@ static void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject );
// Build the export submenu (inside files menu)
static void prepareExportMenu( wxMenu* aParentMenu );
// Build the edit menu
static void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal );
// Build the place submenu
static void preparePlaceMenu( wxMenu* aParentMenu );
@ -90,8 +88,58 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
prepareFilesMenu( filesMenu, Kiface().IsSingle() );
//----- Edit menu -----------------------------------------------------------
wxMenu* editMenu = new wxMenu;
prepareEditMenu( editMenu, IsGalCanvasActive() );
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
auto enableUndoCondition = [ this ] ( const SELECTION& sel ) {
return GetScreen() && GetScreen()->GetUndoCommandCount() > 0;
};
auto enableRedoCondition = [ this ] ( const SELECTION& sel ) {
return GetScreen() && GetScreen()->GetRedoCommandCount() > 0;
};
auto noActiveToolCondition = [ this ] ( const SELECTION& aSelection ) {
return GetToolId() == ID_NO_TOOL_SELECTED;
};
editMenu->AddItem( ACTIONS::undo, enableUndoCondition );
editMenu->AddItem( ACTIONS::redo, enableRedoCondition );
editMenu->AddSeparator();
editMenu->AddItem( ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty );
editMenu->AddItem( ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty );
editMenu->AddItem( ACTIONS::paste, noActiveToolCondition );
editMenu->AddSeparator();
editMenu->AddItem( PCB_ACTIONS::deleteTool, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddSeparator();
editMenu->AddItem( ACTIONS::find, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddSeparator();
editMenu->AddItem( ID_PCB_EDIT_TRACKS_AND_VIAS,
_( "Edit &Track && Via Properties..." ), "",
width_track_via_xpm, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( ID_MENU_PCB_EDIT_TEXT_AND_GRAPHICS,
_( "Edit Text && &Graphic Properties..." ), "",
reset_text_xpm, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( PCB_ACTIONS::exchangeFootprints, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( ID_MENU_PCB_SWAP_LAYERS,
_( "&Swap Layers..." ),
_( "Move tracks or drawings from a layer to another layer" ),
swap_layer_xpm, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddSeparator();
editMenu->AddItem( PCB_ACTIONS::zoneFillAll, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( PCB_ACTIONS::zoneUnfillAll, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddSeparator();
editMenu->AddItem( ID_PCB_GLOBAL_DELETE,
_( "Glo&bal Deletions..." ),
_( "Delete tracks, footprints and graphic items from board" ),
general_deletions_xpm, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( ID_MENU_PCB_CLEAN,
_( "C&leanup Tracks and Vias..." ),
_( "Clean stubs, vias, delete break points or unconnected tracks" ),
delete_xpm, SELECTION_CONDITIONS::ShowAlways );
//----- View menu -----------------------------------------------------------
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
@ -141,10 +189,12 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
auto sketchViasCondition = [ this ] ( const SELECTION& aSel ) {
return !( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayViaFill;
};
auto sketchPadsCondition = [ this ] ( const SELECTION& aSel ) {
return !( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayPadFill;
};
auto contrastModeCondition = [ this ] ( const SELECTION& aSel ) {
return !( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_ContrastModeDisplay;
};
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
_( "Show La&yers Manager" ), HELP_SHOW_HIDE_LAYERMANAGER,
@ -179,19 +229,15 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool );
unitsSubMenu->SetTitle( _( "&Units" ) );
unitsSubMenu->SetIcon( unit_mm_xpm );
unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition );
unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition );
unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition );
unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition );
viewMenu->AddMenu( unitsSubMenu );
viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition );
viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition );
viewMenu->AddSeparator();
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_RATSNEST,
_( "Show Ratsnest" ), _( "Show board ratsnest" ),
general_ratsnest_xpm, ratsnestShownCondition );
viewMenu->AddCheckItem( ID_TB_OPTIONS_CURVED_RATSNEST_LINES,
_( "Curved Ratsnest Lines" ), _( "Show ratsnest with curved lines" ),
curved_ratsnest_xpm, curvedRatsnestCondition );
viewMenu->AddCheckItem( PCB_ACTIONS::showRatsnest, ratsnestShownCondition );
viewMenu->AddCheckItem( PCB_ACTIONS::ratsnestLineMode, curvedRatsnestCondition );
viewMenu->AddSeparator();
@ -200,56 +246,27 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) );
drawingModeSubMenu->SetIcon( add_zone_xpm );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_ZONES,
_( "&Fill Zones" ), _( "Show filled areas of zones" ),
show_zone_xpm, zonesFilledCondition );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
_( "&Wireframe Zones" ), _( "Show only zone outlines" ),
show_zone_disable_xpm, zonesWireframedCondition );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
_( "&Sketch Zones" ),
_( "Hatch outline of filled areas of zones" ) ,
show_zone_outline_only_xpm , zonesOutlinedCondition );
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::zoneDisplayEnable, zonesFilledCondition );
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::zoneDisplayDisable, zonesWireframedCondition );
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::zoneDisplayOutlines, zonesOutlinedCondition );
drawingModeSubMenu->AddSeparator();
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
_( "Sketch &Pads" ), _( "Show pads in outline mode" ),
pad_sketch_xpm, sketchPadsCondition );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
_( "Sketch &Vias" ), _( "Show vias in outline mode" ),
via_sketch_xpm, sketchViasCondition );
text = AddHotkeyName( _( "Sketch &Tracks" ), g_Board_Editor_Hotkeys_Descr,
HK_SWITCH_TRACK_DISPLAY_MODE );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
text, _( "Show tracks in outline mode" ),
showtrack_xpm, sketchTracksCondition );
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::padDisplayMode, sketchPadsCondition );
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::viaDisplayMode, sketchViasCondition );
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::trackDisplayMode, sketchTracksCondition );
viewMenu->AddMenu( drawingModeSubMenu );
// Contrast Mode Submenu
ACTION_MENU* contrastModeSubMenu = new ACTION_MENU;
CONDITIONAL_MENU* contrastModeSubMenu = new CONDITIONAL_MENU( false, selTool );
contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) );
contrastModeSubMenu->SetIcon( contrast_mode_xpm );
contrastModeSubMenu->SetTool( selTool );
text = AddHotkeyName( _( "&High Contrast Mode" ), g_Board_Editor_Hotkeys_Descr,
HK_SWITCH_HIGHCONTRAST_MODE );
AddMenuItem( contrastModeSubMenu, ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
text, _( "Use high contrast display mode" ),
KiBitmap( contrast_mode_xpm ), wxITEM_CHECK );
contrastModeSubMenu->AddCheckItem( PCB_ACTIONS::highContrastMode, contrastModeCondition );
contrastModeSubMenu->AppendSeparator();
text = AddHotkeyName( _( "&Decrease Layer Opacity" ), g_Board_Editor_Hotkeys_Descr,
HK_DEC_LAYER_ALPHA );
AddMenuItem( contrastModeSubMenu, ID_DEC_LAYER_ALPHA,
text, _( "Make the current layer more transparent" ),
KiBitmap( contrast_mode_xpm ) );
text = AddHotkeyName( _( "&Increase Layer Opacity" ), g_Board_Editor_Hotkeys_Descr,
HK_INC_LAYER_ALPHA );
AddMenuItem( contrastModeSubMenu, ID_INC_LAYER_ALPHA,
text, _( "Make the current layer less transparent" ),
KiBitmap( contrast_mode_xpm ) );
contrastModeSubMenu->AddSeparator();
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaDec, SELECTION_CONDITIONS::ShowAlways );
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaInc, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddMenu( contrastModeSubMenu );
@ -262,8 +279,38 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
#endif
//----- Place Menu ----------------------------------------------------------
wxMenu* placeMenu = new wxMenu;
preparePlaceMenu( placeMenu );
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
placeMenu->AddItem( PCB_ACTIONS::placeModule, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( PCB_ACTIONS::drawVia, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( PCB_ACTIONS::drawZone, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( PCB_ACTIONS::drawZoneKeepout, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( PCB_ACTIONS::placeText, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( PCB_ACTIONS::drawArc, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( PCB_ACTIONS::drawCircle, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( PCB_ACTIONS::drawLine, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( PCB_ACTIONS::drawPolygon, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddSeparator();
placeMenu->AddItem( PCB_ACTIONS::drawDimension, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddSeparator();
placeMenu->AddItem( PCB_ACTIONS::placeTarget, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddSeparator();
placeMenu->AddItem( PCB_ACTIONS::drillOrigin, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddItem( ACTIONS::gridSetOrigin, SELECTION_CONDITIONS::ShowAlways );
placeMenu->AddSeparator();
ACTION_MENU* autoplaceSubmenu = new ACTION_MENU;
autoplaceSubmenu->SetTitle( _( "Auto-Place Footprints" ) );
autoplaceSubmenu->SetTool( selTool );
autoplaceSubmenu->Add( PCB_ACTIONS::autoplaceOffboardComponents );
autoplaceSubmenu->Add( PCB_ACTIONS::autoplaceSelectedComponents );
placeMenu->AddMenu( autoplaceSubmenu );
//----- Route Menu ----------------------------------------------------------
wxMenu* routeMenu = new wxMenu;
@ -447,88 +494,6 @@ void prepareLibraryMenu( wxMenu* aParentMenu )
}
// Build the place menu
void preparePlaceMenu( wxMenu* aParentMenu )
{
wxString text;
text = AddHotkeyName( _( "&Footprint" ), g_Board_Editor_Hotkeys_Descr, HK_ADD_MODULE );
AddMenuItem( aParentMenu, ID_PCB_MODULE_BUTT, text, _( "Add footprint" ),
KiBitmap( module_xpm ) );
text = AddHotkeyName( _( "&Via" ), g_Board_Editor_Hotkeys_Descr, HK_ADD_FREE_VIA );
AddMenuItem( aParentMenu, ID_PCB_DRAW_VIA_BUTT, text, _( "Add via" ),
KiBitmap( add_via_xpm ) );
text = AddHotkeyName( _( "&Zone" ), g_Board_Editor_Hotkeys_Descr, HK_ADD_ZONE );
AddMenuItem( aParentMenu, ID_PCB_ZONES_BUTT, text, _( "Add filled zone" ),
KiBitmap( add_zone_xpm ) );
text = AddHotkeyName( _( "&Keepout Area" ), g_Board_Editor_Hotkeys_Descr, HK_ADD_KEEPOUT );
AddMenuItem( aParentMenu, ID_PCB_KEEPOUT_AREA_BUTT, text, _( "Add keepout area" ),
KiBitmap( add_keepout_area_xpm ) );
text = AddHotkeyName( _( "Te&xt" ), g_Board_Editor_Hotkeys_Descr, HK_ADD_TEXT );
AddMenuItem( aParentMenu, ID_PCB_ADD_TEXT_BUTT, text,
_( "Add text on copper layers or graphic text" ), KiBitmap( text_xpm ) );
text = AddHotkeyName( _( "&Arc" ), g_Board_Editor_Hotkeys_Descr, HK_ADD_ARC );
AddMenuItem( aParentMenu, ID_PCB_ARC_BUTT, text, _( "Add graphic arc" ),
KiBitmap( add_arc_xpm ) );
text = AddHotkeyName( _( "&Circle" ), g_Board_Editor_Hotkeys_Descr, HK_ADD_CIRCLE );
AddMenuItem( aParentMenu, ID_PCB_CIRCLE_BUTT, text, _( "Add graphic circle" ),
KiBitmap( add_circle_xpm ) );
text = AddHotkeyName( _( "&Line" ), g_Board_Editor_Hotkeys_Descr, HK_ADD_LINE );
AddMenuItem( aParentMenu, ID_PCB_ADD_LINE_BUTT, text, _( "Add graphic line" ),
KiBitmap( add_graphical_segments_xpm ) );
text = AddHotkeyName( _( "&Polygon" ), g_Board_Editor_Hotkeys_Descr, HK_ADD_POLYGON );
AddMenuItem( aParentMenu, ID_PCB_ADD_POLYGON_BUTT, text, _( "Add graphic polygon" ),
KiBitmap( add_graphical_polygon_xpm ) );
aParentMenu->AppendSeparator();
text = AddHotkeyName( _( "&Dimension" ), g_Board_Editor_Hotkeys_Descr, HK_ADD_DIMENSION );
AddMenuItem( aParentMenu, ID_PCB_DIMENSION_BUTT, text, _( "Add dimension" ),
KiBitmap( add_dimension_xpm ) );
AddMenuItem( aParentMenu, ID_PCB_TARGET_BUTT, _( "La&yer Alignment Target" ),
_( "Add layer alignment target" ), KiBitmap( add_pcb_target_xpm ) );
aParentMenu->AppendSeparator();
AddMenuItem( aParentMenu, ID_PCB_PLACE_OFFSET_COORD_BUTT,
_( "Dr&ill and Place Offset" ),
_( "Place origin point for drill and place files" ),
KiBitmap( pcb_offset_xpm ) );
AddMenuItem( aParentMenu, ID_PCB_PLACE_GRID_COORD_BUTT,
_( "&Grid Origin" ),
_( "Set grid origin point" ),
KiBitmap( grid_select_axis_xpm ) );
aParentMenu->AppendSeparator();
wxMenu* autoplaceSubmenu = new wxMenu;
AddMenuItem( autoplaceSubmenu, ID_POPUP_PCB_AUTOPLACE_OFF_BOARD_MODULES,
_( "A&utomatically Place Off-Board Footprints" ), "",
KiBitmap( grid_select_axis_xpm ) // fixme: icons
);
AddMenuItem( autoplaceSubmenu, ID_POPUP_PCB_AUTOPLACE_SELECTED_MODULES,
_( "Automatically Place &Selected Components" ), "",
KiBitmap( grid_select_axis_xpm ) // fixme: icons
);
AddMenuItem( aParentMenu, autoplaceSubmenu, -1, _( "Place Footprints Au&tomatically" ),
_( "Automatically place all footprints" ),
KiBitmap( grid_select_axis_xpm ) // fixme: icons
);
}
// Build the tools menu
void prepareToolsMenu( wxMenu* aParentMenu )
{
@ -615,102 +580,6 @@ void prepareHelpMenu( wxMenu* aParentMenu )
}
// Build the edit menu
void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal )
{
wxString text;
// JEY TODO: convert to actions (PCB_CONTROL is already ready)...
text = AddHotkeyName( _( "&Undo" ), g_Board_Editor_Hotkeys_Descr, HK_UNDO );
AddMenuItem( aParentMenu, wxID_UNDO, text, HELP_UNDO, KiBitmap( undo_xpm ) );
text = AddHotkeyName( _( "&Redo" ), g_Board_Editor_Hotkeys_Descr, HK_REDO );
AddMenuItem( aParentMenu, wxID_REDO, text, HELP_REDO, KiBitmap( redo_xpm ) );
aParentMenu->AppendSeparator();
// JEY TODO: convert to actions:
if( aUseGal )
{
text = AddHotkeyName( _( "&Cut" ), g_Board_Editor_Hotkeys_Descr, HK_EDIT_CUT );
AddMenuItem( aParentMenu, ID_EDIT_CUT, text,
_( "Cuts the selected item(s) to the Clipboard" ),
KiBitmap( cut_xpm ) );
text = AddHotkeyName( _( "Cop&y" ), g_Board_Editor_Hotkeys_Descr, HK_EDIT_COPY );
AddMenuItem( aParentMenu, ID_EDIT_COPY, text,
_( "Copies the selected item(s) to the Clipboard" ),
KiBitmap( copy_xpm ) );
text = AddHotkeyName( _( "&Paste" ), g_Board_Editor_Hotkeys_Descr, HK_EDIT_PASTE );
AddMenuItem( aParentMenu, ID_EDIT_PASTE, text,
_( "Pastes item(s) from the Clipboard" ),
KiBitmap( paste_xpm ) );
}
AddMenuItem( aParentMenu, ID_PCB_DELETE_ITEM_BUTT,
_( "&Delete" ), _( "Delete items" ),
KiBitmap( delete_xpm ) );
aParentMenu->AppendSeparator();
text = AddHotkeyName( _( "&Find..." ), g_Board_Editor_Hotkeys_Descr, HK_FIND_ITEM );
AddMenuItem( aParentMenu, ID_FIND_ITEMS, text, HELP_FIND , KiBitmap( find_xpm ) );
aParentMenu->AppendSeparator();
AddMenuItem( aParentMenu, ID_PCB_EDIT_TRACKS_AND_VIAS,
_( "Edit &Track && Via Properties..." ), KiBitmap( width_track_via_xpm ) );
AddMenuItem( aParentMenu, ID_MENU_PCB_EDIT_TEXT_AND_GRAPHICS,
_( "Edit Text && &Graphic Properties..." ), KiBitmap( reset_text_xpm ) );
AddMenuItem( aParentMenu, ID_MENU_PCB_EXCHANGE_FOOTPRINTS,
_( "C&hange Footprints..." ),
_( "Assign different footprints from the library" ),
KiBitmap( exchange_xpm ) );
AddMenuItem( aParentMenu, ID_MENU_PCB_SWAP_LAYERS,
_( "&Swap Layers..." ),
_( "Move tracks or drawings from a layer to another layer" ),
KiBitmap( swap_layer_xpm ) );
aParentMenu->AppendSeparator();
text = AddHotkeyName( _( "Fill All &Zones" ), g_Board_Editor_Hotkeys_Descr,
HK_ZONE_FILL_OR_REFILL );
AddMenuItem( aParentMenu, ID_POPUP_PCB_FILL_ALL_ZONES,
text, _( "Fill all zones on the board" ),
KiBitmap( fill_zone_xpm ) );
text = AddHotkeyName( _( "U&nfill All Zones" ), g_Board_Editor_Hotkeys_Descr,
HK_ZONE_REMOVE_FILLED );
AddMenuItem( aParentMenu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES,
text, _( "Remove fill from all zones on the board" ),
KiBitmap( zone_unfill_xpm ) );
aParentMenu->AppendSeparator();
AddMenuItem( aParentMenu, ID_PCB_GLOBAL_DELETE,
_( "Glo&bal Deletions..." ),
_( "Delete tracks, footprints and graphic items from board" ),
KiBitmap( general_deletions_xpm ) );
AddMenuItem( aParentMenu, ID_MENU_PCB_CLEAN,
_( "C&leanup Tracks and Vias..." ),
_( "Clean stubs, vias, delete break points or unconnected tracks" ),
KiBitmap( delete_xpm ) );
}
// Build the view menu
void prepareViewMenu( CONDITIONAL_MENU* aParentMenu, PCB_EDIT_FRAME* aFrame )
{
wxString text;
}
// Build the files menu.
void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject )
{

View File

@ -219,7 +219,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
break;
case ID_PCB_SHOW_1_RATSNEST_BUTT:
case ID_LOCAL_RATSNEST_BUTT:
curr_item = PcbGeneralLocateAndDisplay();
Show_1_Ratsnest( curr_item, aDC );
@ -304,7 +304,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PCB_ZONES_BUTT:
case ID_PCB_KEEPOUT_AREA_BUTT:
case ID_PCB_KEEPOUT_BUTT:
/* ZONE or KEEPOUT Tool is selected. Determine action for a left click:
* this can be start a new zone or select and move an existing zone outline corner
* if found near the mouse cursor
@ -535,7 +535,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PCB_ZONES_BUTT:
case ID_PCB_KEEPOUT_AREA_BUTT:
case ID_PCB_KEEPOUT_BUTT:
if( End_Zone( aDC ) )
{
m_canvas->SetAutoPanRequest( false );

File diff suppressed because it is too large Load Diff

View File

@ -204,15 +204,9 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
// Horizontal toolbar
EVT_TOOL( ID_RUN_LIBRARY, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_SHEET_SET, EDA_DRAW_FRAME::Process_PageSettings )
EVT_TOOL( wxID_CUT, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_COPY, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_PASTE, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_UNDO, PCB_BASE_EDIT_FRAME::RestoreCopyFromUndoList )
EVT_TOOL( wxID_REDO, PCB_BASE_EDIT_FRAME::RestoreCopyFromRedoList )
EVT_TOOL( wxID_PRINT, PCB_EDIT_FRAME::ToPrinter )
EVT_TOOL( ID_GEN_PLOT_SVG, PCB_EDIT_FRAME::ExportSVG )
EVT_TOOL( ID_GEN_PLOT, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_FIND_ITEMS, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_GET_NETLIST, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_DRC_CONTROL, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, PCB_EDIT_FRAME::Process_Special_Functions )
@ -235,26 +229,16 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
// Option toolbar
EVT_TOOL( ID_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_RATSNEST, PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_CURVED_RATSNEST_LINES, PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_UPDATE_PCB_FROM_SCH, PCB_EDIT_FRAME::OnUpdatePCBFromSch )
EVT_TOOL( ID_RUN_EESCHEMA, PCB_EDIT_FRAME::OnRunEeschema )
EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_ZONES, ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
PCB_EDIT_FRAME::OnSelectOptionToolbar )
// Vertical main toolbar:
EVT_TOOL( ID_NO_TOOL_SELECTED, PCB_EDIT_FRAME::OnSelectTool )
EVT_TOOL( ID_ZOOM_SELECTION, PCB_EDIT_FRAME::OnSelectTool )
EVT_TOOL_RANGE( ID_PCB_HIGHLIGHT_BUTT, ID_PCB_MEASUREMENT_TOOL,
PCB_EDIT_FRAME::OnSelectTool )
@ -279,8 +263,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, PCB_EDIT_FRAME::OnUpdateLayerPair )
EVT_UPDATE_UI( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::OnUpdateLayerSelectBox )
EVT_UPDATE_UI( ID_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnUpdateDrcEnable )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode )
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI( ID_ZOOM_SELECTION, PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )

View File

@ -348,7 +348,6 @@ public:
void OnUpdateLayerPair( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
void OnUpdateDrcEnable( wxUpdateUIEvent& aEvent );
void OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent );
bool LayerManagerShown();
bool MicrowaveToolbarShown();
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
@ -509,39 +508,6 @@ public:
*/
bool OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
/**
* Function OnHotkeyDeleteItem
* Delete the item found under the mouse cursor
* Depending on the current active tool::
* Tool track
* if a track is in progress: Delete the last segment
* else delete the entire track
* Tool module (footprint):
* Delete the module.
* @param aDC = current device context
* @return true if an item was deleted
*/
bool OnHotkeyDeleteItem( wxDC* aDC );
/**
* Function OnHotkeyPlaceItem
* Place the item (footprint, track, text .. ) found under the mouse cursor
* An item can be placed only if there is this item currently edited
* Only a footprint, a pad or a track can be placed
* @param aDC = current device context
* @return true if an item was placed
*/
bool OnHotkeyPlaceItem( wxDC* aDC );
bool OnHotkeyEditItem( int aIdCommand );
/**
* Function OnHotkeyCopyItem
* returns the copy event id for copyable items.
* @return Event id of a suitable copy event, zero when no copyable item found.
*/
int OnHotkeyCopyItem();
/**
* Function OnHotkeyDuplicateOrArrayItem
* Duplicate an item (optionally incrementing if necessary and possible)
@ -551,35 +517,6 @@ public:
*/
bool OnHotkeyDuplicateOrArrayItem( int aIdCommand );
/**
* Function OnHotkeyMoveItem
* Moves or drag the item (footprint, track, text .. ) found under the mouse cursor
* Only a footprint or a track can be dragged
* @param aIdCommand = the hotkey command id
* @return true if an item was moved
*/
bool OnHotkeyMoveItem( int aIdCommand );
/**
* Function OnHotkeyRotateItem
* Rotate the item (text or footprint) found under the mouse cursor
* @note This command can be used with an item currently in edit.
* Only some items can be rotated (footprints and texts).
* @param aIdCommand = the hotkey command id
* @return true if an item was moved
*/
bool OnHotkeyRotateItem( int aIdCommand );
/**
* Function OnHotkeyFlipItem
* Flip the item (text or footprint) found under the mouse cursor
* @note This command can be used with an item currently in edit.
* Only some items can be rotated (footprints and texts).
* @param aIdCommand = the hotkey command id
* @return true if an item was moved
*/
bool OnHotkeyFlipItem( int aIdCommand );
/**
* Function OnHotkeyBeginRoute
* If the current active layer is a copper layer,
@ -725,15 +662,7 @@ public:
/* mouse functions events: */
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override;
/**
* Function OnRightClick
* populates a popup menu with the choices appropriate for the current context.
* The caller will add the ZOOM menu choices afterward.
* @param aMousePos The current mouse position
* @param aPopMenu The menu to add to.
*/
bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) override;
bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) override { return true; }
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnFlipPcbView( wxCommandEvent& event );
@ -1656,8 +1585,6 @@ public:
*/
void Clean_Pcb();
void InstallFindFrame();
/**
* Function SendMessageToEESCHEMA
* sends a message to the schematic editor so that it may move its cursor

View File

@ -26,12 +26,12 @@ enum pcbnew_ids
// Right vertical tool bar command IDs.
ID_PCB_HIGHLIGHT_BUTT,
ID_PCB_SHOW_1_RATSNEST_BUTT,
ID_LOCAL_RATSNEST_BUTT,
ID_PCB_MODULE_BUTT,
ID_TRACK_BUTT,
ID_PCB_ZONES_BUTT,
ID_PCB_DRAW_VIA_BUTT,
ID_PCB_KEEPOUT_AREA_BUTT,
ID_PCB_KEEPOUT_BUTT,
ID_PCB_ADD_LINE_BUTT,
ID_PCB_ADD_POLYGON_BUTT,
ID_PCB_CIRCLE_BUTT,
@ -57,24 +57,12 @@ enum pcbnew_ids
ID_MENU_PCB_FLIP_VIEW,
ID_POPUP_PCB_START_RANGE,
ID_POPUP_PCB_MOVE_MODULE_REQUEST,
ID_POPUP_PCB_DRAG_MODULE_REQUEST,
ID_POPUP_PCB_EDIT_MODULE_PRMS,
ID_POPUP_PCB_EDIT_MODULE_WITH_MODEDIT,
ID_POPUP_PCB_CHANGE_SIDE_MODULE,
ID_POPUP_PCB_DELETE_MODULE,
ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE,
ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE,
ID_POPUP_PCB_UPDATE_FOOTPRINTS,
ID_POPUP_PCB_EXCHANGE_FOOTPRINTS,
ID_POPUP_PCB_EDIT_PAD,
ID_POPUP_PCB_EDIT_MORE_PAD,
ID_POPUP_PCB_EDIT_PADS_ON_MODULE,
ID_POPUP_PCB_DELETE_PAD,
ID_POPUP_PCB_ADD_PAD,
ID_POPUP_PCB_NEWSIZE_PAD,
ID_POPUP_PCB_ROTATE_PAD,
ID_POPUP_PCB_MOVE_PAD_REQUEST,
ID_POPUP_PCB_DRAG_PAD_REQUEST,
ID_POPUP_PCB_DUPLICATE_ITEM,
@ -82,22 +70,6 @@ enum pcbnew_ids
ID_POPUP_PCB_MOVE_EXACT,
ID_POPUP_PCB_CREATE_ARRAY,
ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST,
ID_POPUP_PCB_ROTATE_TEXTMODULE,
ID_POPUP_PCB_EDIT_TEXTMODULE,
ID_POPUP_PCB_DELETE_TEXTMODULE,
ID_POPUP_PCB_RESET_TEXT_SIZE,
ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST,
ID_POPUP_PCB_ROTATE_TEXTEPCB,
ID_POPUP_PCB_COPY_TEXTEPCB,
ID_POPUP_PCB_FLIP_TEXTEPCB,
ID_POPUP_PCB_EDIT_TEXTEPCB,
ID_POPUP_PCB_DELETE_TEXTEPCB,
ID_POPUP_PCB_MOVE_DRAWING_REQUEST,
ID_POPUP_PCB_EDIT_DRAWING,
ID_POPUP_PCB_DELETE_DRAWING,
ID_POPUP_PCB_DELETE_DRAWING_LAYER,
ID_POPUP_PCB_END_LINE,
@ -248,11 +220,6 @@ enum pcbnew_ids
ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END = MAX_ITEMS_IN_PICKER + ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_SPREAD_SELECTED_MODULES,
ID_POPUP_PCB_SPREAD_OFF_BOARD_MODULES,
ID_POPUP_PCB_AUTOPLACE_SELECTED_MODULES,
ID_POPUP_PCB_AUTOPLACE_OFF_BOARD_MODULES,
ID_MENU_READ_BOARD_BACKUP_FILE,
ID_MENU_RECOVER_BOARD_AUTOSAVE,
ID_MENU_ARCHIVE_MODULES,
@ -278,8 +245,6 @@ enum pcbnew_ids
ID_GEN_IMPORT_SPECCTRA_DESIGN,
ID_GEN_IMPORT_GRAPHICS_FILE,
ID_TOOLBARH_PCB_MODE_MODULE,
ID_TOOLBARH_PCB_MODE_TRACKS,
ID_TOOLBARH_PCB_SCRIPTING_CONSOLE,
ID_TOOLBARH_PCB_ACTION_PLUGIN,
@ -300,17 +265,7 @@ enum pcbnew_ids
ID_BOARD_SETUP_DIALOG,
ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
ID_TB_OPTIONS_SHOW_ZONES,
ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
ID_TB_OPTIONS_DRC_OFF,
ID_TB_OPTIONS_SHOW_RATSNEST,
ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
ID_TB_OPTIONS_CURVED_RATSNEST_LINES,
ID_DEC_LAYER_ALPHA,
ID_INC_LAYER_ALPHA,
ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
ID_PCB_MUWAVE_START_CMD,
@ -390,9 +345,6 @@ enum pcbnew_ids
ID_ADD_FOOTPRINT_TO_BOARD,
ID_UPDATE_PCB_FROM_SCH,
ID_RUN_EESCHEMA,
ID_EDIT_CUT,
ID_EDIT_COPY,
ID_EDIT_PASTE,
ID_PCBNEW_END_LIST
};

View File

@ -82,17 +82,20 @@ enum VIA_ACTION_FLAGS
TOOL_ACTION PCB_ACTIONS::routerActivateSingle( "pcbnew.InteractiveRouter.SingleTrack",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_NEW_TRACK ),
_( "Interactive Router (Single Tracks)" ),
_( "Run push & shove router (single tracks)" ), ps_router_xpm, AF_ACTIVATE );
_( "Run push & shove router (single tracks)" ),
add_tracks_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::routerActivateDiffPair( "pcbnew.InteractiveRouter.DiffPair",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_DIFF_PAIR ),
_( "Interactive Router (Differential Pairs)" ),
_( "Run push & shove router (differential pairs)" ), ps_diff_pair_xpm, AF_ACTIVATE );
_( "Run push & shove router (differential pairs)" ),
ps_diff_pair_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::routerActivateSettingsDialog( "pcbnew.InteractiveRouter.SettingsDialog",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTING_OPTIONS ),
_( "Interactive Router Settings..." ),
_( "Open Interactive Router settings" ), tools_xpm );
_( "Open Interactive Router settings" ),
tools_xpm );
TOOL_ACTION PCB_ACTIONS::routerActivateDpDimensionsDialog( "pcbnew.InteractiveRouter.DpDimensionsDialog",
AS_GLOBAL, 0,
@ -102,15 +105,18 @@ TOOL_ACTION PCB_ACTIONS::routerActivateDpDimensionsDialog( "pcbnew.InteractiveRo
TOOL_ACTION PCB_ACTIONS::routerActivateTuneSingleTrace( "pcbnew.LengthTuner.TuneSingleTrack",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_SINGLE ),
_( "Tune length of a single track" ), "", ps_tune_length_xpm, AF_ACTIVATE );
_( "Tune length of a single track" ), "",
ps_tune_length_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPair( "pcbnew.LengthTuner.TuneDiffPair",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_DIFF_PAIR ),
_( "Tune length of a differential pair" ), "", NULL, AF_ACTIVATE );
_( "Tune length of a differential pair" ), "",
NULL, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPairSkew( "pcbnew.LengthTuner.TuneDiffPairSkew",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_SKEW ),
_( "Tune skew of a differential pair" ), "", NULL, AF_ACTIVATE );
_( "Tune skew of a differential pair" ), "",
NULL, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::routerInlineDrag( "pcbnew.InteractiveRouter.InlineDrag",
AS_CONTEXT, 0,
@ -143,10 +149,12 @@ TOOL_ACTION PCB_ACTIONS::dragFreeAngle( "pcbnew.InteractiveRouter.DragFreeAngle"
static const TOOL_ACTION ACT_NewTrack( "pcbnew.InteractiveRouter.NewTrack", AS_CONTEXT,
TOOL_ACTION::LegacyHotKey( HK_ADD_NEW_TRACK ),
_( "New Track" ), _( "Starts laying a new track." ), add_tracks_xpm );
_( "New Track" ), _( "Starts laying a new track." ),
add_tracks_xpm );
static const TOOL_ACTION ACT_EndTrack( "pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END,
_( "End Track" ), _( "Stops laying the current track." ), checked_ok_xpm );
_( "End Track" ), _( "Stops laying the current track." ),
checked_ok_xpm );
static const TOOL_ACTION ACT_AutoEndRoute( "pcbnew.InteractiveRouter.AutoEndRoute", AS_CONTEXT, 'F',
_( "Auto-end Track" ), _( "Automagically finishes currently routed track." ) );

View File

@ -28,7 +28,7 @@
#include <pcbnew_id.h>
#include <hotkeys.h>
#include <bitmaps.h>
#include <tools/pcb_actions.h>
void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
{
@ -77,10 +77,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
_( "Print footprint" ) );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiScaledBitmap( undo_xpm, this ),
_( "Undo last edit" ) );
m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiScaledBitmap( redo_xpm, this ),
_( "Redo last undo command" ) );
m_mainToolBar->Add( ACTIONS::undo );
m_mainToolBar->Add( ACTIONS::redo );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( ACTIONS::zoomRedraw );
@ -147,48 +145,21 @@ void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ),
_( "Select item" ), wxITEM_CHECK );
m_drawToolBar->Add( PCB_ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_MODEDIT_PAD_TOOL, wxEmptyString, KiScaledBitmap( pad_xpm, this ),
_( "Add pad" ), wxITEM_CHECK );
m_drawToolBar->Add( PCB_ACTIONS::placePad, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawLine, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawCircle, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawPolygon, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_MODEDIT_LINE_TOOL, wxEmptyString, KiScaledBitmap( add_graphical_segments_xpm, this ),
_( "Add graphic line" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_MODEDIT_CIRCLE_TOOL, wxEmptyString, KiScaledBitmap( add_circle_xpm, this ),
_( "Add graphic circle" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_MODEDIT_ARC_TOOL, wxEmptyString, KiScaledBitmap( add_arc_xpm, this ),
_( "Add graphic arc" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_MODEDIT_POLYGON_TOOL, wxEmptyString, KiScaledBitmap( add_graphical_polygon_xpm, this ),
_( "Add graphic polygon" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_MODEDIT_TEXT_TOOL, wxEmptyString, KiScaledBitmap( text_xpm, this ),
_( "Add Text" ), wxITEM_CHECK );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_MODEDIT_ANCHOR_TOOL, wxEmptyString, KiScaledBitmap( anchor_xpm, this ),
_( "Place footprint reference anchor" ),
wxITEM_CHECK );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_MODEDIT_DELETE_TOOL, wxEmptyString, KiScaledBitmap( delete_xpm, this ),
_( "Delete item" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_MODEDIT_PLACE_GRID_COORD, wxEmptyString,
KiScaledBitmap( grid_select_axis_xpm, this ),
_( "Set grid origin" ),
wxITEM_CHECK );
m_drawToolBar->AddTool( ID_MODEDIT_MEASUREMENT_TOOL, wxEmptyString,
KiScaledBitmap( measurement_xpm, this ),
_( "Measure distance" ),
wxITEM_CHECK );
m_drawToolBar->Add( PCB_ACTIONS::setAnchor, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::gridSetOrigin, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Realize();
}
@ -202,35 +173,22 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
KiScaledBitmap( polar_coord_xpm, this ),
_( "Display Polar Coord ON" ), wxITEM_CHECK );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
KiScaledBitmap( pad_sketch_xpm, this ),
_( "Show Pads Sketch" ), wxITEM_CHECK );
m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::moduleEdgeOutlines, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, wxEmptyString,
KiScaledBitmap( text_sketch_xpm, this ),
_( "Show Texts Sketch" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, wxEmptyString,
KiScaledBitmap( show_mod_edge_xpm, this ),
_( "Show Edges Sketch" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, wxEmptyString,
KiScaledBitmap( contrast_mode_xpm, this ),
_( "Enable high contrast display mode" ),
wxITEM_CHECK );
KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddTool( ID_MODEDIT_SHOW_HIDE_SEARCH_TREE, wxEmptyString,
KiScaledBitmap( search_tree_xpm, this ),
_( "Toggles the search tree" ), wxITEM_CHECK );
@ -243,13 +201,29 @@ void FOOTPRINT_EDIT_FRAME::SyncMenusAndToolbars()
{
PCB_DISPLAY_OPTIONS* opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions();
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, !opts->m_DisplayPadFill );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, !opts->m_DisplayModTextFill );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, !opts->m_DisplayModEdgeFill );
m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 );
m_mainToolBar->Toggle( ACTIONS::redo, GetScreen() && GetScreen()->GetRedoCommandCount() > 0 );
m_mainToolBar->Toggle( ACTIONS::zoomTool, GetToolId() == ID_ZOOM_SELECTION );
m_mainToolBar->Refresh();
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts->m_DisplayPadFill );
m_optionsToolBar->Toggle( PCB_ACTIONS::moduleEdgeOutlines, !opts->m_DisplayModEdgeFill );
m_optionsToolBar->Toggle( PCB_ACTIONS::highContrastMode, opts->m_ContrastModeDisplay );
m_optionsToolBar->Refresh();
m_drawToolBar->Toggle( PCB_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED );
m_drawToolBar->Toggle( PCB_ACTIONS::placePad, GetToolId() == ID_MODEDIT_PAD_TOOL );
m_drawToolBar->Toggle( PCB_ACTIONS::drawLine, GetToolId() == ID_MODEDIT_LINE_TOOL );
m_drawToolBar->Toggle( PCB_ACTIONS::drawCircle, GetToolId() == ID_MODEDIT_CIRCLE_TOOL );
m_drawToolBar->Toggle( PCB_ACTIONS::drawArc, GetToolId() == ID_MODEDIT_ARC_TOOL );
m_drawToolBar->Toggle( PCB_ACTIONS::drawPolygon, GetToolId() == ID_MODEDIT_POLYGON_TOOL );
m_drawToolBar->Toggle( PCB_ACTIONS::placeText, GetToolId() == ID_MODEDIT_TEXT_TOOL );
m_drawToolBar->Toggle( PCB_ACTIONS::deleteTool, GetToolId() == ID_MODEDIT_DELETE_TOOL );
m_drawToolBar->Toggle( PCB_ACTIONS::setAnchor, GetToolId() == ID_MODEDIT_ANCHOR_TOOL );
m_drawToolBar->Toggle( PCB_ACTIONS::gridSetOrigin, GetToolId() == ID_MODEDIT_PLACE_GRID_COORD );
m_drawToolBar->Toggle( PCB_ACTIONS::measureTool, GetToolId() == ID_MODEDIT_MEASUREMENT_TOOL );
m_drawToolBar->Refresh();
}

View File

@ -43,6 +43,7 @@
#include <wx/wupdlock.h>
#include <memory>
#include <pgm_base.h>
#include <tools/pcb_actions.h>
extern bool IsWxPythonLoaded();
@ -264,16 +265,13 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
ADD_TOOL( ID_GEN_PLOT, plot_xpm, _( "Plot (HPGL, PostScript, or GERBER format)" ) );
KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hotkeys_Descr, HK_UNDO, IS_COMMENT );
ADD_TOOL( wxID_UNDO, undo_xpm, msg );
msg = AddHotkeyName( HELP_REDO, g_Board_Editor_Hotkeys_Descr, HK_REDO, IS_COMMENT );
ADD_TOOL( wxID_REDO, redo_xpm, msg );
m_mainToolBar->Add( ACTIONS::undo );
m_mainToolBar->Add( ACTIONS::redo );
KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( HELP_FIND, g_Board_Editor_Hotkeys_Descr, HK_FIND_ITEM, IS_COMMENT );
ADD_TOOL( ID_FIND_ITEMS, find_xpm, msg );
m_mainToolBar->Add( ACTIONS::find );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
@ -349,53 +347,30 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString, KiScaledBitmap( drc_off_xpm, this ),
_( "Enable design rule checking" ), wxITEM_CHECK );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
KiScaledBitmap( polar_coord_xpm, this ),
_( "Display polar coordinates" ), wxITEM_CHECK );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_RATSNEST, wxEmptyString,
KiScaledBitmap( general_ratsnest_xpm, this ),
_( "Show board ratsnest" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_CURVED_RATSNEST_LINES, wxEmptyString,
KiScaledBitmap( curved_ratsnest_xpm, this ),
_( "Show ratsnest with curved lines" ),
wxITEM_CHECK );
m_optionsToolBar->Add( PCB_ACTIONS::showRatsnest, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::ratsnestLineMode, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, KiScaledBitmap( show_zone_xpm, this ),
_( "Show filled areas in zones" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString,
KiScaledBitmap( show_zone_disable_xpm, this ),
_( "Do not show filled areas in zones" ) , wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString,
KiScaledBitmap( show_zone_outline_only_xpm, this ),
_( "Show outlines of filled areas only in zones" ), wxITEM_CHECK );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayEnable, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayDisable, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayOutlines, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
KiScaledBitmap( pad_sketch_xpm, this ),
_( "Show pads in outline mode" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, wxEmptyString,
KiScaledBitmap( via_sketch_xpm, this ),
_( "Show vias in outline mode" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, wxEmptyString,
KiScaledBitmap( showtrack_xpm, this ),
_( "Show tracks in outline mode" ),
wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, wxEmptyString,
KiScaledBitmap( contrast_mode_xpm, this ),
_( "Enable high contrast display mode" ),
wxITEM_CHECK );
m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::viaDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::trackDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
// Tools to show/hide toolbars:
KiScaledSeparator( m_optionsToolBar, this );
@ -426,80 +401,31 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ),
_( "Select item" ), wxITEM_CHECK );
m_drawToolBar->Add( PCB_ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::highlightNetTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::localRatsnestTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_PCB_HIGHLIGHT_BUTT, wxEmptyString, KiScaledBitmap( net_highlight_xpm, this ),
_( "Highlight net" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_SHOW_1_RATSNEST_BUTT, wxEmptyString,
KiScaledBitmap( tool_ratsnest_xpm, this ),
_( "Display local ratsnest" ), wxITEM_CHECK );
m_drawToolBar->Add( PCB_ACTIONS::placeModule, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::routerActivateSingle, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawVia, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawZone, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawZoneKeepout, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_PCB_MODULE_BUTT, wxEmptyString, KiScaledBitmap( module_xpm, this ),
_( "Add footprints" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString, KiScaledBitmap( add_tracks_xpm, this ),
_( "Route tracks" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_DRAW_VIA_BUTT, wxEmptyString, KiScaledBitmap( add_via_xpm, this ),
_( "Add vias" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString, KiScaledBitmap( add_zone_xpm, this ),
_( "Add filled zones" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_KEEPOUT_AREA_BUTT, wxEmptyString,
KiScaledBitmap( add_keepout_area_xpm, this ),
_( "Add keepout areas" ), wxITEM_CHECK );
m_drawToolBar->Add( PCB_ACTIONS::drawLine, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawCircle, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawPolygon, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawDimension, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::placeTarget, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString, KiScaledBitmap( add_graphical_segments_xpm, this ),
_( "Add graphic lines" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString, KiScaledBitmap( add_circle_xpm, this ),
_( "Add graphic circle" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString, KiScaledBitmap( add_arc_xpm, this ),
_( "Add graphic arc" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_ADD_POLYGON_BUTT, wxEmptyString, KiScaledBitmap( add_graphical_polygon_xpm, this ),
_( "Add graphic polygon" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_ADD_TEXT_BUTT, wxEmptyString, KiScaledBitmap( text_xpm, this ),
_( "Add text on copper layers or graphic text" ), wxITEM_CHECK );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_PCB_DIMENSION_BUTT, wxEmptyString, KiScaledBitmap( add_dimension_xpm, this ),
_( "Add dimension" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_TARGET_BUTT, wxEmptyString, KiScaledBitmap( add_pcb_target_xpm, this ),
_( "Add layer alignment target" ), wxITEM_CHECK );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, wxEmptyString, KiScaledBitmap( delete_xpm, this ),
_( "Delete items" ), wxITEM_CHECK );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxEmptyString,
KiScaledBitmap( pcb_offset_xpm, this ),
_( "Place the auxiliary axis origin for some plot file formats,\n"
"and for drill and place files" ),
wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_PLACE_GRID_COORD_BUTT, wxEmptyString,
KiScaledBitmap( grid_select_axis_xpm, this ),
_( "Set the origin point for the grid" ),
wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_MEASUREMENT_TOOL, wxEmptyString,
KiScaledBitmap( measurement_xpm, this ),
_( "Measure distance" ),
wxITEM_CHECK );
m_drawToolBar->Add( PCB_ACTIONS::drillOrigin, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::gridSetOrigin, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Realize();
}
@ -754,7 +680,6 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{
int id = event.GetId();
bool state = event.IsChecked();
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
switch( id )
{
@ -770,59 +695,6 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
}
break;
case ID_TB_OPTIONS_SHOW_RATSNEST:
SetElementVisibility( LAYER_RATSNEST, state );
PCB_BASE_FRAME::OnModify();
Compile_Ratsnest( NULL, true );
if( IsGalCanvasActive() )
{
// keep the ratsnest layer enabled in view, so it shows up when an item is dragged
auto view = GetGalCanvas()->GetView();
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
view->SetLayerVisible( LAYER_RATSNEST, true );
}
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_ZONES:
displ_opts->m_DisplayZonesMode = 0;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_ZONES_DISABLE:
displ_opts->m_DisplayZonesMode = 1;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY:
displ_opts->m_DisplayZonesMode = 2;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
displ_opts->m_DisplayViaFill = !state;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
displ_opts->m_DisplayPcbTrackFill = !state;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
{
displ_opts->m_ContrastModeDisplay = state;
m_canvas->Refresh();
break;
}
case ID_TB_OPTIONS_CURVED_RATSNEST_LINES:
displ_opts->m_DisplayRatsnestLinesCurved = !state;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE:
m_show_microwave_tools = state;
m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools );
@ -842,3 +714,141 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break;
}
}
void PCB_EDIT_FRAME::OnUpdateLayerPair( wxUpdateUIEvent& aEvent )
{
PrepareLayerIndicator();
}
void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_TRACK_WIDTH )
{
if( m_SelTrackWidthBox->GetSelection() != (int) GetDesignSettings().GetTrackWidthIndex() )
m_SelTrackWidthBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() );
}
}
void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_VIA_SIZE )
{
if( m_SelViaSizeBox->GetSelection() != (int) GetDesignSettings().GetViaSizeIndex() )
m_SelViaSizeBox->SetSelection( GetDesignSettings().GetViaSizeIndex() );
}
}
void PCB_EDIT_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
{
m_SelLayerBox->SetLayerSelection( GetActiveLayer() );
}
#if defined( KICAD_SCRIPTING_WXPYTHON )
// Used only when the DKICAD_SCRIPTING_WXPYTHON option is on
void PCB_EDIT_FRAME::OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetEventObject() != m_mainToolBar )
return;
wxMiniFrame* pythonPanelFrame = (wxMiniFrame *) findPythonConsole();
bool pythonPanelShown = pythonPanelFrame ? pythonPanelFrame->IsShown() : false;
aEvent.Check( pythonPanelShown );
}
#endif
void PCB_EDIT_FRAME::OnUpdateDrcEnable( wxUpdateUIEvent& aEvent )
{
bool state = !Settings().m_legacyDrcOn;
aEvent.Check( state );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF,
Settings().m_legacyDrcOn ?
_( "Disable design rule checking while routing/editing tracks using Legacy Toolset.\nUse Route > Interactive Router Settings... for Modern Toolset." ) :
_( "Enable design rule checking while routing/editing tracks using Legacy Toolset.\nUse Route > Interactive Router Settings... for Modern Toolset." ) );
}
bool PCB_EDIT_FRAME::LayerManagerShown()
{
return m_auimgr.GetPane( "LayersManager" ).IsShown();
}
bool PCB_EDIT_FRAME::MicrowaveToolbarShown()
{
return m_auimgr.GetPane( "MicrowaveToolbar" ).IsShown();
}
void PCB_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( GetScreen()->IsModify() );
}
void PCB_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetEventObject() == m_drawToolBar || aEvent.GetEventObject() == m_mainToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() );
}
void PCB_EDIT_FRAME::OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetEventObject() == m_microWaveToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() );
}
void PCB_EDIT_FRAME::SyncMenusAndToolbars()
{
PCB_DISPLAY_OPTIONS* opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions();
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
int zoneMode = opts->m_DisplayZonesMode;
m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 );
m_mainToolBar->Toggle( ACTIONS::redo, GetScreen() && GetScreen()->GetRedoCommandCount() > 0 );
m_mainToolBar->Toggle( ACTIONS::zoomTool, GetToolId() == ID_ZOOM_SELECTION );
m_mainToolBar->Refresh();
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, !galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( PCB_ACTIONS::showRatsnest, GetBoard()->IsElementVisible( LAYER_RATSNEST ) );
m_optionsToolBar->Toggle( PCB_ACTIONS::ratsnestLineMode, opts->m_DisplayRatsnestLinesCurved );
m_optionsToolBar->Toggle( PCB_ACTIONS::zoneDisplayEnable, zoneMode == 0 );
m_optionsToolBar->Toggle( PCB_ACTIONS::zoneDisplayDisable, zoneMode == 1 );
m_optionsToolBar->Toggle( PCB_ACTIONS::zoneDisplayOutlines, zoneMode == 2 );
m_optionsToolBar->Toggle( PCB_ACTIONS::trackDisplayMode, !opts->m_DisplayPcbTrackFill );
m_optionsToolBar->Toggle( PCB_ACTIONS::viaDisplayMode, !opts->m_DisplayViaFill );
m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts->m_DisplayPadFill );
m_optionsToolBar->Toggle( PCB_ACTIONS::highContrastMode, opts->m_ContrastModeDisplay );
m_optionsToolBar->Refresh();
m_drawToolBar->Toggle( PCB_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED );
m_drawToolBar->Toggle( PCB_ACTIONS::highlightNetTool, GetToolId() == ID_PCB_HIGHLIGHT_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::localRatsnestTool,GetToolId() == ID_LOCAL_RATSNEST_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::placeModule, GetToolId() == ID_PCB_MODULE_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::routerActivateSingle, GetToolId() == ID_TRACK_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::drawVia, GetToolId() == ID_PCB_DRAW_VIA_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::drawZone, GetToolId() == ID_PCB_ZONES_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::drawZoneKeepout, GetToolId() == ID_PCB_KEEPOUT_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::drawLine, GetToolId() == ID_PCB_ADD_LINE_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::drawCircle, GetToolId() == ID_PCB_CIRCLE_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::drawArc, GetToolId() == ID_PCB_ARC_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::drawPolygon, GetToolId() == ID_PCB_ADD_POLYGON_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::placeText, GetToolId() == ID_PCB_ADD_TEXT_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::drawDimension, GetToolId() == ID_PCB_DIMENSION_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::placeTarget, GetToolId() == ID_PCB_TARGET_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::deleteTool, GetToolId() == ID_PCB_DELETE_ITEM_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::drillOrigin, GetToolId() == ID_PCB_PLACE_OFFSET_COORD_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::gridSetOrigin, GetToolId() == ID_PCB_PLACE_GRID_COORD_BUTT );
m_drawToolBar->Toggle( PCB_ACTIONS::measureTool, GetToolId() == ID_PCB_MEASUREMENT_TOOL );
m_drawToolBar->Refresh();
}

View File

@ -1,155 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2012-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <pgm_base.h>
#include <class_drawpanel.h>
#include <pcb_edit_frame.h>
#include <dialog_helpers.h>
#include <class_board.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <tool/actions.h>
#include <drc.h>
#include <pcb_layer_box_selector.h>
void PCB_EDIT_FRAME::OnUpdateLayerPair( wxUpdateUIEvent& aEvent )
{
PrepareLayerIndicator();
}
void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_TRACK_WIDTH )
{
if( m_SelTrackWidthBox->GetSelection() != (int) GetDesignSettings().GetTrackWidthIndex() )
m_SelTrackWidthBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() );
}
}
void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_VIA_SIZE )
{
if( m_SelViaSizeBox->GetSelection() != (int) GetDesignSettings().GetViaSizeIndex() )
m_SelViaSizeBox->SetSelection( GetDesignSettings().GetViaSizeIndex() );
}
}
void PCB_EDIT_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
{
m_SelLayerBox->SetLayerSelection( GetActiveLayer() );
}
#if defined( KICAD_SCRIPTING_WXPYTHON )
// Used only when the DKICAD_SCRIPTING_WXPYTHON option is on
void PCB_EDIT_FRAME::OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetEventObject() != m_mainToolBar )
return;
wxMiniFrame* pythonPanelFrame = (wxMiniFrame *) findPythonConsole();
bool pythonPanelShown = pythonPanelFrame ? pythonPanelFrame->IsShown() : false;
aEvent.Check( pythonPanelShown );
}
#endif
void PCB_EDIT_FRAME::OnUpdateDrcEnable( wxUpdateUIEvent& aEvent )
{
bool state = !Settings().m_legacyDrcOn;
aEvent.Check( state );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF,
Settings().m_legacyDrcOn ?
_( "Disable design rule checking while routing/editing tracks using Legacy Toolset.\nUse Route > Interactive Router Settings... for Modern Toolset." ) :
_( "Enable design rule checking while routing/editing tracks using Legacy Toolset.\nUse Route > Interactive Router Settings... for Modern Toolset." ) );
}
void PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( displ_opts->m_ContrastModeDisplay );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
displ_opts->m_ContrastModeDisplay ?
_( "Normal contrast display mode" ) :
_( "High contrast display mode" ) );
}
bool PCB_EDIT_FRAME::LayerManagerShown()
{
return m_auimgr.GetPane( "LayersManager" ).IsShown();
}
bool PCB_EDIT_FRAME::MicrowaveToolbarShown()
{
return m_auimgr.GetPane( "MicrowaveToolbar" ).IsShown();
}
void PCB_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( GetScreen()->IsModify() );
}
void PCB_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetEventObject() == m_drawToolBar || aEvent.GetEventObject() == m_mainToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() );
}
void PCB_EDIT_FRAME::OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetEventObject() == m_microWaveToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() );
}
void PCB_EDIT_FRAME::SyncMenusAndToolbars()
{
PCB_DISPLAY_OPTIONS* opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions();
int zoneMode = opts->m_DisplayZonesMode;
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES, zoneMode == 0 );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, zoneMode == 1 );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, zoneMode == 2 );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, !opts->m_DisplayPcbTrackFill );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, !opts->m_DisplayViaFill );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, !opts->m_DisplayPadFill );
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
m_optionsToolBar->Refresh();
}

View File

@ -67,39 +67,48 @@ using SCOPED_DRAW_MODE = SCOPED_SET_RESET<DRAWING_TOOL::MODE>;
// Drawing tool actions
TOOL_ACTION PCB_ACTIONS::drawLine( "pcbnew.InteractiveDrawing.line",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_LINE ),
_( "Draw Line" ), _( "Draw a line" ), NULL, AF_ACTIVATE );
_( "Draw Line" ), _( "Draw a line" ),
add_polygon_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drawGraphicPolygon( "pcbnew.InteractiveDrawing.graphicPolygon",
TOOL_ACTION PCB_ACTIONS::drawPolygon( "pcbnew.InteractiveDrawing.graphicPolygon",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_POLYGON ),
_( "Draw Graphic Polygon" ), _( "Draw a graphic polygon" ), NULL, AF_ACTIVATE );
_( "Draw Graphic Polygon" ), _( "Draw a graphic polygon" ),
add_polygon_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drawCircle( "pcbnew.InteractiveDrawing.circle",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_CIRCLE ),
_( "Draw Circle" ), _( "Draw a circle" ), NULL, AF_ACTIVATE );
_( "Draw Circle" ), _( "Draw a circle" ),
add_circle_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drawArc( "pcbnew.InteractiveDrawing.arc",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_ARC ),
_( "Draw Arc" ), _( "Draw an arc" ), NULL, AF_ACTIVATE );
_( "Draw Arc" ), _( "Draw an arc" ),
add_arc_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::placeText( "pcbnew.InteractiveDrawing.text",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_TEXT ),
_( "Add Text" ), _( "Add a text" ), NULL, AF_ACTIVATE );
_( "Add Text" ), _( "Add a text item" ),
text_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drawDimension( "pcbnew.InteractiveDrawing.dimension",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_DIMENSION ),
_( "Add Dimension" ), _( "Add a dimension" ), NULL, AF_ACTIVATE );
_( "Add Dimension" ), _( "Add a dimension" ),
add_dimension_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drawZone( "pcbnew.InteractiveDrawing.zone",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_ZONE ),
_( "Add Filled Zone" ), _( "Add a filled zone" ), NULL, AF_ACTIVATE );
_( "Add Filled Zone" ), _( "Add a filled zone" ),
add_zone_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drawVia( "pcbnew.InteractiveDrawing.via",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_FREE_VIA ),
_( "Add Vias" ), _( "Add free-standing vias" ), NULL, AF_ACTIVATE );
_( "Add Vias" ), _( "Add free-standing vias" ),
add_via_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drawZoneKeepout( "pcbnew.InteractiveDrawing.keepout",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_KEEPOUT ),
_( "Add Keepout Area" ), _( "Add a keepout area" ), NULL, AF_ACTIVATE );
_( "Add Keepout Area" ), _( "Add a keepout area" ),
add_keepout_area_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drawZoneCutout( "pcbnew.InteractiveDrawing.zoneCutout",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_CUTOUT ),
@ -113,12 +122,13 @@ TOOL_ACTION PCB_ACTIONS::drawSimilarZone( "pcbnew.InteractiveDrawing.similarZone
TOOL_ACTION PCB_ACTIONS::placeImportedGraphics( "pcbnew.InteractiveDrawing.placeImportedGraphics",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_DXF ),
"Place Imported Graphics", "", NULL, AF_ACTIVATE );
_( "Place Imported Graphics" ), "",
import_vector_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::setAnchor( "pcbnew.InteractiveDrawing.setAnchor",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_ANCHOR ),
_( "Place the Footprint Anchor" ), _( "Place the footprint anchor" ),
NULL, AF_ACTIVATE );
_( "Place the Footprint Anchor" ), "",
anchor_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::incWidth( "pcbnew.InteractiveDrawing.incWidth",
AS_CONTEXT, TOOL_ACTION::LegacyHotKey( HK_INC_LINE_WIDTH ),
@ -704,7 +714,7 @@ int DRAWING_TOOL::DrawZoneKeepout( const TOOL_EVENT& aEvent )
{
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::KEEPOUT );
m_frame->SetToolID( ID_PCB_KEEPOUT_AREA_BUTT, wxCURSOR_PENCIL, _( "Add keepout" ) );
m_frame->SetToolID( ID_PCB_KEEPOUT_BUTT, wxCURSOR_PENCIL, _( "Add keepout" ) );
return drawZone( true, ZONE_MODE::ADD );
}
@ -1778,7 +1788,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
void DRAWING_TOOL::setTransitions()
{
Go( &DRAWING_TOOL::DrawLine, PCB_ACTIONS::drawLine.MakeEvent() );
Go( &DRAWING_TOOL::DrawGraphicPolygon, PCB_ACTIONS::drawGraphicPolygon.MakeEvent() );
Go( &DRAWING_TOOL::DrawGraphicPolygon, PCB_ACTIONS::drawPolygon.MakeEvent() );
Go( &DRAWING_TOOL::DrawCircle, PCB_ACTIONS::drawCircle.MakeEvent() );
Go( &DRAWING_TOOL::DrawArc, PCB_ACTIONS::drawArc.MakeEvent() );
Go( &DRAWING_TOOL::DrawDimension, PCB_ACTIONS::drawDimension.MakeEvent() );

View File

@ -58,17 +58,12 @@ using namespace std::placeholders;
#include "grid_helper.h"
#include "kicad_clipboard.h"
#include "pcbnew_control.h"
#include <router/router_tool.h>
#include <dialogs/dialog_move_exact.h>
#include <dialogs/dialog_track_via_properties.h>
#include <dialogs/dialog_exchange_footprints.h>
#include <tools/tool_event_utils.h>
#include <preview_items/ruler_item.h>
#include <board_commit.h>
@ -81,19 +76,23 @@ TOOL_ACTION PCB_ACTIONS::editFootprintInFpEditor( "pcbnew.InteractiveEdit.editFo
TOOL_ACTION PCB_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
AS_GLOBAL, 0,
_( "Edit Activate" ), "", move_xpm, AF_ACTIVATE );
_( "Edit Activate" ), "",
move_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::move( "pcbnew.InteractiveEdit.move",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MOVE_ITEM ),
_( "Move" ), _( "Moves the selected item(s)" ), move_xpm, AF_ACTIVATE );
_( "Move" ), _( "Moves the selected item(s)" ),
move_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::duplicate( "pcbnew.InteractiveEdit.duplicate",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DUPLICATE ),
_( "Duplicate" ), _( "Duplicates the selected item(s)" ), duplicate_xpm );
_( "Duplicate" ), _( "Duplicates the selected item(s)" ),
duplicate_xpm );
TOOL_ACTION PCB_ACTIONS::duplicateIncrement( "pcbnew.InteractiveEdit.duplicateIncrementPads",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DUPLICATE_ITEM_AND_INCREMENT ),
_( "Duplicate" ), _( "Duplicates the selected item(s), incrementing pad numbers" ) );
_( "Duplicate" ), _( "Duplicates the selected item(s), incrementing pad numbers" ),
duplicate_xpm );
TOOL_ACTION PCB_ACTIONS::moveExact( "pcbnew.InteractiveEdit.moveExact",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MOVE_ITEM_EXACT ),
@ -102,7 +101,8 @@ TOOL_ACTION PCB_ACTIONS::moveExact( "pcbnew.InteractiveEdit.moveExact",
TOOL_ACTION PCB_ACTIONS::createArray( "pcbnew.InteractiveEdit.createArray",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CREATE_ARRAY ),
_( "Create Array..." ), _( "Create array" ), array_xpm, AF_ACTIVATE );
_( "Create Array..." ), _( "Create array" ),
array_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::rotateCw( "pcbnew.InteractiveEdit.rotateCw",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROTATE_ITEM_CLOCKWISE ),
@ -116,16 +116,18 @@ TOOL_ACTION PCB_ACTIONS::rotateCcw( "pcbnew.InteractiveEdit.rotateCcw",
TOOL_ACTION PCB_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_FLIP_ITEM ),
_( "Flip" ), _( "Flips selected item(s)" ), swap_layer_xpm );
_( "Flip" ), _( "Flips selected item(s)" ),
swap_layer_xpm );
TOOL_ACTION PCB_ACTIONS::mirror( "pcbnew.InteractiveEdit.mirror",
AS_GLOBAL, 0,
_( "Mirror" ), _( "Mirrors selected item" ), mirror_h_xpm );
_( "Mirror" ), _( "Mirrors selected item" ),
mirror_h_xpm );
TOOL_ACTION PCB_ACTIONS::remove( "pcbnew.InteractiveEdit.remove",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_BACK_SPACE ),
_( "Delete" ), _( "Deletes selected item(s)" ), delete_xpm,
AF_NONE, (void*) REMOVE_FLAGS::NORMAL );
_( "Delete" ), _( "Deletes selected item(s)" ),
delete_xpm, AF_NONE, (void*) REMOVE_FLAGS::NORMAL );
TOOL_ACTION PCB_ACTIONS::removeAlt( "pcbnew.InteractiveEdit.removeAlt",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DELETE ),
@ -144,12 +146,13 @@ TOOL_ACTION PCB_ACTIONS::exchangeFootprints( "pcbnew.InteractiveEdit.ExchangeFoo
TOOL_ACTION PCB_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_ITEM ),
_( "Properties..." ), _( "Displays item properties dialog" ), config_xpm );
_( "Properties..." ), _( "Displays item properties dialog" ),
config_xpm );
TOOL_ACTION PCB_ACTIONS::measureTool( "pcbnew.InteractiveEdit.measureTool",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MEASURE_TOOL ),
_( "Measuring Tool" ), _( "Interactively measure distance between points" ),
nullptr, AF_ACTIVATE );
measurement_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::updateUnits( "pcbnew.InteractiveEdit.updateUnits",
AS_GLOBAL, 0,

View File

@ -61,7 +61,8 @@ using namespace std::placeholders;
// Module editor tools
TOOL_ACTION PCB_ACTIONS::placePad( "pcbnew.ModuleEditor.placePad",
AS_GLOBAL, 0,
_( "Add Pad" ), _( "Add a pad" ), NULL, AF_ACTIVATE );
_( "Add Pad" ), _( "Add a pad" ),
pad_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::createPadFromShapes( "pcbnew.ModuleEditor.createPadFromShapes",
AS_CONTEXT, 0,

View File

@ -33,12 +33,6 @@ OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
{
switch( aId )
{
case ID_PCB_MODULE_BUTT:
return PCB_ACTIONS::placeModule.MakeEvent();
case ID_TRACK_BUTT:
return PCB_ACTIONS::routerActivateSingle.MakeEvent();
case ID_DIFF_PAIR_BUTT:
return PCB_ACTIONS::routerActivateDiffPair.MakeEvent();
@ -57,148 +51,24 @@ OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
case ID_MENU_DIFF_PAIR_DIMENSIONS:
return PCB_ACTIONS::routerActivateDpDimensionsDialog.MakeEvent();
case ID_PCB_ZONES_BUTT:
return PCB_ACTIONS::drawZone.MakeEvent();
case ID_PCB_DRAW_VIA_BUTT:
return PCB_ACTIONS::drawVia.MakeEvent();
case ID_PCB_KEEPOUT_AREA_BUTT:
return PCB_ACTIONS::drawZoneKeepout.MakeEvent();
case ID_PCB_ADD_LINE_BUTT:
case ID_MODEDIT_LINE_TOOL:
return PCB_ACTIONS::drawLine.MakeEvent();
case ID_PCB_ADD_POLYGON_BUTT:
case ID_MODEDIT_POLYGON_TOOL:
return PCB_ACTIONS::drawGraphicPolygon.MakeEvent();
case ID_PCB_CIRCLE_BUTT:
case ID_MODEDIT_CIRCLE_TOOL:
return PCB_ACTIONS::drawCircle.MakeEvent();
case ID_PCB_ARC_BUTT:
case ID_MODEDIT_ARC_TOOL:
return PCB_ACTIONS::drawArc.MakeEvent();
case ID_PCB_ADD_TEXT_BUTT:
case ID_MODEDIT_TEXT_TOOL:
return PCB_ACTIONS::placeText.MakeEvent();
case ID_PCB_DIMENSION_BUTT:
return PCB_ACTIONS::drawDimension.MakeEvent();
case ID_PCB_TARGET_BUTT:
return PCB_ACTIONS::placeTarget.MakeEvent();
case ID_MODEDIT_PAD_TOOL:
return PCB_ACTIONS::placePad.MakeEvent();
case ID_GEN_IMPORT_GRAPHICS_FILE:
return PCB_ACTIONS::placeImportedGraphics.MakeEvent();
case ID_MODEDIT_ANCHOR_TOOL:
return PCB_ACTIONS::setAnchor.MakeEvent();
case ID_PCB_PLACE_GRID_COORD_BUTT:
case ID_MODEDIT_PLACE_GRID_COORD:
return ACTIONS::gridSetOrigin.MakeEvent();
case ID_POPUP_GRID_NEXT:
return ACTIONS::gridNext.MakeEvent();
case ID_POPUP_GRID_PREV:
return ACTIONS::gridPrev.MakeEvent();
case ID_ZOOM_REDRAW:
case ID_POPUP_ZOOM_REDRAW:
case ID_VIEWER_ZOOM_REDRAW:
return ACTIONS::zoomRedraw.MakeEvent();
case ID_ZOOM_IN: // toolbar button "Zoom In"
case ID_VIEWER_ZOOM_IN:
return ACTIONS::zoomInCenter.MakeEvent();
case ID_ZOOM_OUT: // toolbar button "Zoom In"
case ID_VIEWER_ZOOM_OUT:
return ACTIONS::zoomOutCenter.MakeEvent();
case ID_ZOOM_PAGE: // toolbar button "Fit on Screen"
case ID_VIEWER_ZOOM_PAGE:
return ACTIONS::zoomFitScreen.MakeEvent();
case ID_TB_OPTIONS_CURVED_RATSNEST_LINES:
return PCB_ACTIONS::ratsnestLineMode.MakeEvent();
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
return PCB_ACTIONS::trackDisplayMode.MakeEvent();
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
return PCB_ACTIONS::padDisplayMode.MakeEvent();
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
return PCB_ACTIONS::viaDisplayMode.MakeEvent();
case ID_TB_OPTIONS_SHOW_ZONES:
return PCB_ACTIONS::zoneDisplayEnable.MakeEvent();
case ID_TB_OPTIONS_SHOW_ZONES_DISABLE:
return PCB_ACTIONS::zoneDisplayDisable.MakeEvent();
case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY:
return PCB_ACTIONS::zoneDisplayOutlines.MakeEvent();
case ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH:;
return PCB_ACTIONS::graphicDisplayMode.MakeEvent();
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
return PCB_ACTIONS::moduleEdgeOutlines.MakeEvent();
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:;
return PCB_ACTIONS::moduleTextOutlines.MakeEvent();
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
return PCB_ACTIONS::highContrastMode.MakeEvent();
case ID_DEC_LAYER_ALPHA:
return PCB_ACTIONS::layerAlphaDec.MakeEvent();
case ID_INC_LAYER_ALPHA:
return PCB_ACTIONS::layerAlphaInc.MakeEvent();
case ID_FIND_ITEMS:
return PCB_ACTIONS::find.MakeEvent();
case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST:
return PCB_ACTIONS::findMove.MakeEvent();
case ID_NO_TOOL_SELECTED:
return PCB_ACTIONS::selectionTool.MakeEvent();
case ID_ZOOM_SELECTION:
return ACTIONS::zoomTool.MakeEvent();
case ID_PCB_DELETE_ITEM_BUTT:
case ID_MODEDIT_DELETE_TOOL:
return PCB_ACTIONS::deleteItemCursor.MakeEvent();
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
return PCB_ACTIONS::drillOrigin.MakeEvent();
case ID_PCB_MEASUREMENT_TOOL:
case ID_MODEDIT_MEASUREMENT_TOOL:
return PCB_ACTIONS::measureTool.MakeEvent();
case ID_PCB_HIGHLIGHT_BUTT:
return PCB_ACTIONS::highlightNetCursor.MakeEvent();
case ID_APPEND_FILE:
return PCB_ACTIONS::appendBoard.MakeEvent();
case ID_PCB_SHOW_1_RATSNEST_BUTT:
return PCB_ACTIONS::showLocalRatsnest.MakeEvent();
case ID_PCB_MUWAVE_TOOL_GAP_CMD:
return PCB_ACTIONS::microwaveCreateGap.MakeEvent();
@ -213,28 +83,6 @@ OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
return PCB_ACTIONS::microwaveCreateLine.MakeEvent();
case ID_EDIT_CUT:
return ACTIONS::cut.MakeEvent();
case ID_EDIT_COPY:
return ACTIONS::copy.MakeEvent();
case ID_EDIT_PASTE:
return PCB_ACTIONS::paste.MakeEvent();
case ID_POPUP_PCB_FILL_ALL_ZONES:
return PCB_ACTIONS::zoneFillAll.MakeEvent();
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES:
return PCB_ACTIONS::zoneUnfillAll.MakeEvent();
case ID_POPUP_PCB_AUTOPLACE_OFF_BOARD_MODULES:
return PCB_ACTIONS::autoplaceOffboardComponents.MakeEvent();
case ID_POPUP_PCB_AUTOPLACE_SELECTED_MODULES:
return PCB_ACTIONS::autoplaceSelectedComponents.MakeEvent();
}
return OPT<TOOL_EVENT>();

View File

@ -135,7 +135,7 @@ public:
// Drawing Tool Activations
static TOOL_ACTION drawLine;
static TOOL_ACTION drawGraphicPolygon;
static TOOL_ACTION drawPolygon;
static TOOL_ACTION drawCircle;
static TOOL_ACTION drawArc;
static TOOL_ACTION placeText;
@ -209,6 +209,7 @@ public:
static TOOL_ACTION selectpositionRelativeItem;
// Display modes
static TOOL_ACTION showRatsnest;
static TOOL_ACTION ratsnestLineMode;
static TOOL_ACTION trackDisplayMode;
static TOOL_ACTION padDisplayMode;
@ -272,9 +273,6 @@ public:
/// Display module edges as outlines
static TOOL_ACTION moduleEdgeOutlines;
/// Display module texts as outlines
static TOOL_ACTION moduleTextOutlines;
// Pad tools
/// Copy the selected pad's settings to the board design settings
static TOOL_ACTION copyPadSettings;
@ -307,10 +305,10 @@ public:
static TOOL_ACTION resetCoords;
static TOOL_ACTION measureTool;
static TOOL_ACTION updateUnits;
static TOOL_ACTION deleteItemCursor;
static TOOL_ACTION deleteTool;
static TOOL_ACTION clearHighlight;
static TOOL_ACTION highlightNet;
static TOOL_ACTION highlightNetCursor;
static TOOL_ACTION highlightNetTool;
static TOOL_ACTION highlightNetSelection;
static TOOL_ACTION drillOrigin;
static TOOL_ACTION crossProbeSchToPcb;
@ -319,7 +317,7 @@ public:
static TOOL_ACTION toBeDone;
// Ratsnest
static TOOL_ACTION showLocalRatsnest;
static TOOL_ACTION localRatsnestTool;
static TOOL_ACTION hideLocalRatsnest;
static TOOL_ACTION updateLocalRatsnest;

View File

@ -59,6 +59,7 @@
#include <origin_viewitem.h>
#include <profile.h>
#include <widgets/progress_reporter.h>
#include <dialogs/dialog_find.h>
using namespace std::placeholders;
@ -82,7 +83,8 @@ TOOL_ACTION PCB_ACTIONS::viaSizeDec( "pcbnew.EditorControl.viaSizeDec",
TOOL_ACTION PCB_ACTIONS::trackViaSizeChanged( "pcbnew.EditorControl.trackViaSizeChanged",
AS_GLOBAL, 0,
"", "", NULL, AF_NOTIFY );
"", "",
nullptr, AF_NOTIFY );
TOOL_ACTION PCB_ACTIONS::zoneMerge( "pcbnew.EditorControl.zoneMerge",
AS_GLOBAL, 0,
@ -95,15 +97,18 @@ TOOL_ACTION PCB_ACTIONS::zoneDuplicate( "pcbnew.EditorControl.zoneDuplicate",
TOOL_ACTION PCB_ACTIONS::placeTarget( "pcbnew.EditorControl.placeTarget",
AS_GLOBAL, 0,
_( "Add Layer Alignment Target" ), _( "Add a layer alignment target" ), NULL, AF_ACTIVATE );
_( "Add Layer Alignment Target" ), _( "Add a layer alignment target" ),
add_pcb_target_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::placeModule( "pcbnew.EditorControl.placeModule",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_MODULE ),
_( "Add Footprint" ), _( "Add a footprint" ), NULL, AF_ACTIVATE );
_( "Add Footprint" ), _( "Add a footprint" ),
module_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drillOrigin( "pcbnew.EditorControl.drillOrigin",
AS_GLOBAL, 0,
"", "" );
_( "Drill and Place Offset" ), _( "Place origin point for drill and place files" ),
pcb_offset_xpm );
TOOL_ACTION PCB_ACTIONS::crossProbeSchToPcb( "pcbnew.EditorControl.crossProbSchToPcb",
AS_GLOBAL, 0,
@ -111,15 +116,18 @@ TOOL_ACTION PCB_ACTIONS::crossProbeSchToPcb( "pcbnew.EditorControl.crossProbSchT
TOOL_ACTION PCB_ACTIONS::toggleLock( "pcbnew.EditorControl.toggleLock",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LOCK_UNLOCK_FOOTPRINT ),
"Toggle Lock", "", lock_unlock_xpm );
"Toggle Lock", "",
lock_unlock_xpm );
TOOL_ACTION PCB_ACTIONS::lock( "pcbnew.EditorControl.lock",
AS_GLOBAL, 0,
_( "Lock" ), "", locked_xpm );
_( "Lock" ), "",
locked_xpm );
TOOL_ACTION PCB_ACTIONS::unlock( "pcbnew.EditorControl.unlock",
AS_GLOBAL, 0,
_( "Unlock" ), "", unlocked_xpm );
_( "Unlock" ), "",
unlocked_xpm );
TOOL_ACTION PCB_ACTIONS::appendBoard( "pcbnew.EditorControl.appendBoard",
AS_GLOBAL, 0,
@ -133,18 +141,20 @@ TOOL_ACTION PCB_ACTIONS::clearHighlight( "pcbnew.EditorControl.clearHighlight",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION PCB_ACTIONS::highlightNetCursor( "pcbnew.EditorControl.highlightNetCursor",
TOOL_ACTION PCB_ACTIONS::highlightNetTool( "pcbnew.EditorControl.highlightNetTool",
AS_GLOBAL, 0,
"Highlight Nets", "Highlight all copper items of a net",
_( "Highlight Nets" ), _( "Highlight all copper items of a net" ),
net_highlight_xpm );
TOOL_ACTION PCB_ACTIONS::highlightNetSelection( "pcbnew.EditorControl.highlightNetSelection",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHLIGHT_NET_SELECTION ),
"", "" );
_( "Highlight Net" ), _( "Highlight all copper items of a net" ),
net_highlight_xpm );
TOOL_ACTION PCB_ACTIONS::showLocalRatsnest( "pcbnew.Control.showLocalRatsnest",
TOOL_ACTION PCB_ACTIONS::localRatsnestTool( "pcbnew.Control.localRatsnestTool",
AS_GLOBAL, 0,
"", "" );
_( "Highlight Ratsnest" ), "",
tool_ratsnest_xpm );
TOOL_ACTION PCB_ACTIONS::hideLocalRatsnest( "pcbnew.Control.hideLocalRatsnest",
AS_GLOBAL, 0,
@ -347,6 +357,15 @@ bool PCB_EDITOR_CONTROL::Init()
}
int PCB_EDITOR_CONTROL::Find( const TOOL_EVENT& aEvent )
{
DIALOG_FIND dlg( m_frame );
dlg.ShowModal();
return 0;
}
// Track & via size control
int PCB_EDITOR_CONTROL::TrackWidthInc( const TOOL_EVENT& aEvent )
{
@ -1146,7 +1165,7 @@ static bool showLocalRatsnest( TOOL_MANAGER* aToolMgr, BOARD* aBoard, const VECT
}
int PCB_EDITOR_CONTROL::ShowLocalRatsnest( const TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
{
Activate();
@ -1155,7 +1174,7 @@ int PCB_EDITOR_CONTROL::ShowLocalRatsnest( const TOOL_EVENT& aEvent )
wxASSERT( picker );
wxASSERT( board );
m_frame->SetToolID( ID_PCB_SHOW_1_RATSNEST_BUTT, wxCURSOR_PENCIL,
m_frame->SetToolID( ID_LOCAL_RATSNEST_BUTT, wxCURSOR_PENCIL,
_( "Pick Components for Local Ratsnest" ) );
picker->SetClickHandler( std::bind( showLocalRatsnest, m_toolMgr, board, _1 ) );
picker->SetFinalizeHandler( [ board ]( int aCondition ){
@ -1262,6 +1281,8 @@ void PCB_EDITOR_CONTROL::calculateSelectionRatsnest()
void PCB_EDITOR_CONTROL::setTransitions()
{
Go( &PCB_EDITOR_CONTROL::Find, ACTIONS::find.MakeEvent() );
// Track & via size control
Go( &PCB_EDITOR_CONTROL::TrackWidthInc, PCB_ACTIONS::trackWidthInc.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::TrackWidthDec, PCB_ACTIONS::trackWidthDec.MakeEvent() );
@ -1287,10 +1308,10 @@ void PCB_EDITOR_CONTROL::setTransitions()
Go( &PCB_EDITOR_CONTROL::DrillOrigin, PCB_ACTIONS::drillOrigin.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HighlightNet, PCB_ACTIONS::highlightNet.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ClearHighlight, PCB_ACTIONS::clearHighlight.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, PCB_ACTIONS::highlightNetCursor.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, PCB_ACTIONS::highlightNetTool.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, PCB_ACTIONS::highlightNetSelection.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ShowLocalRatsnest, PCB_ACTIONS::showLocalRatsnest.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::LocalRatsnestTool, PCB_ACTIONS::localRatsnestTool.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HideSelectionRatsnest, PCB_ACTIONS::hideLocalRatsnest.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::UpdateSelectionRatsnest, PCB_ACTIONS::updateLocalRatsnest.MakeEvent() );
}

View File

@ -51,6 +51,8 @@ public:
/// @copydoc TOOL_INTERACTIVE::Init()
bool Init() override;
int Find( const TOOL_EVENT& aEvent );
// Track & via size control
int TrackWidthInc( const TOOL_EVENT& aEvent );
int TrackWidthDec( const TOOL_EVENT& aEvent );
@ -117,7 +119,7 @@ public:
int HideSelectionRatsnest( const TOOL_EVENT& aEvent );
///> Shows local ratsnest of a component
int ShowLocalRatsnest( const TOOL_EVENT& aEvent );
int LocalRatsnestTool( const TOOL_EVENT& aEvent );
private:
///> Event handler to recalculate dynamic ratsnest

View File

@ -68,49 +68,59 @@ extern IO_MGR::PCB_FILE_T plugin_type( const wxString& aFileName, int aCtl );
// Display modes
TOOL_ACTION PCB_ACTIONS::showRatsnest( "pcbnew.Control.showRatsnest",
AS_GLOBAL, 0,
_( "Show Ratsnest" ), _( "Show board ratsnest" ),
general_ratsnest_xpm );
TOOL_ACTION PCB_ACTIONS::ratsnestLineMode( "pcbnew.Control.ratsnestLineMode",
AS_GLOBAL, 0,
"", "" );
_( "Curved Ratsnest Lines" ), _( "Show ratsnest with curved lines" ),
curved_ratsnest_xpm );
TOOL_ACTION PCB_ACTIONS::trackDisplayMode( "pcbnew.Control.trackDisplayMode",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_DISPLAY_MODE ),
"", "" );
_( "Sketch Tracks" ), _( "Show tracks in outline mode" ),
showtrack_xpm );
TOOL_ACTION PCB_ACTIONS::padDisplayMode( "pcbnew.Control.padDisplayMode",
AS_GLOBAL, 0,
"", "" );
_( "Sketch Pads" ), _( "Show pads in outline mode" ),
pad_sketch_xpm );
TOOL_ACTION PCB_ACTIONS::viaDisplayMode( "pcbnew.Control.viaDisplayMode",
AS_GLOBAL, 0,
"", "" );
_( "Sketch Vias" ), _( "Show vias in outline mode" ),
via_sketch_xpm );
TOOL_ACTION PCB_ACTIONS::graphicDisplayMode( "pcbnew.Control.graphicDisplayMode",
AS_GLOBAL, 0,
"", "" );
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION PCB_ACTIONS::moduleEdgeOutlines( "pcbnew.Control.graphicOutlines",
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION PCB_ACTIONS::moduleTextOutlines( "pcbnew.Control.textOutlines",
AS_GLOBAL, 0,
"", "" );
_( "Sketch Graphics" ), _( "Show footprint graphic items in outline mode" ),
show_mod_edge_xpm );
TOOL_ACTION PCB_ACTIONS::zoneDisplayEnable( "pcbnew.Control.zoneDisplayEnable",
AS_GLOBAL, 0,
"", "" );
_( "Fill Zones" ), _( "Show filled areas of zones" ),
show_zone_xpm);
TOOL_ACTION PCB_ACTIONS::zoneDisplayDisable( "pcbnew.Control.zoneDisplayDisable",
AS_GLOBAL, 0,
"", "" );
_( "Wireframe Zones" ), _( "Show only zone boundaries" ),
show_zone_disable_xpm );
TOOL_ACTION PCB_ACTIONS::zoneDisplayOutlines( "pcbnew.Control.zoneDisplayOutlines",
AS_GLOBAL, 0,
"", "" );
_( "Sketch Zones" ), _( "Outline filled areas of zones" ),
show_zone_outline_only_xpm);
TOOL_ACTION PCB_ACTIONS::highContrastMode( "pcbnew.Control.highContrastMode",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_HIGHCONTRAST_MODE ),
"", "" );
_( "High Contrast Mode" ), _( "Use high contrast display mode" ),
contrast_mode_xpm );
TOOL_ACTION PCB_ACTIONS::highContrastInc( "pcbnew.Control.highContrastInc",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHCONTRAST_INC ),
@ -168,28 +178,33 @@ TOOL_ACTION PCB_ACTIONS::layerToggle( "pcbnew.Control.layerToggle",
TOOL_ACTION PCB_ACTIONS::layerAlphaInc( "pcbnew.Control.layerAlphaInc",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_INC_LAYER_ALPHA ),
"", "" );
_( "Increase Layer Opacity" ), _( "Make the current layer more transparent" ),
contrast_mode_xpm );
TOOL_ACTION PCB_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DEC_LAYER_ALPHA ),
"", "" );
_( "Decrease Layer Opacity" ), _( "Make the current layer more transparent" ),
contrast_mode_xpm );
TOOL_ACTION PCB_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
AS_GLOBAL, 0,
"", "", NULL, AF_NOTIFY );
"", "",
NULL, AF_NOTIFY );
// Miscellaneous
TOOL_ACTION PCB_ACTIONS::selectionTool( "pcbnew.Control.selectionTool",
AS_GLOBAL, 0,
"", "", NULL, AF_ACTIVATE );
_( "Select item(s)" ), "",
cursor_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::resetCoords( "pcbnew.Control.resetCoords",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_LOCAL_COORD ),
"", "" );
TOOL_ACTION PCB_ACTIONS::deleteItemCursor( "pcbnew.Control.deleteItemCursor",
TOOL_ACTION PCB_ACTIONS::deleteTool( "pcbnew.Control.deleteTool",
AS_GLOBAL, 0,
"", "" );
_( "Delete Items Tool" ), _( "Click on items to delete them" ),
delete_xpm );
TOOL_ACTION PCB_ACTIONS::showHelp( "pcbnew.Control.showHelp",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HELP ),
@ -248,18 +263,29 @@ int PCBNEW_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent )
return 0;
}
int PCBNEW_CONTROL::RatsnestLineMode( const TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::ToggleRatsnest( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
Flip( opts->m_DisplayRatsnestLinesCurved );
view()->UpdateDisplayOptions( opts );
if( aEvent.IsAction( &PCB_ACTIONS::showRatsnest ) )
{
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) m_frame;
frame->SetElementVisibility( LAYER_RATSNEST, !frame->IsElementVisible( LAYER_RATSNEST ) );
}
else if( aEvent.IsAction( &PCB_ACTIONS::ratsnestLineMode ) )
{
Flip( opts->m_DisplayRatsnestLinesCurved );
view()->UpdateDisplayOptions( opts );
}
canvas()->RedrawRatsnest();
canvas()->Refresh();
return 0;
}
int PCBNEW_CONTROL::PadDisplayMode( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
@ -338,31 +364,6 @@ int PCBNEW_CONTROL::ModuleEdgeOutlines( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::ModuleTextOutlines( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
Flip( opts->m_DisplayModTextFill );
view()->UpdateDisplayOptions( opts );
for( auto module : board()->Modules() )
{
for( auto item : module->GraphicalItems() )
{
if( item->Type() == PCB_MODULE_TEXT_T )
view()->Update( item, KIGFX::GEOMETRY );
}
view()->Update( &module->Reference(), KIGFX::GEOMETRY );
view()->Update( &module->Value(), KIGFX::GEOMETRY );
}
canvas()->Refresh();
return 0;
}
int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
@ -666,7 +667,7 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::PasteItemsFromClipboard( const TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
{
CLIPBOARD_IO pi;
BOARD_ITEM* clipItem = pi.Parse();
@ -990,60 +991,6 @@ int PCBNEW_CONTROL::ToBeDone( const TOOL_EVENT& aEvent )
}
void PCBNEW_CONTROL::setTransitions()
{
// Display modes
Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::RatsnestLineMode, PCB_ACTIONS::ratsnestLineMode.MakeEvent() );
Go( &PCBNEW_CONTROL::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ModuleEdgeOutlines, PCB_ACTIONS::moduleEdgeOutlines.MakeEvent() );
Go( &PCBNEW_CONTROL::ModuleTextOutlines, PCB_ACTIONS::moduleTextOutlines.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastMode, PCB_ACTIONS::highContrastMode.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastInc, PCB_ACTIONS::highContrastInc.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastDec, PCB_ACTIONS::highContrastDec.MakeEvent() );
// Layer control
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerTop.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner1.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner2.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner3.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner4.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner5.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner6.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerBottom.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerNext, PCB_ACTIONS::layerNext.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerPrev, PCB_ACTIONS::layerPrev.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerToggle, PCB_ACTIONS::layerToggle.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerAlphaInc, PCB_ACTIONS::layerAlphaInc.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerAlphaDec, PCB_ACTIONS::layerAlphaDec.MakeEvent() );
// Grid control
Go( &PCBNEW_CONTROL::GridFast1, ACTIONS::gridFast1.MakeEvent() );
Go( &PCBNEW_CONTROL::GridFast2, ACTIONS::gridFast2.MakeEvent() );
Go( &PCBNEW_CONTROL::GridSetOrigin, ACTIONS::gridSetOrigin.MakeEvent() );
Go( &PCBNEW_CONTROL::GridResetOrigin, ACTIONS::gridResetOrigin.MakeEvent() );
Go( &PCBNEW_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
Go( &PCBNEW_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
// Miscellaneous
Go( &PCBNEW_CONTROL::ResetCoords, PCB_ACTIONS::resetCoords.MakeEvent() );
Go( &PCBNEW_CONTROL::DeleteItemCursor, PCB_ACTIONS::deleteItemCursor.MakeEvent() );
Go( &PCBNEW_CONTROL::ShowHelp, PCB_ACTIONS::showHelp.MakeEvent() );
Go( &PCBNEW_CONTROL::ToBeDone, PCB_ACTIONS::toBeDone.MakeEvent() );
// Append control
Go( &PCBNEW_CONTROL::AppendBoardFromFile, PCB_ACTIONS::appendBoard.MakeEvent() );
Go( &PCBNEW_CONTROL::PasteItemsFromClipboard, PCB_ACTIONS::paste.MakeEvent() );
}
void PCBNEW_CONTROL::updateGrid()
{
BASE_SCREEN* screen = m_frame->GetScreen();
@ -1051,3 +998,59 @@ void PCBNEW_CONTROL::updateGrid()
getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
getView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
void PCBNEW_CONTROL::setTransitions()
{
// Display modes
Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::showRatsnest.MakeEvent() );
Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::ratsnestLineMode.MakeEvent() );
Go( &PCBNEW_CONTROL::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ModuleEdgeOutlines, PCB_ACTIONS::moduleEdgeOutlines.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastMode, PCB_ACTIONS::highContrastMode.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastInc, PCB_ACTIONS::highContrastInc.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastDec, PCB_ACTIONS::highContrastDec.MakeEvent() );
// Layer control
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerTop.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner1.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner2.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner3.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner4.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner5.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner6.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerBottom.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerNext, PCB_ACTIONS::layerNext.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerPrev, PCB_ACTIONS::layerPrev.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerToggle, PCB_ACTIONS::layerToggle.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerAlphaInc, PCB_ACTIONS::layerAlphaInc.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerAlphaDec, PCB_ACTIONS::layerAlphaDec.MakeEvent() );
// Grid control
Go( &PCBNEW_CONTROL::GridFast1, ACTIONS::gridFast1.MakeEvent() );
Go( &PCBNEW_CONTROL::GridFast2, ACTIONS::gridFast2.MakeEvent() );
Go( &PCBNEW_CONTROL::GridSetOrigin, ACTIONS::gridSetOrigin.MakeEvent() );
Go( &PCBNEW_CONTROL::GridResetOrigin, ACTIONS::gridResetOrigin.MakeEvent() );
Go( &PCBNEW_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
Go( &PCBNEW_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
// Miscellaneous
Go( &PCBNEW_CONTROL::ResetCoords, PCB_ACTIONS::resetCoords.MakeEvent() );
Go( &PCBNEW_CONTROL::DeleteItemCursor, PCB_ACTIONS::deleteTool.MakeEvent() );
Go( &PCBNEW_CONTROL::ShowHelp, PCB_ACTIONS::showHelp.MakeEvent() );
Go( &PCBNEW_CONTROL::ToBeDone, PCB_ACTIONS::toBeDone.MakeEvent() );
// Append control
Go( &PCBNEW_CONTROL::AppendBoardFromFile, PCB_ACTIONS::appendBoard.MakeEvent() );
Go( &PCBNEW_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
}

View File

@ -51,14 +51,13 @@ public:
void Reset( RESET_REASON aReason ) override;
// Display modes
int RatsnestLineMode( const TOOL_EVENT& aEvent );
int ToggleRatsnest( const TOOL_EVENT& aEvent );
int ZoneDisplayMode( const TOOL_EVENT& aEvent );
int TrackDisplayMode( const TOOL_EVENT& aEvent );
int PadDisplayMode( const TOOL_EVENT& aEvent );
int ViaDisplayMode( const TOOL_EVENT& aEvent );
int GraphicDisplayMode( const TOOL_EVENT& aEvent );
int ModuleEdgeOutlines( const TOOL_EVENT& aEvent );
int ModuleTextOutlines( const TOOL_EVENT& aEvent );
int HighContrastMode( const TOOL_EVENT& aEvent );
int HighContrastInc( const TOOL_EVENT& aEvent );
int HighContrastDec( const TOOL_EVENT& aEvent );
@ -91,7 +90,7 @@ public:
// Miscellaneous
int ResetCoords( const TOOL_EVENT& aEvent );
int DeleteItemCursor( const TOOL_EVENT& aEvent );
int PasteItemsFromClipboard( const TOOL_EVENT& aEvent );
int Paste( const TOOL_EVENT& aEvent );
int AppendBoardFromFile( const TOOL_EVENT& aEvent );
int AppendBoard( PLUGIN& pi, wxString& fileName );
int ShowHelp( const TOOL_EVENT& aEvent );

View File

@ -123,12 +123,6 @@ TOOL_ACTION PCB_ACTIONS::selectSameSheet( "pcbnew.InteractiveSelection.SelectSam
_( "Selects all modules and tracks in the same schematic sheet" ),
select_same_sheet_xpm );
TOOL_ACTION PCB_ACTIONS::find( "pcbnew.InteractiveSelection.Find",
AS_GLOBAL, 0, //TOOL_ACTION::LegacyHotKey( HK_FIND_ITEM ), // handled by wxWidgets
_( "Find Item..." ),
_( "Searches the document for an item" ),
find_xpm );
TOOL_ACTION PCB_ACTIONS::findMove( "pcbnew.InteractiveSelection.FindMove",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GET_AND_MOVE_FOOTPRINT ),
_( "Get and Move Footprint" ),
@ -2310,7 +2304,7 @@ void SELECTION_TOOL::setTransitions()
Go( &SELECTION_TOOL::UnselectItems, PCB_ACTIONS::unselectItems.MakeEvent() );
Go( &SELECTION_TOOL::SelectionMenu, PCB_ACTIONS::selectionMenu.MakeEvent() );
Go( &SELECTION_TOOL::find, PCB_ACTIONS::find.MakeEvent() );
Go( &SELECTION_TOOL::find, ACTIONS::find.MakeEvent() );
Go( &SELECTION_TOOL::findMove, PCB_ACTIONS::findMove.MakeEvent() );
Go( &SELECTION_TOOL::filterSelection, PCB_ACTIONS::filterSelection.MakeEvent() );

View File

@ -44,19 +44,23 @@
// Zone actions
TOOL_ACTION PCB_ACTIONS::zoneFill( "pcbnew.ZoneFiller.zoneFill",
AS_GLOBAL, 0,
_( "Fill" ), _( "Fill zone(s)" ), fill_zone_xpm );
_( "Fill" ), _( "Fill zone(s)" ),
fill_zone_xpm );
TOOL_ACTION PCB_ACTIONS::zoneFillAll( "pcbnew.ZoneFiller.zoneFillAll",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZONE_FILL_OR_REFILL ),
_( "Fill All" ), _( "Fill all zones" ) );
_( "Fill All" ), _( "Fill all zones" ),
fill_zone_xpm );
TOOL_ACTION PCB_ACTIONS::zoneUnfill( "pcbnew.ZoneFiller.zoneUnfill",
AS_GLOBAL, 0,
_( "Unfill" ), _( "Unfill zone(s)" ), zone_unfill_xpm );
_( "Unfill" ), _( "Unfill zone(s)" ),
zone_unfill_xpm );
TOOL_ACTION PCB_ACTIONS::zoneUnfillAll( "pcbnew.ZoneFiller.zoneUnfillAll",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZONE_REMOVE_FILLED ),
_( "Unfill All" ), _( "Unfill all zones" ) );
_( "Unfill All" ), _( "Unfill all zones" ),
zone_unfill_xpm );
ZONE_FILLER_TOOL::ZONE_FILLER_TOOL() :
PCB_TOOL_BASE( "pcbnew.ZoneFiller" )

View File

@ -88,7 +88,7 @@ void PCB_EDIT_FRAME::Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* aZone )
// Use the general event handler to set others params (like toolbar)
wxCommandEvent evt;
evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_AREA_BUTT : ID_PCB_ZONES_BUTT );
evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_BUTT : ID_PCB_ZONES_BUTT );
OnSelectTool( evt );
}
@ -108,7 +108,7 @@ void PCB_EDIT_FRAME::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* aZone )
// Use the general event handle to set others params (like toolbar)
wxCommandEvent evt;
evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_AREA_BUTT : ID_PCB_ZONES_BUTT );
evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_BUTT : ID_PCB_ZONES_BUTT );
OnSelectTool( evt );
}
@ -536,7 +536,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
// Verify if a new zone is allowed on this layer:
if( zone == NULL )
{
if( GetToolId() == ID_PCB_KEEPOUT_AREA_BUTT && !IsCopperLayer( GetActiveLayer() ) )
if( GetToolId() == ID_PCB_KEEPOUT_BUTT && !IsCopperLayer( GetActiveLayer() ) )
{
DisplayErrorMessage( this,
_( "Error: a keepout area is allowed only on copper layers" ) );
@ -588,7 +588,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
cfg->Read( ZONE_MIN_THICKNESS_WIDTH_STRING_KEY, &tmp );
zoneInfo.m_ZoneMinThickness = KiROUND( tmp * IU_PER_MILS );
if( GetToolId() == ID_PCB_KEEPOUT_AREA_BUTT )
if( GetToolId() == ID_PCB_KEEPOUT_BUTT )
{
zoneInfo.SetIsKeepout( true );
// Netcode, netname and some other settings are irrelevant,