bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) { wxString msg; int flags = 0; bool locate_track = false; bool blockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE); wxClientDC dc( m_canvas ); BOARD_ITEM* item = GetCurItem(); m_canvas->SetCanStartBlock( -1 ); // Avoid to start a block coomand when clicking on menu // If a command or a block is in progress: // Put the Cancel command (if needed) and the End command if( blockActive ) { createPopUpBlockMenu( aPopMenu ); aPopMenu->AppendSeparator(); return true; } m_canvas->CrossHairOff( &dc ); if( GetToolId() != ID_NO_TOOL_SELECTED ) { if( item && item->GetFlags() ) { AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), KiBitmap( cancel_xpm ) ); } else { AddMenuItem( aPopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ), KiBitmap( cursor_xpm ) ); } aPopMenu->AppendSeparator(); } else { if( item && item->GetFlags() ) { AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), KiBitmap( cancel_xpm ) ); aPopMenu->AppendSeparator(); } } /* Select a proper item */ wxPoint cursorPos = GetScreen()->GetCrossHairPosition(); wxPoint selectPos = m_Collector->GetRefPos(); selectPos = GetScreen()->GetNearestGridPosition( selectPos ); /* We can reselect another item only if there are no item being edited * because ALL moving functions use GetCurItem(), therefore GetCurItem() * must return the same item during moving. We know an item is moving * if( item && (item->m_Flags != 0)) is true and after calling * PcbGeneralLocateAndDisplay(), GetCurItem() is any arbitrary BOARD_ITEM, * not the current item being edited. In such case we cannot call * PcbGeneralLocateAndDisplay(). */ if( !item || (item->GetFlags() == 0) ) { // show "item selector" menu only if no item now or selected item was not // previously picked at this position if( !item || cursorPos != selectPos ) { m_canvas->SetAbortRequest( false ); item = PcbGeneralLocateAndDisplay(); if( m_canvas->GetAbortRequest() ) { m_canvas->CrossHairOn( &dc ); return false; } } } item = GetCurItem(); if( item ) flags = item->GetFlags(); else flags = 0; if( item ) { switch( item->Type() ) { case PCB_MODULE_T: createPopUpMenuForFootprints( (MODULE*) item, aPopMenu ); if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_MODULE ) ) { aPopMenu->AppendSeparator(); if( !( (MODULE*) item )->IsLocked() ) { msg = AddHotkeyName( _("Lock Module" ), g_Board_Editor_Hokeys_Descr, HK_LOCK_UNLOCK_FOOTPRINT ); AddMenuItem( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, msg, KiBitmap( locked_xpm ) ); } else { msg = AddHotkeyName( _( "Unlock Module" ), g_Board_Editor_Hokeys_Descr, HK_LOCK_UNLOCK_FOOTPRINT ); AddMenuItem( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, msg, KiBitmap( unlocked_xpm ) ); } if( !flags ) aPopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE, _( "Auto Place Module" ) ); } if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_TRACKS ) ) { if( !flags ) aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_MODULE, _( "Autoroute Module" ) ); } break; case PCB_PAD_T: createPopUpMenuForFpPads( (D_PAD*) item, aPopMenu ); break; case PCB_MODULE_TEXT_T: createPopUpMenuForFpTexts( (TEXTE_MODULE*) item, aPopMenu ); break; case PCB_LINE_T: // Some graphic items on technical layers if( (flags & IS_NEW) ) { AddMenuItem( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, _( "End Drawing" ), KiBitmap( apply_xpm ) ); } if( !flags ) { msg = AddHotkeyName( _( "Move Drawing" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_DRAWING_REQUEST, msg, KiBitmap( move_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_EDIT_DRAWING, _( "Edit Drawing" ), KiBitmap( edit_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING, _( "Delete Drawing" ), KiBitmap( delete_xpm ) ); if( item->GetLayer() > LAST_COPPER_LAYER ) AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING_LAYER, _( "Delete All Drawing on Layer" ), KiBitmap( delete_xpm ) ); } break; case PCB_ZONE_T: // Item used to fill a zone AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_ZONE, _( "Delete Zone Filling" ), KiBitmap( delete_xpm ) ); break; case PCB_ZONE_AREA_T: // Item used to handle a zone area (outlines, holes ...) if( flags & IS_NEW ) { AddMenuItem( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE, _( "Close Zone Outline" ), KiBitmap( apply_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER, _( "Delete Last Corner" ), KiBitmap( delete_xpm ) ); } else { createPopUpMenuForZones( (ZONE_CONTAINER*) item, aPopMenu ); } break; case PCB_TEXT_T: createPopUpMenuForTexts( (TEXTE_PCB*) item, aPopMenu ); break; case PCB_TRACE_T: case PCB_VIA_T: locate_track = true; createPopupMenuForTracks( (TRACK*) item, aPopMenu ); break; case PCB_MARKER_T: createPopUpMenuForMarkers( (MARKER_PCB*) item, aPopMenu ); break; case PCB_DIMENSION_T: if( !flags ) { msg = AddHotkeyName( _( "Edit Dimension" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_EDIT_DIMENSION, msg, KiBitmap( edit_xpm ) ); msg = AddHotkeyName( _( "Move Dimension Text" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST, msg, KiBitmap( move_text_xpm ) ); msg = AddHotkeyName( _( "Delete Dimension" ), g_Board_Editor_Hokeys_Descr, HK_DELETE ); AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DIMENSION, msg, KiBitmap( delete_xpm ) ); } break; case PCB_TARGET_T: if( !flags ) { msg = AddHotkeyName( _( "Move Target" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_MIRE_REQUEST, msg, KiBitmap( move_xpm ) ); msg = AddHotkeyName( _( "Edit Target" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_EDIT_MIRE, msg, KiBitmap( edit_xpm ) ); msg = AddHotkeyName( _( "Delete Target" ), g_Board_Editor_Hokeys_Descr, HK_DELETE ); AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_MIRE, msg, KiBitmap( delete_xpm ) ); } break; case PCB_MODULE_EDGE_T: case SCREEN_T: case TYPE_NOT_INIT: case PCB_T: msg.Printf( wxT( "PCB_EDIT_FRAME::OnRightClick() Error: unexpected DrawType %d" ), item->Type() ); wxMessageBox( msg ); SetCurItem( NULL ); break; default: msg.Printf( wxT( "PCB_EDIT_FRAME::OnRightClick() Error: unknown DrawType %d" ), item->Type() ); wxMessageBox( msg ); // Attempt to clear error (but should no occurs ) if( item->Type() >= MAX_STRUCT_TYPE_ID ) SetCurItem( NULL ); break; } aPopMenu->AppendSeparator(); } if( !flags ) { msg = AddHotkeyName( _( "Get and Move Footprint" ), g_Board_Editor_Hokeys_Descr, HK_GET_AND_MOVE_FOOTPRINT ); AddMenuItem( aPopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST, msg, KiBitmap( move_module_xpm ) ); } /* Display context sensitive commands: */ switch( GetToolId() ) { case ID_PCB_ZONES_BUTT: if( GetBoard()->m_ZoneDescriptorList.size() > 0 ) { aPopMenu->AppendSeparator(); AddMenuItem( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES, _( "Fill or Refill All Zones" ), KiBitmap( fill_zone_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES, _( "Remove Filled Areas in All Zones" ), KiBitmap( zone_unfill_xpm ) ); aPopMenu->AppendSeparator(); } AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER, _( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) ); aPopMenu->AppendSeparator(); break; case ID_TRACK_BUTT: if ( ! locate_track ) // This menu is already added when a track is located AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ), ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), KiBitmap( width_track_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_CU_LAYER, _( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR, _( "Select Layer Pair for Vias" ), KiBitmap( select_layer_pair_xpm ) ); aPopMenu->AppendSeparator(); break; case ID_PCB_CIRCLE_BUTT: case ID_PCB_ARC_BUTT: case ID_PCB_ADD_TEXT_BUTT: case ID_PCB_ADD_LINE_BUTT: case ID_PCB_DIMENSION_BUTT: AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_NO_CU_LAYER, _( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) ); aPopMenu->AppendSeparator(); break; case ID_PCB_MODULE_BUTT: AddMenuItem( aPopMenu, ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC, _( "Footprint Documentation" ), KiBitmap( book_xpm ) ); aPopMenu->AppendSeparator(); break; case ID_NO_TOOL_SELECTED: if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_MODULE ) ) { wxMenu* commands = new wxMenu; AddMenuItem( aPopMenu, commands, ID_POPUP_PCB_AUTOPLACE_COMMANDS, _( "Glob Move and Place" ), KiBitmap( move_xpm ) ); AddMenuItem( commands, ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES, _( "Unlock All Modules" ), KiBitmap( unlocked_xpm ) ); AddMenuItem( commands, ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES, _( "Lock All Modules" ), KiBitmap( locked_xpm ) ); commands->AppendSeparator(); AddMenuItem( commands, ID_POPUP_PCB_AUTOMOVE_ALL_MODULES, _( "Move All Modules" ), KiBitmap( move_xpm ) ); commands->Append( ID_POPUP_PCB_AUTOMOVE_NEW_MODULES, _( "Move New Modules" ) ); commands->AppendSeparator(); commands->Append( ID_POPUP_PCB_AUTOPLACE_ALL_MODULES, _( "Autoplace All Modules" ) ); commands->Append( ID_POPUP_PCB_AUTOPLACE_NEW_MODULES, _( "Autoplace New Modules" ) ); commands->Append( ID_POPUP_PCB_AUTOPLACE_NEXT_MODULE, _( "Autoplace Next Module" ) ); commands->AppendSeparator(); AddMenuItem( commands, ID_POPUP_PCB_REORIENT_ALL_MODULES, _( "Orient All Modules" ), KiBitmap( rotate_module_pos_xpm ) ); aPopMenu->AppendSeparator(); } if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_TRACKS ) ) { wxMenu* commands = new wxMenu; aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_COMMANDS, _( "Autoroute" ), commands ); AddMenuItem( commands, ID_POPUP_PCB_SELECT_LAYER_PAIR, _( "Select Layer Pair" ), KiBitmap( select_layer_pair_xpm ) ); commands->AppendSeparator(); commands->Append( ID_POPUP_PCB_AUTOROUTE_ALL_MODULES, _( "Autoroute All Modules" ) ); commands->AppendSeparator(); commands->Append( ID_POPUP_PCB_AUTOROUTE_RESET_UNROUTED, _( "Reset Unrouted" ) ); aPopMenu->AppendSeparator(); } if( locate_track ) AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ), ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), KiBitmap( width_track_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER, _( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) ); aPopMenu->AppendSeparator(); break; } m_canvas->CrossHairOn( &dc ); return true; }
bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) { wxString msg; STATUS_FLAGS flags = 0; bool trackFound = false; // Flag set to true, // if a track is being the cursor, to avoid // to display menus relative to tracks twice bool blockActive = !GetScreen()->m_BlockLocate.IsIdle(); BOARD_ITEM* item = GetCurItem(); m_canvas->SetCanStartBlock( -1 ); // Avoid to start a block command when clicking on menu // If a command or a block is in progress: // Put the Cancel command (if needed) and the End command if( blockActive ) { createPopUpBlockMenu( aPopMenu ); aPopMenu->AppendSeparator(); return true; } if( GetToolId() != ID_NO_TOOL_SELECTED ) { if( item && item->GetFlags() ) { AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), KiBitmap( cancel_xpm ) ); } else { AddMenuItem( aPopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ), KiBitmap( cursor_xpm ) ); } aPopMenu->AppendSeparator(); } else { if( item && item->GetFlags() ) { AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), KiBitmap( cancel_xpm ) ); aPopMenu->AppendSeparator(); } } // Select a proper item wxPoint cursorPos = GetCrossHairPosition(); wxPoint selectPos = m_Collector->GetRefPos(); selectPos = GetNearestGridPosition( selectPos ); /* We can reselect another item only if there are no item being edited * because ALL moving functions use GetCurItem(), therefore GetCurItem() * must return the same item during moving. We know an item is moving * if( item && (item->m_Flags != 0)) is true and after calling * PcbGeneralLocateAndDisplay(), GetCurItem() is any arbitrary BOARD_ITEM, * not the current item being edited. In such case we cannot call * PcbGeneralLocateAndDisplay(). */ if( !item || (item->GetFlags() == 0) ) { // show the "item selector" menu if no item selected or // if there is a selected item but the mouse has moved // (therefore a new item is perhaps under the cursor) if( !item || cursorPos != selectPos ) { m_canvas->SetAbortRequest( false ); PcbGeneralLocateAndDisplay(); if( m_canvas->GetAbortRequest() ) { return false; } } } item = GetCurItem(); flags = item ? item->GetFlags() : 0; // Add the context menu, which depends on the picked item: if( item ) { switch( item->Type() ) { case PCB_MODULE_T: createPopUpMenuForFootprints( (MODULE*) item, aPopMenu ); if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_MODULE ) ) { aPopMenu->AppendSeparator(); if( !( (MODULE*) item )->IsLocked() ) { msg = AddHotkeyName( _("Lock Footprint" ), g_Board_Editor_Hokeys_Descr, HK_LOCK_UNLOCK_FOOTPRINT ); AddMenuItem( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, msg, KiBitmap( locked_xpm ) ); } else { msg = AddHotkeyName( _( "Unlock Footprint" ), g_Board_Editor_Hokeys_Descr, HK_LOCK_UNLOCK_FOOTPRINT ); AddMenuItem( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, msg, KiBitmap( unlocked_xpm ) ); } if( !flags ) aPopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE, _( "Automatically Place Footprint" ) ); } if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_TRACKS ) ) { if( !flags ) aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_MODULE, _( "Automatically Route Footprint" ) ); } break; case PCB_PAD_T: createPopUpMenuForFpPads( static_cast<D_PAD*>( item ), aPopMenu ); break; case PCB_MODULE_TEXT_T: createPopUpMenuForFpTexts( static_cast<TEXTE_MODULE*>( item ), aPopMenu ); break; case PCB_LINE_T: // Some graphic items on technical layers if( (flags & IS_NEW) ) { AddMenuItem( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, _( "End Drawing" ), KiBitmap( checked_ok_xpm ) ); } if( !flags ) { msg = AddHotkeyName( _( "Move Drawing" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_DRAWING_REQUEST, msg, KiBitmap( move_xpm ) ); msg = AddHotkeyName( _( "Duplicate Drawing" ), g_Board_Editor_Hokeys_Descr, HK_DUPLICATE_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_DUPLICATE_ITEM, msg, KiBitmap( duplicate_line_xpm ) ); msg = AddHotkeyName( _("Move Drawing Exactly" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM_EXACT ); AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_EXACT, msg, KiBitmap( move_line_xpm ) ); msg = AddHotkeyName( _("Create Drawing Array" ), g_Board_Editor_Hokeys_Descr, HK_CREATE_ARRAY ); AddMenuItem( aPopMenu, ID_POPUP_PCB_CREATE_ARRAY, msg, KiBitmap( array_line_xpm ) ); msg = AddHotkeyName( _( "Edit Drawing" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_EDIT_DRAWING, msg, KiBitmap( edit_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING, _( "Delete Drawing" ), KiBitmap( delete_xpm ) ); if( !IsCopperLayer( item->GetLayer() ) ) AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING_LAYER, _( "Delete All Drawings on Layer" ), KiBitmap( delete_xpm ) ); } break; case PCB_ZONE_T: // Item used to fill a zone AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_ZONE, _( "Delete Zone Filling" ), KiBitmap( delete_xpm ) ); break; case PCB_ZONE_AREA_T: // Item used to handle a zone area (outlines, holes ...) if( flags & IS_NEW ) { AddMenuItem( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE, _( "Close Zone Outline" ), KiBitmap( checked_ok_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER, _( "Delete Last Corner" ), KiBitmap( delete_xpm ) ); } else { createPopUpMenuForZones( (ZONE_CONTAINER*) item, aPopMenu ); } break; case PCB_TEXT_T: createPopUpMenuForTexts( (TEXTE_PCB*) item, aPopMenu ); break; case PCB_TRACE_T: case PCB_VIA_T: trackFound = true; createPopupMenuForTracks( (TRACK*) item, aPopMenu ); break; case PCB_MARKER_T: createPopUpMenuForMarkers( (MARKER_PCB*) item, aPopMenu ); break; case PCB_DIMENSION_T: if( !flags ) { msg = AddHotkeyName( _( "Edit Dimension" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_EDIT_DIMENSION, msg, KiBitmap( edit_xpm ) ); msg = AddHotkeyName( _( "Move Dimension Text" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST, msg, KiBitmap( move_text_xpm ) ); msg = AddHotkeyName( _( "Duplicate Dimension" ), g_Board_Editor_Hokeys_Descr, HK_DUPLICATE_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_DUPLICATE_ITEM, msg, KiBitmap( duplicate_text_xpm ) ); msg = AddHotkeyName( _("Move Dimension Exactly" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM_EXACT ); AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_EXACT, msg, KiBitmap( move_text_xpm ) ); msg = AddHotkeyName( _( "Delete Dimension" ), g_Board_Editor_Hokeys_Descr, HK_DELETE ); AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DIMENSION, msg, KiBitmap( delete_xpm ) ); } break; case PCB_TARGET_T: if( !flags ) { msg = AddHotkeyName( _( "Move Target" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_MIRE_REQUEST, msg, KiBitmap( move_target_xpm ) ); msg = AddHotkeyName( _("Move Target Exactly" ), g_Board_Editor_Hokeys_Descr, HK_MOVE_ITEM_EXACT ); AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_EXACT, msg, KiBitmap( move_target_xpm ) ); msg = AddHotkeyName( _( "Duplicate Target" ), g_Board_Editor_Hokeys_Descr, HK_DUPLICATE_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_DUPLICATE_ITEM, msg, KiBitmap( duplicate_target_xpm ) ); msg = AddHotkeyName( _("Create Target Array" ), g_Board_Editor_Hokeys_Descr, HK_CREATE_ARRAY ); AddMenuItem( aPopMenu, ID_POPUP_PCB_CREATE_ARRAY, msg, KiBitmap( array_target_xpm ) ); msg = AddHotkeyName( _( "Edit Target" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_EDIT_MIRE, msg, KiBitmap( edit_xpm ) ); msg = AddHotkeyName( _( "Delete Target" ), g_Board_Editor_Hokeys_Descr, HK_DELETE ); AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_MIRE, msg, KiBitmap( delete_xpm ) ); } break; case PCB_MODULE_EDGE_T: case SCREEN_T: case TYPE_NOT_INIT: case PCB_T: msg.Printf( wxT( "PCB_EDIT_FRAME::OnRightClick() Error: unexpected DrawType %d" ), item->Type() ); wxMessageBox( msg ); SetCurItem( NULL ); break; default: msg.Printf( wxT( "PCB_EDIT_FRAME::OnRightClick() Error: unknown DrawType %d" ), item->Type() ); wxMessageBox( msg ); // Attempt to clear error (but should no occurs ) if( item->Type() >= MAX_STRUCT_TYPE_ID ) SetCurItem( NULL ); break; } aPopMenu->AppendSeparator(); } if( !flags ) { msg = AddHotkeyName( _( "Get and Move Footprint" ), g_Board_Editor_Hokeys_Descr, HK_GET_AND_MOVE_FOOTPRINT ); AddMenuItem( aPopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST, msg, KiBitmap( move_module_xpm ) ); } // Display context sensitive commands: switch( GetToolId() ) { case ID_PCB_ZONES_BUTT: if( GetBoard()->m_ZoneDescriptorList.size() > 0 ) { aPopMenu->AppendSeparator(); msg = AddHotkeyName( _( "Fill or Refill All Zones" ), g_Board_Editor_Hokeys_Descr, HK_ZONE_FILL_OR_REFILL ); AddMenuItem( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES, msg, KiBitmap( fill_zone_xpm ) ); msg = AddHotkeyName( _( "Remove Filled Areas in All Zones" ), g_Board_Editor_Hokeys_Descr, HK_ZONE_REMOVE_FILLED ); AddMenuItem( aPopMenu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES, msg, KiBitmap( zone_unfill_xpm ) ); aPopMenu->AppendSeparator(); } AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER, _( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) ); aPopMenu->AppendSeparator(); break; case ID_PCB_KEEPOUT_AREA_BUTT: AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER, _( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) ); aPopMenu->AppendSeparator(); break; case ID_TRACK_BUTT: if ( ! trackFound ) // This menu is already added when a track is located { aPopMenu->AppendSeparator(); msg = AddHotkeyName( _( "Begin Track" ), g_Board_Editor_Hokeys_Descr, HK_ADD_NEW_TRACK ); AddMenuItem( aPopMenu, ID_POPUP_PCB_BEGIN_TRACK, msg, KiBitmap( add_tracks_xpm ) ); AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ), ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), KiBitmap( width_track_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_CU_LAYER, _( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR, _( "Select Layer Pair for Vias" ), KiBitmap( select_layer_pair_xpm ) ); aPopMenu->AppendSeparator(); } break; case ID_PCB_CIRCLE_BUTT: case ID_PCB_ARC_BUTT: case ID_PCB_ADD_TEXT_BUTT: case ID_PCB_ADD_LINE_BUTT: case ID_PCB_DIMENSION_BUTT: AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_NO_CU_LAYER, _( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) ); aPopMenu->AppendSeparator(); break; case ID_PCB_MODULE_BUTT: if( !flags ) { AddMenuItem( aPopMenu, ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC, _( "Footprint Documentation" ), KiBitmap( book_xpm ) ); aPopMenu->AppendSeparator(); } break; case ID_NO_TOOL_SELECTED: if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_MODULE ) ) { wxMenu* commands = new wxMenu; AddMenuItem( aPopMenu, commands, ID_POPUP_PCB_AUTOPLACE_COMMANDS, _( "Global Spread and Place" ), KiBitmap( move_xpm ) ); AddMenuItem( commands, ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES, _( "Unlock All Footprints" ), KiBitmap( unlocked_xpm ) ); AddMenuItem( commands, ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES, _( "Lock All Footprints" ), KiBitmap( locked_xpm ) ); commands->AppendSeparator(); AddMenuItem( commands, ID_POPUP_PCB_SPREAD_ALL_MODULES, _( "Spread out All Footprints" ), KiBitmap( move_xpm ) ); commands->Append( ID_POPUP_PCB_SPREAD_NEW_MODULES, _( "Spread out Footprints not Already on Board" ) ); commands->AppendSeparator(); commands->Append( ID_POPUP_PCB_AUTOPLACE_ALL_MODULES, _( "Automatically Place All Footprints" ) ); commands->Append( ID_POPUP_PCB_AUTOPLACE_NEW_MODULES, _( "Automatically Place New Footprints" ) ); commands->Append( ID_POPUP_PCB_AUTOPLACE_NEXT_MODULE, _( "Automatically Place Next Footprints" ) ); commands->AppendSeparator(); AddMenuItem( commands, ID_POPUP_PCB_REORIENT_ALL_MODULES, _( "Orient All Footprints" ), KiBitmap( rotate_module_cw_xpm ) ); aPopMenu->AppendSeparator(); } if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_TRACKS ) ) { wxMenu* commands = new wxMenu; aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_COMMANDS, _( "Autoroute" ), commands ); AddMenuItem( commands, ID_POPUP_PCB_SELECT_LAYER_PAIR, _( "Select Layer Pair" ), KiBitmap( select_layer_pair_xpm ) ); commands->AppendSeparator(); commands->Append( ID_POPUP_PCB_AUTOROUTE_ALL_MODULES, _( "Automatically Route All Footprints" ) ); commands->AppendSeparator(); commands->Append( ID_POPUP_PCB_AUTOROUTE_RESET_UNROUTED, _( "Reset Unrouted" ) ); aPopMenu->AppendSeparator(); } if( !trackFound ) { msg = AddHotkeyName( _( "Begin Track" ), g_Board_Editor_Hokeys_Descr, HK_ADD_NEW_TRACK ); AddMenuItem( aPopMenu, ID_POPUP_PCB_BEGIN_TRACK, msg, KiBitmap( add_tracks_xpm ) ); AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ), ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), KiBitmap( width_track_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER, _( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) ); aPopMenu->AppendSeparator(); } break; } return true; }