Move sch_text help into markdown file

This commit is contained in:
Michael Kavanagh 2020-10-04 18:49:21 +01:00 committed by Jeff Young
parent 42496a7d62
commit 006e383f2a
4 changed files with 149 additions and 126 deletions

1
.gitignore vendored
View File

@ -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

View File

@ -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 )

View File

@ -44,6 +44,7 @@
#include <project/project_file.h>
#include <project/net_settings.h>
#include <sch_iref.h>
#include <dialog_helpers.h>
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 = _(
"<table>"
" <tr>"
" <th>Markup</th>"
" <th></th>"
" <th>Result</th>"
" </tr>"
" <tr>"
" <td>&nbsp;<br><samp>^{superscript}</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp><sup>superscript</sup>&nbsp;</samp></td>"
" </tr>"
" <tr>"
" <td>&nbsp;<br><samp>Driver Board^{Rev A}</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp>Driver Board<sup>Rev A</sup></samp></td>"
" </tr>"
" <tr><td><br></td></tr>"
" <tr>"
" <td>&nbsp;<br><samp>_{subscript}</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp><sub>subscript</sub>&nbsp;</samp></td>"
" </tr>"
" <tr>"
" <td>&nbsp;<br><samp>D_{0} - D_{15}</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp>D<sub>0</sub> - D<sub>31</sub></samp></td>"
" </tr>"
" <tr><td></td></tr>"
" <tr>"
" <td>"
" &nbsp;<br><samp>~overbar</samp><br>"
" &nbsp;<br><samp>~CLK</samp><br>"
" &nbsp;<br><samp>~~</samp>"
" </td>"
" <td></td>"
" <td>"
" <samp><u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</u></samp><br>"
" <samp>overbar</samp><br>"
" <samp><u>&nbsp;&nbsp;&nbsp;</u></samp><br>"
" <samp>CLK</samp><br>"
" <samp>&nbsp;</samp><br>"
" <samp>~</samp>"
" </td>"
" </tr>"
" <tr><td><br></td></tr>"
" <tr>"
" <td>&nbsp;<br><samp>${variable}</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp><i>variable_value</i></samp></td>"
" </tr>"
" <tr>"
" <td>&nbsp;<br><samp>${REVISION}</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp>2020.1</samp></td>"
" </tr>"
" <tr><td><br></td></tr>"
" <tr>"
" <td>&nbsp;<br><samp>${refdes:field}</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp><i>field_value</i> of symbol <i>refdes</i></samp></td>"
" </tr>"
" <tr>"
" <td>&nbsp;<br><samp>${R3:VALUE}</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp>150K</samp></td>"
" </tr>"
" <tr><td><br></td></tr>"
" <tr><td><br></td></tr>"
" <tr>"
" <th>Bus Definition</th>"
" <th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>"
" <th>Resultant Nets</th>"
" </tr>"
" <tr>"
" <td>&nbsp;<br><samp>prefix[m..n]</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp>prefixm to prefixn</samp></td>"
" </tr>"
" <tr>"
" <td>&nbsp;<br><samp>D[0..7]</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp>D0, D1, D2, D3, D4, D5, D6, D7</samp></td>"
" </tr>"
" <tr><td><br></td></tr>"
" <tr><samp>"
" <td>&nbsp;<br><samp>{net1 net2 ...}</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp>net1, net2, ...</samp></td>"
" </tr>"
" <tr>"
" <td>&nbsp;<br><samp>{SCL SDA}</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp>SCL, SDA</samp></td>"
" </tr></samp>"
" <tr><td><br></td></tr>"
" <tr>"
" <td>&nbsp;<br><samp>prefix{net1 net2 ...}</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp>prefix.net1, prefix.net2, ...</samp></td>"
" </tr>"
" <tr>"
" <td>&nbsp;<br><samp>USB1{DP DM}</samp></td>"
" <td></td>"
" <td>&nbsp;<br><samp>USB1.DP, USB1.DM</samp></td>"
" </tr>"
" <tr><td><br></td></tr>"
" <tr>"
" <td>&nbsp;<br><samp>MEM{D[1..2] LATCH}</samp></td>"
" <td></td>"
" <td>&nbsp;<br>"
" <samp>MEM.D1, MEM.D2, MEM.LATCH</samp>"
" </td>"
" </tr>"
" <tr>"
" <td>&nbsp;<br><samp>MEM{D_{[1..2]} ~LATCH}</samp></td>"
" <td></td>"
" <td>"
" <samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
" <u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</u></samp><br>"
" <samp>MEM.D<sub>1</sub>, MEM.D<sub>2</sub>, MEM.LATCH</samp>"
" </td>"
" </tr>"
"</table>" );
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;

124
eeschema/sch_text_help.md Normal file
View File

@ -0,0 +1,124 @@
<table>
<tr>
<th>Markup</th>
<th></th>
<th>Result</th>
</tr>
<tr>
<td>&nbsp;<br><samp>^{superscript}</samp></td>
<td></td>
<td>&nbsp;<br><samp><sup>superscript</sup>&nbsp;</samp></td>
</tr>
<tr>
<td>&nbsp;<br><samp>Driver Board^{Rev A}</samp></td>
<td></td>
<td>&nbsp;<br><samp>Driver Board<sup>Rev A</sup></samp></td>
</tr>
<tr>
<td><br></td>
</tr>
<tr>
<td>&nbsp;<br><samp>_{subscript}</samp></td>
<td></td>
<td>&nbsp;<br><samp><sub>subscript</sub>&nbsp;</samp></td>
</tr>
<tr>
<td>&nbsp;<br><samp>D_{0} - D_{15}</samp></td>
<td></td>
<td>&nbsp;<br><samp>D<sub>0</sub> - D<sub>31</sub></samp></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td> &nbsp;<br><samp>~overbar</samp><br> &nbsp;<br><samp>~CLK</samp><br> &nbsp;<br><samp>~~</samp> </td>
<td></td>
<td> <samp><u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</u></samp><br> <samp>overbar</samp><br> <samp><u>&nbsp;&nbsp;&nbsp;</u></samp><br> <samp>CLK</samp><br> <samp>&nbsp;</samp><br> <samp>~</samp> </td>
</tr>
<tr>
<td><br></td>
</tr>
<tr>
<td>&nbsp;<br><samp>${variable}</samp></td>
<td></td>
<td>&nbsp;<br><samp><i>variable_value</i></samp></td>
</tr>
<tr>
<td>&nbsp;<br><samp>${REVISION}</samp></td>
<td></td>
<td>&nbsp;<br><samp>2020.1</samp></td>
</tr>
<tr>
<td><br></td>
</tr>
<tr>
<td>&nbsp;<br><samp>${refdes:field}</samp></td>
<td></td>
<td>&nbsp;<br><samp><i>field_value</i> of symbol <i>refdes</i></samp></td>
</tr>
<tr>
<td>&nbsp;<br><samp>${R3:VALUE}</samp></td>
<td></td>
<td>&nbsp;<br><samp>150K</samp></td>
</tr>
<tr>
<td><br></td>
</tr>
<tr>
<td><br></td>
</tr>
<tr>
<th>Bus Definition</th>
<th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th>Resultant Nets</th>
</tr>
<tr>
<td>&nbsp;<br><samp>prefix[m..n]</samp></td>
<td></td>
<td>&nbsp;<br><samp>prefixm to prefixn</samp></td>
</tr>
<tr>
<td>&nbsp;<br><samp>D[0..7]</samp></td>
<td></td>
<td>&nbsp;<br><samp>D0, D1, D2, D3, D4, D5, D6, D7</samp></td>
</tr>
<tr>
<td><br></td>
</tr>
<tr><samp>
<td>&nbsp;<br><samp>{net1 net2 ...}</samp></td>
<td></td>
<td>&nbsp;<br><samp>net1, net2, ...</samp></td>
</tr>
<tr>
<td>&nbsp;<br><samp>{SCL SDA}</samp></td>
<td></td>
<td>&nbsp;<br><samp>SCL, SDA</samp></td>
</tr></samp>
<tr>
<td><br></td>
</tr>
<tr>
<td>&nbsp;<br><samp>prefix{net1 net2 ...}</samp></td>
<td></td>
<td>&nbsp;<br><samp>prefix.net1, prefix.net2, ...</samp></td>
</tr>
<tr>
<td>&nbsp;<br><samp>USB1{DP DM}</samp></td>
<td></td>
<td>&nbsp;<br><samp>USB1.DP, USB1.DM</samp></td>
</tr>
<tr>
<td><br></td>
</tr>
<tr>
<td>&nbsp;<br><samp>MEM{D[1..2] LATCH}</samp></td>
<td></td>
<td>&nbsp;<br> <samp>MEM.D1, MEM.D2, MEM.LATCH</samp> </td>
</tr>
<tr>
<td>&nbsp;<br><samp>MEM{D_{[1..2]} ~LATCH}</samp></td>
<td></td>
<td> <samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</u></samp><br> <samp>MEM.D<sub>1</sub>, MEM.D<sub>2</sub>, MEM.LATCH</samp> </td>
</tr>
</table>