Convert DRC rules syntax help to markdown
Note, the original markdown spec specifies using 4 spaces to indent a code block (https://daringfireball.net/projects/markdown/syntax) Wrapping with three backticks doesn't work with this lib. Wrapping with a single backtick for span elements works ok.
This commit is contained in:
parent
7c46cb0a05
commit
42496a7d62
|
@ -24,7 +24,7 @@ common/template_fieldnames_lexer.h
|
||||||
eeschema/schematic_keywords.*
|
eeschema/schematic_keywords.*
|
||||||
pcbnew/pcb_plot_params_keywords.cpp
|
pcbnew/pcb_plot_params_keywords.cpp
|
||||||
pcbnew/pcb_plot_params_lexer.h
|
pcbnew/pcb_plot_params_lexer.h
|
||||||
pcbnew/dialogs/panel_setup_rules_help_txt.h
|
pcbnew/dialogs/panel_setup_rules_help_md.h
|
||||||
Makefile
|
Makefile
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
auto_renamed_to_cpp
|
auto_renamed_to_cpp
|
||||||
|
@ -109,4 +109,3 @@ CMakeSettings.json
|
||||||
# KDevelop
|
# KDevelop
|
||||||
.kdev4/
|
.kdev4/
|
||||||
*.kdev4
|
*.kdev4
|
||||||
|
|
||||||
|
|
|
@ -585,21 +585,21 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Create a C++ compilable string initializer containing text into a *.h file:
|
# Create a C++ compilable string initializer containing markdown text into a *.h file:
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dialogs/panel_setup_rules_help_txt.h
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dialogs/panel_setup_rules_help_md.h
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DinputFile=${CMAKE_CURRENT_SOURCE_DIR}/dialogs/panel_setup_rules_help.txt
|
-DinputFile=${CMAKE_CURRENT_SOURCE_DIR}/dialogs/panel_setup_rules_help.md
|
||||||
-DoutputFile=${CMAKE_CURRENT_BINARY_DIR}/dialogs/panel_setup_rules_help_txt.h
|
-DoutputFile=${CMAKE_CURRENT_BINARY_DIR}/dialogs/panel_setup_rules_help_md.h
|
||||||
-P ${CMAKE_MODULE_PATH}/Txt2C.cmake
|
-P ${CMAKE_MODULE_PATH}/markdown2C.cmake
|
||||||
DEPENDS ${CMAKE_MODULE_PATH}/Txt2C.cmake ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/panel_setup_rules_help.txt
|
DEPENDS ${CMAKE_MODULE_PATH}/markdown2C.cmake ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/panel_setup_rules_help.md
|
||||||
COMMENT "creating ${CMAKE_CURRENT_BINARY_DIR}/dialogs/panel_setup_rules_help_txt.h
|
COMMENT "creating ${CMAKE_CURRENT_BINARY_DIR}/dialogs/panel_setup_rules_help_md.h
|
||||||
from ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/panel_setup_rules_help.txt"
|
from ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/panel_setup_rules_help.md"
|
||||||
)
|
)
|
||||||
|
|
||||||
set_source_files_properties( dialogs/panel_setup_rules.cpp
|
set_source_files_properties( dialogs/panel_setup_rules.cpp
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dialogs/panel_setup_rules_help_txt.h
|
OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dialogs/panel_setup_rules_help_md.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if( APPLE )
|
if( APPLE )
|
||||||
|
@ -723,6 +723,7 @@ set( PCBNEW_KIFACE_LIBRARIES
|
||||||
tinyspline_lib
|
tinyspline_lib
|
||||||
idf3
|
idf3
|
||||||
nanosvg
|
nanosvg
|
||||||
|
markdown_lib
|
||||||
${PCBNEW_IO_LIBRARIES}
|
${PCBNEW_IO_LIBRARIES}
|
||||||
${wxWidgets_LIBRARIES}
|
${wxWidgets_LIBRARIES}
|
||||||
${GITHUB_PLUGIN_LIBRARIES}
|
${GITHUB_PLUGIN_LIBRARIES}
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <scintilla_tricks.h>
|
#include <scintilla_tricks.h>
|
||||||
#include <drc/drc_rule_parser.h>
|
#include <drc/drc_rule_parser.h>
|
||||||
#include <tools/drc_tool.h>
|
#include <tools/drc_tool.h>
|
||||||
|
#include <dialog_helpers.h>
|
||||||
|
|
||||||
PANEL_SETUP_RULES::PANEL_SETUP_RULES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ) :
|
PANEL_SETUP_RULES::PANEL_SETUP_RULES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ) :
|
||||||
PANEL_SETUP_RULES_BASE( aParent->GetTreebook() ),
|
PANEL_SETUP_RULES_BASE( aParent->GetTreebook() ),
|
||||||
|
@ -440,7 +441,7 @@ bool PANEL_SETUP_RULES::TransferDataFromWindow()
|
||||||
void PANEL_SETUP_RULES::OnSyntaxHelp( wxHyperlinkEvent& aEvent )
|
void PANEL_SETUP_RULES::OnSyntaxHelp( wxHyperlinkEvent& aEvent )
|
||||||
{
|
{
|
||||||
wxString msg =
|
wxString msg =
|
||||||
#include "dialogs/panel_setup_rules_help_txt.h"
|
#include "dialogs/panel_setup_rules_help_md.h"
|
||||||
;
|
;
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
|
@ -450,6 +451,9 @@ void PANEL_SETUP_RULES::OnSyntaxHelp( wxHyperlinkEvent& aEvent )
|
||||||
m_helpDialog = new HTML_MESSAGE_BOX( nullptr, _( "Syntax Help" ) );
|
m_helpDialog = new HTML_MESSAGE_BOX( nullptr, _( "Syntax Help" ) );
|
||||||
m_helpDialog->SetDialogSizeInDU( 320, 320 );
|
m_helpDialog->SetDialogSizeInDU( 320, 320 );
|
||||||
|
|
||||||
m_helpDialog->AddHTML_Text( "<pre>" + EscapedHTML( msg ) + "</pre>" );
|
wxString html_txt;
|
||||||
|
ConvertMarkdown2Html( wxGetTranslation( msg ), html_txt );
|
||||||
|
m_helpDialog->m_htmlWindow->AppendToPage( html_txt );
|
||||||
|
|
||||||
m_helpDialog->ShowModeless();
|
m_helpDialog->ShowModeless();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
# Top-level Clauses
|
||||||
|
|
||||||
|
(version <number>)
|
||||||
|
|
||||||
|
(rule <rule_name> <rule_clause> ...)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule Clauses
|
||||||
|
|
||||||
|
(constraint <constraint_type> ...)
|
||||||
|
|
||||||
|
(condition "<expression>")
|
||||||
|
|
||||||
|
(layer "<layer_name>")
|
||||||
|
|
||||||
|
|
||||||
|
# Constraint Types
|
||||||
|
|
||||||
|
* annular_width
|
||||||
|
* clearance
|
||||||
|
* disallow
|
||||||
|
* hole
|
||||||
|
* track_width
|
||||||
|
|
||||||
|
|
||||||
|
# Item Types
|
||||||
|
|
||||||
|
* buried_via
|
||||||
|
* graphic
|
||||||
|
* hole
|
||||||
|
* micro_via
|
||||||
|
* pad
|
||||||
|
* text
|
||||||
|
* track
|
||||||
|
* via
|
||||||
|
* 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
|
||||||
|
(layer outer)
|
||||||
|
(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'"))
|
||||||
|
|
||||||
|
|
||||||
|
(rule HV_unshielded
|
||||||
|
(constraint clearance (min 2mm))
|
||||||
|
(condition "A.NetClass == 'HV' && !A.insideArea('Shield*')))
|
||||||
|
|
||||||
|
|
||||||
|
# Notes
|
||||||
|
|
||||||
|
Version clause must be the first clause.
|
||||||
|
|
||||||
|
Rules should be ordered by specificity. Later rules take
|
||||||
|
precedence over earlier rules; once a matching rule is found
|
||||||
|
no further rules will be checked.
|
||||||
|
|
||||||
|
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 is a member of the given group. Includes nested membership.
|
||||||
|
|
||||||
|
A.memberOf('<group_name>')
|
||||||
|
|
||||||
|
|
||||||
|
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>')
|
||||||
|
|
||||||
|
NB: this returns true if `A` is on the given layer, independently
|
||||||
|
of whether or not the rule is being evaluated for that layer.
|
||||||
|
For the latter use a `(layer "layer_name")` clause in the rule.
|
|
@ -1,101 +0,0 @@
|
||||||
# ---- Top-level Clauses
|
|
||||||
|
|
||||||
(version <number>)
|
|
||||||
(rule <rule_name> <rule_clause> ...)
|
|
||||||
|
|
||||||
|
|
||||||
# ---- Rule Clauses
|
|
||||||
|
|
||||||
(constraint <constraint_type> ...)
|
|
||||||
(condition "<expression>")
|
|
||||||
(layer "<layer_name>")
|
|
||||||
|
|
||||||
|
|
||||||
# ---- Constraint Types
|
|
||||||
|
|
||||||
clearance annular_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
|
|
||||||
(layer outer)
|
|
||||||
(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'"))
|
|
||||||
|
|
||||||
(rule HV_unshielded
|
|
||||||
(constraint clearance (min 2mm))
|
|
||||||
(condition "A.NetClass == 'HV' && !A.insideArea('Shield*')))
|
|
||||||
|
|
||||||
|
|
||||||
# ---- Notes
|
|
||||||
#
|
|
||||||
# Version clause must be the first clause.
|
|
||||||
#
|
|
||||||
# Rules should be ordered by specificity. Later rules take
|
|
||||||
# precedence over earlier rules; once a matching rule is found
|
|
||||||
# no further rules will be checked.
|
|
||||||
#
|
|
||||||
# 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 is a member of the given group. Includes nested
|
|
||||||
# membership.
|
|
||||||
|
|
||||||
A.memberOf('<group_name>')
|
|
||||||
|
|
||||||
|
|
||||||
# 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).
|
|
||||||
#
|
|
||||||
# NB: this returns true if A is on the given layer, independently
|
|
||||||
# of whether or not the rule is being evaluated for that layer.
|
|
||||||
# For the latter use a (layer "layer_name") clause in the rule.
|
|
||||||
|
|
||||||
A.onLayer('<layer_name>')
|
|
|
@ -82,6 +82,7 @@ target_link_libraries( qa_pcbnew
|
||||||
nanosvg
|
nanosvg
|
||||||
idf3
|
idf3
|
||||||
unit_test_utils
|
unit_test_utils
|
||||||
|
markdown_lib
|
||||||
${PCBNEW_IO_LIBRARIES}
|
${PCBNEW_IO_LIBRARIES}
|
||||||
${wxWidgets_LIBRARIES}
|
${wxWidgets_LIBRARIES}
|
||||||
${GITHUB_PLUGIN_LIBRARIES}
|
${GITHUB_PLUGIN_LIBRARIES}
|
||||||
|
|
|
@ -59,6 +59,7 @@ target_link_libraries( qa_pcbnew_tools
|
||||||
common
|
common
|
||||||
qa_utils
|
qa_utils
|
||||||
unit_test_utils
|
unit_test_utils
|
||||||
|
markdown_lib
|
||||||
${PCBNEW_IO_LIBRARIES}
|
${PCBNEW_IO_LIBRARIES}
|
||||||
${wxWidgets_LIBRARIES}
|
${wxWidgets_LIBRARIES}
|
||||||
${GITHUB_PLUGIN_LIBRARIES}
|
${GITHUB_PLUGIN_LIBRARIES}
|
||||||
|
|
Loading…
Reference in New Issue