void GBSideDebuggerView::DrawSharedMemory(GBRect & box) {
	DrawBox(box);
	short numsWide = world.BackgroundTilesX();
	short numsHigh = world.BackgroundTilesY();
	short minNumThisPane = numsWide * numsHigh * pane; //actually the min is 1 more, because of silly 1-based numbering
	
	const GBSide * side = world.SelectedSide();
	
// determine range, for color-coding
	GBNumber smallest = kInfinity;
	GBNumber largest = -kInfinity;
	int i;
	for (i = 0; i < numsHigh; i++)
		for (int j = 1; j <= numsWide; j++) {
			bool worked = false;
			GBNumber read = GetSM(minNumThisPane + i*numsWide + j, &worked, side);
			if(worked) {
				smallest = min(smallest, read);
				largest = max(largest, read);
			}
		}
	GBNumber range = max(largest - smallest, kEpsilon);
// draw main
	short curY = box.top + 16;
	for (i = numsHigh; i >= 0; i--) { //starts at numsHigh for header row
		short curX = box.left + 5;
		if (i != numsHigh) {
			DrawStringLeft(ToString(minNumThisPane + i*numsWide) + ":", curX, curY, 10, GBColor(0), true);
		} else {
			DrawStringLeft("Shared Mem", curX, curY, 10, GBColor(0,0,0), true);
		}
		curX += 30;

		for (int j = 1; j <= numsWide; j++) {
			curX += 75;
			if (numsHigh == i) {
				DrawStringRight(ToString(j), curX, curY, short(10), GBColor(0), true);
			} else {
				bool worked = false;
				short curNum = minNumThisPane + i*numsWide + j;
				GBNumber read = GetSM(curNum, &worked, side);

				GBColor color = GBColor(0,0,1).Mix(float(((read - smallest) / range).ToDouble()), GBColor(1,0,0));
				if (worked)
					DrawStringRight(ToString(read, 2, false), curX, curY, short(10), color);
			}
		}
		curY += 15;
	}
}
Exemplo n.º 2
0
wxString wxGUIAppTraits::GetDesktopEnvironment() const
{
    wxString de = wxSystemOptions::GetOption(wxT("gtk.desktop"));
#if wxUSE_DETECT_SM
    if ( de.empty() )
    {
        static const wxString s_SM = GetSM();

        if (s_SM == wxT("GnomeSM"))
            de = wxT("GNOME");
        else if (s_SM == wxT("KDE"))
            de = wxT("KDE");
    }
#endif // wxUSE_DETECT_SM

    return de;
}
Exemplo n.º 3
0
long CMessage::DefaultRun()
{
	switch( GetType() )
	{
	case BASEMSG_Socket_Accept:
		{
			//GetGame()->OnGameServerConnect(GetIP(), GetSocketID());
		}
		break;
	case BASEMSG_Socket_Close:
		{
			if(GetNetFlag()&NF_SCC_Client)
			{
				GetSM()->OnSCCClose();
			//	CMessage::UnMapSCCIDSocket(GetSocketID());
			}
		}
		break;
	}
	return true;
}
Exemplo n.º 4
0
void OnCtrlMessage(CMessage* pMsg)
{
	DWORD lSocketID = pMsg->GetSocketID();
	switch(pMsg->GetType())
	{
	case MSG_SCC2SM_CTRL_Request_START:
		{
			long lGappID = pMsg->GetLong();
			CHECKGAPP(lGappID);
			pGapp->Start();
			LogTools::OutLogAndTxt(AppFrame::GetText("IDS_SM_TIP41"),lGappID);
		}
		break;
	case MSG_SCC2SM_CTRL_Request_SHUTDOWN:
		{
			long lGappID = pMsg->GetLong();
			CHECKGAPP(lGappID);				
			pGapp->ShutDown();
			LogTools::OutLogAndTxt(AppFrame::GetText("IDS_SM_TIP42"),lGappID);
		}
		break;
	case MSG_SCC2SM_CTRL_Request_UpdateGapp:
		{
			long lGappID = pMsg->GetLong();
			CHECKGAPP(lGappID);
			BYTE b=pMsg->GetByte();
			//更新到最新版本
			pGapp->SetIsLatest(b);
			pGapp->CheckVersion();
		}
		break;
	case MSG_SCC2SM_CTRL_Request_UpdateTypeGapp:
		{
			DBReadSet dbReadSet;
			pMsg->GetDBReadSet(dbReadSet);
			long lType = dbReadSet.GetLongFromByteArray();
			GetSM()->UpdateGappByType(lType,dbReadSet);
	
		}
		break;
	case MSG_SCC2SM_CTRL_Request_RESTARTCOM:
		{
			ExitWindowsEx(EWX_REBOOT,0);
		}
		break;
		//更新相关
	case MSG_SCC2SM_CTRL_Re_File:
		{
			BYTE bFile = pMsg->GetByte();	
			long lGappID = pMsg->GetLong();
			long lType = pMsg->GetLong();
			CHECKGAPP(lGappID);
			if (!bFile)
			{
				//更新过程中获取文件失败,则结束更新流程
				pGapp->SetIsLatest(0);
				char filename[BASE_NAME_SIZE]="";
				pMsg->GetStr(filename,BASE_NAME_SIZE);
				GetSM()->SendError(AppFrame::GetText("IDS_SM_TIP43"),lGappID,pGapp->GetDisplayName(),filename);
				break;
			}
			DBReadSet dbreadset;
			pMsg->GetDBReadSet(dbreadset);
			//解析文件
			pGapp->GetFile(dbreadset); 
			
		}
		break;
	case MSG_SCC2SM_CTRL_Re_ServerPack:
		{		
			DBReadSet dbreadset;
			pMsg->GetDBReadSet(dbreadset);
			
			long lGappID = dbreadset.GetLongFromByteArray();
			long lType = dbreadset.GetLongFromByteArray();
			BYTE bFile = dbreadset.GetByteFromByteArray();	
			CHECKGAPP(lGappID);
			if (!bFile)
			{
				LogTools::OutLogAndTxt(AppFrame::GetText("IDS_SM_TIP44"),lGappID);
				break;
			}
			pGapp->WritePackRes(dbreadset);
		}
		break;
	case MSG_SCC2SM_CTRL_Request_GappAction:
		{
			long SMID=pMsg->GetLong();
			long lGappID = pMsg->GetLong();
			CHECKGAPP(lGappID);
			long actionID=pMsg->GetLong();	
			/*LogTools::OutLogAndTxt(AppFrame::GetText("IDS_SM_TIP45"),
				SMID,lGappID,pGapp->GetName(),actionID);*/
			if (pGapp->GetState()==eSS_Busy)
			{
				GetSM()->SendError(AppFrame::GetText("IDS_SM_TIP88"),pGapp->GetDisplayName());
				break;
			}
			pMsg->SetType(MSG_SM2GAPP_ACTION);
			pMsg->SendToGapp(lGappID);
			
		}
		break;
	case MSG_SCC2SM_CTRL_Request_SMAction:
		{
			long lSMID=pMsg->GetLong();
			long lGappID=pMsg->GetLong();
			switch(pMsg->GetLong())
			{
			case SETPORT:
				{
					long lport=pMsg->GetLong();
					CHECKGAPP(lGappID);
					if (pGapp->GetType()==eGT_LS)
					{
						bool ret= pGapp->SetLSPort(lport);
						CMessage msg(MSG_SM2SCC_CTRL_Notify_SMAction);
						msg.Add(lSMID);
						msg.Add(lGappID);
						msg.Add((long)SETPORT);
						if(ret) 
						{	
							msg.Add((BYTE)1);
						}
						else
							msg.Add((BYTE)0);
						msg.SendToAllSCC();
					}
				}
				break;
			default:
				break;
			}
		}
	default:
		break;
	}
}