Ejemplo n.º 1
0
void TrackPropDlg::OnHyperLinkClick( wxHyperlinkEvent &event )
{
    if( m_toggleBtnEdit->GetValue() ) {
        m_pEditedLink = (wxHyperlinkCtrl*) event.GetEventObject();
        OnEditLink( event );
        event.Skip( false );
        return;
    }
    //    Windows has trouble handling local file URLs with embedded anchor points, e.g file://testfile.html#point1
    //    The trouble is with the wxLaunchDefaultBrowser with verb "open"
    //    Workaround is to probe the registry to get the default browser, and open directly
    //
    //    But, we will do this only if the URL contains the anchor point charater '#'
    //    What a hack......

#ifdef __WXMSW__

    wxString cc = event.GetURL();
    if( cc.Find( _T("#") ) != wxNOT_FOUND ) {
        wxRegKey RegKey( wxString( _T("HKEY_CLASSES_ROOT\\HTTP\\shell\\open\\command") ) );
        if( RegKey.Exists() ) {
            wxString command_line;
            RegKey.QueryValue( wxString( _T("") ), command_line );

            //  Remove "
            command_line.Replace( wxString( _T("\"") ), wxString( _T("") ) );

            //  Strip arguments
            int l = command_line.Find( _T(".exe") );
            if( wxNOT_FOUND == l ) l = command_line.Find( _T(".EXE") );

            if( wxNOT_FOUND != l ) {
                wxString cl = command_line.Mid( 0, l + 4 );
                cl += _T(" ");
                cc.Prepend( _T("\"") );
                cc.Append( _T("\"") );
                cl += cc;
                wxExecute( cl );        // Async, so Fire and Forget...
            }
        }
    } else
        event.Skip();
#else
    wxString url = event.GetURL();
    url.Replace(_T(" "), _T("%20") );
    ::wxLaunchDefaultBrowser(url);
//    event.Skip();
#endif
}
Ejemplo n.º 2
0
void CPanelStatus::OnClick(wxHyperlinkEvent &e)
{
  CStatusInfo *pStatus = m_vpStatus.at(e.GetId() - IDhyperlinkStatus);
  int nID = pStatus->GetID();
  if(m_pParent->CheckIfHistoryOK())
  {
    wxCommandEvent ee(wxEVT_MENU,nID);
    switch(nID)
    {
      case IDmenuAcceptLocus:
      case IDmenuReviewLocus:
        ee.SetClientData((void *)pStatus->GetLocus());
      case IDmenuAcceptSample:
      case IDmenuAcceptILS:
      case IDmenuAcceptChannels:
      case IDmenuAcceptDirectory:
      case IDmenuReviewSample:
      case IDmenuReviewILS:
      case IDmenuReviewChannels:
      case IDmenuReviewDirectory:
        GetEventHandler()->AddPendingEvent(ee);
        break;
      default:
        wxASSERT_MSG(0,"CPanelStatus::OnClick() invalid ID");
    }
  }
}
Ejemplo n.º 3
0
void CPanelStatus::OnClick(wxHyperlinkEvent &e)
{
  CStatusInfo *pStatus = m_vpStatus.at(e.GetId() - IDhyperlinkStatus);
  int nID = pStatus->GetID();
  if(m_pParent->CheckIfHistoryOK())
  {
    switch(nID)
    {
      case IDmenuAcceptLocus:
        m_pParent->DoAcceptLocus(m_pSample,pStatus->GetLocus());
        break;
      case IDmenuReviewLocus:
        m_pParent->DoReviewLocus(m_pSample,pStatus->GetLocus());
        break;
      case IDmenuAcceptSample:
      case IDmenuAcceptILS:
      case IDmenuAcceptChannels:
      case IDmenuAcceptDirectory:
        m_pParent->DoAcceptSample(nID,m_pSample);
        break;
      case IDmenuReviewSample:
      case IDmenuReviewILS:
      case IDmenuReviewChannels:
      case IDmenuReviewDirectory:
        m_pParent->DoReviewSample(nID,m_pSample);
        break;
      default:
        wxASSERT_MSG(0,"CPanelStatus::OnClick() invalid ID");
    }
  }
}
Ejemplo n.º 4
0
void CAbout::OnVisitSiteClicked(wxHyperlinkEvent& event) {
  // Do nothing to prevent double open, because GTK control opens URL by itself,
  // otherwise default handler will call xdg-open to open URL
#ifndef __WXGTK__
  // skip this hook and leave default processing for non-GTK builds
  event.Skip();
#else
  wxUnusedVar(event);
#endif
}
Ejemplo n.º 5
0
//------------------------------------------------------------------------------
void WelcomePanel::OnOpenHelpLink(wxHyperlinkEvent& event)
{
   // if link is a keyword (no slashes or periods), use help controller
   // otherwise, assume it is a URL and use the default browser
   wxString link = event.GetURL();
   #ifdef DEBUG_WELCOME_HELP
      MessageInterface::ShowMessage("WelcomePanel::OnOpenHelpLink, url = %s\n",
            link.c_str());
   #endif
   if ((GmatAppData::Instance()->GetMainFrame()->GetHelpController() == NULL) || 
	   link.Contains("\\") || link.Contains("/") || link.Contains(":") )
	   ::wxLaunchDefaultBrowser(link);
   else
	   GmatAppData::Instance()->GetMainFrame()->GetHelpController()->DisplaySection(link);		
}
Ejemplo n.º 6
0
//------------------------------------------------------------------------------
void AboutDialog::OnHyperLinkClick(wxHyperlinkEvent &event)
{
   if (event.GetEventObject() == theLicenseLink)
   {
      ViewTextDialog *dlg =
         //new ViewTextDialog(this, _T("NASA Open Source Agreement"), false,
         //                   wxDefaultPosition, wxSize(450, 300));
         new ViewTextDialog(this, _T("Apache License, Version 2.0"), false,
                            wxDefaultPosition, wxSize(400, 300));
      
      wxString rootPath = FileManager::Instance()->GetRootPath().c_str();
      wxString fileName = rootPath + "License.txt";
      if (!GmatFileUtil::DoesFileExist(fileName.c_str()))
         fileName = "../License.txt";
      
      wxTextCtrl *text = dlg->GetTextCtrl();
      text->LoadFile(fileName);
      dlg->ShowModal();
   }
}
Ejemplo n.º 7
0
//------------------------------------------------------------------------------
void WelcomePanel::OnOpenSampleScript(wxHyperlinkEvent& event)
{
   std::string sampleDir = event.GetURL().WX_TO_STD_STRING;
   std::string appFullPath = GmatFileUtil::GetApplicationPath();
   std::string appDir = GmatFileUtil::ParsePathName(appFullPath, true);
   std::string sampleFullPath = sampleDir;
   if (GmatFileUtil::IsPathRelative(sampleDir))
      sampleFullPath = appDir + sampleDir;
   sampleFullPath = GmatStringUtil::Replace(sampleFullPath, "\\", "/");
   
   #ifdef DEBUG_SAMPLE_SCRIPT
   MessageInterface::ShowMessage
      ("WelcomePanel::OnOpenSampleScript() entered\n   sampleDir='%s'\n   appDir=%s'\n"
       "   sampleFullPath='%s'\n", sampleDir.c_str(), appDir.c_str(), sampleFullPath.c_str());
   #endif
   
   if (GmatFileUtil::DoesDirectoryExist(sampleFullPath + "/", false))
   {
      wxString samplePath = wxString(sampleFullPath.c_str());
      wxFileDialog dialog(this, _T("Choose a file"), samplePath, _T(""), _T("*.*"));
      if (dialog.ShowModal() == wxID_OK)
      {
         wxString scriptfile;
         scriptfile = dialog.GetPath().c_str();
         #ifdef DEBUG_SAMPLE_SCRIPT
         MessageInterface::ShowMessage("   scriptfile='%s'\n", scriptfile.c_str());
         #endif
         GmatAppData::Instance()->GetMainFrame()->OpenRecentScript(scriptfile, event);
      }
   }
   else
   {
      MessageInterface::PopupMessage
         (Gmat::WARNING_, "Cannot open samples directory, '%s'\n", sampleFullPath.c_str());
   }
}
Ejemplo n.º 8
0
//------------------------------------------------------------------------------
void WelcomePanel::OnOpenRecentScript(wxHyperlinkEvent& event)
{
   GmatAppData::Instance()->GetMainFrame()->OpenRecentScript(event.GetURL(),
                                            event, false);
   GmatAppData::Instance()->GetMainFrame()->CloseWelcomePanel();  // ****
}
Ejemplo n.º 9
0
//---------------------------------------------------------------------------------------
void WelcomeWindow::OnOpenRecent(wxHyperlinkEvent& event)
{
    int i = event.GetId() - lmLINK_Recent1;
    wxCommandEvent myEvent(wxEVT_COMMAND_MENU_SELECTED, wxID_FILE1+i);
    ::wxPostEvent(this, myEvent);
}