From 837ba323fb557d8622640e0555d88a10e484c46e Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 1 Feb 2023 23:23:23 +0000 Subject: [PATCH] Add doc link to custom rules syntax help. Fixes https://gitlab.com/kicad/code/kicad/issues/13727 --- common/dialogs/html_message_box.cpp | 16 ++++++++++++++++ include/dialogs/html_message_box.h | 3 +++ pcbnew/dialogs/panel_setup_rules_help.md | 6 +++++- pcbnew/dialogs/panel_setup_rules_help_md.h | 6 +++++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/common/dialogs/html_message_box.cpp b/common/dialogs/html_message_box.cpp index 7982e0d6b6..448dc0acc0 100644 --- a/common/dialogs/html_message_box.cpp +++ b/common/dialogs/html_message_box.cpp @@ -25,8 +25,10 @@ #include #include #include +#include #include #include +#include HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* aParent, const wxString& aTitle, @@ -144,6 +146,20 @@ void HTML_MESSAGE_BOX::ShowModeless() } +void HTML_MESSAGE_BOX::OnHTMLLinkClicked( wxHtmlLinkEvent& event ) +{ + wxString href = event.GetLinkInfo().GetHref(); + + if( href.StartsWith( wxS( "https://docs.kicad.org/" ) ) ) + { + href.Replace( wxS( "GetMajorMinorVersion" ), GetMajorMinorVersion() ); + + wxURI uri( href ); + wxLaunchDefaultBrowser( uri.BuildURI() ); + } +} + + void HTML_MESSAGE_BOX::OnCharHook( wxKeyEvent& aEvent ) { // shift-return (Mac default) or Ctrl-Return (GTK) for OK diff --git a/include/dialogs/html_message_box.h b/include/dialogs/html_message_box.h index 51e77293c6..c3f7cd8224 100644 --- a/include/dialogs/html_message_box.h +++ b/include/dialogs/html_message_box.h @@ -83,6 +83,9 @@ public: */ void ShowModeless(); + void OnHTMLLinkClicked( wxHtmlLinkEvent& event ) override; + + protected: void reload(); diff --git a/pcbnew/dialogs/panel_setup_rules_help.md b/pcbnew/dialogs/panel_setup_rules_help.md index c056f83ab7..e1f4074345 100644 --- a/pcbnew/dialogs/panel_setup_rules_help.md +++ b/pcbnew/dialogs/panel_setup_rules_help.md @@ -311,4 +311,8 @@ Deprecated; use `intersectsArea()` instead. (rule high-current (constraint track_width (min 1.0mm)) (constraint connection_width (min 0.8mm)) - (condition "A.NetClass == 'Power'")) \ No newline at end of file + (condition "A.NetClass == 'Power'")) + +### Documentation + +For the full documentation see [https://docs.kicad.org](https://docs.kicad.org/GetMajorMinorVersion/pcbnew/#custom_design_rules). \ No newline at end of file diff --git a/pcbnew/dialogs/panel_setup_rules_help_md.h b/pcbnew/dialogs/panel_setup_rules_help_md.h index c3ef147ec0..abccac1285 100644 --- a/pcbnew/dialogs/panel_setup_rules_help_md.h +++ b/pcbnew/dialogs/panel_setup_rules_help_md.h @@ -312,4 +312,8 @@ _HKI( "### Top-level Clauses\n" " (rule high-current\n" " (constraint track_width (min 1.0mm))\n" " (constraint connection_width (min 0.8mm))\n" -" (condition \"A.NetClass == 'Power'\"))" ); +" (condition \"A.NetClass == 'Power'\"))\n" +"\n" +"### Documentation\n" +"\n" +"For the full documentation see [https://docs.kicad.org](https://docs.kicad.org/GetMajorMinorVersion/pcbnew/#custom_design_rules)." );