/* MainWindow::onHTMLLinkClicked * Called when a link is clicked on the HTML Window, so that * external (http) links are opened in the default browser *******************************************************************/ void MainWindow::onHTMLLinkClicked(wxEvent& e) { wxHtmlLinkEvent& ev = (wxHtmlLinkEvent&)e; string href = ev.GetLinkInfo().GetHref(); if (href.StartsWith("http://")) wxLaunchDefaultBrowser(ev.GetLinkInfo().GetHref()); else if (href.StartsWith("recent://")) { // Recent file string rs = href.Right(1); unsigned long index = 0; rs.ToULong(&index); index++; panel_archivemanager->handleAction(S_FMT("aman_recent%lu", index)); } else if (href.StartsWith("action://")) { // Action if (href.EndsWith("open")) theApp->doAction("aman_open"); else if (href.EndsWith("newwad")) theApp->doAction("aman_newwad"); else if (href.EndsWith("newzip")) theApp->doAction("aman_newzip"); else if (href.EndsWith("newmap")) theApp->doAction("aman_newmap"); else if (href.EndsWith("reloadstartpage")) createStartPage(); } else html_startpage->OnLinkClicked(ev.GetLinkInfo()); }
void DisplayPgAdminHelp(const wxString &helpTopic) { static wxHelpControllerBase *helpCtl = 0; static bool firstCall = true; // Startup the main help system if (firstCall) { firstCall = false; wxString helpdir = docPath + wxT("/") + settings->GetCanonicalLanguageName(); if (!wxFile::Exists(helpdir + wxT("/pgadmin3.hhp")) && #if defined(__WXMSW__) || wxUSE_LIBMSPACK !wxFile::Exists(helpdir + wxT("/pgadmin3.chm")) && #endif !wxFile::Exists(helpdir + wxT("/pgadmin3.zip"))) helpdir = docPath + wxT("/en_US"); #ifdef __WXMSW__ #ifndef __WXDEBUG__ if (wxFile::Exists(helpdir + wxT("/pgadmin3.chm"))) { helpCtl = new wxCHMHelpController(); helpCtl->Initialize(helpdir + wxT("/pgadmin3")); } else #endif #endif #if wxUSE_LIBMSPACK if (wxFile::Exists(helpdir + wxT("/pgadmin3.chm")) || wxFile::Exists(helpdir + wxT("/pgadmin3.hhp")) || wxFile::Exists(helpdir + wxT("/pgadmin3.zip"))) #else if (wxFile::Exists(helpdir + wxT("/pgadmin3.hhp")) || wxFile::Exists(helpdir + wxT("/pgadmin3.zip"))) #endif { helpCtl = new wxHtmlHelpController(); helpCtl->Initialize(helpdir + wxT("/pgadmin3")); } } wxString page; int hashPos = helpTopic.Find('#'); if (hashPos < 0) page = helpTopic + wxT(".html"); else page = helpTopic.Left(hashPos) + wxT(".html") + helpTopic.Mid(hashPos); if (helpCtl) { if (helpTopic == wxT("index.html")) helpCtl->DisplayContents(); else helpCtl->DisplaySection(page); } else { wxLaunchDefaultBrowser(page); } }
/** * 選択したテキストでヤフー検索 */ void ThreadContentWindow::SearchSelectWordByYahoo(wxCommandEvent& event) { // 検索方法の元ネタは右:http://developer.yahoo.co.jp/other/query_parameters/search/websearch.html wxString url = wxT("http://search.yahoo.co.jp/search?p="); url += m_selectedText; url += wxT("&ei=UTF-8"); wxLaunchDefaultBrowser(url); }
void CWizardAttach::OnFinished( wxWizardExEvent& event ) { if (IsAccountManagerWizard) { // Attached to an account manager if (!GetReturnURL().empty() && GetAttachedToProjectSuccessfully()) { wxLaunchDefaultBrowser(GetReturnURL()); } } else { // Attached to a project if (GetAccountCreatedSuccessfully() && GetAttachedToProjectSuccessfully()) { wxLaunchDefaultBrowser(GetProjectURL() + wxT("account_finish.php?auth=") + GetProjectAuthenticator()); } } // Let the framework clean things up. event.Skip(); }
/** * 選択したテキストでGoogle検索 */ void ThreadContentWindow::SearchSelectWordByGoogle(wxCommandEvent& event) { // ここはHTTPSじゃなくてHTTP通信でいいのかなあ? wxString url = wxT("http://www.google.co.jp/search?q="); url += m_selectedText; url += wxT("&ie=utf-8"); wxLaunchDefaultBrowser(url); }
void CConfigurationDialog::OnTextURLEvent(wxTextUrlEvent& event) { if(event.GetMouseEvent().LeftIsDown()) { wxTextCtrl* pTextCtrl = (wxTextCtrl*)event.GetEventObject(); wxLaunchDefaultBrowser(pTextCtrl->GetRange(event.GetURLStart(), event.GetURLEnd())); } }
void ZLauncherFrame::OnClickLink(wxWebViewEvent& evt) { // Open the link on the default browser wxLaunchDefaultBrowser(evt.GetURL()); // Stop navigation evt.Veto(); }
void StyleDialog::OnStyleWebReport ( wxCommandEvent& event ) { std::vector<ContextMatch> v; getAllMatches ( v ); sort ( v.begin(), v.end(), reportCompareFunction ); // temporary file should be in default temporary folder wxString tempNameWide = wxFileName::CreateTempFileName ( _T ( "" ) ); if ( tempNameWide.empty() ) return; tempNameWide.Replace ( _T ( ".tmp" ), _T ( "_report.html" ), true ); tempFiles.insert ( tempNameWide ); std::string tempNameUtf8 = ( const char * ) tempNameWide.mb_str ( wxConvUTF8 ); std::ofstream ofs ( tempNameUtf8.c_str() ); if ( !ofs ) return; WrapExpat we; ofs << XHTML_START; ofs << "<body><h2>"; ofs << fileName.mb_str ( wxConvUTF8 ); ofs << "</h2><table><tr>"; ofs << "<td><b align=\"right\">No.</b></td>"; ofs << "<td align=\"right\"><b>Context</b></td>"; ofs << "<td align=\"center\"><b>Match</b></td>"; ofs << "<td align=\"left\"><b>Context</b></td>"; ofs << "<td><b>Suggestion</b></td><td><b>Report</b></td></tr>"; std::vector<ContextMatch>::iterator it; int matchCount = 0; for ( it = v.begin(); it != v.end(); ++it ) { ofs << "<tr><td align=\"right\">"; ofs << ++matchCount; ofs << "</td>"; ofs << "<td align=\"right\">"; ofs << we.xmliseTextNode ( it->prelog ); ofs << "</td><td align=\"center\"><font color=\"red\"><b>"; ofs << we.xmliseTextNode ( it->match ); ofs << "</b></font></td><td align=\"left\">"; ofs << we.xmliseTextNode ( it->postlog ); ofs << "</td><td><font color=\"green\"><b>"; ofs << we.xmliseTextNode ( it->replace ); ofs << "</b></font></td><td>"; ofs << we.xmliseTextNode ( it->report ); ofs << "</td></tr>"; } ofs << "</table></body>"; ofs << XHTML_END; ofs.close(); // display file in browser if ( !wxFileExists ( tempNameWide ) ) return; wxLaunchDefaultBrowser ( tempNameWide ); }
static gboolean activate_link(GtkAboutDialog*, const char* link, void* dontIgnore) { if (dontIgnore) { wxLaunchDefaultBrowser(wxGTK_CONV_BACK_SYS(link)); return true; } return false; }
void HelpButton::OpenPage(wxString const& pageID) { init_static(); wxString page = (*pages)[pageID]; wxString section; page = page.BeforeFirst('#', §ion); wxLaunchDefaultBrowser(wxString::Format("http://docs.aegisub.org/3.1/%s/#%s", page, section)); }
void ScreenshotFrame::OnSeeScreenshots(wxCommandEvent& WXUNUSED(event)) { wxString defaultDir = AutoCaptureMechanism::GetDefaultDirectoryAbsPath(); if (wxFileName::DirExists(defaultDir)) wxLaunchDefaultBrowser(defaultDir); else wxMessageBox(_("There isn't any screenshots yet.")); }
/* TextEditor::onMouseDown * Called when a mouse button is clicked *******************************************************************/ void TextEditor::onMouseDown(wxMouseEvent& e) { e.Skip(); // No language, no checks if (!language) return; // Check for ctrl+left (web lookup) if (e.LeftDown() && e.GetModifiers() == wxMOD_CMD) { int pos = CharPositionFromPointClose(e.GetX(), e.GetY()); string word = GetTextRange(WordStartPosition(pos, true), WordEndPosition(pos, true)); if (!word.IsEmpty()) { // TODO: Reimplement for word lists //// Check for keyword //if (language->isKeyword(word)) //{ // string url = language->getKeywordLink(); // if (!url.IsEmpty()) // { // url.Replace("%s", word); // wxLaunchDefaultBrowser(url); // } //} //// Check for constant //else if (language->isConstant(word)) //{ // string url = language->getConstantLink(); // if (!url.IsEmpty()) // { // url.Replace("%s", word); // wxLaunchDefaultBrowser(url); // } //} // Check for function if (language->isFunction(word)) { string url = language->getFunctionLink(); if (!url.IsEmpty()) { url.Replace("%s", word); wxLaunchDefaultBrowser(url); } } hideCalltip(); } } if (e.RightDown() || e.LeftDown()) hideCalltip(); }
void PoeditApp::OpenPoeditWeb(const wxString& path) { wxLaunchDefaultBrowser ( wxString::Format("http://poedit.net%s?fromVersion=%s", path, GetAppVersion()) ); }
void BundleManager::OnBeforeLoad(IHtmlWndBeforeLoadEvent& event) { const wxString url = event.GetURL(); if (url == wxT("about:blank")) return; wxLaunchDefaultBrowser(url); // Don't try to open it in inline browser event.Cancel(true); }
void EDA_BASE_FRAME::GetKicadContribute( wxCommandEvent& event ) { if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) ) { wxString msg = _( "Could not launch the default browser. For information on how to help the KiCad project, visit " ); msg.Append( URL_GET_INVOLVED ); wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this ); } }
/* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RUN_FREEROUTE */ void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event ) { wxString url; wxString command; wxFileName fileName( FindKicadFile( wxT( "freeroute.jnlp" ) ), wxPATH_UNIX ); if( fileName.FileExists() ) { wxString javaWebStartCommand = wxT( "javaws" ); // Find the Java web start application on Windows. #ifdef __WINDOWS__ // If you thought the registry was brain dead before, now you have to deal with // accessing it in either 64 or 32 bit mode depending on the build version of // Windows and the build version of KiCad. // This key works for 32 bit Java on 32 bit Windows and 64 bit Java on 64 bit Windows. wxRegKey key( wxRegKey::HKLM, wxT( "SOFTWARE\\JavaSoft\\Java Web Start" ), wxIsPlatform64Bit() ? wxRegKey::WOW64ViewMode_64 : wxRegKey::WOW64ViewMode_Default ); // It's possible that 32 bit Java is installed on 64 bit Windows. if( !key.Exists() && wxIsPlatform64Bit() ) key.SetName( wxRegKey::HKLM, wxT( "SOFTWARE\\Wow6432Node\\JavaSoft\\Java Web Start" ) ); if( !key.Exists() ) { ::wxMessageBox( _( "It appears that the Java run time environment is not " "installed on this computer. Java is required to use " "FreeRoute." ), _( "Pcbnew Error" ), wxOK | wxICON_ERROR ); return; } key.Open( wxRegKey::Read ); // Get the current version of java installed to determine the executable path. wxString value; key.QueryValue( wxT( "CurrentVersion" ), value ); key.SetName( key.GetName() + wxT( "\\" ) + value ); key.QueryValue( wxT( "Home" ), value ); javaWebStartCommand = value + wxFileName::GetPathSeparator() + javaWebStartCommand; #endif // Wrap FullFileName in double quotes in case it has C:\Program Files in it. // The space is interpreted as an argument separator. command << javaWebStartCommand << wxChar( ' ' ) << wxChar( '"' ) << fileName.GetFullPath() << wxChar( '"' ); ProcessExecute( command ); return; } url = m_FreerouteURLName->GetValue() + wxT( "/java/freeroute.jnlp" ); wxLaunchDefaultBrowser( url ); }
void frmScanforDevices::OnHtmlwindow3LinkClicked(wxHtmlLinkEvent& event) { if (event.GetLinkInfo().GetHref().StartsWith(_("http://"))) { wxLaunchDefaultBrowser(event.GetLinkInfo().GetHref()); event.Skip(false); return; } event.Skip(); }
void CSimpleProjectWebSitesPopupButton::OnMenuLinkClicked(wxCommandEvent& event) { CMainDocument* pDoc = wxGetApp().GetDocument(); wxASSERT(pDoc); int menuIDevt = event.GetId(); ProjectSelectionData* selData = ((CSimpleProjectPanel*)GetParent())->GetProjectSelectionData(); if (selData == NULL) return; char* ctrl_url = selData->project_url; if (menuIDevt == WEBSITE_URL_MENU_ID_HOMEPAGE ) { wxLaunchDefaultBrowser(wxString(ctrl_url, wxConvUTF8)); } else{ int menuId = menuIDevt - WEBSITE_URL_MENU_ID; PROJECT* project = pDoc->state.lookup_project(ctrl_url); project->gui_urls[menuId].name.c_str(); wxLaunchDefaultBrowser(wxString(project->gui_urls[menuId].url.c_str(),wxConvUTF8)); } }
/* MainWindow::onHTMLLinkClicked * Called when a link is clicked on the HTML Window, so that * external (http) links are opened in the default browser *******************************************************************/ void MainWindow::onHTMLLinkClicked(wxEvent& e) { wxWebViewEvent& ev = (wxWebViewEvent&)e; string href = ev.GetURL(); #ifdef __WXGTK__ href.Replace("file://", ""); #endif if (href.EndsWith("/")) href.RemoveLast(1); if (href.StartsWith("http://")) { wxLaunchDefaultBrowser(ev.GetURL()); ev.Veto(); } else if (href.StartsWith("recent://")) { // Recent file string rs = href.Mid(9); unsigned long index = 0; rs.ToULong(&index); index++; panel_archivemanager->handleAction(S_FMT("aman_recent%lu", index)); createStartPage(); } else if (href.StartsWith("action://")) { // Action if (href.EndsWith("open")) theApp->doAction("aman_open"); else if (href.EndsWith("newwad")) theApp->doAction("aman_newwad"); else if (href.EndsWith("newzip")) theApp->doAction("aman_newzip"); else if (href.EndsWith("newmap")) { theApp->doAction("aman_newmap"); return; } else if (href.EndsWith("reloadstartpage")) createStartPage(); html_startpage->Reload(); } else if (wxFileExists(href)) { // Navigating to file, open it string page = appPath("startpage.htm", DIR_TEMP); if (wxFileName(href).GetLongPath() != wxFileName(page).GetLongPath()) theArchiveManager->openArchive(href); ev.Veto(); } }
/** * 選択したテキストでAmazon検索 */ void ThreadContentWindow::SearchSelectWordByAmazon(wxCommandEvent& event) { // AmazonはShift_JISによるURLエンコードしか受け付けないようだ wxString url = wxT("http://www.amazon.co.jp/gp/search/?__mk_ja_JP=%83J%83%5E%83J%83i&field-keywords="); const std::string buffer = babel::utf8_to_sjis(std::string(m_selectedText.mb_str())); const wxString urlEncode(JaneCloneUtil::UrlEncode(buffer).c_str(), wxConvUTF8); url += urlEncode; // 文字列をutf-8からShift_JISに変換しておく必要があるようだ wxLaunchDefaultBrowser(url); }
void MainFrame::SurChangementOngletRuban( wxRibbonBarEvent& event ) { if(m_ribbonBar1->GetActivePage() == 1) { //On remet immédiatement le 1er onglet m_ribbonBar1->SetActivePage((std::size_t)0); //Lancement de l'aide wxFileName exeFileName(wxStandardPaths::Get().GetExecutablePath()); wxLaunchDefaultBrowser("file:///" + exeFileName.GetPath() + "/aide.html"); } }
void ShareTransactionDialog::OnStockPriceButton(wxCommandEvent& WXUNUSED(event)) { const wxString stockSymbol = m_stock_symbol_ctrl->GetValue().Trim(); if (!stockSymbol.IsEmpty()) { const wxString& stockURL = Model_Infotable::instance().GetStringInfo("STOCKURL", mmex::weblink::DefStockUrl); const wxString& httpString = wxString::Format(stockURL, stockSymbol); wxLaunchDefaultBrowser(httpString); } }
bool wxWebUpdateActionOpen::Run() const { wxFileName f(m_strFile); wxLogUsrMsg(wxT("wxWebUpdateActionOpen::Run - opening the file [") + m_strFile + wxT("]")); if (!f.FileExists()) { wxLogUsrMsg(wxT("wxWebUpdateActionOpen::Run - the file \"") + m_strFile + wxT("\" does not exist !")); return FALSE; } // a little exception for Web pages: wxWidgets has the better function // wxLaunchDefaultBrowser which has a bteer error-checking and more // fallbacks, so use it if possible if (f.GetExt().StartsWith(wxT("htm")) && m_nExecFlag == wxEXEC_ASYNC) return wxLaunchDefaultBrowser(m_strFile); // get the mime type wxFileType *ft; if (m_strMime.IsEmpty()) if (f.GetExt().IsEmpty()) return FALSE; // how do we get the MIME type without extension ? else ft = wxTheMimeTypesManager->GetFileTypeFromExtension(f.GetExt()); else ft = wxTheMimeTypesManager->GetFileTypeFromMimeType(m_strMime); if (!ft) { wxLogUsrMsg(wxT("wxWebUpdateActionOpen::Run - No default application can open the file [") + m_strFile + wxT("]")); return false; } wxString mt; ft->GetMimeType(&mt); // get the open command wxString cmd; bool ok = ft->GetOpenCommand(&cmd, wxFileType::MessageParameters(m_strFile)); delete ft; if (!ok) { wxLogUsrMsg(wxT("wxWebUpdateActionOpen::Run - Cannot get the OPEN command for [") + m_strFile + wxT("]")); return FALSE; } if (wxExecute (cmd, m_nExecFlag) == -1) { wxLogUsrMsg(wxT("wxWebUpdateActionOpen::Run - Failed to launch application for [") + m_strFile + wxT("]")); return FALSE; } return TRUE; }
void MainFrame::OnLangOpenFolder(wxCommandEvent& WXUNUSED(event)) { wxString AppPoDir(wxGetCwd() + wxT("/po")); if(!wxDirExists(AppPoDir)){ etrace("po dir not found: %ls",AppPoDir.wc_str()); } else { if(!wxLaunchDefaultBrowser(AppPoDir)) Utils::ShowError(wxT("Cannot open %ls!"),AppPoDir.wc_str()); } }
void ChangeLogPage::OnURL(wxTextUrlEvent& event) { // we respond only for LeftDown event if(event.GetMouseEvent().LeftDown()) { int start = event.GetURLStart(); int end = event.GetURLEnd(); wxString url = m_textCtrl->GetRange(start, end); wxLaunchDefaultBrowser(url); } }
void mmStockDialog::OnStockPriceButton(wxCommandEvent& /*event*/) { const wxString stockSymbol = stockSymbol_->GetValue().Trim(); if (!stockSymbol.IsEmpty()) { const wxString& stockURL = Model_Infotable::instance().GetStringInfo("STOCKURL", mmex::weblink::DefStockUrl); const wxString& httpString = wxString::Format(stockURL, stockSymbol); wxLaunchDefaultBrowser(httpString); } }
void ViewLog::OnOpenBackupsDir(wxCommandEvent& event) { wxString dirPath = TextCtrl3->GetValue(); if (!wxDirExists(dirPath)) { wxMessageBox(_("Failed to find backups directory!"), _("Error"), wxICON_ERROR | wxOK, this); return; } wxLaunchDefaultBrowser(wxString("file:") + dirPath, wxBROWSER_NEW_WINDOW); }
void wxHyperlinkCtrlBase::SendEvent() { wxString url = GetURL(); wxHyperlinkEvent linkEvent(this, GetId(), url); if (!GetEventHandler()->ProcessEvent(linkEvent)) // was the event skipped ? { if (!wxLaunchDefaultBrowser(url)) { wxLogWarning(wxT("Could not launch the default browser with url '%s' !"), url.c_str()); } } }
/* DocsPage::onHTMLLinkClicked * Called when a link is clicked in the browser *******************************************************************/ void DocsPage::onHTMLLinkClicked(wxEvent& e) { wxWebViewEvent& ev = (wxWebViewEvent&)e; string href = ev.GetURL(); // Open external links externally if (!href.StartsWith(docs_url)) { wxLaunchDefaultBrowser(href); ev.Veto(); } }
void ClientCrashDlg::OnHelp(wxCommandEvent& WXUNUSED(eventUnused)) { wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl(); wxString wxurl; wxurl.Printf( wxT("%s?target=crash_detection&version=%s&controlid=%d"), strURL.c_str(), wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(), ID_HELPBOINC ); wxLaunchDefaultBrowser(wxurl); }