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)
 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

static wxMenu * Append_Track_Width_List ( BOARD aBoard)
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 991 of file pcbnew/onrightclick.cpp.

References g_UserUnit, 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().

992 {
993  wxString msg;
994  wxMenu* trackwidth_menu;
995  wxString value;
996 
997  trackwidth_menu = new wxMenu;
998 
999  trackwidth_menu->Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH, _( "Auto Width" ),
1000  _( "Use the track width when starting on a track, otherwise the current track width" ),
1001  true );
1002 
1004  trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
1005 
1006  if( aBoard->GetDesignSettings().GetViaSizeIndex() != 0
1007  || aBoard->GetDesignSettings().GetTrackWidthIndex() != 0
1009  trackwidth_menu->Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES,
1010  _( "Use Netclass Values" ),
1011  _( "Use track and via sizes from their Netclass values" ),
1012  true );
1013 
1014  for( unsigned ii = 0; ii < aBoard->GetDesignSettings().m_TrackWidthList.size(); ii++ )
1015  {
1016  value = StringFromValue( g_UserUnit, aBoard->GetDesignSettings().m_TrackWidthList[ii], true );
1017  msg.Printf( _( "Track %s" ), GetChars( value ) );
1018 
1019  if( ii == 0 )
1020  msg << _( " uses NetClass" );
1021 
1022  trackwidth_menu->Append( ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, true );
1023  }
1024 
1025  trackwidth_menu->AppendSeparator();
1026 
1027  for( unsigned ii = 0; ii < aBoard->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
1028  {
1029  value = StringFromValue( g_UserUnit,
1030  aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Diameter,
1031  true );
1032  wxString drill = StringFromValue( g_UserUnit,
1033  aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Drill,
1034  true );
1035 
1036  if( aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Drill <= 0 )
1037  {
1038  msg.Printf( _( "Via %s" ), GetChars( value ) );
1039  }
1040  else
1041  {
1042  msg.Printf( _( "Via %s, drill %s" ), GetChars( value ), GetChars( drill ) );
1043  }
1044 
1045  if( ii == 0 )
1046  msg << _( " uses NetClass" );
1047 
1048  trackwidth_menu->Append( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, msg, wxEmptyString, true );
1049  }
1050 
1051  return trackwidth_menu;
1052 }
std::vector< int > m_TrackWidthList
Track width list.
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:205
bool m_UseConnectedTrackWidth
if true, when creating a new track starting on an existing track, use this track width ...
unsigned GetViaSizeIndex() const
Function GetViaSizeIndex.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:533
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
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
Vias size and drill list.
unsigned GetTrackWidthIndex() const
Function GetTrackWidthIndex.