Fix another case of 413ff4525b.

This commit is contained in:
Jeff Young 2020-12-07 12:15:52 +00:00
parent 86b631b31e
commit 78129aabeb
3 changed files with 35 additions and 20 deletions

View File

@ -178,6 +178,8 @@ private:
BOM_GENERATOR_ARRAY m_generators;
bool m_initialized;
HTML_MESSAGE_BOX* m_helpWindow;
public:
DIALOG_BOM( SCH_EDIT_FRAME* parent );
~DIALOG_BOM();
@ -224,11 +226,11 @@ int InvokeDialogCreateBOM( SCH_EDIT_FRAME* aCaller )
DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) :
DIALOG_BOM_BASE( parent )
DIALOG_BOM_BASE( parent ),
m_parent( parent ),
m_initialized( false ),
m_helpWindow( nullptr )
{
m_parent = parent;
m_initialized = false;
m_buttonAddGenerator->SetBitmap( KiBitmap( small_plus_xpm ) );
m_buttonDelGenerator->SetBitmap( KiBitmap( trash_xpm ) );
m_buttonEdit->SetBitmap( KiBitmap( small_edit_xpm ) );
@ -252,6 +254,9 @@ DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) :
DIALOG_BOM::~DIALOG_BOM()
{
if( m_helpWindow )
m_helpWindow->Destroy();
// TODO(JE) maybe unpack this into JSON instead of sexpr
// Save the plugin descriptions in config.
@ -593,16 +598,20 @@ void DIALOG_BOM::OnEditGenerator( wxCommandEvent& event )
void DIALOG_BOM::OnHelp( wxCommandEvent& event )
{
HTML_MESSAGE_BOX* help_Dlg = new HTML_MESSAGE_BOX( nullptr,
_( "Bill of Material Generation Help" ) );
if( m_helpWindow )
{
m_helpWindow->ShowModeless();
return;
}
help_Dlg->SetDialogSizeInDU( 500, 350 );
m_helpWindow = new HTML_MESSAGE_BOX( nullptr, _( "Bill of Material Generation Help" ) );
m_helpWindow->SetDialogSizeInDU( 500, 350 );
wxString html_txt;
ConvertMarkdown2Html( wxGetTranslation( s_bomHelpInfo ), html_txt );
help_Dlg->m_htmlWindow->AppendToPage( html_txt );
help_Dlg->ShowModeless();
m_helpWindow->m_htmlWindow->AppendToPage( html_txt );
m_helpWindow->ShowModeless();
}

View File

@ -43,7 +43,7 @@ PANEL_SETUP_RULES::PANEL_SETUP_RULES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFr
m_Parent( aParent ),
m_frame( aFrame ),
m_scintillaTricks( nullptr ),
m_helpDialog( nullptr )
m_helpWindow( nullptr )
{
m_scintillaTricks = new SCINTILLA_TRICKS( m_textEditor, wxT( "()" ) );
@ -67,8 +67,8 @@ PANEL_SETUP_RULES::~PANEL_SETUP_RULES( )
{
delete m_scintillaTricks;
if( m_helpDialog )
m_helpDialog->Destroy();
if( m_helpWindow )
m_helpWindow->Destroy();
};
@ -438,6 +438,12 @@ bool PANEL_SETUP_RULES::TransferDataFromWindow()
void PANEL_SETUP_RULES::OnSyntaxHelp( wxHyperlinkEvent& aEvent )
{
if( m_helpWindow )
{
m_helpWindow->ShowModeless();
return;
}
wxString msg =
#include "dialogs/panel_setup_rules_help_md.h"
;
@ -446,12 +452,12 @@ void PANEL_SETUP_RULES::OnSyntaxHelp( wxHyperlinkEvent& aEvent )
msg.Replace( "Ctrl+", "Cmd+" );
#endif
m_helpDialog = new HTML_MESSAGE_BOX( nullptr, _( "Syntax Help" ) );
m_helpDialog->SetDialogSizeInDU( 320, 320 );
m_helpWindow = new HTML_MESSAGE_BOX( nullptr, _( "Syntax Help" ) );
m_helpWindow->SetDialogSizeInDU( 320, 320 );
wxString html_txt;
ConvertMarkdown2Html( wxGetTranslation( msg ), html_txt );
m_helpDialog->m_htmlWindow->AppendToPage( html_txt );
m_helpWindow->m_htmlWindow->AppendToPage( html_txt );
m_helpDialog->ShowModeless();
m_helpWindow->ShowModeless();
}

View File

@ -46,7 +46,7 @@ private:
wxRegEx m_netClassRegex;
wxRegEx m_netNameRegex;
HTML_MESSAGE_BOX* m_helpDialog;
HTML_MESSAGE_BOX* m_helpWindow;
public:
PANEL_SETUP_RULES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame );