void SplashDialog::Show2( wxWindow * pParent ) { if( pSelf == NULL ) { pSelf = new SplashDialog( pParent ); } pSelf->mpHtml->SetPage(HelpText( wxT("welcome") )); pSelf->Show( true ); }
void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) { wxString href = link.GetHref(); if( href.StartsWith(wxT("innerlink:")) ) { this->SetPage( HelpText( href.Mid( 10 ))); this->GetParent()->SetLabel( TitleText( href.Mid( 10 ))); return; } OpenInDefaultBrowser(link); }
void ErrorDialog::OnHelp(wxCommandEvent & WXUNUSED(event)) { if( dhelpURL.StartsWith(wxT("innerlink:")) ) { HelpSystem::ShowHtmlText( this, TitleText(dhelpURL.Mid( 10 ) ), HelpText( dhelpURL.Mid( 10 )), false, true ); return; } OpenInDefaultBrowser( dhelpURL ); if(dClose) EndModal(true); }
void SplashDialog::Populate( ShuttleGui & S ) { this->SetBackgroundColour(theTheme.Colour( clrAboutBoxBackground )); bool bShow; gPrefs->Read(wxT("/GUI/ShowSplashScreen"), &bShow, true ); S.StartVerticalLay(1); //v For now, change to AudacityLogoWithName via old-fashioned ways, not Theme. m_pLogo = new wxBitmap((const char **) AudacityLogoWithName_xpm); //v // JKC: Resize to 50% of size. Later we may use a smaller xpm as // our source, but this allows us to tweak the size - if we want to. // It also makes it easier to revert to full size if we decide to. const float fScale=0.5f;// smaller size. wxImage RescaledImage( m_pLogo->ConvertToImage() ); // wxIMAGE_QUALITY_HIGH not supported by wxWidgets 2.6.1, or we would use it here. RescaledImage.Rescale( int(LOGOWITHNAME_WIDTH * fScale), int(LOGOWITHNAME_HEIGHT *fScale) ); wxBitmap RescaledBitmap( RescaledImage ); m_pIcon = new wxStaticBitmap(S.GetParent(), -1, //*m_pLogo, //v theTheme.Bitmap(bmpAudacityLogoWithName), RescaledBitmap, wxDefaultPosition, wxSize(int(LOGOWITHNAME_WIDTH*fScale), int(LOGOWITHNAME_HEIGHT*fScale))); S.Prop(0).AddWindow( m_pIcon ); mpHtml = new LinkingHtmlWindow(S.GetParent(), -1, wxDefaultPosition, wxSize(506, 280), wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER ); mpHtml->SetPage(HelpText( wxT("welcome") )); S.Prop(1).AddWindow( mpHtml, wxEXPAND ); S.Prop(0).StartMultiColumn(2, wxEXPAND); S.SetStretchyCol( 1 );// Column 1 is stretchy... { S.SetBorder( 5 ); S.Id( DontShowID).AddCheckBox( _("Don't show this again at start up"), bShow ? wxT("false") : wxT("true") ); wxButton *ok = new wxButton(S.GetParent(), wxID_OK); ok->SetDefault(); S.SetBorder( 5 ); S.Prop(0).AddWindow( ok, wxALIGN_RIGHT| wxALL ); } S.EndVerticalLay(); }
void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) { wxString href = link.GetHref(); if( href.StartsWith(wxT("innerlink:")) ) { wxString FileName = wxFileName( FileNames::HtmlHelpDir(), href.Mid( 10 ) + wxT(".htm") ).GetFullPath(); if( wxFileExists( FileName ) ) { HelpSystem::ShowHelpDialog(NULL, FileName, wxT("")); return; } else { SetPage( HelpText( href.Mid( 10 ))); wxGetTopLevelParent(this)->SetLabel( TitleText( href.Mid( 10 ))); } } else if( href.StartsWith(wxT("mailto:")) || href.StartsWith(wxT("file:")) ) { OpenInDefaultBrowser( link ); return; } else if( !href.StartsWith( wxT("http:")) && !href.StartsWith( wxT("https:")) ) { HtmlWindow::OnLinkClicked( link ); } else { OpenInDefaultBrowser(link); return; } BrowserFrame * pDlg = wxDynamicCast( GetRelatedFrame(), BrowserFrame ); if( pDlg ) { pDlg->UpdateButtons(); }; }
void HelpSystem::ShowHelpDialog(wxWindow *parent, const wxString &localFileName, const wxString &remoteURL, bool bModal) { AudacityProject * pProj = GetActiveProject(); wxString HelpMode = wxT("Local"); if( pProj ) { HelpMode = pProj->mHelpPref; // these next lines are for legacy cfg files (pre 2.0) where we had different modes if( (HelpMode == wxT("Standard")) || (HelpMode == wxT("InBrowser")) ) { HelpMode = wxT("Local"); pProj->mHelpPref = HelpMode; gPrefs->Write(wxT("/GUI/Help"), HelpMode); gPrefs->Flush(); } } // Anchors (URLs with a '#' in them) are not supported by many OSs for local file names // See, for example, https://groups.google.com/forum/#!topic/wx-users/pC0uOZJalRQ // Problems have been reported on Win, Mac and some versions of Linux. // So we set HelpMode to use the internet if an anchor is found. if (localFileName.Find('#', true) != wxNOT_FOUND) HelpMode = wxT("FromInternet"); // Until a solution is found for this, the next few lines are irrelevant. // Obtain the local file system file name, without the anchor if present. wxString localfile; if (localFileName.Find('#', true) != wxNOT_FOUND) localfile = localFileName.BeforeLast('#'); else localfile = localFileName; if( (HelpMode == wxT("FromInternet")) && !remoteURL.IsEmpty() ) { // Always go to remote URL. Use External browser. OpenInDefaultBrowser( remoteURL ); } else if( !wxFileExists( localfile )) { // If you give an empty remote URL, you should have already ensured // that the file exists! wxASSERT( !remoteURL.IsEmpty() ); // I can't find it'. // Use Built-in browser to suggest you use the remote url. wxString Text = HelpText( wxT("remotehelp") ); Text.Replace( wxT("*URL*"), remoteURL ); ShowHtmlText( parent, _("Help on the Internet"), Text, false, bModal ); } else if( HelpMode == wxT("Local") ) { // Local file, External browser OpenInDefaultBrowser( wxString(wxT("file:"))+localFileName ); } else { // Local file, Built-in browser ShowHtmlText( parent, wxT(""), localFileName, true, bModal ); } }
int main(int argc, char **argv) { char const *infile, *outfile; char *prog; FILE *fin, *fout; Stream *in = NULL; prog = argv[0]; while (argc > 0) { if (argc > 1 && argv[1][0] == '-') { if (strcmp(argv[1], "-help") == 0 || argv[1][1] == 'h') { HelpText(stdout, prog); return 1; } if (strcmp(argv[1], "-dos") == 0 || strcmp(argv[1], "-crlf") == 0) endline = DOS_CRLF; else if (strcmp(argv[1], "-mac") == 0 || strcmp(argv[1], "-cr") == 0) endline = MAC_CR; else if (strcmp(argv[1], "-unix") == 0 || strcmp(argv[1], "-lf") == 0) endline = UNIX_LF; else if (strcmp(argv[1], "-tabs") == 0) tabs = true; else if (strncmp(argv[1], "-t", 2) == 0) sscanf(argv[1]+2, "%d", &tabsize); --argc; ++argv; continue; } if (argc > 1) { infile = argv[1]; fin = fopen(infile, "rb"); } else { infile = "stdin"; fin = stdin; } if (argc > 2) { outfile = argv[2]; fout = NULL; --argc; ++argv; } else { outfile = "stdout"; fout = stdout; } if (fin) { in = ReadFile(fin); if (fin != stdin) fclose(fin); if (fout != stdout) fout = fopen(outfile, "wb"); if (fout) { WriteFile(in, fout); if (fout != stdout) fclose(fout); } else fprintf(stderr, "%s - can't open \"%s\" for writing\n", prog, outfile); FreeStream(in); } else fprintf(stderr, "%s - can't open \"%s\" for reading\n", prog, infile); --argc; ++argv; if (argc <= 1) break; } return 0; }
void SplashDialog::Populate( ShuttleGui & S ) { //#if ((AUDACITY_BRANDING == BRAND_JAMLING__EASY) || (AUDACITY_BRANDING == BRAND_JAMLING__FULL)) // this->SetBackgroundColour(wxColour(rrr, ggg, bbb)); // same as waveform color //#else // this->SetBackgroundColour(theTheme.Colour( clrAboutBoxBackground )); //#endif this->SetBackgroundColour(theTheme.Colour( clrAboutBoxBackground )); bool bShow; gPrefs->Read(wxT("/GUI/ShowSplashScreen"), &bShow, true ); S.StartVerticalLay(1); wxImage buttonImageUp; wxImage buttonImageOver; wxSize buttonSize; wxBitmap* pButtonBitmap; wxBitmap* pButtonBitmapOver; //vvv Change this compile flag when other brands are supported. #if ((AUDACITY_BRANDING == BRAND_JAMLING__EASY) || (AUDACITY_BRANDING == BRAND_JAMLING__FULL)) //vvv Compiles only BRAND_JAMLING__EASY or BRAND_JAMLING__FULL // because we don't load any other company_logo*_xpm consts yet. pButtonBitmap = new wxBitmap(company_logo_xpm); buttonImageUp = pButtonBitmap->ConvertToImage(); pButtonBitmapOver = new wxBitmap(company_logo_over_xpm); buttonImageOver = pButtonBitmapOver->ConvertToImage(); buttonSize = wxSize(pButtonBitmap->GetWidth(), pButtonBitmap->GetHeight()); mButton_Logo = new AButton(this, ID_BUTTON_LOGO, wxDefaultPosition, buttonSize, &buttonImageUp, &buttonImageOver, &buttonImageUp, &buttonImageUp, //v other images? true); #else //vvv For now, change to AudacityLogoWithName via old-fashioned ways, not Theme. pButtonBitmap = //vvv theTheme.Bitmap(bmpAudacityLogoWithName) new wxBitmap((const char **) AudacityLogoWithName_xpm); buttonImageUp = pButtonBitmap->ConvertToImage(); // JKC: Resize to 50% of size. Later we may use a smaller xpm as // our source, but this allows us to tweak the size - if we want to. // It also makes it easier to revert to full size if we decide to. const float fScale=0.5f;// smaller size. buttonSize = wxSize(LOGOWITHNAME_WIDTH * fScale, LOGOWITHNAME_HEIGHT * fScale); // wxIMAGE_QUALITY_HIGH not supported by wxWidgets 2.6.x, or we would use it here. buttonImageUp.Rescale(buttonSize.GetWidth(), buttonSize.GetHeight()); buttonImageOver = buttonImageUp.Copy(); buttonImageOver.RotateHue(-0.01); mButton_Logo = new AButton(this, ID_BUTTON_LOGO, wxDefaultPosition, buttonSize, &buttonImageUp, &buttonImageOver, &buttonImageUp, &buttonImageUp, //v other images? true); #endif S.Prop(0).AddWindow(mButton_Logo); mpHtml = new LinkingHtmlWindow(S.GetParent(), -1, wxDefaultPosition, wxSize(kWidth, 280), wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER ); mpHtml->SetPage(HelpText( wxT("welcome") )); S.Prop(1).AddWindow( mpHtml, wxEXPAND ); S.Prop(0).StartMultiColumn(2, wxEXPAND); S.SetStretchyCol( 1 );// Column 1 is stretchy... { S.SetBorder( 5 ); S.Id( DontShowID).AddCheckBox( _("Don't show this again at start up"), bShow ? wxT("false") : wxT("true") ); wxButton *ok = new wxButton(S.GetParent(), wxID_OK); ok->SetDefault(); ok->SetFocus(); S.SetBorder( 5 ); S.Prop(0).AddWindow( ok, wxALIGN_RIGHT| wxALL ); } S.EndVerticalLay(); }