Example #1
0
void about::Update()
{
    pAboutTextCtl->Clear();
    wxString *pAboutString = new wxString( AboutText, wxConvUTF8 );

    pAboutString->Append( OpenCPNVersion );
    pAboutString->Append( wxString( OpenCPNInfo, wxConvUTF8 ) );

    pAboutTextCtl->WriteText( *pAboutString );
    delete pAboutString;

    // Show the user where the log file is going to be
    wxString log = _T("    Logfile location: ");
    log.Append( glog_file );
    pAboutTextCtl->WriteText( log );

    // Show the user where the config file is going to be
    wxString conf = _T("\n    Config file location: ");
    conf.Append( g_Platform->GetConfigFileName() );
    pAboutTextCtl->WriteText( conf );
    pAboutTextCtl->SetInsertionPoint( 0 );
    
    pAuthorTextCtl->Clear();
    wxString *pAuthorsString = new wxString( AuthorText, wxConvUTF8 );
    pAuthorTextCtl->WriteText( *pAuthorsString );
    pAuthorTextCtl->SetInsertionPoint( 0 );
    
    delete pAuthorsString;

    pLicenseTextCtl->Clear();
    wxString license_loc(m_DataLocn );
    license_loc.Append( _T("license.txt") );

    wxTextFile license_file( license_loc );

    if( license_file.Open() ) {
        wxString str;
        str = license_file.GetFirstLine();
        pLicenseTextCtl->WriteText( str );

        while( !license_file.Eof() ) {
            str = license_file.GetNextLine();
            str.Append( _T("\n") );
            pLicenseTextCtl->AppendText( str );
        }
        license_file.Close();
    } else {
        wxString msg( _T("Could not open License file: ") );
        msg.Append( license_loc );
        wxLogMessage( msg );
    }
    pLicenseTextCtl->SetInsertionPoint( 0 );

    DimeControl( this );
}
Example #2
0
void about::Update()
{
      wxColour cb = GetGlobalColor( _T("DILG1") );
      SetBackgroundColour(cb);

      wxColour cf = GetGlobalColor( _T( "UINFD" ) );          // or UINFF
      SetForegroundColour( cf );

      itemPanelAbout->SetBackgroundColour(cb);
      itemPanelAuthors->SetBackgroundColour(cb);
      itemPanelLicense->SetBackgroundColour(cb);
      itemPanelTips->SetBackgroundColour(cb);
      pAboutTextCtl->SetBackgroundColour(cb);
      pAuthorTextCtl->SetBackgroundColour(cb);
      pLicenseTextCtl->SetBackgroundColour(cb);

      itemPanelAbout->SetForegroundColour(cf);
      itemPanelAuthors->SetForegroundColour(cf);
      itemPanelLicense->SetForegroundColour(cf);
      itemPanelTips->SetForegroundColour(cf);
      pAboutTextCtl->SetForegroundColour(cf);
      pAuthorTextCtl->SetForegroundColour(cf);
      pLicenseTextCtl->SetForegroundColour(cf);

      wxTextAttr ta(cf, cb);

      pAboutTextCtl->SetDefaultStyle(ta);
      pAboutTextCtl->Clear();
      wxString *pAboutString = new wxString(AboutText,  wxConvUTF8);

      pAboutString->Append(OpenCPNVersion); //Gunther
      pAboutString->Append(wxString(OpenCPNInfo,  wxConvUTF8));

      pAboutTextCtl->WriteText(*pAboutString);
      delete pAboutString;

  // Show the user where the log file is going to be
      wxString log = _T("\n    Logfile location: ");
      log.Append(*pHome_Locn);
      log.Append(_T("opencpn.log"));

      pAboutTextCtl->WriteText(log);


      pAuthorTextCtl->SetDefaultStyle(ta);
      pAuthorTextCtl->Clear();
      wxString *pAuthorsString = new wxString(AuthorText,  wxConvUTF8);
      pAuthorTextCtl->WriteText(*pAuthorsString);
      delete pAuthorsString;


      pLicenseTextCtl->SetDefaultStyle(ta);
      pLicenseTextCtl->Clear();
      wxString license_loc(*m_pDataLocn);
      license_loc.Append(_T("license.txt"));

      wxTextFile license_file(license_loc);

      if(license_file.Open())
      {
            wxString str;
            str = license_file.GetFirstLine();
            pLicenseTextCtl->WriteText(str);

            while (!license_file.Eof())
            {
                  str = license_file.GetNextLine();
                  str.Append(_T("\n"));
                  pLicenseTextCtl->AppendText(str);
            }
            license_file.Close();
      }
      else
      {
            wxString msg(_T("Could not open License file: "));
            msg.Append(license_loc);
            wxLogMessage(msg);
      }
      pLicenseTextCtl->SetInsertionPoint(0);


}
Example #3
0
void about::Update()
{

    wxColor bg = GetBackgroundColour();
    wxColor fg = wxColour(0,0,0); //FontMgr::Get().GetFontColor( _("Dialog") );

    wxString aboutText;
    aboutText.Printf( _T("<html><body bgcolor=#%02x%02x%02x><font color=#%02x%02x%02x>"),
                   bg.Red(), bg.Blue(), bg.Green(), fg.Red(), fg.Blue(), fg.Green() );
    
    wxFont *dFont = FontMgr::Get().GetFont( _("Dialog") );
    wxString face = dFont->GetFaceName();
    
    #ifdef __WXOSX__
    int points = dFont->GetPointSize();
    #else
    int points = dFont->GetPointSize() + 1;
    #endif
    
    int sizes[7];
    for ( int i=-2; i<5; i++ ) {
        sizes[i+2] = points + i + (i>0?i:0);
    }
    pAboutHTMLCtl->SetFonts(face, face, sizes);
    
    if(wxFONTSTYLE_ITALIC == dFont->GetStyle())
        aboutText += _T("<i>");
    
    wxString *pAboutString = new wxString( AboutText, wxConvUTF8 );
    pAboutString->Append( OpenCPNVersion );
    pAboutString->Append( wxString( OpenCPNInfo, wxConvUTF8 ) );
    
    // Show the user where the log file is going to be
    wxString log = _T("    Logfile location: ");
    log.Append( g_Platform->GetLogFileName() );
    pAboutString->Append(log);
    
    // Show the user where the config file is going to be
    wxString conf = _T("<br><br>    Config file location: ");
    conf.Append( g_Platform->GetConfigFileName() );
    pAboutString->Append(conf);
    
    aboutText << *pAboutString;
    delete pAboutString;
    
    aboutText << _T("</font>");
    if(wxFONTSTYLE_ITALIC == dFont->GetStyle())
        aboutText << _T("</i>");
    
    aboutText << _T("</body></html>");
    
    pAboutHTMLCtl->SetPage( aboutText );

    
    pAuthorTextCtl->Clear();
    wxString *pAuthorsString = new wxString( AuthorText, wxConvUTF8 );
    pAuthorTextCtl->WriteText( *pAuthorsString );
    pAuthorTextCtl->SetInsertionPoint( 0 );
    
    delete pAuthorsString;

    pLicenseTextCtl->Clear();
    wxString license_loc(m_DataLocn );
    license_loc.Append( _T("license.txt") );

    wxTextFile license_file( license_loc );

    if( license_file.Open() ) {
        wxString str;
        str = license_file.GetFirstLine();
        pLicenseTextCtl->WriteText( str );

        while( !license_file.Eof() ) {
            str = license_file.GetNextLine();
            str.Append( _T("\n") );
            pLicenseTextCtl->AppendText( str );
        }
        license_file.Close();
    } else {
        wxString msg( _T("Could not open License file: ") );
        msg.Append( license_loc );
        wxLogMessage( msg );
    }
    pLicenseTextCtl->SetInsertionPoint( 0 );

    SetColorScheme();
}