Esempio n. 1
0
void drawAboutScreen()
{
	#ifndef DEBUG_MODE
	displayHTML(fb_backBuffer(), &aboutData, 0, 192);
	#endif
	displayHTML(bg_backBuffer(), &aboutData, 192, 192);
}
void STDMETHODCALLTYPE IECrossfireBHO::OnBeforeNavigate2(IDispatch* pDisp, VARIANT* URL, VARIANT* Flags, VARIANT* TargetFrameName, VARIANT* PostData, VARIANT* Headers, VARIANT_BOOL* Cancel) {
	m_contextCreated = false;
	if (!m_firstNavigate) {
		return;
	}

	m_firstNavigate = false;
	std::wstring string(URL->bstrVal);
	size_t index = string.find(DEBUG_START);
	if (index == std::string::npos) {
		return;
	}

	*Cancel = VARIANT_TRUE;

	size_t equalsIndex;
	if ((equalsIndex = string.find('=', index)) != index + wcslen(DEBUG_START)) {
		if ((equalsIndex = string.find(L"%3D", index)) != index + wcslen(DEBUG_START)) {
			displayHTML(L"<html><body>Did not start Crossfire Server<p>Command-line syntax: <tt>iexplore.exe -crossfire-server-port=&lt;port&gt;</tt></body></html>");
			return;
		}
		equalsIndex += 2; /* because found "%3D" instead of "=" */
	}

	index = equalsIndex + 1;
	int port = _wtoi(string.substr(index, 5).c_str());

	if (1000 <= port && port <= 65534) {
		if (startDebugging(port)) {
			std::wstringstream stream;
			stream << "<html><body>Crossfire Server started on port ";
			stream << port;
			stream << "</body></html>";
			displayHTML((wchar_t*)stream.str().c_str());
		} else {
			std::wstringstream stream;
			stream << "<html><body>Failed to start Crossfire Server on port ";
			stream << port;
			stream << "</body></html>";
			displayHTML((wchar_t*)stream.str().c_str());
		}
	} else {
		displayHTML(L"<html><body>Did not start Crossfire Server<p>Valid port range is 1000-65534</body></html>");
	}
}
Esempio n. 3
0
void HTMLPreview::fileChanged()
{
	if(ui->refreshWhen->currentIndex() != 0)
		return;

	QTextDocument *doc = dynamic_cast<QTextDocument*>(sender());

	if(ui->refreshFrom->currentIndex() == 0)
		displayHTML(doc->toPlainText());
}
Esempio n. 4
0
void HTMLPreview::manualRefresh()
{
	Editor *current = mParent->getCurrentEditor();

	BaseFile *file = NULL;
	if(current)
		file = current->getFile();

	switch(ui->refreshFrom->currentIndex())
	{
		case 0:
			if(file)
				displayHTML(file->getTextDocument()->toPlainText());
			break;
		case 1:
			displayURL();
			break;
	}

}
Esempio n. 5
0
void HTMLPreview::fileSaved()
{
	if(ui->refreshWhen->currentIndex() != 1)
		return;

	BaseFile *file = dynamic_cast<BaseFile*>(sender());

	if(file->hasUnsavedChanges())
		return;

	switch(ui->refreshFrom->currentIndex())
	{
		case 0:
			displayHTML(file->getTextDocument()->toPlainText());
			break;
		case 1:
			displayURL();
			break;
	}
}