Esempio n. 1
0
void DisplayHtmlInfoMessage( wxWindow* parent, const wxString& title,
                             const wxString& text, const wxSize& size )
{
    HTML_MESSAGE_BOX *dlg = new HTML_MESSAGE_BOX(parent,title, wxDefaultPosition, size );
    dlg->AddHTML_Text( text );
    dlg->ShowModal();
    dlg->Destroy();
}
void DisplayHotkeyList( EDA_BASE_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescList )
{
    wxString     keyname;
    wxString     keymessage;
    EDA_HOTKEY** list;

    wxString     msg = wxT( "<html><body bgcolor=\"#E2E2E2\">" );

    msg += wxT( "<H3>" );
    msg += _( "Hotkeys List" );
    msg += wxT( "</H3> <table cellpadding=\"0\">" );

    for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
    {
        list = aDescList->m_HK_InfoList;

        for( ; *list != NULL; list++ )
        {
            EDA_HOTKEY* hk_decr = *list;

            if( !hk_decr->m_InfoMsg.Contains( wxT( "Macros" ) ) )
            {
                keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
                keymessage = wxGetTranslation( hk_decr->m_InfoMsg );

                // Some chars are modified, using html encoding, to be
                // displayed by DisplayHtmlInfoMessage()
                keyname.Replace( wxT( "<" ), wxT( "&lt;" ) );
                keyname.Replace( wxT( ">" ), wxT( "&gt;" ) );
                msg    += wxT( "<tr><td>" ) + keymessage + wxT( "</td>" );
                msg    += wxT( "<td><b>&nbsp;&nbsp;" ) + keyname + wxT( "</b></td></tr>" );
            }
        }
    }

    msg += wxT( "</table></html></body>" );

#if 0   // Set to 1 to create a modal dialog (blocking)
    DisplayHtmlInfoMessage( aFrame, _( "Hotkeys List" ), msg, wxSize( 340, 750 ) );
#else
    // Create a non modal dialog, which shows the list of hotkeys until dismissed
    // but does not block the parent window
    HTML_MESSAGE_BOX *dlg = new HTML_MESSAGE_BOX( aFrame, _( "Hotkeys List" ),
                                        wxDefaultPosition, wxSize( 340, 750 ) );
    dlg->AddHTML_Text( msg );
    dlg->Show( true );
#endif
}