Ejemplo n.º 1
0
CWebSock::EPageReqResult CWebSock::PrintTemplate(const CString& sPageName, CString& sPageRet, CModule* pModule) {
	SetVars();
	m_Template["PageName"] = sPageName;

	if (pModule) {
		CUser* pUser = pModule->GetUser();
		m_Template["ModUser"] = pUser ? pUser->GetUserName() : "";
		m_Template["ModName"] = pModule->GetModName();

		if (m_Template.find("Title") == m_Template.end()) {
			m_Template["Title"] = pModule->GetWebMenuTitle();
		}
	}

	if (!m_bPathsSet) {
		SetPaths(pModule, true);
	}

	if (m_Template.GetFileName().empty() && !m_Template.SetFile(sPageName + ".tmpl")) {
		return PAGE_NOTFOUND;
	}

	if (m_Template.PrintString(sPageRet)) {
		return PAGE_PRINT;
	} else {
		return PAGE_NOTFOUND;
	}
}
Ejemplo n.º 2
0
void COXCustomizeCaptionPage::OnCheckGradient() 
{
	// TODO: Add your control notification handler code here

	ShowControls();
	SetVars();
}
Ejemplo n.º 3
0
main()
{
	int FixtureIndex;
	double NewOriginOffset,OriginOffsetY,AxisOffsetY;
	double Machinex,Machiney,Machinez,Machinea,Machineb,Machinec;

	GetFixtureIndex(&FixtureIndex);

	GetOriginOffset(&OriginOffsetY, FixtureIndex, Yaxis);

	GetAxisOffset(&AxisOffsetY, Yaxis);
	
	GetMachine(&Machinex,&Machiney,&Machinez,&Machinea,&Machineb,&Machinec);

	// Compute Origin Offset to make DRO zero
	//
	// Since Machine = DRO + OriginOffset + AxisOffset
	//
	// Set DRO = 0 and solve for OriginOffset
	//
	NewOriginOffset = Machiney -  AxisOffsetY;
	SetUserDataDouble(TMP,NewOriginOffset);
	SetVars(5201+FixtureIndex*20+1, 1, TMP);

	DoPC(PC_COMM_UPDATE_FIXTURE);
}
Ejemplo n.º 4
0
main()
{
	int FixtureIndex;
	double NewOriginOffset,OriginOffsetX,AxisOffsetX;
	double Machinex,Machiney,Machinez,Machinea,Machineb,Machinec;

	GetFixtureIndex(&FixtureIndex);

	GetOriginOffset(&OriginOffsetX, FixtureIndex, Xaxis);

	GetAxisOffset(&AxisOffsetX, Xaxis);
	
	GetMachine(&Machinex,&Machiney,&Machinez,&Machinea,&Machineb,&Machinec);

	// Compute Origin Offset to make DRO zero
	//
	// Since Machine = DRO + OriginOffset + AxisOffset
	//
	// Set DRO = 0 and solve for OriginOffset
	//
	NewOriginOffset = Machinex -  AxisOffsetX;

	pD[TMP]=NewOriginOffset;
	SetVars(5201+FixtureIndex*20+0, 1, TMP);

	DoPC(PC_COMM_UPDATE_FIXTURE);
}
Ejemplo n.º 5
0
void SimplexSphereGenerator::spawnPopup()
{
	srand(time(NULL));
	uniform_int_distribution<int> rand2(0, spherePoints.size() - 1);
	static default_random_engine e_rand;
	int iterCount = 1000;

	while (iterCount-- > 0)
	{
		int ind = rand2(e_rand);
		D3DXVECTOR3 p = spherePoints[ind];
		p.y = 0;
		D3DXVec3Normalize(&p, &p);
		D3DXVECTOR4 t;
		D3DXVec3Transform(&t, &p, &matWorld);

		if (t.z > .5f && t.x < -0.2f)
		{
			popupsMutex.lock();
			for (int i = 0; i < POPUPS_COUNT; i++)
				if (!popups[i])
				{
					int x, y;
					while (true)
					{
						windowGenStart:
						x = (int)Window::GetWidth() / 6;
						x = rand() % (x * 2) - x;
						if (abs(x) < 40)
							x = 40 * sign(x);
						if (x < 0)
							x += Window::GetWidth() - 192;
						y = rand() % ((int)Window::GetHeight() - 80 - 128) + 40;
						for (int i = 0; i < POPUPS_COUNT; i++)
							if (popups[i])
								if (popups[i]->IsIn(x, y) || popups[i]->IsIn(x + 192, y) || popups[i]->IsIn(x, y + 128) || popups[i]->IsIn(x + 192, y + 128))
									goto windowGenStart;
						break;
					}
					auto p = new SpherePopup();
					try
					{
						p->SetVars(D3DXVECTOR2(x, y), parrtriangle[ind], ind);
					}
					catch (...)
					{
						delete p;
						popupsMutex.unlock();
						return;
					}
					p->Initialize();
					popups[i] = p;
					break;
				}
			popupsMutex.unlock();
			break;
		}
	}
}
Ejemplo n.º 6
0
void COXCustomizeCaptionPage::OnButtonSmalltextfont() 
{
	// TODO: Add your control notification handler code here
	
	UpdateData(TRUE);
	if(m_clrTextSmall!=m_clrText)
	{
		m_clrText=m_clrTextSmall;
	}
	UpdateData(FALSE);
	SetVars();
}
Ejemplo n.º 7
0
void COXCustomizeCaptionPage::OnChangeEditNumshades() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the COXCustomizePage::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	
	if(m_bInitialized)
		SetVars();
}
Ejemplo n.º 8
0
main()
{
	int Answer;
	double *pD = (double *)persist.UserData;
	
//	DoPC(PC_COMM_ESTOP);
//	DoPC(PC_COMM_HALT);
//	DoPC(PC_COMM_EXECUTE);
//	DoPC(PC_COMM_SINGLE_STEP);
//	DoPCFloat(PC_COMM_SET_FRO,0.25f);
//	DoPCFloat(PC_COMM_SET_FRO_INC,1.1f);
//	DoPCFloat(PC_COMM_SET_X,0.0);
//	DoPCFloat(PC_COMM_SET_Y,0.0);
//	DoPCFloat(PC_COMM_SET_Z,1.25);
//	DoPCInt(PC_COMM_USER_BUTTON,3);
//	DoPCInt(PC_COMM_MCODE,3);
//	printf("Answer is No\n");

//	Answer = MsgBox("Hello World",MB_YESNO|MB_ICONEXCLAMATION);
//	if (Answer == IDYES)
//		printf("Answer is Yes\n");
//	else
//		printf("Answer is No\n");
	

//	MDI("G0 X1.2 Y2.2 Z3.3");


	// put 3 double values in the persist vars 
	
	pD[10] = 123.456;
	pD[11] = 1000.0;
	pD[12] = 999.9;
	
	// transfer up to the GCode Vars
	SetVars(100,3,10);  // Upload 3 to GCode 100 from persist 10   
	
//	MDI("#100 = [#100 + 1]");
		
	// read them back into different persist Vars
//	GetVars(100,3,13);  // Download 3 from GCode 100 to persist 13 

//	printf("%f %f %f\n",pD[13],pD[14],pD[15]);
	
	DoPCInt(PC_COMM_GETAXISRES, 150);
	printf("XRes=%f\n", *(float *)&persist.UserData[150]);
	printf("YRes=%f\n", *(float *)&persist.UserData[151]);
	printf("ZRes=%f\n", *(float *)&persist.UserData[152]);
	printf("ARes=%f\n", *(float *)&persist.UserData[153]);
}
Ejemplo n.º 9
0
void Cmd_TextureMix()
{
    miptex32_t		*qtex32;
    char			filename[1024];
    int				size;

    InitVars();

    GetScriptToken (false);

    strcpy(root, token);
    RemoveExt(root);
    RemoveLeading(root);

    strcpy(filename, ExpandPathAndArchive(token));
    if (SetVars(filename))
    {
        // Create combined texture
        percent = ((TotalArea() * 100) / (out.w * out.h));
        printf("Total area consumed : %d%%\n", percent);
        printf("Texture resolution  : %dx%d pixels.\n", xcharsize, ycharsize);
        CreateMain();

        // Save image as m32
        sprintf (filename, "%spics/misc/%s.m32", gamedir, out.name);
        qtex32 = CreateMip32((unsigned *)outpixels, out.w, out.h, &size, false);

        qtex32->contents = 0;
        qtex32->value = 0;
        qtex32->scale_x = 1.0;
        qtex32->scale_y = 1.0;
        sprintf (qtex32->name, "misc/%s", out.name);

        printf ("\n\nwriting %s\n", filename);
        SaveFile (filename, (byte *)qtex32, size);
        free (qtex32);

        // Save out script file
        sprintf (filename, "%spics/misc/%s.fnt", gamedir, outscript);
        printf("Writing %s as script file\n", filename);
        if (!SaveScript(filename))
        {
            printf("Unable to save output script.\n");
        }
    }
    printf("Everythings groovy.\n");
    Cleanup();
}
Ejemplo n.º 10
0
bool SqwBase::SetVarIfAvail(const std::string& strKey, const std::string& strNewVal)
{
	std::vector<t_var> vecVars = GetVars();
	for(const t_var& var : vecVars)
	{
		if(strKey == std::get<0>(var))
		{
			t_var varNew = var;
			std::get<2>(varNew) = strNewVal;
			SetVars(std::vector<t_var>({varNew}));

			return true;
		}
	}

	return false;
}
Ejemplo n.º 11
0
void COXCustomizeCaptionPage::OnSelchangeComboTextEllipsis() 
{
	// TODO: Add your control notification handler code here
	
	SetVars();
}
Ejemplo n.º 12
0
void COXCustomizeCaptionPage::OnSelchangeComboGradientAlignment() 
{
	// TODO: Add your control notification handler code here
	
	SetVars();
}
Ejemplo n.º 13
0
void COXCustomizeCaptionPage::OnButtonBackcolor() 
{
	// TODO: Add your control notification handler code here
	
	SetVars();
}
Ejemplo n.º 14
0
void AllocateurDInconnues::RestoreState(const cStateAllocI & aS)
{
    AssertUsable(aS);
    SetVars(&(aS.mVals[0]));
}