Exemplo n.º 1
0
bool wxHtmlHelpController::Display(const wxString& x)
{
    CreateHelpWindow();
    bool success = m_helpWindow->Display(x);
    MakeModalIfNeeded();
    return success;
}
Exemplo n.º 2
0
EXPORT void wHelp( const char * topic )		
{
	char *htmlFile;

	if( !wHelpWindow )
	{
		directory = malloc( BUFSIZ );
		assert( directory != NULL );
			
		sprintf( directory, "%s/html/", wGetAppLibDir());
		
		wHelpWindow = CreateHelpWindow();
		/* load the default content */
		load_into_view ("index.html", MAIN_VIEW);
	}

	/* need space for the 'html' extension plus dot plus \0 */
	htmlFile = malloc( strlen( topic ) + 6 );
	assert( htmlFile != NULL );
	
	sprintf( htmlFile, "%s.html", topic );
	
	load_into_view (htmlFile, MAIN_VIEW);
	gtk_widget_show_all(wHelpWindow);
	gtk_window_present(GTK_WINDOW(wHelpWindow));
}
Exemplo n.º 3
0
bool wxHtmlHelpController::DisplayIndex()
{
    CreateHelpWindow();
    bool success = m_helpWindow->DisplayIndex();
    MakeModalIfNeeded();
    return success;
}
Exemplo n.º 4
0
bool wxHtmlHelpController::DisplayIndex()
{
    CreateHelpWindow();
    bool success = m_helpFrame->DisplayIndex();
    AddGrabIfNeeded();
    return success;
}
Exemplo n.º 5
0
bool wxHtmlHelpControllerEx::Display(int id)
{
    CreateHelpWindow();
    bool success = m_helpWindow->Display(id);
    MakeModalIfNeeded();
    return success;
}
Exemplo n.º 6
0
bool wxHtmlHelpController::Display(const wxString& x)
{
    CreateHelpWindow();
    bool success = m_helpFrame->Display(x);
    AddGrabIfNeeded();
    return success;
}
Exemplo n.º 7
0
bool wxHtmlHelpController::KeywordSearch(const wxString& keyword,
                                         wxHelpSearchMode mode)
{
    CreateHelpWindow();
    bool success = m_helpWindow->KeywordSearch(keyword, mode);
    MakeModalIfNeeded();
    return success;
}
Exemplo n.º 8
0
void wxHtmlHelpController::Display(const wxString& x)
{
    int cnt;
    int i;
    wxFileSystem fsys;
    wxFSFile *f;

    CreateHelpWindow();

    /* 1. try to open given file: */

    cnt = m_BookRecords.GetCount();
    for (i = 0; i < cnt; i++) {
        f = fsys.OpenFile(m_BookRecords[i].GetBasePath() + x);
        if (f) {
            m_HtmlWin -> LoadPage(m_BookRecords[i].GetBasePath() + x);
            delete f;
            return;
        }
    }


    /* 2. try to find a book: */

    for (i = 0; i < cnt; i++) {
        if (m_BookRecords[i].GetTitle() == x) {
            m_HtmlWin -> LoadPage(m_BookRecords[i].GetBasePath() + m_BookRecords[i].GetStart());
            return;
        }
    }

    /* 3. try to find in contents: */

    cnt = m_ContentsCnt;
    for (i = 0; i < cnt; i++) {
        if (strcmp(m_Contents[i].m_Name, x) == 0) {
            m_HtmlWin -> LoadPage(m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page);
            return;
        }
    }


    /* 4. try to find in index: */

    cnt = m_IndexCnt;
    for (i = 0; i < cnt; i++) {
        if (strcmp(m_Index[i].m_Name, x) == 0) {
            m_HtmlWin -> LoadPage(m_Index[i].m_Book -> GetBasePath() + m_Index[i].m_Page);
            return;
        }
    }


    /* 5. if everything failed, search the documents: */

    KeywordSearch(x);
}
Exemplo n.º 9
0
void wxHtmlHelpController::DisplayIndex()
{
    CreateHelpWindow();
    m_Frame -> Raise();
    if (!m_Splitter -> IsSplit()) {
       m_NavigPan -> Show(TRUE);
       m_HtmlWin -> Show(TRUE);
       m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
    }
    m_NavigPan -> SetSelection(1);
}
Exemplo n.º 10
0
void wxHtmlHelpController::Display(const int id)
{
    CreateHelpWindow();

    for (int i = 0; i < m_ContentsCnt; i++) {
        if (m_Contents[i].m_ID == id) {
            m_HtmlWin -> LoadPage(m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page);
            return;
        }
    }
}
Exemplo n.º 11
0
bool wxHtmlHelpControllerEx::KeywordSearch(const wxString& keyword
#if wxCHECK_VERSION(2,5,0)
        , wxHelpSearchMode mode
#endif
     )
{
    CreateHelpWindow();
    bool success = m_helpWindow->KeywordSearch(keyword
#if wxCHECK_VERSION(2,5,0)
        , mode
#endif
        );
    MakeModalIfNeeded();
    return success;
}
Exemplo n.º 12
0
void Scene_End::Start() {
	CreateCommandWindow();
	CreateHelpWindow();
}
Exemplo n.º 13
0
bool wxHtmlHelpController::KeywordSearch(const wxString& keyword)
{
    int foundcnt = 0;
    CreateHelpWindow();
    // if these are not set, we can't continue
    if (! (m_SearchList && m_HtmlWin))
       return FALSE;
    m_Frame -> Raise();
    if (m_Splitter && m_NavigPan && m_SearchButton) {
       if (!m_Splitter -> IsSplit()) {
          m_NavigPan -> Show(TRUE);
          m_HtmlWin -> Show(TRUE);
          m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
       }
       m_NavigPan -> SetSelection(2);
       m_SearchList -> Clear();
       m_SearchText -> SetValue(keyword);
       m_SearchButton -> Enable(FALSE);
    }
    {
        int cnt = m_ContentsCnt;
        wxSearchEngine engine;
        wxFileSystem fsys;
        wxFSFile *file;
        wxString lastpage = wxEmptyString;
        wxString foundstr;

#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7))
        MyProgressDlg progress(m_Frame);

        wxStaticText *prompt = new wxStaticText(&progress, -1, "", wxPoint(20, 50), wxSize(260, 25), wxALIGN_CENTER);
        wxGauge *gauge = new wxGauge(&progress, -1, cnt, wxPoint(20, 20), wxSize(260, 25));
        wxButton *btn = new wxButton(&progress, wxID_CANCEL, _("Cancel"), wxPoint(110, 70), wxSize(80, 25));
        btn = btn; /* fool compiler :-) */
        prompt -> SetLabel(_("No matching page found yet"));

	progress.Centre(wxBOTH);
        progress.Show(TRUE);
#else
	wxProgressDialog progress(_("Searching..."), _("No matching page found yet"), cnt, m_Frame, wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE);
#endif

        engine.LookFor(keyword);

        for (int i = 0; i < cnt; i++) {
#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7))
            gauge -> SetValue(i);
            if (progress.m_Canceled) break;
#else
    	    if (progress.Update(i) == FALSE) break;
#endif
	    wxYield();

            file = fsys.OpenFile(m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page);
            if (file) {
                if (lastpage != file -> GetLocation()) {
                    lastpage = file -> GetLocation();
                    if (engine.Scan(file -> GetStream())) {
                        foundstr.Printf(_("Found %i matches"), ++foundcnt);
#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7))
                        prompt -> SetLabel(foundstr);
#else
    	    	    	progress.Update(i, foundstr);
#endif
                        wxYield();
                        m_SearchList -> Append(m_Contents[i].m_Name, (char*)(m_Contents + i));
                    }
                }
                delete file;
            }
        }

#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7))
        progress.Close(TRUE);
#endif
    }
    if (m_SearchButton)
	m_SearchButton -> Enable(TRUE);
    if (m_SearchText) {
	m_SearchText -> SetSelection(0, keyword.Length());
	m_SearchText -> SetFocus();
    }
    if (foundcnt) {
        HtmlContentsItem *it = (HtmlContentsItem*) m_SearchList -> GetClientData(0);
        if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
    }
    return (foundcnt > 0);
}