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

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

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

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