Exemple #1
0
void HtmlOutputPane::OnBeforeLoad(IHtmlWndBeforeLoadEvent& event) {
    const wxString url = event.GetURL();
	if (url == wxT("about:blank")) return;

	if (url.StartsWith(wxT("txmt://open"))) {
		m_opener.OpenTxmtUrl(url);

		// Don't try to open it in browser
		event.Cancel(true);
		return;
	}
	
	if (url.StartsWith(wxT("tm-file://"))) {
		wxString path = url.substr(10);

#ifdef __WXMSW__
		path = eDocumentPath::CygwinPathToWin(path); // path may be in unix format, so we have to convert it
#endif

		DecodePath(path); // Spaces transformed to %20 in paths confuses ie
		m_browser->LoadUrl(path);

		// Don't try to open it in browser
		event.Cancel(true);
		return;
	}
}
/* Called when the user presses 'Enter' while
the address bar has focus, or when the 'Go'
toolbar button to the right of the address
bar is pressed.

The path entered may be relative to the current
directory, or absolute.
Basic procedure:
1. Path is expanded (if possible)
2. Any special character sequences ("..", ".") are removed
3. If the path is a URL, pass it straight out, else
4. If the path is relative, add it onto onto the current directory
*/
void Explorerplusplus::OnAddressBarGo(void)
{
	TCHAR szPath[MAX_PATH];
	TCHAR szFullFilePath[MAX_PATH];
	TCHAR szCurrentDirectory[MAX_PATH];

	/* Retrieve the combobox text, and determine if it is a
	valid path. */
	SendMessage(m_hAddressBar,WM_GETTEXT,SIZEOF_ARRAY(szPath),(LPARAM)szPath);

	m_pActiveShellBrowser->QueryCurrentDirectory(SIZEOF_ARRAY(szCurrentDirectory),szCurrentDirectory);
	DecodePath(szPath,szCurrentDirectory,szFullFilePath,SIZEOF_ARRAY(szFullFilePath));

	OpenItem(szFullFilePath,FALSE,FALSE);
}
Exemple #3
0
void HtmlOutputPane::SetPage(const wxString& text) {
#ifdef FEAT_BROWSER

#ifdef __WXMSW__
	// Convert cygwin paths to windows
	wxString html = text;
	unsigned int pos = 0;
	while (pos < html.size()) {
		const size_t startpos = html.find(eDocumentPath::CygdrivePrefix(), pos);
		if (startpos == wxString::npos) break;
		++pos; // to advance if we continue the loop

		// Find the end of path
		unsigned int endpos = startpos+10;
		while (endpos < html.size()) {
			const wxChar c = html[endpos];
			if (c == wxT('"') || c == wxT('\'') || c == wxT('>') || c == wxT('<')) break;
			++endpos;
		}

		// Convert the path
		wxString path = html.substr(startpos, endpos - startpos);
		path = eDocumentPath::CygwinPathToWin(path);
		DecodePath(path); // Spaces transformed to %20 in paths confuses ie

		html.replace(startpos, endpos - startpos, path);

		pos = startpos + path.size();
	}

	m_browser->LoadString(html);
#else
	m_browser->LoadString(text);
#endif

#endif //FEAT_BROWSER
}