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 972 of file pcbnew/onrightclick.cpp.

973 {
974  wxString msg;
975  wxMenu* trackwidth_menu;
976  BOARD_DESIGN_SETTINGS& bds = aBoard->GetDesignSettings();
977 
978  trackwidth_menu = new wxMenu;
979 
980  trackwidth_menu->Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH, _( "Auto Width" ),
981  _( "Use the track width when starting on a track, otherwise the current track width" ),
982  true );
983 
984  if( bds.m_UseConnectedTrackWidth )
985  trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
986 
987  if( bds.GetViaSizeIndex() != 0 || bds.GetTrackWidthIndex() != 0 || bds.m_UseConnectedTrackWidth )
988  trackwidth_menu->Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES,
989  _( "Use Netclass Values" ),
990  _( "Use track and via sizes from their Netclass values" ),
991  true );
992 
993  for( unsigned ii = 0; ii < bds.m_TrackWidthList.size(); ii++ )
994  {
995  wxString value = StringFromValue( aUnits, bds.m_TrackWidthList[ii], true );
996  msg.Printf( _( "Track %s" ), GetChars( value ) );
997 
998  if( ii == 0 )
999  msg << _( " uses NetClass" );
1000 
1001  trackwidth_menu->Append( ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, true );
1002  }
1003 
1004  trackwidth_menu->AppendSeparator();
1005 
1006  for( unsigned ii = 0; ii < bds.m_ViasDimensionsList.size(); ii++ )
1007  {
1008  wxString value = StringFromValue( aUnits, bds.m_ViasDimensionsList[ii].m_Diameter, true );
1009  wxString drill = StringFromValue( aUnits, bds.m_ViasDimensionsList[ii].m_Drill, true );
1010 
1011  if( bds.m_ViasDimensionsList[ii].m_Drill <= 0 )
1012  {
1013  msg.Printf( _( "Via %s" ), GetChars( value ) );
1014  }
1015  else
1016  {
1017  msg.Printf( _( "Via %s, drill %s" ), GetChars( value ), GetChars( drill ) );
1018  }
1019 
1020  if( ii == 0 )
1021  msg << _( " uses NetClass" );
1022 
1023  trackwidth_menu->Append( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, msg, wxEmptyString, true );
1024  }
1025 
1026  return trackwidth_menu;
1027 }
std::vector< int > m_TrackWidthList
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:539
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:92
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().