diff --git a/.gitignore b/.gitignore index e444e8e9ac..fffd3eb3a0 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/CMakeModules/Txt2C.cmake b/CMakeModules/Txt2C.cmake new file mode 100644 index 0000000000..7be185b9ca --- /dev/null +++ b/CMakeModules/Txt2C.cmake @@ -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}" ) diff --git a/common/dialogs/dialog_configure_paths.cpp b/common/dialogs/dialog_configure_paths.cpp index 89a074b259..ae51f31bcb 100644 --- a/common/dialogs/dialog_configure_paths.cpp +++ b/common/dialogs/dialog_configure_paths.cpp @@ -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 ); } diff --git a/eeschema/dialogs/dialog_edit_label.cpp b/eeschema/dialogs/dialog_edit_label.cpp index 8da292aeef..c8520823e4 100644 --- a/eeschema/dialogs/dialog_edit_label.cpp +++ b/eeschema/dialogs/dialog_edit_label.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -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 ); } diff --git a/eeschema/dialogs/dialog_edit_label.h b/eeschema/dialogs/dialog_edit_label.h index c36db76357..8652156662 100644 --- a/eeschema/dialogs/dialog_edit_label.h +++ b/eeschema/dialogs/dialog_edit_label.h @@ -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; }; diff --git a/eeschema/dialogs/dialog_edit_sheet_pin.cpp b/eeschema/dialogs/dialog_edit_sheet_pin.cpp index 1c4a8d0965..962293166c 100644 --- a/eeschema/dialogs/dialog_edit_sheet_pin.cpp +++ b/eeschema/dialogs/dialog_edit_sheet_pin.cpp @@ -26,6 +26,7 @@ #include #include #include +#include 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 ); } diff --git a/eeschema/dialogs/dialog_edit_sheet_pin.h b/eeschema/dialogs/dialog_edit_sheet_pin.h index b65d875f75..58241259e9 100644 --- a/eeschema/dialogs/dialog_edit_sheet_pin.h +++ b/eeschema/dialogs/dialog_edit_sheet_pin.h @@ -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; diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 1e0f6ff6d7..0216dff2ed 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -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 = _( "" @@ -1365,4 +1365,6 @@ void SCH_TEXT::ShowSyntaxHelp( wxWindow* aParentWindow ) dlg->AddHTML_Text( msg ); dlg->ShowModeless(); + + return dlg; } diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 2e9066027b..b9d59303f9 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -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 ); }; diff --git a/include/dialog_configure_paths.h b/include/dialog_configure_paths.h index 1d0a0153fc..3f8051a076 100644 --- a/include/dialog_configure_paths.h +++ b/include/dialog_configure_paths.h @@ -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_ diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 75108be774..41f85c8e92 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -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 ) diff --git a/pcbnew/board_connected_item.cpp b/pcbnew/board_connected_item.cpp index dbbebbd46f..54e43756ce 100644 --- a/pcbnew/board_connected_item.cpp +++ b/pcbnew/board_connected_item.cpp @@ -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; diff --git a/pcbnew/board_connected_item.h b/pcbnew/board_connected_item.h index fd8068092a..1f1bb3a7a0 100644 --- a/pcbnew/board_connected_item.h +++ b/pcbnew/board_connected_item.h @@ -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 diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 9a1be08c6b..b84471296a 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -1717,17 +1717,22 @@ static struct MODULE_DESC propMgr.AddProperty( new PROPERTY( _( "Value" ), &MODULE::SetValue, &MODULE::GetValue ) ); propMgr.AddProperty( new PROPERTY( _( "Orientation" ), - &MODULE::SetOrientationDegrees, &MODULE::GetOrientationDegrees, PROPERTY_DISPLAY::DEGREE ) ); + &MODULE::SetOrientationDegrees, &MODULE::GetOrientationDegrees, + PROPERTY_DISPLAY::DEGREE ) ); propMgr.AddProperty( new PROPERTY( _( "Local Clearance" ), - &MODULE::SetLocalClearance, &MODULE::GetLocalClearance, PROPERTY_DISPLAY::DISTANCE ) ); + &MODULE::SetLocalClearance, &MODULE::GetLocalClearance, + PROPERTY_DISPLAY::DISTANCE ) ); propMgr.AddProperty( new PROPERTY( _( "Local Solderpaste Margin" ), - &MODULE::SetLocalSolderPasteMargin, &MODULE::GetLocalSolderPasteMargin, PROPERTY_DISPLAY::DISTANCE ) ); + &MODULE::SetLocalSolderPasteMargin, &MODULE::GetLocalSolderPasteMargin, + PROPERTY_DISPLAY::DISTANCE ) ); propMgr.AddProperty( new PROPERTY( _( "Local Solderpaste Margin Ratio" ), &MODULE::SetLocalSolderPasteMarginRatio, &MODULE::GetLocalSolderPasteMarginRatio ) ); propMgr.AddProperty( new PROPERTY( _( "Thermal Width" ), - &MODULE::SetThermalWidth, &MODULE::GetThermalWidth, PROPERTY_DISPLAY::DISTANCE ) ); + &MODULE::SetThermalWidth, &MODULE::GetThermalWidth, + PROPERTY_DISPLAY::DISTANCE ) ); propMgr.AddProperty( new PROPERTY( _( "Thermal Gap" ), - &MODULE::SetThermalGap, &MODULE::GetThermalGap, PROPERTY_DISPLAY::DISTANCE ) ); + &MODULE::SetThermalGap, &MODULE::GetThermalGap, + PROPERTY_DISPLAY::DISTANCE ) ); // TODO zone connection, FPID? } } _MODULE_DESC; diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 2e0c91fcae..9fef402389 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -1326,47 +1326,71 @@ static struct PAD_DESC PAD_DESC() { ENUM_MAP::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::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( _( "Shape" ), &D_PAD::SetShape, &D_PAD::GetShape ); + auto shape = new PROPERTY_ENUM( _( "Shape" ), + &D_PAD::SetShape, &D_PAD::GetShape ); propMgr.AddProperty( shape ); - propMgr.AddProperty( new PROPERTY( _( "Name" ), &D_PAD::SetName, &D_PAD::GetName ) ); + propMgr.AddProperty( new PROPERTY( _( "Name" ), + &D_PAD::SetName, &D_PAD::GetName ) ); propMgr.AddProperty( new PROPERTY( _( "Orientation" ), - &D_PAD::SetOrientationDegrees, &D_PAD::GetOrientationDegrees, PROPERTY_DISPLAY::DEGREE ) ); + &D_PAD::SetOrientationDegrees, &D_PAD::GetOrientationDegrees, + PROPERTY_DISPLAY::DEGREE ) ); propMgr.AddProperty( new PROPERTY( _( "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( _( "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( _( "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( _( "Local Solderpaste Margin Ratio" ), &D_PAD::SetLocalSolderPasteMarginRatio, &D_PAD::GetLocalSolderPasteMarginRatio ) ); propMgr.AddProperty( new PROPERTY( _( "Thermal Width" ), - &D_PAD::SetThermalWidth, &D_PAD::GetThermalWidth, PROPERTY_DISPLAY::DISTANCE ) ); + &D_PAD::SetThermalWidth, &D_PAD::GetThermalWidth, + PROPERTY_DISPLAY::DISTANCE ) ); propMgr.AddProperty( new PROPERTY( _( "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( _( "Fabrication Property" ), + &D_PAD::SetProperty, &D_PAD::GetProperty ) ); auto roundRadiusRatio = new PROPERTY( _( "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( _( "Local Clearance" ), - // &D_PAD::SetLocalClearance, &D_PAD::GetLocalClearance, PROPERTY_DISPLAY::DISTANCE ) ); + propMgr.AddProperty( new PROPERTY( _( "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 ); diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index b951c589d7..6f1ed1efab 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -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: diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 50f223ea8f..093d81c44d 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -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; diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 6aba983d04..880e78f209 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -1367,19 +1367,37 @@ static struct ZONE_CONTAINER_DESC { ZONE_CONTAINER_DESC() { + ENUM_MAP::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( _( "Clearance" ), - &ZONE_CONTAINER::SetZoneClearance, &ZONE_CONTAINER::GetZoneClearance, PROPERTY_DISPLAY::DISTANCE ) ); propMgr.AddProperty( new PROPERTY( _( "Priority" ), &ZONE_CONTAINER::SetPriority, &ZONE_CONTAINER::GetPriority ) ); //propMgr.AddProperty( new PROPERTY( "Filled", //&ZONE_CONTAINER::SetIsFilled, &ZONE_CONTAINER::IsFilled ) ); - propMgr.AddProperty( new PROPERTY( _( "Min Thickness" ), - &ZONE_CONTAINER::SetMinThickness, &ZONE_CONTAINER::GetMinThickness, PROPERTY_DISPLAY::DISTANCE ) ); propMgr.AddProperty( new PROPERTY( _( "Name" ), &ZONE_CONTAINER::SetZoneName, &ZONE_CONTAINER::GetZoneName ) ); - // TODO pad connection, thermal relief gap, thermal relief copper bridge + propMgr.AddProperty( new PROPERTY( _( "Clearance" ), + &ZONE_CONTAINER::SetLocalClearance, &ZONE_CONTAINER::GetLocalClearance, + PROPERTY_DISPLAY::DISTANCE ) ); + propMgr.AddProperty( new PROPERTY( _( "Min Width" ), + &ZONE_CONTAINER::SetMinThickness, &ZONE_CONTAINER::GetMinThickness, + PROPERTY_DISPLAY::DISTANCE ) ); + propMgr.AddProperty( new PROPERTY_ENUM( _( "Pad Connections" ), + &ZONE_CONTAINER::SetPadConnection, &ZONE_CONTAINER::GetPadConnection ) ); + propMgr.AddProperty( new PROPERTY( _( "Thermal Clearance" ), + &ZONE_CONTAINER::SetThermalReliefGap, &ZONE_CONTAINER::GetThermalReliefGap, + PROPERTY_DISPLAY::DISTANCE ) ); + propMgr.AddProperty( new PROPERTY( _( "Thermal Spoke Width" ), + &ZONE_CONTAINER::SetThermalReliefCopperBridge, &ZONE_CONTAINER::GetThermalReliefCopperBridge, + PROPERTY_DISPLAY::DISTANCE ) ); } } _ZONE_CONTAINER_DESC; + +ENUM_TO_WXANY( ZONE_CONNECTION ); diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index f01b41869c..65077e631e 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -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 ) diff --git a/pcbnew/dialogs/dialog_pad_properties_base.cpp b/pcbnew/dialogs/dialog_pad_properties_base.cpp index 620d5c3d03..91513283a8 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.cpp +++ b/pcbnew/dialogs/dialog_pad_properties_base.cpp @@ -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 ); diff --git a/pcbnew/dialogs/dialog_pad_properties_base.fbp b/pcbnew/dialogs/dialog_pad_properties_base.fbp index 643c6f5299..bb2ae3897b 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.fbp +++ b/pcbnew/dialogs/dialog_pad_properties_base.fbp @@ -6766,7 +6766,7 @@ 1 0 - "None" "BGA pad" "Fiducial, local to footprint" "Fiducial, global to board" "Test Point Pad" "Heatsink pad" "Castellated pad (through hole only)" + "None" "BGA pad" "Fiducial, local to footprint" "Fiducial, global to board" "Test point pad" "Heatsink pad" "Castellated pad (through hole only)" 1 1 diff --git a/pcbnew/dialogs/panel_setup_rules.cpp b/pcbnew/dialogs/panel_setup_rules.cpp index 69306d0ec3..50ca904863 100644 --- a/pcbnew/dialogs/panel_setup_rules.cpp +++ b/pcbnew/dialogs/panel_setup_rules.cpp @@ -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 << "" << _( "Top-level Clauses" ) << ""; - msg << "
"
-            "# version must be first clause in file\r"
-            "(version <number>)\r"
-            "(rule <rule_name> <rule_clause> ...)\r"
-            "\r
"; - msg << _( "Rule Clauses" ); - msg << "" - "
"
-            "(constraint <constraint_type> ...)\r"
-            "(condition \"<expression>\")\r"
-            "(layer \"<layer name>\")\r"
-            "\r
" - ""; - msg << _( "Constraint Types" ); - msg << "" - "
"
-            "clearance    annulus_width   track_width     hole     dissallow\r"
-            "\r
" - ""; - msg << _( "Item Types" ); - msg << "" - "
"
-            "track           via                 zone\r"
-            "pad             micro_via           text\r"
-            "hole            buried_via          graphic\r"
-            "\r
" - ""; - msg << _( "Examples" ); - msg << "" - "
"
-            "(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
-            "
"; - 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( "
" + EscapedHTML( msg ) + "
" ); + m_helpDialog->ShowModeless(); } diff --git a/pcbnew/dialogs/panel_setup_rules.h b/pcbnew/dialogs/panel_setup_rules.h index 5b984f3916..6819856c70 100644 --- a/pcbnew/dialogs/panel_setup_rules.h +++ b/pcbnew/dialogs/panel_setup_rules.h @@ -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; diff --git a/pcbnew/dialogs/panel_setup_rules_help.txt b/pcbnew/dialogs/panel_setup_rules_help.txt new file mode 100644 index 0000000000..5938a8956a --- /dev/null +++ b/pcbnew/dialogs/panel_setup_rules_help.txt @@ -0,0 +1,78 @@ +# ---- Top-level Clauses + +(version ) +(rule ...) + + +# ---- Rule Clauses + +(constraint ...) +(condition "") +(layer "") + + +# ---- 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('') + + +# True if any part of A lies within the given zone's outline. + +A.insideArea('') + + +# 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('') diff --git a/pcbnew/drc/drc_rule_parser.cpp b/pcbnew/drc/drc_rule_parser.cpp index af718678ab..ce367534e2 100644 --- a/pcbnew/drc/drc_rule_parser.cpp +++ b/pcbnew/drc/drc_rule_parser.cpp @@ -442,12 +442,18 @@ LSET DRC_RULES_PARSER::parseLayer() else { wxString layerName = FromUTF8(); - PCB_LAYER_ID layer = ENUM_MAP::Instance().ToEnum( layerName ); + wxPGChoices& layerMap = ENUM_MAP::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 ) diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index e09316282f..4ecb9ae1fe 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -1348,9 +1348,9 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode ) std::max( 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; diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 82093b4980..5a546b8fac 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -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() ); diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index a7e022b488..db1282b204 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -2632,7 +2632,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() THROW_IO_ERROR( m_error ); } - zc->SetZoneClearance( clearance ); + zc->SetLocalClearance( clearance ); zc->SetPadConnection( popt ); } diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp index 2ea28ff945..4477720745 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp @@ -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 ); diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index df40db91fd..ccdf646706 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -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( 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::Instance().ToEnum( layerName ); + wxPGChoices& layerMap = ENUM_MAP::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( 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 ) ); } diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index bef222595d..6654a2daf6 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -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; diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index 71f34ac3c0..134e09762f 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -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 ) diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index 4e07c2e99b..d3173672a0 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -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(); diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 6b74c044dd..944f0ab602 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -1012,7 +1012,7 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE_CONTAINER* aZone, PCB_LAYER_ID std::deque& 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 ); diff --git a/pcbnew/zone_settings.cpp b/pcbnew/zone_settings.cpp index 6b1210fe0b..662af86e08 100644 --- a/pcbnew/zone_settings.cpp +++ b/pcbnew/zone_settings.cpp @@ -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 ); diff --git a/pcbnew/zones_test_and_combine_areas.cpp b/pcbnew/zones_test_and_combine_areas.cpp index dbf1a818e7..90bae36ed5 100644 --- a/pcbnew/zones_test_and_combine_areas.cpp +++ b/pcbnew/zones_test_and_combine_areas.cpp @@ -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() )