Esempio n. 1
0
void CBMPImportSetupDlg::OnPaint()
{
	CPaintDC dc(this);    // device context for painting
	CRect    frameImage;
	CBrush   brImage(RGB(0, 0, 0));
	int      dx, dy, imax;

	// frame
	frameImage = m_rectImage;
	frameImage.InflateRect(2, 2);
	dc.FrameRect((LPRECT)frameImage, &brImage);

	if (m_BTCData)
	{
		CStatic *help = (CStatic *)GetDlgItem(IDC_HMAP_HELP);
		help->ShowWindow(SW_HIDE);

		dx = m_rectImage.right - m_rectImage.left;
		dy = m_rectImage.bottom - m_rectImage.top;

		if (m_BTCData->GetWidth() != m_BTCData->GetHeight())
		{
			imax = max(m_BTCData->GetWidth(), m_BTCData->GetHeight());

			dx = (dx * m_BTCData->GetWidth()) / imax;
			dy = (dy * m_BTCData->GetHeight()) / imax;
		}

		m_BTCData->DrawImage(dc.m_hDC, m_rectImage.left, m_rectImage.top, dx, dy);
	}

}
BOOL AboutDialog::OnInitDialog()
{
	CStatic* name = (CStatic*)GetDlgItem(IDC_ABOUTNAME);
	CStatic* org = (CStatic*)GetDlgItem(IDC_ABOUTORG);
	CStatic* evalMessage = (CStatic*)GetDlgItem(IDC_EVALMESSAGE);
	CStatic* daysRemaining = (CStatic*)GetDlgItem(IDC_DAYSREMAINING);
    CStatic* version = (CStatic*)GetDlgItem(IDC_REGVERSION);
	RegistrationInfo info;
	RegistrationDialog::GetRegistrationInfo(&info);
    char* versionCaption = getVersionCaption();
    if (versionCaption)
        version->SetWindowText(versionCaption);

	if (info.isRegistered)
	{
		name->SetWindowText(info.name);
		org->SetWindowText(info.organization);
		evalMessage->ShowWindow(SW_HIDE);
		daysRemaining->ShowWindow(SW_HIDE);
	}
	else
	{
		name->SetWindowText("Evaluation Copy");
		org->SetWindowText("");
		int remaining = info.daysRemaining;
		if (remaining < 0)
		{
			daysRemaining->SetWindowText("Expired");
			theApp.m_expired = TRUE;
		}
		else
		{
			char buf[16];
			sprintf_s(buf, sizeof(buf), "%d", remaining);
			daysRemaining->SetWindowText(buf);
		}
	}
	CWnd* item = GetDlgItem(IDOK);
	if (item)
		((CButton*)item)->SetButtonStyle(BS_DEFPUSHBUTTON);
	SetDefID(IDOK);
	return FALSE;
}
Esempio n. 3
0
BOOL CBMPImportSetupDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	CStatic *hmap = (CStatic *)GetDlgItem(IDC_IMAGE);

	hmap->ShowWindow(SW_HIDE);
	hmap->GetWindowRect(&m_rectImage);
	ScreenToClient(&m_rectImage);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 4
0
void CNBBindListViewCtrl::OnPaint(HDC /*wParam*/)
{
	CRect rtCol, rtHeader, rtSubItem;
	CHeaderCtrl header = GetHeader();
	header.GetWindowRect( rtHeader );
	ScreenToClient( rtHeader );
	header.GetItemRect( 0, rtCol) ;
	rtCol.OffsetRect( rtHeader.TopLeft() );

	while ( !m_vtRowHeader.empty() )
	{
		CCustomStaticCtrl *pWnd = m_vtRowHeader.front();
		m_vtRowHeader.pop_front();
		pWnd->DestroyWindow();
		delete pWnd;
	}

	// For vertical scroll.
	if ( GetItemCount() > 0 )
	{
		GetSubItemRect(0, 0, LVIR_BOUNDS, rtSubItem);
	}
	else
	{
		rtSubItem.top = rtCol.bottom;
	}

	for ( UINT i=0; i < m_nMaxCount; i++ )
	{
		CCustomStaticCtrl *pWnd;
		CStatic staticCtrl;
		pWnd = new CCustomStaticCtrl;
		CRect rtItem;
		static int nHeight = 14;
		rtItem.left = rtCol.left;
		rtItem.right = rtCol.right-2;
		rtItem.top = rtSubItem.top + i * nHeight;
		rtItem.bottom = rtItem.top + nHeight-1;
		
		if ( rtItem.top < rtCol.bottom )
			continue;
		WTL::CString strTitle;
		strTitle.Format(_T("%d"), i);
		staticCtrl.Create( m_hWnd, rtItem, strTitle,
			WS_CHILD | SS_CENTER | WS_DISABLED);
		staticCtrl.ShowWindow( SW_SHOW );
		pWnd->SubclassWindow( staticCtrl.m_hWnd );
		m_vtRowHeader.push_back( pWnd );
	}
	DefWindowProc();
}
Esempio n. 5
0
BOOL FW_HtmlCtrl::CreateFromStatic(UINT nID, CWnd* pParent)
{
	CStatic wndStatic;
	if (!wndStatic.SubclassDlgItem(nID, pParent))
		return FALSE;
	
	CRect rc;
	wndStatic.GetWindowRect(&rc);
	pParent->ScreenToClient(&rc);
	wndStatic.ShowWindow(SW_HIDE);
	
	return Create(NULL,
		NULL,
		(WS_CHILD | WS_VISIBLE ),
		rc,
		pParent,
		nID,
		NULL);
}
void DialogObjProp::OP_COMPCB()
{
	CComboBox* complb = (CComboBox*)GetDlgItem(IDC_CBCOMPONENT);
	CListBox* objList = (CListBox*)parentWnd->GetObjList()->GetDlgItem(IDC_OBJLIST);
	int curSel = complb->GetCurSel() ;
	Gameobject* obj = parentWnd->theApp->GetProject()->GetScene()->GetSceneObject(objList->GetCurSel());
	Component* compSel = obj->GetComponent(curSel);
	if (strcmp(compSel->GetIdentifier(),CTYPE_MESHRENDERER))
	{
		ClearTempIDS();

		RECT tr;

		tr.top = 275;
		tr.left = 40;
		tr.bottom = tr.top + 20;
		tr.right = tr.left + 120;

		CStatic* text = new CStatic();
		text->Create("Linked Mesh: ",WS_VISIBLE,tr,this,TEMPID_0);
		text->ShowWindow(SW_SHOW);

		tr.top = 300;
		tr.bottom = tr.top + 30;
		CComboBoxEx* cb = new CComboBoxEx();
		cb->Create(WS_VISIBLE,tr,this,TEMPID_1);
		cb->ShowWindow(SW_SHOW);
		for (int i = 0, ListItem = 1; i < obj->GetNumberOfComponent(); i++)
		{
			if (strcmp(obj->GetComponent(i)->GetIdentifier(), CTYPE_MESH) )
			{
				char name[512];
				obj->GetComponent(i)->GetName(name, 512);/*
				cb->AddString(name);
				cb->SetItemData(ListItem, i);*/
				ListItem++;
			}
		}
	}
}
void CTestPlayDialog::OnStart() 
{
	//
	GetDlgItem(ID_START)->EnableWindow(FALSE);
	GetDlgItem(ID_STOP)->EnableWindow(TRUE);
	m_bPlayActive = TRUE;

	// results array is 8 x 8
	//          Clubs  Diamonds  Hearts  Spades  NT  Doubled  Redoubled  Total
	// -----------------------------------------------------------------------
	// 1-level   xx/yy
	// 2-level
	// ...
	// 7-level
	// Totals
	//
	int numHands = 0;
	BOOL bBreak = FALSE;

	//
	// suppress updates
	//
	pDOC->SuppressBidHistoryUpdate(TRUE);
	pDOC->SuppressPlayHistoryUpdate(TRUE);
	pMAINFRAME->HideDialog(twBidDialog);
	pVIEW->ClearDisplay();
//NCR	pVIEW->SuppressRefresh();   // Dialog box "smears" with this code ???
	pDOC->ClearAllInfo();

	// save settings
	BOOL bOldClaimSetting = theApp.GetValue(tbComputerCanClaim);
	theApp.SetValue(tbComputerCanClaim, FALSE);
	BOOL bOldAnalysisSetting = theApp.GetValue(tbEnableAnalysisTracing);
#ifndef _TESTING
	theApp.SetValue(tbEnableAnalysisTracing, FALSE);
#endif

	// 
	theApp.SetValue(tbAutoTestMode, TRUE);
	m_strStatus = "Auto play in progress...";
	UpdateData(FALSE);

	//
	int nCode = 0;
	double lfTotalTime = 0;
	long lNumHands = 0;
	CString strAvgTime;
	// loop 
	do
	{
		// play continuously

		// deal a new hand
		m_strStatus = "Dealing...";
		UpdateData(FALSE);
		pDOC->DealHands();
		numHands++;

		// and get bids
		m_strStatus = "Bidding...";
		UpdateData(FALSE);
		do 
		{
			// get the computer's bids
			int nPos = pDOC->GetCurrentPlayerPosition();
			int nBid = pDOC->GetCurrentPlayer()->Bid();
			nCode = pDOC->EnterBid(nPos, nBid);
			if ((nCode == -99) || (nCode == 1))
			{
				// passed out, or 3 passes, and bidding is complete
				break;
			}
			else if (nCode == -1) 
			{
				AfxMessageBox("Error in Bidding Dialog!");
				bBreak = TRUE;
				break;
			}
		} while (!bBreak);

		// bidding is complete; see if we reached a contract
		if (nCode == -99)
			continue;	// passed out, so redeal

		// start timeing
		long lStartTime = timeGetTime();

		// now play out the hand -- play on full auto
		theApp.SetValue(tnCardPlayMode, CEasyBApp::PLAY_FULL_AUTO_EXPRESS);
		pDOC->SetValue(tbExpressPlayMode, TRUE);
		pDOC->InvokeNextPlayer();

		// pump the mesage loop while the hand is being played out
		m_strStatus = "Playing hand...";
		UpdateData(FALSE);
		MSG msg;
		while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) 
		{ 
			if (!AfxGetApp()->PumpMessage()) 
			{ 
				::PostQuitMessage(0); 
				return; 
			}
		} 

		
		// reset flags
		pDOC->SetValue(tbExpressPlayMode, FALSE);

		// end timer 
		lNumHands++;
		long lEndTime = timeGetTime();
		lfTotalTime += (lEndTime - lStartTime);
		strAvgTime.Format(_T("%.1f secs"), lfTotalTime / (lNumHands*1000));
		//
		CStatic* pText = (CStatic*) GetDlgItem(IDC_AVG_TIME);
		pText->SetWindowText(strAvgTime);
		pText->UpdateWindow();
		//
		CStatic* pLabel = (CStatic*) GetDlgItem(IDC_LABEL_AVGTIME);
		if (!pLabel->IsWindowVisible())
		{
			pLabel->ShowWindow(SW_SHOW);
			pLabel->UpdateWindow();
		}

		//
		if (m_bStopFlag)
			break;

		// save results and update the display
		Update();
	} while (!bBreak);


	//
	// done -- reset
	//
	pDOC->SuppressBidHistoryUpdate(FALSE);
	pDOC->SuppressPlayHistoryUpdate(FALSE);
	pVIEW->EnableRefresh();
	pVIEW->Refresh(TRUE);
	pDOC->ClearAllInfo();

	// restore settings
	theApp.SetValue(tbComputerCanClaim, bOldClaimSetting);
	theApp.SetValue(tbEnableAnalysisTracing, bOldAnalysisSetting);

	//
	theApp.SetValue(tbAutoTestMode, FALSE);
	GetDlgItem(ID_START)->EnableWindow(TRUE);
	GetDlgItem(ID_STOP)->EnableWindow(FALSE);
	m_bPlayActive = FALSE;
	m_bStopFlag = FALSE;
	
	//
	m_strStatus = "Ready.";
	UpdateData(FALSE);
}
void CTestPlayDialog::Update() 
{
	// display each row
	m_listResults.DeleteAllItems();

	// get the latest results from the document
	int nTrumpSuit = pDOC->GetTrumpSuit();
	int nContractLevel = pDOC->GetContractLevel();
	int nDeclaringTeam = pDOC->GetDeclaringTeam();
	int numTricksMade = pDOC->GetNumTricksWonByTeam(nDeclaringTeam);
	BOOL bDoubled = pDOC->IsContractDoubled();
	BOOL bReDoubled = pDOC->IsContractRedoubled();

	// update counts
	m_numContracts[nContractLevel-1][nTrumpSuit]++;
	m_numContracts[nContractLevel-1][nTotalsColumn]++;
	m_numContracts[nTotalsRow][nTrumpSuit]++;
	m_numContracts[nTotalsRow][nTotalsColumn]++;
	if (bDoubled)
	{
		m_numContracts[nContractLevel-1][nDoubledColumn]++;
		m_numContracts[7][nDoubledColumn]++;
	}
	else if (bReDoubled)
	{
		m_numContracts[nContractLevel-1][nRedoubledColumn]++;
		m_numContracts[7][nRedoubledColumn]++;
	}

	// NCR-706  WRite out boards that go down using Cash play
	BOOL bSaveThisBoard = FALSE;
	if(theApp.GetValue(tnFileProgramBuildNumber) == 1234) {
		bSaveThisBoard = TRUE;  // Ask that this board be written
		theApp.SetValue(tnFileProgramBuildNumber, 1);   // turn off
    }  // NCR-706 end
	// also update # contracts made
	if (numTricksMade >= (nContractLevel+6))
	{
		m_numMade[nContractLevel-1][nTrumpSuit]++;
		m_numMade[nContractLevel-1][nTotalsColumn]++;
		m_numMade[nTotalsRow][nTrumpSuit]++;
		m_numMade[nTotalsRow][nTotalsColumn]++;
		if (bDoubled)
		{
			m_numMade[nContractLevel-1][nDoubledColumn]++;
			m_numMade[7][nDoubledColumn]++;
		}
		else if (bReDoubled)
		{
			m_numMade[nContractLevel-1][nRedoubledColumn]++;
			m_numMade[7][nRedoubledColumn]++;
		}
	}
	// NCR-AT  Save contracts that went down
	else if (((nContractLevel >= 1) && m_bSaveDowns) || bSaveThisBoard)   //<<<<<<<< NCR changed to 1 vs 4 for NCR-706 testing
	{
		int nDownCnt = (nContractLevel+6) - numTricksMade; // show number of tricks down
		CFile file;
		CFileException fileException;
		CString strPath;
//		CTime time = CTime::GetCurrentTime();
		strPath.Format("%s\\LostContract_Down_%d_%s.brd",theApp.GetValue(tszProgramDirectory),
								nDownCnt, pDOC->GetDealIDString());
//				                (LPCTSTR)time.Format("%X"));
		int nCode = file.Open((LPCTSTR)strPath, 
							  CFile::modeWrite | CFile::modeCreate | CFile::shareDenyWrite, 
							  &fileException);
		CArchive ar(&file, CArchive::store);
		pDOC->WriteFile(ar);
		ar.Close();
		file.Close();
	} // NCR-AT end saving lost contracts
#ifdef _DEBUG
	// NCR-SCU Save hands that have used conventions
    //
	if(m_bSaveConvUsed &&  (pDOC->GetNumSCU() > 0))
	{
		CFile file;
		CFileException fileException;
		CString strPath;
		// Build filename from conventions used
		CString fileNm = "CU";  // Filename prefix
		const int nInitNameLen = fileNm.GetLength(); // save length for test below
		bool usedConv[] = {false,false,false,false,false,false,false,false,false,false,
			               false,false,false,false,false,false,false,false,false,false,
			               false,false,false,false,false,false,false,false,false,false,
						   false,false,false,false,false,false,false,false,false,false};

		for(int k = 0; k < pDOC->GetNumSCU(); k++) {
			int cix = pDOC->GetSCU(k); // get next convention
			if(cix == tidOvercalls)
				continue;  // skip saving overcalls
			if(usedConv[cix])
				continue;  // skip if seen before
			usedConv[cix] = true;  // remember that we've use this one
			fileNm += GetConvName(cix); // add on convention
		} // end for(k) thru used conventions

		if(fileNm.GetLength() > nInitNameLen) {  // Only write if a convention used
			// build filename from conventions used
			strPath.Format("%s\\%s_%s.brd",theApp.GetValue(tszProgramDirectory),
							fileNm,
							pDOC->GetDealIDString());
			int nCode = file.Open((LPCTSTR)strPath, 
								  CFile::modeWrite | CFile::modeCreate | CFile::shareDenyWrite, 
								  &fileException);
			CArchive ar(&file, CArchive::store);
			pDOC->WriteFile(ar);
			ar.Close();
			file.Close();
		}
	}  // NCR-SCU end saving hands that used a convention
#endif

	// and display
	for(int nRow=0;nRow<8;nRow++)
	{
		m_listResults.InsertItem(nRow, tszRowTitle[nRow]);
		for(int nCol=0;nCol<8;nCol++)
			m_listResults.SetItem(nRow, nCol+1, LVIF_TEXT, FormString("%d / %d", m_numMade[nRow][nCol], m_numContracts[nRow][nCol]), 0, 0, 0, 0L);
	}

	// show % made
	CStatic* pLabel = (CStatic*) GetDlgItem(IDC_GAMES_MADE_LABEL);
	if (!pLabel->IsWindowVisible())
	{
		pLabel->ShowWindow(SW_SHOW);
		pLabel->UpdateWindow();
	}
	double fPercent = m_numMade[nTotalsRow][nTotalsColumn] / (double) m_numContracts[nTotalsRow][nTotalsColumn];
	m_strPercentMade.Format(_T("%.1f%%"), fPercent * 100);
	UpdateData(FALSE);

	//
	m_listResults.UpdateWindow();
}
//***********************************************************************************
void CLocatedBindableDialog::init(CParticleDlg* pParent)
{
	Create(IDD_LOCATED_BINDABLE, pParent);
	ShowWindow(SW_SHOW);
	_ParticleDlg = pParent;

	NL3D::CParticleSystem *ps = _Bindable->getOwner()->getOwner();
	if (ps->isSharingEnabled())
	{	
		GetDlgItem(IDC_NO_AUTO_LOD)->ShowWindow(TRUE);
		if (ps->isAutoLODEnabled() == false)
		{
			GetDlgItem(IDC_NO_AUTO_LOD)->EnableWindow(FALSE);
		}
		else
		{
			((CButton *) GetDlgItem(IDC_NO_AUTO_LOD))->SetCheck(NLMISC::safe_cast<NL3D::CPSParticle *>(_Bindable)->isAutoLODDisabled());
		}
	}
	else
	{
		GetDlgItem(IDC_NO_AUTO_LOD)->ShowWindow(FALSE);
	}

	uint yPos = 60;
	const uint xPos = 5;
	RECT rect;


	// control at the top of the sheet are not available for meshs & constraint meshes, so use that extra space
	if (dynamic_cast<NL3D::CPSMesh *>(_Bindable) || dynamic_cast<NL3D::CPSConstraintMesh *>(_Bindable))
	{
		yPos = 0;
	}

	// has the particle a material ?
	if (dynamic_cast<NL3D::CPSMaterial *>(_Bindable))
	{
		NL3D::CPSMaterial *material = dynamic_cast<NL3D::CPSMaterial *>(_Bindable);
		// blending mode
		m_BlendingMode.SetCurSel((uint) material->getBlendingMode() );
		// z-test		
		((CButton *) GetDlgItem(IDC_ZTEST))->SetCheck(material->isZTestEnabled() ? BST_CHECKED : BST_UNCHECKED);
		// z-bias
		GetDlgItem(IDC_ZBIAS)->SetWindowText(NLMISC::toString("%.2f", -material->getZBias()).c_str());						
	}
	else
	{
		m_BlendingMode.ShowWindow(SW_HIDE);
		GetDlgItem(IDC_BLENDING_MODE_STATIC)->ShowWindow(SW_HIDE);
		GetDlgItem(IDC_ZTEST)->ShowWindow(SW_HIDE);
		GetDlgItem(IDC_ZBIAS)->ShowWindow(SW_HIDE);
		GetDlgItem(IDC_ZBIAS_TEXT)->ShowWindow(SW_HIDE);
	}
	GetDlgItem(IDC_ALIGN_ON_MOTION)->ShowWindow(SW_HIDE);
	GetDlgItem(IDC_ZALIGN)->ShowWindow(SW_HIDE);
	// enable disable z-test	
	//
	if (dynamic_cast<NL3D::CPSParticle *>(_Bindable))
	{
		NL3D::CPSParticle *p = (NL3D::CPSParticle *) _Bindable;

		// check support for lighting
		if (p->supportGlobalColorLighting())
		{
			GetDlgItem(ID_GLOBAL_COLOR_LIGHTING)->ShowWindow(SW_SHOW);
			// if global color lighting is forced for all objects, don't allow to modify
			GetDlgItem(ID_GLOBAL_COLOR_LIGHTING)->EnableWindow(ps->getForceGlobalColorLightingFlag() ? FALSE : TRUE);
			((CButton *) GetDlgItem(ID_GLOBAL_COLOR_LIGHTING))->SetCheck(p->usesGlobalColorLighting() ? 1 : 0);
		}
		else
		{
			GetDlgItem(ID_GLOBAL_COLOR_LIGHTING)->ShowWindow(SW_HIDE);
		}
		// check support for color
		if (dynamic_cast<NL3D::CPSColoredParticle *>(_Bindable))
		{
			
			CAttribDlgRGBA *ad = new CAttribDlgRGBA("PARTICLE_COLOR", _Node);
			pushWnd(ad);

			_ColorWrapper.S = dynamic_cast<NL3D::CPSColoredParticle *>(_Bindable);		
			ad->setWrapper(&_ColorWrapper);			
			ad->setSchemeWrapper(&_ColorWrapper);

			HBITMAP bmh = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_PARTICLE_COLOR));
			ad->init(bmh, xPos, yPos, this);
			ad->GetClientRect(&rect);
			yPos += rect.bottom + 3;
		}

		// init size ctrl
		_SizeCtrlX = xPos;
		_SizeCtrlY = yPos;
		yPos += updateSizeControl();

		// check support for angle 2D
		if (dynamic_cast<NL3D::CPSRotated2DParticle *>(_Bindable))
		{
			
			CAttribDlgFloat *ad = new CAttribDlgFloat("PARTICLE_ANGLE2D", _Node, 0.f, 256.f);
			pushWnd(ad);

			_Angle2DWrapper.S = dynamic_cast<NL3D::CPSRotated2DParticle *>(_Bindable);
			ad->setWrapper(&_Angle2DWrapper);						
			ad->setSchemeWrapper(&_Angle2DWrapper);	

			HBITMAP bmh = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_PARTICLE_ANGLE));
			ad->init(bmh, xPos, yPos, this);
			ad->GetClientRect(&rect);
			yPos += rect.bottom + 3;
		}

		

		CAttribDlgPlaneBasis *pb = NULL;

		// check support for plane basis
		if (dynamic_cast<NL3D::CPSRotated3DPlaneParticle *>(_Bindable))
		{
			pb = new CAttribDlgPlaneBasis("PARTICLE_PLANE_BASIS", _Node);
			pushWnd(pb);
			_PlaneBasisWrapper.S = dynamic_cast<NL3D::CPSRotated3DPlaneParticle *>(_Bindable);
			pb->setWrapper(&_PlaneBasisWrapper);
			pb->setSchemeWrapper(&_PlaneBasisWrapper);
			HBITMAP bmh = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BASIS));
			pb->init(bmh, xPos, yPos, this);
			pb->GetClientRect(&rect);
			yPos += rect.bottom + 3;
		
		}

		// check support for precomputed rotations
		if (dynamic_cast<NL3D::CPSHintParticleRotateTheSame *>(_Bindable))
		{
			CPrecomputedRotationsDlg *pr = new CPrecomputedRotationsDlg(_Node, dynamic_cast<NL3D::CPSHintParticleRotateTheSame *>(_Bindable), pb);
			pushWnd(pr);
			pr->init(this, xPos, yPos);
			pr->GetClientRect(&rect);
			yPos += rect.bottom + 3;
		}

		// if we're dealing with a face look at, motion blur can be tuned
		if (dynamic_cast<NL3D::CPSFaceLookAt *>(_Bindable))
		{
			NL3D::CPSFaceLookAt *fla = static_cast<NL3D::CPSFaceLookAt *>(_Bindable);
			CEditableRangeFloat *mbc = new CEditableRangeFloat(std::string("MOTION_BLUR_COEFF"), _Node, 0, 5);
			pushWnd(mbc);
			_MotionBlurWnd.push_back(mbc);
			_MotionBlurCoeffWrapper.P = fla;
			mbc->setWrapper(&_MotionBlurCoeffWrapper);
			mbc->init(xPos + 140, yPos, this);
			CStatic *s = new CStatic;
			pushWnd(s);
			_MotionBlurWnd.push_back(s);
			s->Create("Fake motion blur coeff.", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this);
			s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)));			
			s->ShowWindow(SW_SHOW);
			mbc->GetClientRect(&rect);
			yPos += rect.bottom + 3;
			mbc = new CEditableRangeFloat(std::string("MOTION_BLUR_THRESHOLD"), _Node, 0, 5);
			pushWnd(mbc);
			_MotionBlurWnd.push_back(mbc);
			_MotionBlurThresholdWrapper.P = fla;
			mbc->setWrapper(&_MotionBlurThresholdWrapper);
			mbc->init(xPos + 140, yPos, this);
			s = new CStatic;			
			pushWnd(s);
			_MotionBlurWnd.push_back(s);
			s->Create("Fake motion blur threshold.", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this);
			s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)));
			s->ShowWindow(SW_SHOW);
			mbc->GetClientRect(&rect);
			yPos += rect.bottom + 3;				
			GetDlgItem(IDC_ALIGN_ON_MOTION)->ShowWindow(SW_SHOW);
			GetDlgItem(IDC_ZALIGN)->ShowWindow(SW_SHOW);
			((CButton *) GetDlgItem(IDC_ALIGN_ON_MOTION))->SetCheck(fla->getAlignOnMotion());
			((CButton *) GetDlgItem(IDC_ZALIGN))->SetCheck(fla->getAlignOnZAxis());
			updateValidWndForAlignOnMotion(fla->getAlignOnMotion());
		}

		// if we're dealing with a shockwave, we add dlg for the radius cut, and the number of segments
		if (dynamic_cast<NL3D::CPSShockWave *>(_Bindable))
		{
			NL3D::CPSShockWave *sw = static_cast<NL3D::CPSShockWave *>(_Bindable);
			CEditableRangeFloat *rc = new CEditableRangeFloat(std::string("RADIUS CUT"), _Node, 0, 1);
			pushWnd(rc);			
			_RadiusCutWrapper.S = sw;
			rc->setWrapper(&_RadiusCutWrapper);
			rc->init(xPos + 140, yPos, this);
			CStatic *s = new CStatic;
			pushWnd(s);
			s->Create("Radius cut.", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this);
			s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)));			
			s->ShowWindow(SW_SHOW);


			rc->GetClientRect(&rect);
			yPos += rect.bottom + 3;

			CEditableRangeUInt *snbs = new CEditableRangeUInt(std::string("SHOCK WAVE NB SEG"), _Node, 3, 24);
			pushWnd(snbs);
			_ShockWaveNbSegWrapper.S = sw;
			snbs->enableLowerBound(3, false);
			snbs->setWrapper(&_ShockWaveNbSegWrapper);
			snbs->init(xPos + 140, yPos, this);

			s = new CStatic;			
			pushWnd(s);
			s->Create("Nb segs", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this);
			s->ShowWindow(SW_SHOW);

			snbs->GetClientRect(&rect);
			yPos += rect.bottom + 3;


			CEditableRangeFloat *uvd = new CEditableRangeFloat(std::string("TEX UFACTOR"), _Node, 0, 5);
			pushWnd(uvd);
			_ShockWaveUFactorWrapper.S = sw;
			uvd->setWrapper(&_ShockWaveUFactorWrapper);
			uvd->init(xPos + 140, yPos, this);
			s = new CStatic;			
			pushWnd(s);
			s->Create("Texture U factor :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this);
			s->ShowWindow(SW_SHOW);
			uvd->GetClientRect(&rect);
			yPos += rect.bottom + 3;	
			
		}

		// fanlight
		if (dynamic_cast<NL3D::CPSFanLight *>(_Bindable))
		{
			CEditableRangeUInt *nbf = new CEditableRangeUInt(std::string("NB_FANS"), _Node, 3, 127);
			pushWnd(nbf);
			nbf->enableLowerBound(3, false);
			nbf->enableUpperBound(128, true);
			_FanLightWrapper.P = dynamic_cast<NL3D::CPSFanLight *>(_Bindable);
			nbf->setWrapper(&_FanLightWrapper);
			nbf->init(xPos + 140, yPos, this);
			CStatic *s = new CStatic;
			pushWnd(s);
			s->Create("Nb fan lights :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this);
			s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)));			
			s->ShowWindow(SW_SHOW);

			nbf->GetClientRect(&rect);
			yPos += rect.bottom + 3;

			nbf = new CEditableRangeUInt(std::string("PHASE_SMOOTHNESS"), _Node, 0, 31);
			pushWnd(nbf);
			nbf->enableUpperBound(32, true);
			_FanLightSmoothnessWrapper.P = static_cast<NL3D::CPSFanLight *>(_Bindable);
			nbf->setWrapper(&_FanLightSmoothnessWrapper);
			nbf->init(xPos + 140, yPos, this);
			s = new CStatic;			
			pushWnd(s);
			s->Create("Phase smoothnes:", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this);
			s->ShowWindow(SW_SHOW);

			nbf->GetClientRect(&rect);
			yPos += rect.bottom + 3;

			CEditableRangeFloat *nbfp = new CEditableRangeFloat(std::string("FAN_LIGHT_PHASE"), _Node, 0, 4.f);
			pushWnd(nbfp);			
			_FanLightPhaseWrapper.P = static_cast<NL3D::CPSFanLight *>(_Bindable);
			nbfp->setWrapper(&_FanLightPhaseWrapper);
			nbfp->init(xPos + 140, yPos, this);
			s = new CStatic;			
			pushWnd(s);
			s->Create("Fan light speed :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this);
			s->ShowWindow(SW_SHOW);

			nbf->GetClientRect(&rect);
			yPos += rect.bottom + 3;

			nbfp = new CEditableRangeFloat(std::string("FAN_LIGHT_INTENSITY"), _Node, 0, 4.f);
			pushWnd(nbfp);			
			_FanLightIntensityWrapper.P = static_cast<NL3D::CPSFanLight *>(_Bindable);
			nbfp->setWrapper(&_FanLightIntensityWrapper);
			nbfp->init(xPos + 140, yPos, this);
			s = new CStatic;			
			pushWnd(s);
			s->Create("Fan light intensity:", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this);
			s->ShowWindow(SW_SHOW);

			nbf->GetClientRect(&rect);
			yPos += rect.bottom + 3;

		}


		// tail particle
		if (dynamic_cast<NL3D::CPSTailParticle *>(_Bindable))
		{
			CEditableRangeUInt *nbs;
			if (!dynamic_cast<NL3D::CPSRibbonLookAt *>(_Bindable))
			{
				nbs = new CEditableRangeUInt(std::string("TAIL_NB_SEGS_"), _Node, 2, 16);
				nbs->enableLowerBound(1, true);
			}
			else
			{
				nbs = new CEditableRangeUInt(std::string("LOOKAT_RIBBON_TAIL_NB_SEGS_"), _Node, 2, 16);
				nbs->enableLowerBound(1, true);
			}

			pushWnd(nbs);

			if (dynamic_cast<NL3D::CPSTailDot *>(_Bindable))
			{
				nbs->enableUpperBound(256, true);
			}
			
			
			_TailParticleWrapper.P = dynamic_cast<NL3D::CPSTailParticle *>(_Bindable);
			nbs->setWrapper(&_TailParticleWrapper);
			nbs->init(xPos + 140, yPos, this);
			CStatic *s = new CStatic;
			pushWnd(s);
			s->Create("Nb segs :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this);
			s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)));			
			s->ShowWindow(SW_SHOW);	
			
			nbs->GetClientRect(&rect);
			yPos += rect.bottom + 3;

			CTailParticleDlg *tpd = new CTailParticleDlg(_Node, dynamic_cast<NL3D::CPSTailParticle *>(_Bindable));
			pushWnd(tpd);
			tpd->init(this, xPos, yPos);
				
			tpd->GetClientRect(&rect);
			yPos += rect.bottom + 3;
		}


		// shape particle
		if (dynamic_cast<NL3D::CPSShapeParticle *>(_Bindable))
		{
			CMeshDlg *md = new CMeshDlg(_Node, dynamic_cast<NL3D::CPSShapeParticle *>(_Bindable), _ParticleDlg);
			md->init(this, xPos, yPos);
			md->GetClientRect(&rect);
			yPos += rect.bottom + 3;
			pushWnd(md);
		}

		// constraint mesh particle
		if (dynamic_cast<NL3D::CPSConstraintMesh *>(_Bindable))
		{
			CConstraintMeshDlg *cmd = new CConstraintMeshDlg(static_cast<NL3D::CPSConstraintMesh *>(_Bindable));
			cmd->init(xPos, yPos, this);
			cmd->GetClientRect(&rect);
			yPos += rect.bottom + 3;
			CConstraintMeshTexDlg *cmtd = new CConstraintMeshTexDlg(static_cast<NL3D::CPSConstraintMesh *>(_Bindable),
																	this);
			cmtd->init(xPos, yPos, this);
			cmtd->GetClientRect(&rect);
			yPos += rect.bottom + 3;
			pushWnd(cmd);
			pushWnd(cmtd);			
		}



		// check support for animated texture
		if (dynamic_cast<NL3D::CPSTexturedParticle *>(_Bindable))
		{
			CTextureAnimDlg *td = new CTextureAnimDlg(_Node,
													  dynamic_cast<NL3D::CPSTexturedParticle *>(_Bindable),
													  dynamic_cast<NL3D::CPSMultiTexturedParticle *>(_Bindable)
													 );			
			pushWnd(td);
						
			td->init(xPos, yPos, this);
			td->GetClientRect(&rect);
			yPos += rect.bottom + 3;
		}

		// unanimated texture
		if (dynamic_cast<NL3D::CPSTexturedParticleNoAnim *>(_Bindable))
		{
			NL3D::CPSTexturedParticleNoAnim *tp = dynamic_cast<NL3D::CPSTexturedParticleNoAnim *>(_Bindable);
			_TextureNoAnimWrapper.TP = tp;
			CTextureChooser *tc = new CTextureChooser(dynamic_cast<NL3D::CPSMultiTexturedParticle *>(_Bindable), _Node);			
			tc->enableRemoveButton();
			tc->setWrapper(&_TextureNoAnimWrapper);
			pushWnd(tc);

			tc->init(xPos, yPos, this);
			tc->GetClientRect(&rect);
			yPos += rect.bottom + 3;
		}

		// ribbon texture (doesn't support texture animation for now)
		if (dynamic_cast<NL3D::CPSRibbon *>(_Bindable))
		{									
		
			// add dialog for uv tuning with ribbon
			CEditableRangeFloat *uvd = new CEditableRangeFloat(std::string("RIBBON UFACTOR"), _Node, 0, 5);
			pushWnd(uvd);
			_RibbonUFactorWrapper.R = static_cast<NL3D::CPSRibbon *>(_Bindable);
			uvd->setWrapper(&_RibbonUFactorWrapper);
			uvd->init(xPos + 140, yPos, this);
			CStatic *s = new CStatic;
			pushWnd(s);
			s->Create("Texture U factor :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this);
			s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)));			
			s->ShowWindow(SW_SHOW);
			uvd->GetClientRect(&rect);
			yPos += rect.bottom + 3;

			uvd = new CEditableRangeFloat(std::string("RIBBON VFACTOR"), _Node, 0, 5);
			pushWnd(uvd);
			_RibbonVFactorWrapper.R = static_cast<NL3D::CPSRibbon *>(_Bindable);
			uvd->setWrapper(&_RibbonVFactorWrapper);
			uvd->init(xPos + 140, yPos, this);
			s = new CStatic;			
			pushWnd(s);
			s->Create("Texture V factor :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this);
			s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)));
			s->ShowWindow(SW_SHOW);
			uvd->GetClientRect(&rect);
			yPos += rect.bottom + 3;

		}		

		if (dynamic_cast<NL3D::CPSRibbonBase *>(_Bindable))
		{									
		
			// add dialog for uv tuning with ribbon
			CEditableRangeFloat *sd = new CEditableRangeFloat(std::string("SEGMENT DURATION"), _Node, 0.05f, 0.5f);
			sd->enableLowerBound(0, true);
			pushWnd(sd);
			_SegDurationWrapper.R = static_cast<NL3D::CPSRibbonLookAt *>(_Bindable);
			sd->setWrapper(&_SegDurationWrapper);
			sd->init(xPos + 140, yPos, this);
			CStatic *s = new CStatic;
			pushWnd(s);
			s->Create("Seg Duration :", SS_LEFT, CRect(xPos, yPos + 16, xPos + 139, yPos + 48), this);
			s->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)));			
			s->ShowWindow(SW_SHOW);
			sd->GetClientRect(&rect);
			yPos += rect.bottom + 3;
		}
	
		// 'look at' independant sizes
		bool isLookAt = dynamic_cast<NL3D::CPSFaceLookAt *>(_Bindable) != NULL;		
		GetDlgItem(IDC_INDE_SIZES)->ShowWindow(isLookAt ? SW_SHOW : SW_HIDE);
		GetDlgItem(IDC_SIZE_WIDTH)->ShowWindow(isLookAt ? SW_SHOW : SW_HIDE);
		GetDlgItem(IDC_SIZE_HEIGHT)->ShowWindow(isLookAt ? SW_SHOW : SW_HIDE);
		GetDlgItem(IDC_WIDTH_HEIGHT_BOX)->ShowWindow(isLookAt ? SW_SHOW : SW_HIDE);		
		((CButton *) GetDlgItem(IDC_SIZE_WIDTH))->SetCheck(1);
		if (isLookAt)
		{
			NL3D::CPSFaceLookAt *la = static_cast<NL3D::CPSFaceLookAt *>(_Bindable);
			m_IndependantSizes = la->hasIndependantSizes();
			((CButton *) GetDlgItem(IDC_INDE_SIZES))->SetCheck(m_IndependantSizes);
			updateIndependantSizes();
		}

		/// new ribbon base class
		if (dynamic_cast<NL3D::CPSRibbonBase *>(_Bindable))
		{
			CRibbonDlg *rd = new CRibbonDlg(_Node, static_cast<NL3D::CPSRibbonBase *>(_Bindable),
											this);
			rd->init(this, xPos, yPos);
			pushWnd(rd);
			rd->GetClientRect(&rect);
			yPos += rect.bottom + 3;
		}		
	}	
	UpdateData();
}
Esempio n. 10
0
void CRoom::draw()
{
	POSITION pos;
	CButton* Button;
	CStatic* staticText;
	CString btnText[2];
	CDevice* tmpDevice;
	int top = 10;
	int bottom = 30;
	int i = 0;
	int countButtonID = 3001;
	int countStaticID = 2001;
	CObList* list = phandleData->get_deviceList();
	for (pos = list->GetHeadPosition(); pos != NULL;)
	{	
		tmpDevice = (CDevice*)list->GetNext(pos);
		if(tmpDevice->get_room() != room)
			continue;
		if(tmpDevice->get_typ() == _T("fs20rsu"))
		{
			btnText[0] = _T("Auf");
			btnText[1] = _T("Ab");
		}
		else
		{
			btnText[0] = _T("An");
			btnText[1] = _T("Aus");
		}
		staticText = new CStatic();
		DWORD dwStyleStatic  = WS_EX_STATICEDGE;
		staticText->Create(tmpDevice->get_name(),dwStyleStatic,CRect(10,top,260,bottom),this,countStaticID);
		staticText->ShowWindow(TRUE);

		Button = new CButton();
		DWORD dwStyle = WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON;
		Button->Create(btnText[0], dwStyle, CRect(300,top,340,bottom), this, countButtonID);
		Button->ShowWindow(TRUE);
		Button = NULL;
		buttonIDs[i][i] = countButtonID;
		countButtonID++;

		Button = new CButton();
		Button->Create(btnText[1], dwStyle, CRect(360,top,400,bottom), this, countButtonID);
		Button->ShowWindow(TRUE);
		Button = NULL;
		buttonIDs[i][i+1] = countButtonID;
		countButtonID++;

		Button = new CButton();
		Button->Create(_T("Details"), dwStyle, CRect(420,top,480,bottom), this, countButtonID);
		Button->ShowWindow(TRUE);
		Button = NULL;
		buttonIDs[i][i+2] = countButtonID;

		top += 30;
		bottom += 30;
		staticText = NULL;
		countButtonID++;
		countStaticID++;
		i++;
	}
}