Exemplo n.º 1
0
//---------------------------------------------------------------------------------------
void BooksDlg::OnLinkClicked(wxHtmlLinkEvent& event)
{
    const wxHtmlLinkInfo& link = event.GetLinkInfo();
    wxString sLocation = link.GetHref();

    //study guide
    if (sLocation == "lenmus#study-guide")
    {
        HelpSystem* pHelp = m_appScope.get_help_controller();
        pHelp->display_section(10101);    //study-guide
        //show_html_document("study-guide.htm");
        return;
    }

    //verify if it is a LenMus command link
    int iPos = sLocation.Find("lenmus#");
    if (iPos == wxNOT_FOUND)
    {
        // external link
        ::wxLaunchDefaultBrowser(sLocation);
    }
    else
    {
        wxString filename = sLocation.substr(12);
        Paths* pPaths = m_appScope.get_paths();
        wxString sPath = pPaths->GetBooksPath();
        wxFileName oFile(sPath, filename, wxPATH_NATIVE);
        if (!oFile.FileExists())
        {
            //try to use the english version
            sPath = pPaths->GetLocaleRootPath();
            oFile.AssignDir(sPath);
            oFile.AppendDir("en");
            oFile.AppendDir("books");
            oFile.SetFullName(filename);
            if (!oFile.FileExists())
            {
                wxMessageBox(_("Sorry: File not found!"));
                LOMSE_LOG_WARN(str(boost::format("File '%s' not found!")
                               % oFile.GetFullPath().wx_str() ));
                return;
            }
        }

        m_fullName = oFile.GetFullPath();
        EndModal(wxID_OK);
    }
}
Exemplo n.º 2
0
//---------------------------------------------------------------------------------------
void WelcomeWindow::ShowDocument(wxString& sDocName)
{
    Paths* pPaths = m_appScope.get_paths();
    wxString sPath = pPaths->GetLocalePath();
    wxFileName oFile(sPath, sDocName, wxPATH_NATIVE);
	if (!oFile.FileExists())
	{
		//try to display the english version
		sPath = pPaths->GetLocaleRootPath();
		oFile.AssignDir(sPath);
		oFile.AppendDir("en");
		oFile.SetFullName(sDocName);
        if (!oFile.FileExists())
        {
            wxMessageBox(_("Sorry: File not found!"));
            wxLogMessage("[WelcomeWindow::ShowDocument] File %s' not found!",
                         oFile.GetFullPath().wx_str() );
            return;
        }
	}
    ::wxLaunchDefaultBrowser( oFile.GetFullPath() );
}
Exemplo n.º 3
0
//---------------------------------------------------------------------------------------
void BooksDlg::show_html_document(const wxString& sDocName)
{
    Paths* pPaths = m_appScope.get_paths();
    wxString sPath = pPaths->GetLocalePath();
    wxFileName oFile(sPath, sDocName, wxPATH_NATIVE);
	if (!oFile.FileExists())
	{
		//try to display the english version
		sPath = pPaths->GetLocaleRootPath();
		oFile.AssignDir(sPath);
		oFile.AppendDir("en");
		oFile.SetFullName(sDocName);
        if (!oFile.FileExists())
        {
            wxMessageBox(_("Sorry: File not found!"));
            LOMSE_LOG_ERROR(str(boost::format("File %s' not found!")
                            % oFile.GetFullPath().wx_str() ));
            return;
        }
	}
    ::wxLaunchDefaultBrowser( oFile.GetFullPath() );
}