Consolidate design rules UI.

Implement new Board Setup paged dialog which includes:
  Layers Setup
  Design Rules
  Solder Mask & Paste
  Text & Drawings

Moves line width and text properties to a layer-class-based
system.  Renames unlocked to upright (which also reverses the
logic).

New Edit Text and Graphic Properties dialog which replaces
Edit Footprint Text and adds layer-class-based editing and the
italic, upright and visibility properties.

Adds Import Settings functionality which allows settings to
be imported from another project at page granularity.

Also UNIT_BINDERizes the dialog and adds editing of pcb text.

Fixes: lp:1731952
* https://bugs.launchpad.net/kicad/+bug/1731952

Fixes: lp:1743464
* https://bugs.launchpad.net/kicad/+bug/1743464

Fixes: lp:1664761
* https://bugs.launchpad.net/kicad/+bug/1664761

Fixes: lp:1753362
* https://bugs.launchpad.net/kicad/+bug/1753362

Fixes: lp:1545427
* https://bugs.launchpad.net/kicad/+bug/1545427

Fixes: lp:1753775
* https://bugs.launchpad.net/kicad/+bug/1753775

Fixes: lp:1777692
* https://bugs.launchpad.net/kicad/+bug/1777692

Fixes: lp:1780670
* https://bugs.launchpad.net/kicad/+bug/1780670

Fixes: lp:1519601
* https://bugs.launchpad.net/kicad/+bug/1519601

(cherry picked from commit 3944a5e)
This commit is contained in:
Jeff Young 2018-04-28 16:22:25 +01:00
parent 5f3ee1e7ce
commit aab97c8385
131 changed files with 30932 additions and 31019 deletions

View File

@ -135,19 +135,20 @@ void ConfigBaseWriteDouble( wxConfigBase* aConfig, const wxString& aKey, double
PARAM_CFG_BASE::PARAM_CFG_BASE( const wxString& ident, const paramcfg_id type,
const wxChar* group )
const wxChar* group, const wxString& legacy )
{
m_Ident = ident;
m_Type = type;
m_Group = group;
m_Setup = false;
m_Ident_legacy = legacy;
}
PARAM_CFG_INT::PARAM_CFG_INT( const wxString& ident, int* ptparam,
int default_val, int min, int max,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_INT, group )
PARAM_CFG_INT::PARAM_CFG_INT( const wxString& ident, int* ptparam, int default_val,
int min, int max, const wxChar* group, const wxString& legacy ) :
PARAM_CFG_BASE( ident, PARAM_INT, group, legacy )
{
m_Pt_param = ptparam;
m_Default = default_val;
@ -156,16 +157,15 @@ PARAM_CFG_INT::PARAM_CFG_INT( const wxString& ident, int* ptparam,
}
PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxString& ident, int* ptparam,
int default_val, int min, int max,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_INT, group )
PARAM_CFG_INT::PARAM_CFG_INT( bool setup, const wxString& ident, int* ptparam, int default_val,
int min, int max, const wxChar* group, const wxString& legacy ) :
PARAM_CFG_BASE( ident, PARAM_INT, group, legacy )
{
m_Pt_param = ptparam;
m_Default = default_val;
m_Min = min;
m_Max = max;
m_Setup = Insetup;
m_Setup = setup;
}
@ -174,7 +174,10 @@ void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) const
if( !m_Pt_param || !aConfig )
return;
int itmp = aConfig->Read( m_Ident, m_Default );
int itmp = m_Default;
if( !aConfig->Read( m_Ident, &itmp ) && m_Ident_legacy != wxEmptyString )
aConfig->Read( m_Ident_legacy, &itmp );
if( (itmp < m_Min) || (itmp > m_Max) )
itmp = m_Default;
@ -193,20 +196,21 @@ void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const
PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( const wxString& ident, int* ptparam,
int default_val, int min, int max,
const wxChar* group, double aBiu2cfgunit ) :
PARAM_CFG_INT( ident, ptparam, default_val, min, max, group )
int default_val, int min, int max,
const wxChar* group, double aBiu2cfgunit,
const wxString& legacy_ident ) :
PARAM_CFG_INT( ident, ptparam, default_val, min, max, group, legacy_ident )
{
m_Type = PARAM_INT_WITH_SCALE;
m_BIU_to_cfgunit = aBiu2cfgunit;
}
PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( bool Insetup,
const wxString& ident, int* ptparam,
int default_val, int min, int max,
const wxChar* group, double aBiu2cfgunit ) :
PARAM_CFG_INT( Insetup, ident, ptparam, default_val, min, max, group )
PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( bool setup, const wxString& ident, int* ptparam,
int default_val, int min, int max,
const wxChar* group, double aBiu2cfgunit,
const wxString& legacy_ident ) :
PARAM_CFG_INT( setup, ident, ptparam, default_val, min, max, group, legacy_ident )
{
m_Type = PARAM_INT_WITH_SCALE;
m_BIU_to_cfgunit = aBiu2cfgunit;
@ -219,7 +223,8 @@ void PARAM_CFG_INT_WITH_SCALE::ReadParam( wxConfigBase* aConfig ) const
return;
double dtmp = (double) m_Default * m_BIU_to_cfgunit;
aConfig->Read( m_Ident, &dtmp );
if( !aConfig->Read( m_Ident, &dtmp ) && m_Ident_legacy != wxEmptyString )
aConfig->Read( m_Ident_legacy, &dtmp );
int itmp = KiROUND( dtmp / m_BIU_to_cfgunit );

View File

@ -802,7 +802,7 @@ LSEQ LSET::UIOrder() const
PCB_LAYER_ID ToLAYER_ID( int aLayer )
{
wxASSERT( unsigned( aLayer ) < PCB_LAYER_ID_COUNT );
wxASSERT( aLayer < GAL_LAYER_ID_END );
return PCB_LAYER_ID( aLayer );
}

View File

@ -102,7 +102,6 @@ struct LANGUAGE_DESCR
*/
static LANGUAGE_DESCR s_Languages[] =
{
// Default language
{ wxLANGUAGE_DEFAULT, ID_LANGUAGE_DEFAULT, lang_def_xpm, _( "Default" ) },
{ wxLANGUAGE_ENGLISH, ID_LANGUAGE_ENGLISH, lang_en_xpm, wxT( "English" ), true },
{ wxLANGUAGE_FRENCH, ID_LANGUAGE_FRENCH, lang_fr_xpm, _( "French" ) },

View File

@ -89,7 +89,8 @@ void WX_GRID::ShowHideColumns( const wxString& shownColumns )
}
// An re-implementation of wxGrid::DrawColLabel which left-aligns the first column.
// An re-implementation of wxGrid::DrawColLabel which left-aligns the first column when
// there are no row labels.
void WX_GRID::DrawColLabel( wxDC& dc, int col )
{
if( GetColWidth( col ) <= 0 || m_colLabelHeight <= 0 )
@ -111,7 +112,7 @@ void WX_GRID::DrawColLabel( wxDC& dc, int col )
GetColLabelAlignment( &hAlign, &vAlign );
const int orient = GetColLabelTextOrientation();
if( col == 0 )
if( col == 0 && GetRowLabelSize() == 0 )
hAlign = wxALIGN_LEFT;
rend.DrawLabel( *this, dc, GetColLabelValue( col ), rect, hAlign, vAlign, orient );

View File

@ -30,29 +30,40 @@
#include <netclass.h>
#include <config_params.h>
// Some default values for the board editor and the fp editor (given in mm)
#define DEFAULT_TEXT_MODULE_SIZE 1.0
#define DEFAULT_GR_MODULE_THICKNESS 0.15 // given in mm
#define DEFAULT_SILK_LINE_WIDTH 0.12
#define DEFAULT_COPPER_LINE_WIDTH 0.20
#define DEFAULT_EDGE_WIDTH 0.05 // used for Edge.Cuts and CrtYds
#define DEFAULT_LINE_WIDTH 0.10
#define DEFAULT_SILK_TEXT_SIZE 1.0
#define DEFAULT_COPPER_TEXT_SIZE 1.5
#define DEFAULT_TEXT_SIZE 1.0
#define DEFAULT_SILK_TEXT_WIDTH 0.15
#define DEFAULT_COPPER_TEXT_WIDTH 0.30
#define DEFAULT_TEXT_WIDTH 0.15
// Board thickness, mainly for 3D view:
#define DEFAULT_BOARD_THICKNESS_MM 1.6
#define DEFAULT_BOARD_THICKNESS_MM 1.6
// Default values for some board items (given in mm)
#define DEFAULT_TEXT_PCB_SIZE 1.5
#define DEFAULT_TEXT_PCB_THICKNESS 0.3
#define DEFAULT_PCB_EDGE_THICKNESS 0.15
#define DEFAULT_GRAPHIC_THICKNESS 0.2
#define DEFAULT_PCB_EDGE_THICKNESS 0.15
#define DEFAULT_SOLDERMASK_CLEARANCE 0.2
#define DEFAULT_SOLDERMASK_MIN_WIDTH Millimeter2iu( 0.0 )
#define DEFAULT_SOLDERMASK_CLEARANCE 0.2
#define DEFAULT_SOLDERMASK_MIN_WIDTH 0.0
#define DEFAULT_SOLDERPASTE_CLEARANCE 0.0
#define DEFAULT_SOLDERPASTE_RATIO 0.0
#define DEFAULT_CUSTOMTRACKWIDTH 0.2
#define DEFAULT_TRACKMINWIDTH 0.2 // track width min value
#define DEFAULT_VIASMINSIZE 0.4 // vias (not micro vias) min diameter
#define DEFAULT_VIASMINDRILL 0.3 // vias (not micro vias) min drill diameter
#define DEFAULT_MICROVIASMINSIZE 0.2 // micro vias (not vias) min diameter
#define DEFAULT_MICROVIASMINDRILL 0.1 // micro vias (not vias) min drill diameter
#define DEFAULT_HOLETOHOLEMIN 0.25 // separation between drilled hole edges
#define DEFAULT_CUSTOMTRACKWIDTH 0.2
#define DEFAULT_CUSTOMDPAIRWIDTH 0.125
#define DEFAULT_CUSTOMDPAIRGAP 0.18
#define DEFAULT_CUSTOMDPAIRVIAGAP 0.18
#define DEFAULT_TRACKMINWIDTH 0.2 // track width min value
#define DEFAULT_VIASMINSIZE 0.4 // vias (not micro vias) min diameter
#define DEFAULT_VIASMINDRILL 0.3 // vias (not micro vias) min drill diameter
#define DEFAULT_MICROVIASMINSIZE 0.2 // micro vias (not vias) min diameter
#define DEFAULT_MICROVIASMINDRILL 0.1 // micro vias (not vias) min drill diameter
#define DEFAULT_HOLETOHOLEMIN 0.25 // separation between drilled hole edges
/**
* Struct VIA_DIMENSION
@ -91,6 +102,62 @@ struct VIA_DIMENSION
};
/**
* Struct DIFF_PAIR_DIMENSION
* is a small helper container to handle a stock of specific differential pairs each with
* unique track width, gap and via gap.
*/
struct DIFF_PAIR_DIMENSION
{
int m_Width; // <= 0 means use Netclass differential pair width
int m_Gap; // <= 0 means use Netclass differential pair gap
int m_ViaGap; // <= 0 means use Netclass differential pair via gap
DIFF_PAIR_DIMENSION()
{
m_Width = 0;
m_Gap = 0;
m_ViaGap = 0;
}
DIFF_PAIR_DIMENSION( int aWidth, int aGap, int aViaGap )
{
m_Width = aWidth;
m_Gap = aGap;
m_ViaGap = aViaGap;
}
bool operator==( const DIFF_PAIR_DIMENSION& aOther ) const
{
return ( m_Width == aOther.m_Width )
&& ( m_Gap == aOther.m_Gap )
&& ( m_ViaGap == aOther.m_ViaGap );
}
bool operator<( const DIFF_PAIR_DIMENSION& aOther ) const
{
if( m_Width != aOther.m_Width )
return m_Width < aOther.m_Width;
if( m_Gap != aOther.m_Gap )
return m_Gap < aOther.m_Gap;
return m_ViaGap < aOther.m_ViaGap;
}
};
enum
{
LAYER_CLASS_SILK = 0,
LAYER_CLASS_COPPER,
LAYER_CLASS_EDGES,
LAYER_CLASS_OTHERS,
LAYER_CLASS_COUNT
};
/**
* Class BOARD_DESIGN_SETTINGS
* contains design settings for a BOARD object.
@ -98,98 +165,97 @@ struct VIA_DIMENSION
class BOARD_DESIGN_SETTINGS
{
public:
// The first value is the current netclass via size
/// Vias size and drill list
std::vector<VIA_DIMENSION> m_ViasDimensionsList;
// Note: the first value in each dimensions list is the current netclass value
std::vector<int> m_TrackWidthList;
std::vector<VIA_DIMENSION> m_ViasDimensionsList;
std::vector<DIFF_PAIR_DIMENSION> m_DiffPairDimensionsList;
// The first value is the current netclass track width
/// Track width list
std::vector<int> m_TrackWidthList;
/// List of current netclasses. There is always the default netclass.
// List of netclasses. There is always the default netclass.
NETCLASSES m_NetClasses;
bool m_MicroViasAllowed; ///< true to allow micro vias
bool m_BlindBuriedViaAllowed; ///< true to allow blind/buried vias
VIATYPE_T m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
bool m_MicroViasAllowed; ///< true to allow micro vias
bool m_BlindBuriedViaAllowed; ///< true to allow blind/buried vias
VIATYPE_T m_CurrentViaType; ///< (VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
/// if true, when creating a new track starting on an existing track, use this track width
bool m_UseConnectedTrackWidth;
int m_DrawSegmentWidth; ///< current graphic line width (not EDGE layer)
int m_EdgeSegmentWidth; ///< current graphic line width (EDGE layer only)
int m_PcbTextWidth; ///< current Pcb (not module) Text width
wxSize m_PcbTextSize; ///< current Pcb (not module) Text size
int m_TrackMinWidth; ///< track min value for width ((min copper size value
int m_ViasMinSize; ///< vias (not micro vias) min diameter
int m_ViasMinDrill; ///< vias (not micro vias) min drill diameter
int m_MicroViasMinSize; ///< micro vias (not vias) min diameter
int m_MicroViasMinDrill; ///< micro vias (not vias) min drill diameter
bool m_RequireCourtyards; ///< require courtyard definitions in footprints
bool m_ProhibitOverlappingCourtyards; ///< check for overlapping courtyards in DRC
// if true, when creating a new track starting on an existing track, use this track width
bool m_UseConnectedTrackWidth;
int m_TrackMinWidth; ///< track min value for width ((min copper size value
int m_ViasMinSize; ///< vias (not micro vias) min diameter
int m_ViasMinDrill; ///< vias (not micro vias) min drill diameter
int m_MicroViasMinSize; ///< micro vias (not vias) min diameter
int m_MicroViasMinDrill; ///< micro vias (not vias) min drill diameter
// Global mask margins:
int m_SolderMaskMargin; ///< Solder mask margin
int m_SolderMaskMinWidth; ///< Solder mask min width
int m_SolderMaskMargin; ///< Solder mask margin
int m_SolderMaskMinWidth; ///< Solder mask min width
// 2 areas near than m_SolderMaskMinWidth
// are merged
int m_SolderPasteMargin; ///< Solder paste margin absolute value
double m_SolderPasteMarginRatio; ///< Solder pask margin ratio value of pad size
int m_SolderPasteMargin; ///< Solder paste margin absolute value
double m_SolderPasteMarginRatio; ///< Solder pask margin ratio value of pad size
///< The final margin is the sum of these 2 values
// Variables used in footprint edition (default value in item/footprint creation)
int m_ModuleSegmentWidth; ///< Default width for all graphic lines
// Note: the default layer is the active layer
wxSize m_ModuleTextSize; ///< Default footprint texts size
int m_ModuleTextWidth; ///< Default footprint texts thickness
int m_HoleToHoleMin; ///< Min width of peninsula between two drilled holes
wxString m_RefDefaultText; ///< Default ref text on fp creation
// Arrays of default values for the various layer classes.
int m_LineThickness[ LAYER_CLASS_COUNT ];
wxSize m_TextSize[ LAYER_CLASS_COUNT ];
int m_TextThickness[ LAYER_CLASS_COUNT ];
bool m_TextItalic[ LAYER_CLASS_COUNT ];
bool m_TextUpright[ LAYER_CLASS_COUNT ];
// Variables used in footprint edition (default value in item/footprint creation)
wxString m_RefDefaultText; ///< Default ref text on fp creation
// if empty, use footprint name as default
bool m_RefDefaultVisibility; ///< Default ref text visibility on fp creation
int m_RefDefaultlayer; ///< Default ref text layer on fp creation
bool m_RefDefaultVisibility; ///< Default ref text visibility on fp creation
int m_RefDefaultlayer; ///< Default ref text layer on fp creation
// should be a PCB_LAYER_ID, but use an int
// to save this param in config
wxString m_ValueDefaultText; ///< Default value text on fp creation
wxString m_ValueDefaultText; ///< Default value text on fp creation
// if empty, use footprint name as default
bool m_ValueDefaultVisibility; ///< Default value text visibility on fp creation
int m_ValueDefaultlayer; ///< Default value text layer on fp creation
bool m_ValueDefaultVisibility; ///< Default value text visibility on fp creation
int m_ValueDefaultlayer; ///< Default value text layer on fp creation
// should be a PCB_LAYER_ID, but use an int
// to save this param in config
// Miscellaneous
wxPoint m_AuxOrigin; ///< origin for plot exports
wxPoint m_GridOrigin; ///< origin for grid offsets
wxPoint m_AuxOrigin; ///< origin for plot exports
wxPoint m_GridOrigin; ///< origin for grid offsets
D_PAD m_Pad_Master; ///< A dummy pad to store all default parameters
D_PAD m_Pad_Master; ///< A dummy pad to store all default parameters
// when importing values or create a new pad
private:
/// Index for #m_ViasDimensionsList to select the current via size.
/// 0 is the index selection of the default value Netclass
unsigned m_viaSizeIndex;
// Indicies into the trackWidth, viaSizes and diffPairDimensions lists.
// The 0 index is always the current netclass value(s)
unsigned m_trackWidthIndex;
unsigned m_viaSizeIndex;
unsigned m_diffPairIndex;
// Index for m_TrackWidthList to select the value.
/// 0 is the index selection of the default value Netclass
unsigned m_trackWidthIndex;
///> Use custom values for track/via sizes (not specified in net class nor in the size lists).
bool m_useCustomTrackVia;
///> Custom track width (used after UseCustomTrackViaSize( true ) was called).
int m_customTrackWidth;
///> Custom via size (used after UseCustomTrackViaSize( true ) was called).
// Custom values for track/via sizes (specified via dialog instead of netclass or lists)
bool m_useCustomTrackVia;
int m_customTrackWidth;
VIA_DIMENSION m_customViaSize;
int m_copperLayerCount; ///< Number of copper layers for this design
// Custom values for differential pairs (specified via dialog instead of netclass/lists)
bool m_useCustomDiffPair;
DIFF_PAIR_DIMENSION m_customDiffPair;
LSET m_enabledLayers; ///< Bit-mask for layer enabling
LSET m_visibleLayers; ///< Bit-mask for layer visibility
int m_copperLayerCount; ///< Number of copper layers for this design
int m_visibleElements; ///< Bit-mask for element category visibility
int m_boardThickness; ///< Board thickness for 3D viewer
LSET m_enabledLayers; ///< Bit-mask for layer enabling
LSET m_visibleLayers; ///< Bit-mask for layer visibility
int m_visibleElements; ///< Bit-mask for element category visibility
int m_boardThickness; ///< Board thickness for 3D viewer
/// Current net class name used to display netclass info.
/// This is also the last used netclass after starting a track.
wxString m_currentNetClassName;
wxString m_currentNetClassName;
public:
BOARD_DESIGN_SETTINGS();
@ -415,11 +481,95 @@ public:
}
/**
* Function GetMinHoleSeparation
* @return The minimum distance between the edges of two holes or 0, which indicates that
* hole-to-hole separation should not be checked.
* Function GetDiffPairIndex
* @return the current diff pair dimension list index.
*/
int GetMinHoleSeparation() const;
inline unsigned GetDiffPairIndex() const { return m_diffPairIndex; }
/**
* Function SetDiffPairIndex
* @param aIndex is the diff pair dimensions list index to set.
*/
void SetDiffPairIndex( unsigned aIndex );
/**
* Function SetCustomDiffPairWidth
* Sets custom track width for differential pairs (i.e. not available in netclasses or
* preset list).
* @param aDrill is the new track wdith.
*/
inline void SetCustomDiffPairWidth( int aWidth )
{
m_customDiffPair.m_Width = aWidth;
}
/**
* Function GetCustomDiffPairWidth
* @return Current custom track width for differential pairs.
*/
inline int GetCustomDiffPairWidth()
{
return m_customDiffPair.m_Width;
}
/**
* Function SetCustomDiffPairGap
* Sets custom gap for differential pairs (i.e. not available in netclasses or preset
* list).
* @param aGap is the new gap.
*/
inline void SetCustomDiffPairGap( int aGap )
{
m_customDiffPair.m_Gap = aGap;
}
/**
* Function GetCustomDiffPairGap
* @return Current custom gap width for differential pairs.
*/
inline int GetCustomDiffPairGap()
{
return m_customDiffPair.m_Gap;
}
/**
* Function SetCustomDiffPairViaGap
* Sets custom via gap for differential pairs (i.e. not available in netclasses or
* preset list).
* @param aGap is the new gap. Specify 0 to use the DiffPairGap for vias as well.
*/
inline void SetCustomDiffPairViaGap( int aGap )
{
m_customDiffPair.m_ViaGap = aGap;
}
/**
* Function GetCustomDiffPairViaGap
* @return Current custom via gap width for differential pairs.
*/
inline int GetCustomDiffPairViaGap()
{
return m_customDiffPair.m_ViaGap > 0 ? m_customDiffPair.m_ViaGap : m_customDiffPair.m_Gap;
}
/**
* Function UseCustomDiffPairDimensions
* Enables/disables custom differential pair dimensions.
* @param aEnabled decides if custom settings should be used for new differential pairs.
*/
inline void UseCustomDiffPairDimensions( bool aEnabled )
{
m_useCustomDiffPair = aEnabled;
}
/**
* Function UseCustomDiffPairDimensions
* @return True if custom sizes of diff pairs are enabled, false otherwise.
*/
inline bool UseCustomDiffPairDimensions() const
{
return m_useCustomDiffPair;
}
/**
* Function SetMinHoleSeparation
@ -428,29 +578,17 @@ public:
*/
void SetMinHoleSeparation( int aDistance );
/**
* Function RequireCourtyardDefinitions
* @return True if footprints without courtyard definitions are considered DRC violations.
*/
bool RequireCourtyardDefinitions() const;
/**
* Function SetRequireCourtyardDefinitions
* @param aRequire Set to true to generate DRC violations from missing courtyards.
*/
void SetRequireCourtyardDefinitions( bool aRequire );
/**
* Function ProhibitOverlappingCourtyards
* @return True if overlapping courtyards are considered DRC violations.
*/
bool ProhibitOverlappingCourtyards() const;
/**
* Function SetProhibitOverlappingCourtyards
* @param aRequire Set to true to generate DRC violations from overlapping courtyards.
* @param aProhibit Set to true to generate DRC violations from overlapping courtyards.
*/
void SetProhibitOverlappingCourtyards( bool aRequire );
void SetProhibitOverlappingCourtyards( bool aProhibit );
/**
* Function GetVisibleLayers
@ -591,11 +729,34 @@ public:
* allow reading or writing of configuration file information directly into
* this object.
*/
void AppendConfigs( PARAM_CFG_ARRAY* aResult );
void AppendConfigs( BOARD* aBoard, PARAM_CFG_ARRAY* aResult );
inline int GetBoardThickness() const { return m_boardThickness; }
inline void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
/**
* Function GetLineThickness
* Returns the default graphic segment thickness from the layer class for the given layer.
*/
int GetLineThickness( PCB_LAYER_ID aLayer ) const;
/**
* Function GetTextSize
* Returns the default text size from the layer class for the given layer.
*/
wxSize GetTextSize( PCB_LAYER_ID aLayer ) const;
/**
* Function GetTextThickness
* Returns the default text thickness from the layer class for the given layer.
*/
int GetTextThickness( PCB_LAYER_ID aLayer ) const;
bool GetTextItalic( PCB_LAYER_ID aLayer ) const;
bool GetTextUpright( PCB_LAYER_ID aLayer ) const;
int GetLayerClass( PCB_LAYER_ID aLayer ) const;
private:
void formatNetClass( NETCLASS* aNetClass, OUTPUTFORMATTER* aFormatter, int aNestLevel,
int aControlBits ) const;

View File

@ -78,7 +78,12 @@ enum paramcfg_id {
PARAM_WXSTRING,
PARAM_FILENAME,
PARAM_COMMAND_ERASE,
PARAM_FIELDNAME_LIST
PARAM_FIELDNAME_LIST,
PARAM_LAYERS,
PARAM_TRACKWIDTHS,
PARAM_VIADIMENSIONS,
PARAM_DIFFPAIRDIMENSIONS,
PARAM_NETCLASSES
};
@ -99,9 +104,13 @@ public:
wxString m_Group; ///< Group name (this is like a path in the config data)
bool m_Setup; ///< Install or Project based parameter, true == install
// If the m_Ident keyword isn't found, fall back and read values from m_Ident_legacy.
// Note that values are always written to the current, non-legacy keyword.
wxString m_Ident_legacy;
public:
PARAM_CFG_BASE( const wxString& ident, const paramcfg_id type,
const wxChar* group = NULL );
PARAM_CFG_BASE( const wxString& ident, const paramcfg_id type, const wxChar* group = NULL,
const wxString& legacy_ident = wxEmptyString );
virtual ~PARAM_CFG_BASE() {}
/**
@ -132,16 +141,16 @@ public:
int m_Default; ///< The default value of the parameter
public:
PARAM_CFG_INT( const wxString& ident, int* ptparam,
int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
const wxChar* group = NULL );
PARAM_CFG_INT( bool Insetup, const wxString& ident, int* ptparam,
int default_val = 0,
PARAM_CFG_INT( const wxString& ident, int* ptparam, int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
const wxChar* group = NULL );
const wxChar* group = nullptr,
const wxString& legacy_ident = wxEmptyString );
PARAM_CFG_INT( bool Insetup, const wxString& ident, int* ptparam, int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
const wxChar* group = nullptr,
const wxString& legacy_ident = wxEmptyString );
virtual void ReadParam( wxConfigBase* aConfig ) const override;
virtual void SaveParam( wxConfigBase* aConfig ) const override;
@ -157,21 +166,20 @@ public:
class PARAM_CFG_INT_WITH_SCALE : public PARAM_CFG_INT
{
public:
double m_BIU_to_cfgunit; ///< the factor to convert the saved value in internal value
double m_BIU_to_cfgunit; ///< the factor to convert the saved value in internal value
public:
PARAM_CFG_INT_WITH_SCALE( const wxString& ident, int* ptparam,
int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
const wxChar* group = NULL,
double aBiu2cfgunit = 1.0);
PARAM_CFG_INT_WITH_SCALE( bool Insetup, const wxString& ident, int* ptparam,
int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
const wxChar* group = NULL,
double aBiu2cfgunit = 1.0 );
PARAM_CFG_INT_WITH_SCALE( const wxString& ident, int* ptparam, int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
const wxChar* group = NULL, double aBiu2cfgunit = 1.0,
const wxString& legacy_ident = wxEmptyString );
PARAM_CFG_INT_WITH_SCALE( bool insetup, const wxString& ident, int* ptparam,
int default_val = 0,
int min = std::numeric_limits<int>::min(),
int max = std::numeric_limits<int>::max(),
const wxChar* group = NULL, double aBiu2cfgunit = 1.0,
const wxString& legacy_ident = wxEmptyString );
virtual void ReadParam( wxConfigBase* aConfig ) const override;
virtual void SaveParam( wxConfigBase* aConfig ) const override;

View File

@ -382,21 +382,7 @@ public:
*/
void ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC );
/**
* Function ResetModuleTextSizes
* resets text size and width of all module text fields of given field
* type to current settings in Preferences->Dimensions->Texts and Drawings.
* @param aFilter is a filter: footprint names must match this filter.
* an empty filter, or "*" do not filter anything.
* @param aRef = true to modify the reference of footprints.
* @param aValue = true to modify the value of footprints.
* @param aOthers = true to modify the other fields of footprints.
*/
void ResetModuleTextSizes( const wxString & aFilter, bool aRef,
bool aValue, bool aOthers );
void InstallPadOptionsFrame( D_PAD* pad );
void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC );
void AddPad( MODULE* Module, bool draw );

View File

@ -53,6 +53,7 @@ include_directories(
set( PCBNEW_DIALOGS
dialogs/dialog_block_options.cpp
dialogs/dialog_block_options_base.cpp
dialogs/dialog_board_setup.cpp
dialogs/dialog_cleaning_options.cpp
dialogs/dialog_cleaning_options_base.cpp
dialogs/dialog_copper_zones.cpp
@ -60,8 +61,6 @@ set( PCBNEW_DIALOGS
dialogs/dialog_create_array.cpp
dialogs/dialog_create_array_base.cpp
dialogs/dialog_drc.cpp
dialogs/dialog_design_rules.cpp
dialogs/dialog_design_rules_base.cpp
dialogs/dialog_drc_base.cpp
dialogs/dialog_edit_footprint_for_BoardEditor.cpp
dialogs/dialog_edit_footprint_for_BoardEditor_base.cpp
@ -98,21 +97,17 @@ set( PCBNEW_DIALOGS
dialogs/dialog_global_deletion_base.cpp
dialogs/dialog_global_edit_tracks_and_vias.cpp
dialogs/dialog_global_edit_tracks_and_vias_base.cpp
dialogs/dialog_global_footprints_fields_edition.cpp
dialogs/dialog_global_footprints_fields_edition_base.cpp
dialogs/dialog_global_edit_text_and_graphics.cpp
dialogs/dialog_global_edit_text_and_graphics_base.cpp
dialogs/dialog_global_pads_edition.cpp
dialogs/dialog_global_pads_edition_base.cpp
dialogs/dialog_graphic_item_properties.cpp
dialogs/dialog_graphic_item_properties_base.cpp
dialogs/dialog_graphic_items_options.cpp
dialogs/dialog_graphic_items_options_base.cpp
dialogs/dialog_import_settings.cpp
dialogs/dialog_import_settings_base.cpp
dialogs/dialog_keepout_area_properties.cpp
dialogs/dialog_keepout_area_properties_base.cpp
dialogs/dialog_layer_selection_base.cpp
dialogs/dialog_layers_setup.cpp
dialogs/dialog_layers_setup_base.cpp
dialogs/dialog_mask_clearance.cpp
dialogs/dialog_mask_clearance_base.cpp
dialogs/dialog_move_exact.cpp
dialogs/dialog_move_exact_base.cpp
dialogs/dialog_netlist.cpp
@ -162,6 +157,16 @@ set( PCBNEW_DIALOGS
dialogs/panel_pcbnew_display_options_base.cpp
dialogs/panel_pcbnew_settings.cpp
dialogs/panel_pcbnew_settings_base.cpp
dialogs/panel_setup_mask_and_paste.cpp
dialogs/panel_setup_mask_and_paste_base.cpp
dialogs/panel_setup_feature_constraints.cpp
dialogs/panel_setup_feature_constraints_base.cpp
dialogs/panel_setup_layers.cpp
dialogs/panel_setup_layers_base.cpp
dialogs/panel_setup_netclasses.cpp
dialogs/panel_setup_netclasses_base.cpp
dialogs/panel_setup_text_and_graphics.cpp
dialogs/panel_setup_text_and_graphics_base.cpp
footprint_wizard.cpp
footprint_wizard_frame.cpp
footprint_wizard_frame_functions.cpp
@ -312,7 +317,6 @@ set( PCBNEW_CLASS_SRCS
tools/position_relative_tool.cpp
tools/selection.cpp
tools/selection_tool.cpp
tools/size_menu.cpp
tools/tool_event_utils.cpp
tools/tools_common.cpp
tools/zone_create_helper.cpp

View File

@ -28,24 +28,369 @@
#include <fctsys.h>
#include <common.h>
#include <class_board.h>
#include <layers_id_colors_and_visibility.h>
#include <kiface_i.h>
#include <pcbnew.h>
#include <board_design_settings.h>
#include <class_track.h>
#include <convert_to_biu.h>
#include <kiface_i.h>
#define TestMissingCourtyardKey wxT( "TestMissingCourtyard" )
#define TestFootprintCourtyardKey wxT( "TestFootprintCourtyard" )
#define MinHoleSeparationKey wxT( "MinHoleSeparation" )
#define CopperLayerCountKey wxT( "CopperLayerCount" )
#define BoardThicknessKey wxT( "BoardThickness" )
#define LayerKeyPrefix wxT( "Layer" )
#define LayerNameKey wxT( "Name" )
#define LayerTypeKey wxT( "Type" )
#define NetclassNameKey wxT( "Name" )
#define ClearanceKey wxT( "Clearance" )
#define TrackWidthKey wxT( "TrackWidth" )
#define ViaDiameterKey wxT( "ViaDiameter" )
#define ViaDrillKey wxT( "ViaDrill" )
#define uViaDiameterKey wxT( "uViaDiameter" )
#define uViaDrillKey wxT( "uViaDrill" )
#define dPairWidthKey wxT( "dPairWidth" )
#define dPairGapKey wxT( "dPairGap" )
#define dPairViaGapKey wxT( "dPairViaGap" )
//
// NOTE: layer configuration info is stored in both the BOARD and BOARD_DESIGN_SETTINGS so one
// of the two needs to read/write the config so we don't end up with order dependency issues.
//
class PARAM_CFG_LAYERS : public PARAM_CFG_BASE
{
protected:
BOARD* m_Pt_param; ///< Pointer to the parameter value
public:
PARAM_CFG_LAYERS( BOARD* ptparam, const wxChar* group = nullptr ) :
PARAM_CFG_BASE( wxEmptyString, PARAM_LAYERS, group )
{
m_Pt_param = ptparam;
}
void ReadParam( wxConfigBase* aConfig ) const override
{
if( !m_Pt_param || !aConfig )
return;
BOARD* board = m_Pt_param;
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
wxString oldPath = aConfig->GetPath();
bds.SetCopperLayerCount( aConfig->Read( CopperLayerCountKey, 2 ) );
double thickness = aConfig->ReadDouble( BoardThicknessKey, DEFAULT_BOARD_THICKNESS_MM );
bds.SetBoardThickness( Millimeter2iu( thickness ) );
for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
{
PCB_LAYER_ID layer = *seq;
wxString layerName;
int layerType;
aConfig->SetPath( oldPath );
aConfig->SetPath( LayerKeyPrefix + board->GetStandardLayerName( layer ) );
if( aConfig->Read( LayerNameKey, &layerName ) )
board->SetLayerName( layer, layerName );
if( aConfig->Read( LayerTypeKey, &layerType ) )
board->SetLayerType( layer, (LAYER_T) layerType );
}
aConfig->SetPath( oldPath );
}
void SaveParam( wxConfigBase* aConfig ) const override
{
if( !m_Pt_param || !aConfig )
return;
BOARD* board = m_Pt_param;
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
wxString oldPath = aConfig->GetPath();
wxString layerKeyPrefix = LayerKeyPrefix;
aConfig->Write( CopperLayerCountKey, board->GetCopperLayerCount() );
aConfig->Write( BoardThicknessKey, Iu2Millimeter( bds.GetBoardThickness() ) );
for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
{
PCB_LAYER_ID layer = *seq;
wxString stdName = board->GetStandardLayerName( layer );
wxString layerName = board->GetLayerName( layer );
LAYER_T layerType = board->GetLayerType( layer );
aConfig->SetPath( oldPath );
aConfig->SetPath( layerKeyPrefix + wxT( "." ) + stdName );
if( layerName == stdName && layerType == LT_SIGNAL )
{
aConfig->DeleteGroup( aConfig->GetPath() );
}
else
{
aConfig->Write( LayerNameKey, layerName );
aConfig->Write( LayerTypeKey, (int) layerType );
}
}
aConfig->SetPath( oldPath );
}
};
class PARAM_CFG_TRACKWIDTHS : public PARAM_CFG_BASE
{
protected:
std::vector<int>* m_Pt_param; ///< Pointer to the parameter value
public:
PARAM_CFG_TRACKWIDTHS( std::vector<int>* ptparam, const wxChar* group = nullptr ) :
PARAM_CFG_BASE( wxEmptyString, PARAM_TRACKWIDTHS, group )
{
m_Pt_param = ptparam;
}
void ReadParam( wxConfigBase* aConfig ) const override
{
if( !m_Pt_param || !aConfig )
return;
m_Pt_param->clear();
for( int index = 1; ; ++index )
{
wxString key = TrackWidthKey;
double width;
if( !aConfig->Read( key << index, &width ) )
break;
m_Pt_param->push_back( Millimeter2iu( width ) );
}
}
void SaveParam( wxConfigBase* aConfig ) const override
{
if( !m_Pt_param || !aConfig )
return;
for( size_t index = 1; index <= m_Pt_param->size(); ++index )
{
wxString key = TrackWidthKey;
aConfig->Write( key << index, Iu2Millimeter( m_Pt_param->at( index - 1 ) ) );
}
}
};
class PARAM_CFG_VIADIMENSIONS : public PARAM_CFG_BASE
{
protected:
std::vector<VIA_DIMENSION>* m_Pt_param; ///< Pointer to the parameter value
public:
PARAM_CFG_VIADIMENSIONS( std::vector<VIA_DIMENSION>* ptparam, const wxChar* group = nullptr ) :
PARAM_CFG_BASE( wxEmptyString, PARAM_VIADIMENSIONS, group )
{
m_Pt_param = ptparam;
}
void ReadParam( wxConfigBase* aConfig ) const override
{
if( !m_Pt_param || !aConfig )
return;
m_Pt_param->clear();
for( int index = 1; ; ++index )
{
double diameter = 0.0, drill = 0.0;
wxString key = ViaDiameterKey;
if( !aConfig->Read( key << index, &diameter ) )
break;
key = ViaDrillKey;
drill = aConfig->ReadDouble( key << index, 0.0 );
m_Pt_param->emplace_back( VIA_DIMENSION( Millimeter2iu( diameter ),
Millimeter2iu( drill ) ) );
}
}
void SaveParam( wxConfigBase* aConfig ) const override
{
if( !m_Pt_param || !aConfig )
return;
for( size_t index = 1; index <= m_Pt_param->size(); ++index )
{
wxString key = ViaDiameterKey;
aConfig->Write( key << index, Iu2Millimeter( m_Pt_param->at( index - 1 ).m_Diameter ) );
key = ViaDrillKey;
aConfig->Write( key << index, Iu2Millimeter( m_Pt_param->at( index - 1 ).m_Drill ) );
}
}
};
class PARAM_CFG_DIFFPAIRDIMENSIONS : public PARAM_CFG_BASE
{
protected:
std::vector<DIFF_PAIR_DIMENSION>* m_Pt_param; ///< Pointer to the parameter value
public:
PARAM_CFG_DIFFPAIRDIMENSIONS( std::vector<DIFF_PAIR_DIMENSION>* ptparam,
const wxChar* group = nullptr ) :
PARAM_CFG_BASE( wxEmptyString, PARAM_DIFFPAIRDIMENSIONS, group )
{
m_Pt_param = ptparam;
}
void ReadParam( wxConfigBase* aConfig ) const override
{
if( !m_Pt_param || !aConfig )
return;
m_Pt_param->clear();
for( int index = 1; ; ++index )
{
double width, gap, viagap;
wxString key = dPairWidthKey;
if( !aConfig->Read( key << index, &width ) )
break;
key = dPairGapKey;
gap = aConfig->ReadDouble( key << index, 0.0 );
key = dPairViaGapKey;
viagap = aConfig->ReadDouble( key << index, 0.0 );
m_Pt_param->emplace_back( DIFF_PAIR_DIMENSION( Millimeter2iu( width ),
Millimeter2iu( gap ),
Millimeter2iu( viagap ) ) );
}
}
void SaveParam( wxConfigBase* aConfig ) const override
{
if( !m_Pt_param || !aConfig )
return;
for( size_t index = 1; index <= m_Pt_param->size(); ++index )
{
wxString key = dPairWidthKey;
aConfig->Write( key << index, Iu2Millimeter( m_Pt_param->at( index - 1 ).m_Width ) );
key = dPairGapKey;
aConfig->Write( key << index, Iu2Millimeter( m_Pt_param->at( index - 1 ).m_Gap ) );
key = dPairViaGapKey;
aConfig->Write( key << index, Iu2Millimeter( m_Pt_param->at( index - 1 ).m_ViaGap ) );
}
}
};
class PARAM_CFG_NETCLASSES : public PARAM_CFG_BASE
{
protected:
NETCLASSES* m_Pt_param; ///< Pointer to the parameter value
public:
PARAM_CFG_NETCLASSES( const wxChar* ident, NETCLASSES* ptparam,
const wxChar* group = nullptr ) :
PARAM_CFG_BASE( ident, PARAM_NETCLASSES, group )
{
m_Pt_param = ptparam;
}
void ReadParam( wxConfigBase* aConfig ) const override
{
if( !m_Pt_param || !aConfig )
return;
wxString oldPath = aConfig->GetPath();
m_Pt_param->Clear();
for( int index = 1; ; ++index )
{
wxString pathIndex = wxString() << index;
wxString netclassName;
aConfig->SetPath( oldPath );
aConfig->SetPath( m_Ident );
aConfig->SetPath( pathIndex );
if( !aConfig->Read( NetclassNameKey, &netclassName ) )
break;
NETCLASSPTR netclass = std::make_shared<NETCLASS>( netclassName );
#define READ_MM( aKey, aDefault ) Millimeter2iu( aConfig->ReadDouble( aKey, aDefault ) )
netclass->SetClearance( READ_MM( ClearanceKey, netclass->GetClearance() ) );
netclass->SetTrackWidth( READ_MM( TrackWidthKey, netclass->GetTrackWidth() ) );
netclass->SetViaDiameter( READ_MM( ViaDiameterKey, netclass->GetViaDiameter() ) );
netclass->SetViaDrill( READ_MM( ViaDrillKey, netclass->GetViaDrill() ) );
netclass->SetuViaDiameter( READ_MM( uViaDiameterKey, netclass->GetuViaDiameter() ) );
netclass->SetuViaDrill( READ_MM( uViaDrillKey, netclass->GetuViaDrill() ) );
netclass->SetDiffPairWidth( READ_MM( dPairWidthKey, netclass->GetDiffPairWidth() ) );
netclass->SetDiffPairGap( READ_MM( dPairGapKey, netclass->GetDiffPairGap() ) );
netclass->SetDiffPairViaGap( READ_MM( dPairViaGapKey, netclass->GetDiffPairViaGap() ) );
m_Pt_param->Add( netclass );
}
aConfig->SetPath( oldPath );
}
void SaveParam( wxConfigBase* aConfig ) const override
{
if( !m_Pt_param || !aConfig )
return;
wxString oldPath = aConfig->GetPath();
int index = 1;
for( NETCLASSES::const_iterator nc = m_Pt_param->begin(); nc != m_Pt_param->end(); ++nc )
{
wxString pathIndex = wxString() << index++;
NETCLASSPTR netclass = nc->second;
aConfig->SetPath( oldPath );
aConfig->SetPath( m_Ident );
aConfig->SetPath( pathIndex );
aConfig->Write( NetclassNameKey, netclass->GetName() );
#define WRITE_MM( aKey, aValue ) aConfig->Write( aKey, Iu2Millimeter( aValue ) )
WRITE_MM( ClearanceKey, netclass->GetClearance() );
WRITE_MM( TrackWidthKey, netclass->GetTrackWidth() );
WRITE_MM( ViaDiameterKey, netclass->GetViaDiameter() );
WRITE_MM( ViaDrillKey, netclass->GetViaDrill() );
WRITE_MM( uViaDiameterKey, netclass->GetuViaDiameter() );
WRITE_MM( uViaDrillKey, netclass->GetuViaDrill() );
WRITE_MM( dPairWidthKey, netclass->GetDiffPairWidth() );
WRITE_MM( dPairGapKey, netclass->GetDiffPairGap() );
WRITE_MM( dPairViaGapKey, netclass->GetDiffPairViaGap() );
}
aConfig->SetPath( oldPath );
}
};
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_Pad_Master( NULL )
{
LSET all_set = LSET().set();
LSET all_set = LSET().set();
m_enabledLayers = all_set; // All layers enabled at first.
// SetCopperLayerCount() will adjust this.
@ -56,61 +401,79 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
SetCopperLayerCount( 2 ); // Default design is a double sided board
// via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA).
m_CurrentViaType = VIA_THROUGH;
// if true, when creating a new track starting on an existing track, use this track width
m_UseConnectedTrackWidth = false;
m_BlindBuriedViaAllowed = false; // true to allow blind/buried vias
m_MicroViasAllowed = false; // true to allow micro vias
m_BlindBuriedViaAllowed = false;
m_MicroViasAllowed = false;
m_DrawSegmentWidth = Millimeter2iu( DEFAULT_GRAPHIC_THICKNESS ); // current graphic line width (not EDGE layer)
m_LineThickness[ LAYER_CLASS_SILK ] = Millimeter2iu( DEFAULT_SILK_LINE_WIDTH );
m_TextSize[ LAYER_CLASS_SILK ] = wxSize( Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ),
Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_SILK ] = Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH );
m_TextItalic[ LAYER_CLASS_SILK ] = false;
m_TextUpright[ LAYER_CLASS_SILK ] = true;
m_EdgeSegmentWidth = Millimeter2iu( DEFAULT_PCB_EDGE_THICKNESS ); // current graphic line width (EDGE layer only)
m_PcbTextWidth = Millimeter2iu( DEFAULT_TEXT_PCB_THICKNESS ); // current Pcb (not module) Text width
m_LineThickness[ LAYER_CLASS_COPPER ] = Millimeter2iu( DEFAULT_COPPER_LINE_WIDTH );
m_TextSize[ LAYER_CLASS_COPPER ] = wxSize( Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ),
Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_COPPER ] = Millimeter2iu( DEFAULT_COPPER_TEXT_WIDTH );
m_TextItalic[ LAYER_CLASS_COPPER ] = false;
m_TextUpright[ LAYER_CLASS_COPPER ] = true;
m_PcbTextSize = wxSize( Millimeter2iu( DEFAULT_TEXT_PCB_SIZE ),
Millimeter2iu( DEFAULT_TEXT_PCB_SIZE ) ); // current Pcb (not module) Text size
// Edges & Courtyards; text properties aren't used but better to have them holding
// reasonable values than not.
m_LineThickness[ LAYER_CLASS_EDGES ] = Millimeter2iu( DEFAULT_EDGE_WIDTH );
m_TextSize[ LAYER_CLASS_EDGES ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
Millimeter2iu( DEFAULT_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_EDGES ] = Millimeter2iu( DEFAULT_TEXT_WIDTH );
m_TextItalic[ LAYER_CLASS_EDGES ] = false;
m_TextUpright[ LAYER_CLASS_EDGES ] = true;
m_LineThickness[ LAYER_CLASS_OTHERS ] = Millimeter2iu( DEFAULT_LINE_WIDTH );
m_TextSize[ LAYER_CLASS_OTHERS ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
Millimeter2iu( DEFAULT_TEXT_SIZE ) );
m_TextThickness[ LAYER_CLASS_OTHERS ] = Millimeter2iu( DEFAULT_TEXT_WIDTH );
m_TextItalic[ LAYER_CLASS_OTHERS ] = false;
m_TextUpright[ LAYER_CLASS_OTHERS ] = true;
m_useCustomTrackVia = false;
m_customTrackWidth = Millimeter2iu( DEFAULT_CUSTOMTRACKWIDTH );
m_customViaSize.m_Diameter = Millimeter2iu( DEFAULT_VIASMINSIZE );
m_customViaSize.m_Drill = Millimeter2iu( DEFAULT_VIASMINDRILL );
m_TrackMinWidth = Millimeter2iu( DEFAULT_TRACKMINWIDTH ); // track min width
m_ViasMinSize = Millimeter2iu( DEFAULT_VIASMINSIZE ); // via (not uvia) min diam
m_ViasMinDrill = Millimeter2iu( DEFAULT_VIASMINDRILL ); // via (not uvia) min drill diam
m_MicroViasMinSize = Millimeter2iu( DEFAULT_MICROVIASMINSIZE );// uvia (not via) min diam
m_MicroViasMinDrill = Millimeter2iu( DEFAULT_MICROVIASMINDRILL );// uvia (not via) min drill diam
m_useCustomDiffPair = false;
m_customDiffPair.m_Width = Millimeter2iu( DEFAULT_CUSTOMDPAIRWIDTH );
m_customDiffPair.m_Gap = Millimeter2iu( DEFAULT_CUSTOMDPAIRGAP );
m_customDiffPair.m_ViaGap = Millimeter2iu( DEFAULT_CUSTOMDPAIRVIAGAP );
m_TrackMinWidth = Millimeter2iu( DEFAULT_TRACKMINWIDTH );
m_ViasMinSize = Millimeter2iu( DEFAULT_VIASMINSIZE );
m_ViasMinDrill = Millimeter2iu( DEFAULT_VIASMINDRILL );
m_MicroViasMinSize = Millimeter2iu( DEFAULT_MICROVIASMINSIZE );
m_MicroViasMinDrill = Millimeter2iu( DEFAULT_MICROVIASMINDRILL );
// Global mask margins:
m_SolderMaskMargin = Millimeter2iu( DEFAULT_SOLDERMASK_CLEARANCE ); // Solder mask margin
m_SolderMaskMinWidth = Millimeter2iu( DEFAULT_SOLDERMASK_MIN_WIDTH ); // Solder mask min width
m_SolderMaskMargin = Millimeter2iu( DEFAULT_SOLDERMASK_CLEARANCE );
m_SolderMaskMinWidth = Millimeter2iu( DEFAULT_SOLDERMASK_MIN_WIDTH );
m_SolderPasteMargin = 0; // Solder paste margin absolute value
m_SolderPasteMarginRatio = 0.0; // Solder pask margin ratio value of pad size
m_SolderPasteMarginRatio = 0.0; // Solder paste margin as a ratio of pad size
// The final margin is the sum of these 2 values
// Usually < 0 because the mask is smaller than pad
// Layer thickness for 3D viewer
m_boardThickness = Millimeter2iu( DEFAULT_BOARD_THICKNESS_MM );
m_viaSizeIndex = 0;
m_trackWidthIndex = 0;
m_diffPairIndex = 0;
// Default values for the footprint editor and fp creation
// (also covers footprints created on the fly by micor-waves tools)
m_ModuleTextSize = wxSize( Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ) );
m_ModuleTextWidth = Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS );
m_ModuleSegmentWidth = Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS );
// These values will be overriden by config values after reading the config
// Default ref text on fp creation. if empty, use footprint name as default
// Default ref text on fp creation. If empty, use footprint name as default
m_RefDefaultText = wxT( "REF**" );
m_RefDefaultVisibility = true; // Default ref text visibility on fp creation
m_RefDefaultlayer = int( F_SilkS ); // Default ref text layer on fp creation
// Default value text on fp creation. if empty, use footprint name as default
m_RefDefaultVisibility = true;
m_RefDefaultlayer = int( F_SilkS );
// Default value text on fp creation. If empty, use footprint name as default
m_ValueDefaultText = wxEmptyString;
m_ValueDefaultVisibility = true;
m_ValueDefaultlayer = int( F_Fab );
@ -118,68 +481,159 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
// Add parameters to save in project config.
// values are saved in mm
void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult )
void BOARD_DESIGN_SETTINGS::AppendConfigs( BOARD* aBoard, PARAM_CFG_ARRAY* aResult )
{
m_Pad_Master.AppendConfigs( aResult );
aResult->push_back( new PARAM_CFG_LAYERS( aBoard ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextSizeV" ),
&m_PcbTextSize.y,
Millimeter2iu( DEFAULT_TEXT_PCB_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_BOOL( wxT( "AllowMicroVias" ),
&m_MicroViasAllowed, false ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextSizeH" ),
&m_PcbTextSize.x,
Millimeter2iu( DEFAULT_TEXT_PCB_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_BOOL( wxT( "AllowBlindVias" ),
&m_BlindBuriedViaAllowed, false ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PcbTextThickness" ),
&m_PcbTextWidth,
Millimeter2iu(DEFAULT_TEXT_PCB_THICKNESS ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_BOOL( wxT( "RequireCourtyardDefinitions" ),
&m_RequireCourtyards, false ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeV" ),
&m_ModuleTextSize.y,
DEFAULT_TEXT_MODULE_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_BOOL( wxT( "ProhibitOverlappingCourtyards" ),
&m_ProhibitOverlappingCourtyards, true ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeH" ),
&m_ModuleTextSize.x,
DEFAULT_TEXT_MODULE_SIZE, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinTrackWidth" ),
&m_TrackMinWidth,
Millimeter2iu( DEFAULT_TRACKMINWIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ),
nullptr, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleTextSizeThickness" ),
&m_ModuleTextWidth,
Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ), 1, TEXTS_MAX_WIDTH,
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinViaDiameter" ),
&m_ViasMinSize,
Millimeter2iu( DEFAULT_VIASMINSIZE ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ),
nullptr, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinViaDrill" ),
&m_ViasMinDrill,
Millimeter2iu( DEFAULT_VIASMINDRILL ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ),
nullptr, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinMicroViaDiameter" ),
&m_MicroViasMinSize,
Millimeter2iu( DEFAULT_MICROVIASMINSIZE ), Millimeter2iu( 0.01 ), Millimeter2iu( 10.0 ),
nullptr, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinMicroViaDrill" ),
&m_MicroViasMinDrill,
Millimeter2iu( DEFAULT_MICROVIASMINDRILL ), Millimeter2iu( 0.01 ), Millimeter2iu( 10.0 ),
nullptr, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "MinHoleToHole" ),
&m_HoleToHoleMin,
Millimeter2iu( DEFAULT_HOLETOHOLEMIN ), 0, Millimeter2iu( 10.0 ),
nullptr, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_TRACKWIDTHS( &m_TrackWidthList ) );
aResult->push_back( new PARAM_CFG_VIADIMENSIONS( &m_ViasDimensionsList ) );
aResult->push_back( new PARAM_CFG_DIFFPAIRDIMENSIONS( &m_DiffPairDimensionsList ) );
aResult->push_back( new PARAM_CFG_NETCLASSES( wxT( "Netclasses" ), &m_NetClasses ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkLineWidth" ),
&m_LineThickness[ LAYER_CLASS_SILK ],
Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
nullptr, MM_PER_IU, wxT( "ModuleOutlineThickness" ) ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkTextSizeV" ),
&m_TextSize[ LAYER_CLASS_SILK ].y,
Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
nullptr, MM_PER_IU, wxT( "ModuleTextSizeV" ) ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkTextSizeH" ),
&m_TextSize[ LAYER_CLASS_SILK ].x,
Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
nullptr, MM_PER_IU, wxT( "ModuleTextSizeH" ) ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SilkTextSizeThickness" ),
&m_TextThickness[ LAYER_CLASS_SILK ],
Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH,
nullptr, MM_PER_IU, wxT( "ModuleTextSizeThickness" ) ) );
aResult->push_back( new PARAM_CFG_BOOL( wxT( "SilkTextItalic" ),
&m_TextItalic[ LAYER_CLASS_SILK ], false ) );
aResult->push_back( new PARAM_CFG_BOOL( wxT( "SilkTextUpright" ),
&m_TextUpright[ LAYER_CLASS_SILK ], true ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperLineWidth" ),
&m_LineThickness[ LAYER_CLASS_COPPER ],
Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
nullptr, MM_PER_IU, wxT( "DrawSegmentWidth" ) ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperTextSizeV" ),
&m_TextSize[ LAYER_CLASS_COPPER ].y,
Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
nullptr, MM_PER_IU, wxT( "PcbTextSizeV" ) ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperTextSizeH" ),
&m_TextSize[ LAYER_CLASS_COPPER ].x,
Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
nullptr, MM_PER_IU, wxT( "PcbTextSizeH" ) ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "CopperTextThickness" ),
&m_TextThickness[ LAYER_CLASS_COPPER ],
Millimeter2iu( DEFAULT_COPPER_TEXT_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
nullptr, MM_PER_IU, wxT( "PcbTextThickness" ) ) );
aResult->push_back( new PARAM_CFG_BOOL( wxT( "CopperTextItalic" ),
&m_TextItalic[ LAYER_CLASS_COPPER ], false ) );
aResult->push_back( new PARAM_CFG_BOOL( wxT( "CopperTextUpright" ),
&m_TextUpright[ LAYER_CLASS_COPPER ], true ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "EdgesAndCourtyardsLineWidth" ),
&m_LineThickness[ LAYER_CLASS_EDGES ],
Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
nullptr, MM_PER_IU, wxT( "BoardOutlineThickness" ) ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersLineWidth" ),
&m_LineThickness[ LAYER_CLASS_OTHERS ],
Millimeter2iu( DEFAULT_SILK_LINE_WIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
nullptr, MM_PER_IU, wxT( "ModuleOutlineThickness" ) ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersTextSizeV" ),
&m_TextSize[ LAYER_CLASS_OTHERS ].x,
Millimeter2iu( DEFAULT_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
nullptr, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersTextSizeH" ),
&m_TextSize[ LAYER_CLASS_OTHERS ].y,
Millimeter2iu( DEFAULT_TEXT_SIZE ), TEXTS_MIN_SIZE, TEXTS_MAX_SIZE,
nullptr, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "OthersTextSizeThickness" ),
&m_TextThickness[ LAYER_CLASS_OTHERS ],
Millimeter2iu( DEFAULT_TEXT_WIDTH ), 1, TEXTS_MAX_WIDTH,
nullptr, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_BOOL( wxT( "OthersTextItalic" ),
&m_TextItalic[ LAYER_CLASS_OTHERS ], false ) );
aResult->push_back( new PARAM_CFG_BOOL( wxT( "OthersTextUpright" ),
&m_TextUpright[ LAYER_CLASS_OTHERS ], true ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskClearance" ),
&m_SolderMaskMargin,
Millimeter2iu( DEFAULT_SOLDERMASK_CLEARANCE ), 0, Millimeter2iu( 1.0 ),
NULL, MM_PER_IU ) );
&m_SolderMaskMargin,
Millimeter2iu( DEFAULT_SOLDERMASK_CLEARANCE ), Millimeter2iu( -1.0 ), Millimeter2iu( 1.0 ),
nullptr, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskMinWidth" ),
&m_SolderMaskMinWidth,
Millimeter2iu( DEFAULT_SOLDERMASK_MIN_WIDTH ), 0, Millimeter2iu( 0.5 ),
NULL, MM_PER_IU ) );
&m_SolderMaskMinWidth,
Millimeter2iu( DEFAULT_SOLDERMASK_MIN_WIDTH ), 0, Millimeter2iu( 1.0 ),
nullptr, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "DrawSegmentWidth" ),
&m_DrawSegmentWidth,
Millimeter2iu( DEFAULT_GRAPHIC_THICKNESS ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderPasteClearance" ),
&m_SolderPasteMargin,
Millimeter2iu( DEFAULT_SOLDERPASTE_CLEARANCE ), Millimeter2iu( -1.0 ), Millimeter2iu( 1.0 ),
nullptr, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "BoardOutlineThickness" ),
&m_EdgeSegmentWidth,
Millimeter2iu( DEFAULT_PCB_EDGE_THICKNESS ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "ModuleOutlineThickness" ),
&m_ModuleSegmentWidth,
Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ),
NULL, MM_PER_IU ) );
aResult->push_back( new PARAM_CFG_DOUBLE( wxT( "SolderPasteRatio" ),
&m_SolderPasteMarginRatio,
DEFAULT_SOLDERPASTE_RATIO, 0, 10.0 ) );
}
@ -189,28 +643,39 @@ bool BOARD_DESIGN_SETTINGS::SetCurrentNetClass( const wxString& aNetClassName )
bool lists_sizes_modified = false;
// if not found (should not happen) use the default
if( netClass == NULL )
if( !netClass )
netClass = m_NetClasses.GetDefault();
m_currentNetClassName = netClass->GetName();
// Initialize others values:
if( m_ViasDimensionsList.size() == 0 )
{
VIA_DIMENSION viadim;
lists_sizes_modified = true;
m_ViasDimensionsList.push_back( viadim );
}
if( m_TrackWidthList.size() == 0 )
{
lists_sizes_modified = true;
m_TrackWidthList.push_back( 0 );
}
if( m_ViasDimensionsList.size() == 0 )
{
lists_sizes_modified = true;
m_ViasDimensionsList.emplace_back( VIA_DIMENSION() );
}
if( m_DiffPairDimensionsList.size() == 0 )
{
lists_sizes_modified = true;
m_DiffPairDimensionsList.emplace_back( DIFF_PAIR_DIMENSION() );
}
/* note the m_ViasDimensionsList[0] and m_TrackWidthList[0] values
* are always the Netclass values
*/
if( m_TrackWidthList[0] != netClass->GetTrackWidth() )
{
lists_sizes_modified = true;
m_TrackWidthList[0] = netClass->GetTrackWidth();
}
if( m_ViasDimensionsList[0].m_Diameter != netClass->GetViaDiameter() )
{
lists_sizes_modified = true;
@ -223,10 +688,22 @@ bool BOARD_DESIGN_SETTINGS::SetCurrentNetClass( const wxString& aNetClassName )
m_ViasDimensionsList[0].m_Drill = netClass->GetViaDrill();
}
if( m_TrackWidthList[0] != netClass->GetTrackWidth() )
if( m_DiffPairDimensionsList[0].m_Width != netClass->GetDiffPairWidth() )
{
lists_sizes_modified = true;
m_TrackWidthList[0] = netClass->GetTrackWidth();
m_DiffPairDimensionsList[0].m_Width = netClass->GetDiffPairWidth();
}
if( m_DiffPairDimensionsList[0].m_Gap != netClass->GetDiffPairGap() )
{
lists_sizes_modified = true;
m_DiffPairDimensionsList[0].m_Gap = netClass->GetDiffPairGap();
}
if( m_DiffPairDimensionsList[0].m_ViaGap != netClass->GetDiffPairViaGap() )
{
lists_sizes_modified = true;
m_DiffPairDimensionsList[0].m_ViaGap = netClass->GetDiffPairViaGap();
}
if( GetViaSizeIndex() >= m_ViasDimensionsList.size() )
@ -235,6 +712,9 @@ bool BOARD_DESIGN_SETTINGS::SetCurrentNetClass( const wxString& aNetClassName )
if( GetTrackWidthIndex() >= m_TrackWidthList.size() )
SetTrackWidthIndex( m_TrackWidthList.size() );
if( GetDiffPairIndex() >= m_DiffPairDimensionsList.size() )
SetDiffPairIndex( m_DiffPairDimensionsList.size() );
return lists_sizes_modified;
}
@ -287,11 +767,7 @@ int BOARD_DESIGN_SETTINGS::GetCurrentMicroViaDrill()
void BOARD_DESIGN_SETTINGS::SetViaSizeIndex( unsigned aIndex )
{
if( aIndex >= m_ViasDimensionsList.size() )
m_viaSizeIndex = m_ViasDimensionsList.size();
else
m_viaSizeIndex = aIndex;
m_viaSizeIndex = std::min( aIndex, (unsigned) m_ViasDimensionsList.size() );
m_useCustomTrackVia = false;
}
@ -311,76 +787,33 @@ int BOARD_DESIGN_SETTINGS::GetCurrentViaDrill() const
void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( unsigned aIndex )
{
if( aIndex >= m_TrackWidthList.size() )
m_trackWidthIndex = m_TrackWidthList.size();
else
m_trackWidthIndex = aIndex;
m_trackWidthIndex = std::min( aIndex, (unsigned) m_TrackWidthList.size() );
m_useCustomTrackVia = false;
}
int BOARD_DESIGN_SETTINGS::GetMinHoleSeparation() const
void BOARD_DESIGN_SETTINGS::SetDiffPairIndex( unsigned aIndex )
{
// 6.0 TODO: we need to decide where these go, but until then don't disturb the
// file format unnecessarily.
wxConfigBase* config = Kiface().KifaceSettings();
int value;
config->Read( MinHoleSeparationKey, &value, Millimeter2iu( DEFAULT_HOLETOHOLEMIN ) );
return value;
m_diffPairIndex = std::min( aIndex, (unsigned) 8 );
m_useCustomDiffPair = false;
}
void BOARD_DESIGN_SETTINGS::SetMinHoleSeparation( int aDistance )
{
// 6.0 TODO: we need to decide where these go, but until then don't disturb the
// file format unnecessarily.
wxConfigBase* config = Kiface().KifaceSettings();
config->Write( MinHoleSeparationKey, aDistance );
m_HoleToHoleMin = aDistance;
}
bool BOARD_DESIGN_SETTINGS::RequireCourtyardDefinitions() const
{
// 6.0 TODO: we need to decide where these go, but until then don't disturb the
// file format unnecessarily.
wxConfigBase* config = Kiface().KifaceSettings();
bool value;
config->Read( TestMissingCourtyardKey, &value, false );
return value;
}
void BOARD_DESIGN_SETTINGS::SetRequireCourtyardDefinitions( bool aRequire )
{
// 6.0 TODO: we need to decide where these go, but until then don't disturb the
// file format unnecessarily.
wxConfigBase* config = Kiface().KifaceSettings();
config->Write( TestMissingCourtyardKey, aRequire );
m_RequireCourtyards = aRequire;
}
bool BOARD_DESIGN_SETTINGS::ProhibitOverlappingCourtyards() const
void BOARD_DESIGN_SETTINGS::SetProhibitOverlappingCourtyards( bool aProhibit )
{
// 6.0 TODO: we need to decide where these go, but until then don't disturb the
// file format unnecessarily.
wxConfigBase* config = Kiface().KifaceSettings();
bool value;
config->Read( TestFootprintCourtyardKey, &value, false );
return value;
}
void BOARD_DESIGN_SETTINGS::SetProhibitOverlappingCourtyards( bool aRequire )
{
// 6.0 TODO: we need to decide where these go, but until then don't disturb the
// file format unnecessarily.
wxConfigBase* config = Kiface().KifaceSettings();
config->Write( TestFootprintCourtyardKey, aRequire );
m_ProhibitOverlappingCourtyards = aProhibit;
}
@ -393,10 +826,7 @@ void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
void BOARD_DESIGN_SETTINGS::SetLayerVisibility( PCB_LAYER_ID aLayer, bool aNewState )
{
if( aNewState && IsLayerEnabled( aLayer ) )
m_visibleLayers.set( aLayer, true );
else
m_visibleLayers.set( aLayer, false );
m_visibleLayers.set( aLayer, aNewState && IsLayerEnabled( aLayer ));
}
@ -449,6 +879,51 @@ void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LSET aMask )
}
// Return the layer class index { silk, copper, edges & courtyards, others } of the
// given layer.
int BOARD_DESIGN_SETTINGS::GetLayerClass( PCB_LAYER_ID aLayer ) const
{
if( aLayer == F_SilkS || aLayer == B_SilkS )
return 0;
else if( IsCopperLayer( aLayer ) )
return 1;
else if( aLayer == Edge_Cuts || aLayer == F_CrtYd || aLayer == B_CrtYd )
return 2;
else
return 3;
}
int BOARD_DESIGN_SETTINGS::GetLineThickness( PCB_LAYER_ID aLayer ) const
{
return m_LineThickness[ GetLayerClass( aLayer ) ];
}
wxSize BOARD_DESIGN_SETTINGS::GetTextSize( PCB_LAYER_ID aLayer ) const
{
return m_TextSize[ GetLayerClass( aLayer ) ];
}
int BOARD_DESIGN_SETTINGS::GetTextThickness( PCB_LAYER_ID aLayer ) const
{
return m_TextThickness[ GetLayerClass( aLayer ) ];
}
bool BOARD_DESIGN_SETTINGS::GetTextItalic( PCB_LAYER_ID aLayer ) const
{
return m_TextItalic[ GetLayerClass( aLayer ) ];
}
bool BOARD_DESIGN_SETTINGS::GetTextUpright( PCB_LAYER_ID aLayer ) const
{
return m_TextUpright[ GetLayerClass( aLayer ) ];
}
#ifndef NDEBUG
struct list_size_check {
list_size_check()
@ -460,3 +935,5 @@ struct list_size_check {
};
static list_size_check check;
#endif

View File

@ -56,7 +56,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type ) :
MODULE* module = static_cast<MODULE*>( m_Parent );
m_Type = text_type;
m_unlocked = false;
m_keepUpright = true;
// Set text thickness to a default value
SetThickness( Millimeter2iu( 0.15 ) );
@ -341,11 +341,7 @@ double TEXTE_MODULE::GetDrawRotation() const
if( module )
rotation += module->GetOrientation();
if( m_unlocked )
{
NORMALIZE_ANGLE_POS( rotation );
}
else
if( m_keepUpright )
{
// Keep angle between -90 .. 90 deg. Otherwise the text is not easy to read
while( rotation > 900 )
@ -354,6 +350,10 @@ double TEXTE_MODULE::GetDrawRotation() const
while( rotation < -900 )
rotation += 1800;
}
else
{
NORMALIZE_ANGLE_POS( rotation );
}
return rotation;
}

View File

@ -87,14 +87,14 @@ public:
void SetTextAngle( double aAngle );
bool IsUnlocked()
bool IsKeepUpright()
{
return m_unlocked;
return m_keepUpright;
}
void SetUnlocked( bool unlocked )
void SetKeepUpright( bool aKeepUpright )
{
m_unlocked = unlocked;
m_keepUpright = aKeepUpright;
}
/// Rotate text, in footprint editor
@ -243,7 +243,7 @@ private:
wxPoint m_Pos0; ///< text coordinates relative to the footprint anchor, orient 0.
///< text coordinate ref point is the text center
bool m_unlocked;
bool m_keepUpright;
};
#endif // TEXT_MODULE_H_

View File

@ -0,0 +1,87 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <pcb_edit_frame.h>
#include <panel_setup_layers.h>
#include <panel_setup_text_and_graphics.h>
#include <panel_setup_feature_constraints.h>
#include <panel_setup_netclasses.h>
#include <panel_setup_mask_and_paste.h>
#include <wildcards_and_files_ext.h>
#include <confirm.h>
#include <project.h>
#include <kiface_i.h>
#include "dialog_import_settings.h"
#include "dialog_board_setup.h"
DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
PAGED_DIALOG( aFrame, _( "Board Setup" ), _( "Import Settings..." ) ),
m_frame( aFrame )
{
m_layers = new PANEL_SETUP_LAYERS( this, aFrame );
m_textAndGraphics = new PANEL_SETUP_TEXT_AND_GRAPHICS( this, aFrame );
m_constraints = new PANEL_SETUP_FEATURE_CONSTRAINTS( this, aFrame );
m_netclasses = new PANEL_SETUP_NETCLASSES( this, aFrame, m_constraints );
m_maskAndPaste = new PANEL_SETUP_MASK_AND_PASTE( this, aFrame );
AddPage( m_layers, _( "Layers" ) );
AddSubPage( m_textAndGraphics, _( "Text & Graphics" ) );
AddPage( m_constraints, _( "Design Rules" ) );
AddSubPage( m_netclasses, _( "Net Classes" ) );
AddSubPage( m_maskAndPaste, _( "Solder Mask/Paste" ) );
}
// Run Import Settings... action
void DIALOG_BOARD_SETUP::OnAuxiliaryAction( wxCommandEvent& event )
{
DIALOG_IMPORT_SETTINGS importDlg( this, m_frame );
if( importDlg.ShowModal() == wxID_CANCEL )
return;
wxConfigBase* cfg = new wxFileConfig( wxEmptyString, wxEmptyString, importDlg.GetFilePath() );
// We do not want expansion of env var values when reading our project config file
cfg->SetExpandEnvVars( false );
cfg->SetPath( wxCONFIG_PATH_SEPARATOR );
BOARD* dummyBoard = new BOARD();
PARAM_CFG_ARRAY designSettingsConfig;
dummyBoard->GetDesignSettings().AppendConfigs( dummyBoard, &designSettingsConfig );
wxConfigLoadParams( cfg, designSettingsConfig, GROUP_PCB );
if( importDlg.m_LayersOpt->GetValue() )
m_layers->ImportSettingsFrom( dummyBoard );
if( importDlg.m_TextAndGraphicsOpt->GetValue() )
m_textAndGraphics->ImportSettingsFrom( dummyBoard );
if( importDlg.m_ConstraintsOpt->GetValue() )
m_constraints->ImportSettingsFrom( dummyBoard );
if( importDlg.m_NetclassesOpt->GetValue() )
m_netclasses->ImportSettingsFrom( dummyBoard );
if( importDlg.m_MaskAndPasteOpt->GetValue() )
m_maskAndPaste->ImportSettingsFrom( dummyBoard );
delete dummyBoard;
delete cfg;
}

View File

@ -0,0 +1,53 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KICAD_DIALOG_BOARD_SETUP_H
#define KICAD_DIALOG_BOARD_SETUP_H
#include <widgets/paged_dialog.h>
class PCB_EDIT_FRAME;
class PANEL_SETUP_FEATURE_CONSTRAINTS;
class PANEL_SETUP_LAYERS;
class PANEL_SETUP_TEXT_AND_GRAPHICS;
class PANEL_SETUP_NETCLASSES;
class PANEL_SETUP_MASK_AND_PASTE;
class DIALOG_BOARD_SETUP : public PAGED_DIALOG
{
public:
DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame );
protected:
void OnAuxiliaryAction( wxCommandEvent& event ) override;
PCB_EDIT_FRAME* m_frame;
PANEL_SETUP_FEATURE_CONSTRAINTS* m_constraints;
PANEL_SETUP_LAYERS* m_layers;
PANEL_SETUP_TEXT_AND_GRAPHICS* m_textAndGraphics;
PANEL_SETUP_NETCLASSES* m_netclasses;
PANEL_SETUP_MASK_AND_PASTE* m_maskAndPaste;
};
#endif //KICAD_DIALOG_BOARD_SETUP_H

File diff suppressed because it is too large Load Diff

View File

@ -1,179 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2009 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2009-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file dialog_design_rules.h
*/
#ifndef __dialog_design_rules_h_
#define __dialog_design_rules_h_
#include <../class_board.h>
#include <widgets/unit_binder.h>
#include <dialog_design_rules_base.h>
#include <float.h>
#include <wx/valnum.h>
class PCB_EDIT_FRAME;
class BOARD_DESIGN_SETTINGS;
// helper struct to handle a net and its netclass in dialog design rule editor
struct NETCUP
{
NETCUP( const wxString& aNet, const wxString& aClass )
{
net = aNet;
clazz = aClass;
}
wxString net; ///< a net name
wxString clazz; ///< a class name
};
typedef std::vector<NETCUP> NETCUPS;
typedef std::vector<NETCUP*> PNETCUPS;
class DIALOG_DESIGN_RULES : public DIALOG_DESIGN_RULES_BASE
{
private:
static const wxString wildCard; // The name of a fictitious netclass
// which includes all NETs
static int s_LastTabSelection; // Which tab user had open last
PCB_EDIT_FRAME* m_Parent;
BOARD* m_Pcb;
BOARD_DESIGN_SETTINGS* m_BrdSettings;
int* m_originalColWidths;
wxString m_gridErrorMsg;
wxGrid* m_gridErrorGrid;
int m_gridErrorRow;
int m_gridErrorCol;
bool m_netclassesDirty; // Indicates the netclass drop-down
// menus need rebuilding
UNIT_BINDER m_trackMinWidth;
UNIT_BINDER m_viaMinDiameter;
UNIT_BINDER m_viaMinDrill;
UNIT_BINDER m_microViaMinDiameter;
UNIT_BINDER m_microViaMinDrill;
wxFloatingPointValidator< double > m_validator; // Floating point validator
/**
* A two column table which gets filled once and never loses any elements, so it is
* basically constant, except that the NETCUP::clazz member can change for any
* given row a NET is moved in and out of a class. class reflects the respective
* NET's current net class.
*/
NETCUPS m_AllNets;
// List of values to "customize" some tracks and vias
std::vector <VIA_DIMENSION> m_ViasDimensionsList;
std::vector <int> m_TracksWidthList;
private:
void OnNetClassesNameLeftClick( wxGridEvent& event ) override { event.Skip(); }
void OnNetClassesNameRightClick( wxGridEvent& event ) override { event.Skip(); }
void OnAddNetclassClick( wxCommandEvent& event ) override;
void OnRemoveNetclassClick( wxCommandEvent& event ) override;
void CheckAllowMicroVias();
void OnAllowMicroVias( wxCommandEvent& event ) override;
void OnSizeNetclassGrid( wxSizeEvent& event ) override;
void OnUpdateUI( wxUpdateUIEvent &event ) override;
void OnNetclassGridCellChanging( wxGridEvent& event );
void OnMoveUpSelectedNetClass( wxCommandEvent& event ) override;
void OnMoveDownSelectedNetClass( wxCommandEvent& event ) override;
void OnLeftCBSelection( wxCommandEvent& event ) override;
void OnRightCBSelection( wxCommandEvent& event ) override;
void OnRightToLeftCopyButton( wxCommandEvent& event ) override;
void OnLeftToRightCopyButton( wxCommandEvent& event ) override;
void OnNotebookPageChanged( wxNotebookEvent& event ) override;
void OnLeftSelectAllButton( wxCommandEvent& event ) override;
void OnRightSelectAllButton( wxCommandEvent& event ) override;
bool validateNetclassName( int aRow, wxString aName, bool focusFirst = true );
bool validateData();
void transferNetclassesToWindow();
void transferGlobalRulesToWindow();
void rebuildNetclassDropdowns();
/* Populates the lists of sizes (Tracks width list and Vias diameters & drill list) */
void InitDimensionsLists();
void CopyNetclassesToBoard();
void CopyGlobalRulesToBoard();
void CopyDimensionsListsToBoard( );
void SetRoutableLayerStatus();
/**
* Function FillListBoxWithNetNames
* populates aListCtrl with net names and class names from m_AllNets in a two column display.
*/
void FillListBoxWithNetNames( NETS_LIST_CTRL* aListCtrl, const wxString& aNetClass );
/**
* Function swapNetClass
* replaces one net class name with another in the master list, m_AllNets.
*/
void swapNetClass( const wxString& oldClass, const wxString& newClass )
{
for( NETCUPS::iterator i = m_AllNets.begin(); i!=m_AllNets.end(); ++i )
{
if( i->clazz == oldClass )
i->clazz = newClass;
}
}
void makePointers( PNETCUPS* aList, const wxString& aNetClassName );
void setNetClass( const wxString& aNetName, const wxString& aClassName );
void moveSelectedItems( NETS_LIST_CTRL* src, const wxString& newClassName );
void setGridError( wxGrid* aGrid, const wxString& aMsg, int aRow, int aCol );
void AdjustNetclassGridColumns( int aWidth );
public:
DIALOG_DESIGN_RULES( PCB_EDIT_FRAME* parent );
~DIALOG_DESIGN_RULES( );
virtual bool TransferDataToWindow() override;
virtual bool TransferDataFromWindow() override;
};
#endif //__dialog_design_rules_h_

View File

@ -1,78 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __dialog_design_rules_aux_helper_class_h_
#define __dialog_design_rules_aux_helper_class_h_
#include <wx/listctrl.h>
/**
* Class NETS_LIST_CTRL
* is a helper to display lists of nets and associated netclasses
* used in dialog design rules.
* It's needed because the 2 "wxListCtl"s used to display lists of nets
* uses the wxLC_VIRTUAL option. The method:
*
* virtual wxString OnGetItemText( long item, long column ) const
*
* must be overloaded.
*/
class NETS_LIST_CTRL: public wxListCtrl
{
public:
NETS_LIST_CTRL( wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxLC_ICON ):
wxListCtrl( parent, id, pos, size, style )
{
};
void ClearList()
{
SetItemCount( 0 );
m_Netnames.Clear();
m_Classnames.Clear();
}
/**
* Function OnGetItemText
* is an overloaded method needed by wxListCtrl with wxLC_VIRTUAL options
*/
virtual wxString OnGetItemText( long item, long column ) const override;
/**
* Function SetRowItems
* sets the net name and the net class name at @a aRow.
* @param aRow = row index (if aRow > number of stored row, empty rows will be created)
* @param aNetname = the string to display in row aRow, column 0
* @param aNetclassName = the string to display in row aRow, column 1
*/
void SetRowItems( unsigned aRow, const wxString& aNetname, const wxString& aNetclassName );
private:
wxArrayString m_Netnames; ///< column 0: nets
wxArrayString m_Classnames; ///< column 1: netclasses
};
#endif //__dialog_design_rules_aux_helper_class_h_

View File

@ -1,438 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_design_rules_aux_helper_class.h"
#include "dialog_design_rules_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxSize( -1,-1 ) );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_DRnotebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP );
m_panelNetClassesEditor = new wxPanel( m_DRnotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bpanelNetClassesSizer;
bpanelNetClassesSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerUpper;
sbSizerUpper = new wxStaticBoxSizer( new wxStaticBox( m_panelNetClassesEditor, wxID_ANY, _("Net Classes") ), wxVERTICAL );
m_grid = new wxGrid( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxSUNKEN_BORDER|wxTAB_TRAVERSAL|wxVSCROLL );
// Grid
m_grid->CreateGrid( 1, 9 );
m_grid->EnableEditing( true );
m_grid->EnableGridLines( true );
m_grid->EnableDragGridSize( false );
m_grid->SetMargins( 0, 0 );
// Columns
m_grid->SetColSize( 0, 120 );
m_grid->SetColSize( 1, 100 );
m_grid->SetColSize( 2, 100 );
m_grid->SetColSize( 3, 100 );
m_grid->SetColSize( 4, 100 );
m_grid->SetColSize( 5, 100 );
m_grid->SetColSize( 6, 100 );
m_grid->SetColSize( 7, 100 );
m_grid->SetColSize( 8, 100 );
m_grid->EnableDragColMove( false );
m_grid->EnableDragColSize( true );
m_grid->SetColLabelSize( 22 );
m_grid->SetColLabelValue( 0, _("Name") );
m_grid->SetColLabelValue( 1, _("Clearance") );
m_grid->SetColLabelValue( 2, _("Track Width") );
m_grid->SetColLabelValue( 3, _("Via Dia") );
m_grid->SetColLabelValue( 4, _("Via Drill") );
m_grid->SetColLabelValue( 5, _("uVia Dia") );
m_grid->SetColLabelValue( 6, _("uVia Drill") );
m_grid->SetColLabelValue( 7, _("Diff Pair Width") );
m_grid->SetColLabelValue( 8, _("Diff Pair Gap") );
m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_grid->EnableDragRowSize( false );
m_grid->SetRowLabelSize( 0 );
m_grid->SetRowLabelValue( 0, _("Default") );
m_grid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_grid->SetToolTip( _("Net Class parameters") );
sbSizerUpper->Add( m_grid, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* buttonBoxSizer;
buttonBoxSizer = new wxBoxSizer( wxHORIZONTAL );
m_addButton = new wxBitmapButton( m_panelNetClassesEditor, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW );
m_addButton->SetMinSize( wxSize( 29,29 ) );
buttonBoxSizer->Add( m_addButton, 0, wxLEFT, 5 );
m_removeButton = new wxBitmapButton( m_panelNetClassesEditor, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW );
m_removeButton->SetMinSize( wxSize( 29,29 ) );
buttonBoxSizer->Add( m_removeButton, 0, wxRIGHT, 10 );
m_moveUpButton = new wxBitmapButton( m_panelNetClassesEditor, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW );
m_moveUpButton->SetMinSize( wxSize( 29,29 ) );
buttonBoxSizer->Add( m_moveUpButton, 0, wxLEFT, 5 );
m_moveDownButton = new wxBitmapButton( m_panelNetClassesEditor, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW );
m_moveDownButton->SetMinSize( wxSize( 29,29 ) );
buttonBoxSizer->Add( m_moveDownButton, 0, wxRIGHT, 5 );
sbSizerUpper->Add( buttonBoxSizer, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 2 );
bpanelNetClassesSizer->Add( sbSizerUpper, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
wxStaticBoxSizer* sbSizerNetSelectMain;
sbSizerNetSelectMain = new wxStaticBoxSizer( new wxStaticBox( m_panelNetClassesEditor, wxID_ANY, _("Net Class Membership") ), wxHORIZONTAL );
wxBoxSizer* leftNetSelectBoxSizer;
leftNetSelectBoxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxHORIZONTAL );
m_leftClassChoice = new wxComboBox( m_panelNetClassesEditor, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
bSizer10->Add( m_leftClassChoice, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_staticline21 = new wxStaticLine( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
bSizer10->Add( m_staticline21, 0, wxEXPAND | wxALL, 5 );
m_buttonLeftSelAll = new wxButton( m_panelNetClassesEditor, wxID_ANY, _("Select All"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonLeftSelAll->SetToolTip( _("Select all nets in the left list") );
bSizer10->Add( m_buttonLeftSelAll, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
leftNetSelectBoxSizer->Add( bSizer10, 0, wxEXPAND, 5 );
m_leftListCtrl = new NETS_LIST_CTRL( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VIRTUAL|wxLC_VRULES|wxSUNKEN_BORDER );
leftNetSelectBoxSizer->Add( m_leftListCtrl, 1, wxALL|wxEXPAND, 5 );
sbSizerNetSelectMain->Add( leftNetSelectBoxSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bmiddleSizerNetSelect;
bmiddleSizerNetSelect = new wxBoxSizer( wxVERTICAL );
m_buttonRightToLeft = new wxButton( m_panelNetClassesEditor, ID_LEFT_TO_RIGHT_COPY, _("<<<"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonRightToLeft->SetToolTip( _("Move the selected nets in the right list to the left list") );
bmiddleSizerNetSelect->Add( m_buttonRightToLeft, 0, wxALL, 5 );
m_buttonLeftToRight = new wxButton( m_panelNetClassesEditor, ID_RIGHT_TO_LEFT_COPY, _(">>>"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonLeftToRight->SetToolTip( _("Move the selected nets in the left list to the right list") );
bmiddleSizerNetSelect->Add( m_buttonLeftToRight, 0, wxALL, 5 );
sbSizerNetSelectMain->Add( bmiddleSizerNetSelect, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* rghtNetSelectBoxSizer;
rghtNetSelectBoxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer11;
bSizer11 = new wxBoxSizer( wxHORIZONTAL );
m_rightClassChoice = new wxComboBox( m_panelNetClassesEditor, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
bSizer11->Add( m_rightClassChoice, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_staticline3 = new wxStaticLine( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
bSizer11->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 );
m_buttonRightSelAll = new wxButton( m_panelNetClassesEditor, wxID_ANY, _("Select All"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonRightSelAll->SetToolTip( _("Select all nets in the right list") );
bSizer11->Add( m_buttonRightSelAll, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
rghtNetSelectBoxSizer->Add( bSizer11, 0, wxEXPAND, 5 );
m_rightListCtrl = new NETS_LIST_CTRL( m_panelNetClassesEditor, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_VIRTUAL|wxLC_VRULES|wxSUNKEN_BORDER );
rghtNetSelectBoxSizer->Add( m_rightListCtrl, 1, wxALL|wxEXPAND, 5 );
sbSizerNetSelectMain->Add( rghtNetSelectBoxSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bpanelNetClassesSizer->Add( sbSizerNetSelectMain, 1, wxALL|wxEXPAND, 5 );
m_panelNetClassesEditor->SetSizer( bpanelNetClassesSizer );
m_panelNetClassesEditor->Layout();
bpanelNetClassesSizer->Fit( m_panelNetClassesEditor );
m_DRnotebook->AddPage( m_panelNetClassesEditor, _("Net Classes Editor"), true );
m_panelGolbalDesignRules = new wxPanel( m_DRnotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bpanelGlobRulesSizer;
bpanelGlobRulesSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbRoutingOptionSizer;
sbRoutingOptionSizer = new wxStaticBoxSizer( new wxStaticBox( m_panelGolbalDesignRules, wxID_ANY, _("Routing Options") ), wxVERTICAL );
wxFlexGridSizer* fgViaOptionsSize;
fgViaOptionsSize = new wxFlexGridSizer( 0, 3, 0, 0 );
fgViaOptionsSize->AddGrowableCol( 1 );
fgViaOptionsSize->SetFlexibleDirection( wxBOTH );
fgViaOptionsSize->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_TrackMinWidthTitle = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("Minimum track width:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_TrackMinWidthTitle->Wrap( -1 );
fgViaOptionsSize->Add( m_TrackMinWidthTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_SetTrackMinWidthCtrl = new wxTextCtrl( m_panelGolbalDesignRules, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgViaOptionsSize->Add( m_SetTrackMinWidthCtrl, 0, wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_TrackMinWidthUnits = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_TrackMinWidthUnits->Wrap( -1 );
fgViaOptionsSize->Add( m_TrackMinWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_ViaMinTitle = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("Minimum via diameter:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_ViaMinTitle->Wrap( -1 );
fgViaOptionsSize->Add( m_ViaMinTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_SetViasMinSizeCtrl = new wxTextCtrl( m_panelGolbalDesignRules, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgViaOptionsSize->Add( m_SetViasMinSizeCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_ViaMinUnits = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_ViaMinUnits->Wrap( -1 );
fgViaOptionsSize->Add( m_ViaMinUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_ViaMinDrillTitle = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("Minimum via drill:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_ViaMinDrillTitle->Wrap( -1 );
fgViaOptionsSize->Add( m_ViaMinDrillTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_SetViasMinDrillCtrl = new wxTextCtrl( m_panelGolbalDesignRules, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgViaOptionsSize->Add( m_SetViasMinDrillCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_ViaMinDrillUnits = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_ViaMinDrillUnits->Wrap( -1 );
fgViaOptionsSize->Add( m_ViaMinDrillUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
fgViaOptionsSize->Add( 0, 0, 1, wxEXPAND, 5 );
m_OptAllowBlindBuriedVias = new wxCheckBox( m_panelGolbalDesignRules, wxID_ANY, _("Allow blind/buried vias"), wxDefaultPosition, wxDefaultSize, 0 );
fgViaOptionsSize->Add( m_OptAllowBlindBuriedVias, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
fgViaOptionsSize->Add( 0, 0, 1, wxEXPAND, 5 );
fgViaOptionsSize->Add( 0, 0, 1, wxEXPAND, 5 );
m_OptAllowMicroVias = new wxCheckBox( m_panelGolbalDesignRules, wxID_ANY, _("Allow micro vias (uVias)"), wxDefaultPosition, wxDefaultSize, 0 );
fgViaOptionsSize->Add( m_OptAllowMicroVias, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
fgViaOptionsSize->Add( 0, 0, 1, wxEXPAND, 5 );
m_MicroViaMinSizeTitle = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("Minimum uVia diameter:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_MicroViaMinSizeTitle->Wrap( -1 );
fgViaOptionsSize->Add( m_MicroViaMinSizeTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxTOP, 5 );
m_SetMicroViasMinSizeCtrl = new wxTextCtrl( m_panelGolbalDesignRules, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetMicroViasMinSizeCtrl->Enable( false );
fgViaOptionsSize->Add( m_SetMicroViasMinSizeCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_MicroViaMinSizeUnits = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_MicroViaMinSizeUnits->Wrap( -1 );
fgViaOptionsSize->Add( m_MicroViaMinSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_MicroViaMinDrillTitle = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("Minimum uVia drill:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_MicroViaMinDrillTitle->Wrap( -1 );
fgViaOptionsSize->Add( m_MicroViaMinDrillTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_SetMicroViasMinDrillCtrl = new wxTextCtrl( m_panelGolbalDesignRules, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetMicroViasMinDrillCtrl->Enable( false );
fgViaOptionsSize->Add( m_SetMicroViasMinDrillCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_MicroViaMinDrillUnits = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_MicroViaMinDrillUnits->Wrap( -1 );
fgViaOptionsSize->Add( m_MicroViaMinDrillUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
sbRoutingOptionSizer->Add( fgViaOptionsSize, 1, wxEXPAND, 5 );
bpanelGlobRulesSizer->Add( sbRoutingOptionSizer, 1, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbTracksListSizer;
sbTracksListSizer = new wxStaticBoxSizer( new wxStaticBox( m_panelGolbalDesignRules, wxID_ANY, _("Custom Track Widths") ), wxVERTICAL );
m_gridTrackWidthList = new wxGrid( m_panelGolbalDesignRules, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_gridTrackWidthList->CreateGrid( 8, 1 );
m_gridTrackWidthList->EnableEditing( true );
m_gridTrackWidthList->EnableGridLines( true );
m_gridTrackWidthList->EnableDragGridSize( false );
m_gridTrackWidthList->SetMargins( 0, 0 );
// Columns
m_gridTrackWidthList->SetColSize( 0, 110 );
m_gridTrackWidthList->EnableDragColMove( false );
m_gridTrackWidthList->EnableDragColSize( false );
m_gridTrackWidthList->SetColLabelSize( 22 );
m_gridTrackWidthList->SetColLabelValue( 0, _("Width") );
m_gridTrackWidthList->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_gridTrackWidthList->EnableDragRowSize( false );
m_gridTrackWidthList->SetRowLabelSize( 80 );
m_gridTrackWidthList->SetRowLabelValue( 0, _("Track 1") );
m_gridTrackWidthList->SetRowLabelValue( 1, _("Track 2") );
m_gridTrackWidthList->SetRowLabelValue( 2, _("Track 3") );
m_gridTrackWidthList->SetRowLabelValue( 3, _("Track 4") );
m_gridTrackWidthList->SetRowLabelValue( 4, _("Track 5") );
m_gridTrackWidthList->SetRowLabelValue( 5, _("Track 6") );
m_gridTrackWidthList->SetRowLabelValue( 6, _("Track 7") );
m_gridTrackWidthList->SetRowLabelValue( 7, _("Track 8") );
m_gridTrackWidthList->SetRowLabelValue( 8, _("Track 9") );
m_gridTrackWidthList->SetRowLabelValue( 9, _("Track 10") );
m_gridTrackWidthList->SetRowLabelValue( 10, _("Track 11") );
m_gridTrackWidthList->SetRowLabelValue( 11, _("Track 12") );
m_gridTrackWidthList->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_gridTrackWidthList->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
sbTracksListSizer->Add( m_gridTrackWidthList, 0, wxALL|wxEXPAND, 5 );
bpanelGlobRulesSizer->Add( sbTracksListSizer, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sViaSizeBox;
sViaSizeBox = new wxStaticBoxSizer( new wxStaticBox( m_panelGolbalDesignRules, wxID_ANY, _("Custom Via Sizes") ), wxVERTICAL );
m_gridViaSizeList = new wxGrid( m_panelGolbalDesignRules, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_gridViaSizeList->CreateGrid( 8, 2 );
m_gridViaSizeList->EnableEditing( true );
m_gridViaSizeList->EnableGridLines( true );
m_gridViaSizeList->EnableDragGridSize( false );
m_gridViaSizeList->SetMargins( 0, 0 );
// Columns
m_gridViaSizeList->SetColSize( 0, 110 );
m_gridViaSizeList->SetColSize( 1, 110 );
m_gridViaSizeList->EnableDragColMove( false );
m_gridViaSizeList->EnableDragColSize( false );
m_gridViaSizeList->SetColLabelSize( 22 );
m_gridViaSizeList->SetColLabelValue( 0, _("Diameter") );
m_gridViaSizeList->SetColLabelValue( 1, _("Drill") );
m_gridViaSizeList->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_gridViaSizeList->EnableDragRowSize( false );
m_gridViaSizeList->SetRowLabelSize( 80 );
m_gridViaSizeList->SetRowLabelValue( 0, _("Via 1") );
m_gridViaSizeList->SetRowLabelValue( 1, _("Via 2") );
m_gridViaSizeList->SetRowLabelValue( 2, _("Via 3") );
m_gridViaSizeList->SetRowLabelValue( 3, _("Via 4") );
m_gridViaSizeList->SetRowLabelValue( 4, _("Via 5") );
m_gridViaSizeList->SetRowLabelValue( 5, _("Via 6") );
m_gridViaSizeList->SetRowLabelValue( 6, _("Via 7") );
m_gridViaSizeList->SetRowLabelValue( 7, _("Via 8") );
m_gridViaSizeList->SetRowLabelValue( 8, _("Via 9") );
m_gridViaSizeList->SetRowLabelValue( 9, _("Via 10") );
m_gridViaSizeList->SetRowLabelValue( 10, _("Via 11") );
m_gridViaSizeList->SetRowLabelValue( 11, _("Via 12") );
m_gridViaSizeList->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_gridViaSizeList->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
sViaSizeBox->Add( m_gridViaSizeList, 0, wxALL|wxEXPAND, 5 );
bpanelGlobRulesSizer->Add( sViaSizeBox, 0, wxALL|wxEXPAND, 5 );
m_panelGolbalDesignRules->SetSizer( bpanelGlobRulesSizer );
m_panelGolbalDesignRules->Layout();
bpanelGlobRulesSizer->Fit( m_panelGolbalDesignRules );
m_DRnotebook->AddPage( m_panelGolbalDesignRules, _("Global Design Rules"), false );
bMainSizer->Add( m_DRnotebook, 1, wxALL|wxEXPAND, 5 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_DESIGN_RULES_BASE::OnUpdateUI ) );
m_DRnotebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_DESIGN_RULES_BASE::OnNotebookPageChanged ), NULL, this );
m_grid->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesNameLeftClick ), NULL, this );
m_grid->Connect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesNameRightClick ), NULL, this );
m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_DESIGN_RULES_BASE::OnSizeNetclassGrid ), NULL, this );
m_addButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnAddNetclassClick ), NULL, this );
m_removeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRemoveNetclassClick ), NULL, this );
m_moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnMoveUpSelectedNetClass ), NULL, this );
m_moveDownButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnMoveDownSelectedNetClass ), NULL, this );
m_leftClassChoice->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftCBSelection ), NULL, this );
m_buttonLeftSelAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftSelectAllButton ), NULL, this );
m_buttonRightToLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightToLeftCopyButton ), NULL, this );
m_buttonLeftToRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftToRightCopyButton ), NULL, this );
m_rightClassChoice->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightCBSelection ), NULL, this );
m_buttonRightSelAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightSelectAllButton ), NULL, this );
m_OptAllowMicroVias->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnAllowMicroVias ), NULL, this );
}
DIALOG_DESIGN_RULES_BASE::~DIALOG_DESIGN_RULES_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_DESIGN_RULES_BASE::OnUpdateUI ) );
m_DRnotebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_DESIGN_RULES_BASE::OnNotebookPageChanged ), NULL, this );
m_grid->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesNameLeftClick ), NULL, this );
m_grid->Disconnect( wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler( DIALOG_DESIGN_RULES_BASE::OnNetClassesNameRightClick ), NULL, this );
m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_DESIGN_RULES_BASE::OnSizeNetclassGrid ), NULL, this );
m_addButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnAddNetclassClick ), NULL, this );
m_removeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRemoveNetclassClick ), NULL, this );
m_moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnMoveUpSelectedNetClass ), NULL, this );
m_moveDownButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnMoveDownSelectedNetClass ), NULL, this );
m_leftClassChoice->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftCBSelection ), NULL, this );
m_buttonLeftSelAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftSelectAllButton ), NULL, this );
m_buttonRightToLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightToLeftCopyButton ), NULL, this );
m_buttonLeftToRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnLeftToRightCopyButton ), NULL, this );
m_rightClassChoice->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightCBSelection ), NULL, this );
m_buttonRightSelAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnRightSelectAllButton ), NULL, this );
m_OptAllowMicroVias->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DESIGN_RULES_BASE::OnAllowMicroVias ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,125 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_DESIGN_RULES_BASE_H__
#define __DIALOG_DESIGN_RULES_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class NETS_LIST_CTRL;
#include "dialog_shim.h"
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/font.h>
#include <wx/grid.h>
#include <wx/gdicmn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/combobox.h>
#include <wx/statline.h>
#include <wx/listctrl.h>
#include <wx/panel.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/valtext.h>
#include <wx/checkbox.h>
#include <wx/notebook.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_DESIGN_RULES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_DESIGN_RULES_BASE : public DIALOG_SHIM
{
private:
protected:
enum
{
ID_LEFT_TO_RIGHT_COPY = 1000,
ID_RIGHT_TO_LEFT_COPY
};
wxNotebook* m_DRnotebook;
wxPanel* m_panelNetClassesEditor;
wxGrid* m_grid;
wxBitmapButton* m_addButton;
wxBitmapButton* m_removeButton;
wxBitmapButton* m_moveUpButton;
wxBitmapButton* m_moveDownButton;
wxComboBox* m_leftClassChoice;
wxStaticLine* m_staticline21;
wxButton* m_buttonLeftSelAll;
NETS_LIST_CTRL* m_leftListCtrl;
wxButton* m_buttonRightToLeft;
wxButton* m_buttonLeftToRight;
wxComboBox* m_rightClassChoice;
wxStaticLine* m_staticline3;
wxButton* m_buttonRightSelAll;
NETS_LIST_CTRL* m_rightListCtrl;
wxPanel* m_panelGolbalDesignRules;
wxStaticText* m_TrackMinWidthTitle;
wxTextCtrl* m_SetTrackMinWidthCtrl;
wxStaticText* m_TrackMinWidthUnits;
wxStaticText* m_ViaMinTitle;
wxTextCtrl* m_SetViasMinSizeCtrl;
wxStaticText* m_ViaMinUnits;
wxStaticText* m_ViaMinDrillTitle;
wxTextCtrl* m_SetViasMinDrillCtrl;
wxStaticText* m_ViaMinDrillUnits;
wxCheckBox* m_OptAllowBlindBuriedVias;
wxCheckBox* m_OptAllowMicroVias;
wxStaticText* m_MicroViaMinSizeTitle;
wxTextCtrl* m_SetMicroViasMinSizeCtrl;
wxStaticText* m_MicroViaMinSizeUnits;
wxStaticText* m_MicroViaMinDrillTitle;
wxTextCtrl* m_SetMicroViasMinDrillCtrl;
wxStaticText* m_MicroViaMinDrillUnits;
wxGrid* m_gridTrackWidthList;
wxGrid* m_gridViaSizeList;
wxStaticLine* m_staticline2;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnNotebookPageChanged( wxNotebookEvent& event ) { event.Skip(); }
virtual void OnNetClassesNameLeftClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnNetClassesNameRightClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnSizeNetclassGrid( wxSizeEvent& event ) { event.Skip(); }
virtual void OnAddNetclassClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveNetclassClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMoveUpSelectedNetClass( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMoveDownSelectedNetClass( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLeftCBSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLeftSelectAllButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRightToLeftCopyButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLeftToRightCopyButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRightCBSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRightSelectAllButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAllowMicroVias( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Design Rules Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DESIGN_RULES_BASE();
};
#endif //__DIALOG_DESIGN_RULES_BASE_H__

View File

@ -51,8 +51,6 @@
*/
// Keywords for read and write config
#define TestMissingCourtyardKey wxT( "TestMissingCourtyard" )
#define TestFootprintCourtyardKey wxT( "TestFootprintCourtyard" )
#define RefillZonesBeforeDrc wxT( "RefillZonesBeforeDrc" )
@ -131,8 +129,6 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFra
DIALOG_DRC_CONTROL::~DIALOG_DRC_CONTROL()
{
m_config->Write( TestMissingCourtyardKey, m_cbCourtyardMissing->GetValue() );
m_config->Write( TestFootprintCourtyardKey, m_cbCourtyardOverlap->GetValue() );
m_config->Write( RefillZonesBeforeDrc, m_cbRefillZones->GetValue() );
// Disconnect events
@ -187,10 +183,6 @@ void DIALOG_DRC_CONTROL::InitValues()
// read options
bool value;
m_config->Read( TestMissingCourtyardKey, &value, false );
m_cbCourtyardMissing->SetValue( value );
m_config->Read( TestFootprintCourtyardKey, &value, false );
m_cbCourtyardOverlap->SetValue( value );
m_config->Read( RefillZonesBeforeDrc, &value, false );
m_cbRefillZones->SetValue( value );

View File

@ -103,12 +103,6 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
bSizerOptSettings->Add( m_cbReportAllTrackErrors, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbCourtyardOverlap = new wxCheckBox( this, wxID_ANY, _("Check footprint courtyard overlap"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerOptSettings->Add( m_cbCourtyardOverlap, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbCourtyardMissing = new wxCheckBox( this, wxID_ANY, _("Check courtyard missing in footprints"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerOptSettings->Add( m_cbCourtyardMissing, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerOptions->Add( bSizerOptSettings, 1, wxEXPAND, 5 );

View File

@ -1278,182 +1278,6 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Check footprint courtyard overlap</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbCourtyardOverlap</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Check courtyard missing in footprints</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbCourtyardMissing</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>

View File

@ -60,8 +60,6 @@ class DIALOG_DRC_CONTROL_BASE : public DIALOG_SHIM
wxStaticText* m_MicroViaMinUnit;
wxCheckBox* m_cbRefillZones;
wxCheckBox* m_cbReportAllTrackErrors;
wxCheckBox* m_cbCourtyardOverlap;
wxCheckBox* m_cbCourtyardMissing;
wxStaticText* m_messagesLabel;
wxTextCtrl* m_Messages;
wxCheckBox* m_CreateRptCtrl;

View File

@ -684,8 +684,10 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField( wxCommandEvent& )
else
textMod.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
textMod.SetTextSize( dsnSettings.m_ModuleTextSize );
textMod.SetThickness( dsnSettings.m_ModuleTextWidth );
textMod.SetTextSize( dsnSettings.GetTextSize( textMod.GetLayer() ) );
textMod.SetThickness( dsnSettings.GetTextThickness( textMod.GetLayer() ) );
textMod.SetItalic( dsnSettings.GetTextItalic( textMod.GetLayer() ) );
textMod.SetKeepUpright( dsnSettings.GetTextUpright( textMod.GetLayer() ) );
m_texts->push_back( textMod );

View File

@ -43,8 +43,8 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
m_itemsGrid->SetColSize( 4, 90 );
m_itemsGrid->SetColSize( 5, 48 );
m_itemsGrid->SetColSize( 6, 112 );
m_itemsGrid->SetColSize( 7, 80 );
m_itemsGrid->SetColSize( 8, 48 );
m_itemsGrid->SetColSize( 7, 90 );
m_itemsGrid->SetColSize( 8, 90 );
m_itemsGrid->SetColSize( 9, 90 );
m_itemsGrid->SetColSize( 10, 90 );
m_itemsGrid->EnableDragColMove( false );
@ -58,7 +58,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
m_itemsGrid->SetColLabelValue( 5, _("Italic") );
m_itemsGrid->SetColLabelValue( 6, _("Layer") );
m_itemsGrid->SetColLabelValue( 7, _("Orientation") );
m_itemsGrid->SetColLabelValue( 8, _("Unconstrained") );
m_itemsGrid->SetColLabelValue( 8, _("Keep Upright") );
m_itemsGrid->SetColLabelValue( 9, _("X Offset") );
m_itemsGrid->SetColLabelValue( 10, _("Y Offset") );
m_itemsGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
@ -277,7 +277,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
wxStaticBoxSizer* sbSizerLocalProperties;
sbSizerLocalProperties = new wxStaticBoxSizer( new wxStaticBox( m_PanelClearances, wxID_ANY, _("Clearances") ), wxVERTICAL );
m_staticTextInfo = new wxStaticText( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, _("Set values to 0 to use netclass values."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfo = new wxStaticText( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, _("Set values to 0 to use Board Setup values."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfo->Wrap( -1 );
m_staticTextInfo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );

View File

@ -299,10 +299,10 @@
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="col_label_size">22</property>
<property name="col_label_values">&quot;Text Items&quot; &quot;Show&quot; &quot;Width&quot; &quot;Height&quot; &quot;Thickness&quot; &quot;Italic&quot; &quot;Layer&quot; &quot;Orientation&quot; &quot;Unconstrained&quot; &quot;X Offset&quot; &quot;Y Offset&quot;</property>
<property name="col_label_values">&quot;Text Items&quot; &quot;Show&quot; &quot;Width&quot; &quot;Height&quot; &quot;Thickness&quot; &quot;Italic&quot; &quot;Layer&quot; &quot;Orientation&quot; &quot;Keep Upright&quot; &quot;X Offset&quot; &quot;Y Offset&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="cols">11</property>
<property name="column_sizes">120,48,90,90,90,48,112,80,48,90,90</property>
<property name="column_sizes">120,48,90,90,90,48,112,90,90,90,90</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
@ -2895,7 +2895,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Set values to 0 to use netclass values.</property>
<property name="label">Set values to 0 to use Board Setup values.</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>

View File

@ -587,8 +587,9 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAddField( wxCommandEvent& event )
else
textMod.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
textMod.SetTextSize( dsnSettings.m_ModuleTextSize );
textMod.SetThickness( dsnSettings.m_ModuleTextWidth );
textMod.SetTextSize( dsnSettings.GetTextSize( textMod.GetLayer() ) );
textMod.SetThickness( dsnSettings.GetTextThickness( textMod.GetLayer() ) );
textMod.SetItalic( dsnSettings.GetTextItalic( textMod.GetLayer() ) );
m_texts->push_back( textMod );

View File

@ -0,0 +1,342 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <class_drawpanel.h>
#include <kicad_string.h>
#include <board_commit.h>
#include <pcb_edit_frame.h>
#include <pcb_layer_box_selector.h>
#include <class_board.h>
#include <class_module.h>
#include <class_edge_mod.h>
#include <class_pcb_text.h>
#include <widgets/unit_binder.h>
#include <dialog_global_edit_text_and_graphics_base.h>
// Columns of layer classes grid
enum
{
COL_CLASS_NAME = 0,
COL_LINE_THICKNESS,
COL_TEXT_WIDTH,
COL_TEXT_HEIGHT,
COL_TEXT_THICKNESS,
COL_TEXT_ITALIC,
COL_TEXT_UPRIGHT
};
enum
{
ROW_HEADER = 0,
ROW_SILK,
ROW_COPPER,
ROW_EDGES,
ROW_OTHERS
};
static wxString g_textAndGraphicsFootprintFilter;
class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS : public DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE
{
PCB_EDIT_FRAME* m_parent;
BOARD_DESIGN_SETTINGS* m_brdSettings;
UNIT_BINDER m_lineWidth;
UNIT_BINDER m_textWidth;
UNIT_BINDER m_textHeight;
UNIT_BINDER m_thickness;
public:
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( PCB_EDIT_FRAME* parent );
~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS() override;
protected:
void OnUpdateUI( wxUpdateUIEvent& event ) override;
void OnLayerFilterSelect( wxCommandEvent& event ) override
{
m_layerFilterOpt->SetValue( true );
}
void OnFootprintFilterText( wxCommandEvent& event ) override
{
m_footprintFilterOpt->SetValue( true );
}
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void visitItem( BOARD_COMMIT& aCommit, BOARD_ITEM* aItem );
void processItem( BOARD_COMMIT& aCommit, BOARD_ITEM* aItem );
};
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( PCB_EDIT_FRAME* parent ) :
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE( parent ),
m_lineWidth( parent, m_lineWidthLabel, m_LineWidthCtrl, m_lineWidthUnits, true, 0 ),
m_textWidth( parent, m_SizeXlabel, m_SizeXCtrl, m_SizeXunit, true, TEXTS_MIN_SIZE ),
m_textHeight( parent, m_SizeYlabel, m_SizeYCtrl, m_SizeYunit, true, TEXTS_MIN_SIZE ),
m_thickness( parent, m_ThicknessLabel, m_ThicknessCtrl, m_ThicknessUnit, true, 0 )
{
m_parent = parent;
m_brdSettings = &m_parent->GetDesignSettings();
m_layerFilter->SetBoardFrame( m_parent );
m_layerFilter->SetLayersHotkeys( false );
m_layerFilter->Resync();
m_LayerCtrl->SetBoardFrame( m_parent );
m_LayerCtrl->SetLayersHotkeys( false );
m_LayerCtrl->Resync();
m_grid->SetCellHighlightPenWidth( 0 );
m_sdbSizerButtonsOK->SetDefault();
FinishDialogSettings();
}
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS()
{
g_textAndGraphicsFootprintFilter = m_footprintFilter->GetValue();
}
bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow()
{
// SetValue() generates events, ChangeValue() does not
m_footprintFilter->ChangeValue( g_textAndGraphicsFootprintFilter );
m_lineWidth.SetValue( INDETERMINATE );
m_textWidth.SetValue( INDETERMINATE );
m_textHeight.SetValue( INDETERMINATE );
m_thickness.SetValue( INDETERMINATE );
m_Italic->Set3StateValue( wxCHK_UNDETERMINED );
m_keepUpright->Set3StateValue( wxCHK_UNDETERMINED );
m_Visible->Set3StateValue( wxCHK_UNDETERMINED );
m_LayerCtrl->SetLayerSelection( UNDEFINED_LAYER );
#define SET_GRID_VALUE( aRow, aCol, aValue ) \
m_grid->SetCellValue( aRow, aCol, StringFromValue( GetUserUnits(), aValue, true, true ) )
#define SET_BOOL_VALUE( aRow, aCol, aValue ) \
attr = new wxGridCellAttr; \
attr->SetRenderer( new wxGridCellBoolRenderer() ); \
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM ); \
attr->SetReadOnly(); \
m_grid->SetAttr( aRow, aCol, attr ); \
m_grid->SetCellValue( aRow, aCol, ( aValue ) ? "1" : "" )
const BOARD_DESIGN_SETTINGS& bds = m_parent->GetBoard()->GetDesignSettings();
wxGridCellAttr* attr;
m_grid->SetCellValue( ROW_SILK, COL_CLASS_NAME, _( "Silk Layers" ) );
m_grid->SetCellValue( ROW_COPPER, COL_CLASS_NAME, _( "Copper Layers" ) );
m_grid->SetCellValue( ROW_EDGES, COL_CLASS_NAME, _( "Edges & Courtyards" ) );
m_grid->SetCellValue( ROW_OTHERS, COL_CLASS_NAME, _( "Other Layers" ) );
m_grid->SetCellValue( ROW_HEADER, COL_LINE_THICKNESS, _( "Line Thickness" ) );
SET_GRID_VALUE( ROW_SILK, COL_LINE_THICKNESS, bds.m_LineThickness[ LAYER_CLASS_SILK ] );
SET_GRID_VALUE( ROW_COPPER, COL_LINE_THICKNESS, bds.m_LineThickness[ LAYER_CLASS_COPPER ] );
SET_GRID_VALUE( ROW_EDGES, COL_LINE_THICKNESS, bds.m_LineThickness[ LAYER_CLASS_EDGES ] );
SET_GRID_VALUE( ROW_OTHERS, COL_LINE_THICKNESS, bds.m_LineThickness[ LAYER_CLASS_OTHERS ] );
m_grid->SetCellValue( ROW_HEADER, COL_TEXT_WIDTH, _( "Text Width" ) );
SET_GRID_VALUE( ROW_SILK, COL_TEXT_WIDTH, bds.m_TextSize[ LAYER_CLASS_SILK ].x );
SET_GRID_VALUE( ROW_COPPER, COL_TEXT_WIDTH, bds.m_TextSize[ LAYER_CLASS_COPPER ].x );
SET_GRID_VALUE( ROW_OTHERS, COL_TEXT_WIDTH, bds.m_TextSize[ LAYER_CLASS_OTHERS ].x );
m_grid->SetCellValue( ROW_HEADER, COL_TEXT_HEIGHT, _( "Text Height" ) );
SET_GRID_VALUE( ROW_SILK, COL_TEXT_HEIGHT, bds.m_TextSize[ LAYER_CLASS_SILK ].y );
SET_GRID_VALUE( ROW_COPPER, COL_TEXT_HEIGHT, bds.m_TextSize[ LAYER_CLASS_COPPER ].y );
SET_GRID_VALUE( ROW_OTHERS, COL_TEXT_HEIGHT, bds.m_TextSize[ LAYER_CLASS_OTHERS ].y );
m_grid->SetCellValue( ROW_HEADER, COL_TEXT_THICKNESS, _( "Text Thickness" ) );
SET_GRID_VALUE( ROW_SILK, COL_TEXT_THICKNESS, bds.m_TextThickness[ LAYER_CLASS_SILK ] );
SET_GRID_VALUE( ROW_COPPER, COL_TEXT_THICKNESS, bds.m_TextThickness[ LAYER_CLASS_COPPER ] );
SET_GRID_VALUE( ROW_OTHERS, COL_TEXT_THICKNESS, bds.m_TextThickness[ LAYER_CLASS_OTHERS ] );
m_grid->SetCellValue( ROW_HEADER, COL_TEXT_ITALIC, _( "Italic" ) );
SET_BOOL_VALUE( ROW_SILK, COL_TEXT_ITALIC, bds.m_TextItalic[ LAYER_CLASS_SILK ] );
SET_BOOL_VALUE( ROW_COPPER, COL_TEXT_ITALIC, bds.m_TextItalic[ LAYER_CLASS_COPPER ] );
SET_BOOL_VALUE( ROW_OTHERS, COL_TEXT_ITALIC, bds.m_TextItalic[ LAYER_CLASS_OTHERS ] );
m_grid->SetCellValue( ROW_HEADER, COL_TEXT_UPRIGHT, _( "Upright" ) );
SET_BOOL_VALUE( ROW_SILK, COL_TEXT_UPRIGHT, bds.m_TextUpright[ LAYER_CLASS_SILK ] );
SET_BOOL_VALUE( ROW_COPPER, COL_TEXT_UPRIGHT, bds.m_TextUpright[ LAYER_CLASS_COPPER ] );
SET_BOOL_VALUE( ROW_OTHERS, COL_TEXT_UPRIGHT, bds.m_TextUpright[ LAYER_CLASS_OTHERS ] );
return true;
#undef SET_GRID_VALUE
#undef SET_BOOL_VALUE
}
void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::OnUpdateUI( wxUpdateUIEvent& )
{
m_lineWidth.Enable( m_setToSpecifiedValues->GetValue() );
m_textWidth.Enable( m_setToSpecifiedValues->GetValue() );
m_textHeight.Enable( m_setToSpecifiedValues->GetValue() );
m_thickness.Enable( m_setToSpecifiedValues->GetValue() );
m_Italic->Enable( m_setToSpecifiedValues->GetValue() );
m_Visible->Enable( m_setToSpecifiedValues->GetValue() );
m_LayerLabel->Enable( m_setToSpecifiedValues->GetValue() );
m_LayerCtrl->Enable( m_setToSpecifiedValues->GetValue() );
m_keepUpright->Enable( m_setToSpecifiedValues->GetValue() );
}
void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, BOARD_ITEM* aItem )
{
aCommit.Modify( aItem );
auto textItem = dynamic_cast<EDA_TEXT*>( aItem );
auto drawItem = dyn_cast<DRAWSEGMENT*>( aItem );
auto moduleTextItem = dyn_cast<TEXTE_MODULE*>( aItem );
if( m_setToSpecifiedValues->GetValue() )
{
if( m_LayerCtrl->GetLayerSelection() != UNDEFINED_LAYER )
aItem->SetLayer( ToLAYER_ID( m_LayerCtrl->GetLayerSelection() ) );
if( !m_textWidth.IsIndeterminate() && textItem )
textItem->SetTextSize( wxSize( m_textWidth.GetValue(), textItem->GetTextSize().y ) );
if( !m_textHeight.IsIndeterminate() && textItem )
textItem->SetTextSize( wxSize( textItem->GetTextSize().x, m_textHeight.GetValue() ) );
if( !m_thickness.IsIndeterminate() && textItem )
textItem->SetThickness( m_thickness.GetValue() );
if( m_Italic->Get3StateValue() != wxCHK_UNDETERMINED && textItem )
textItem->SetItalic( m_Italic->GetValue() );
if( m_Visible->Get3StateValue() != wxCHK_UNDETERMINED && textItem )
textItem->SetVisible( m_Visible->GetValue() );
if( m_keepUpright->Get3StateValue() != wxCHK_UNDETERMINED && moduleTextItem )
moduleTextItem->SetKeepUpright( m_keepUpright->GetValue() );
if( !m_lineWidth.IsIndeterminate() && drawItem )
drawItem->SetWidth( m_lineWidth.GetValue() );
}
else
{
PCB_LAYER_ID layer = aItem->GetLayer();
if( textItem )
{
textItem->SetTextSize( m_brdSettings->GetTextSize( layer ) );
textItem->SetThickness( m_brdSettings->GetTextThickness( layer ) );
textItem->SetItalic( m_brdSettings->GetTextItalic( layer ) );
}
if( moduleTextItem )
moduleTextItem->SetKeepUpright( m_brdSettings->GetTextUpright( layer ) );
if( drawItem )
drawItem->SetWidth( m_brdSettings->GetLineThickness( layer ) );
}
}
void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( BOARD_COMMIT& aCommit, BOARD_ITEM* aItem )
{
if( m_layerFilterOpt->GetValue() && m_layerFilter->GetLayerSelection() != UNDEFINED_LAYER )
{
if( aItem->GetLayer() != m_layerFilter->GetLayerSelection() )
return;
}
if( m_footprintFilterOpt->GetValue() && !m_footprintFilter->GetValue().IsEmpty() )
{
MODULE* module = dynamic_cast<MODULE*>( aItem->GetParent() );
if( module )
{
wxString fpID = module->GetFPID().GetUniStringLibId();
if( !WildCompareString( m_footprintFilter->GetValue(), fpID, false ) )
return;
}
}
processItem( aCommit, aItem );
}
bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
{
if( !m_textWidth.Validate( true ) || !m_textHeight.Validate( true ) ||
!m_thickness.Validate( true ) || !m_lineWidth.Validate( true ) )
return false;
BOARD_COMMIT commit( m_parent );
// Go through the modules
for( MODULE* module : m_parent->GetBoard()->Modules() )
{
if( m_references->GetValue() )
visitItem( commit, &module->Reference() );
if( m_values->GetValue() )
visitItem( commit, &module->Value() );
// Go through all other module items
for( BOARD_ITEM* boardItem : module->GraphicalItems() )
{
if( m_otherFields->GetValue() && boardItem->Type() == PCB_MODULE_TEXT_T )
visitItem( commit, boardItem );
else if( m_footprintGraphics->GetValue() && boardItem->Type() == PCB_MODULE_EDGE_T )
visitItem( commit, boardItem );
}
}
// Go through the PCB text & graphic items
for( BOARD_ITEM* boardItem : m_parent->GetBoard()->Drawings() )
{
if( m_boardText->GetValue() && boardItem->Type() == PCB_TEXT_T )
visitItem( commit, boardItem );
else if( m_boardGraphics->GetValue() && boardItem->Type() == PCB_LINE_T )
visitItem( commit, boardItem );
}
commit.Push( "Edit text and graphics properties" );
m_parent->GetCanvas()->Refresh();
return true;
}
void PCB_EDIT_FRAME::OnEditTextAndGraphics( wxCommandEvent& event )
{
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS dlg( this );
dlg.ShowModal();
}

View File

@ -0,0 +1,286 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "pcb_layer_box_selector.h"
#include "dialog_global_edit_text_and_graphics_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbScope;
sbScope = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Scope") ), wxVERTICAL );
wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer3->AddGrowableCol( 0 );
fgSizer3->AddGrowableCol( 1 );
fgSizer3->SetFlexibleDirection( wxBOTH );
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_references = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Footprint references"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_references, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_boardText = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("PCB text items"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_boardText, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_values = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Footprint values"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_values, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_boardGraphics = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("PCB graphic items"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_boardGraphics, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_otherFields = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Other footprint fields"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_otherFields, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
m_footprintGraphics = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Footprint graphic items"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_footprintGraphics, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbScope->Add( fgSizer3, 0, wxEXPAND, 5 );
bMainSizer->Add( sbScope, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
wxStaticBoxSizer* sbFilters;
sbFilters = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Filters") ), wxVERTICAL );
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 0, 3, 2, 0 );
fgSizer2->AddGrowableCol( 1 );
fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_layerFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by layer:"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_layerFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_layerFilter = new PCB_LAYER_BOX_SELECTOR( sbFilters->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
fgSizer2->Add( m_layerFilter, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxLEFT, 2 );
fgSizer2->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 100 );
m_footprintFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by parent footprint:"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_footprintFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_footprintFilter = new wxTextCtrl( sbFilters->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_footprintFilter, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxLEFT, 5 );
fgSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
sbFilters->Add( fgSizer2, 0, wxEXPAND|wxRIGHT, 5 );
bMainSizer->Add( sbFilters, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
wxStaticBoxSizer* sbAction;
sbAction = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Action") ), wxVERTICAL );
m_setToSpecifiedValues = new wxRadioButton( sbAction->GetStaticBox(), ID_SPECIFIED_NET_TO_NETCLASS_VALUES, _("Set to specified values:"), wxDefaultPosition, wxDefaultSize, 0 );
m_setToSpecifiedValues->SetValue( true );
sbAction->Add( m_setToSpecifiedValues, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_specifiedValues = new wxPanel( sbAction->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 5, 2, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_LayerLabel = new wxStaticText( m_specifiedValues, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayerLabel->Wrap( -1 );
fgSizer1->Add( m_LayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_LayerCtrl = new PCB_LAYER_BOX_SELECTOR( m_specifiedValues, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
fgSizer1->Add( m_LayerCtrl, 0, wxLEFT, 2 );
fgSizer1->Add( 0, 0, 0, wxEXPAND, 10 );
fgSizer1->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 30 );
m_Visible = new wxCheckBox( m_specifiedValues, wxID_ANY, _("Visible"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
m_Visible->SetValue(true);
fgSizer1->Add( m_Visible, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
m_lineWidthLabel = new wxStaticText( m_specifiedValues, wxID_ANY, _("Line thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthLabel->Wrap( -1 );
fgSizer1->Add( m_lineWidthLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_LineWidthCtrl = new wxTextCtrl( m_specifiedValues, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_LineWidthCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_lineWidthUnits = new wxStaticText( m_specifiedValues, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthUnits->Wrap( -1 );
fgSizer1->Add( m_lineWidthUnits, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND|wxTOP, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_SizeXlabel = new wxStaticText( m_specifiedValues, wxID_ANY, _("Text width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXlabel->Wrap( -1 );
fgSizer1->Add( m_SizeXlabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
m_SizeXCtrl = new wxTextCtrl( m_specifiedValues, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXCtrl->SetMinSize( wxSize( 120,-1 ) );
fgSizer1->Add( m_SizeXCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_SizeXunit = new wxStaticText( m_specifiedValues, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXunit->Wrap( -1 );
fgSizer1->Add( m_SizeXunit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
fgSizer1->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 20 );
m_Italic = new wxCheckBox( m_specifiedValues, wxID_ANY, _("Italic"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
fgSizer1->Add( m_Italic, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_SizeYlabel = new wxStaticText( m_specifiedValues, wxID_ANY, _("Text height:"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYlabel->Wrap( -1 );
fgSizer1->Add( m_SizeYlabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_SizeYCtrl = new wxTextCtrl( m_specifiedValues, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_SizeYCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_SizeYunit = new wxStaticText( m_specifiedValues, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYunit->Wrap( -1 );
fgSizer1->Add( m_SizeYunit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
fgSizer1->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 20 );
m_keepUpright = new wxCheckBox( m_specifiedValues, wxID_ANY, _("Keep upright"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
m_keepUpright->SetValue(true);
fgSizer1->Add( m_keepUpright, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
m_ThicknessLabel = new wxStaticText( m_specifiedValues, wxID_ANY, _("Text thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThicknessLabel->Wrap( -1 );
fgSizer1->Add( m_ThicknessLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_ThicknessCtrl = new wxTextCtrl( m_specifiedValues, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_ThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ThicknessUnit = new wxStaticText( m_specifiedValues, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThicknessUnit->Wrap( -1 );
fgSizer1->Add( m_ThicknessUnit, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
bSizer2->Add( fgSizer1, 1, wxEXPAND|wxTOP, 2 );
m_specifiedValues->SetSizer( bSizer2 );
m_specifiedValues->Layout();
bSizer2->Fit( m_specifiedValues );
sbAction->Add( m_specifiedValues, 1, wxEXPAND|wxBOTTOM|wxLEFT, 15 );
m_setToLayerDefaults = new wxRadioButton( sbAction->GetStaticBox(), ID_ALL_TRACKS_VIAS, _("Set to layer default values:"), wxDefaultPosition, wxDefaultSize, 0 );
sbAction->Add( m_setToLayerDefaults, 0, wxTOP|wxBOTTOM, 5 );
m_grid = new wxGrid( sbAction->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_grid->CreateGrid( 5, 7 );
m_grid->EnableEditing( false );
m_grid->EnableGridLines( true );
m_grid->EnableDragGridSize( false );
m_grid->SetMargins( 0, 0 );
// Columns
m_grid->SetColSize( 0, 120 );
m_grid->SetColSize( 1, 95 );
m_grid->SetColSize( 2, 95 );
m_grid->SetColSize( 3, 95 );
m_grid->SetColSize( 4, 95 );
m_grid->SetColSize( 5, 50 );
m_grid->SetColSize( 6, 50 );
m_grid->EnableDragColMove( false );
m_grid->EnableDragColSize( false );
m_grid->SetColLabelSize( 0 );
m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_grid->EnableDragRowSize( false );
m_grid->SetRowLabelSize( 0 );
m_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_grid->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
m_grid->SetDefaultCellFont( wxFont( 11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
sbAction->Add( m_grid, 0, wxEXPAND|wxLEFT, 15 );
sbAction->Add( 0, 0, 0, wxEXPAND|wxBOTTOM, 5 );
bMainSizer->Add( sbAction, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
m_sdbSizerButtons = new wxStdDialogButtonSizer();
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK );
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize();
bMainSizer->Add( m_sdbSizerButtons, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnUpdateUI ) );
m_layerFilter->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnLayerFilterSelect ), NULL, this );
m_footprintFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnFootprintFilterText ), NULL, this );
m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnSizeNetclassGrid ), NULL, this );
}
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnUpdateUI ) );
m_layerFilter->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnLayerFilterSelect ), NULL, this );
m_footprintFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnFootprintFilterText ), NULL, this );
m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnSizeNetclassGrid ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,96 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE_H__
#define __DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class PCB_LAYER_BOX_SELECTOR;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/bmpcbox.h>
#include <wx/textctrl.h>
#include <wx/radiobut.h>
#include <wx/stattext.h>
#include <wx/panel.h>
#include <wx/grid.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_SPECIFIED_NET_TO_NETCLASS_VALUES 1000
#define ID_ALL_TRACKS_VIAS 1001
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE : public DIALOG_SHIM
{
private:
protected:
wxCheckBox* m_references;
wxCheckBox* m_boardText;
wxCheckBox* m_values;
wxCheckBox* m_boardGraphics;
wxCheckBox* m_otherFields;
wxCheckBox* m_footprintGraphics;
wxCheckBox* m_layerFilterOpt;
PCB_LAYER_BOX_SELECTOR* m_layerFilter;
wxCheckBox* m_footprintFilterOpt;
wxTextCtrl* m_footprintFilter;
wxRadioButton* m_setToSpecifiedValues;
wxPanel* m_specifiedValues;
wxStaticText* m_LayerLabel;
PCB_LAYER_BOX_SELECTOR* m_LayerCtrl;
wxCheckBox* m_Visible;
wxStaticText* m_lineWidthLabel;
wxTextCtrl* m_LineWidthCtrl;
wxStaticText* m_lineWidthUnits;
wxStaticText* m_SizeXlabel;
wxTextCtrl* m_SizeXCtrl;
wxStaticText* m_SizeXunit;
wxCheckBox* m_Italic;
wxStaticText* m_SizeYlabel;
wxTextCtrl* m_SizeYCtrl;
wxStaticText* m_SizeYunit;
wxCheckBox* m_keepUpright;
wxStaticText* m_ThicknessLabel;
wxTextCtrl* m_ThicknessCtrl;
wxStaticText* m_ThicknessUnit;
wxRadioButton* m_setToLayerDefaults;
wxGrid* m_grid;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnLayerFilterSelect( wxCommandEvent& event ) { event.Skip(); }
virtual void OnFootprintFilterText( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSizeNetclassGrid( wxSizeEvent& event ) { event.Skip(); }
public:
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Edit Text and Graphic Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE();
};
#endif //__DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE_H__

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009-2016 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -23,250 +23,303 @@
*/
#include <fctsys.h>
#include <confirm.h>
#include <pcbnew.h>
#include <pcb_edit_frame.h>
#include <class_drawpanel.h>
#include <base_units.h>
#include <class_board.h>
#include <dialog_global_edit_tracks_and_vias.h>
#include <connectivity_data.h>
#include <view/view.h>
#include <pcb_layer_box_selector.h>
/**
* DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS, derived from DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE_BASE
* @see dialog_global_edit_tracks_and_vias_base.h and dialog_global_edit_tracks_and_vias_base.cpp,
* automatically created by wxFormBuilder
*/
#include "dialog_global_edit_tracks_and_vias_base.h"
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT_FRAME* aParent,
int aNetcode ) :
// Columns of netclasses grid
enum {
GRID_NAME = 0,
GRID_TRACKSIZE,
GRID_VIASIZE,
GRID_VIADRILL,
GRID_uVIASIZE,
GRID_uVIADRILL,
GRID_DIFF_PAIR_WIDTH, // not currently included in grid
GRID_DIFF_PAIR_GAP, // not currently included in grid
GRID_DIFF_PAIR_VIA_GAP // not currently included in grid
};
class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS : public DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
{
private:
PCB_EDIT_FRAME* m_parent;
BOARD* m_brd;
int* m_originalColWidths;
public:
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT_FRAME* aParent );
~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS() override;
private:
void visitItem( PICKED_ITEMS_LIST* aUndoList, TRACK* aItem );
void processItem( PICKED_ITEMS_LIST* aUndoList, TRACK* aItem );
bool TransferDataFromWindow() override;
void OnUpdateUI( wxUpdateUIEvent& event ) override;
void OnSizeNetclassGrid( wxSizeEvent& event ) override;
void AdjustNetclassGridColumns( int aWidth );
void OnNetFilterSelect( wxCommandEvent& event ) override
{
m_netFilterOpt->SetValue( true );
}
void OnNetclassFilterSelect( wxCommandEvent& event ) override
{
m_netclassFilterOpt->SetValue( true );
}
void OnLayerFilterSelect( wxCommandEvent& event ) override
{
m_layerFilterOpt->SetValue( true );
}
void buildNetclassesGrid();
void buildFilterLists();
};
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT_FRAME* aParent ) :
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE( aParent )
{
m_parent = aParent;
m_curr_netcode = aNetcode;
m_optionID = 0;
MyInit();
GetSizer()->SetSizeHints( this );
}
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
{
SetFocus();
// Display current setup for tracks and vias
m_brd = m_parent->GetBoard();
buildNetsList();
updateNetInfo();
m_gridDisplayCurrentSettings->Fit();
m_originalColWidths = new int[ m_netclassGrid->GetNumberCols() ];
for( int i = 0; i < m_netclassGrid->GetNumberCols(); ++i )
m_originalColWidths[ i ] = m_netclassGrid->GetColSize( i );
buildFilterLists();
m_parent->UpdateTrackWidthSelectBox( m_trackWidthSelectBox );
m_parent->UpdateViaSizeSelectBox( m_viaSizesSelectBox );
m_layerBox->SetBoardFrame( m_parent );
m_layerBox->SetLayersHotkeys( false );
m_layerBox->SetNotAllowedLayerSet( LSET::AllNonCuMask() );
m_layerBox->Resync();
buildNetclassesGrid();
m_netclassGrid->SetCellHighlightPenWidth( 0 );
m_sdbSizerOK->SetDefault();
FinishDialogSettings();
}
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::updateNetInfo()
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS()
{
BOARD_DESIGN_SETTINGS& brdSettings = m_brd->GetDesignSettings();
NETCLASSES& netclasses = brdSettings.m_NetClasses;
NETCLASSPTR netclass = netclasses.GetDefault();
NETINFO_ITEM* net = m_brd->FindNet( m_curr_netcode );
if( net )
{
netclass = net->GetNetClass();
m_CurrentNetclassName->SetLabel( netclass->GetName() );
}
/* Disable the option "copy current to net" if we have only default netclass values
* i.e. when m_TrackWidthSelector and m_ViaSizeSelector are set to 0
*/
if( !brdSettings.GetTrackWidthIndex() && !brdSettings.GetViaSizeIndex() )
{
m_Net2CurrValueButton->Enable( false );
m_optionID = ID_NETCLASS_VALUES_TO_CURRENT_NET;
m_NetUseNetclassValueButton->SetValue(true);
}
else
{
m_optionID = ID_CURRENT_VALUES_TO_CURRENT_NET;
m_Net2CurrValueButton->SetValue(true);
}
// Display current values, and current netclass values:
wxString msg;
int value = netclass->GetTrackWidth(); // Display track width
msg = StringFromValue( g_UserUnit, value, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 0, msg );
if( brdSettings.GetTrackWidthIndex() > 0 )
{
value = brdSettings.GetCurrentTrackWidth();
msg = StringFromValue( g_UserUnit, value, true );
}
else
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 0, msg );
value = netclass->GetViaDiameter(); // Display via diameter
msg = StringFromValue( g_UserUnit, value, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 1, msg );
if( brdSettings.GetViaSizeIndex() > 0 )
{
value = brdSettings.GetCurrentViaSize();
msg = StringFromValue( g_UserUnit, value, true );
}
else
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 1, msg );
value = netclass->GetViaDrill(); // Display via drill
msg = StringFromValue( g_UserUnit, value, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 2, msg );
value = brdSettings.GetCurrentViaDrill();
if( value >= 0 )
msg = StringFromValue( g_UserUnit, value, true );
else
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 2, msg );
value = netclass->GetuViaDiameter(); // Display micro via diameter
msg = StringFromValue( g_UserUnit, value, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 3, msg );
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 3, msg );
value = netclass->GetuViaDrill(); // Display micro via drill
msg = StringFromValue( g_UserUnit, value, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 4, msg );
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 4, msg );
// Set all cells Read Only
for( int ii = 0; ii < m_gridDisplayCurrentSettings->GetNumberRows(); ii++ )
{
for( int jj = 0; jj < m_gridDisplayCurrentSettings->GetNumberCols(); jj++ )
m_gridDisplayCurrentSettings->SetReadOnly( ii, jj, true );
}
m_gridDisplayCurrentSettings->SetRowLabelSize(wxGRID_AUTOSIZE);
delete[] m_originalColWidths;
}
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetsList()
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists()
{
wxString txt;
int currentNet = m_brd->GetHighLightNetCode();
// Populate the nets list with nets names
if( currentNet < 0 && m_parent->GetCurItem() && m_parent->GetCurItem()->IsConnected() )
currentNet = static_cast<BOARD_CONNECTED_ITEM*>( m_parent->GetCurItem() )->GetNetCode();
wxString currentNetClass = m_brd->GetDesignSettings().GetCurrentNetClassName();
LAYER_NUM currentLayer = m_parent->GetActiveLayer();
// Populate the net filter list with net names
for( unsigned netcode = 0; netcode < m_brd->GetNetCount(); netcode++ )
{
NETINFO_ITEM* net = m_brd->GetNetInfo().GetNetItem( netcode );
wxString netname = net->GetNetname();
wxString netname;
if( netcode == 0 ) // netcode 0 is the netcode of not connected items
netname = "<no net>";
else
netname = m_brd->GetNetInfo().GetNetItem( netcode )->GetNetname();
txt.Printf( _( "net %.3d" ), net->GetNet() );
m_netFilter->Append( netname );
txt << " " << netname;
m_choiceNetName->Append( txt );
if( (int) netcode == currentNet )
m_netFilter->SetSelection( m_netFilter->GetCount() - 1 );
}
if( m_curr_netcode < 0 )
m_curr_netcode = 0;
// Populate the netclass filter list with netclass names
NETCLASSES& netclasses = m_brd->GetDesignSettings().m_NetClasses;
m_choiceNetName->SetSelection( m_curr_netcode );
m_netclassFilter->Append( netclasses.GetDefault()->GetName() );
updateNetInfo();
for( NETCLASSES::const_iterator nc = netclasses.begin(); nc != netclasses.end(); ++nc )
m_netclassFilter->Append( nc->second->GetName() );
m_netclassFilter->SetSelection( m_netclassFilter->FindString( currentNetClass ) );
// Populate the layer filter list
m_layerFilter->SetBoardFrame( m_parent );
m_layerFilter->SetLayersHotkeys( false );
m_layerFilter->SetNotAllowedLayerSet( LSET::AllNonCuMask() );
m_layerFilter->Resync();
m_layerFilter->SetLayerSelection( currentLayer );
}
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::onNetSelection( wxCommandEvent& event )
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid()
{
int idx = m_choiceNetName->GetSelection();
#define SET_NETCLASS_VALUE( aRow, aGrid, aCol, aValue ) \
aGrid->SetCellValue( aRow, aCol, StringFromValue( GetUserUnits(), aValue, true, true ) )
if( idx == wxNOT_FOUND )
return;
m_netclassGrid->SetCellValue( 0, GRID_NAME, _( "Netclass" ) );
m_netclassGrid->SetCellValue( 0, GRID_TRACKSIZE, _( "Track width" ) );
m_netclassGrid->SetCellValue( 0, GRID_VIASIZE, _( "Via size" ) );
m_netclassGrid->SetCellValue( 0, GRID_VIADRILL, _( "Via drill" ) );
m_netclassGrid->SetCellValue( 0, GRID_uVIASIZE, _( "uVia size" ) );
m_netclassGrid->SetCellValue( 0, GRID_uVIADRILL, _( "uVia drill" ) );
m_curr_netcode = idx;
updateNetInfo();
}
NETCLASSES& netclasses = m_brd->GetDesignSettings().m_NetClasses;
m_netclassGrid->AppendRows( netclasses.GetCount() );
int row = 1;
#include <ratsnest_data.h>
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick( wxCommandEvent& event )
{
bool change = false;
switch( m_optionID )
for( NETCLASSES::const_iterator nc = netclasses.begin(); nc != netclasses.end(); ++nc, ++row )
{
case ID_CURRENT_VALUES_TO_CURRENT_NET:
if( !IsOK( this,
_( "Set current Net tracks and vias sizes and drill to the current values?" ) ) )
return;
{
wxBusyCursor dummy;
change = m_parent->Change_Net_Tracks_And_Vias_Sizes( m_curr_netcode, false );
}
break;
NETCLASSPTR netclass = nc->second;
m_netclassGrid->SetCellValue( row, GRID_NAME, netclass->GetName() );
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_TRACKSIZE, netclass->GetTrackWidth() );
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_VIASIZE, netclass->GetViaDiameter() );
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_VIADRILL, netclass->GetViaDrill() );
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_uVIASIZE, netclass->GetuViaDiameter() );
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_uVIADRILL, netclass->GetuViaDrill() );
}
}
case ID_NETCLASS_VALUES_TO_CURRENT_NET:
if( !IsOK( this,
_( "Set current Net tracks and vias sizes and drill to the Netclass default value?" ) ) )
return;
{
wxBusyCursor dummy;
change = m_parent->Change_Net_Tracks_And_Vias_Sizes( m_curr_netcode, true );
}
break;
case ID_ALL_TRACKS_VIAS:
if( !IsOK( this, _( "Set All Tracks and Vias to Netclass value" ) ) )
return;
{
wxBusyCursor dummy;
change = m_parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( true, true );
}
break;
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnUpdateUI( wxUpdateUIEvent& )
{
m_trackWidthSelectBox->Enable( m_setToSpecifiedValues->GetValue() );
m_viaSizesSelectBox->Enable( m_setToSpecifiedValues->GetValue() );
}
case ID_ALL_VIAS:
if( !IsOK( this, _( "Set All Via to Netclass value" ) ) )
return;
{
wxBusyCursor dummy;
change = m_parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( false, true );
}
break;
case ID_ALL_TRACKS:
if( !IsOK( this, _( "Set All Track to Netclass value" ) ) )
return;
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem( PICKED_ITEMS_LIST* aUndoList, TRACK* aItem )
{
BOARD_DESIGN_SETTINGS& brdSettings = m_brd->GetDesignSettings();
if( m_setToSpecifiedValues->GetValue() )
{
unsigned int prevTrackWidthIndex = brdSettings.GetTrackWidthIndex();
unsigned int prevViaSizeIndex = brdSettings.GetViaSizeIndex();
brdSettings.SetTrackWidthIndex( (unsigned) m_trackWidthSelectBox->GetSelection() );
brdSettings.SetViaSizeIndex( (unsigned) m_viaSizesSelectBox->GetSelection() );
m_parent->SetTrackSegmentWidth( aItem, aUndoList, false );
if( m_layerBox->GetLayerSelection() != UNDEFINED_LAYER && aItem->Type() == PCB_TRACE_T )
{
wxBusyCursor dummy;
change = m_parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( true, false );
if( aUndoList->FindItem( aItem ) < 0 )
{
ITEM_PICKER picker( aItem, UR_CHANGED );
picker.SetLink( aItem->Clone() );
aUndoList->PushItem( picker );
}
aItem->SetLayer( ToLAYER_ID( m_layerBox->GetLayerSelection() ) );
m_parent->GetBoard()->GetConnectivity()->Update( aItem );
}
break;
brdSettings.SetTrackWidthIndex( prevTrackWidthIndex );
brdSettings.SetViaSizeIndex( prevViaSizeIndex );
}
else
{
m_parent->SetTrackSegmentWidth( aItem, aUndoList, true );
}
}
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem( PICKED_ITEMS_LIST* aUndoList, TRACK* aItem )
{
if( m_netFilterOpt->GetValue() )
{
if( aItem->GetNetCode() != m_netFilter->GetSelection() )
return;
}
if( change )
if( m_netclassFilterOpt->GetValue() )
{
if( aItem->GetNetClassName() != m_netclassFilter->GetStringSelection() )
return;
}
if( m_layerFilterOpt->GetValue() && m_layerFilter->GetLayerSelection() != UNDEFINED_LAYER )
{
if( aItem->GetLayer() != m_layerFilter->GetLayerSelection() )
return;
}
processItem( aUndoList, aItem );
}
bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow()
{
PICKED_ITEMS_LIST itemsListPicker;
wxBusyCursor dummy;
// Examine segments
for( TRACK* segment = m_brd->m_Track; segment != nullptr; segment = segment->Next() )
{
if( m_tracks->GetValue() && segment->Type() == PCB_TRACE_T )
visitItem( &itemsListPicker, segment );
else if (m_vias->GetValue() && segment->Type() == PCB_VIA_T )
visitItem( &itemsListPicker, segment );
}
if( itemsListPicker.GetCount() > 0 )
{
m_parent->SaveCopyInUndoList( itemsListPicker, UR_CHANGED );
if( m_parent->IsGalCanvasActive() )
{
for( TRACK* track = m_parent->GetBoard()->m_Track; track != NULL; track = track->Next() )
m_parent->GetGalCanvas()->GetView()->Update( track, KIGFX::GEOMETRY );
for( TRACK* segment = m_brd->m_Track; segment != nullptr; segment = segment->Next() )
m_parent->GetGalCanvas()->GetView()->Update( segment );
}
else
{
m_parent->GetCanvas()->Refresh();
}
}
// Call the default handler
return true;
}
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::AdjustNetclassGridColumns( int aWidth )
{
for( int i = 1; i < m_netclassGrid->GetNumberCols(); i++ )
{
m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
aWidth -= m_originalColWidths[ i ];
}
m_netclassGrid->SetColSize( 0, aWidth );
}
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnSizeNetclassGrid( wxSizeEvent& event )
{
AdjustNetclassGridColumns( event.GetSize().GetX() );
event.Skip();
}
void PCB_EDIT_FRAME::OnEditTracksAndVias( wxCommandEvent& event )
{
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( this );
dlg.ShowModal();
}

View File

@ -1,63 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2009 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 1992-2009 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __dialog_global_edit_tracks_and_vias__
#define __dialog_global_edit_tracks_and_vias__
#include <dialog_global_edit_tracks_and_vias_base.h>
class BOARD;
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS :
public DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
{
private:
PCB_EDIT_FRAME* m_parent;
BOARD* m_brd;
int m_curr_netcode;
int m_optionID;
public:
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT_FRAME* aParent, int aNetcode );
~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS() {};
private:
// Virtual event handlers, overided here
void OnSelectionClick( wxCommandEvent& event ) override
{
m_optionID = event.GetId();
}
void OnOkClick( wxCommandEvent& event ) override;
void onNetSelection( wxCommandEvent& event ) override;
void MyInit();
void updateNetInfo();
void buildNetsList();
};
#endif //__dialog_global_edit_tracks_and_vias__

View File

@ -1,204 +1,189 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 20 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_global_edit_tracks_and_vias_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerCurrSettings;
bSizerCurrSettings = new wxBoxSizer( wxVERTICAL );
m_staticText12 = new wxStaticText( this, wxID_ANY, _("Current Settings:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText12->Wrap( -1 );
m_staticText12->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizerCurrSettings->Add( m_staticText12, 0, wxALL, 5 );
wxBoxSizer* bSizerCurrSettingsLeft;
bSizerCurrSettingsLeft = new wxBoxSizer( wxHORIZONTAL );
bSizerCurrSettingsLeft->Add( 20, 0, 0, 0, 5 );
wxBoxSizer* bSizerGrids;
bSizerGrids = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizeNetInfo;
fgSizeNetInfo = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizeNetInfo->AddGrowableCol( 1 );
fgSizeNetInfo->SetFlexibleDirection( wxBOTH );
fgSizeNetInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_CurrentNetText = new wxStaticText( this, wxID_ANY, _("Current Net:"), wxDefaultPosition, wxDefaultSize, 0 );
m_CurrentNetText->Wrap( -1 );
fgSizeNetInfo->Add( m_CurrentNetText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxArrayString m_choiceNetNameChoices;
m_choiceNetName = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceNetNameChoices, 0 );
m_choiceNetName->SetSelection( 0 );
fgSizeNetInfo->Add( m_choiceNetName, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_CurrentNetclassText = new wxStaticText( this, wxID_ANY, _("Current NetClass:"), wxDefaultPosition, wxDefaultSize, 0 );
m_CurrentNetclassText->Wrap( -1 );
fgSizeNetInfo->Add( m_CurrentNetclassText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_CurrentNetclassName = new wxStaticText( this, wxID_ANY, _("unknown"), wxDefaultPosition, wxDefaultSize, 0 );
m_CurrentNetclassName->Wrap( -1 );
m_CurrentNetclassName->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
fgSizeNetInfo->Add( m_CurrentNetclassName, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizerGrids->Add( fgSizeNetInfo, 0, wxEXPAND, 5 );
bSizerGrids->Add( 10, 10, 0, 0, 5 );
m_gridDisplayCurrentSettings = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_gridDisplayCurrentSettings->CreateGrid( 2, 5 );
m_gridDisplayCurrentSettings->EnableEditing( true );
m_gridDisplayCurrentSettings->EnableGridLines( true );
m_gridDisplayCurrentSettings->EnableDragGridSize( true );
m_gridDisplayCurrentSettings->SetMargins( 10, 0 );
// Columns
m_gridDisplayCurrentSettings->AutoSizeColumns();
m_gridDisplayCurrentSettings->EnableDragColMove( false );
m_gridDisplayCurrentSettings->EnableDragColSize( true );
m_gridDisplayCurrentSettings->SetColLabelSize( 30 );
m_gridDisplayCurrentSettings->SetColLabelValue( 0, _("Track size") );
m_gridDisplayCurrentSettings->SetColLabelValue( 1, _("Via diameter") );
m_gridDisplayCurrentSettings->SetColLabelValue( 2, _("Via drill") );
m_gridDisplayCurrentSettings->SetColLabelValue( 3, _("uVia size") );
m_gridDisplayCurrentSettings->SetColLabelValue( 4, _("uVia Drill") );
m_gridDisplayCurrentSettings->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_gridDisplayCurrentSettings->AutoSizeRows();
m_gridDisplayCurrentSettings->EnableDragRowSize( true );
m_gridDisplayCurrentSettings->SetRowLabelSize( 100 );
m_gridDisplayCurrentSettings->SetRowLabelValue( 0, _("Netclass value") );
m_gridDisplayCurrentSettings->SetRowLabelValue( 1, _("Current value") );
m_gridDisplayCurrentSettings->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_gridDisplayCurrentSettings->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
bSizerGrids->Add( m_gridDisplayCurrentSettings, 1, wxALL|wxEXPAND, 5 );
bSizerCurrSettingsLeft->Add( bSizerGrids, 1, wxEXPAND, 5 );
bSizerCurrSettings->Add( bSizerCurrSettingsLeft, 1, wxEXPAND, 5 );
bMainSizer->Add( bSizerCurrSettings, 0, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline1, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* bLowerSizer;
bLowerSizer = new wxBoxSizer( wxVERTICAL );
m_staticText11 = new wxStaticText( this, wxID_ANY, _("Global Edition Option:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText11->Wrap( -1 );
m_staticText11->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bLowerSizer->Add( m_staticText11, 0, wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( bLowerSizer, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizerOptions;
bSizerOptions = new wxBoxSizer( wxHORIZONTAL );
bSizerOptions->Add( 20, 0, 0, 0, 5 );
wxBoxSizer* bSizerRadioButtons;
bSizerRadioButtons = new wxBoxSizer( wxVERTICAL );
m_Net2CurrValueButton = new wxRadioButton( this, ID_CURRENT_VALUES_TO_CURRENT_NET, _("Set tracks and vias of the current Net to the current selected user value"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_Net2CurrValueButton->SetValue( true );
bSizerRadioButtons->Add( m_Net2CurrValueButton, 0, wxALL, 5 );
m_NetUseNetclassValueButton = new wxRadioButton( this, ID_NETCLASS_VALUES_TO_CURRENT_NET, _("Set tracks and vias of the current Net to the Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRadioButtons->Add( m_NetUseNetclassValueButton, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_radioBtnAll = new wxRadioButton( this, ID_ALL_TRACKS_VIAS, _("Set all tracks and vias to their Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRadioButtons->Add( m_radioBtnAll, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_radioAllVias = new wxRadioButton( this, ID_ALL_VIAS, _("Set all vias (no track) to their Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRadioButtons->Add( m_radioAllVias, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_radioAllTracks = new wxRadioButton( this, ID_ALL_TRACKS, _("Set all tracks (no via) to their Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRadioButtons->Add( m_radioAllTracks, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
bSizerOptions->Add( bSizerRadioButtons, 1, wxEXPAND, 5 );
bMainSizer->Add( bSizerOptions, 0, wxEXPAND, 5 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
bMainSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bMainSizer->Add( m_sdbSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_choiceNetName->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onNetSelection ), NULL, this );
m_Net2CurrValueButton->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_NetUseNetclassValueButton->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioBtnAll->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioAllVias->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioAllTracks->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
}
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE()
{
// Disconnect Events
m_choiceNetName->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onNetSelection ), NULL, this );
m_Net2CurrValueButton->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_NetUseNetclassValueButton->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioBtnAll->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioAllVias->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioAllTracks->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "pcb_layer_box_selector.h"
#include "dialog_global_edit_tracks_and_vias_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbScope;
sbScope = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Scope") ), wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer1->AddGrowableCol( 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_tracks = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
m_tracks->SetValue(true);
fgSizer1->Add( m_tracks, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_vias = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Vias"), wxDefaultPosition, wxDefaultSize, 0 );
m_vias->SetValue(true);
fgSizer1->Add( m_vias, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbScope->Add( fgSizer1, 0, wxEXPAND, 5 );
bMainSizer->Add( sbScope, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbFilters;
sbFilters = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Filters") ), wxVERTICAL );
wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer3->AddGrowableCol( 1 );
fgSizer3->AddGrowableCol( 2 );
fgSizer3->SetFlexibleDirection( wxBOTH );
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_netFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by net:"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_netFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxArrayString m_netFilterChoices;
m_netFilter = new wxChoice( sbFilters->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_netFilterChoices, 0 );
m_netFilter->SetSelection( 0 );
fgSizer3->Add( m_netFilter, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizer3->Add( 0, 0, 1, wxEXPAND|wxRIGHT|wxLEFT, 100 );
m_netclassFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by net class:"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_netclassFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
wxArrayString m_netclassFilterChoices;
m_netclassFilter = new wxChoice( sbFilters->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_netclassFilterChoices, 0 );
m_netclassFilter->SetSelection( 0 );
fgSizer3->Add( m_netclassFilter, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
m_layerFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by layer:"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_layerFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_layerFilter = new PCB_LAYER_BOX_SELECTOR( sbFilters->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
fgSizer3->Add( m_layerFilter, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 3 );
fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
sbFilters->Add( fgSizer3, 1, wxEXPAND, 5 );
bMainSizer->Add( sbFilters, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbAction;
sbAction = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Action") ), wxVERTICAL );
m_setToSpecifiedValues = new wxRadioButton( sbAction->GetStaticBox(), ID_SPECIFIED_NET_TO_SPECIFIED_VALUES, _("Set to specified values:"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_setToSpecifiedValues->SetValue( true );
sbAction->Add( m_setToSpecifiedValues, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
wxBoxSizer* bSizerTrackViaPopups;
bSizerTrackViaPopups = new wxBoxSizer( wxHORIZONTAL );
wxArrayString m_trackWidthSelectBoxChoices;
m_trackWidthSelectBox = new wxChoice( sbAction->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_trackWidthSelectBoxChoices, 0 );
m_trackWidthSelectBox->SetSelection( 0 );
bSizerTrackViaPopups->Add( m_trackWidthSelectBox, 4, wxEXPAND|wxRIGHT, 5 );
wxArrayString m_viaSizesSelectBoxChoices;
m_viaSizesSelectBox = new wxChoice( sbAction->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_viaSizesSelectBoxChoices, 0 );
m_viaSizesSelectBox->SetSelection( 0 );
bSizerTrackViaPopups->Add( m_viaSizesSelectBox, 5, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_layerBox = new PCB_LAYER_BOX_SELECTOR( sbAction->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bSizerTrackViaPopups->Add( m_layerBox, 0, wxRIGHT, 5 );
sbAction->Add( bSizerTrackViaPopups, 0, wxEXPAND|wxBOTTOM|wxLEFT, 15 );
m_setToNetclassValues = new wxRadioButton( sbAction->GetStaticBox(), ID_SPECIFIED_NET_TO_NETCLASS_VALUES, _("Set to net class values:"), wxDefaultPosition, wxDefaultSize, 0 );
sbAction->Add( m_setToNetclassValues, 0, wxTOP|wxBOTTOM, 5 );
m_netclassGrid = new wxGrid( sbAction->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
// Grid
m_netclassGrid->CreateGrid( 1, 6 );
m_netclassGrid->EnableEditing( false );
m_netclassGrid->EnableGridLines( true );
m_netclassGrid->EnableDragGridSize( false );
m_netclassGrid->SetMargins( 0, 0 );
// Columns
m_netclassGrid->SetColSize( 0, 95 );
m_netclassGrid->SetColSize( 1, 95 );
m_netclassGrid->SetColSize( 2, 95 );
m_netclassGrid->SetColSize( 3, 95 );
m_netclassGrid->SetColSize( 4, 95 );
m_netclassGrid->SetColSize( 5, 95 );
m_netclassGrid->EnableDragColMove( false );
m_netclassGrid->EnableDragColSize( false );
m_netclassGrid->SetColLabelSize( 0 );
m_netclassGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_netclassGrid->EnableDragRowSize( false );
m_netclassGrid->SetRowLabelSize( 0 );
m_netclassGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_netclassGrid->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
m_netclassGrid->SetDefaultCellFont( wxFont( 11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
m_netclassGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
sbAction->Add( m_netclassGrid, 0, wxEXPAND|wxLEFT, 15 );
bMainSizer->Add( sbAction, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bMainSizer->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnUpdateUI ) );
m_netFilter->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnNetFilterSelect ), NULL, this );
m_netclassFilter->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnNetclassFilterSelect ), NULL, this );
m_layerFilter->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnLayerFilterSelect ), NULL, this );
m_netclassGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSizeNetclassGrid ), NULL, this );
}
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnUpdateUI ) );
m_netFilter->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnNetFilterSelect ), NULL, this );
m_netclassFilter->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnNetclassFilterSelect ), NULL, this );
m_layerFilter->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnLayerFilterSelect ), NULL, this );
m_netclassGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSizeNetclassGrid ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,76 +1,78 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 20 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE_H__
#define __DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/grid.h>
#include <wx/statline.h>
#include <wx/radiobut.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_CURRENT_VALUES_TO_CURRENT_NET 1000
#define ID_NETCLASS_VALUES_TO_CURRENT_NET 1001
#define ID_ALL_TRACKS_VIAS 1002
#define ID_ALL_VIAS 1003
#define ID_ALL_TRACKS 1004
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText12;
wxStaticText* m_CurrentNetText;
wxChoice* m_choiceNetName;
wxStaticText* m_CurrentNetclassText;
wxStaticText* m_CurrentNetclassName;
wxGrid* m_gridDisplayCurrentSettings;
wxStaticLine* m_staticline1;
wxStaticText* m_staticText11;
wxRadioButton* m_Net2CurrValueButton;
wxRadioButton* m_NetUseNetclassValueButton;
wxRadioButton* m_radioBtnAll;
wxRadioButton* m_radioAllVias;
wxRadioButton* m_radioAllTracks;
wxStaticLine* m_staticline2;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void onNetSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectionClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Global Edition of Tracks and Vias"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE();
};
#endif //__DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE_H__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE_H__
#define __DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class PCB_LAYER_BOX_SELECTOR;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/choice.h>
#include <wx/bmpcbox.h>
#include <wx/radiobut.h>
#include <wx/grid.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_SPECIFIED_NET_TO_SPECIFIED_VALUES 1000
#define ID_SPECIFIED_NET_TO_NETCLASS_VALUES 1001
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE : public DIALOG_SHIM
{
private:
protected:
wxCheckBox* m_tracks;
wxCheckBox* m_vias;
wxCheckBox* m_netFilterOpt;
wxChoice* m_netFilter;
wxCheckBox* m_netclassFilterOpt;
wxChoice* m_netclassFilter;
wxCheckBox* m_layerFilterOpt;
PCB_LAYER_BOX_SELECTOR* m_layerFilter;
wxRadioButton* m_setToSpecifiedValues;
wxChoice* m_trackWidthSelectBox;
wxChoice* m_viaSizesSelectBox;
PCB_LAYER_BOX_SELECTOR* m_layerBox;
wxRadioButton* m_setToNetclassValues;
wxGrid* m_netclassGrid;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnNetFilterSelect( wxCommandEvent& event ) { event.Skip(); }
virtual void OnNetclassFilterSelect( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLayerFilterSelect( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSizeNetclassGrid( wxSizeEvent& event ) { event.Skip(); }
public:
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Set Track and Via Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE();
};
#endif //__DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE_H__

View File

@ -1,213 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-201_ KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file dialog_global_footprints_fields_edition.cpp
* @brief global footprint fields edition.
*/
#include <fctsys.h>
#include <common.h>
#include <class_drawpanel.h>
#include <pcb_base_frame.h>
#include <base_units.h>
#include <kicad_string.h>
#include <macros.h>
#include <board_commit.h>
#include <widgets/unit_binder.h>
#include <pcbnew.h>
#include <pcb_edit_frame.h>
#include <class_board.h>
#include <class_module.h>
#include <class_text_mod.h>
#include <dialog_global_footprints_fields_edition_base.h>
// The dialog to set options for global fields edition:
// optionas are:
// - edited fields (ref, value, others
// - the footprint filter, for selective edition
class DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION : public DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION_BASE
{
PCB_EDIT_FRAME* m_parent;
BOARD_DESIGN_SETTINGS* m_brdSettings;
UNIT_BINDER m_textWidth;
UNIT_BINDER m_textHeight;
UNIT_BINDER m_textThickness;
// Static variable to remember options, withing a session:
static bool m_refSelection;
static bool m_valueSelection;
static bool m_othersSelection;
static wxString m_filterString;
public:
DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION( PCB_EDIT_FRAME* parent ) :
DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION_BASE( parent ),
m_textWidth( parent, m_staticText3, m_SizeX_Value, m_SizeXunit, true, 0 ),
m_textHeight( parent, m_staticText6, m_SizeY_Value, m_SizeYunit, true, 0 ),
m_textThickness( parent, m_staticText9, m_ThicknessValue, m_ThicknessUnit, true, 0 )
{
m_parent = parent;
initDialog();
}
private:
void initDialog();
bool TransferDataFromWindow() override;
};
bool DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION::m_refSelection = false;
bool DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION::m_valueSelection = false;
bool DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION::m_othersSelection = false;
wxString DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION::m_filterString;
void DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION::initDialog()
{
m_sdbSizerButtonsOK->SetDefault();
m_brdSettings = &m_parent->GetDesignSettings();
m_ReferenceOpt->SetValue(m_refSelection),
m_ValueOpt->SetValue(m_valueSelection),
m_OtherFields->SetValue(m_othersSelection);
m_ModuleFilter->SetValue(m_filterString);
m_textWidth.SetValue( m_brdSettings->m_ModuleTextSize.x );
m_textHeight.SetValue( m_brdSettings->m_ModuleTextSize.y );
m_textThickness.SetValue( m_brdSettings->m_ModuleTextWidth );
Layout();
GetSizer()->SetSizeHints( this );
Centre();
}
bool DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION::TransferDataFromWindow()
{
m_refSelection = m_ReferenceOpt->GetValue();
m_valueSelection = m_ValueOpt->GetValue();
m_othersSelection = m_OtherFields->GetValue();
m_filterString = m_ModuleFilter->GetValue();
m_brdSettings->m_ModuleTextSize.x = m_textWidth.GetValue();
m_brdSettings->m_ModuleTextSize.y = m_textHeight.GetValue();
m_brdSettings->m_ModuleTextWidth = m_textThickness.GetValue();
// clip m_ModuleTextWidth to the 1/4 of min size, to keep it always readable
int max_thickness = std::min( m_brdSettings->m_ModuleTextSize.x,
m_brdSettings->m_ModuleTextSize.y ) / 4;
if( m_brdSettings->m_ModuleTextWidth > max_thickness )
m_brdSettings->m_ModuleTextWidth = max_thickness;
m_parent->ResetModuleTextSizes( m_filterString, m_refSelection,
m_valueSelection, m_othersSelection );
return true;
}
void PCB_EDIT_FRAME::OnResetModuleTextSizes( wxCommandEvent& event )
{
DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION dlg( this );
dlg.ShowModal();
}
void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef,
bool aValue, bool aOthers )
{
BOARD_COMMIT commit( this );
int modTextWidth = GetDesignSettings().m_ModuleTextWidth;
const wxSize& modTextSize = GetDesignSettings().m_ModuleTextSize;
bool modified = false;
// Change fields of footprints with fpid matching the filter
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
{
if( !aFilter.IsEmpty() )
{
if( ! WildCompareString( aFilter, FROM_UTF8( module->GetFPID().Format().c_str() ),
false ) )
continue;
}
if( aRef )
{
TEXTE_MODULE* item = &module->Reference();
if( item->GetTextSize() != GetDesignSettings().m_ModuleTextSize ||
item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{
commit.Modify( item );
item->SetThickness( modTextWidth );
item->SetTextSize( modTextSize );
modified = true;
}
}
if( aValue )
{
TEXTE_MODULE* item = &module->Value();
if( item->GetTextSize() != GetDesignSettings().m_ModuleTextSize ||
item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{
commit.Modify( item );
item->SetThickness( modTextWidth );
item->SetTextSize( modTextSize );
modified = true;
}
}
if( aOthers )
{
// Go through all other module text fields
for( BOARD_ITEM* boardItem = module->GraphicalItemsList(); boardItem; boardItem = boardItem->Next() )
{
if( boardItem->Type() == PCB_MODULE_TEXT_T )
{
TEXTE_MODULE* item = static_cast<TEXTE_MODULE*>( boardItem );
if( item->GetTextSize() != GetDesignSettings().m_ModuleTextSize
|| item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{
commit.Modify( item );
item->SetThickness( modTextWidth );
item->SetTextSize( modTextSize );
modified = true;
}
}
}
}
}
if( modified )
{
commit.Push( "Reset module text size" );
GetCanvas()->Refresh();
}
}

View File

@ -1,129 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_global_footprints_fields_edition_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION_BASE::DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprint Fields:") ), wxVERTICAL );
m_ReferenceOpt = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Reference designator"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_ReferenceOpt, 0, wxALL|wxEXPAND, 5 );
m_ValueOpt = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Value"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_ValueOpt, 0, wxALL|wxEXPAND, 5 );
m_OtherFields = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("User defined"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_OtherFields, 0, wxALL|wxEXPAND, 5 );
bLeftSizer->Add( sbSizer1, 1, wxBOTTOM|wxEXPAND|wxRIGHT, 5 );
m_staticTextFilter = new wxStaticText( this, wxID_ANY, _("Footprint filter:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextFilter->Wrap( -1 );
m_staticTextFilter->SetToolTip( _("A string to filter footprints to edit.\nIf not void, footprint names should match this filter.\nA filter can be something like SM* (case insensitive)") );
bLeftSizer->Add( m_staticTextFilter, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ModuleFilter = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bLeftSizer->Add( m_ModuleFilter, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
bSizerUpper->Add( bLeftSizer, 2, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerSettings;
sbSizerSettings = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Current Text Dimensions:") ), wxVERTICAL );
wxFlexGridSizer* fgSizerCurrSettings;
fgSizerCurrSettings = new wxFlexGridSizer( 3, 3, 0, 0 );
fgSizerCurrSettings->AddGrowableCol( 1 );
fgSizerCurrSettings->SetFlexibleDirection( wxBOTH );
fgSizerCurrSettings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText3 = new wxStaticText( sbSizerSettings->GetStaticBox(), wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizerCurrSettings->Add( m_staticText3, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_SizeX_Value = new wxTextCtrl( sbSizerSettings->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerCurrSettings->Add( m_SizeX_Value, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_SizeXunit = new wxStaticText( sbSizerSettings->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXunit->Wrap( -1 );
fgSizerCurrSettings->Add( m_SizeXunit, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_staticText6 = new wxStaticText( sbSizerSettings->GetStaticBox(), wxID_ANY, _("Height:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
fgSizerCurrSettings->Add( m_staticText6, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT|wxALIGN_RIGHT, 5 );
m_SizeY_Value = new wxTextCtrl( sbSizerSettings->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerCurrSettings->Add( m_SizeY_Value, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
m_SizeYunit = new wxStaticText( sbSizerSettings->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYunit->Wrap( -1 );
fgSizerCurrSettings->Add( m_SizeYunit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticText9 = new wxStaticText( sbSizerSettings->GetStaticBox(), wxID_ANY, _("Thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText9->Wrap( -1 );
fgSizerCurrSettings->Add( m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_ThicknessValue = new wxTextCtrl( sbSizerSettings->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerCurrSettings->Add( m_ThicknessValue, 0, wxALL|wxEXPAND, 5 );
m_ThicknessUnit = new wxStaticText( sbSizerSettings->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThicknessUnit->Wrap( -1 );
fgSizerCurrSettings->Add( m_ThicknessUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
sbSizerSettings->Add( fgSizerCurrSettings, 1, wxEXPAND, 5 );
bRightSizer->Add( sbSizerSettings, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bSizerUpper->Add( bRightSizer, 3, wxEXPAND, 5 );
bMainSizer->Add( bSizerUpper, 1, wxALL|wxEXPAND, 5 );
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_sdbSizerButtons = new wxStdDialogButtonSizer();
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK );
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize();
bMainSizer->Add( m_sdbSizerButtons, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
}
DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION_BASE::~DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION_BASE()
{
}

File diff suppressed because it is too large Load Diff

View File

@ -1,66 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION_BASE_H__
#define __DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION_BASE : public DIALOG_SHIM
{
private:
protected:
wxCheckBox* m_ReferenceOpt;
wxCheckBox* m_ValueOpt;
wxCheckBox* m_OtherFields;
wxStaticText* m_staticTextFilter;
wxTextCtrl* m_ModuleFilter;
wxStaticText* m_staticText3;
wxTextCtrl* m_SizeX_Value;
wxStaticText* m_SizeXunit;
wxStaticText* m_staticText6;
wxTextCtrl* m_SizeY_Value;
wxStaticText* m_SizeYunit;
wxStaticText* m_staticText9;
wxTextCtrl* m_ThicknessValue;
wxStaticText* m_ThicknessUnit;
wxStaticLine* m_staticline;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;
public:
DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Set Text Size"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION_BASE();
};
#endif //__DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION_BASE_H__

View File

@ -1,150 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <pcbnew.h>
#include <pcb_edit_frame.h>
#include <base_units.h>
#include <pcbnew_id.h>
#include <footprint_edit_frame.h>
#include <class_board.h>
#include <widgets/text_ctrl_eval.h>
#include <dialog_graphic_items_options.h>
void PCB_EDIT_FRAME::OnConfigurePcbOptions( wxCommandEvent& aEvent )
{
DIALOG_GRAPHIC_ITEMS_OPTIONS dlg( this );
dlg.ShowModal();
}
void FOOTPRINT_EDIT_FRAME::InstallOptionsFrame( const wxPoint& pos )
{
DIALOG_GRAPHIC_ITEMS_OPTIONS dlg( this );
dlg.ShowModal();
}
/*
* DIALOG_GRAPHIC_ITEMS_OPTIONS constructor
*/
DIALOG_GRAPHIC_ITEMS_OPTIONS::DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* parent )
: DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE( parent )
{
m_parent = parent;
m_brdSettings = m_parent->GetDesignSettings();
initValues( );
m_sdbSizerOK->SetDefault();
}
DIALOG_GRAPHIC_ITEMS_OPTIONS::~DIALOG_GRAPHIC_ITEMS_OPTIONS()
{
}
void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues()
{
SetFocus();
/* Drawings width */
AddUnitSymbol( *m_GraphicSegmWidthTitle );
PutValueInLocalUnits( *m_OptPcbSegmWidth, m_brdSettings.m_DrawSegmentWidth );
/* Edges width */
AddUnitSymbol( *m_BoardEdgesWidthTitle );
PutValueInLocalUnits( *m_OptPcbEdgesWidth, m_brdSettings.m_EdgeSegmentWidth );
/* Pcb Textes (Size & Width) */
AddUnitSymbol( *m_CopperTextWidthTitle );
PutValueInLocalUnits( *m_OptPcbTextWidth, m_brdSettings.m_PcbTextWidth );
AddUnitSymbol( *m_TextSizeVTitle );
PutValueInLocalUnits( *m_OptPcbTextVSize, m_brdSettings.m_PcbTextSize.y );
AddUnitSymbol( *m_TextSizeHTitle );
PutValueInLocalUnits( *m_OptPcbTextHSize, m_brdSettings.m_PcbTextSize.x );
/* Modules: Edges width */
AddUnitSymbol( *m_EdgeModWidthTitle );
PutValueInLocalUnits( *m_OptModuleEdgesWidth, m_brdSettings.m_ModuleSegmentWidth );
/* Modules: Texts: Size & width */
AddUnitSymbol( *m_TextModWidthTitle );
PutValueInLocalUnits( *m_OptModuleTextWidth, m_brdSettings.m_ModuleTextWidth );
AddUnitSymbol( *m_TextModSizeVTitle );
PutValueInLocalUnits( *m_OptModuleTextVSize, m_brdSettings.m_ModuleTextSize.y );
AddUnitSymbol( *m_TextModSizeHTitle );
PutValueInLocalUnits( *m_OptModuleTextHSize, m_brdSettings.m_ModuleTextSize.x );
AddUnitSymbol( *m_DefaultPenSizeTitle );
PutValueInLocalUnits( *m_DefaultPenSizeCtrl, g_DrawDefaultLineThickness );
}
void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event )
{
m_brdSettings.m_DrawSegmentWidth = ValueFromTextCtrl( *m_OptPcbSegmWidth );
m_brdSettings.m_EdgeSegmentWidth = ValueFromTextCtrl( *m_OptPcbEdgesWidth );
m_brdSettings.m_PcbTextWidth = ValueFromTextCtrl( *m_OptPcbTextWidth );
m_brdSettings.m_PcbTextSize.y = ValueFromTextCtrl( *m_OptPcbTextVSize );
m_brdSettings.m_PcbTextSize.x = ValueFromTextCtrl( *m_OptPcbTextHSize );
m_parent->GetBoard()->SetDesignSettings( m_brdSettings );
m_brdSettings.m_ModuleSegmentWidth = ValueFromTextCtrl( *m_OptModuleEdgesWidth );
m_brdSettings.m_ModuleTextWidth = ValueFromTextCtrl( *m_OptModuleTextWidth );
m_brdSettings.m_ModuleTextSize.y = ValueFromTextCtrl( *m_OptModuleTextVSize );
m_brdSettings.m_ModuleTextSize.x = ValueFromTextCtrl( *m_OptModuleTextHSize );
g_DrawDefaultLineThickness = ValueFromTextCtrl( *m_DefaultPenSizeCtrl );
if( g_DrawDefaultLineThickness < 0 )
g_DrawDefaultLineThickness = 0;
m_parent->SetDesignSettings( m_brdSettings );
m_parent->OnModify();
EndModal( wxID_OK );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnCancelClick( wxCommandEvent& event )
{
event.Skip();
}

View File

@ -1,64 +0,0 @@
/**
* @file dialog_graphic_items_options.h
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2010 <Jean-Pierre Charras> jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _DIALOG_GRAPHIC_ITEMS_OPTIONS_H_
#define _DIALOG_GRAPHIC_ITEMS_OPTIONS_H_
#include <dialog_graphic_items_options_base.h>
/*!
* DIALOG_GRAPHIC_ITEMS_OPTIONS class declaration
*/
class DIALOG_GRAPHIC_ITEMS_OPTIONS: public DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE
{
private:
BOARD_DESIGN_SETTINGS m_brdSettings;
PCB_BASE_FRAME * m_parent;
public:
DIALOG_GRAPHIC_ITEMS_OPTIONS( PCB_BASE_FRAME* parent );
~DIALOG_GRAPHIC_ITEMS_OPTIONS();
private:
void initValues( );
void OnOkClick( wxCommandEvent& event ) override;
void OnCancelClick( wxCommandEvent& event ) override;
void OnInitDlg( wxInitDialogEvent& event ) override
{
// Call the default wxDialog handler of a wxInitDialogEvent
TransferDataToWindow();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}
};
#endif
// _DIALOG_GRAPHIC_ITEMS_OPTIONS_H_

View File

@ -1,147 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 17 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/text_ctrl_eval.h"
#include "dialog_graphic_items_options_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE::DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbSizerLeft;
sbSizerLeft = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Graphics:") ), wxVERTICAL );
m_GraphicSegmWidthTitle = new wxStaticText( sbSizerLeft->GetStaticBox(), wxID_ANY, _("Graphic segment width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_GraphicSegmWidthTitle->Wrap( -1 );
sbSizerLeft->Add( m_GraphicSegmWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptPcbSegmWidth = new TEXT_CTRL_EVAL( sbSizerLeft->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizerLeft->Add( m_OptPcbSegmWidth, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_BoardEdgesWidthTitle = new wxStaticText( sbSizerLeft->GetStaticBox(), wxID_ANY, _("Board edge width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_BoardEdgesWidthTitle->Wrap( -1 );
sbSizerLeft->Add( m_BoardEdgesWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptPcbEdgesWidth = new TEXT_CTRL_EVAL( sbSizerLeft->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizerLeft->Add( m_OptPcbEdgesWidth, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_CopperTextWidthTitle = new wxStaticText( sbSizerLeft->GetStaticBox(), wxID_ANY, _("Copper text thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_CopperTextWidthTitle->Wrap( -1 );
sbSizerLeft->Add( m_CopperTextWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptPcbTextWidth = new TEXT_CTRL_EVAL( sbSizerLeft->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizerLeft->Add( m_OptPcbTextWidth, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_TextSizeVTitle = new wxStaticText( sbSizerLeft->GetStaticBox(), wxID_ANY, _("Text height:"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextSizeVTitle->Wrap( -1 );
sbSizerLeft->Add( m_TextSizeVTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptPcbTextVSize = new TEXT_CTRL_EVAL( sbSizerLeft->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizerLeft->Add( m_OptPcbTextVSize, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_TextSizeHTitle = new wxStaticText( sbSizerLeft->GetStaticBox(), wxID_ANY, _("Text width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextSizeHTitle->Wrap( -1 );
sbSizerLeft->Add( m_TextSizeHTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptPcbTextHSize = new TEXT_CTRL_EVAL( sbSizerLeft->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizerLeft->Add( m_OptPcbTextHSize, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerUpper->Add( sbSizerLeft, 1, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizerMiddle;
sbSizerMiddle = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprints:") ), wxVERTICAL );
m_EdgeModWidthTitle = new wxStaticText( sbSizerMiddle->GetStaticBox(), wxID_ANY, _("Edge width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_EdgeModWidthTitle->Wrap( -1 );
sbSizerMiddle->Add( m_EdgeModWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptModuleEdgesWidth = new TEXT_CTRL_EVAL( sbSizerMiddle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizerMiddle->Add( m_OptModuleEdgesWidth, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_TextModWidthTitle = new wxStaticText( sbSizerMiddle->GetStaticBox(), wxID_ANY, _("Text thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextModWidthTitle->Wrap( -1 );
sbSizerMiddle->Add( m_TextModWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptModuleTextWidth = new TEXT_CTRL_EVAL( sbSizerMiddle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizerMiddle->Add( m_OptModuleTextWidth, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_TextModSizeVTitle = new wxStaticText( sbSizerMiddle->GetStaticBox(), wxID_ANY, _("Text height:"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextModSizeVTitle->Wrap( -1 );
sbSizerMiddle->Add( m_TextModSizeVTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptModuleTextVSize = new TEXT_CTRL_EVAL( sbSizerMiddle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizerMiddle->Add( m_OptModuleTextVSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_TextModSizeHTitle = new wxStaticText( sbSizerMiddle->GetStaticBox(), wxID_ANY, _("Text width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextModSizeHTitle->Wrap( -1 );
sbSizerMiddle->Add( m_TextModSizeHTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptModuleTextHSize = new TEXT_CTRL_EVAL( sbSizerMiddle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizerMiddle->Add( m_OptModuleTextHSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizerUpper->Add( sbSizerMiddle, 1, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizerRight;
sbSizerRight = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("General:") ), wxVERTICAL );
m_DefaultPenSizeTitle = new wxStaticText( sbSizerRight->GetStaticBox(), wxID_ANY, _("Default pen size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_DefaultPenSizeTitle->Wrap( -1 );
m_DefaultPenSizeTitle->SetToolTip( _("Pen size used to draw items that have no pen size specified.\nUsed mainly to draw items in sketch mode.") );
sbSizerRight->Add( m_DefaultPenSizeTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DefaultPenSizeCtrl = new TEXT_CTRL_EVAL( sbSizerRight->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizerRight->Add( m_DefaultPenSizeCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerUpper->Add( sbSizerRight, 1, wxEXPAND|wxALL, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
bSizerMain->Add( 0, 0, 0, wxEXPAND, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE::OnInitDlg ) );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE::OnOkClick ), NULL, this );
}
DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE::~DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE::OnInitDlg ) );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE::OnOkClick ), NULL, this );
}

View File

@ -1,78 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 17 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE_H__
#define __DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
class TEXT_CTRL_EVAL;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_GraphicSegmWidthTitle;
TEXT_CTRL_EVAL* m_OptPcbSegmWidth;
wxStaticText* m_BoardEdgesWidthTitle;
TEXT_CTRL_EVAL* m_OptPcbEdgesWidth;
wxStaticText* m_CopperTextWidthTitle;
TEXT_CTRL_EVAL* m_OptPcbTextWidth;
wxStaticText* m_TextSizeVTitle;
TEXT_CTRL_EVAL* m_OptPcbTextVSize;
wxStaticText* m_TextSizeHTitle;
TEXT_CTRL_EVAL* m_OptPcbTextHSize;
wxStaticText* m_EdgeModWidthTitle;
TEXT_CTRL_EVAL* m_OptModuleEdgesWidth;
wxStaticText* m_TextModWidthTitle;
TEXT_CTRL_EVAL* m_OptModuleTextWidth;
wxStaticText* m_TextModSizeVTitle;
TEXT_CTRL_EVAL* m_OptModuleTextVSize;
wxStaticText* m_TextModSizeHTitle;
TEXT_CTRL_EVAL* m_OptModuleTextHSize;
wxStaticText* m_DefaultPenSizeTitle;
TEXT_CTRL_EVAL* m_DefaultPenSizeCtrl;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text and Drawings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE();
};
#endif //__DIALOG_GRAPHIC_ITEMS_OPTIONS_BASE_H__

View File

@ -0,0 +1,90 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <bitmaps.h>
#include <pcb_edit_frame.h>
#include <class_board.h>
#include <wildcards_and_files_ext.h>
#include <confirm.h>
#include <dialog_import_settings.h>
wxString DIALOG_IMPORT_SETTINGS::m_filePath; // remember for session
DIALOG_IMPORT_SETTINGS::DIALOG_IMPORT_SETTINGS( wxWindow* aParent, PCB_EDIT_FRAME* aFrame ) :
DIALOG_IMPORT_SETTINGS_BASE( aParent ),
m_frame( aFrame )
{
m_browseButton->SetBitmap( KiBitmap( folder_xpm ) );
m_sdbSizer1OK->SetLabel( _( "Import Settings" ) );
m_buttonsSizer->Layout();
m_sdbSizer1OK->SetDefault();
}
bool DIALOG_IMPORT_SETTINGS::TransferDataToWindow()
{
m_filePathCtrl->SetValue( m_filePath );
return true;
}
void DIALOG_IMPORT_SETTINGS::OnBrowseClicked( wxCommandEvent& event )
{
wxFileName fn = m_frame->GetBoard()->GetFileName();
fn.SetExt( ProjectFileExtension );
wxFileDialog dlg( this, _( "Import Settings From" ), fn.GetPath(), fn.GetFullName(),
ProjectFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
if( dlg.ShowModal() == wxID_OK )
m_filePathCtrl->SetValue( dlg.GetPath() );
}
bool DIALOG_IMPORT_SETTINGS::TransferDataFromWindow()
{
if( !wxFileExists( m_filePathCtrl->GetValue() ) )
{
DisplayError( this, wxString::Format( _( "File not found." ) ) );
m_filePathCtrl->SetFocus();
return false;
}
m_filePath = m_filePathCtrl->GetValue();
return true;
}
void DIALOG_IMPORT_SETTINGS::OnSelectAll( wxCommandEvent& event )
{
m_LayersOpt->SetValue( true );
m_TextAndGraphicsOpt->SetValue( true );
m_ConstraintsOpt->SetValue( true );
m_NetclassesOpt->SetValue( true );
m_MaskAndPasteOpt->SetValue( true );
}

View File

@ -0,0 +1,52 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef KICAD_DIALOG_IMPORT_SETTINGS_H
#define KICAD_DIALOG_IMPORT_SETTINGS_H
#include "dialog_import_settings_base.h"
class PCB_EDIT_FRAME;
class DIALOG_IMPORT_SETTINGS : public DIALOG_IMPORT_SETTINGS_BASE
{
protected:
PCB_EDIT_FRAME* m_frame;
static wxString m_filePath;
public:
DIALOG_IMPORT_SETTINGS( wxWindow* aParent, PCB_EDIT_FRAME* aFrame );
void OnBrowseClicked( wxCommandEvent& event ) override;
void OnSelectAll( wxCommandEvent& event ) override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
wxString GetFilePath() { return m_filePath; }
};
#endif //KICAD_DIALOG_IMPORT_SETTINGS_H

View File

@ -0,0 +1,101 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_import_settings_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_IMPORT_SETTINGS_BASE::DIALOG_IMPORT_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
m_MainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bupperSizer;
bupperSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText* importFromLabel;
importFromLabel = new wxStaticText( this, wxID_ANY, _("Import from:"), wxDefaultPosition, wxDefaultSize, 0 );
importFromLabel->Wrap( -1 );
bupperSizer->Add( importFromLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_filePathCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_filePathCtrl->SetToolTip( _("Target directory for plot files. Can be absolute or relative to the board file location.") );
m_filePathCtrl->SetMinSize( wxSize( 300,-1 ) );
bupperSizer->Add( m_filePathCtrl, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_browseButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_browseButton->SetMinSize( wxSize( 29,29 ) );
bupperSizer->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_MainSizer->Add( bupperSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bmiddleSizer;
bmiddleSizer = new wxBoxSizer( wxVERTICAL );
wxStaticText* importLabel;
importLabel = new wxStaticText( this, wxID_ANY, _("Import:"), wxDefaultPosition, wxDefaultSize, 0 );
importLabel->Wrap( -1 );
bmiddleSizer->Add( importLabel, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_LayersOpt = new wxCheckBox( this, wxID_ANY, _("Layers setup"), wxDefaultPosition, wxDefaultSize, 0 );
bmiddleSizer->Add( m_LayersOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_TextAndGraphicsOpt = new wxCheckBox( this, wxID_ANY, _("Text && Graphics default properties"), wxDefaultPosition, wxDefaultSize, 0 );
bmiddleSizer->Add( m_TextAndGraphicsOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ConstraintsOpt = new wxCheckBox( this, wxID_ANY, _("Design Rules"), wxDefaultPosition, wxDefaultSize, 0 );
bmiddleSizer->Add( m_ConstraintsOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_NetclassesOpt = new wxCheckBox( this, wxID_ANY, _("Net Classes"), wxDefaultPosition, wxDefaultSize, 0 );
bmiddleSizer->Add( m_NetclassesOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_MaskAndPasteOpt = new wxCheckBox( this, wxID_ANY, _("Solder Mask/Paste defaults"), wxDefaultPosition, wxDefaultSize, 0 );
bmiddleSizer->Add( m_MaskAndPasteOpt, 0, wxRIGHT|wxLEFT, 5 );
m_MainSizer->Add( bmiddleSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 );
m_buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
m_selectAllButton = new wxButton( this, wxID_ANY, _("Select All"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonsSizer->Add( m_selectAllButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
m_buttonsSizer->Add( m_sdbSizer1, 1, wxALL|wxEXPAND, 5 );
m_MainSizer->Add( m_buttonsSizer, 0, wxEXPAND, 5 );
this->SetSizer( m_MainSizer );
this->Layout();
m_MainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnBrowseClicked ), NULL, this );
m_selectAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnSelectAll ), NULL, this );
}
DIALOG_IMPORT_SETTINGS_BASE::~DIALOG_IMPORT_SETTINGS_BASE()
{
// Disconnect Events
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnBrowseClicked ), NULL, this );
m_selectAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnSelectAll ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,67 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_IMPORT_SETTINGS_BASE_H__
#define __DIALOG_IMPORT_SETTINGS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_IMPORT_SETTINGS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_IMPORT_SETTINGS_BASE : public DIALOG_SHIM
{
private:
protected:
wxBoxSizer* m_MainSizer;
wxTextCtrl* m_filePathCtrl;
wxBitmapButton* m_browseButton;
wxBoxSizer* m_buttonsSizer;
wxButton* m_selectAllButton;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectAll( wxCommandEvent& event ) { event.Skip(); }
public:
wxCheckBox* m_LayersOpt;
wxCheckBox* m_TextAndGraphicsOpt;
wxCheckBox* m_ConstraintsOpt;
wxCheckBox* m_NetclassesOpt;
wxCheckBox* m_MaskAndPasteOpt;
DIALOG_IMPORT_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Import Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_IMPORT_SETTINGS_BASE();
};
#endif //__DIALOG_IMPORT_SETTINGS_BASE_H__

File diff suppressed because it is too large Load Diff

View File

@ -1,118 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file dialog_mask_clearance.cpp
*/
#include <fctsys.h>
#include <pcbnew.h>
#include <pcb_edit_frame.h>
#include <board_design_settings.h>
#include <base_units.h>
#include <class_board.h>
#include <dialog_mask_clearance.h>
/**
* Class DIALOG_PADS_MASK_CLEARANCE
* is derived from DIALOG_PADS_MASK_CLEARANCE_BASE.
* @see dialog_dialog_mask_clearance_base.h and dialog_mask_clearance_base.cpp,
* which are maintained by wxFormBuilder
*/
DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE( PCB_EDIT_FRAME* aParent ) :
DIALOG_PADS_MASK_CLEARANCE_BASE( aParent )
{
m_parent = aParent;
m_brdSettings = m_parent->GetBoard()->GetDesignSettings();
myInit();
m_sdbButtonsSizerOK->SetDefault();
Layout();
FinishDialogSettings();
}
void DIALOG_PADS_MASK_CLEARANCE::myInit()
{
SetFocus();
m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_solderMaskMinWidthUnit->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
PutValueInLocalUnits( *m_SolderMaskMarginCtrl, m_brdSettings.m_SolderMaskMargin );
PutValueInLocalUnits( *m_SolderMaskMinWidthCtrl, m_brdSettings.m_SolderMaskMinWidth );
// These 2 parameters are usually < 0, so prepare entering a negative
// value, if current is 0
PutValueInLocalUnits( *m_SolderPasteMarginCtrl, m_brdSettings.m_SolderPasteMargin );
if( m_brdSettings.m_SolderPasteMargin == 0 )
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
m_SolderPasteMarginCtrl->GetValue() );
wxString msg;
msg.Printf( wxT( "%f" ), m_brdSettings.m_SolderPasteMarginRatio * 100.0 );
// Sometimes Printf adds a sign if the value is small
if( m_brdSettings.m_SolderPasteMarginRatio == 0.0 && msg[0] == '0' )
m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
else
m_SolderPasteMarginRatioCtrl->SetValue( msg );
}
void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
{
m_brdSettings.m_SolderMaskMargin = ValueFromTextCtrl( *m_SolderMaskMarginCtrl );
m_brdSettings.m_SolderMaskMinWidth = ValueFromTextCtrl( *m_SolderMaskMinWidthCtrl );
m_brdSettings.m_SolderPasteMargin = ValueFromTextCtrl( *m_SolderPasteMarginCtrl );
double dtmp = 0;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp );
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
if( dtmp < -50 )
dtmp = -50;
if( dtmp > +100 )
dtmp = +100;
m_brdSettings.m_SolderPasteMarginRatio = dtmp / 100;
m_parent->OnModify();
m_parent->GetBoard()->SetDesignSettings( m_brdSettings );
EndModal( 1 );
}
void DIALOG_PADS_MASK_CLEARANCE::OnButtonCancelClick( wxCommandEvent& event )
{
EndModal( 0 );
}

View File

@ -1,132 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 4 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_mask_clearance_base.h"
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_PADS_MASK_CLEARANCE_BASE, DIALOG_SHIM )
EVT_BUTTON( wxID_CANCEL, DIALOG_PADS_MASK_CLEARANCE_BASE::_wxFB_OnButtonCancelClick )
EVT_BUTTON( wxID_OK, DIALOG_PADS_MASK_CLEARANCE_BASE::_wxFB_OnButtonOkClick )
END_EVENT_TABLE()
DIALOG_PADS_MASK_CLEARANCE_BASE::DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bMainUpperSizer;
bMainUpperSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextInfo = new wxStaticText( this, wxID_ANY, _("Note: for clearance values:\n- a positive value means a mask bigger than a pad.\n- a negative value means a mask smaller than a pad."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfo->Wrap( -1 );
bMainUpperSizer->Add( m_staticTextInfo, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
m_staticTextInfo2 = new wxStaticText( this, wxID_ANY, _("These global values are used only to build the mask shape\nof pads on copper layers."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfo2->Wrap( -1 );
m_staticTextInfo2->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bMainUpperSizer->Add( m_staticTextInfo2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainUpperSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
wxFlexGridSizer* fgGridSolderMaskSizer;
fgGridSolderMaskSizer = new wxFlexGridSizer( 0, 3, 0, 0 );
fgGridSolderMaskSizer->AddGrowableCol( 1 );
fgGridSolderMaskSizer->SetFlexibleDirection( wxBOTH );
fgGridSolderMaskSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_MaskClearanceTitle = new wxStaticText( this, wxID_ANY, _("Solder mask clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MaskClearanceTitle->Wrap( -1 );
m_MaskClearanceTitle->SetToolTip( _("This is the global clearance between pads and the solder mask\nThis value can be superseded by local values for a footprint or a pad.") );
fgGridSolderMaskSizer->Add( m_MaskClearanceTitle, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_SolderMaskMarginCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgGridSolderMaskSizer->Add( m_SolderMaskMarginCtrl, 0, wxEXPAND|wxALL, 5 );
m_SolderMaskMarginUnits = new wxStaticText( this, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_SolderMaskMarginUnits->Wrap( -1 );
fgGridSolderMaskSizer->Add( m_SolderMaskMarginUnits, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextMinWidth = new wxStaticText( this, wxID_ANY, _("Solder mask min width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextMinWidth->Wrap( -1 );
m_staticTextMinWidth->SetToolTip( _("Min dist between 2 pad areas.\nTwo pad areas nearer than this value will be merged during plotting.\nThis parameter is used only to plot solder mask layers.") );
fgGridSolderMaskSizer->Add( m_staticTextMinWidth, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_SolderMaskMinWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgGridSolderMaskSizer->Add( m_SolderMaskMinWidthCtrl, 0, wxALL|wxEXPAND, 5 );
m_solderMaskMinWidthUnit = new wxStaticText( this, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_solderMaskMinWidthUnit->Wrap( -1 );
fgGridSolderMaskSizer->Add( m_solderMaskMinWidthUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgGridSolderMaskSizer->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 );
m_staticline4 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgGridSolderMaskSizer->Add( m_staticline4, 0, wxEXPAND | wxALL, 5 );
m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgGridSolderMaskSizer->Add( m_staticline5, 0, wxEXPAND | wxALL, 5 );
m_staticTextSolderPaste = new wxStaticText( this, wxID_ANY, _("Solder paste clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSolderPaste->Wrap( -1 );
m_staticTextSolderPaste->SetToolTip( _("This is the global clearance between pads and the solder paste\nThis value can be superseded by local values for a footprint or a pad.\nThe final clearance value is the sum of this value and the clearance value ratio") );
fgGridSolderMaskSizer->Add( m_staticTextSolderPaste, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_SolderPasteMarginCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgGridSolderMaskSizer->Add( m_SolderPasteMarginCtrl, 0, wxALL|wxEXPAND, 5 );
m_SolderPasteMarginUnits = new wxStaticText( this, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteMarginUnits->Wrap( -1 );
fgGridSolderMaskSizer->Add( m_SolderPasteMarginUnits, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextRatio = new wxStaticText( this, wxID_ANY, _("Solder paste ratio clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRatio->Wrap( -1 );
m_staticTextRatio->SetToolTip( _("This is the global clearance ratio in per cent between pads and the solder paste\nA value of 10 means the clearance value is 10 per cent of the pad size\nThis value can be superseded by local values for a footprint or a pad.\nThe final clearance value is the sum of this value and the clearance value") );
fgGridSolderMaskSizer->Add( m_staticTextRatio, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_SolderPasteMarginRatioCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgGridSolderMaskSizer->Add( m_SolderPasteMarginRatioCtrl, 0, wxALL|wxEXPAND, 5 );
m_SolderPasteRatioMarginUnits = new wxStaticText( this, wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteRatioMarginUnits->Wrap( -1 );
fgGridSolderMaskSizer->Add( m_SolderPasteRatioMarginUnits, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
bMainUpperSizer->Add( fgGridSolderMaskSizer, 1, wxEXPAND, 5 );
m_staticline11 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainUpperSizer->Add( m_staticline11, 0, wxEXPAND | wxALL, 5 );
bMainSizer->Add( bMainUpperSizer, 1, wxEXPAND, 5 );
m_sdbButtonsSizer = new wxStdDialogButtonSizer();
m_sdbButtonsSizerOK = new wxButton( this, wxID_OK );
m_sdbButtonsSizer->AddButton( m_sdbButtonsSizerOK );
m_sdbButtonsSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbButtonsSizer->AddButton( m_sdbButtonsSizerCancel );
m_sdbButtonsSizer->Realize();
bMainSizer->Add( m_sdbButtonsSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
this->SetSizer( bMainSizer );
this->Layout();
}
DIALOG_PADS_MASK_CLEARANCE_BASE::~DIALOG_PADS_MASK_CLEARANCE_BASE()
{
}

View File

@ -1,80 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 4 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_MASK_CLEARANCE_BASE_H__
#define __DIALOG_MASK_CLEARANCE_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/statline.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PADS_MASK_CLEARANCE_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PADS_MASK_CLEARANCE_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_OnButtonCancelClick( wxCommandEvent& event ){ OnButtonCancelClick( event ); }
void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); }
protected:
wxStaticText* m_staticTextInfo;
wxStaticText* m_staticTextInfo2;
wxStaticLine* m_staticline1;
wxStaticText* m_MaskClearanceTitle;
wxTextCtrl* m_SolderMaskMarginCtrl;
wxStaticText* m_SolderMaskMarginUnits;
wxStaticText* m_staticTextMinWidth;
wxTextCtrl* m_SolderMaskMinWidthCtrl;
wxStaticText* m_solderMaskMinWidthUnit;
wxStaticLine* m_staticline3;
wxStaticLine* m_staticline4;
wxStaticLine* m_staticline5;
wxStaticText* m_staticTextSolderPaste;
wxTextCtrl* m_SolderPasteMarginCtrl;
wxStaticText* m_SolderPasteMarginUnits;
wxStaticText* m_staticTextRatio;
wxTextCtrl* m_SolderPasteMarginRatioCtrl;
wxStaticText* m_SolderPasteRatioMarginUnits;
wxStaticLine* m_staticline11;
wxStdDialogButtonSizer* m_sdbButtonsSizer;
wxButton* m_sdbButtonsSizerOK;
wxButton* m_sdbButtonsSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pads Mask Clearance"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 393,332 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PADS_MASK_CLEARANCE_BASE();
};
#endif //__DIALOG_MASK_CLEARANCE_BASE_H__

View File

@ -67,8 +67,7 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC )
// Project settings are saved in the corresponding <board name>.pro file
bool configChanged = !GetLastNetListRead().IsEmpty() && ( netlistName != GetLastNetListRead() );
if( configChanged && !GetBoard()->GetFileName().IsEmpty()
&& IsOK( this, _( "The project configuration has changed. Do you want to save it?" ) ) )
if( configChanged && !GetBoard()->GetFileName().IsEmpty() )
{
wxFileName fn = Prj().AbsolutePath( GetBoard()->GetFileName() );
fn.SetExt( ProjectFileExtension );

View File

@ -230,7 +230,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
m_Mirrored->SetValue( m_edaText->IsMirrored() );
if( m_modText )
m_KeepUpright->SetValue( !m_modText->IsUnlocked() );
m_KeepUpright->SetValue( m_modText->IsKeepUpright() );
return DIALOG_TEXT_PROPERTIES_BASE::TransferDataToWindow();
}
@ -305,7 +305,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
m_edaText->SetMirrored( m_Mirrored->GetValue() );
if( m_modText )
m_modText->SetUnlocked( !m_KeepUpright->GetValue() );
m_modText->SetKeepUpright( m_KeepUpright->GetValue() );
switch( m_JustifyChoice->GetSelection() )
{

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -24,31 +24,104 @@
#include <fctsys.h>
#include <pcbnew.h>
#include <board_design_settings.h>
#include <widgets/text_ctrl_eval.h>
#include <widgets/paged_dialog.h>
#include <footprint_edit_frame.h>
#include <widgets/wx_grid.h>
#include <panel_modedit_defaults.h>
// Columns of layer classes grid
enum
{
COL_LINE_THICKNESS = 0,
COL_TEXT_WIDTH,
COL_TEXT_HEIGHT,
COL_TEXT_THICKNESS,
COL_TEXT_ITALIC
};
enum
{
ROW_SILK = 0,
ROW_COPPER,
ROW_EDGES,
ROW_OTHERS,
ROW_COUNT
};
PANEL_MODEDIT_DEFAULTS::PANEL_MODEDIT_DEFAULTS( FOOTPRINT_EDIT_FRAME* aFrame, PAGED_DIALOG* aParent) :
PANEL_MODEDIT_DEFAULTS_BASE( aParent ),
m_brdSettings( aFrame->GetDesignSettings() ),
m_frame( aFrame ),
m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true, 0 ),
m_textThickness( aFrame, m_textThickLabel, m_textThickCtrl, m_textThickUnits, true, 0 ),
m_textWidth( aFrame, m_textWidthLabel, m_textWidthCtrl, m_textWidthUnits, true, 0 ),
m_textHeight( aFrame, m_textHeightLabel, m_textHeightCtrl, m_textHeightUnits, true, 0 )
{}
m_Parent( aParent )
{
m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
// Work around a bug in wxWidgets where it fails to recalculate the grid height
// after changing the default row size
m_grid->AppendRows( 1 );
m_grid->DeleteRows( m_grid->GetNumberRows() - 1, 1 );
m_grid->PushEventHandler( new GRID_TRICKS( m_grid ) );
// 6.0 TODO: flag the Others row for now
auto attr = new wxGridCellAttr;
attr->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) );
m_grid->SetRowAttr( 3, attr );
}
PANEL_MODEDIT_DEFAULTS::~PANEL_MODEDIT_DEFAULTS()
{
// destroy GRID_TRICKS before m_grid.
m_grid->PopEventHandler( true );
}
bool PANEL_MODEDIT_DEFAULTS::TransferDataToWindow()
{
m_lineWidth.SetValue( m_brdSettings.m_ModuleSegmentWidth );
wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND );
m_textThickness.SetValue( m_brdSettings.m_ModuleTextWidth );
m_textWidth.SetValue( m_brdSettings.m_ModuleTextSize.x );
m_textHeight.SetValue( m_brdSettings.m_ModuleTextSize.y );
#define SET_MILS_CELL( row, col, val ) \
m_grid->SetCellValue( row, col, StringFromValue( m_frame->GetUserUnits(), val, true, true ) )
#define DISABLE_CELL( row, col ) \
m_grid->SetReadOnly( row, col ); m_grid->SetCellBackgroundColour( row, col, disabledColour );
for( int i = 0; i < ROW_COUNT; ++i )
{
SET_MILS_CELL( i, COL_LINE_THICKNESS, m_brdSettings.m_LineThickness[ i ] );
if( i == ROW_EDGES )
{
DISABLE_CELL( i, COL_TEXT_WIDTH );
DISABLE_CELL( i, COL_TEXT_HEIGHT );
DISABLE_CELL( i, COL_TEXT_THICKNESS );
DISABLE_CELL( i, COL_TEXT_ITALIC );
}
else
{
SET_MILS_CELL( i, COL_TEXT_WIDTH, m_brdSettings.m_TextSize[ i ].x );
SET_MILS_CELL( i, COL_TEXT_HEIGHT, m_brdSettings.m_TextSize[ i ].y );
SET_MILS_CELL( i, COL_TEXT_THICKNESS, m_brdSettings.m_TextThickness[ i ] );
m_grid->SetCellValue( i, COL_TEXT_ITALIC, m_brdSettings.m_TextItalic[ i ] ? "1" : "" );
auto attr = new wxGridCellAttr;
attr->SetRenderer( new wxGridCellBoolRenderer() );
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
// 6.0 TODO: flag the Italic Text column for now
attr->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) );
m_grid->SetAttr( i, COL_TEXT_ITALIC, attr );
}
}
// Footprint defaults
m_textCtrlRefText->SetValue( m_brdSettings.m_RefDefaultText );
m_choiceLayerReference->SetSelection( m_brdSettings.m_RefDefaultlayer == F_SilkS ? 0 : 1 );
m_choiceVisibleReference->SetSelection( m_brdSettings.m_RefDefaultVisibility ? 0 : 1 );
@ -61,20 +134,54 @@ bool PANEL_MODEDIT_DEFAULTS::TransferDataToWindow()
}
int PANEL_MODEDIT_DEFAULTS::getGridValue( int aRow, int aCol )
{
return ValueFromString( m_frame->GetUserUnits(), m_grid->GetCellValue( aRow, aCol ), true );
}
bool PANEL_MODEDIT_DEFAULTS::validateData()
{
// Commit any pending in-place edits and close editors from grid
m_grid->DisableCellEditControl();
// Test text parameters.
for( int row : { ROW_SILK, ROW_COPPER, ROW_OTHERS } )
{
int textSize = std::min( getGridValue( row, COL_TEXT_WIDTH ),
getGridValue( row, COL_TEXT_HEIGHT ) );
if( getGridValue( row, COL_TEXT_THICKNESS ) > textSize / 4 )
{
wxString msg = _( "Text will not be readable with a thickness greater than\n"
"1/4 its width or height." );
m_Parent->SetError( msg, this, m_grid, row, COL_TEXT_THICKNESS );
return false;
}
}
return true;
}
bool PANEL_MODEDIT_DEFAULTS::TransferDataFromWindow()
{
m_brdSettings.m_ModuleSegmentWidth = m_lineWidth.GetValue();
m_brdSettings.m_ModuleTextWidth = m_textThickness.GetValue();
m_brdSettings.m_ModuleTextSize.x = m_textWidth.GetValue();
m_brdSettings.m_ModuleTextSize.y = m_textHeight.GetValue();
if( !validateData() )
return false;
m_brdSettings.m_RefDefaultText = m_textCtrlRefText->GetValue();
m_brdSettings.m_RefDefaultlayer = m_choiceLayerReference->GetSelection() == 1 ? F_Fab : F_SilkS;
m_brdSettings.m_RefDefaultVisibility = m_choiceVisibleReference->GetSelection() != 1;
for( int i = 0; i < ROW_COUNT; ++i )
{
m_brdSettings.m_LineThickness[ i ] = getGridValue( i, COL_LINE_THICKNESS );
m_brdSettings.m_ValueDefaultText = m_textCtrlValueText->GetValue();
m_brdSettings.m_ValueDefaultlayer = m_choiceLayerValue->GetSelection() == 1 ? F_Fab : F_SilkS;
m_brdSettings.m_ValueDefaultVisibility = m_choiceVisibleValue->GetSelection() != 1;
if( i == ROW_EDGES ) // edges & courtyards only define line thickness
continue;
m_brdSettings.m_TextSize[ i ] =
wxSize( getGridValue( i, COL_TEXT_WIDTH ), getGridValue( i, COL_TEXT_HEIGHT ) );
m_brdSettings.m_TextThickness[ i ] = getGridValue( i, COL_TEXT_THICKNESS );
m_brdSettings.m_TextItalic[ i ] =
wxGridCellBoolEditor::IsTrueValue( m_grid->GetCellValue( i, COL_TEXT_ITALIC ) );
}
m_frame->SetDesignSettings( m_brdSettings );

View File

@ -31,16 +31,17 @@ class PANEL_MODEDIT_DEFAULTS : public PANEL_MODEDIT_DEFAULTS_BASE
{
BOARD_DESIGN_SETTINGS m_brdSettings;
FOOTPRINT_EDIT_FRAME* m_frame;
UNIT_BINDER m_lineWidth;
UNIT_BINDER m_textThickness;
UNIT_BINDER m_textWidth;
UNIT_BINDER m_textHeight;
PAGED_DIALOG* m_Parent;
public:
PANEL_MODEDIT_DEFAULTS( FOOTPRINT_EDIT_FRAME* aFrame, PAGED_DIALOG* aParent );
~PANEL_MODEDIT_DEFAULTS() override;
private:
int getGridValue( int aRow, int aCol );
bool validateData();
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
};

View File

@ -5,7 +5,7 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/text_ctrl_eval.h"
#include "widgets/wx_grid.h"
#include "panel_modedit_defaults_base.h"
@ -14,143 +14,133 @@
PANEL_MODEDIT_DEFAULTS_BASE::PANEL_MODEDIT_DEFAULTS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxHORIZONTAL );
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerMargins;
bSizerMargins = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerNewGraphicItems;
sbSizerNewGraphicItems = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Default Values for New Graphic Items") ), wxVERTICAL );
m_staticText13 = new wxStaticText( this, wxID_ANY, _("Default values for new footprints:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText13->Wrap( -1 );
bSizerMargins->Add( m_staticText13, 0, wxTOP|wxLEFT, 10 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 3, 5, 5 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxFlexGridSizer* defaultValuesSizer;
defaultValuesSizer = new wxFlexGridSizer( 0, 4, 5, 5 );
defaultValuesSizer->AddGrowableCol( 1 );
defaultValuesSizer->SetFlexibleDirection( wxBOTH );
defaultValuesSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_lineWidthLabel = new wxStaticText( sbSizerNewGraphicItems->GetStaticBox(), wxID_ANY, _("&Graphic line width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthLabel->Wrap( -1 );
fgSizer1->Add( m_lineWidthLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_lineWidthCtrl = new TEXT_CTRL_EVAL( sbSizerNewGraphicItems->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_lineWidthCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_lineWidthUnits = new wxStaticText( sbSizerNewGraphicItems->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthUnits->Wrap( -1 );
fgSizer1->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND|wxTOP, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_textThickLabel = new wxStaticText( sbSizerNewGraphicItems->GetStaticBox(), wxID_ANY, _("&Text thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textThickLabel->Wrap( -1 );
fgSizer1->Add( m_textThickLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textThickCtrl = new TEXT_CTRL_EVAL( sbSizerNewGraphicItems->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textThickCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_textThickUnits = new wxStaticText( sbSizerNewGraphicItems->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_textThickUnits->Wrap( -1 );
fgSizer1->Add( m_textThickUnits, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textHeightLabel = new wxStaticText( sbSizerNewGraphicItems->GetStaticBox(), wxID_ANY, _("Text &height:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textHeightLabel->Wrap( -1 );
fgSizer1->Add( m_textHeightLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textHeightCtrl = new TEXT_CTRL_EVAL( sbSizerNewGraphicItems->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textHeightCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_textHeightUnits = new wxStaticText( sbSizerNewGraphicItems->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_textHeightUnits->Wrap( -1 );
fgSizer1->Add( m_textHeightUnits, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textWidthLabel = new wxStaticText( sbSizerNewGraphicItems->GetStaticBox(), wxID_ANY, _("Text &width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textWidthLabel->Wrap( -1 );
fgSizer1->Add( m_textWidthLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textWidthCtrl = new TEXT_CTRL_EVAL( sbSizerNewGraphicItems->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textWidthCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_textWidthUnits = new wxStaticText( sbSizerNewGraphicItems->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_textWidthUnits->Wrap( -1 );
fgSizer1->Add( m_textWidthUnits, 0, wxALIGN_CENTER_VERTICAL, 5 );
sbSizerNewGraphicItems->Add( fgSizer1, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
bSizerMargins->Add( sbSizerNewGraphicItems, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
wxStaticBoxSizer* sbSizerNewFootprints;
sbSizerNewFootprints = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Default Values for New Footprints") ), wxVERTICAL );
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 0, 4, 5, 5 );
fgSizer2->AddGrowableCol( 1 );
fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextRef = new wxStaticText( sbSizerNewFootprints->GetStaticBox(), wxID_ANY, _("&Reference:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRef = new wxStaticText( this, wxID_ANY, _("&Reference:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRef->Wrap( -1 );
fgSizer2->Add( m_staticTextRef, 0, wxALIGN_CENTER_VERTICAL, 5 );
defaultValuesSizer->Add( m_staticTextRef, 0, wxALIGN_CENTER_VERTICAL|wxTOP, 5 );
m_textCtrlRefText = new wxTextCtrl( sbSizerNewFootprints->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textCtrlRefText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textCtrlRefText->SetToolTip( _("Default text for reference\nLeave blank to use the footprint name") );
fgSizer2->Add( m_textCtrlRefText, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 5 );
defaultValuesSizer->Add( m_textCtrlRefText, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT, 5 );
wxString m_choiceLayerReferenceChoices[] = { _("SilkScreen"), _("Fab. Layer") };
int m_choiceLayerReferenceNChoices = sizeof( m_choiceLayerReferenceChoices ) / sizeof( wxString );
m_choiceLayerReference = new wxChoice( sbSizerNewFootprints->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceLayerReferenceNChoices, m_choiceLayerReferenceChoices, 0 );
m_choiceLayerReference = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceLayerReferenceNChoices, m_choiceLayerReferenceChoices, 0 );
m_choiceLayerReference->SetSelection( 0 );
fgSizer2->Add( m_choiceLayerReference, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
defaultValuesSizer->Add( m_choiceLayerReference, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
wxString m_choiceVisibleReferenceChoices[] = { _("Visible"), _("Invisible") };
int m_choiceVisibleReferenceNChoices = sizeof( m_choiceVisibleReferenceChoices ) / sizeof( wxString );
m_choiceVisibleReference = new wxChoice( sbSizerNewFootprints->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVisibleReferenceNChoices, m_choiceVisibleReferenceChoices, 0 );
m_choiceVisibleReference = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVisibleReferenceNChoices, m_choiceVisibleReferenceChoices, 0 );
m_choiceVisibleReference->SetSelection( 0 );
fgSizer2->Add( m_choiceVisibleReference, 0, wxALIGN_CENTER_VERTICAL, 5 );
defaultValuesSizer->Add( m_choiceVisibleReference, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
m_staticTextValue = new wxStaticText( sbSizerNewFootprints->GetStaticBox(), wxID_ANY, _("V&alue:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextValue = new wxStaticText( this, wxID_ANY, _("V&alue:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextValue->Wrap( -1 );
fgSizer2->Add( m_staticTextValue, 0, wxALIGN_CENTER_VERTICAL, 5 );
defaultValuesSizer->Add( m_staticTextValue, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textCtrlValueText = new wxTextCtrl( sbSizerNewFootprints->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textCtrlValueText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textCtrlValueText->SetToolTip( _("Default text for value\nLeave blank to use the footprint name") );
m_textCtrlValueText->SetMinSize( wxSize( 160,-1 ) );
fgSizer2->Add( m_textCtrlValueText, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 5 );
defaultValuesSizer->Add( m_textCtrlValueText, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 5 );
wxString m_choiceLayerValueChoices[] = { _("SilkScreen"), _("Fab. Layer") };
int m_choiceLayerValueNChoices = sizeof( m_choiceLayerValueChoices ) / sizeof( wxString );
m_choiceLayerValue = new wxChoice( sbSizerNewFootprints->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceLayerValueNChoices, m_choiceLayerValueChoices, 0 );
m_choiceLayerValue = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceLayerValueNChoices, m_choiceLayerValueChoices, 0 );
m_choiceLayerValue->SetSelection( 1 );
fgSizer2->Add( m_choiceLayerValue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
defaultValuesSizer->Add( m_choiceLayerValue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
wxString m_choiceVisibleValueChoices[] = { _("Visible"), _("Invisible") };
int m_choiceVisibleValueNChoices = sizeof( m_choiceVisibleValueChoices ) / sizeof( wxString );
m_choiceVisibleValue = new wxChoice( sbSizerNewFootprints->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVisibleValueNChoices, m_choiceVisibleValueChoices, 0 );
m_choiceVisibleValue = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVisibleValueNChoices, m_choiceVisibleValueChoices, 0 );
m_choiceVisibleValue->SetSelection( 0 );
fgSizer2->Add( m_choiceVisibleValue, 0, wxALIGN_CENTER_VERTICAL, 5 );
defaultValuesSizer->Add( m_choiceVisibleValue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
sbSizerNewFootprints->Add( fgSizer2, 0, wxEXPAND|wxBOTTOM, 5 );
bSizerMargins->Add( defaultValuesSizer, 0, wxEXPAND|wxLEFT, 25 );
m_staticTextInfo = new wxStaticText( sbSizerNewFootprints->GetStaticBox(), wxID_ANY, _("Leave reference and/or value blank to use footprint name."), wxDefaultPosition, wxDefaultSize, 0 );
bSizerMargins->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticTextInfo = new wxStaticText( this, wxID_ANY, _("Leave reference and/or value blank to use footprint name."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfo->Wrap( -1 );
sbSizerNewFootprints->Add( m_staticTextInfo, 0, wxTOP|wxBOTTOM, 5 );
m_staticTextInfo->SetFont( wxFont( 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizerMargins->Add( m_staticTextInfo, 0, wxBOTTOM|wxLEFT, 25 );
bSizerMargins->Add( sbSizerNewFootprints, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
bSizerMargins->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 );
wxBoxSizer* defaultSizesSizer1;
defaultSizesSizer1 = new wxBoxSizer( wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Default properties for new graphic items:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
defaultSizesSizer1->Add( m_staticText1, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
// Grid
m_grid->CreateGrid( 4, 5 );
m_grid->EnableEditing( true );
m_grid->EnableGridLines( true );
m_grid->EnableDragGridSize( false );
m_grid->SetMargins( 0, 0 );
// Columns
m_grid->SetColSize( 0, 110 );
m_grid->SetColSize( 1, 100 );
m_grid->SetColSize( 2, 100 );
m_grid->SetColSize( 3, 100 );
m_grid->SetColSize( 4, 60 );
m_grid->EnableDragColMove( false );
m_grid->EnableDragColSize( true );
m_grid->SetColLabelSize( 22 );
m_grid->SetColLabelValue( 0, _("Line Thickness") );
m_grid->SetColLabelValue( 1, _("Text Width") );
m_grid->SetColLabelValue( 2, _("Text Height") );
m_grid->SetColLabelValue( 3, _("Text Thickness") );
m_grid->SetColLabelValue( 4, _("Italic") );
m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_grid->EnableDragRowSize( false );
m_grid->SetRowLabelSize( 125 );
m_grid->SetRowLabelValue( 0, _("Silk Layers") );
m_grid->SetRowLabelValue( 1, _("Copper Layers") );
m_grid->SetRowLabelValue( 2, _("Edges & Courtyards") );
m_grid->SetRowLabelValue( 3, _("Other Layers") );
m_grid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_grid->SetToolTip( _("Net Class parameters") );
defaultSizesSizer1->Add( m_grid, 1, wxBOTTOM|wxLEFT, 20 );
bSizerMain->Add( bSizerMargins, 0, wxEXPAND|wxTOP|wxLEFT, 10 );
bSizerMargins->Add( defaultSizesSizer1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bSizerMain->Add( bSizerMargins, 1, wxTOP|wxLEFT, 10 );
this->SetSizer( bSizerMain );

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class TEXT_CTRL_EVAL;
class WX_GRID;
#include <wx/string.h>
#include <wx/stattext.h>
@ -20,9 +20,9 @@ class TEXT_CTRL_EVAL;
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/grid.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
@ -36,18 +36,7 @@ class PANEL_MODEDIT_DEFAULTS_BASE : public wxPanel
private:
protected:
wxStaticText* m_lineWidthLabel;
TEXT_CTRL_EVAL* m_lineWidthCtrl;
wxStaticText* m_lineWidthUnits;
wxStaticText* m_textThickLabel;
TEXT_CTRL_EVAL* m_textThickCtrl;
wxStaticText* m_textThickUnits;
wxStaticText* m_textHeightLabel;
TEXT_CTRL_EVAL* m_textHeightCtrl;
wxStaticText* m_textHeightUnits;
wxStaticText* m_textWidthLabel;
TEXT_CTRL_EVAL* m_textWidthCtrl;
wxStaticText* m_textWidthUnits;
wxStaticText* m_staticText13;
wxStaticText* m_staticTextRef;
wxTextCtrl* m_textCtrlRefText;
wxChoice* m_choiceLayerReference;
@ -57,6 +46,8 @@ class PANEL_MODEDIT_DEFAULTS_BASE : public wxPanel
wxChoice* m_choiceLayerValue;
wxChoice* m_choiceVisibleValue;
wxStaticText* m_staticTextInfo;
wxStaticText* m_staticText1;
WX_GRID* m_grid;
public:

View File

@ -65,7 +65,7 @@ PANEL_PCBNEW_DISPLAY_OPTIONS_BASE::PANEL_PCBNEW_DISPLAY_OPTIONS_BASE( wxWindow*
bRightSizer->Add( sbClearance, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
bupperSizer->Add( bRightSizer, 1, wxEXPAND|wxTOP, 5 );
bupperSizer->Add( bRightSizer, 1, wxEXPAND|wxTOP|wxLEFT, 5 );
bMainSizer->Add( bupperSizer, 0, wxEXPAND|wxTOP|wxLEFT, 10 );

View File

@ -105,7 +105,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="flag">wxEXPAND|wxTOP|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>

View File

@ -0,0 +1,101 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <pcb_edit_frame.h>
#include <board_design_settings.h>
#include <panel_setup_feature_constraints.h>
PANEL_SETUP_FEATURE_CONSTRAINTS::PANEL_SETUP_FEATURE_CONSTRAINTS( PAGED_DIALOG* aParent,
PCB_EDIT_FRAME* aFrame ) :
PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( aParent ),
m_trackMinWidth( aFrame, m_TrackMinWidthTitle, m_TrackMinWidthCtrl, m_TrackMinWidthUnits, true, 0 ),
m_viaMinSize( aFrame, m_ViaMinTitle, m_SetViasMinSizeCtrl, m_ViaMinUnits, true, 0 ),
m_viaMinDrill( aFrame, m_ViaMinDrillTitle, m_SetViasMinDrillCtrl, m_ViaMinDrillUnits, true, 0 ),
m_uviaMinSize( aFrame, m_uviaMinSizeLabel, m_uviaMinSizeCtrl, m_uviaMinSizeUnits, true, 0 ),
m_uviaMinDrill( aFrame, m_uviaMinDrillLabel, m_uviaMinDrillCtrl, m_uviaMinDrillUnits, true, 0 ),
m_holeToHoleMin( aFrame, m_HoleToHoleTitle, m_SetHoleToHoleCtrl, m_HoleToHoleUnits, true, 0 )
{
m_Frame = aFrame;
m_BrdSettings = &m_Frame->GetBoard()->GetDesignSettings();
}
bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataToWindow()
{
m_trackMinWidth.SetValue( m_BrdSettings->m_TrackMinWidth );
m_viaMinSize.SetValue(m_BrdSettings->m_ViasMinSize );
m_viaMinDrill.SetValue( m_BrdSettings->m_ViasMinDrill );
m_OptAllowBlindBuriedVias->SetValue( m_BrdSettings->m_BlindBuriedViaAllowed );
m_OptAllowMicroVias->SetValue( m_BrdSettings->m_MicroViasAllowed );
m_uviaMinSize.SetValue( m_BrdSettings->m_MicroViasMinSize );
m_uviaMinDrill.SetValue( m_BrdSettings->m_MicroViasMinDrill );
m_holeToHoleMin.SetValue( m_BrdSettings->m_HoleToHoleMin );
m_OptRequireCourtyards->SetValue( m_BrdSettings->m_RequireCourtyards );
m_OptOverlappingCourtyards->SetValue( m_BrdSettings->m_ProhibitOverlappingCourtyards );
return true;
}
bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataFromWindow()
{
// Update tracks minimum values for DRC
m_BrdSettings->m_TrackMinWidth = m_trackMinWidth.GetValue();
// Update vias minimum values for DRC
m_BrdSettings->m_ViasMinSize = m_viaMinSize.GetValue();
m_BrdSettings->m_ViasMinDrill = m_viaMinDrill.GetValue();
m_BrdSettings->m_BlindBuriedViaAllowed = m_OptAllowBlindBuriedVias->GetValue();
m_BrdSettings->m_MicroViasAllowed = m_OptAllowMicroVias->GetValue();
// Update microvias minimum values for DRC
m_BrdSettings->m_MicroViasMinSize = m_uviaMinSize.GetValue();
m_BrdSettings->m_MicroViasMinDrill = m_uviaMinDrill.GetValue();
m_BrdSettings->SetMinHoleSeparation( m_holeToHoleMin.GetValue() );
m_BrdSettings->SetRequireCourtyardDefinitions( m_OptRequireCourtyards->GetValue() );
m_BrdSettings->SetProhibitOverlappingCourtyards( m_OptOverlappingCourtyards->GetValue() );
return true;
}
void PANEL_SETUP_FEATURE_CONSTRAINTS::ImportSettingsFrom( BOARD* aBoard )
{
BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
m_BrdSettings = &aBoard->GetDesignSettings();
TransferDataToWindow();
m_BrdSettings = savedSettings;
}

View File

@ -0,0 +1,61 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PANEL_SETUP_FEATURE_CONSTRAINTS_H
#define PANEL_SETUP_FEATURE_CONSTRAINTS_H
#include <class_board.h>
#include <widgets/unit_binder.h>
#include <widgets/paged_dialog.h>
#include <panel_setup_feature_constraints_base.h>
class PCB_EDIT_FRAME;
class BOARD_DESIGN_SETTINGS;
class PANEL_SETUP_FEATURE_CONSTRAINTS : public PANEL_SETUP_FEATURE_CONSTRAINTS_BASE
{
private:
PCB_EDIT_FRAME* m_Frame;
BOARD_DESIGN_SETTINGS* m_BrdSettings;
public:
UNIT_BINDER m_trackMinWidth;
UNIT_BINDER m_viaMinSize;
UNIT_BINDER m_viaMinDrill;
UNIT_BINDER m_uviaMinSize;
UNIT_BINDER m_uviaMinDrill;
UNIT_BINDER m_holeToHoleMin;
public:
PANEL_SETUP_FEATURE_CONSTRAINTS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame );
~PANEL_SETUP_FEATURE_CONSTRAINTS( ) override { };
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void ImportSettingsFrom( BOARD* aBoard );
};
#endif //PANEL_SETUP_FEATURE_CONSTRAINTS_H

View File

@ -0,0 +1,165 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "panel_setup_feature_constraints_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* sbFeatureRules;
sbFeatureRules = new wxBoxSizer( wxVERTICAL );
m_OptAllowBlindBuriedVias = new wxCheckBox( this, wxID_ANY, _("Allow blind/buried vias"), wxDefaultPosition, wxDefaultSize, 0 );
sbFeatureRules->Add( m_OptAllowBlindBuriedVias, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 5 );
m_OptAllowMicroVias = new wxCheckBox( this, wxID_ANY, _("Allow micro vias (uVias)"), wxDefaultPosition, wxDefaultSize, 0 );
sbFeatureRules->Add( m_OptAllowMicroVias, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT, 5 );
sbFeatureRules->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_OptRequireCourtyards = new wxCheckBox( this, wxID_ANY, _("Require courtyard definitions in footprints"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptRequireCourtyards->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) );
sbFeatureRules->Add( m_OptRequireCourtyards, 0, wxTOP|wxRIGHT, 5 );
m_OptOverlappingCourtyards = new wxCheckBox( this, wxID_ANY, _("Prohibit overlapping courtyards"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptOverlappingCourtyards->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) );
sbFeatureRules->Add( m_OptOverlappingCourtyards, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
bMainSizer->Add( sbFeatureRules, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 20 );
bMainSizer->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* sbFeatureConstraints;
sbFeatureConstraints = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgFeatureConstraints;
fgFeatureConstraints = new wxFlexGridSizer( 0, 3, 3, 0 );
fgFeatureConstraints->AddGrowableCol( 1 );
fgFeatureConstraints->SetFlexibleDirection( wxBOTH );
fgFeatureConstraints->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_TrackMinWidthTitle = new wxStaticText( this, wxID_ANY, _("Minimum track width:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_TrackMinWidthTitle->Wrap( -1 );
fgFeatureConstraints->Add( m_TrackMinWidthTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxBOTTOM, 5 );
m_TrackMinWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgFeatureConstraints->Add( m_TrackMinWidthCtrl, 0, wxALIGN_LEFT|wxALIGN_TOP|wxEXPAND|wxBOTTOM|wxLEFT, 5 );
m_TrackMinWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_TrackMinWidthUnits->Wrap( -1 );
fgFeatureConstraints->Add( m_TrackMinWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxBOTTOM, 5 );
fgFeatureConstraints->Add( 0, 0, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
fgFeatureConstraints->Add( 0, 0, 1, wxEXPAND, 5 );
fgFeatureConstraints->Add( 0, 0, 1, wxALL|wxEXPAND, 5 );
m_ViaMinTitle = new wxStaticText( this, wxID_ANY, _("Minimum via diameter:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_ViaMinTitle->Wrap( -1 );
fgFeatureConstraints->Add( m_ViaMinTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_SetViasMinSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgFeatureConstraints->Add( m_SetViasMinSizeCtrl, 0, wxEXPAND|wxLEFT, 5 );
m_ViaMinUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_ViaMinUnits->Wrap( -1 );
fgFeatureConstraints->Add( m_ViaMinUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_ViaMinDrillTitle = new wxStaticText( this, wxID_ANY, _("Minimum via drill:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_ViaMinDrillTitle->Wrap( -1 );
fgFeatureConstraints->Add( m_ViaMinDrillTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_SetViasMinDrillCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgFeatureConstraints->Add( m_SetViasMinDrillCtrl, 0, wxEXPAND|wxBOTTOM|wxLEFT, 5 );
m_ViaMinDrillUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_ViaMinDrillUnits->Wrap( -1 );
fgFeatureConstraints->Add( m_ViaMinDrillUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
fgFeatureConstraints->Add( 0, 0, 1, wxEXPAND|wxTOP, 5 );
fgFeatureConstraints->Add( 0, 0, 1, wxEXPAND|wxTOP, 5 );
fgFeatureConstraints->Add( 0, 0, 1, wxEXPAND|wxTOP, 5 );
m_uviaMinSizeLabel = new wxStaticText( this, wxID_ANY, _("Minimum uVia diameter:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_uviaMinSizeLabel->Wrap( -1 );
fgFeatureConstraints->Add( m_uviaMinSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_uviaMinSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgFeatureConstraints->Add( m_uviaMinSizeCtrl, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
m_uviaMinSizeUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_uviaMinSizeUnits->Wrap( -1 );
fgFeatureConstraints->Add( m_uviaMinSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_uviaMinDrillLabel = new wxStaticText( this, wxID_ANY, _("Minimum uVia drill:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_uviaMinDrillLabel->Wrap( -1 );
fgFeatureConstraints->Add( m_uviaMinDrillLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_uviaMinDrillCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgFeatureConstraints->Add( m_uviaMinDrillCtrl, 0, wxEXPAND|wxLEFT, 5 );
m_uviaMinDrillUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_uviaMinDrillUnits->Wrap( -1 );
fgFeatureConstraints->Add( m_uviaMinDrillUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
fgFeatureConstraints->Add( 0, 0, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
fgFeatureConstraints->Add( 0, 0, 1, wxEXPAND, 5 );
fgFeatureConstraints->Add( 0, 0, 1, wxEXPAND, 5 );
m_HoleToHoleTitle = new wxStaticText( this, wxID_ANY, _("Minimum hole to hole:"), wxDefaultPosition, wxDefaultSize, 0 );
m_HoleToHoleTitle->Wrap( -1 );
m_HoleToHoleTitle->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) );
fgFeatureConstraints->Add( m_HoleToHoleTitle, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP, 5 );
m_SetHoleToHoleCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetHoleToHoleCtrl->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) );
fgFeatureConstraints->Add( m_SetHoleToHoleCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_HoleToHoleUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_HoleToHoleUnits->Wrap( -1 );
fgFeatureConstraints->Add( m_HoleToHoleUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP, 5 );
sbFeatureConstraints->Add( fgFeatureConstraints, 1, wxEXPAND, 5 );
bMainSizer->Add( sbFeatureConstraints, 0, wxEXPAND|wxTOP|wxLEFT, 20 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
}
PANEL_SETUP_FEATURE_CONSTRAINTS_BASE::~PANEL_SETUP_FEATURE_CONSTRAINTS_BASE()
{
}

View File

@ -0,0 +1,66 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __PANEL_SETUP_FEATURE_CONSTRAINTS_BASE_H__
#define __PANEL_SETUP_FEATURE_CONSTRAINTS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/valtext.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_SETUP_FEATURE_CONSTRAINTS_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_SETUP_FEATURE_CONSTRAINTS_BASE : public wxPanel
{
private:
protected:
wxCheckBox* m_OptAllowBlindBuriedVias;
wxCheckBox* m_OptAllowMicroVias;
wxCheckBox* m_OptRequireCourtyards;
wxCheckBox* m_OptOverlappingCourtyards;
wxStaticText* m_TrackMinWidthTitle;
wxTextCtrl* m_TrackMinWidthCtrl;
wxStaticText* m_TrackMinWidthUnits;
wxStaticText* m_ViaMinTitle;
wxTextCtrl* m_SetViasMinSizeCtrl;
wxStaticText* m_ViaMinUnits;
wxStaticText* m_ViaMinDrillTitle;
wxTextCtrl* m_SetViasMinDrillCtrl;
wxStaticText* m_ViaMinDrillUnits;
wxStaticText* m_uviaMinSizeLabel;
wxTextCtrl* m_uviaMinSizeCtrl;
wxStaticText* m_uviaMinSizeUnits;
wxStaticText* m_uviaMinDrillLabel;
wxTextCtrl* m_uviaMinDrillCtrl;
wxStaticText* m_uviaMinDrillUnits;
wxStaticText* m_HoleToHoleTitle;
wxTextCtrl* m_SetHoleToHoleCtrl;
wxStaticText* m_HoleToHoleUnits;
public:
PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
~PANEL_SETUP_FEATURE_CONSTRAINTS_BASE();
};
#endif //__PANEL_SETUP_FEATURE_CONSTRAINTS_BASE_H__

View File

@ -30,12 +30,10 @@
#include <pcbnew.h>
#include <pcb_edit_frame.h>
#include <view/view.h>
#include <widgets/unit_binder.h>
#include <invoke_pcb_dialog.h>
#include <class_board.h>
#include <collectors.h>
#include <dialog_layers_setup_base.h>
#include <panel_setup_layers.h>
// some define to choose how copper layers widgets are shown
@ -45,24 +43,6 @@
#define HIDE_INACTIVE_LAYERS
/**
* Holds the 3 UI control pointers for a single board layer.
*/
struct CTLs
{
CTLs( wxControl* aName, wxCheckBox* aCheckBox, wxControl* aChoiceOrDesc )
{
name = aName;
checkbox = aCheckBox;
choice = aChoiceOrDesc;
}
wxControl* name;
wxCheckBox* checkbox;
wxControl* choice;
};
static LSEQ dlg_layers()
{
// layers that are put out into the dialog UI, coordinate with wxformbuilder and
@ -128,77 +108,6 @@ static LSEQ dlg_layers()
}
class DIALOG_LAYERS_SETUP : public DIALOG_LAYERS_SETUP_BASE
{
public:
DIALOG_LAYERS_SETUP( PCB_EDIT_FRAME* aCaller, BOARD* aBoard );
private:
int m_copperLayerCount;
LSET m_enabledLayers;
BOARD* m_pcb;
UNIT_BINDER m_pcbThickness;
void setLayerCheckBox( LAYER_NUM layer, bool isChecked );
void setCopperLayerCheckBoxes( int copperCount );
void setMandatoryLayerCheckBoxes();
void showCopperChoice( int copperCount );
void showBoardLayerNames();
void showSelectedLayerCheckBoxes( LSET enableLayerMask );
void showLayerTypes();
void showPresets( LSET enabledLayerMask );
/** Return the selected layer mask within the UI checkboxes */
LSET getUILayerMask();
wxString getLayerName( LAYER_NUM layer );
int getLayerTypeIndex( LAYER_NUM layer );
void OnInitDialog( wxInitDialogEvent& aEvent ) override;
void OnCheckBox( wxCommandEvent& event ) override;
void DenyChangeCheckBox( wxCommandEvent& event ) override;
void OnPresetsChoice( wxCommandEvent& event ) override;
void OnCopperLayersChoice( wxCommandEvent& event ) override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
bool testLayerNames();
/**
* Return a list of layers removed from the board that contain items.
*/
LSEQ getRemovedLayersWithItems();
/**
* Return a list of layers in use in footprints, and therefore not removable.
*/
LSEQ getNonRemovableLayers();
/**
* Map \a aLayerNumber to the wx IDs for that layer which are
* the layer name control ID, checkbox control ID, and choice control ID
*/
CTLs getCTLs( LAYER_NUM aLayerNumber );
wxControl* getName( LAYER_NUM aLayer )
{
return getCTLs( aLayer ).name;
}
wxCheckBox* getCheckBox( LAYER_NUM aLayer )
{
return getCTLs( aLayer ).checkbox;
}
wxChoice* getChoice( LAYER_NUM aLayer )
{
return (wxChoice*) getCTLs( aLayer ).choice;
}
};
// Layer bit masks for each defined "Preset Layer Grouping"
static const LSET presets[] =
{
@ -225,10 +134,23 @@ static const LSET presets[] =
};
CTLs DIALOG_LAYERS_SETUP::getCTLs( LAYER_NUM aLayerNumber )
PANEL_SETUP_LAYERS::PANEL_SETUP_LAYERS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ) :
PANEL_SETUP_LAYERS_BASE( aParent ),
m_Parent( aParent ),
m_pcbThickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits, true,
Millimeter2iu( 0.1 ), Millimeter2iu( 10.0 ) )
{
#define RETURN_COPPER(x) return CTLs( x##Name, x##CheckBox, x##Choice )
#define RETURN_AUX(x) return CTLs( x##Name, x##CheckBox, x##StaticText )
m_pcb = aFrame->GetBoard();
m_LayersListPanel->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX) );
}
PANEL_SETUP_LAYERS_CTLs PANEL_SETUP_LAYERS::getCTLs( LAYER_NUM aLayerNumber )
{
#define RETURN_COPPER(x) return PANEL_SETUP_LAYERS_CTLs( x##Name, x##CheckBox, x##Choice )
#define RETURN_AUX(x) return PANEL_SETUP_LAYERS_CTLs( x##Name, x##CheckBox, x##StaticText )
switch( aLayerNumber )
{
@ -288,49 +210,35 @@ CTLs DIALOG_LAYERS_SETUP::getCTLs( LAYER_NUM aLayerNumber )
case Dwgs_User: RETURN_AUX( m_Drawings );
default:
wxASSERT_MSG( 0, wxT( "bad layer id" ) );
return CTLs( nullptr, nullptr, nullptr );
return PANEL_SETUP_LAYERS_CTLs( nullptr, nullptr, nullptr );
}
#undef RETURN_COPPER
#undef RETURN_AUX
}
DIALOG_LAYERS_SETUP::DIALOG_LAYERS_SETUP( PCB_EDIT_FRAME* aParent, BOARD* aBoard ) :
DIALOG_LAYERS_SETUP_BASE( aParent ),
m_pcbThickness( aParent, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits, true,
Millimeter2iu( 0.1 ), Millimeter2iu( 10.0 ) )
wxControl* PANEL_SETUP_LAYERS::getName( LAYER_NUM aLayer )
{
m_pcb = aBoard;
return getCTLs( aLayer ).name;
}
m_copperLayerCount = m_pcb->GetCopperLayerCount();
wxCheckBox* PANEL_SETUP_LAYERS::getCheckBox( LAYER_NUM aLayer )
{
return getCTLs( aLayer ).checkbox;
}
wxChoice* PANEL_SETUP_LAYERS::getChoice( LAYER_NUM aLayer )
{
return (wxChoice*) getCTLs( aLayer ).choice;
}
bool PANEL_SETUP_LAYERS::TransferDataToWindow()
{
m_enabledLayers = m_pcb->GetEnabledLayers();
SetAutoLayout( true );
}
void DIALOG_LAYERS_SETUP::OnInitDialog( wxInitDialogEvent& aEvent )
{
wxWindowBase::OnInitDialog( aEvent );
m_LayersListPanel->ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
SetInitialFocus( m_PresetsChoice );
m_sdbSizerOK->SetDefault();
Layout();
FinishDialogSettings();
}
bool DIALOG_LAYERS_SETUP::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
return false;
showCopperChoice( m_copperLayerCount );
setCopperLayerCheckBoxes( m_copperLayerCount );
showCopperChoice( m_pcb->GetCopperLayerCount() );
setCopperLayerCheckBoxes( m_pcb->GetCopperLayerCount() );
m_pcbThickness.SetValue( m_pcb->GetDesignSettings().GetBoardThickness() );
showBoardLayerNames();
@ -339,21 +247,18 @@ bool DIALOG_LAYERS_SETUP::TransferDataToWindow()
showLayerTypes();
setMandatoryLayerCheckBoxes();
// All widgets are now initialized. Fix the min sizes:
GetSizer()->SetSizeHints( this );
return true;
}
void DIALOG_LAYERS_SETUP::setMandatoryLayerCheckBoxes()
void PANEL_SETUP_LAYERS::setMandatoryLayerCheckBoxes()
{
for( int layer : { F_CrtYd, B_CrtYd, Edge_Cuts, Margin } )
setLayerCheckBox( layer, true );
}
void DIALOG_LAYERS_SETUP::showCopperChoice( int copperCount )
void PANEL_SETUP_LAYERS::showCopperChoice( int copperCount )
{
if( copperCount > MAX_CU_LAYERS )
copperCount = MAX_CU_LAYERS;
@ -374,7 +279,7 @@ void DIALOG_LAYERS_SETUP::showCopperChoice( int copperCount )
}
void DIALOG_LAYERS_SETUP::showBoardLayerNames()
void PANEL_SETUP_LAYERS::showBoardLayerNames()
{
// Set all the board's layer names into the dialog by calling BOARD::GetLayerName(),
// which will call BOARD::GetStandardLayerName() for non-coppers.
@ -397,7 +302,7 @@ void DIALOG_LAYERS_SETUP::showBoardLayerNames()
}
void DIALOG_LAYERS_SETUP::showSelectedLayerCheckBoxes( LSET enabledLayers )
void PANEL_SETUP_LAYERS::showSelectedLayerCheckBoxes( LSET enabledLayers )
{
// the check boxes
for( LSEQ seq = dlg_layers(); seq; ++seq )
@ -408,7 +313,7 @@ void DIALOG_LAYERS_SETUP::showSelectedLayerCheckBoxes( LSET enabledLayers )
}
void DIALOG_LAYERS_SETUP::showPresets( LSET enabledLayers )
void PANEL_SETUP_LAYERS::showPresets( LSET enabledLayers )
{
int presetsNdx = 0; // the "Custom" setting, matches nothing
@ -425,7 +330,7 @@ void DIALOG_LAYERS_SETUP::showPresets( LSET enabledLayers )
}
void DIALOG_LAYERS_SETUP::showLayerTypes()
void PANEL_SETUP_LAYERS::showLayerTypes()
{
for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
{
@ -437,7 +342,7 @@ void DIALOG_LAYERS_SETUP::showLayerTypes()
}
LSET DIALOG_LAYERS_SETUP::getUILayerMask()
LSET PANEL_SETUP_LAYERS::getUILayerMask()
{
LSET layerMaskResult;
@ -454,14 +359,17 @@ LSET DIALOG_LAYERS_SETUP::getUILayerMask()
}
void DIALOG_LAYERS_SETUP::setLayerCheckBox( LAYER_NUM aLayer, bool isChecked )
void PANEL_SETUP_LAYERS::setLayerCheckBox( LAYER_NUM aLayer, bool isChecked )
{
wxCheckBox* ctl = getCheckBox( aLayer );
ctl->SetValue( isChecked );
PANEL_SETUP_LAYERS_CTLs ctl = getCTLs( aLayer );
ctl.checkbox->SetValue( isChecked );
ctl.name->Enable( isChecked );
ctl.choice->Enable( isChecked );
}
void DIALOG_LAYERS_SETUP::setCopperLayerCheckBoxes( int copperCount )
void PANEL_SETUP_LAYERS::setCopperLayerCheckBoxes( int copperCount )
{
if( copperCount > 0 )
{
@ -483,7 +391,7 @@ void DIALOG_LAYERS_SETUP::setCopperLayerCheckBoxes( int copperCount )
#ifdef HIDE_INACTIVE_LAYERS
// This code hides non-active copper layers, or redisplays hidden
// layers which are now needed.
CTLs ctl = getCTLs( layer );
PANEL_SETUP_LAYERS_CTLs ctl = getCTLs( layer );
ctl.name->Show( state );
ctl.checkbox->Show( state );
@ -502,69 +410,76 @@ void DIALOG_LAYERS_SETUP::setCopperLayerCheckBoxes( int copperCount )
}
void DIALOG_LAYERS_SETUP::OnCheckBox( wxCommandEvent& event )
void PANEL_SETUP_LAYERS::OnCheckBox( wxCommandEvent& event )
{
for( LSEQ seq = dlg_layers(); seq; ++seq )
{
PANEL_SETUP_LAYERS_CTLs ctl = getCTLs( *seq );
ctl.name->Enable( ctl.checkbox->GetValue() );
ctl.choice->Enable( ctl.checkbox->GetValue() );
}
m_enabledLayers = getUILayerMask();
showPresets( m_enabledLayers );
}
void DIALOG_LAYERS_SETUP::DenyChangeCheckBox( wxCommandEvent& event )
void PANEL_SETUP_LAYERS::DenyChangeCheckBox( wxCommandEvent& event )
{
wxObject* source = event.GetEventObject();
if( dynamic_cast<wxCheckBox*>( source ) )
wxString msg;
for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
{
wxCheckBox* cb = dynamic_cast<wxCheckBox*>( source );
wxCheckBox* copper = getCheckBox( *seq );
for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
if( source == copper )
{
wxCheckBox* candidate = getCheckBox( *seq );
wxString controlLabel = m_staticTextCopperLayers->GetLabel();
// knock the ':' off the end
controlLabel = controlLabel.substr( 0, controlLabel.size() - 1 );
if( candidate == cb )
{
wxString ctrlLabel = m_staticTextCopperLayers->GetLabel();
DisplayError( this, wxString::Format( _( "Use the \"%s\" control to change \n"
"the number of copper layers." ),
ctrlLabel.substr( 0, ctrlLabel.size() - 1 ) ) );
cb->SetValue( true );
return;
}
msg.Printf( _( "Use the \"%s\" control to change the number of copper layers." ),
controlLabel );
DisplayError( this, msg );
copper->SetValue( true );
return;
}
}
for( int layer : { F_CrtYd, B_CrtYd, Edge_Cuts, Margin } )
for( int layer : { F_CrtYd, B_CrtYd, Edge_Cuts, Margin } )
{
wxCheckBox* mandatory = getCheckBox( layer );
if( source == mandatory )
{
wxCheckBox* candidate = getCheckBox( layer );
if( candidate == cb )
{
DisplayError( this, wxString::Format( _( "The %s layer is mandatory." ),
getLayerName( layer ) ) );
cb->SetValue( true );
return;
}
msg.Printf( _( "The %s layer is mandatory." ), getLayerName( layer ) );
DisplayError( this, msg );
mandatory->SetValue( true );
return;
}
}
}
void DIALOG_LAYERS_SETUP::OnPresetsChoice( wxCommandEvent& event )
void PANEL_SETUP_LAYERS::OnPresetsChoice( wxCommandEvent& event )
{
unsigned presetNdx = m_PresetsChoice->GetCurrentSelection();
int presetNdx = m_PresetsChoice->GetCurrentSelection();
if( presetNdx == 0 ) // the Custom setting controls nothing.
if( presetNdx <= 0 ) // the Custom setting controls nothing.
return;
if( presetNdx < DIM(presets) )
if( presetNdx < (int) DIM(presets) )
{
m_enabledLayers = presets[ presetNdx ];
LSET copperSet = m_enabledLayers & LSET::AllCuMask();
int copperCount = copperSet.count();
m_copperLayerCount = copperCount;
showCopperChoice( m_copperLayerCount );
showCopperChoice( copperCount );
showSelectedLayerCheckBoxes( m_enabledLayers );
setCopperLayerCheckBoxes( m_copperLayerCount );
setCopperLayerCheckBoxes( copperCount );
}
// Ensure mandatory layers are activated
@ -572,21 +487,20 @@ void DIALOG_LAYERS_SETUP::OnPresetsChoice( wxCommandEvent& event )
}
void DIALOG_LAYERS_SETUP::OnCopperLayersChoice( wxCommandEvent& event )
void PANEL_SETUP_LAYERS::OnCopperLayersChoice( wxCommandEvent& event )
{
m_copperLayerCount = m_CopperLayersChoice->GetCurrentSelection() * 2 + 2;
setCopperLayerCheckBoxes( m_copperLayerCount );
setCopperLayerCheckBoxes( m_CopperLayersChoice->GetCurrentSelection() * 2 + 2 );
m_enabledLayers = getUILayerMask();
showPresets( m_enabledLayers );
}
bool DIALOG_LAYERS_SETUP::TransferDataFromWindow()
bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
{
if( !wxWindow::TransferDataFromWindow() || !testLayerNames() )
if( !m_pcbThickness.Validate( true ) )
return false;
if( !m_pcbThickness.Validate( true ) )
if( !testLayerNames() )
return false;
wxString msg;
@ -685,7 +599,7 @@ bool DIALOG_LAYERS_SETUP::TransferDataFromWindow()
}
int DIALOG_LAYERS_SETUP::getLayerTypeIndex( LAYER_NUM aLayer )
int PANEL_SETUP_LAYERS::getLayerTypeIndex( LAYER_NUM aLayer )
{
wxChoice* ctl = getChoice( aLayer );
int ret = ctl->GetCurrentSelection(); // indices must have same sequence as LAYER_T
@ -693,7 +607,7 @@ int DIALOG_LAYERS_SETUP::getLayerTypeIndex( LAYER_NUM aLayer )
}
wxString DIALOG_LAYERS_SETUP::getLayerName( LAYER_NUM aLayer )
wxString PANEL_SETUP_LAYERS::getLayerName( LAYER_NUM aLayer )
{
wxControl* control = getName( aLayer );
@ -716,7 +630,7 @@ static bool hasOneOf( const wxString& str, const wxString& chars )
}
bool DIALOG_LAYERS_SETUP::testLayerNames()
bool PANEL_SETUP_LAYERS::testLayerNames()
{
std::vector<wxString> names;
wxTextCtrl* ctl;
@ -746,32 +660,29 @@ bool DIALOG_LAYERS_SETUP::testLayerNames()
if( !name )
{
DisplayError( this, _( "Layer name may not be empty." ) );
ctl->SetFocus(); // on the bad name
m_Parent->SetError( _( "Layer must have a name." ), this, ctl );
return false;
}
if( hasOneOf( name, badchars ) )
{
DisplayError( this, _( "Layer name has an illegal character, one of: '" ) +
badchars + wxT( "'" ) );
ctl->SetFocus(); // on the bad name
auto msg = wxString::Format(_( "\"%s\" are forbidden in layer names." ), badchars );
m_Parent->SetError( msg, this, ctl );
return false;
}
if( name == wxT( "signal" ) )
{
DisplayError( this, _( "Layer name 'signal' is reserved." ) );
ctl->SetFocus(); // on the bad name
m_Parent->SetError( _( "Layer name \"signal\" is reserved." ), this, ctl );
return false;
}
for( std::vector<wxString>::iterator it = names.begin(); it != names.end(); ++it )
for( const wxString& existingName : names )
{
if( name == *it )
if( name == existingName )
{
DisplayError( this, _( "Duplicate layer names are not permitted." ) );
ctl->SetFocus(); // on the bad name
auto msg = wxString::Format(_( "Layer name \"%s\" is already in use." ), name );
m_Parent->SetError( msg, this, ctl );
return false;
}
}
@ -783,7 +694,7 @@ bool DIALOG_LAYERS_SETUP::testLayerNames()
}
LSEQ DIALOG_LAYERS_SETUP::getRemovedLayersWithItems()
LSEQ PANEL_SETUP_LAYERS::getRemovedLayersWithItems()
{
LSEQ removedLayers;
LSET newLayers = getUILayerMask();
@ -812,7 +723,7 @@ LSEQ DIALOG_LAYERS_SETUP::getRemovedLayersWithItems()
}
LSEQ DIALOG_LAYERS_SETUP::getNonRemovableLayers()
LSEQ PANEL_SETUP_LAYERS::getNonRemovableLayers()
{
//Build the list of non copper layers in use in footprints.
LSEQ inUseLayers;
@ -845,9 +756,12 @@ LSEQ DIALOG_LAYERS_SETUP::getNonRemovableLayers()
}
bool InvokeLayerSetup( PCB_EDIT_FRAME* aCaller, BOARD* aBoard )
void PANEL_SETUP_LAYERS::ImportSettingsFrom( BOARD* aBoard )
{
DIALOG_LAYERS_SETUP dlg( aCaller, aBoard );
BOARD* savedBoard = m_pcb;
return dlg.ShowModal() == wxID_OK;
}
m_pcb = aBoard;
TransferDataToWindow();
m_pcb = savedBoard;
}

View File

@ -0,0 +1,113 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PANEL_SETUP_LAYERS_H
#define PANEL_SETUP_LAYERS_H
#include <widgets/unit_binder.h>
#include <widgets/paged_dialog.h>
#include <panel_setup_layers_base.h>
class PCB_EDIT_FRAME;
class BOARD;
class BOARD_DESIGN_SETTINGS;
/**
* Holds the 3 UI control pointers for a single board layer.
*/
struct PANEL_SETUP_LAYERS_CTLs
{
PANEL_SETUP_LAYERS_CTLs( wxControl* aName, wxCheckBox* aCheckBox, wxControl* aChoiceOrDesc )
{
name = aName;
checkbox = aCheckBox;
choice = aChoiceOrDesc;
}
wxControl* name;
wxCheckBox* checkbox;
wxControl* choice;
};
class PANEL_SETUP_LAYERS : public PANEL_SETUP_LAYERS_BASE
{
public:
PANEL_SETUP_LAYERS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame );
void ImportSettingsFrom( BOARD* aBoard );
private:
PAGED_DIALOG* m_Parent;
BOARD* m_pcb;
LSET m_enabledLayers;
UNIT_BINDER m_pcbThickness;
void setLayerCheckBox( LAYER_NUM layer, bool isChecked );
void setCopperLayerCheckBoxes( int copperCount );
void setMandatoryLayerCheckBoxes();
void showCopperChoice( int copperCount );
void showBoardLayerNames();
void showSelectedLayerCheckBoxes( LSET enableLayerMask );
void showLayerTypes();
void showPresets( LSET enabledLayerMask );
/** Return the selected layer mask within the UI checkboxes */
LSET getUILayerMask();
wxString getLayerName( LAYER_NUM layer );
int getLayerTypeIndex( LAYER_NUM layer );
void OnCheckBox( wxCommandEvent& event ) override;
void DenyChangeCheckBox( wxCommandEvent& event ) override;
void OnPresetsChoice( wxCommandEvent& event ) override;
void OnCopperLayersChoice( wxCommandEvent& event ) override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
bool testLayerNames();
/**
* Return a list of layers removed from the board that contain items.
*/
LSEQ getRemovedLayersWithItems();
/**
* Return a list of layers in use in footprints, and therefore not removable.
*/
LSEQ getNonRemovableLayers();
PANEL_SETUP_LAYERS_CTLs getCTLs( LAYER_NUM aLayerNumber );
wxControl* getName( LAYER_NUM aLayer );
wxCheckBox* getCheckBox( LAYER_NUM aLayer );
wxChoice* getChoice( LAYER_NUM aLayer );
};
#endif //PANEL_SETUP_LAYERS_H

View File

@ -5,61 +5,45 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_layers_setup_base.h"
#include "panel_setup_layers_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
PANEL_SETUP_LAYERS_BASE::PANEL_SETUP_LAYERS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
this->SetSizeHints( wxSize( 200,200 ), wxSize( -1,-1 ) );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bPresetsSizer;
bPresetsSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* leftSizer;
leftSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextGrouping = new wxStaticText( this, wxID_ANY, _("Preset Layer Groups:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGrouping->Wrap( -1 );
bPresetsSizer->Add( m_staticTextGrouping, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxString m_PresetsChoiceChoices[] = { _("Custom"), _("Two layers, parts on Front only"), _("Two layers, parts on Back only"), _("Two layers, parts on Front and Back"), _("Four layers, parts on Front only"), _("Four layers, parts on Front and Back"), _("All layers on") };
wxString m_PresetsChoiceChoices[] = { _("Custom layer set"), _("Two layers, parts on Front"), _("Two layers, parts on Back"), _("Two layers, parts on Front & Back"), _("Four layers, parts on Front"), _("Four layers, parts on Front & Back"), _("All layers on") };
int m_PresetsChoiceNChoices = sizeof( m_PresetsChoiceChoices ) / sizeof( wxString );
m_PresetsChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_PresetsChoiceNChoices, m_PresetsChoiceChoices, 0 );
m_PresetsChoice->SetSelection( 0 );
bPresetsSizer->Add( m_PresetsChoice, 1, wxEXPAND|wxALL, 5 );
bMainSizer->Add( bPresetsSizer, 0, wxEXPAND|wxALL, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
leftSizer->Add( m_PresetsChoice, 0, wxALL|wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizer4->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
leftSizer->Add( m_staticline1, 0, wxEXPAND|wxALL, 5 );
wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 3, 0 );
gbSizer1->SetFlexibleDirection( wxHORIZONTAL );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
bMainSizer->Add( bSizer4, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bCopperLayersSizer;
bCopperLayersSizer = new wxBoxSizer( wxHORIZONTAL );
m_staticTextCopperLayers = new wxStaticText( this, wxID_ANY, _("PCB layers:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCopperLayers = new wxStaticText( this, wxID_ANY, _("Copper layers:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCopperLayers->Wrap( -1 );
bCopperLayersSizer->Add( m_staticTextCopperLayers, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizer1->Add( m_staticTextCopperLayers, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxString m_CopperLayersChoiceChoices[] = { _("2"), _("4"), _("6"), _("8"), _("10"), _("12"), _("14"), _("16"), _("18"), _("20"), _("22"), _("24"), _("26"), _("28"), _("30"), _("32") };
int m_CopperLayersChoiceNChoices = sizeof( m_CopperLayersChoiceChoices ) / sizeof( wxString );
m_CopperLayersChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_CopperLayersChoiceNChoices, m_CopperLayersChoiceChoices, 0 );
m_CopperLayersChoice->SetSelection( 0 );
bCopperLayersSizer->Add( m_CopperLayersChoice, 0, wxEXPAND|wxALL, 5 );
bCopperLayersSizer->Add( 0, 0, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
gbSizer1->Add( m_CopperLayersChoice, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxLEFT, 10 );
m_thicknessLabel = new wxStaticText( this, wxID_ANY, _("PCB thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_thicknessLabel->Wrap( -1 );
bCopperLayersSizer->Add( m_thicknessLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizer1->Add( m_thicknessLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_thicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
#ifdef __WXGTK__
@ -70,22 +54,25 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID
#else
m_thicknessCtrl->SetMaxLength( 12 );
#endif
bCopperLayersSizer->Add( m_thicknessCtrl, 0, wxEXPAND|wxALL, 5 );
m_thicknessCtrl->SetMinSize( wxSize( 190,-1 ) );
m_thicknessUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_thicknessCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxLEFT, 10 );
m_thicknessUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_thicknessUnits->Wrap( -1 );
bCopperLayersSizer->Add( m_thicknessUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
gbSizer1->Add( m_thicknessUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
bMainSizer->Add( bCopperLayersSizer, 0, wxEXPAND|wxALL, 5 );
gbSizer1->AddGrowableCol( 1 );
leftSizer->Add( gbSizer1, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_LayersListPanel = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxRAISED_BORDER|wxTAB_TRAVERSAL|wxVSCROLL );
m_LayersListPanel->SetScrollRate( 0, 5 );
m_LayersListPanel->SetMinSize( wxSize( -1,300 ) );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxVERTICAL );
m_LayerListFlexGridSizer = new wxFlexGridSizer( 0, 3, 2, 0 );
m_LayerListFlexGridSizer->AddGrowableCol( 1 );
m_LayerListFlexGridSizer->AddGrowableCol( 2 );
m_LayerListFlexGridSizer = new wxFlexGridSizer( 0, 3, 2, 2 );
m_LayerListFlexGridSizer->SetFlexibleDirection( wxHORIZONTAL );
m_LayerListFlexGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
@ -96,10 +83,14 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID
m_CrtYdFrontName = new wxStaticText( m_LayersListPanel, ID_CRTYDFRONTNAME, _("CrtYd_Front_layer"), wxDefaultPosition, wxDefaultSize, 0 );
m_CrtYdFrontName->Wrap( -1 );
m_CrtYdFrontName->SetMinSize( wxSize( 110,-1 ) );
m_LayerListFlexGridSizer->Add( m_CrtYdFrontName, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_CrtYdFrontStaticText = new wxStaticText( m_LayersListPanel, ID_CRTYDFRONTCHOICE, _("Off-board, testing"), wxDefaultPosition, wxDefaultSize, 0 );
m_CrtYdFrontStaticText->Wrap( -1 );
m_CrtYdFrontStaticText->SetMinSize( wxSize( 150,-1 ) );
m_LayerListFlexGridSizer->Add( m_CrtYdFrontStaticText, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_FabFrontCheckBox = new wxCheckBox( m_LayersListPanel, ID_FABFRONTCHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
@ -1030,136 +1021,130 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID
m_LayerListFlexGridSizer->Add( m_DrawingsStaticText, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_LayersListPanel->SetSizer( m_LayerListFlexGridSizer );
bSizer9->Add( m_LayerListFlexGridSizer, 1, wxEXPAND|wxRIGHT, 20 );
m_LayersListPanel->SetSizer( bSizer9 );
m_LayersListPanel->Layout();
m_LayerListFlexGridSizer->Fit( m_LayersListPanel );
bMainSizer->Add( m_LayersListPanel, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
bSizer9->Fit( m_LayersListPanel );
leftSizer->Add( m_LayersListPanel, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 3 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bMainSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( leftSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 15 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_LAYERS_SETUP_BASE::OnInitDialog ) );
m_PresetsChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnPresetsChoice ), NULL, this );
m_CopperLayersChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCopperLayersChoice ), NULL, this );
m_CrtYdFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_FabFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_AdhesFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_SoldPFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_SilkSFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_MaskFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_FrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In1CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In2CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In3CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In4CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In5CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In6CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In7CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In8CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In9CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In10CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In11CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In12CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In13CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In14CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In15CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In16CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In17CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In18CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In19CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In20CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In21CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In22CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In23CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In24CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In25CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In26CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In27CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In28CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In29CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In30CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_BackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_MaskBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_SilkSBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_SoldPBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_AdhesBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_FabBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_CrtYdBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_PCBEdgesCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_MarginCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_Eco1CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_Eco2CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_CommentsCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_DrawingsCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_PresetsChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnPresetsChoice ), NULL, this );
m_CopperLayersChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCopperLayersChoice ), NULL, this );
m_CrtYdFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_FabFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_AdhesFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_SoldPFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_SilkSFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_MaskFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_FrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In1CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In2CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In3CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In4CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In5CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In6CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In7CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In8CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In9CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In10CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In11CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In12CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In13CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In14CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In15CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In16CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In17CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In18CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In19CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In20CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In21CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In22CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In23CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In24CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In25CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In26CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In27CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In28CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In29CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In30CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_BackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_MaskBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_SilkSBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_SoldPBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_AdhesBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_FabBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_CrtYdBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_PCBEdgesCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_MarginCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_Eco1CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_Eco2CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_CommentsCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_DrawingsCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
}
DIALOG_LAYERS_SETUP_BASE::~DIALOG_LAYERS_SETUP_BASE()
PANEL_SETUP_LAYERS_BASE::~PANEL_SETUP_LAYERS_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_LAYERS_SETUP_BASE::OnInitDialog ) );
m_PresetsChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnPresetsChoice ), NULL, this );
m_CopperLayersChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCopperLayersChoice ), NULL, this );
m_CrtYdFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_FabFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_AdhesFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_SoldPFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_SilkSFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_MaskFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_FrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In1CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In2CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In3CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In4CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In5CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In6CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In7CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In8CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In9CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In10CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In11CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In12CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In13CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In14CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In15CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In16CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In17CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In18CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In19CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In20CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In21CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In22CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In23CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In24CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In25CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In26CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In27CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In28CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In29CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_In30CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_BackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_MaskBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_SilkSBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_SoldPBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_AdhesBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_FabBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_CrtYdBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_PCBEdgesCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_MarginCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this );
m_Eco1CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_Eco2CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_CommentsCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_DrawingsCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this );
m_PresetsChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnPresetsChoice ), NULL, this );
m_CopperLayersChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCopperLayersChoice ), NULL, this );
m_CrtYdFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_FabFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_AdhesFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_SoldPFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_SilkSFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_MaskFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_FrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In1CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In2CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In3CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In4CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In5CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In6CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In7CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In8CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In9CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In10CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In11CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In12CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In13CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In14CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In15CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In16CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In17CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In18CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In19CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In20CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In21CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In22CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In23CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In24CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In25CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In26CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In27CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In28CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In29CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_In30CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_BackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_MaskBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_SilkSBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_SoldPBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_AdhesBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_FabBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_CrtYdBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_PCBEdgesCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_MarginCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::DenyChangeCheckBox ), NULL, this );
m_Eco1CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_Eco2CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_CommentsCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
m_DrawingsCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SETUP_LAYERS_BASE::OnCheckBox ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -5,27 +5,26 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_LAYERS_SETUP_BASE_H__
#define __DIALOG_LAYERS_SETUP_BASE_H__
#ifndef __PANEL_SETUP_LAYERS_BASE_H__
#define __PANEL_SETUP_LAYERS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/choice.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/gbsizer.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/scrolwin.h>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
@ -179,14 +178,13 @@
#define ID_DRAWINGSCHOICE 1147
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LAYERS_SETUP_BASE
/// Class PANEL_SETUP_LAYERS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_LAYERS_SETUP_BASE : public DIALOG_SHIM
class PANEL_SETUP_LAYERS_BASE : public wxPanel
{
private:
protected:
wxStaticText* m_staticTextGrouping;
wxChoice* m_PresetsChoice;
wxStaticLine* m_staticline1;
wxStaticText* m_staticTextCopperLayers;
@ -346,12 +344,8 @@ class DIALOG_LAYERS_SETUP_BASE : public DIALOG_SHIM
wxCheckBox* m_DrawingsCheckBox;
wxStaticText* m_DrawingsName;
wxStaticText* m_DrawingsStaticText;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnPresetsChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCopperLayersChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void DenyChangeCheckBox( wxCommandEvent& event ) { event.Skip(); }
@ -360,9 +354,9 @@ class DIALOG_LAYERS_SETUP_BASE : public DIALOG_SHIM
public:
DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Layer Setup"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LAYERS_SETUP_BASE();
PANEL_SETUP_LAYERS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 714,394 ), long style = wxTAB_TRAVERSAL );
~PANEL_SETUP_LAYERS_BASE();
};
#endif //__DIALOG_LAYERS_SETUP_BASE_H__
#endif //__PANEL_SETUP_LAYERS_BASE_H__

View File

@ -0,0 +1,104 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <class_drawpanel.h>
#include <pcbnew.h>
#include <pcb_edit_frame.h>
#include <board_design_settings.h>
#include <dialog_text_entry.h>
#include <panel_setup_mask_and_paste.h>
PANEL_SETUP_MASK_AND_PASTE::PANEL_SETUP_MASK_AND_PASTE( PAGED_DIALOG* aParent,
PCB_EDIT_FRAME* aFrame ) :
PANEL_SETUP_MASK_AND_PASTE_BASE( aParent ),
m_maskMargin( aFrame, m_MaskMarginLabel, m_MaskMarginCtrl, m_MaskMarginUnits, true ),
m_maskMinWidth( aFrame, m_MaskMinWidthLabel, m_MaskMinWidthCtrl, m_MaskMinWidthUnits, true ),
m_pasteMargin( aFrame, m_PasteMarginLabel, m_PasteMarginCtrl, m_PasteMarginUnits, true )
{
m_Frame = aFrame;
m_BrdSettings = &m_Frame->GetBoard()->GetDesignSettings();
}
bool PANEL_SETUP_MASK_AND_PASTE::TransferDataToWindow()
{
m_maskMargin.SetValue( m_BrdSettings->m_SolderMaskMargin );
m_maskMinWidth.SetValue( m_BrdSettings->m_SolderMaskMinWidth );
m_pasteMargin.SetValue( m_BrdSettings->m_SolderPasteMargin );
// Prefer "-0" to "0" for normally negative values
if( m_BrdSettings->m_SolderPasteMargin == 0 )
m_PasteMarginCtrl->SetValue( wxT( "-" ) + m_PasteMarginCtrl->GetValue() );
// Add solder paste margin ratio in per cent
// for the usual default value 0.0, display -0.0 (or -0,0 in some countries)
wxString msg;
msg.Printf( wxT( "%f" ), m_BrdSettings->m_SolderPasteMarginRatio * 100.0 );
// Sometimes Printf adds a sign if the value is small
if( m_BrdSettings->m_SolderPasteMarginRatio == 0.0 && msg[0] == '0' )
m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
else
m_SolderPasteMarginRatioCtrl->SetValue( msg );
return true;
}
bool PANEL_SETUP_MASK_AND_PASTE::TransferDataFromWindow()
{
m_BrdSettings->m_SolderMaskMargin = m_maskMargin.GetValue();
m_BrdSettings->m_SolderMaskMinWidth = m_maskMinWidth.GetValue();
m_BrdSettings->m_SolderPasteMargin = m_pasteMargin.GetValue();
double dtmp = 0.0;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp );
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
if( dtmp < -50 )
dtmp = -50;
if( dtmp > +100 )
dtmp = +100;
m_BrdSettings->m_SolderPasteMarginRatio = dtmp / 100;
return true;
}
void PANEL_SETUP_MASK_AND_PASTE::ImportSettingsFrom( BOARD* aBoard )
{
BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
m_BrdSettings = &aBoard->GetDesignSettings();
TransferDataToWindow();
m_BrdSettings = savedSettings;
}

View File

@ -0,0 +1,60 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PANEL_SETUP_DEFAULT_CLEARANCES_H
#define PANEL_SETUP_DEFAULT_CLEARANCES_H
#include <class_board.h>
#include <widgets/unit_binder.h>
#include <widgets/paged_dialog.h>
#include <dialogs/panel_setup_mask_and_paste_base.h>
class PCB_EDIT_FRAME;
class BOARD;
class BOARD_DESIGN_SETTINGS;
class PANEL_SETUP_MASK_AND_PASTE : public PANEL_SETUP_MASK_AND_PASTE_BASE
{
private:
PCB_EDIT_FRAME* m_Frame;
BOARD_DESIGN_SETTINGS* m_BrdSettings;
UNIT_BINDER m_maskMargin;
UNIT_BINDER m_maskMinWidth;
UNIT_BINDER m_pasteMargin;
public:
PANEL_SETUP_MASK_AND_PASTE( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame );
~PANEL_SETUP_MASK_AND_PASTE( ) { };
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void ImportSettingsFrom( BOARD* aBoard );
};
#endif //PANEL_SETUP_DEFAULT_CLEARANCES_H

View File

@ -0,0 +1,128 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "panel_setup_mask_and_paste_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_SETUP_MASK_AND_PASTE_BASE::PANEL_SETUP_MASK_AND_PASTE_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bMessages;
bMessages = new wxBoxSizer( wxVERTICAL );
m_staticTextInfoValPos = new wxStaticText( this, wxID_ANY, _("Positive clearance means area bigger than the pad (usual for mask clearance)."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfoValPos->Wrap( 500 );
m_staticTextInfoValPos->SetFont( wxFont( 11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bMessages->Add( m_staticTextInfoValPos, 0, wxBOTTOM, 5 );
m_staticTextInfoValNeg = new wxStaticText( this, wxID_ANY, _("Negative clearance means area smaller than the pad (usual for paste clearance)."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfoValNeg->Wrap( 500 );
m_staticTextInfoValNeg->SetFont( wxFont( 11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bMessages->Add( m_staticTextInfoValNeg, 0, wxBOTTOM, 12 );
bSizer3->Add( bMessages, 0, wxEXPAND|wxALL, 5 );
wxFlexGridSizer* fgGridSolderMaskSizer;
fgGridSolderMaskSizer = new wxFlexGridSizer( 0, 3, 0, 0 );
fgGridSolderMaskSizer->AddGrowableCol( 1 );
fgGridSolderMaskSizer->SetFlexibleDirection( wxBOTH );
fgGridSolderMaskSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_MaskMarginLabel = new wxStaticText( this, wxID_ANY, _("Solder mask clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MaskMarginLabel->Wrap( -1 );
m_MaskMarginLabel->SetToolTip( _("This is the global clearance between pads and the solder mask\nThis value can be superseded by local values for a footprint or a pad.") );
fgGridSolderMaskSizer->Add( m_MaskMarginLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_MaskMarginCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgGridSolderMaskSizer->Add( m_MaskMarginCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_MaskMarginUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_MaskMarginUnits->Wrap( -1 );
fgGridSolderMaskSizer->Add( m_MaskMarginUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_MaskMinWidthLabel = new wxStaticText( this, wxID_ANY, _("Solder mask minimum width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MaskMinWidthLabel->Wrap( -1 );
m_MaskMinWidthLabel->SetToolTip( _("Min dist between 2 pad areas.\nTwo pad areas nearer than this value will be merged during plotting.\nThis parameter is used only to plot solder mask layers.") );
fgGridSolderMaskSizer->Add( m_MaskMinWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_MaskMinWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgGridSolderMaskSizer->Add( m_MaskMinWidthCtrl, 0, wxEXPAND|wxALL, 5 );
m_MaskMinWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_MaskMinWidthUnits->Wrap( -1 );
fgGridSolderMaskSizer->Add( m_MaskMinWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
fgGridSolderMaskSizer->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 10 );
fgGridSolderMaskSizer->Add( 0, 0, 1, wxEXPAND, 5 );
fgGridSolderMaskSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_PasteMarginLabel = new wxStaticText( this, wxID_ANY, _("Solder paste clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_PasteMarginLabel->Wrap( -1 );
m_PasteMarginLabel->SetToolTip( _("This is the global clearance between pads and the solder paste\nThis value can be superseded by local values for a footprint or a pad.\nThe final clearance value is the sum of this value and the clearance value ratio") );
fgGridSolderMaskSizer->Add( m_PasteMarginLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_PasteMarginCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgGridSolderMaskSizer->Add( m_PasteMarginCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_PasteMarginUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_PasteMarginUnits->Wrap( -1 );
fgGridSolderMaskSizer->Add( m_PasteMarginUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_staticTextRatio = new wxStaticText( this, wxID_ANY, _("Solder paste ratio clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRatio->Wrap( -1 );
m_staticTextRatio->SetToolTip( _("This is the global clearance ratio in per cent between pads and the solder paste\nA value of 10 means the clearance value is 10 per cent of the pad size\nThis value can be superseded by local values for a footprint or a pad.\nThe final clearance value is the sum of this value and the clearance value") );
fgGridSolderMaskSizer->Add( m_staticTextRatio, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_SolderPasteMarginRatioCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgGridSolderMaskSizer->Add( m_SolderPasteMarginRatioCtrl, 0, wxEXPAND|wxALL, 5 );
m_SolderPasteRatioMarginUnits = new wxStaticText( this, wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteRatioMarginUnits->Wrap( -1 );
fgGridSolderMaskSizer->Add( m_SolderPasteRatioMarginUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
bSizer3->Add( fgGridSolderMaskSizer, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
bSizer3->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 );
m_staticTextInfo2 = new wxStaticText( this, wxID_ANY, _("Note: solder mask and paste values are used only for pads on copper layers."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfo2->Wrap( -1 );
m_staticTextInfo2->SetFont( wxFont( 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizer3->Add( m_staticTextInfo2, 0, wxALL, 5 );
bMainSizer->Add( bSizer3, 1, wxTOP|wxLEFT, 15 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
}
PANEL_SETUP_MASK_AND_PASTE_BASE::~PANEL_SETUP_MASK_AND_PASTE_BASE()
{
}

View File

@ -0,0 +1,57 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __PANEL_SETUP_MASK_AND_PASTE_BASE_H__
#define __PANEL_SETUP_MASK_AND_PASTE_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_SETUP_MASK_AND_PASTE_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_SETUP_MASK_AND_PASTE_BASE : public wxPanel
{
private:
protected:
wxStaticText* m_staticTextInfoValPos;
wxStaticText* m_staticTextInfoValNeg;
wxStaticText* m_MaskMarginLabel;
wxTextCtrl* m_MaskMarginCtrl;
wxStaticText* m_MaskMarginUnits;
wxStaticText* m_MaskMinWidthLabel;
wxTextCtrl* m_MaskMinWidthCtrl;
wxStaticText* m_MaskMinWidthUnits;
wxStaticText* m_PasteMarginLabel;
wxTextCtrl* m_PasteMarginCtrl;
wxStaticText* m_PasteMarginUnits;
wxStaticText* m_staticTextRatio;
wxTextCtrl* m_SolderPasteMarginRatioCtrl;
wxStaticText* m_SolderPasteRatioMarginUnits;
wxStaticText* m_staticTextInfo2;
public:
PANEL_SETUP_MASK_AND_PASTE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
~PANEL_SETUP_MASK_AND_PASTE_BASE();
};
#endif //__PANEL_SETUP_MASK_AND_PASTE_BASE_H__

View File

@ -0,0 +1,721 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2009-2018 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <class_drawpanel.h>
#include <base_units.h>
#include <confirm.h>
#include <pcb_edit_frame.h>
#include <board_design_settings.h>
#include <bitmaps.h>
#include <widgets/wx_grid.h>
#include <panel_setup_netclasses.h>
// Columns of netclasses grid
enum {
GRID_NAME = 0,
GRID_CLEARANCE,
GRID_TRACKSIZE,
GRID_VIASIZE,
GRID_VIADRILL,
GRID_uVIASIZE,
GRID_uVIADRILL,
GRID_DIFF_PAIR_WIDTH,
GRID_DIFF_PAIR_GAP,
GRID_DIFF_PAIR_VIA_GAP
};
PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame,
PANEL_SETUP_FEATURE_CONSTRAINTS* aConstraintsPanel ) :
PANEL_SETUP_NETCLASSES_BASE( aParent )
{
m_Parent = aParent;
m_Frame = aFrame;
m_Pcb = m_Frame->GetBoard();
m_BrdSettings = &m_Pcb->GetDesignSettings();
m_ConstraintsPanel = aConstraintsPanel;
m_netclassesDirty = true;
m_originalColWidths = new int[ m_netclassGrid->GetNumberCols() ];
for( int i = 0; i < m_netclassGrid->GetNumberCols(); ++i )
m_originalColWidths[ i ] = m_netclassGrid->GetColSize( i );
// Membership combobox editors require a bit more room, so increase the row size of
// all our grids for consistency
m_netclassGrid->SetDefaultRowSize( m_netclassGrid->GetDefaultRowSize() + 4 );
m_membershipGrid->SetDefaultRowSize( m_membershipGrid->GetDefaultRowSize() + 4 );
m_trackWidthsGrid->SetDefaultRowSize( m_trackWidthsGrid->GetDefaultRowSize() + 4 );
m_viaSizesGrid->SetDefaultRowSize( m_viaSizesGrid->GetDefaultRowSize() + 4 );
m_diffPairsGrid->SetDefaultRowSize( m_diffPairsGrid->GetDefaultRowSize() + 4 );
m_textNetFilter->SetHint( _( "Net filter" ) );
// Set up the net name column of the netclass membership grid to read-only
wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetReadOnly( true );
m_membershipGrid->SetColAttr( 0, attr );
m_addButton->SetBitmap( KiBitmap( small_plus_xpm ) );
m_removeButton->SetBitmap( KiBitmap( trash_xpm ) );
// wxFormBuilder doesn't include this event...
m_netclassGrid->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging ), NULL, this );
}
PANEL_SETUP_NETCLASSES::~PANEL_SETUP_NETCLASSES()
{
delete [] m_originalColWidths;
m_netclassGrid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging ), NULL, this );
}
static void netclassToGridRow( EDA_UNITS_T aUnits, wxGrid* aGrid, int aRow, const NETCLASSPTR& nc )
{
aGrid->SetCellValue( aRow, GRID_NAME, nc->GetName() );
#define SET_MILS_CELL( col, val ) \
aGrid->SetCellValue( aRow, col, StringFromValue( aUnits, val, true, true ) )
SET_MILS_CELL( GRID_CLEARANCE, nc->GetClearance() );
SET_MILS_CELL( GRID_TRACKSIZE, nc->GetTrackWidth() );
SET_MILS_CELL( GRID_VIASIZE, nc->GetViaDiameter() );
SET_MILS_CELL( GRID_VIADRILL, nc->GetViaDrill() );
SET_MILS_CELL( GRID_uVIASIZE, nc->GetuViaDiameter() );
SET_MILS_CELL( GRID_uVIADRILL, nc->GetuViaDrill() );
SET_MILS_CELL( GRID_DIFF_PAIR_WIDTH, nc->GetDiffPairWidth() );
SET_MILS_CELL( GRID_DIFF_PAIR_GAP, nc->GetDiffPairGap() );
// 6.0 TODO: SET_MILS_CELL( GRID_DIFF_PAIR_VIA_GAP, nc->GetDiffPairViaGap() );
}
bool PANEL_SETUP_NETCLASSES::TransferDataToWindow()
{
NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
NETCLASSPTR netclass = netclasses.GetDefault();
if( m_netclassGrid->GetNumberRows() )
m_netclassGrid->DeleteRows( 0, m_netclassGrid->GetNumberRows() );
m_netclassGrid->AppendRows( netclasses.GetCount() + 1 ); // + 1 for default netclass
// enter the Default NETCLASS.
netclassToGridRow( m_Frame->GetUserUnits(), m_netclassGrid, 0, netclass );
// make the Default NETCLASS name read-only
wxGridCellAttr* cellAttr = m_netclassGrid->GetOrCreateCellAttr( 0, GRID_NAME );
cellAttr->SetReadOnly();
cellAttr->DecRef();
// enter other netclasses
int row = 1;
for( NETCLASSES::iterator i = netclasses.begin(); i != netclasses.end(); ++i, ++row )
netclassToGridRow( m_Frame->GetUserUnits(), m_netclassGrid, row, i->second );
// Reassure that all nets have net classes assigned
m_Pcb->BuildListOfNets();
if( m_membershipGrid->GetNumberRows() )
m_membershipGrid->DeleteRows( 0, m_membershipGrid->GetNumberRows() );
// Initialize list of nets for Default Net Class
for( NETCLASS::iterator name = netclass->begin(); name != netclass->end(); ++name )
{
if( name->IsEmpty() )
// @TODO go fix m_Pcb->SynchronizeNetsAndNetClasses() so that the netcode==0
// is not present in the BOARD::m_NetClasses
continue;
else
addNet( *name, netclass->GetName() );
}
// Initialize list of nets for others (custom) Net Classes
for( NETCLASSES::const_iterator nc = netclasses.begin(); nc != netclasses.end(); ++nc )
{
netclass = nc->second;
for( NETCLASS::const_iterator name = netclass->begin(); name != netclass->end(); ++name )
addNet( *name, netclass->GetName() );
}
TransferDimensionListsToWindow();
return true;
}
void PANEL_SETUP_NETCLASSES::addNet( wxString netName, const wxString& netclass )
{
int i = m_membershipGrid->GetNumberRows();
m_membershipGrid->AppendRows( 1 );
m_membershipGrid->SetCellValue( i, 0, netName );
m_membershipGrid->SetCellValue( i, 1, netclass );
}
void PANEL_SETUP_NETCLASSES::TransferDimensionListsToWindow()
{
#define SETCELL( grid, row, col, val ) \
grid->SetCellValue( row, col, StringFromValue( m_Frame->GetUserUnits(), val, true, true ) )
m_trackWidthsGrid->ClearGrid();
m_viaSizesGrid->ClearGrid();
m_diffPairsGrid->ClearGrid();
// Skip the first item, which is the current netclass value
for( unsigned ii = 1; ii < m_BrdSettings->m_TrackWidthList.size(); ii++ )
{
SETCELL( m_trackWidthsGrid, ii-1, 0, m_BrdSettings->m_TrackWidthList[ii] );
}
// Skip the first item, which is the current netclass value
for( unsigned ii = 1; ii < m_BrdSettings->m_ViasDimensionsList.size(); ii++ )
{
SETCELL( m_viaSizesGrid, ii-1, 0, m_BrdSettings->m_ViasDimensionsList[ii].m_Diameter );
if( m_BrdSettings->m_ViasDimensionsList[ii].m_Drill > 0 )
SETCELL( m_viaSizesGrid, ii-1, 1, m_BrdSettings->m_ViasDimensionsList[ii].m_Drill );
}
// Skip the first item, which is the current netclass value
for( unsigned ii = 1; ii < m_BrdSettings->m_DiffPairDimensionsList.size(); ii++ )
{
SETCELL( m_diffPairsGrid, ii-1, 0, m_BrdSettings->m_DiffPairDimensionsList[ii].m_Width );
if( m_BrdSettings->m_DiffPairDimensionsList[ii].m_Gap > 0 )
SETCELL( m_diffPairsGrid, ii-1, 1, m_BrdSettings->m_DiffPairDimensionsList[ii].m_Gap );
if( m_BrdSettings->m_DiffPairDimensionsList[ii].m_ViaGap > 0 )
SETCELL( m_diffPairsGrid, ii-1, 2, m_BrdSettings->m_DiffPairDimensionsList[ii].m_ViaGap );
}
}
/* Populates drop-downs with the list of net classes
*/
void PANEL_SETUP_NETCLASSES::rebuildNetclassDropdowns()
{
wxArrayString netclassNames;
for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ )
{
wxString netclassName = m_netclassGrid->GetCellValue( ii, GRID_NAME );
if( !netclassName.IsEmpty() )
netclassNames.push_back( netclassName );
}
wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetEditor( new wxGridCellChoiceEditor( netclassNames ) );
m_membershipGrid->SetColAttr( 1, attr );
}
static void gridRowToNetclass( EDA_UNITS_T aUnits, wxGrid* grid, int row, const NETCLASSPTR& nc )
{
nc->SetName( grid->GetCellValue( row, GRID_NAME ) );
#define MYCELL( col ) \
ValueFromString( aUnits, grid->GetCellValue( row, col ), true )
nc->SetClearance( MYCELL( GRID_CLEARANCE ) );
nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) );
nc->SetViaDiameter( MYCELL( GRID_VIASIZE ) );
nc->SetViaDrill( MYCELL( GRID_VIADRILL ) );
nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) );
nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) );
nc->SetDiffPairWidth( MYCELL( GRID_DIFF_PAIR_WIDTH ) );
nc->SetDiffPairGap( MYCELL( GRID_DIFF_PAIR_GAP ) );
// 6.0 TODO: nc->SetDiffPairViaGap( MYCELL( GRID_DIFF_PAIR_VIA_GAP ) );
}
void PANEL_SETUP_NETCLASSES::CopyNetclassesToBoard()
{
NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
// Remove all netclasses from board. We'll copy new list after
netclasses.Clear();
// Copy the default NetClass:
gridRowToNetclass( m_Frame->GetUserUnits(), m_netclassGrid, 0, netclasses.GetDefault());
// Copy other NetClasses :
for( int row = 1; row < m_netclassGrid->GetNumberRows(); ++row )
{
NETCLASSPTR nc = std::make_shared<NETCLASS>( m_netclassGrid->GetCellValue( row, GRID_NAME ) );
if( m_BrdSettings->m_NetClasses.Add( nc ) )
gridRowToNetclass( m_Frame->GetUserUnits(), m_netclassGrid, row, nc );
}
// Now read all nets and push them in the corresponding netclass net buffer
for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
{
NETCLASSPTR nc = netclasses.Find( m_membershipGrid->GetCellValue( row, 1 ) );
if( nc )
nc->Add( m_membershipGrid->GetCellValue( row, 0 ) );
}
m_Pcb->SynchronizeNetsAndNetClasses();
}
void PANEL_SETUP_NETCLASSES::CopyDimensionsListsToBoard()
{
wxString msg;
std::vector<int> trackWidths;
std::vector<VIA_DIMENSION> vias;
std::vector<DIFF_PAIR_DIMENSION> diffPairs;
for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row )
{
msg = m_trackWidthsGrid->GetCellValue( row, 0 );
if( !msg.IsEmpty() )
trackWidths.push_back( ValueFromString( m_Frame->GetUserUnits(), msg, true ) );
}
for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
{
msg = m_viaSizesGrid->GetCellValue( row, 0 );
if( !msg.IsEmpty() )
{
VIA_DIMENSION via_dim;
via_dim.m_Diameter = ValueFromString( m_Frame->GetUserUnits(), msg, true );
msg = m_viaSizesGrid->GetCellValue( row, 1 );
if( !msg.IsEmpty() )
via_dim.m_Drill = ValueFromString( m_Frame->GetUserUnits(), msg, true );
vias.push_back( via_dim );
}
}
for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
{
msg = m_diffPairsGrid->GetCellValue( row, 0 );
if( !msg.IsEmpty() )
{
DIFF_PAIR_DIMENSION diffPair_dim;
diffPair_dim.m_Width = ValueFromString( m_Frame->GetUserUnits(), msg, true );
msg = m_diffPairsGrid->GetCellValue( row, 1 );
diffPair_dim.m_Gap = ValueFromString( m_Frame->GetUserUnits(), msg, true );
msg = m_diffPairsGrid->GetCellValue( row, 2 );
if( !msg.IsEmpty() )
diffPair_dim.m_ViaGap = ValueFromString( m_Frame->GetUserUnits(), msg, true );
diffPairs.push_back( diffPair_dim );
}
}
// Sort lists by increasing value
sort( trackWidths.begin(), trackWidths.end() );
sort( vias.begin(), vias.end() );
sort( diffPairs.begin(), diffPairs.end() );
trackWidths.insert( trackWidths.begin(), m_BrdSettings->m_TrackWidthList[ 0 ] );
m_BrdSettings->m_TrackWidthList = trackWidths;
vias.insert( vias.begin(), m_BrdSettings->m_ViasDimensionsList[ 0 ] );
m_BrdSettings->m_ViasDimensionsList = vias;
diffPairs.insert( diffPairs.begin(), m_BrdSettings->m_DiffPairDimensionsList[ 0 ] );
m_BrdSettings->m_DiffPairDimensionsList = diffPairs;
}
bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow()
{
if( !validateData() )
return false;
CopyNetclassesToBoard();
CopyDimensionsListsToBoard();
m_BrdSettings->SetCurrentNetClass( NETCLASS::Default );
return true;
}
bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, wxString aName, bool focusFirst )
{
aName.Trim( true );
aName.Trim( false );
if( aName.IsEmpty() )
{
wxString msg = _( "Netclass must have a name." );
m_Parent->SetError( msg, this, m_netclassGrid, aRow, GRID_NAME );
return false;
}
for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ )
{
if( ii != aRow && m_netclassGrid->GetRowLabelValue( ii ).CmpNoCase( aName ) == 0 )
{
wxString msg = _( "Netclass name already in use." );
m_Parent->SetError( msg, this, m_netclassGrid, focusFirst ? aRow : ii, GRID_NAME );
return false;
}
}
return true;
}
void PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging( wxGridEvent& event )
{
if( event.GetCol() == GRID_NAME )
{
if( validateNetclassName( event.GetRow(), event.GetString() ) )
m_netclassesDirty = true;
else
event.Veto();
}
}
void PANEL_SETUP_NETCLASSES::OnAddNetclassClick( wxCommandEvent& event )
{
int row = m_netclassGrid->GetNumberRows();
m_netclassGrid->AppendRows();
// Copy values of the default class:
for( int col = 1; col < m_netclassGrid->GetNumberCols(); col++ )
m_netclassGrid->SetCellValue( row, col, m_netclassGrid->GetCellValue( 0, col ) );
m_netclassGrid->MakeCellVisible( row, 0 );
m_netclassGrid->SetGridCursor( row, 0 );
m_netclassGrid->EnableCellEditControl( true );
m_netclassGrid->ShowCellEditControl();
m_netclassesDirty = true;
}
void PANEL_SETUP_NETCLASSES::OnRemoveNetclassClick( wxCommandEvent& event )
{
m_netclassGrid->DisableCellEditControl();
int curRow = m_netclassGrid->GetGridCursorRow();
if( !m_netclassGrid->HasFocus() || curRow < 0 )
{
m_netclassGrid->SetFocus();
return;
}
else if( curRow == 0 )
{
DisplayErrorMessage( this, _( "The default net class is required." ) );
return;
}
// reset the net class to default for members of the removed class
wxString classname = m_netclassGrid->GetCellValue( curRow, GRID_NAME );
for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
{
if( m_membershipGrid->GetCellValue( row, 1 ) == classname )
m_membershipGrid->SetCellValue( row, 1, NETCLASS::Default );
}
m_netclassGrid->DeleteRows( curRow, 1 );
curRow = std::max( 0, curRow - 1 );
m_netclassGrid->MakeCellVisible( curRow, m_netclassGrid->GetGridCursorCol() );
m_netclassGrid->SetGridCursor( curRow, m_netclassGrid->GetGridCursorCol() );
m_netclassesDirty = true;
}
void PANEL_SETUP_NETCLASSES::AdjustNetclassGridColumns( int aWidth )
{
// Account for scroll bars
aWidth -= ( m_netclassGrid->GetSize().x - m_netclassGrid->GetClientSize().x );
for( int i = 1; i < m_netclassGrid->GetNumberCols(); i++ )
{
m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
aWidth -= m_originalColWidths[ i ];
}
m_netclassGrid->SetColSize( 0, std::max( aWidth, m_originalColWidths[ 0 ] ) );
}
void PANEL_SETUP_NETCLASSES::OnSizeNetclassGrid( wxSizeEvent& event )
{
AdjustNetclassGridColumns( event.GetSize().GetX() );
event.Skip();
}
void PANEL_SETUP_NETCLASSES::AdjustMembershipGridColumns( int aWidth )
{
// Account for scroll bars
aWidth -= ( m_membershipGrid->GetSize().x - m_membershipGrid->GetClientSize().x );
// Set className column width to original className width from netclasses grid
int classNameWidth = m_originalColWidths[ 0 ];
m_membershipGrid->SetColSize( 1, m_originalColWidths[ 0 ] );
m_membershipGrid->SetColSize( 0, std::max( aWidth - classNameWidth, classNameWidth ) );
}
void PANEL_SETUP_NETCLASSES::OnSizeMembershipGrid( wxSizeEvent& event )
{
AdjustMembershipGridColumns( event.GetSize().GetX() );
event.Skip();
}
void PANEL_SETUP_NETCLASSES::OnFilterChanged( wxCommandEvent& event )
{
wxString filter = m_textNetFilter->GetValue().MakeLower();
if( filter.IsEmpty() )
filter = wxT( "*" );
else
filter = wxT( "*" ) + filter + wxT( "*" );
for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
{
if( m_membershipGrid->GetCellValue( row, 0 ).MakeLower().Matches( filter )
|| m_membershipGrid->GetCellValue( row, 1 ).MakeLower().Matches( filter ) )
m_membershipGrid->ShowRow( row );
else
m_membershipGrid->HideRow( row );
}
}
void PANEL_SETUP_NETCLASSES::OnUpdateUI( wxUpdateUIEvent& event )
{
if( m_netclassesDirty )
{
rebuildNetclassDropdowns();
m_netclassesDirty = false;
}
}
int PANEL_SETUP_NETCLASSES::getNetclassValue( int aRow, int aCol )
{
return ValueFromString( m_Frame->GetUserUnits(), m_netclassGrid->GetCellValue( aRow, aCol ), true );
}
bool PANEL_SETUP_NETCLASSES::validateData()
{
// Commit any pending in-place edits and close editors from grid controls
m_netclassGrid->DisableCellEditControl();
m_membershipGrid->DisableCellEditControl();
m_trackWidthsGrid->DisableCellEditControl();
m_viaSizesGrid->DisableCellEditControl();
m_diffPairsGrid->DisableCellEditControl();
wxString msg;
int minViaDia = m_ConstraintsPanel->m_viaMinSize.GetValue();
int minViaDrill = m_ConstraintsPanel->m_viaMinDrill.GetValue();
int minUViaDia = m_ConstraintsPanel->m_uviaMinSize.GetValue();
int minUViaDrill = m_ConstraintsPanel->m_uviaMinDrill.GetValue();
int minTrackWidth = m_ConstraintsPanel->m_trackMinWidth.GetValue();
// Test net class parameters.
for( int row = 0; row < m_netclassGrid->GetNumberRows(); row++ )
{
wxString netclassName = m_netclassGrid->GetCellValue( row, GRID_NAME );
netclassName.Trim( true );
netclassName.Trim( false );
if( !validateNetclassName( row, netclassName, false ) )
return false;
if( getNetclassValue( row, GRID_TRACKSIZE ) < minTrackWidth )
{
msg.Printf( _( "Track width less than minimum track width (%s)." ),
StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) );
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_TRACKSIZE );
return false;
}
if( getNetclassValue( row, GRID_DIFF_PAIR_WIDTH ) < minTrackWidth )
{
msg.Printf( _( "Differential pair width less than minimum track width (%s)." ),
StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) );
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_DIFF_PAIR_WIDTH );
return false;
}
// Test vias
if( getNetclassValue( row, GRID_VIASIZE ) < minViaDia )
{
msg.Printf( _( "Via diameter less than minimum via diameter (%s)." ),
StringFromValue( m_Frame->GetUserUnits(), minViaDia, true, true ) );
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIASIZE );
return false;
}
if( getNetclassValue( row, GRID_VIADRILL ) >= getNetclassValue( row, GRID_VIASIZE ) )
{
msg = _( "Via drill larger than via diameter." );
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIADRILL );
return false;
}
if( getNetclassValue( row, GRID_VIADRILL ) < minViaDrill )
{
msg.Printf( _( "Via drill less than minimum via drill (%s)." ),
StringFromValue( m_Frame->GetUserUnits(), minViaDrill, true, true ) );
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIADRILL );
return false;
}
// Test Micro vias
if( getNetclassValue( row, GRID_uVIASIZE ) < minUViaDia )
{
msg.Printf( _( "Microvia diameter less than minimum microvia diameter (%s)." ),
StringFromValue( m_Frame->GetUserUnits(), minUViaDia, true, true ) );
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIASIZE );
return false;
}
if( getNetclassValue( row, GRID_uVIADRILL ) >= getNetclassValue( row, GRID_uVIASIZE ) )
{
msg = _( "Microvia drill larger than microvia diameter." );
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIADRILL );
return false;
}
if( getNetclassValue( row, GRID_uVIADRILL ) < minUViaDrill )
{
msg.Printf( _( "Microvia drill less than minimum microvia drill (%s)." ),
StringFromValue( m_Frame->GetUserUnits(), minUViaDrill, true, true ) );
m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIADRILL );
return false;
}
}
// Test custom tracks
for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row )
{
wxString tvalue = m_trackWidthsGrid->GetCellValue( row, 0 );
if( tvalue.IsEmpty() )
continue;
if( ValueFromString( m_Frame->GetUserUnits(), tvalue ) < minTrackWidth )
{
msg.Printf( _( "Track width less than minimum track width (%s)." ),
StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) );
m_Parent->SetError( msg, this, m_trackWidthsGrid, row, 0 );
return false;
}
}
// Test custom vias
for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
{
wxString viaDia = m_viaSizesGrid->GetCellValue( row, 0 );
if( viaDia.IsEmpty() )
continue;
if( ValueFromString( m_Frame->GetUserUnits(), viaDia ) < minViaDia )
{
msg.Printf( _( "Via diameter less than minimum via diameter (%s)." ),
StringFromValue( m_Frame->GetUserUnits(), minViaDia, true, true ) );
m_Parent->SetError( msg, this, m_viaSizesGrid, row, 0 );
return false;
}
wxString viaDrill = m_viaSizesGrid->GetCellValue( row, 1 );
if( viaDrill.IsEmpty() )
{
msg = _( "No via drill defined." );
m_Parent->SetError( msg, this, m_viaSizesGrid, row, 1 );
return false;
}
if( ValueFromString( m_Frame->GetUserUnits(), viaDrill ) < minViaDrill )
{
msg.Printf( _( "Via drill less than minimum via drill (%s)." ),
StringFromValue( m_Frame->GetUserUnits(), minViaDrill, true, true ) );
m_Parent->SetError( msg, this, m_viaSizesGrid, row, 1 );
return false;
}
if( ValueFromString( m_Frame->GetUserUnits(), viaDrill )
>= ValueFromString( m_Frame->GetUserUnits(), viaDia ) )
{
msg = _( "Via drill larger than via diameter." );
m_Parent->SetError( msg, this, m_viaSizesGrid, row, 1 );
return false;
}
}
return true;
}
void PANEL_SETUP_NETCLASSES::ImportSettingsFrom( BOARD* aBoard )
{
// Note: do not change the board, as we need to get the current nets from it for
// netclass memberships. All the netclass definitions and dimension lists are in
// the BOARD_DESIGN_SETTINGS.
BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
m_BrdSettings = &aBoard->GetDesignSettings();
TransferDataToWindow();
m_netclassGrid->ForceRefresh();
m_membershipGrid->ForceRefresh();
m_BrdSettings = savedSettings;
}

View File

@ -0,0 +1,91 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PANEL_SETUP_NETCLASSES_H
#define PANEL_SETUP_NETCLASSES_H
#include <class_board.h>
#include <widgets/unit_binder.h>
#include <widgets/paged_dialog.h>
#include <panel_setup_netclasses_base.h>
#include "panel_setup_feature_constraints.h"
class PCB_EDIT_FRAME;
class BOARD_DESIGN_SETTINGS;
class PANEL_SETUP_NETCLASSES : public PANEL_SETUP_NETCLASSES_BASE
{
private:
PAGED_DIALOG* m_Parent;
PCB_EDIT_FRAME* m_Frame;
BOARD* m_Pcb;
BOARD_DESIGN_SETTINGS* m_BrdSettings;
// We must validate against the current m_BrdSettings as they may have been
// changed but not yet committed. Fetch them from the constraints panel.
PANEL_SETUP_FEATURE_CONSTRAINTS* m_ConstraintsPanel;
int* m_originalColWidths;
bool m_netclassesDirty; // Indicates the netclass drop-down
// menus need rebuilding
private:
void OnAddNetclassClick( wxCommandEvent& event ) override;
void OnRemoveNetclassClick( wxCommandEvent& event ) override;
void OnSizeNetclassGrid( wxSizeEvent& event ) override;
void OnSizeMembershipGrid( wxSizeEvent& event ) override;
void OnUpdateUI( wxUpdateUIEvent &event ) override;
void OnNetclassGridCellChanging( wxGridEvent& event );
void OnFilterChanged( wxCommandEvent& event ) override;
bool validateNetclassName( int aRow, wxString aName, bool focusFirst = true );
bool validateData();
void rebuildNetclassDropdowns();
/* Populates the lists of sizes (Tracks width list and Vias diameters & drill list) */
void TransferDimensionListsToWindow();
void CopyDimensionsListsToBoard( );
int getNetclassValue( int aRow, int aCol );
void CopyNetclassesToBoard();
void addNet( wxString netName, const wxString& netclass );
void AdjustNetclassGridColumns( int aWidth );
void AdjustMembershipGridColumns( int aWidth );
public:
PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame,
PANEL_SETUP_FEATURE_CONSTRAINTS* aConstraintsPanel );
~PANEL_SETUP_NETCLASSES( ) override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void ImportSettingsFrom( BOARD* aBoard );
};
#endif //PANEL_SETUP_NETCLASSES_H

View File

@ -0,0 +1,307 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/wx_grid.h"
#include "panel_setup_netclasses_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_SETUP_NETCLASSES_BASE::PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
wxBoxSizer* bpanelNetClassesSizer;
bpanelNetClassesSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerUpper;
sbSizerUpper = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net Classes") ), wxVERTICAL );
sbSizerUpper->SetMinSize( wxSize( -1,220 ) );
m_netclassGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxTAB_TRAVERSAL|wxVSCROLL );
// Grid
m_netclassGrid->CreateGrid( 1, 9 );
m_netclassGrid->EnableEditing( true );
m_netclassGrid->EnableGridLines( true );
m_netclassGrid->EnableDragGridSize( false );
m_netclassGrid->SetMargins( 0, 0 );
// Columns
m_netclassGrid->SetColSize( 0, 120 );
m_netclassGrid->SetColSize( 1, 88 );
m_netclassGrid->SetColSize( 2, 88 );
m_netclassGrid->SetColSize( 3, 88 );
m_netclassGrid->SetColSize( 4, 88 );
m_netclassGrid->SetColSize( 5, 88 );
m_netclassGrid->SetColSize( 6, 88 );
m_netclassGrid->SetColSize( 7, 88 );
m_netclassGrid->SetColSize( 8, 88 );
m_netclassGrid->EnableDragColMove( false );
m_netclassGrid->EnableDragColSize( true );
m_netclassGrid->SetColLabelSize( 22 );
m_netclassGrid->SetColLabelValue( 0, _("Name") );
m_netclassGrid->SetColLabelValue( 1, _("Clearance") );
m_netclassGrid->SetColLabelValue( 2, _("Track Width") );
m_netclassGrid->SetColLabelValue( 3, _("Via Size") );
m_netclassGrid->SetColLabelValue( 4, _("Via Drill") );
m_netclassGrid->SetColLabelValue( 5, _("uVia Size") );
m_netclassGrid->SetColLabelValue( 6, _("uVia Drill") );
m_netclassGrid->SetColLabelValue( 7, _("dPair Width") );
m_netclassGrid->SetColLabelValue( 8, _("dPair Gap") );
m_netclassGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_netclassGrid->EnableDragRowSize( false );
m_netclassGrid->SetRowLabelSize( 0 );
m_netclassGrid->SetRowLabelValue( 0, _("Default") );
m_netclassGrid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_netclassGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_netclassGrid->SetToolTip( _("Net Class parameters") );
sbSizerUpper->Add( m_netclassGrid, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* buttonBoxSizer;
buttonBoxSizer = new wxBoxSizer( wxHORIZONTAL );
m_addButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW );
m_addButton->SetMinSize( wxSize( 29,29 ) );
buttonBoxSizer->Add( m_addButton, 0, 0, 5 );
m_removeButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW );
m_removeButton->SetMinSize( wxSize( 29,29 ) );
buttonBoxSizer->Add( m_removeButton, 0, wxRIGHT, 10 );
sbSizerUpper->Add( buttonBoxSizer, 0, wxEXPAND|wxALL, 2 );
bpanelNetClassesSizer->Add( sbSizerUpper, 4, wxEXPAND|wxTOP|wxLEFT, 15 );
wxBoxSizer* bSizerLower;
bSizerLower = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbSizerNetSelectMain;
sbSizerNetSelectMain = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net Class Membership") ), wxVERTICAL );
m_textNetFilter = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizerNetSelectMain->Add( m_textNetFilter, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_membershipGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_membershipGrid->CreateGrid( 0, 2 );
m_membershipGrid->EnableEditing( true );
m_membershipGrid->EnableGridLines( true );
m_membershipGrid->EnableDragGridSize( false );
m_membershipGrid->SetMargins( 0, 0 );
// Columns
m_membershipGrid->EnableDragColMove( false );
m_membershipGrid->EnableDragColSize( true );
m_membershipGrid->SetColLabelSize( 22 );
m_membershipGrid->SetColLabelValue( 0, _("Net") );
m_membershipGrid->SetColLabelValue( 1, _("Net Class") );
m_membershipGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_membershipGrid->EnableDragRowSize( true );
m_membershipGrid->SetRowLabelSize( 0 );
m_membershipGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_membershipGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
sbSizerNetSelectMain->Add( m_membershipGrid, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerLower->Add( sbSizerNetSelectMain, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxStaticBoxSizer* sbOtherValuesSizer;
sbOtherValuesSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Non-netclass Predefined Values") ), wxHORIZONTAL );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxVERTICAL );
m_staticText24 = new wxStaticText( this, wxID_ANY, _("Tracks:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText24->Wrap( -1 );
bSizer10->Add( m_staticText24, 0, wxRIGHT|wxLEFT, 5 );
m_trackWidthsGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_trackWidthsGrid->CreateGrid( 8, 1 );
m_trackWidthsGrid->EnableEditing( true );
m_trackWidthsGrid->EnableGridLines( true );
m_trackWidthsGrid->EnableDragGridSize( false );
m_trackWidthsGrid->SetMargins( 0, 0 );
// Columns
m_trackWidthsGrid->SetColSize( 0, 78 );
m_trackWidthsGrid->EnableDragColMove( false );
m_trackWidthsGrid->EnableDragColSize( false );
m_trackWidthsGrid->SetColLabelSize( 22 );
m_trackWidthsGrid->SetColLabelValue( 0, _("Width") );
m_trackWidthsGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_trackWidthsGrid->EnableDragRowSize( false );
m_trackWidthsGrid->SetRowLabelSize( 0 );
m_trackWidthsGrid->SetRowLabelValue( 0, _("Track 1") );
m_trackWidthsGrid->SetRowLabelValue( 1, _("Track 2") );
m_trackWidthsGrid->SetRowLabelValue( 2, _("Track 3") );
m_trackWidthsGrid->SetRowLabelValue( 3, _("Track 4") );
m_trackWidthsGrid->SetRowLabelValue( 4, _("Track 5") );
m_trackWidthsGrid->SetRowLabelValue( 5, _("Track 6") );
m_trackWidthsGrid->SetRowLabelValue( 6, _("Track 7") );
m_trackWidthsGrid->SetRowLabelValue( 7, _("Track 8") );
m_trackWidthsGrid->SetRowLabelValue( 8, _("Track 9") );
m_trackWidthsGrid->SetRowLabelValue( 9, _("Track 10") );
m_trackWidthsGrid->SetRowLabelValue( 10, _("Track 11") );
m_trackWidthsGrid->SetRowLabelValue( 11, _("Track 12") );
m_trackWidthsGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_trackWidthsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizer10->Add( m_trackWidthsGrid, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbOtherValuesSizer->Add( bSizer10, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer11;
bSizer11 = new wxBoxSizer( wxVERTICAL );
m_staticText25 = new wxStaticText( this, wxID_ANY, _("Vias:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText25->Wrap( -1 );
bSizer11->Add( m_staticText25, 0, wxRIGHT|wxLEFT, 5 );
m_viaSizesGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_viaSizesGrid->CreateGrid( 8, 2 );
m_viaSizesGrid->EnableEditing( true );
m_viaSizesGrid->EnableGridLines( true );
m_viaSizesGrid->EnableDragGridSize( false );
m_viaSizesGrid->SetMargins( 0, 0 );
// Columns
m_viaSizesGrid->SetColSize( 0, 78 );
m_viaSizesGrid->SetColSize( 1, 78 );
m_viaSizesGrid->EnableDragColMove( false );
m_viaSizesGrid->EnableDragColSize( false );
m_viaSizesGrid->SetColLabelSize( 22 );
m_viaSizesGrid->SetColLabelValue( 0, _("Size") );
m_viaSizesGrid->SetColLabelValue( 1, _("Drill") );
m_viaSizesGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_viaSizesGrid->EnableDragRowSize( false );
m_viaSizesGrid->SetRowLabelSize( 0 );
m_viaSizesGrid->SetRowLabelValue( 0, _("Via 1") );
m_viaSizesGrid->SetRowLabelValue( 1, _("Via 2") );
m_viaSizesGrid->SetRowLabelValue( 2, _("Via 3") );
m_viaSizesGrid->SetRowLabelValue( 3, _("Via 4") );
m_viaSizesGrid->SetRowLabelValue( 4, _("Via 5") );
m_viaSizesGrid->SetRowLabelValue( 5, _("Via 6") );
m_viaSizesGrid->SetRowLabelValue( 6, _("Via 7") );
m_viaSizesGrid->SetRowLabelValue( 7, _("Via 8") );
m_viaSizesGrid->SetRowLabelValue( 8, _("Via 9") );
m_viaSizesGrid->SetRowLabelValue( 9, _("Via 10") );
m_viaSizesGrid->SetRowLabelValue( 10, _("Via 11") );
m_viaSizesGrid->SetRowLabelValue( 11, _("Via 12") );
m_viaSizesGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_viaSizesGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizer11->Add( m_viaSizesGrid, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbOtherValuesSizer->Add( bSizer11, 0, wxEXPAND|wxLEFT, 5 );
wxBoxSizer* bSizer12;
bSizer12 = new wxBoxSizer( wxVERTICAL );
m_staticText26 = new wxStaticText( this, wxID_ANY, _("Differential Pairs:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText26->Wrap( -1 );
bSizer12->Add( m_staticText26, 0, wxRIGHT|wxLEFT, 5 );
m_diffPairsGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_diffPairsGrid->CreateGrid( 8, 3 );
m_diffPairsGrid->EnableEditing( true );
m_diffPairsGrid->EnableGridLines( true );
m_diffPairsGrid->EnableDragGridSize( false );
m_diffPairsGrid->SetMargins( 0, 0 );
// Columns
m_diffPairsGrid->SetColSize( 0, 78 );
m_diffPairsGrid->SetColSize( 1, 78 );
m_diffPairsGrid->SetColSize( 2, 78 );
m_diffPairsGrid->EnableDragColMove( false );
m_diffPairsGrid->EnableDragColSize( true );
m_diffPairsGrid->SetColLabelSize( 22 );
m_diffPairsGrid->SetColLabelValue( 0, _("Width") );
m_diffPairsGrid->SetColLabelValue( 1, _("Gap") );
m_diffPairsGrid->SetColLabelValue( 2, _("Via Gap") );
m_diffPairsGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_diffPairsGrid->EnableDragRowSize( true );
m_diffPairsGrid->SetRowLabelSize( 0 );
m_diffPairsGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_diffPairsGrid->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) );
m_diffPairsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizer12->Add( m_diffPairsGrid, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbOtherValuesSizer->Add( bSizer12, 0, wxEXPAND|wxLEFT, 5 );
bSizerLower->Add( sbOtherValuesSizer, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
bpanelNetClassesSizer->Add( bSizerLower, 5, wxEXPAND|wxTOP|wxLEFT, 10 );
this->SetSizer( bpanelNetClassesSizer );
this->Layout();
bpanelNetClassesSizer->Fit( this );
// Connect Events
m_netclassGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnSizeNetclassGrid ), NULL, this );
m_addButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnAddNetclassClick ), NULL, this );
m_removeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnRemoveNetclassClick ), NULL, this );
m_textNetFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnFilterChanged ), NULL, this );
m_membershipGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnSizeMembershipGrid ), NULL, this );
m_membershipGrid->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnUpdateUI ), NULL, this );
}
PANEL_SETUP_NETCLASSES_BASE::~PANEL_SETUP_NETCLASSES_BASE()
{
// Disconnect Events
m_netclassGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnSizeNetclassGrid ), NULL, this );
m_addButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnAddNetclassClick ), NULL, this );
m_removeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnRemoveNetclassClick ), NULL, this );
m_textNetFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnFilterChanged ), NULL, this );
m_membershipGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnSizeMembershipGrid ), NULL, this );
m_membershipGrid->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_NETCLASSES_BASE::OnUpdateUI ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,71 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __PANEL_SETUP_NETCLASSES_BASE_H__
#define __PANEL_SETUP_NETCLASSES_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class WX_GRID;
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/font.h>
#include <wx/grid.h>
#include <wx/gdicmn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/textctrl.h>
#include <wx/stattext.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_SETUP_NETCLASSES_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_SETUP_NETCLASSES_BASE : public wxPanel
{
private:
protected:
WX_GRID* m_netclassGrid;
wxBitmapButton* m_addButton;
wxBitmapButton* m_removeButton;
wxTextCtrl* m_textNetFilter;
WX_GRID* m_membershipGrid;
wxStaticText* m_staticText24;
WX_GRID* m_trackWidthsGrid;
wxStaticText* m_staticText25;
WX_GRID* m_viaSizesGrid;
wxStaticText* m_staticText26;
WX_GRID* m_diffPairsGrid;
// Virtual event handlers, overide them in your derived class
virtual void OnSizeNetclassGrid( wxSizeEvent& event ) { event.Skip(); }
virtual void OnAddNetclassClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveNetclassClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnFilterChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSizeMembershipGrid( wxSizeEvent& event ) { event.Skip(); }
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
public:
PANEL_SETUP_NETCLASSES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
~PANEL_SETUP_NETCLASSES_BASE();
};
#endif //__PANEL_SETUP_NETCLASSES_BASE_H__

View File

@ -0,0 +1,194 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <base_units.h>
#include <class_drawpanel.h>
#include <pcb_edit_frame.h>
#include <board_design_settings.h>
#include <widgets/wx_grid.h>
#include <panel_setup_text_and_graphics.h>
// Columns of layer classes grid
enum
{
COL_LINE_THICKNESS = 0,
COL_TEXT_WIDTH,
COL_TEXT_HEIGHT,
COL_TEXT_THICKNESS,
COL_TEXT_ITALIC,
COL_TEXT_UPRIGHT
};
enum
{
ROW_SILK = 0,
ROW_COPPER,
ROW_EDGES,
ROW_OTHERS,
ROW_COUNT
};
PANEL_SETUP_TEXT_AND_GRAPHICS::PANEL_SETUP_TEXT_AND_GRAPHICS( PAGED_DIALOG* aParent,
PCB_EDIT_FRAME* aFrame ) :
PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( aParent )
{
m_Parent = aParent;
m_Frame = aFrame;
m_BrdSettings = &m_Frame->GetBoard()->GetDesignSettings();
m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
// Work around a bug in wxWidgets where it fails to recalculate the grid height
// after changing the default row size
m_grid->AppendRows( 1 );
m_grid->DeleteRows( m_grid->GetNumberRows() - 1, 1 );
m_grid->PushEventHandler( new GRID_TRICKS( m_grid ) );
}
PANEL_SETUP_TEXT_AND_GRAPHICS::~PANEL_SETUP_TEXT_AND_GRAPHICS()
{
// destroy GRID_TRICKS before m_grid.
m_grid->PopEventHandler( true );
}
bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataToWindow()
{
wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND );
#define SET_MILS_CELL( row, col, val ) \
m_grid->SetCellValue( row, col, StringFromValue( m_Frame->GetUserUnits(), val, true, true ) )
#define DISABLE_CELL( row, col ) \
m_grid->SetReadOnly( row, col ); m_grid->SetCellBackgroundColour( row, col, disabledColour );
for( int i = 0; i < ROW_COUNT; ++i )
{
SET_MILS_CELL( i, COL_LINE_THICKNESS, m_BrdSettings->m_LineThickness[ i ] );
if( i == ROW_EDGES )
{
DISABLE_CELL( i, COL_TEXT_WIDTH );
DISABLE_CELL( i, COL_TEXT_HEIGHT );
DISABLE_CELL( i, COL_TEXT_THICKNESS );
DISABLE_CELL( i, COL_TEXT_ITALIC );
DISABLE_CELL( i, COL_TEXT_UPRIGHT );
}
else
{
SET_MILS_CELL( i, COL_TEXT_WIDTH, m_BrdSettings->m_TextSize[ i ].x );
SET_MILS_CELL( i, COL_TEXT_HEIGHT, m_BrdSettings->m_TextSize[ i ].y );
SET_MILS_CELL( i, COL_TEXT_THICKNESS, m_BrdSettings->m_TextThickness[ i ] );
m_grid->SetCellValue( i, COL_TEXT_ITALIC, m_BrdSettings->m_TextItalic[ i ] ? "1" : "" );
m_grid->SetCellValue( i, COL_TEXT_UPRIGHT, m_BrdSettings->m_TextUpright[ i ] ? "1" : "" );
auto attr = new wxGridCellAttr;
attr->SetRenderer( new wxGridCellBoolRenderer() );
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
m_grid->SetAttr( i, COL_TEXT_ITALIC, attr );
attr = new wxGridCellAttr;
attr->SetRenderer( new wxGridCellBoolRenderer() );
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
m_grid->SetAttr( i, COL_TEXT_UPRIGHT, attr );
}
}
return true;
}
int PANEL_SETUP_TEXT_AND_GRAPHICS::getGridValue( int aRow, int aCol )
{
return ValueFromString( m_Frame->GetUserUnits(), m_grid->GetCellValue( aRow, aCol ), true );
}
bool PANEL_SETUP_TEXT_AND_GRAPHICS::validateData()
{
// Commit any pending in-place edits and close editors from grid
m_grid->DisableCellEditControl();
// Test text parameters.
for( int row : { ROW_SILK, ROW_COPPER, ROW_OTHERS } )
{
int textSize = std::min( getGridValue( row, COL_TEXT_WIDTH ),
getGridValue( row, COL_TEXT_HEIGHT ) );
if( getGridValue( row, COL_TEXT_THICKNESS ) > textSize / 4 )
{
wxString msg = _( "Text will not be readable with a thickness greater than\n"
"1/4 its width or height." );
m_Parent->SetError( msg, this, m_grid, row, COL_TEXT_THICKNESS );
return false;
}
}
return true;
}
bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataFromWindow()
{
if( !validateData() )
return false;
for( int i = 0; i < ROW_COUNT; ++i )
{
m_BrdSettings->m_LineThickness[ i ] = getGridValue( i, COL_LINE_THICKNESS );
if( i == ROW_EDGES ) // edges & courtyards only define line thickness
continue;
m_BrdSettings->m_TextSize[ i ] =
wxSize( getGridValue( i, COL_TEXT_WIDTH ), getGridValue( i, COL_TEXT_HEIGHT ) );
m_BrdSettings->m_TextThickness[ i ] = getGridValue( i, COL_TEXT_THICKNESS );
m_BrdSettings->m_TextItalic[ i ] =
wxGridCellBoolEditor::IsTrueValue( m_grid->GetCellValue( i, COL_TEXT_ITALIC ) );
m_BrdSettings->m_TextUpright[ i ] =
wxGridCellBoolEditor::IsTrueValue( m_grid->GetCellValue( i, COL_TEXT_UPRIGHT ) );
}
return true;
}
void PANEL_SETUP_TEXT_AND_GRAPHICS::ImportSettingsFrom( BOARD* aBoard )
{
BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
m_BrdSettings = &aBoard->GetDesignSettings();
TransferDataToWindow();
m_BrdSettings = savedSettings;
}

View File

@ -1,8 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -22,29 +21,40 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _DIALOG_MASK_CLEARANCE_H_
#define _DIALOG_MASK_CLEARANCE_H_
#include <dialog_mask_clearance_base.h>
#ifndef PANEL_SETUP_TEXT_AND_GRAPHICS_H
#define PANEL_SETUP_TEXT_AND_GRAPHICS_H
/**
* DIALOG_PADS_MASK_CLEARANCE, derived from DIALOG_PADS_MASK_CLEARANCE_BASE
* @see dialog_mask_clearance.h and dialog_mask_clearance.cpp,
* automatically created by wxFormBuilder
*/
class DIALOG_PADS_MASK_CLEARANCE : public DIALOG_PADS_MASK_CLEARANCE_BASE
#include <class_board.h>
#include <widgets/unit_binder.h>
#include <widgets/paged_dialog.h>
#include <panel_setup_text_and_graphics_base.h>
class PCB_EDIT_FRAME;
class BOARD_DESIGN_SETTINGS;
class PANEL_SETUP_TEXT_AND_GRAPHICS : public PANEL_SETUP_TEXT_AND_GRAPHICS_BASE
{
private:
PCB_EDIT_FRAME* m_parent;
BOARD_DESIGN_SETTINGS m_brdSettings;
PAGED_DIALOG* m_Parent;
PCB_EDIT_FRAME* m_Frame;
BOARD_DESIGN_SETTINGS* m_BrdSettings;
private:
bool validateData();
int getGridValue( int aRow, int aCol );
public:
DIALOG_PADS_MASK_CLEARANCE( PCB_EDIT_FRAME* parent );
~DIALOG_PADS_MASK_CLEARANCE() {};
private:
void myInit();
virtual void OnButtonOkClick( wxCommandEvent& event ) override;
virtual void OnButtonCancelClick( wxCommandEvent& event ) override;
PANEL_SETUP_TEXT_AND_GRAPHICS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame );
~PANEL_SETUP_TEXT_AND_GRAPHICS( ) override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void ImportSettingsFrom( BOARD* aBoard );
};
#endif // _DIALOG_MASK_CLEARANCE_H_
#endif //PANEL_SETUP_TEXT_AND_GRAPHICS_H

View File

@ -0,0 +1,80 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/wx_grid.h"
#include "panel_setup_text_and_graphics_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_SETUP_TEXT_AND_GRAPHICS_BASE::PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
m_gridSizer = new wxBoxSizer( wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Default properties for new graphic items:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
m_gridSizer->Add( m_staticText1, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
// Grid
m_grid->CreateGrid( 4, 6 );
m_grid->EnableEditing( true );
m_grid->EnableGridLines( true );
m_grid->EnableDragGridSize( false );
m_grid->SetMargins( 0, 0 );
// Columns
m_grid->SetColSize( 0, 120 );
m_grid->SetColSize( 1, 100 );
m_grid->SetColSize( 2, 100 );
m_grid->SetColSize( 3, 120 );
m_grid->SetColSize( 4, 60 );
m_grid->SetColSize( 5, 100 );
m_grid->EnableDragColMove( false );
m_grid->EnableDragColSize( true );
m_grid->SetColLabelSize( 22 );
m_grid->SetColLabelValue( 0, _("Line Thickness") );
m_grid->SetColLabelValue( 1, _("Text Width") );
m_grid->SetColLabelValue( 2, _("Text Height") );
m_grid->SetColLabelValue( 3, _("Text Thickness") );
m_grid->SetColLabelValue( 4, _("Italic") );
m_grid->SetColLabelValue( 5, _("Keep Upright") );
m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_grid->EnableDragRowSize( false );
m_grid->SetRowLabelSize( 132 );
m_grid->SetRowLabelValue( 0, _("Silk Layers") );
m_grid->SetRowLabelValue( 1, _("Copper Layers") );
m_grid->SetRowLabelValue( 2, _("Edges & Courtyards") );
m_grid->SetRowLabelValue( 3, _("Other Layers") );
m_grid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_grid->SetToolTip( _("Net Class parameters") );
m_gridSizer->Add( m_grid, 0, wxBOTTOM|wxLEFT, 20 );
mainSizer->Add( m_gridSizer, 0, wxTOP|wxLEFT, 15 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
}
PANEL_SETUP_TEXT_AND_GRAPHICS_BASE::~PANEL_SETUP_TEXT_AND_GRAPHICS_BASE()
{
}

View File

@ -0,0 +1,326 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">panel_setup_text_and_graphics_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">panel_setup_text_and_graphics_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">PANEL_SETUP_TEXT_AND_GRAPHICS_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="subclass">; forward_declare</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">mainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">15</property>
<property name="flag">wxTOP|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_gridSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Default properties for new graphic items:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">20</property>
<property name="flag">wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxGrid" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="autosize_cols">0</property>
<property name="autosize_rows">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="cell_bg"></property>
<property name="cell_font"></property>
<property name="cell_horiz_alignment">wxALIGN_LEFT</property>
<property name="cell_text"></property>
<property name="cell_vert_alignment">wxALIGN_TOP</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="col_label_size">22</property>
<property name="col_label_values">&quot;Line Thickness&quot; &quot;Text Width&quot; &quot;Text Height&quot; &quot;Text Thickness&quot; &quot;Italic&quot; &quot;Keep Upright&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="cols">6</property>
<property name="column_sizes">120,100,100,120,60,100</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
<property name="drag_row_size">0</property>
<property name="editing">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="grid_line_color"></property>
<property name="grid_lines">1</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label_bg"></property>
<property name="label_font"></property>
<property name="label_text"></property>
<property name="margin_height">0</property>
<property name="margin_width">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_grid</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="row_label_horiz_alignment">wxALIGN_LEFT</property>
<property name="row_label_size">132</property>
<property name="row_label_values">&quot;Silk Layers&quot; &quot;Copper Layers&quot; &quot;Edges &amp; Courtyards&quot; &quot;Other Layers&quot;</property>
<property name="row_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="row_sizes"></property>
<property name="rows">4</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Net Class parameters</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnGridCellChange"></event>
<event name="OnGridCellLeftClick"></event>
<event name="OnGridCellLeftDClick"></event>
<event name="OnGridCellRightClick"></event>
<event name="OnGridCellRightDClick"></event>
<event name="OnGridCmdCellChange"></event>
<event name="OnGridCmdCellLeftClick"></event>
<event name="OnGridCmdCellLeftDClick"></event>
<event name="OnGridCmdCellRightClick"></event>
<event name="OnGridCmdCellRightDClick"></event>
<event name="OnGridCmdColSize"></event>
<event name="OnGridCmdEditorCreated"></event>
<event name="OnGridCmdEditorHidden"></event>
<event name="OnGridCmdEditorShown"></event>
<event name="OnGridCmdLabelLeftClick"></event>
<event name="OnGridCmdLabelLeftDClick"></event>
<event name="OnGridCmdLabelRightClick"></event>
<event name="OnGridCmdLabelRightDClick"></event>
<event name="OnGridCmdRangeSelect"></event>
<event name="OnGridCmdRowSize"></event>
<event name="OnGridCmdSelectCell"></event>
<event name="OnGridColSize"></event>
<event name="OnGridEditorCreated"></event>
<event name="OnGridEditorHidden"></event>
<event name="OnGridEditorShown"></event>
<event name="OnGridLabelLeftClick"></event>
<event name="OnGridLabelLeftDClick"></event>
<event name="OnGridLabelRightClick"></event>
<event name="OnGridLabelRightDClick"></event>
<event name="OnGridRangeSelect"></event>
<event name="OnGridRowSize"></event>
<event name="OnGridSelectCell"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -0,0 +1,47 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __PANEL_SETUP_TEXT_AND_GRAPHICS_BASE_H__
#define __PANEL_SETUP_TEXT_AND_GRAPHICS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class WX_GRID;
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/grid.h>
#include <wx/sizer.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_SETUP_TEXT_AND_GRAPHICS_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_SETUP_TEXT_AND_GRAPHICS_BASE : public wxPanel
{
private:
protected:
wxBoxSizer* m_gridSizer;
wxStaticText* m_staticText1;
WX_GRID* m_grid;
public:
PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
~PANEL_SETUP_TEXT_AND_GRAPHICS_BASE();
};
#endif //__PANEL_SETUP_TEXT_AND_GRAPHICS_BASE_H__

View File

@ -100,6 +100,8 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
if( aDimension == NULL )
{
const BOARD_DESIGN_SETTINGS& boardSettings = GetBoard()->GetDesignSettings();
status_dimension = 1;
pos = GetCrossHairPosition();
@ -109,17 +111,10 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
aDimension->SetOrigin( pos );
aDimension->SetEnd( pos );
aDimension->Text().SetTextSize( GetBoard()->GetDesignSettings().m_PcbTextSize );
int width = GetBoard()->GetDesignSettings().m_PcbTextWidth;
int maxthickness = Clamp_Text_PenSize(width, aDimension->Text().GetTextSize() );
if( width > maxthickness )
{
width = maxthickness;
}
aDimension->Text().SetThickness( width );
aDimension->SetWidth( width );
aDimension->Text().SetTextSize( boardSettings.GetTextSize( GetActiveLayer() ) );
aDimension->Text().SetThickness( boardSettings.GetTextThickness( GetActiveLayer() ) );
aDimension->Text().SetItalic( boardSettings.GetTextItalic( GetActiveLayer() ) );
aDimension->SetWidth( boardSettings.GetLineThickness( GetActiveLayer() ) );
aDimension->AdjustDimensionDetails( GetUserUnits() );
aDimension->Draw( m_canvas, aDC, GR_XOR );

View File

@ -500,8 +500,8 @@ void DRC::RunTests( wxTextCtrl* aMessages )
testTexts();
// find overlapping courtyard ares.
if( m_pcb->GetDesignSettings().ProhibitOverlappingCourtyards()
|| m_pcb->GetDesignSettings().RequireCourtyardDefinitions() )
if( m_pcb->GetDesignSettings().m_ProhibitOverlappingCourtyards
|| m_pcb->GetDesignSettings().m_RequireCourtyards )
{
if( aMessages )
{
@ -720,7 +720,7 @@ void DRC::testPad2Pad()
void DRC::testDrilledHoles()
{
int holeToHoleMin = m_pcb->GetDesignSettings().GetMinHoleSeparation();
int holeToHoleMin = m_pcb->GetDesignSettings().m_HoleToHoleMin;
if( holeToHoleMin == 0 ) // No min setting turns testing off.
return;
@ -1325,7 +1325,7 @@ bool DRC::doFootprintOverlappingDrc()
{
bool is_ok = footprint->BuildPolyCourtyard();
if( !is_ok && m_pcb->GetDesignSettings().ProhibitOverlappingCourtyards() )
if( !is_ok && m_pcb->GetDesignSettings().m_ProhibitOverlappingCourtyards )
{
m_currentMarker = fillMarker( footprint, footprint->GetPosition(),
DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT,
@ -1335,7 +1335,7 @@ bool DRC::doFootprintOverlappingDrc()
success = false;
}
if( !m_pcb->GetDesignSettings().RequireCourtyardDefinitions() )
if( !m_pcb->GetDesignSettings().m_RequireCourtyards )
continue;
if( footprint->GetPolyCourtyardFront().OutlineCount() == 0 &&
@ -1351,7 +1351,7 @@ bool DRC::doFootprintOverlappingDrc()
}
}
if( !m_pcb->GetDesignSettings().ProhibitOverlappingCourtyards() )
if( !m_pcb->GetDesignSettings().m_ProhibitOverlappingCourtyards )
return success;
// Now test for overlapping on top layer:

View File

@ -727,6 +727,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
if( layer != UNDEFINED_LAYER )
{
const BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings();
DIMENSION* dimension = new DIMENSION( m_board );
m_board->Add( dimension, ADD_APPEND );
@ -752,16 +753,9 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
// The origin and end are assumed to always be in this order from eagle
dimension->SetOrigin( wxPoint( kicad_x( d.x1 ), kicad_y( d.y1 ) ) );
dimension->SetEnd( wxPoint( kicad_x( d.x2 ), kicad_y( d.y2 ) ) );
dimension->Text().SetTextSize( m_board->GetDesignSettings().m_PcbTextSize );
int width = m_board->GetDesignSettings().m_PcbTextWidth;
int maxThickness = Clamp_Text_PenSize( width, dimension->Text().GetTextSize() );
if( width > maxThickness )
width = maxThickness;
dimension->Text().SetThickness( width );
dimension->SetWidth( width );
dimension->Text().SetTextSize( designSettings.GetTextSize( layer ) );
dimension->Text().SetThickness( designSettings.GetTextThickness( layer ) );
dimension->SetWidth( designSettings.GetLineThickness( layer ) );
// check which axis the dimension runs in
// because the "height" of the dimension is perpendicular to that axis

View File

@ -168,19 +168,17 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge )
if( aEdge == NULL )
{
aEdge = (EDGE_MODULE*) (BOARD_ITEM*) module->GraphicalItemsList();
for( BOARD_ITEM *item = module->GraphicalItemsList(); item; item = item->Next() )
{
aEdge = dyn_cast<EDGE_MODULE*>( item );
if( aEdge )
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
aEdge->SetWidth( GetDesignSettings().GetLineThickness( aEdge->GetLayer() ) );
}
}
else
{
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
aEdge->SetWidth( GetDesignSettings().GetLineThickness( aEdge->GetLayer() ) );
}
OnModify();
@ -247,29 +245,6 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
}
void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge )
{
wxString buffer;
buffer = StringFromValue( GetUserUnits(), GetDesignSettings().m_ModuleSegmentWidth );
WX_TEXT_ENTRY_DIALOG dlg( this, _( "New Width:" ), _( "Edge Width" ), buffer );
if( dlg.ShowModal() != wxID_OK )
return; // canceled by user
buffer = dlg.GetValue( );
GetDesignSettings().m_ModuleSegmentWidth = ValueFromString( GetUserUnits(), buffer );
if( aEdge )
{
MODULE* module = GetBoard()->m_Modules;
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
module->CalculateBoundingBox();
OnModify();
}
}
void FOOTPRINT_EDIT_FRAME::Delete_Edge_Module( EDGE_MODULE* aEdge )
{
if( aEdge == NULL )
@ -347,7 +322,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
if( aEdge->GetShape() == S_ARC )
aEdge->SetAngle( ArcValue );
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
aEdge->SetWidth( GetDesignSettings().GetLineThickness( GetActiveLayer() ) );
aEdge->SetLayer( GetActiveLayer() );
// Initialize the starting point of the new segment or arc
@ -387,7 +362,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
aEdge = newedge; // point now new item
aEdge->SetFlags( IS_NEW );
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
aEdge->SetWidth( GetDesignSettings().GetLineThickness( aEdge->GetLayer() ) );
aEdge->SetStart( GetCrossHairPosition() );
aEdge->SetEnd( aEdge->GetStart() );

View File

@ -51,7 +51,6 @@
#include <footprint_viewer_frame.h>
#include <pcb_layer_box_selector.h>
#include <dialog_drc.h>
#include <dialog_global_edit_tracks_and_vias.h>
#include <invoke_pcb_dialog.h>
#include <array_creator.h>
#include <connectivity_data.h>
@ -343,26 +342,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
OnModify();
break;
case ID_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE:
{
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( this, GetBoard()->GetHighLightNetCode() );
dlg.ShowModal();
}
break;
case ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE:
if( GetCurItem() == NULL )
break;
{
int type = GetCurItem()->Type();
if( type == PCB_TRACE_T || type == PCB_VIA_T )
{
BOARD_CONNECTED_ITEM*item = (BOARD_CONNECTED_ITEM*) GetCurItem();
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( this, item->GetNetCode() );
dlg.ShowModal();
}
wxCommandEvent dummy;
OnEditTracksAndVias( dummy );
}
m_canvas->MoveCursorToCrossHair();
break;
@ -470,21 +453,22 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_DELETE_TRACKSEG:
if( GetCurItem() == NULL )
break;
m_canvas->MoveCursorToCrossHair();
SetCurItem( Delete_Segment( &dc, (TRACK*) GetCurItem() ) );
OnModify();
if( GetCurItem() )
{
m_canvas->MoveCursorToCrossHair();
SetCurItem( Delete_Segment( &dc, (TRACK*) GetCurItem() ) );
OnModify();
}
break;
case ID_POPUP_PCB_DELETE_TRACK:
if( GetCurItem() == NULL )
break;
m_canvas->MoveCursorToCrossHair();
Delete_Track( &dc, (TRACK*) GetCurItem() );
SetCurItem( NULL );
OnModify();
if( GetCurItem() )
{
m_canvas->MoveCursorToCrossHair();
Delete_Track( &dc, (TRACK*) GetCurItem() );
SetCurItem( NULL );
OnModify();
}
break;
case ID_POPUP_PCB_DELETE_TRACKNET:
@ -524,9 +508,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DELETE_ZONE:
m_canvas->MoveCursorToCrossHair();
if( GetCurItem() == NULL )
break;
if( GetCurItem() )
{
SEGZONE* zsegm = (SEGZONE*) GetCurItem();
int netcode = zsegm->GetNetCode();
@ -858,19 +840,19 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_UPDATE_FOOTPRINTS:
if( GetCurItem() && GetCurItem()->Type() != PCB_MODULE_T )
break;
InstallExchangeModuleFrame( (MODULE*) GetCurItem(), true );
m_canvas->MoveCursorToCrossHair();
if( GetCurItem() && GetCurItem()->Type() == PCB_MODULE_T )
{
InstallExchangeModuleFrame( (MODULE*) GetCurItem(), true );
m_canvas->MoveCursorToCrossHair();
}
break;
case ID_POPUP_PCB_EXCHANGE_FOOTPRINTS:
if( GetCurItem() && GetCurItem()->Type() != PCB_MODULE_T )
break;
InstallExchangeModuleFrame( (MODULE*) GetCurItem(), false );
m_canvas->MoveCursorToCrossHair();
if( GetCurItem() && GetCurItem()->Type() == PCB_MODULE_T )
{
InstallExchangeModuleFrame( (MODULE*) GetCurItem(), false );
m_canvas->MoveCursorToCrossHair();
}
break;
case ID_POPUP_PCB_EDIT_MODULE_PRMS:

View File

@ -214,9 +214,10 @@ TEXTE_PCB* PCB_EDIT_FRAME::CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText )
)
textePcb->SetMirrored( true );
textePcb->SetTextSize( GetBoard()->GetDesignSettings().m_PcbTextSize );
textePcb->SetTextSize( GetBoard()->GetDesignSettings().GetTextSize( layer ) );
textePcb->SetTextPos( GetCrossHairPosition() );
textePcb->SetThickness( GetBoard()->GetDesignSettings().m_PcbTextWidth );
textePcb->SetThickness( GetBoard()->GetDesignSettings().GetTextThickness( layer ) );
textePcb->SetItalic( GetBoard()->GetDesignSettings().GetTextItalic( layer ) );
InstallTextOptionsFrame( textePcb, aDC );

View File

@ -251,69 +251,3 @@ void PCB_EDIT_FRAME::Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment )
}
bool PCB_EDIT_FRAME::Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNetclassValue )
{
/* Reset all tracks width and vias diameters and drill
* to their default Netclass value or current values
* aNetcode : the netcode of the net to edit
* aUseNetclassValue = true to use netclass values, false to use current values
*/
TRACK* pt_segm;
if( aNetcode <= 0 )
return false;
// Examine segments
PICKED_ITEMS_LIST itemsListPicker;
bool change = false;
for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
{
if( aNetcode != pt_segm->GetNetCode() ) // not in net
continue;
// we have found a item member of the net
if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, aUseNetclassValue ) )
change = true;
}
if( !change )
return false;
// Some segment have changed: save them in undo list
SaveCopyInUndoList( itemsListPicker, UR_CHANGED );
return true;
}
bool PCB_EDIT_FRAME::Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack, bool aVia )
{
TRACK* pt_segm;
// read and edit tracks and vias if required
PICKED_ITEMS_LIST itemsListPicker;
bool change = false;
for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
{
if( (pt_segm->Type() == PCB_VIA_T ) && aVia )
{
if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, true ) )
change = true;
}
if( (pt_segm->Type() == PCB_TRACE_T ) && aTrack )
{
if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, true ) )
change = true;
}
}
if( !change )
return false;
// Some segment have changed: save them in undo list
SaveCopyInUndoList( itemsListPicker, UR_CHANGED );
return true;
}

View File

@ -248,33 +248,27 @@ static void Abort_EditEdge( EDA_DRAW_PANEL* aPanel, wxDC* DC )
*/
DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC )
{
int s_large;
int lineWidth;
DRAWSEGMENT* DrawItem;
s_large = GetDesignSettings().m_DrawSegmentWidth;
lineWidth = GetDesignSettings().GetLineThickness( GetActiveLayer() );
if( GetActiveLayer() == Edge_Cuts )
{
s_large = GetDesignSettings().m_EdgeSegmentWidth;
}
if( Segment == NULL ) // Create new trace.
if( Segment == NULL ) // Create new segment.
{
SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
Segment->SetFlags( IS_NEW );
Segment->SetLayer( GetActiveLayer() );
Segment->SetWidth( s_large );
Segment->SetWidth( lineWidth );
Segment->SetShape( shape );
Segment->SetAngle( 900 );
Segment->SetStart( GetCrossHairPosition() );
Segment->SetEnd( GetCrossHairPosition() );
m_canvas->SetMouseCapture( DrawSegment, Abort_EditEdge );
}
else /* The ending point ccordinate Segment->m_End was updated by he function
* DrawSegment() called on a move mouse event
* during the segment creation
*/
else
{
// The ending point coordinate Segment->m_End was updated by the function
// DrawSegment() called on a move mouse event during the segment creation
if( Segment->GetStart() != Segment->GetEnd() )
{
if( Segment->GetShape() == S_SEGMENT )
@ -293,7 +287,7 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T s
Segment->SetFlags( IS_NEW );
Segment->SetLayer( DrawItem->GetLayer() );
Segment->SetWidth( s_large );
Segment->SetWidth( lineWidth );
Segment->SetShape( DrawItem->GetShape() );
Segment->SetType( DrawItem->GetType() );
Segment->SetAngle( DrawItem->GetAngle() );

View File

@ -69,13 +69,6 @@ TEXTE_MODULE* FOOTPRINT_EDIT_FRAME::CreateTextModule( MODULE* aModule, wxDC* aDC
text->SetFlags( IS_NEW );
GetDesignSettings().m_ModuleTextWidth = Clamp_Text_PenSize( GetDesignSettings().m_ModuleTextWidth,
std::min( GetDesignSettings().m_ModuleTextSize.x,
GetDesignSettings().m_ModuleTextSize.y ), true );
text->SetTextSize( GetDesignSettings().m_ModuleTextSize );
text->SetThickness( GetDesignSettings().m_ModuleTextWidth );
text->SetPosition( GetCrossHairPosition() );
if( LSET::AllTechMask().test( GetActiveLayer() ) ) // i.e. a possible layer for a text
text->SetLayer( GetActiveLayer() );
@ -295,13 +288,12 @@ static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
{
wxSize newSize;
int newThickness;
wxSize newSize = GetDesignSettings().GetTextSize( aItem->GetLayer() );
int newThickness = GetDesignSettings().GetTextThickness( aItem->GetLayer() );
bool newItalic = GetDesignSettings().GetTextItalic( aItem->GetLayer() );
if( aItem->Type() == PCB_TEXT_T )
{
newSize = GetDesignSettings().m_PcbTextSize;
newThickness = GetDesignSettings().m_PcbTextWidth;
TEXTE_PCB* text = static_cast<TEXTE_PCB*>( aItem );
// Exit if there's nothing to do
@ -311,12 +303,11 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
SaveCopyInUndoList( text, UR_CHANGED );
text->SetTextSize( newSize );
text->SetThickness( newThickness );
text->SetItalic( newItalic );
}
else if( aItem->Type() == PCB_MODULE_TEXT_T )
{
newSize = GetDesignSettings().m_ModuleTextSize;
newThickness = GetDesignSettings().m_ModuleTextWidth;
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( aItem );
// Exit if there's nothing to do
@ -326,6 +317,7 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
SaveCopyInUndoList( text->GetParent(), UR_CHANGED );
text->SetTextSize( newSize );
text->SetThickness( newThickness );
text->SetItalic( newItalic );
}
else
return;

View File

@ -528,6 +528,22 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
return false;
}
// 6.0 TODO: some settings didn't make it into the board file in 5.1 so as not to
// change the file format. For 5.1 we must copy them across from the config-initialized
// board.
BOARD_DESIGN_SETTINGS& bds = loadedBoard->m_designSettings;
BOARD_DESIGN_SETTINGS& configBds = GetBoard()->GetDesignSettings();
bds.m_RequireCourtyards = configBds.m_RequireCourtyards;
bds.m_ProhibitOverlappingCourtyards = configBds.m_ProhibitOverlappingCourtyards;
bds.m_HoleToHoleMin = configBds.m_HoleToHoleMin;
bds.m_LineThickness[LAYER_CLASS_OTHERS] = configBds.m_LineThickness[LAYER_CLASS_OTHERS];
bds.m_TextSize[LAYER_CLASS_OTHERS] = configBds.m_TextSize[LAYER_CLASS_OTHERS];
bds.m_TextThickness[LAYER_CLASS_OTHERS] = configBds.m_TextThickness[LAYER_CLASS_OTHERS];
std::copy( configBds.m_TextItalic, configBds.m_TextItalic + 4, bds.m_TextItalic );
std::copy( configBds.m_TextUpright, configBds.m_TextUpright + 4, bds.m_TextUpright );
bds.m_DiffPairDimensionsList = configBds.m_DiffPairDimensionsList;
SetBoard( loadedBoard );
// we should not ask PLUGINs to do these items:

View File

@ -154,15 +154,12 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE,
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
// Module transformations
EVT_MENU( ID_MODEDIT_MODULE_ROTATE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_MIRROR, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_MOVE_EXACT, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_PCB_PAD_SETUP, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_PCB_USER_GRID_SETUP, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
// Menu Help

View File

@ -80,8 +80,6 @@ public:
*/
PARAM_CFG_ARRAY& GetConfigurationSettings();
void InstallOptionsFrame( const wxPoint& pos );
void OnCloseWindow( wxCloseEvent& Event ) override;
void CloseModuleEditor( wxCommandEvent& Event );
@ -375,16 +373,6 @@ public:
*/
void End_Edge_Module( EDGE_MODULE* Edge );
/**
* Function Enter_Edge_Width
* Edition of width of module outlines
* Ask for a new width.
* Change the width of EDGE_MODULE Edge if aEdge != NULL
* @param aEdge = edge to edit, or NULL
* changes ModuleSegmentWidth (global) = new width
*/
void Enter_Edge_Width( EDGE_MODULE* aEdge );
/// Function to initialize the move function params of a graphic item type DRAWSEGMENT
void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );

View File

@ -470,15 +470,6 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
PopMenu->AppendSeparator();
}
if( ( GetToolId() == ID_MODEDIT_LINE_TOOL ) ||
( GetToolId() == ID_MODEDIT_CIRCLE_TOOL ) ||
( GetToolId() == ID_MODEDIT_ARC_TOOL ) )
{
AddMenuItem( PopMenu, ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH, _("Set Line Width..." ),
KiBitmap( width_segment_xpm ) );
PopMenu->AppendSeparator();
}
return true;
}

Some files were not shown because too many files have changed in this diff Show More