Beispiel #1
0
	void QSPCallBacks::RefreshInt(QSP_BOOL isRedraw)
	{
		int i, numVal;
		bool isScroll, isCanSave;
		QSP_CHAR *strVal, *imgPath;

		UpdateGamePath();

		const QSP_CHAR *mainDesc = QSPGetMainDesc();
		const QSP_CHAR *varsDesc = QSPGetVarsDesc();

		m_isHtml = QSPGetVarValues(QSP_FMT("USEHTML"), 0, &numVal, &strVal) && numVal;

		m_window->GetVars()->SetIsHtml(m_isHtml);
		if (QSPIsVarsDescChanged())
			m_window->GetVars()->SetText(QString::fromWCharArray(varsDesc)/*, isScroll */);

		m_window->GetDesc()->SetIsHtml(m_isHtml);
		if (QSPIsMainDescChanged())
			m_window->GetDesc()->SetText(QString::fromWCharArray(mainDesc));

		if (QSPIsActionsChanged())
		{
			m_window->GetActions()->ClearItems();
			int actionsCount = QSPGetActionsCount();
			for (i = 0; i < actionsCount; i++)
			{
				QSPGetActionData(i, &imgPath, &strVal);
				m_window->GetActions()->AddItem(QString::fromWCharArray(imgPath), QString::fromWCharArray(strVal));
			}
		}
		m_window->GetActions()->setCurrentRow(QSPGetSelActionIndex());
		if (QSPIsObjectsChanged())
		{
			int objectsCount = QSPGetObjectsCount();
			m_window->GetObjects()->ClearItems();
			for (i = 0; i < objectsCount; ++i)
			{
				QSPGetObjectData(i, &imgPath, &strVal);
				m_window->GetObjects()->AddItem(QString::fromWCharArray(imgPath), QString::fromWCharArray(strVal));
			}
		}
		m_window->GetObjects()->setCurrentRow(QSPGetSelObjectIndex());
		if (QSPGetVarValues(QSP_FMT("BACKIMAGE"), 0, &numVal, &strVal) && strVal && *strVal)
			m_window->GetDesc()->LoadBackImage(m_gamePath + QString::fromWCharArray(strVal));
		else
			m_window->GetDesc()->LoadBackImage("");

		m_window->ApplyParams();
	}
Beispiel #2
0
void QSPCallBacks::RefreshInt(QSP_BOOL isRedraw)
{
	static int oldFullRefreshCount = 0;
	int i, numVal;
	bool isScroll, isCanSave;
	QSPString strVal;
	QSPListItem items[MAX_LIST_ITEMS];
	if (m_frame->IsQuit()) return;
	// -------------------------------
	isScroll = !(QSPGetVarValues(QSP_STATIC_STR(QSP_FMT("DISABLESCROLL")), 0, &numVal, &strVal) && numVal);
	isCanSave = !(QSPGetVarValues(QSP_STATIC_STR(QSP_FMT("NOSAVE")), 0, &numVal, &strVal) && numVal);
	m_isHtml = QSPGetVarValues(QSP_STATIC_STR(QSP_FMT("USEHTML")), 0, &numVal, &strVal) && numVal;
	// -------------------------------
	m_frame->GetVars()->SetIsHtml(m_isHtml);
	if (QSPIsVarsDescChanged())
	{
		QSPString varsDesc = QSPGetVarsDesc();
		m_frame->GetVars()->SetText(wxString(varsDesc.Str, varsDesc.End), isScroll);
	}
	// -------------------------------
	int fullRefreshCount = QSPGetFullRefreshCount();
	if (oldFullRefreshCount != fullRefreshCount)
	{
		isScroll = false;
		oldFullRefreshCount = fullRefreshCount;
	}
	m_frame->GetDesc()->SetIsHtml(m_isHtml);
	if (QSPIsMainDescChanged())
	{
		QSPString mainDesc = QSPGetMainDesc();
		m_frame->GetDesc()->SetText(wxString(mainDesc.Str, mainDesc.End), isScroll);
	}
	// -------------------------------
	m_frame->GetActions()->SetIsHtml(m_isHtml);
	m_frame->GetActions()->SetIsShowNums(m_frame->IsShowHotkeys());
	if (QSPIsActionsChanged())
	{
		int actionsCount = QSPGetActions(items, MAX_LIST_ITEMS);
		m_frame->GetActions()->BeginItems();
		for (i = 0; i < actionsCount; ++i)
			m_frame->GetActions()->AddItem(wxString(items[i].Image.Str, items[i].Image.End), wxString(items[i].Name.Str, items[i].Name.End));
		m_frame->GetActions()->EndItems();
	}
	m_frame->GetActions()->SetSelection(QSPGetSelActionIndex());
	m_frame->GetObjects()->SetIsHtml(m_isHtml);
	if (QSPIsObjectsChanged())
	{
		int objectsCount = QSPGetObjects(items, MAX_LIST_ITEMS);
		m_frame->GetObjects()->BeginItems();
		for (i = 0; i < objectsCount; ++i)
			m_frame->GetObjects()->AddItem(wxString(items[i].Image.Str, items[i].Image.End), wxString(items[i].Name.Str, items[i].Name.End));
		m_frame->GetObjects()->EndItems();
	}
	m_frame->GetObjects()->SetSelection(QSPGetSelObjectIndex());
	// -------------------------------
	if (QSPGetVarValues(QSP_STATIC_STR(QSP_FMT("BACKIMAGE")), 0, &numVal, &strVal) && strVal.Str && strVal.Str != strVal.End)
		m_frame->GetDesc()->LoadBackImage(m_gamePath + wxString(strVal.Str, strVal.End));
	else
		m_frame->GetDesc()->LoadBackImage(wxEmptyString);
	// -------------------------------
	m_frame->ApplyParams();
	if (isRedraw)
	{
		m_frame->EnableControls(false, true);
		m_frame->Update();
		wxTheApp->Yield(true);
		if (m_frame->IsQuit()) return;
		m_frame->EnableControls(true, true);
	}
	m_frame->GetGameMenu()->Enable(ID_SAVEGAMESTAT, isCanSave);
}