Flesh out object properties and DRC Rule syntax help.

This commit is contained in:
Jeff Young 2020-09-05 17:00:29 +01:00
parent 276d77a1d7
commit e782794f96
36 changed files with 331 additions and 160 deletions

1
.gitignore vendored
View File

@ -24,6 +24,7 @@ common/template_fieldnames_lexer.h
eeschema/schematic_keywords.*
pcbnew/pcb_plot_params_keywords.cpp
pcbnew/pcb_plot_params_lexer.h
pcbnew/dialogs/panel_setup_rules_help_txt.h
Makefile
CMakeCache.txt
auto_renamed_to_cpp

13
CMakeModules/Txt2C.cmake Normal file
View File

@ -0,0 +1,13 @@
# CMake script file to process a text file for use as an immediate string value in C/C++.
# It escapes double-quotes and then wraps every line in (unescaped) double-quotes.
set( lines "" )
file( STRINGS ${inputFile} lines )
file( WRITE ${outputFile} "// Do not edit this file, it is autogenerated by CMake from a .txt file\n" )
foreach( line IN LISTS lines )
STRING(REGEX REPLACE "\"" "\\\\\"" linem "${line}" )
file( APPEND ${outputFile} "\"" "${linem}" "\\n\"\n" )
endforeach( line "${lines}" )

View File

@ -53,9 +53,12 @@ enum SEARCH_PATH_GRID_COLUMNS
DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent, FILENAME_RESOLVER* aResolver ) :
DIALOG_CONFIGURE_PATHS_BASE( aParent ),
m_errorGrid( nullptr ), m_errorRow( -1 ), m_errorCol( -1 ),
m_errorGrid( nullptr ),
m_errorRow( -1 ),
m_errorCol( -1 ),
m_resolver( aResolver ),
m_gridWidthsDirty( true )
m_gridWidthsDirty( true ),
m_helpDialog( nullptr )
{
m_btnAddEnvVar->SetBitmap( KiBitmap( small_plus_xpm ) );
m_btnDeleteEnvVar->SetBitmap( KiBitmap( trash_xpm ) );
@ -117,6 +120,9 @@ DIALOG_CONFIGURE_PATHS::~DIALOG_CONFIGURE_PATHS()
m_SearchPaths->PopEventHandler( true );
m_EnvVars->PopEventHandler( true );
if( m_helpDialog )
m_helpDialog->Destroy();
m_EnvVars->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
m_SearchPaths->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ), NULL, this );
}

View File

@ -35,6 +35,7 @@
#include <sch_reference_list.h>
#include <schematic.h>
#include <widgets/unit_binder.h>
#include <html_messagebox.h>
#include <dialog_edit_label.h>
#include <kicad_string.h>
#include <tool/actions.h>
@ -48,7 +49,8 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
DIALOG_LABEL_EDITOR_BASE( aParent ),
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, false ),
m_netNameValidator( true ),
m_scintillaTricks( nullptr )
m_scintillaTricks( nullptr ),
m_helpWindow( nullptr )
{
m_Parent = aParent;
m_CurrentText = aTextItem;
@ -140,6 +142,9 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
DIALOG_LABEL_EDITOR::~DIALOG_LABEL_EDITOR()
{
delete m_scintillaTricks;
if( m_helpWindow )
m_helpWindow->Destroy();
}
@ -346,5 +351,5 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
void DIALOG_LABEL_EDITOR::OnFormattingHelp( wxHyperlinkEvent& aEvent )
{
SCH_TEXT::ShowSyntaxHelp( this );
m_helpWindow = SCH_TEXT::ShowSyntaxHelp( this );
}

View File

@ -33,6 +33,7 @@
class SCH_EDIT_FRAME;
class SCH_TEXT;
class SCINTILLA_TRICKS;
class HTML_MESSAGE_BOX;
class DIALOG_LABEL_EDITOR : public DIALOG_LABEL_EDITOR_BASE
@ -78,6 +79,8 @@ private:
UNIT_BINDER m_textSize;
SCH_NETNAME_VALIDATOR m_netNameValidator;
SCINTILLA_TRICKS* m_scintillaTricks;
HTML_MESSAGE_BOX* m_helpWindow;
};

View File

@ -26,6 +26,7 @@
#include <sch_sheet.h>
#include <sch_validators.h>
#include <dialog_edit_sheet_pin.h>
#include <html_messagebox.h>
static wxString sheetPinTypes[] =
@ -42,7 +43,8 @@ DIALOG_EDIT_SHEET_PIN::DIALOG_EDIT_SHEET_PIN( SCH_EDIT_FRAME* parent, SCH_SHEET_
DIALOG_EDIT_SHEET_PIN_BASE( parent ),
m_frame( parent ),
m_sheetPin( aPin ),
m_textSize( parent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true )
m_textSize( parent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
m_helpWindow( nullptr )
{
for( const wxString& sheetPinType : sheetPinTypes )
m_choiceConnectionType->Append( sheetPinType );
@ -74,6 +76,13 @@ DIALOG_EDIT_SHEET_PIN::DIALOG_EDIT_SHEET_PIN( SCH_EDIT_FRAME* parent, SCH_SHEET_
}
DIALOG_EDIT_SHEET_PIN::~DIALOG_EDIT_SHEET_PIN()
{
if( m_helpWindow )
m_helpWindow->Destroy();
}
bool DIALOG_EDIT_SHEET_PIN::TransferDataToWindow()
{
SCH_SCREEN* screen = m_sheetPin->GetParent()->GetScreen();
@ -126,7 +135,7 @@ void DIALOG_EDIT_SHEET_PIN::onOKButton( wxCommandEvent& event )
void DIALOG_EDIT_SHEET_PIN::OnSyntaxHelp( wxHyperlinkEvent& aEvent )
{
SCH_TEXT::ShowSyntaxHelp( this );
m_helpWindow = SCH_TEXT::ShowSyntaxHelp( this );
}

View File

@ -31,17 +31,21 @@
class SCH_SHEET_PIN;
class HTML_MESSAGE_BOX;
class DIALOG_EDIT_SHEET_PIN : public DIALOG_EDIT_SHEET_PIN_BASE
{
SCH_EDIT_FRAME* m_frame;
SCH_SHEET_PIN* m_sheetPin;
SCH_EDIT_FRAME* m_frame;
SCH_SHEET_PIN* m_sheetPin;
UNIT_BINDER m_textSize;
UNIT_BINDER m_textSize;
HTML_MESSAGE_BOX* m_helpWindow;
public:
DIALOG_EDIT_SHEET_PIN( SCH_EDIT_FRAME* parent, SCH_SHEET_PIN* aPin );
~DIALOG_EDIT_SHEET_PIN();
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;

View File

@ -1232,7 +1232,7 @@ BITMAP_DEF SCH_HIERLABEL::GetMenuImage() const
}
void SCH_TEXT::ShowSyntaxHelp( wxWindow* aParentWindow )
HTML_MESSAGE_BOX* SCH_TEXT::ShowSyntaxHelp( wxWindow* aParentWindow )
{
wxString msg = _(
"<table>"
@ -1365,4 +1365,6 @@ void SCH_TEXT::ShowSyntaxHelp( wxWindow* aParentWindow )
dlg->AddHTML_Text( msg );
dlg->ShowModeless();
return dlg;
}

View File

@ -33,6 +33,8 @@
class NETLIST_OBJECT_LIST;
class HTML_MESSAGE_BOX;
/*
* Spin style for text items of all kinds on schematics
@ -324,7 +326,7 @@ public:
void Show( int nestLevel, std::ostream& os ) const override;
#endif
static void ShowSyntaxHelp( wxWindow* aParentWindow );
static HTML_MESSAGE_BOX* ShowSyntaxHelp( wxWindow* aParentWindow );
};

View File

@ -33,6 +33,7 @@
class EDA_DRAW_FRAME;
class FILENAME_RESOLVER;
class HTML_MESSAGE_BOX;
class DIALOG_CONFIGURE_PATHS: public DIALOG_CONFIGURE_PATHS_BASE
@ -73,6 +74,8 @@ private:
wxTextValidator m_aliasValidator;
bool m_gridWidthsDirty;
HTML_MESSAGE_BOX* m_helpDialog;
};
#endif // _DIALOG_CONFIGURE_PATHS_H_

View File

@ -562,6 +562,23 @@ else()
endif()
# Create a C++ compilable string initializer containing text into a *.h file:
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dialogs/panel_setup_rules_help_txt.h
COMMAND ${CMAKE_COMMAND}
-DinputFile=${CMAKE_CURRENT_SOURCE_DIR}/dialogs/panel_setup_rules_help.txt
-DoutputFile=${CMAKE_CURRENT_BINARY_DIR}/dialogs/panel_setup_rules_help_txt.h
-P ${CMAKE_MODULE_PATH}/Txt2C.cmake
DEPENDS ${CMAKE_MODULE_PATH}/Txt2C.cmake ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/panel_setup_rules_help.txt
COMMENT "creating ${CMAKE_CURRENT_BINARY_DIR}/dialogs/panel_setup_rules_help_txt.h
from ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/panel_setup_rules_help.txt"
)
set_source_files_properties( dialogs/panel_setup_rules.cpp
PROPERTIES
OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dialogs/panel_setup_rules_help_txt.h
)
if( APPLE )
# setup bundle
set( PCBNEW_RESOURCES pcbnew.icns pcbnew_doc.icns )

View File

@ -95,10 +95,10 @@ int BOARD_CONNECTED_ITEM::GetClearance( PCB_LAYER_ID aLayer, BOARD_ITEM* aItem,
// LEVEL 1: local overrides (pad, footprint, etc.)
//
if( GetLocalClearanceOverrides() > clearance )
if( GetLocalClearanceOverrides( nullptr ) > clearance )
clearance = GetLocalClearanceOverrides( localSource );
if( second && second->GetLocalClearanceOverrides() > clearance )
if( second && second->GetLocalClearanceOverrides( nullptr ) > clearance )
clearance = second->GetLocalClearanceOverrides( localSource );
if( clearance )
@ -142,10 +142,10 @@ int BOARD_CONNECTED_ITEM::GetClearance( PCB_LAYER_ID aLayer, BOARD_ITEM* aItem,
clearance = bds.m_CopperEdgeClearance;
}
if( GetLocalClearance() > clearance )
if( GetLocalClearance( nullptr ) > clearance )
clearance = GetLocalClearance( aSource );
if( second && second->GetLocalClearance() > clearance )
if( second && second->GetLocalClearance( nullptr ) > clearance )
clearance = second->GetLocalClearance( aSource );
return clearance;

View File

@ -186,7 +186,7 @@ public:
* @param aSource [out] optionally reports the source as a user-readable string
* @return int - the clearance in internal units.
*/
virtual int GetLocalClearanceOverrides( wxString* aSource = nullptr ) const { return 0; }
virtual int GetLocalClearanceOverrides( wxString* aSource ) const { return 0; }
/**
* Function GetLocalClearance
@ -195,7 +195,7 @@ public:
* @param aSource [out] optionally reports the source as a user-readable string
* @return int - the clearance in internal units.
*/
virtual int GetLocalClearance( wxString* aSource = nullptr ) const { return 0; }
virtual int GetLocalClearance( wxString* aSource ) const { return 0; }
/**
* Function GetNetClassPtr

View File

@ -1717,17 +1717,22 @@ static struct MODULE_DESC
propMgr.AddProperty( new PROPERTY<MODULE, wxString>( _( "Value" ),
&MODULE::SetValue, &MODULE::GetValue ) );
propMgr.AddProperty( new PROPERTY<MODULE, double>( _( "Orientation" ),
&MODULE::SetOrientationDegrees, &MODULE::GetOrientationDegrees, PROPERTY_DISPLAY::DEGREE ) );
&MODULE::SetOrientationDegrees, &MODULE::GetOrientationDegrees,
PROPERTY_DISPLAY::DEGREE ) );
propMgr.AddProperty( new PROPERTY<MODULE, int>( _( "Local Clearance" ),
&MODULE::SetLocalClearance, &MODULE::GetLocalClearance, PROPERTY_DISPLAY::DISTANCE ) );
&MODULE::SetLocalClearance, &MODULE::GetLocalClearance,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<MODULE, int>( _( "Local Solderpaste Margin" ),
&MODULE::SetLocalSolderPasteMargin, &MODULE::GetLocalSolderPasteMargin, PROPERTY_DISPLAY::DISTANCE ) );
&MODULE::SetLocalSolderPasteMargin, &MODULE::GetLocalSolderPasteMargin,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<MODULE, double>( _( "Local Solderpaste Margin Ratio" ),
&MODULE::SetLocalSolderPasteMarginRatio, &MODULE::GetLocalSolderPasteMarginRatio ) );
propMgr.AddProperty( new PROPERTY<MODULE, int>( _( "Thermal Width" ),
&MODULE::SetThermalWidth, &MODULE::GetThermalWidth, PROPERTY_DISPLAY::DISTANCE ) );
&MODULE::SetThermalWidth, &MODULE::GetThermalWidth,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<MODULE, int>( _( "Thermal Gap" ),
&MODULE::SetThermalGap, &MODULE::GetThermalGap, PROPERTY_DISPLAY::DISTANCE ) );
&MODULE::SetThermalGap, &MODULE::GetThermalGap,
PROPERTY_DISPLAY::DISTANCE ) );
// TODO zone connection, FPID?
}
} _MODULE_DESC;

View File

@ -1326,47 +1326,71 @@ static struct PAD_DESC
PAD_DESC()
{
ENUM_MAP<PAD_SHAPE_T>::Instance()
.Map( PAD_SHAPE_CIRCLE, _( "Circle" ) )
.Map( PAD_SHAPE_RECT, _( "Rectangle" ) )
.Map( PAD_SHAPE_OVAL, _( "Oval" ) )
.Map( PAD_SHAPE_TRAPEZOID, _( "Trapezoid" ) )
.Map( PAD_SHAPE_ROUNDRECT, _( "Rounded Rectangle" ) )
.Map( PAD_SHAPE_CHAMFERED_RECT, _( "Chamfered Rectangle" ) )
.Map( PAD_SHAPE_CUSTOM, _( "Custom" ) );
.Map( PAD_SHAPE_CIRCLE, _( "Circle" ) )
.Map( PAD_SHAPE_RECT, _( "Rectangle" ) )
.Map( PAD_SHAPE_OVAL, _( "Oval" ) )
.Map( PAD_SHAPE_TRAPEZOID, _( "Trapezoid" ) )
.Map( PAD_SHAPE_ROUNDRECT, _( "Rounded rectangle" ) )
.Map( PAD_SHAPE_CHAMFERED_RECT, _( "Chamfered rectangle" ) )
.Map( PAD_SHAPE_CUSTOM, _( "Custom" ) );
ENUM_MAP<PAD_PROP_T>::Instance()
.Map( PAD_PROP_NONE, _( "None" ) )
.Map( PAD_PROP_BGA, _( "BGA pad" ) )
.Map( PAD_PROP_FIDUCIAL_GLBL, _( "Fiducial, global to board" ) )
.Map( PAD_PROP_FIDUCIAL_LOCAL, _( "Fiducial, local to footprint" ) )
.Map( PAD_PROP_TESTPOINT, _( "Test point pad" ) )
.Map( PAD_PROP_HEATSINK, _( "Heatsink pad" ) )
.Map( PAD_PROP_CASTELLATED, _( "Castellated pad" ) );
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( D_PAD );
propMgr.InheritsAfter( TYPE_HASH( D_PAD ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
auto shape = new PROPERTY_ENUM<D_PAD, PAD_SHAPE_T>( _( "Shape" ), &D_PAD::SetShape, &D_PAD::GetShape );
auto shape = new PROPERTY_ENUM<D_PAD, PAD_SHAPE_T>( _( "Shape" ),
&D_PAD::SetShape, &D_PAD::GetShape );
propMgr.AddProperty( shape );
propMgr.AddProperty( new PROPERTY<D_PAD, wxString>( _( "Name" ), &D_PAD::SetName, &D_PAD::GetName ) );
propMgr.AddProperty( new PROPERTY<D_PAD, wxString>( _( "Name" ),
&D_PAD::SetName, &D_PAD::GetName ) );
propMgr.AddProperty( new PROPERTY<D_PAD, double>( _( "Orientation" ),
&D_PAD::SetOrientationDegrees, &D_PAD::GetOrientationDegrees, PROPERTY_DISPLAY::DEGREE ) );
&D_PAD::SetOrientationDegrees, &D_PAD::GetOrientationDegrees,
PROPERTY_DISPLAY::DEGREE ) );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Pad To Die Length" ),
&D_PAD::SetPadToDieLength, &D_PAD::GetPadToDieLength, PROPERTY_DISPLAY::DISTANCE ) );
&D_PAD::SetPadToDieLength, &D_PAD::GetPadToDieLength,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Local Soldermask Margin" ),
&D_PAD::SetLocalSolderMaskMargin, &D_PAD::GetLocalSolderMaskMargin, PROPERTY_DISPLAY::DISTANCE ) );
&D_PAD::SetLocalSolderMaskMargin, &D_PAD::GetLocalSolderMaskMargin,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Local Solderpaste Margin" ),
&D_PAD::SetLocalSolderPasteMargin, &D_PAD::GetLocalSolderPasteMargin, PROPERTY_DISPLAY::DISTANCE ) );
&D_PAD::SetLocalSolderPasteMargin, &D_PAD::GetLocalSolderPasteMargin,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<D_PAD, double>( _( "Local Solderpaste Margin Ratio" ),
&D_PAD::SetLocalSolderPasteMarginRatio, &D_PAD::GetLocalSolderPasteMarginRatio ) );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Thermal Width" ),
&D_PAD::SetThermalWidth, &D_PAD::GetThermalWidth, PROPERTY_DISPLAY::DISTANCE ) );
&D_PAD::SetThermalWidth, &D_PAD::GetThermalWidth,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Thermal Gap" ),
&D_PAD::SetThermalGap, &D_PAD::GetThermalGap, PROPERTY_DISPLAY::DISTANCE ) );
&D_PAD::SetThermalGap, &D_PAD::GetThermalGap,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY_ENUM<D_PAD, PAD_PROP_T>( _( "Fabrication Property" ),
&D_PAD::SetProperty, &D_PAD::GetProperty ) );
auto roundRadiusRatio = new PROPERTY<D_PAD, double>( _( "Round Radius Ratio" ),
&D_PAD::SetRoundRectRadiusRatio, &D_PAD::GetRoundRectRadiusRatio );
roundRadiusRatio->SetAvailableFunc( [=](INSPECTABLE* aItem)->bool
{ return aItem->Get( shape ) == PAD_SHAPE_ROUNDRECT; } );
&D_PAD::SetRoundRectRadiusRatio, &D_PAD::GetRoundRectRadiusRatio );
roundRadiusRatio->SetAvailableFunc(
[=]( INSPECTABLE* aItem ) -> bool
{
return aItem->Get( shape ) == PAD_SHAPE_ROUNDRECT;
} );
propMgr.AddProperty( roundRadiusRatio );
//propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Local Clearance" ),
// &D_PAD::SetLocalClearance, &D_PAD::GetLocalClearance, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<D_PAD, int>( _( "Local Clearance" ),
&D_PAD::SetLocalClearance, &D_PAD::GetLocalClearance,
PROPERTY_DISPLAY::DISTANCE ) );
// TODO delta, size, drill size, dirill shape offset, layerset, zone connection
}
} _PAD_DESC;
ENUM_TO_WXANY( PAD_SHAPE_T );
ENUM_TO_WXANY( PAD_PROP_T );

View File

@ -350,7 +350,8 @@ public:
int GetLocalSolderMaskMargin() const { return m_localSolderMaskMargin; }
void SetLocalSolderMaskMargin( int aMargin ) { m_localSolderMaskMargin = aMargin; }
int GetLocalClearance( wxString* aSource = nullptr ) const override;
int GetLocalClearance( wxString* aSource ) const override;
int GetLocalClearance() const { return m_localClearance; }
void SetLocalClearance( int aClearance ) { m_localClearance = aClearance; }
int GetLocalSolderPasteMargin() const { return m_localSolderPasteMargin; }
@ -408,7 +409,7 @@ public:
* @param aSource [out] optionally reports the source as a user-readable string
* @return int - the clearance in internal units.
*/
int GetLocalClearanceOverrides( wxString* aSource = nullptr ) const override;
int GetLocalClearanceOverrides( wxString* aSource ) const override;
// Mask margins handling:

View File

@ -214,7 +214,7 @@ public:
* @param aSource [out] optionally reports the source as a user-readable string
* @return int - the clearance in internal units.
*/
int GetLocalClearance( wxString* aSource = nullptr ) const override;
int GetLocalClearance( wxString* aSource ) const override;
void GetWidthConstraints( int* aMin, int* aMax, wxString* aSource ) const;

View File

@ -1367,19 +1367,37 @@ static struct ZONE_CONTAINER_DESC
{
ZONE_CONTAINER_DESC()
{
ENUM_MAP<ZONE_CONNECTION>::Instance()
.Map( ZONE_CONNECTION::INHERITED, _( "Inherited" ) )
.Map( ZONE_CONNECTION::NONE, _( "None" ) )
.Map( ZONE_CONNECTION::THERMAL, _( "Thermal reliefs" ) )
.Map( ZONE_CONNECTION::FULL, _( "Solid" ) )
.Map( ZONE_CONNECTION::THT_THERMAL, _( "Reliefs for PTH" ) );
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( ZONE_CONTAINER );
propMgr.InheritsAfter( TYPE_HASH( ZONE_CONTAINER ), TYPE_HASH( BOARD_CONNECTED_ITEM ) );
propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, int>( _( "Clearance" ),
&ZONE_CONTAINER::SetZoneClearance, &ZONE_CONTAINER::GetZoneClearance, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, unsigned>( _( "Priority" ),
&ZONE_CONTAINER::SetPriority, &ZONE_CONTAINER::GetPriority ) );
//propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, bool>( "Filled",
//&ZONE_CONTAINER::SetIsFilled, &ZONE_CONTAINER::IsFilled ) );
propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, int>( _( "Min Thickness" ),
&ZONE_CONTAINER::SetMinThickness, &ZONE_CONTAINER::GetMinThickness, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, wxString>( _( "Name" ),
&ZONE_CONTAINER::SetZoneName, &ZONE_CONTAINER::GetZoneName ) );
// TODO pad connection, thermal relief gap, thermal relief copper bridge
propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, int>( _( "Clearance" ),
&ZONE_CONTAINER::SetLocalClearance, &ZONE_CONTAINER::GetLocalClearance,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, int>( _( "Min Width" ),
&ZONE_CONTAINER::SetMinThickness, &ZONE_CONTAINER::GetMinThickness,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY_ENUM<ZONE_CONTAINER, ZONE_CONNECTION>( _( "Pad Connections" ),
&ZONE_CONTAINER::SetPadConnection, &ZONE_CONTAINER::GetPadConnection ) );
propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, int>( _( "Thermal Clearance" ),
&ZONE_CONTAINER::SetThermalReliefGap, &ZONE_CONTAINER::GetThermalReliefGap,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, int>( _( "Thermal Spoke Width" ),
&ZONE_CONTAINER::SetThermalReliefCopperBridge, &ZONE_CONTAINER::GetThermalReliefCopperBridge,
PROPERTY_DISPLAY::DISTANCE ) );
}
} _ZONE_CONTAINER_DESC;
ENUM_TO_WXANY( ZONE_CONNECTION );

View File

@ -111,7 +111,6 @@ public:
virtual LSET GetLayerSet() const override;
wxString GetZoneName() const { return m_zoneName; }
void SetZoneName( const wxString& aName ) { m_zoneName = aName; }
/** Function GetBoundingBox (virtual)
@ -126,7 +125,10 @@ public:
* @param aSource [out] optionally reports the source as a user-readable string
* @return int - the clearance in internal units.
*/
int GetLocalClearance( wxString* aSource = nullptr ) const override;
int GetLocalClearance( wxString* aSource ) const override;
int GetLocalClearance() const { return GetLocalClearance( nullptr ); }
void SetLocalClearance( int aClearance ) { m_ZoneClearance = aClearance; }
/**
* Function IsOnCopperLayer
@ -153,8 +155,15 @@ public:
void SetFillMode( ZONE_FILL_MODE aFillMode ) { m_FillMode = aFillMode; }
ZONE_FILL_MODE GetFillMode() const { return m_FillMode; }
void SetThermalReliefGap( int aThermalReliefGap ) { m_ThermalReliefGap = aThermalReliefGap; }
int GetThermalReliefGap( D_PAD* aPad = NULL ) const;
void SetThermalReliefGap( int aThermalReliefGap )
{
if( m_ThermalReliefGap != aThermalReliefGap )
SetNeedRefill( true );
m_ThermalReliefGap = aThermalReliefGap;
}
int GetThermalReliefGap() const { return m_ThermalReliefGap; }
int GetThermalReliefGap( D_PAD* aPad ) const;
void SetThermalReliefCopperBridge( int aThermalReliefCopperBridge )
{
@ -163,7 +172,8 @@ public:
m_ThermalReliefCopperBridge = aThermalReliefCopperBridge;
}
int GetThermalReliefCopperBridge( D_PAD* aPad = NULL ) const;
int GetThermalReliefCopperBridge() const { return m_ThermalReliefCopperBridge; }
int GetThermalReliefCopperBridge( D_PAD* aPad ) const;
/**
* Compute the area currently occupied by the zone fill.
@ -194,15 +204,9 @@ public:
bool NeedRefill() const { return m_needRefill; }
void SetNeedRefill( bool aNeedRefill ) { m_needRefill = aNeedRefill; }
int GetZoneClearance() const { return m_ZoneClearance; }
void SetZoneClearance( int aZoneClearance ) { m_ZoneClearance = aZoneClearance; }
ZONE_CONNECTION GetPadConnection( D_PAD* aPad = NULL ) const;
void SetPadConnection( ZONE_CONNECTION aPadConnection )
{
m_PadConnection = aPadConnection;
}
ZONE_CONNECTION GetPadConnection( D_PAD* aPad ) const;
ZONE_CONNECTION GetPadConnection() const { return m_PadConnection; }
void SetPadConnection( ZONE_CONNECTION aPadConnection ) { m_PadConnection = aPadConnection; }
int GetMinThickness() const { return m_ZoneMinThickness; }
void SetMinThickness( int aMinThickness )

View File

@ -555,7 +555,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_middleBoxSizer->Add( 0, 2, 0, wxEXPAND, 5 );
wxString m_choiceFabPropertyChoices[] = { _("None"), _("BGA pad"), _("Fiducial, local to footprint"), _("Fiducial, global to board"), _("Test Point Pad"), _("Heatsink pad"), _("Castellated pad (through hole only)") };
wxString m_choiceFabPropertyChoices[] = { _("None"), _("BGA pad"), _("Fiducial, local to footprint"), _("Fiducial, global to board"), _("Test point pad"), _("Heatsink pad"), _("Castellated pad (through hole only)") };
int m_choiceFabPropertyNChoices = sizeof( m_choiceFabPropertyChoices ) / sizeof( wxString );
m_choiceFabProperty = new wxChoice( m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceFabPropertyNChoices, m_choiceFabPropertyChoices, 0 );
m_choiceFabProperty->SetSelection( 0 );

View File

@ -6766,7 +6766,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;None&quot; &quot;BGA pad&quot; &quot;Fiducial, local to footprint&quot; &quot;Fiducial, global to board&quot; &quot;Test Point Pad&quot; &quot;Heatsink pad&quot; &quot;Castellated pad (through hole only)&quot;</property>
<property name="choices">&quot;None&quot; &quot;BGA pad&quot; &quot;Fiducial, local to footprint&quot; &quot;Fiducial, global to board&quot; &quot;Test point pad&quot; &quot;Heatsink pad&quot; &quot;Castellated pad (through hole only)&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>

View File

@ -39,7 +39,8 @@ PANEL_SETUP_RULES::PANEL_SETUP_RULES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFr
PANEL_SETUP_RULES_BASE( aParent->GetTreebook() ),
m_Parent( aParent ),
m_frame( aFrame ),
m_scintillaTricks( nullptr )
m_scintillaTricks( nullptr ),
m_helpDialog( nullptr )
{
m_scintillaTricks = new SCINTILLA_TRICKS( m_textEditor, wxT( "()" ) );
@ -62,6 +63,9 @@ PANEL_SETUP_RULES::PANEL_SETUP_RULES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFr
PANEL_SETUP_RULES::~PANEL_SETUP_RULES( )
{
delete m_scintillaTricks;
if( m_helpDialog )
m_helpDialog->Destroy();
};
@ -380,68 +384,17 @@ bool PANEL_SETUP_RULES::TransferDataFromWindow()
void PANEL_SETUP_RULES::OnSyntaxHelp( wxHyperlinkEvent& aEvent )
{
// Do not make this full sentence translatable: it contains keywords
// Only a few titles can be traslated.
wxString msg;
msg << "<b>" << _( "Top-level Clauses" ) << "</b>";
msg << "<pre>"
"# version must be first clause in file\r"
"(version &lt;number>)\r"
"(rule &lt;rule_name> &lt;rule_clause> ...)\r"
"\r</pre><b>";
msg << _( "Rule Clauses" );
msg << "</b>"
"<pre>"
"(constraint &lt;constraint_type> ...)\r"
"(condition \"&lt;expression>\")\r"
"(layer \"&lt;layer name>\")\r"
"\r</pre>"
"<b>";
msg << _( "Constraint Types" );
msg << "</b>"
"<pre>"
"clearance annulus_width track_width hole dissallow\r"
"\r</pre>"
"<b>";
msg << _( "Item Types" );
msg << "</b>"
"<pre>"
"track via zone\r"
"pad micro_via text\r"
"hole buried_via graphic\r"
"\r</pre>"
"<b>";
msg << _( "Examples" );
msg << "</b>"
"<pre>"
"(rule \"copper keepout\"\r"
" (constraint disallow track via zone)\r"
" (condition \"A.insideArea('zone_name')\"))\r"
"\r"
"(rule \"BGA neckdown\"\r"
" (constraint track_width (min 0.2mm) (opt 0.25mm))\r"
" (constraint clearance (min 0.05) (opt 0.08mm))\r"
" (condition \"A.insideCourtyard('U3')\"))\r"
"\r"
"(rule HV\r"
" (constraint clearance (min 1.5mm))\r"
" (condition \"A.netclass == 'HV'\"))\r"
"\r"
"(rule HV_HV\r"
" # wider clearance between HV tracks\r"
" (constraint clearance (min \"1.5mm + 2.0mm\"))\r"
" (condition \"A.netclass == 'HV' && B.netclass == 'HV'\"))\r"
"\r"
wxString msg =
#include "dialogs/panel_setup_rules_help_txt.h"
;
#ifdef __WXMAC__
"# Use Cmd+/ to comment or uncomment line(s)\r"
#else
"# Use Ctrl+/ to comment or uncomment line(s)\r"
msg.Replace( "Ctrl+", "Cmd+" );
#endif
"</pre>";
HTML_MESSAGE_BOX* dlg = new HTML_MESSAGE_BOX( nullptr, _( "Syntax Help" ) );
dlg->SetDialogSizeInDU( 320, 320 );
m_helpDialog = new HTML_MESSAGE_BOX( nullptr, _( "Syntax Help" ) );
m_helpDialog->SetDialogSizeInDU( 320, 320 );
dlg->AddHTML_Text( msg );
dlg->ShowModeless();
m_helpDialog->AddHTML_Text( "<pre>" + EscapedHTML( msg ) + "</pre>" );
m_helpDialog->ShowModeless();
}

View File

@ -32,6 +32,7 @@ class DRC;
class PAGED_DIALOG;
class PCB_EDIT_FRAME;
class SCINTILLA_TRICKS;
class HTML_MESSAGE_BOX;
class PANEL_SETUP_RULES : public PANEL_SETUP_RULES_BASE
@ -45,6 +46,8 @@ private:
wxRegEx m_netClassRegex;
wxRegEx m_netNameRegex;
HTML_MESSAGE_BOX* m_helpDialog;
public:
PANEL_SETUP_RULES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame );
~PANEL_SETUP_RULES( ) override;

View File

@ -0,0 +1,78 @@
# ---- Top-level Clauses
(version <number>)
(rule <rule_name> <rule_clause> ...)
# ---- Rule Clauses
(constraint <constraint_type> ...)
(condition "<expression>")
(layer "<layer_name>")
# ---- Constraint Types
clearance annulus_width track_width hole dissallow
# ---- Item Types
track via micro_via buried_via
pad hole graphic text zone
# ---- Examples
(rule "copper keepout"
(constraint disallow track via zone)
(condition "A.insideArea('zone3')"))
(rule "BGA neckdown"
(constraint track_width (min 0.2mm) (opt 0.25mm))
(constraint clearance (min 0.05) (opt 0.08mm))
(condition "A.insideCourtyard('U3')"))
(rule HV
(constraint clearance (min 1.5mm))
(condition "A.netclass == 'HV'"))
(rule HV_HV
# wider clearance between HV tracks
(constraint clearance (min "1.5mm + 2.0mm"))
(condition "A.netclass == 'HV' && B.netclass == 'HV'"))
# ---- Notes
#
# Version clause must be first clause in file.
#
# Use Ctrl+/ to comment or uncomment line(s).
#
# ---- Expression functions
#
# All function parameters support simple wildcards ('*' and '?').
#
# True if any part of A lies within the given footprint's courtyard.
A.insideCourtyard('<footprint_refdes>')
# True if any part of A lies within the given zone's outline.
A.insideArea('<zone_name>')
# True if A has a hole which is plated.
A.isPlated()
# True if 'A' exists on the given layer. The layer name can be
# either the name assigned in Board Setup > Board Editor Layers or
# the canonical name (ie: F.Cu).
A.onLayer('<layer_name>')

View File

@ -442,12 +442,18 @@ LSET DRC_RULES_PARSER::parseLayer()
else
{
wxString layerName = FromUTF8();
PCB_LAYER_ID layer = ENUM_MAP<PCB_LAYER_ID>::Instance().ToEnum( layerName );
wxPGChoices& layerMap = ENUM_MAP<PCB_LAYER_ID>::Instance().Choices();
if( layer == UNDEFINED_LAYER )
for( unsigned ii = 0; ii < layerMap.GetCount(); ++ii )
{
wxPGChoiceEntry& entry = layerMap[ii];
if( entry.GetText().Matches( layerName ) )
retVal.set( ToLAYER_ID( entry.GetValue() ) );
}
if( !retVal.any() )
reportError( wxString::Format( _( "Unrecognized layer '%s' " ), layerName ) );
retVal.set( layer );
}
if( (int) NextTok() != DSN_RIGHT )

View File

@ -1348,9 +1348,9 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
std::max<int>( ZONE_THICKNESS_MIN_VALUE_MIL * IU_PER_MILS, p.width.ToPcbUnits() / 2 ) );
if( p.isolate )
zone->SetZoneClearance( p.isolate->ToPcbUnits() );
zone->SetLocalClearance( p.isolate->ToPcbUnits() );
else
zone->SetZoneClearance( 1 ); // @todo: set minimum clearance value based on board settings
zone->SetLocalClearance( 1 ); // @todo: set minimum clearance value based on board settings
// missing == yes per DTD.
bool thermals = !p.thermals || *p.thermals;

View File

@ -1740,7 +1740,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
}
m_out->Print( 0, " (clearance %s))\n",
FormatInternalUnits( aZone->GetZoneClearance() ).c_str() );
FormatInternalUnits( aZone->GetLocalClearance() ).c_str() );
m_out->Print( aNestLevel+1, "(min_thickness %s)",
FormatInternalUnits( aZone->GetMinThickness() ).c_str() );

View File

@ -2632,7 +2632,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
THROW_IO_ERROR( m_error );
}
zc->SetZoneClearance( clearance );
zc->SetLocalClearance( clearance );
zc->SetPadConnection( popt );
}

View File

@ -198,7 +198,7 @@ void PCB_POLYGON::AddToBoard()
KiROUND( m_outline[i]->y ) ), -1 );
}
zone->SetZoneClearance( m_width );
zone->SetLocalClearance( m_width );
zone->SetPriority( m_priority );

View File

@ -31,12 +31,18 @@
static void onLayer( LIBEVAL::CONTEXT* aCtx, void *self )
{
LIBEVAL::VALUE* arg = aCtx->Pop();
LIBEVAL::VALUE* result = aCtx->AllocValue();
PCB_EXPR_VAR_REF* vref = static_cast<PCB_EXPR_VAR_REF*>( self );
BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
LIBEVAL::VALUE* arg = aCtx->Pop();
LIBEVAL::VALUE* result = aCtx->AllocValue();
result->Set( 0.0 );
aCtx->Push( result );
if( !item )
return;
if( !arg )
{
aCtx->ReportError( wxString::Format( _( "Missing argument to '%s'" ),
@ -45,19 +51,27 @@ static void onLayer( LIBEVAL::CONTEXT* aCtx, void *self )
}
wxString layerName = arg->AsString();
PCB_LAYER_ID layer = ENUM_MAP<PCB_LAYER_ID>::Instance().ToEnum( layerName );
wxPGChoices& layerMap = ENUM_MAP<PCB_LAYER_ID>::Instance().Choices();
bool anyMatch = false;
if( layer == UNDEFINED_LAYER )
for( unsigned ii = 0; ii < layerMap.GetCount(); ++ii )
{
aCtx->ReportError( wxString::Format( _( "Unrecognized layer '%s' " ), layerName ) );
return;
wxPGChoiceEntry& entry = layerMap[ii];
if( entry.GetText().Matches( layerName ) )
{
anyMatch = true;
if( item->IsOnLayer( ToLAYER_ID( entry.GetValue() ) ) )
{
result->Set( 1.0 );
return;
}
}
}
PCB_EXPR_VAR_REF* vref = static_cast<PCB_EXPR_VAR_REF*>( self );
BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
if( item && item->IsOnLayer( layer ) )
result->Set( 1.0 );
if( !anyMatch )
aCtx->ReportError( wxString::Format( _( "Unrecognized layer '%s' " ), layerName ) );
}

View File

@ -4114,7 +4114,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent )
break;
case T_clearance:
zone->SetZoneClearance( parseBoardUnits( "zone clearance" ) );
zone->SetLocalClearance( parseBoardUnits( "zone clearance" ) );
NeedRIGHT();
break;

View File

@ -1284,7 +1284,7 @@ void ALTIUM_PCB::ParsePolygons6Data(
if( clearanceRule != nullptr )
{
zone->SetZoneClearance( clearanceRule->planeclearanceClearance );
zone->SetLocalClearance( clearanceRule->planeclearanceClearance );
}
const ARULE6* polygonConnectRule = GetRuleDefault( ALTIUM_RULE_KIND::POLYGON_CONNECT );
@ -2426,7 +2426,7 @@ void ALTIUM_PCB::ParseFills6Data(
zone->AppendCorner( p21, outlineIdx );
// should be correct?
zone->SetZoneClearance( 0 );
zone->SetLocalClearance( 0 );
zone->SetPadConnection( ZONE_CONNECTION::FULL );
if( elem.is_keepout )

View File

@ -831,15 +831,15 @@ void APPEARANCE_CONTROLS::OnLayerChanged()
if( r < 240 || g < 240 || b < 240 )
{
r = std::min( r + 15, 255 );
g = std::min( g + 15, 255 );
b = std::min( b + 15, 255 );
r = wxChar( std::min( (int) r + 15, 255 ) );
g = wxChar( std::min( (int) g + 15, 255 ) );
b = wxChar( std::min( (int) b + 15, 255 ) );
}
else
{
r = std::max( r - 15, 0 );
g = std::max( g - 15, 0 );
b = std::max( b - 15, 0 );
r = wxChar( std::max( (int) r - 15, 0 ) );
g = wxChar( std::max( (int) g - 15, 0 ) );
b = wxChar( std::max( (int) b - 15, 0 ) );
}
PCB_LAYER_ID current = m_frame->GetActiveLayer();

View File

@ -1012,7 +1012,7 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE_CONTAINER* aZone, PCB_LAYER_ID
std::deque<SHAPE_LINE_CHAIN>& aSpokesList )
{
auto zoneBB = aZone->GetBoundingBox();
int zone_clearance = aZone->GetZoneClearance();
int zone_clearance = aZone->GetLocalClearance();
int biggest_clearance = m_board->GetDesignSettings().GetBiggestClearanceValue();
biggest_clearance = std::max( biggest_clearance, zone_clearance );
zoneBB.Inflate( biggest_clearance );

View File

@ -93,7 +93,7 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource )
{
m_ZonePriority = aSource.GetPriority();
m_FillMode = aSource.GetFillMode();
m_ZoneClearance = aSource.GetZoneClearance();
m_ZoneClearance = aSource.GetLocalClearance();
m_ZoneMinThickness = aSource.GetMinThickness();
m_HatchThickness = aSource.GetHatchThickness();
m_HatchGap = aSource.GetHatchGap();
@ -129,7 +129,7 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource )
void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) const
{
aTarget.SetFillMode( m_FillMode );
aTarget.SetZoneClearance( m_ZoneClearance );
aTarget.SetLocalClearance( m_ZoneClearance );
aTarget.SetMinThickness( m_ZoneMinThickness );
aTarget.SetHatchThickness( m_HatchThickness );
aTarget.SetHatchGap( m_HatchGap );

View File

@ -178,7 +178,7 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test )
if( area_to_test->GetThermalReliefCopperBridge() != area2->GetThermalReliefCopperBridge() )
continue;
if( area_to_test->GetZoneClearance() != area2->GetZoneClearance() )
if( area_to_test->GetLocalClearance() != area2->GetLocalClearance() )
continue;
if( area_to_test->GetPadConnection() != area2->GetPadConnection() )