KiCad PCB EDA Suite
pcbnew/onrightclick.cpp File Reference

Right mouse button functions. More...

#include <fctsys.h>
#include <class_drawpanel.h>
#include <macros.h>
#include <base_units.h>
#include <bitmaps.h>
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <class_pcb_text.h>
#include <class_zone.h>
#include <pcbnew.h>
#include <pcb_edit_frame.h>
#include <pcbnew_id.h>
#include <hotkeys.h>
#include <collectors.h>
#include <menus_helpers.h>

Go to the source code of this file.

Functions

static wxMenu * Append_Track_Width_List (BOARD *aBoard, EDA_UNITS_T aUnits)
 Function Append_Track_Width_List creates a wxMenu * which shows the last used track widths and via diameters. More...
 

Detailed Description

Right mouse button functions.

Definition in file pcbnew/onrightclick.cpp.

Function Documentation

◆ Append_Track_Width_List()

static wxMenu * Append_Track_Width_List ( BOARD aBoard,
EDA_UNITS_T  aUnits 
)
static

Function Append_Track_Width_List creates a wxMenu * which shows the last used track widths and via diameters.

Returns
a pointer to the menu

Definition at line 967 of file pcbnew/onrightclick.cpp.

968 {
969  wxString msg;
970  wxMenu* trackwidth_menu;
971  BOARD_DESIGN_SETTINGS& bds = aBoard->GetDesignSettings();
972 
973  trackwidth_menu = new wxMenu;
974 
975  trackwidth_menu->Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH, _( "Auto Width" ),
976  _( "Use the track width when starting on a track, otherwise the current track width" ),
977  true );
978 
979  if( bds.m_UseConnectedTrackWidth )
980  trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
981 
982  if( bds.GetViaSizeIndex() != 0 || bds.GetTrackWidthIndex() != 0 || bds.m_UseConnectedTrackWidth )
983  trackwidth_menu->Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES,
984  _( "Use Netclass Values" ),
985  _( "Use track and via sizes from their Netclass values" ),
986  true );
987 
988  for( unsigned ii = 0; ii < bds.m_TrackWidthList.size(); ii++ )
989  {
990  wxString value = StringFromValue( aUnits, bds.m_TrackWidthList[ii], true );
991  msg.Printf( _( "Track %s" ), GetChars( value ) );
992 
993  if( ii == 0 )
994  msg << _( " uses NetClass" );
995 
996  trackwidth_menu->Append( ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, true );
997  }
998 
999  trackwidth_menu->AppendSeparator();
1000 
1001  for( unsigned ii = 0; ii < bds.m_ViasDimensionsList.size(); ii++ )
1002  {
1003  wxString value = StringFromValue( aUnits, bds.m_ViasDimensionsList[ii].m_Diameter, true );
1004  wxString drill = StringFromValue( aUnits, bds.m_ViasDimensionsList[ii].m_Drill, true );
1005 
1006  if( bds.m_ViasDimensionsList[ii].m_Drill <= 0 )
1007  {
1008  msg.Printf( _( "Via %s" ), GetChars( value ) );
1009  }
1010  else
1011  {
1012  msg.Printf( _( "Via %s, drill %s" ), GetChars( value ), GetChars( drill ) );
1013  }
1014 
1015  if( ii == 0 )
1016  msg << _( " uses NetClass" );
1017 
1018  trackwidth_menu->Append( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, msg, wxEmptyString, true );
1019  }
1020 
1021  return trackwidth_menu;
1022 }
std::vector< int > m_TrackWidthList
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:534
unsigned GetViaSizeIndex() const
Function GetViaSizeIndex.
unsigned GetTrackWidthIndex() const
Function GetTrackWidthIndex.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:100
std::vector< VIA_DIMENSION > m_ViasDimensionsList
wxString StringFromValue(EDA_UNITS_T aUnits, int aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:210
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References GetChars(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetTrackWidthIndex(), BOARD_DESIGN_SETTINGS::GetViaSizeIndex(), ID_POPUP_PCB_SELECT_AUTO_WIDTH, ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES, ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_WIDTH1, BOARD_DESIGN_SETTINGS::m_TrackWidthList, BOARD_DESIGN_SETTINGS::m_UseConnectedTrackWidth, BOARD_DESIGN_SETTINGS::m_ViasDimensionsList, and StringFromValue().

Referenced by PCB_EDIT_FRAME::createPopupMenuForTracks(), and PCB_EDIT_FRAME::OnRightClick().