From 006e383f2a41cc6d1d080e10ad8aaf80fc47bb09 Mon Sep 17 00:00:00 2001 From: Michael Kavanagh Date: Sun, 4 Oct 2020 18:49:21 +0100 Subject: [PATCH] Move sch_text help into markdown file --- .gitignore | 1 + eeschema/CMakeLists.txt | 17 +++++ eeschema/sch_text.cpp | 133 ++------------------------------------ eeschema/sch_text_help.md | 124 +++++++++++++++++++++++++++++++++++ 4 files changed, 149 insertions(+), 126 deletions(-) create mode 100644 eeschema/sch_text_help.md diff --git a/.gitignore b/.gitignore index 997cd7b7f0..eafdc95c01 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ eeschema/dialogs/dialog_bom_cfg_lexer.h common/template_fieldnames_keywords.cpp common/template_fieldnames_lexer.h eeschema/schematic_keywords.* +eeschema/sch_text_help_md.h pcbnew/pcb_plot_params_keywords.cpp pcbnew/pcb_plot_params_lexer.h pcbnew/dialogs/panel_setup_rules_help_md.h diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 39fe02e424..c04054c8a9 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -330,6 +330,23 @@ set_source_files_properties( dialogs/dialog_bom.cpp OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help_md.h ) +# Create a C++ compilable string initializer containing markdown text into a *.h file: +add_custom_command( + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/sch_text_help_md.h + COMMAND ${CMAKE_COMMAND} + -DinputFile=${CMAKE_CURRENT_SOURCE_DIR}/sch_text_help.md + -DoutputFile=${CMAKE_CURRENT_SOURCE_DIR}/sch_text_help_md.h + -P ${CMAKE_MODULE_PATH}/markdown2C.cmake + DEPENDS ${CMAKE_MODULE_PATH}/markdown2C.cmake ${CMAKE_CURRENT_SOURCE_DIR}/sch_text_help.md + COMMENT "creating ${CMAKE_CURRENT_SOURCE_DIR}/sch_text_help_md.h + from ${CMAKE_CURRENT_SOURCE_DIR}/sch_text_help.md" + ) + +set_source_files_properties( sch_text.cpp + PROPERTIES + OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sch_text_help_md.h + ) + if( APPLE ) # setup bundle set( EESCHEMA_RESOURCES eeschema.icns eeschema_doc.icns ) diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index c74e2aebfd..f5c8c4ab48 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -44,6 +44,7 @@ #include #include #include +#include using KIGFX::SCH_RENDER_SETTINGS; @@ -1237,136 +1238,16 @@ BITMAP_DEF SCH_HIERLABEL::GetMenuImage() const HTML_MESSAGE_BOX* SCH_TEXT::ShowSyntaxHelp( wxWindow* aParentWindow ) { - wxString msg = _( - "" - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - "
MarkupResult
 
^{superscript}
 
superscript 
 
Driver Board^{Rev A}
 
Driver BoardRev A

 
_{subscript}
 
subscript 
 
D_{0} - D_{15}
 
D0 - D31
" - "  
~overbar
" - "  
~CLK
" - "  
~~" - "
" - "        
" - " overbar
" - "    
" - " CLK
" - "  
" - " ~" - "

 
${variable}
 
variable_value
 
${REVISION}
 
2020.1

 
${refdes:field}
 
field_value of symbol refdes
 
${R3:VALUE}
 
150K


Bus Definition             Resultant Nets
 
prefix[m..n]
 
prefixm to prefixn
 
D[0..7]
 
D0, D1, D2, D3, D4, D5, D6, D7

 
{net1 net2 ...}
 
net1, net2, ...
 
{SCL SDA}
 
SCL, SDA

 
prefix{net1 net2 ...}
 
prefix.net1, prefix.net2, ...
 
USB1{DP DM}
 
USB1.DP, USB1.DM

 
MEM{D[1..2] LATCH}
 
" - " MEM.D1, MEM.D2, MEM.LATCH" - "
 
MEM{D_{[1..2]} ~LATCH}
" - "            " - "       " - "      
" - " MEM.D1, MEM.D2, MEM.LATCH" - "
" ); + wxString msg = +#include "sch_text_help_md.h" + ; HTML_MESSAGE_BOX* dlg = new HTML_MESSAGE_BOX( aParentWindow, _( "Syntax Help" ) ); dlg->SetDialogSizeInDU( 280, 280 ); - dlg->AddHTML_Text( msg ); + wxString html_txt; + ConvertMarkdown2Html( wxGetTranslation( msg ), html_txt ); + dlg->m_htmlWindow->AppendToPage( html_txt ); dlg->ShowModeless(); return dlg; diff --git a/eeschema/sch_text_help.md b/eeschema/sch_text_help.md new file mode 100644 index 0000000000..1653e1c8eb --- /dev/null +++ b/eeschema/sch_text_help.md @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MarkupResult
 
^{superscript}
 
superscript 
 
Driver Board^{Rev A}
 
Driver BoardRev A

 
_{subscript}
 
subscript 
 
D_{0} - D_{15}
 
D0 - D31
 
~overbar
 
~CLK
 
~~
       
overbar
   
CLK
 
~

 
${variable}
 
variable_value
 
${REVISION}
 
2020.1

 
${refdes:field}
 
field_value of symbol refdes
 
${R3:VALUE}
 
150K


Bus Definition             Resultant Nets
 
prefix[m..n]
 
prefixm to prefixn
 
D[0..7]
 
D0, D1, D2, D3, D4, D5, D6, D7

 
{net1 net2 ...}
 
net1, net2, ...
 
{SCL SDA}
 
SCL, SDA

 
prefix{net1 net2 ...}
 
prefix.net1, prefix.net2, ...
 
USB1{DP DM}
 
USB1.DP, USB1.DM

 
MEM{D[1..2] LATCH}
 
MEM.D1, MEM.D2, MEM.LATCH
 
MEM{D_{[1..2]} ~LATCH}
                        
MEM.D1, MEM.D2, MEM.LATCH