KiCad PCB EDA Suite
panel_setup_netclasses.cpp File Reference
#include <base_units.h>
#include <bitmaps.h>
#include <netclass.h>
#include <confirm.h>
#include <grid_tricks.h>
#include <panel_setup_netclasses.h>
#include <tool/tool_manager.h>
#include <widgets/grid_combobox.h>
#include <widgets/wx_grid.h>
#include <kicad_string.h>
#include <widgets/grid_color_swatch_helpers.h>
#include <widgets/grid_icon_text_helpers.h>
#include <algorithm>

Go to the source code of this file.

Macros

#define NO_NETCLASS_ASSIGNMENT   _( "<unassigned>" )
 
#define SET_MILS_CELL(col, val)   aGrid->SetCellValue( aRow, col, StringFromValue( aUnits, val, true, true ) )
 
#define MYCELL(col)   ValueFromString( aUnits, grid->GetCellValue( row, col ), true )
 

Enumerations

enum  {
  GRID_NAME = 0, GRID_FIRST_PCBNEW, GRID_CLEARANCE = GRID_FIRST_PCBNEW, GRID_TRACKSIZE,
  GRID_VIASIZE, GRID_VIADRILL, GRID_uVIASIZE, GRID_uVIADRILL,
  GRID_DIFF_PAIR_WIDTH, GRID_DIFF_PAIR_GAP, GRID_FIRST_EESCHEMA, GRID_WIREWIDTH = GRID_FIRST_EESCHEMA,
  GRID_BUSWIDTH, GRID_SCHEMATIC_COLOR, GRID_LINESTYLE, GRID_END
}
 

Functions

static void netclassToGridRow (EDA_UNITS aUnits, wxGrid *aGrid, int aRow, const NETCLASSPTR &nc)
 
static void gridRowToNetclass (EDA_UNITS aUnits, wxGrid *grid, int row, const NETCLASSPTR &nc)
 

Variables

std::vector< BITMAP_DEFg_lineStyleIcons
 
wxArrayString g_lineStyleNames
 

Macro Definition Documentation

◆ MYCELL

#define MYCELL (   col)    ValueFromString( aUnits, grid->GetCellValue( row, col ), true )

◆ NO_NETCLASS_ASSIGNMENT

#define NO_NETCLASS_ASSIGNMENT   _( "<unassigned>" )

Definition at line 70 of file panel_setup_netclasses.cpp.

◆ SET_MILS_CELL

#define SET_MILS_CELL (   col,
  val 
)    aGrid->SetCellValue( aRow, col, StringFromValue( aUnits, val, true, true ) )

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
GRID_NAME 
GRID_FIRST_PCBNEW 
GRID_CLEARANCE 
GRID_TRACKSIZE 
GRID_VIASIZE 
GRID_VIADRILL 
GRID_uVIASIZE 
GRID_uVIADRILL 
GRID_DIFF_PAIR_WIDTH 
GRID_DIFF_PAIR_GAP 
GRID_FIRST_EESCHEMA 
GRID_WIREWIDTH 
GRID_BUSWIDTH 
GRID_SCHEMATIC_COLOR 
GRID_LINESTYLE 
GRID_END 

Definition at line 42 of file panel_setup_netclasses.cpp.

Function Documentation

◆ gridRowToNetclass()

static void gridRowToNetclass ( EDA_UNITS  aUnits,
wxGrid *  grid,
int  row,
const NETCLASSPTR &  nc 
)
static

Definition at line 328 of file panel_setup_netclasses.cpp.

329 {
330  nc->SetName( grid->GetCellValue( row, GRID_NAME ) );
331 
332 #define MYCELL( col ) \
333  ValueFromString( aUnits, grid->GetCellValue( row, col ), true )
334 
335  nc->SetClearance( MYCELL( GRID_CLEARANCE ) );
336  nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) );
337  nc->SetViaDiameter( MYCELL( GRID_VIASIZE ) );
338  nc->SetViaDrill( MYCELL( GRID_VIADRILL ) );
339  nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) );
340  nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) );
341  nc->SetDiffPairWidth( MYCELL( GRID_DIFF_PAIR_WIDTH ) );
342  nc->SetDiffPairGap( MYCELL( GRID_DIFF_PAIR_GAP ) );
343 
344  nc->SetWireWidth( MYCELL( GRID_WIREWIDTH ) );
345  nc->SetBusWidth( MYCELL( GRID_BUSWIDTH ) );
346 
347  nc->SetSchematicColor( wxColour( grid->GetCellValue( row, GRID_SCHEMATIC_COLOR ) ) );
348  nc->SetLineStyle( g_lineStyleNames.Index( grid->GetCellValue( row, GRID_LINESTYLE ) ) );
349 }
wxArrayString g_lineStyleNames
#define MYCELL(col)

References g_lineStyleNames, GRID_BUSWIDTH, GRID_CLEARANCE, GRID_DIFF_PAIR_GAP, GRID_DIFF_PAIR_WIDTH, GRID_LINESTYLE, GRID_NAME, GRID_SCHEMATIC_COLOR, GRID_TRACKSIZE, GRID_uVIADRILL, GRID_uVIASIZE, GRID_VIADRILL, GRID_VIASIZE, GRID_WIREWIDTH, and MYCELL.

Referenced by PANEL_SETUP_NETCLASSES::TransferDataFromWindow().

◆ netclassToGridRow()

static void netclassToGridRow ( EDA_UNITS  aUnits,
wxGrid *  aGrid,
int  aRow,
const NETCLASSPTR &  nc 
)
static

Definition at line 197 of file panel_setup_netclasses.cpp.

198 {
199  aGrid->SetCellValue( aRow, GRID_NAME, nc->GetName() );
200 
201 #define SET_MILS_CELL( col, val ) \
202  aGrid->SetCellValue( aRow, col, StringFromValue( aUnits, val, true, true ) )
203 
204  SET_MILS_CELL( GRID_CLEARANCE, nc->GetClearance() );
205  SET_MILS_CELL( GRID_TRACKSIZE, nc->GetTrackWidth() );
206  SET_MILS_CELL( GRID_VIASIZE, nc->GetViaDiameter() );
207  SET_MILS_CELL( GRID_VIADRILL, nc->GetViaDrill() );
208  SET_MILS_CELL( GRID_uVIASIZE, nc->GetuViaDiameter() );
209  SET_MILS_CELL( GRID_uVIADRILL, nc->GetuViaDrill() );
210  SET_MILS_CELL( GRID_DIFF_PAIR_WIDTH, nc->GetDiffPairWidth() );
211  SET_MILS_CELL( GRID_DIFF_PAIR_GAP, nc->GetDiffPairGap() );
212 
213  SET_MILS_CELL( GRID_WIREWIDTH, nc->GetWireWidth() );
214  SET_MILS_CELL( GRID_BUSWIDTH, nc->GetBusWidth() );
215 
216  wxString colorAsString = nc->GetSchematicColor().ToWxString( wxC2S_CSS_SYNTAX );
217  aGrid->SetCellValue( aRow, GRID_SCHEMATIC_COLOR, colorAsString );
218  aGrid->SetCellValue( aRow, GRID_LINESTYLE, g_lineStyleNames[ nc->GetLineStyle() ] );
219 }
#define SET_MILS_CELL(col, val)
wxArrayString g_lineStyleNames

References g_lineStyleNames, GRID_BUSWIDTH, GRID_CLEARANCE, GRID_DIFF_PAIR_GAP, GRID_DIFF_PAIR_WIDTH, GRID_LINESTYLE, GRID_NAME, GRID_SCHEMATIC_COLOR, GRID_TRACKSIZE, GRID_uVIADRILL, GRID_uVIASIZE, GRID_VIADRILL, GRID_VIASIZE, GRID_WIREWIDTH, and SET_MILS_CELL.

Referenced by PANEL_SETUP_NETCLASSES::TransferDataToWindow().

Variable Documentation

◆ g_lineStyleIcons

std::vector<BITMAP_DEF> g_lineStyleIcons

◆ g_lineStyleNames

wxArrayString g_lineStyleNames