Exemple #1
0
void CZhfPalette::AddControls()
{
	acDocManager->lockDocument(curDoc(), AcAp::kWrite, NULL, NULL, true) ;
	CRect rect ;
	GetClientRect(&rect) ;
	int iWidth = rect.Width() ;
	int iHeight = rect.Height() ;

	CFont * pFont = new CFont;
	pFont->CreateFont(14, // nHeight
		0, // nWidth
		0, // nEscapement
		0, // nOrientation
		FW_NORMAL , // nWeight
		FALSE, // bItalic
		FALSE, // bUnderline
		0, // cStrikeOut
		ANSI_CHARSET, // nCharSet
		OUT_DEFAULT_PRECIS, // nOutPrecision
		CLIP_DEFAULT_PRECIS, // nClipPrecision
		DEFAULT_QUALITY, // nQuality
		DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
		_T("Arial")); // lpszFac


	int iIndex = 0 ;
	int iCount = m_strArrayFile.GetCount() ;
	for (int i=0; i<iCount; i++)
	{
		CString strFile = m_strArrayFile.GetAt(i) ;

		CGsPreviewCtrl* pCtrl = new CGsPreviewCtrl() ;
		pCtrl->m_iIndex = iIndex ;
		pCtrl->m_strDwgFile = strFile ;
		m_pArrayPreviewCtrl.Add(pCtrl) ;
		pCtrl->Create(_T(""), WS_CHILD|WS_VISIBLE|SS_CENTER|SS_SUNKEN, CRect(10, 10, 110, 110), this) ;
		
		AcDbDatabase* pDbSrc = new AcDbDatabase(false) ;
		if(Acad::eOk==pDbSrc->readDwgFile(strFile))
		{
			AcDbDatabase* pDbTo = new AcDbDatabase() ;
			this->Wblock(pDbSrc, pDbTo) ;
			this->FilterDb(pDbTo, m_nArrayFilterMode.GetAt(i)) ;

			pCtrl->SetDatabase(pDbTo);
		}
		delete pDbSrc ;		

		CStatic* pCtrlStatic = new CStatic() ;
		CString strFileName ;
		strFileName.Format(_T("%s"), m_strArrayFileName.GetAt(i)) ;		
		m_pArrayStatic.Add(pCtrlStatic) ;
		pCtrlStatic->Create(strFileName, WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(10, 10, 40, 110), this) ;
		pCtrlStatic->SetFont(pFont) ;
		iIndex++ ;
	}
	acDocManager->unlockDocument(curDoc()) ;
	this->OnSize(0, iWidth, iHeight) ;
}
void COpPropertyDlg::addLabel(RECT &client, const std::string &str)
{
	CStatic *label = new CStatic;
	string tmp = str;
	if (!tmp.empty())
		tmp[0] = toupper (tmp[0]);
	label->Create (tmp.c_str(), WS_CHILD|SS_LEFT|SS_CENTERIMAGE|WS_VISIBLE, client, this);
	label->SetFont (GetFont());
	Others.push_back(label);
}
HRESULT CPropertyEditWindow::CreatePropertyLabel(DWORD dwPropertyInfoIndex, CAtlStringW strLabelText, RECT& rectLabel)
{
    HRESULT hr = S_OK;
    
    CStatic* pStatic = new CStatic();
    CHECK_ALLOC( pStatic );
    pStatic->Create(m_hWnd, &rectLabel, strLabelText, WS_CHILD | WS_VISIBLE);
    pStatic->SetFont(m_hLabelFont);
    m_arrPropertyInfoDisplay[dwPropertyInfoIndex]->m_arrLabels.Add(pStatic);

Cleanup:
    return hr;
}
Exemple #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();
}
Exemple #5
0
// add bitmap at the specified  column
void CCustomListRowWnd::AddBitmap(INT32 col, HBITMAP hBitmap,HBITMAP, DWORD dwBackColour)
{
    CStatic* pStat = new CStatic();
    ASSERT(m_ColumnObjects[col] == NULL);
    m_ColumnObjects[col] = pStat ;

    CRect cr;
    GetClientRect(&cr);

    BITMAP bitmap;
    CBitmap::FromHandle(hBitmap)->GetBitmap(&bitmap);
    CRect srect;
    srect.left = m_Parent->m_Parent->m_ColumnOffsetsArray[col] ;
    srect.right = srect.left + bitmap.bmWidth;
    srect.top	= cr.Height()/2 - bitmap.bmHeight/2;
    srect.bottom = cr.Height()/2 + bitmap.bmHeight/2;

    ////
    HDC hBitmapDC = CreateCompatibleDC(NULL);
    if (!hBitmapDC)
    {
        ERROR2RAW("Non-fatal GDI error");
    }
    SelectObject(hBitmapDC, hBitmap);
    // Iff we haven't been told what the background colour is...
    // We make the assumption that the pixel in the lower right corner has the background colour
    if (dwBackColour == 0xFFFFFFFF)
        dwBackColour = (DWORD) GetPixel(hBitmapDC, bitmap.bmWidth - 1, bitmap.bmHeight -1);
    DWORD sysBkColour = GetSysColor(COLOR_3DFACE);
    for (INT32 i = 0; i < bitmap.bmWidth; i++)
    {
        for (INT32 j = 0; j < bitmap.bmHeight; j++)
        {
            if ((DWORD) GetPixel(hBitmapDC, i, j) == dwBackColour)
                SetPixelV(hBitmapDC, i, j, (COLORREF) sysBkColour);
        }
    }
    DeleteDC(hBitmapDC);

    ////
    pStat->Create(NULL, WS_VISIBLE | SS_BITMAP, srect, this);
    pStat->SetBitmap(hBitmap);
}
Exemple #6
0
void CModifyDlg::CreateCtrl()
{
	CRect rcClient;
	GetClientRect(&rcClient);
	int top = rcClient.top + TOPINCREMENT;
	int Left = rcClient.left + LEFTINCREMENT;
	CRect CTRRECT;

	if (PUBLIC == m_tableType || INCODE == m_tableType){
		for (int i = 0;i < m_vHead.size();i++){
			CStatic *Static = new CStatic;
			CTRRECT = SetCtrlPos(Left,top,88,CTRLHEIGHT);
			Static->Create(m_vHead[i],WS_CHILD|WS_VISIBLE,CTRRECT,this);
			Static->SetFont(GetFont());
			Left += 88 + HINCREMENT;
			CEdit *Edit = new CEdit;
			CTRRECT = SetCtrlPos(Left,top - 3,380,EDITHEIGHT);
			Edit->Create(WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER|ES_MULTILINE|ES_AUTOVSCROLL,CTRRECT,this,IDC_MODIFY_EDIT);
			Edit->SetFont(GetFont());
			Edit->SetWindowText(m_vData[i]);
			top += VINCREMENT + CTRLHEIGHT ;
			Left = rcClient.left + LEFTINCREMENT;

			if (i == 0){
				Static->EnableWindow(FALSE);
				Edit->EnableWindow(FALSE);
			}
			if (i == m_vHead.size()-1 && INCODE == m_tableType)
			{
				CStatic *Static1 = new CStatic;
				CTRRECT = SetCtrlPos(Left,top,450,CTRLHEIGHT);
				Static1->Create("调度规则 1:最大空闲时间调度 2:最短会话时间调度 3:最高优先级调度",WS_CHILD|WS_VISIBLE,CTRRECT,this);
				Static1->SetFont(GetFont());
				m_StaticObject.push_back(Static1);
			}
			m_StaticObject.push_back(Static);
			m_EidtObject.push_back(Edit);
		}
	}
	if (TP == m_tableType) SetTPRuleCtrl();
}
Exemple #7
0
// add text to the specified column of this row
void CCustomListRowWnd::AddText(INT32 col, CString text)
{
    ASSERT(m_ColumnObjects[col] == NULL);

    CStatic* pStat = new CStatic();
    m_ColumnObjects[col] = pStat ;

    CRect cr;
    GetClientRect(&cr);

    CRect srect;
    srect.left= m_Parent->m_Parent->m_ColumnOffsetsArray[col] ;
    if( col < CCustomList::MAXCOLUMNS && m_Parent->m_Parent->m_ColumnOffsetsArray[col + 1] > 0)
        srect.right= m_Parent->m_Parent->m_ColumnOffsetsArray[col + 1] ;
    else
        srect.right= cr.right;
    srect.top	= (CCustomList::ROWHEIGHT - CCustomList::FONTHEIGHT)/2;
    srect.bottom = srect.top + CCustomList::FONTHEIGHT;
    pStat->Create(text, WS_CHILD|WS_VISIBLE|WS_EX_LEFT, srect, this);
    pStat->SetFont(&m_Parent->m_Font);
}
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++;
			}
		}
	}
}
HRESULT CPropertyEditWindow::CreateTitle(DWORD dwPropertyInfoIndex, RECT& labelRect)
{
    HRESULT hr = S_OK;
    LPWSTR szName = NULL;

    TED_ATTRIBUTE_CATEGORY Category;
    IFC( m_arrPropertyInfo[dwPropertyInfoIndex]->GetPropertyInfoName(&szName, &Category) );

    CStatic* pStatic = new CStatic();
    CHECK_ALLOC( pStatic );
    pStatic->Create(m_hWnd, &labelRect, szName, WS_CHILD | WS_VISIBLE);
    pStatic->SetFont(m_hLabelFont);
    m_arrTitles.Add(pStatic);

    labelRect.top += ms_LabelHeight;
    labelRect.bottom += ms_LabelHeight;

Cleanup:
    CoTaskMemFree(szName);

    return hr;
}
	BOOL CModelInputDlg::Create(const CModelInputParameterDefVector& variables, const CRect& rectMI, const CString& modelName, CWnd* pParentWnd, bool bForTest)
	{
		BOOL rep = false;

		ResetCtrl();

		m_variables = variables;

		CRect rectDlg(rectMI);

		CAppOption option;
		option.SetCurrentProfile(_T("ModelsWindowsPosition"));
		CPoint defaultPos = option.GetProfilePoint(modelName, CPoint(430, 0));

		option.SetCurrentProfile(_T("WindowsPosition"));
		defaultPos += option.GetProfilePoint(_T("ModelInputEditor"), CPoint(30, 30));

		rectDlg += defaultPos;
		UtilWin::EnsureRectangleOnDisplay(rectDlg);


		CWinApp* pApp = AfxGetApp();

		CString strWndClass = AfxRegisterWndClass(
			0,
			pApp->LoadStandardCursor(IDC_ARROW),
			(HBRUSH)(COLOR_3DFACE + 1),
			pApp->LoadIcon(IDI_HEART));

		if (bForTest)
			rep = CWnd::CreateEx(WS_EX_CLIENTEDGE, strWndClass, modelName, WS_DLGFRAME | WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_VISIBLE | WS_SYSMENU, rectDlg, pParentWnd, NULL, NULL);
		else
			rep = CWnd::CreateEx(WS_EX_CLIENTEDGE, strWndClass, modelName, WS_DLGFRAME | WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_VISIBLE, rectDlg, pParentWnd, NULL, NULL);



		CFont* pFont = CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)); // SYSTEM_FONT ANSI_VAR_FONT

		for (size_t i = 0; i < m_variables.size(); i++)
		{
			//create title
			CStatic* pStatic = (CStatic*) new CStatic;
			CRect rect = m_variables[i].GetItemRect(0);
			//rect.top += 3;
			//rect.bottom += 3;

			pStatic->Create(CString(m_variables[i].m_caption.c_str()), WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, rect, this, IDC_STATIC);
			pStatic->SetFont(pFont);
			m_titleCtrlArray.Add(pStatic);

			//create control
			switch (m_variables[i].GetType())
			{
			case CModelInputParameterDef::kMVBool:
			{
				CCFLComboBox* pCombo = (CCFLComboBox*) new CCFLComboBox;
				CRect rect = m_variables[i].GetItemRect(1);
				rect.bottom += 3 * rect.Height();

				pCombo->Create(WS_TABSTOP | WS_BORDER | WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST, rect, this, GetID(i));
				pCombo->SetFont(pFont);

				CString str;
				str.LoadString(IDS_STR_YES);
				pCombo->AddString(str);
				str.LoadString(IDS_STR_NO);
				pCombo->AddString(str);

				m_varCtrlArray.Add(pCombo);
				break;
			}

			case CModelInputParameterDef::kMVInt:
			{
				CIntEdit* pIntEdit = (CIntEdit*) new CIntEdit;
				CRect rect = m_variables[i].GetItemRect(1);


				pIntEdit->CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), NULL, WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER, rect, this, GetID(i));
				pIntEdit->SetFont(pFont);
				m_varCtrlArray.Add(pIntEdit);
				break;
			}

			case CModelInputParameterDef::kMVReal:
			{
				CFloatEdit* pFloatEdit = (CFloatEdit*) new CFloatEdit;
				CRect rect = m_variables[i].GetItemRect(1);

				pFloatEdit->CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), NULL, WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER, rect, this, GetID(i));
				pFloatEdit->SetFont(pFont);
				m_varCtrlArray.Add(pFloatEdit);
				break;
			}



			case CModelInputParameterDef::kMVString:
			{
				CCFLEdit* pEdit = (CCFLEdit*) new CCFLEdit;
				CRect rect = m_variables[i].GetItemRect(1);


				pEdit->CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), NULL, WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL, rect, this, GetID(i));
				pEdit->SetFont(pFont);
				m_varCtrlArray.Add(pEdit);
				break;
			}

			case CModelInputParameterDef::kMVFile:
			{
				CModelInputBrowseCtrl* pEdit = new CModelInputBrowseCtrl;
				pEdit->m_appPath = m_appPath;
				pEdit->m_projectPath = m_projectPath;

				CRect rect = m_variables[i].GetItemRect(1);

				pEdit->Create(WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL, rect, this, GetID(i));
				pEdit->EnableFileBrowseButton();
				pEdit->SetFont(pFont);
				m_varCtrlArray.Add(pEdit);
				break;
			}

			case CModelInputParameterDef::kMVListByPos:
			case CModelInputParameterDef::kMVListByString:
			case CModelInputParameterDef::kMVListByCSV:
			{
				//int defPos = WBSF::ToInt(m_variables[i].m_default);
				//if (CModelInputParameterDef::kMVListByCSV)

				StringVector listOfValues = m_variables[i].GetList(GetFM().GetAppPath(), GetFM().GetProjectPath());
				bool bFromFile = m_variables[i].IsExtendedList();//listOfValues[0] == "FROM_CSV_FILE" && listOfValues.size() == 4;

				CCFLComboBox* pCombo = (CCFLComboBox*) new CCFLComboBox;
				CRect rect = m_variables[i].GetItemRect(1);
				rect.bottom += 10 * rect.Height();

				UINT style = bFromFile ? WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT : WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST;
				pCombo->Create(style, rect, this, GetID(i));
				pCombo->SetFont(pFont);
				pCombo->SetExtendedUI(true);


				/*if (bFromFile)
				{
				string filePath = CModelInput::SpecialPath2FilePath(listOfValues[1], m_appPath, m_projectPath);
				int col = WBSF::ToInt(listOfValues[2]);

				listOfValues.clear();

				ifStream file;
				if (file.open(filePath))
				{
				for (CSVIterator loop(file, ",; \t"); loop != CSVIterator(); ++loop)
				{

				if (col < loop.Header().size() &&
				col < (*loop).size())
				{
				listOfValues.push_back((*loop)[col]);
				}
				}
				}
				}*/

				for (size_t pos = 0; pos < listOfValues.size(); pos++)
				{
					int index = pCombo->AddString(CString(listOfValues[pos].c_str()));
					pCombo->SetItemData(index, pos);
				}

				if (m_variables[i].GetType() == CModelInputParameterDef::kMVListByPos)
					pCombo->SetCurSel(WBSF::ToInt(m_variables[i].m_default));
				else
					pCombo->SelectStringExact(0, m_variables[i].m_default);


				m_varCtrlArray.Add(pCombo);
				break;
			}

			case CModelInputParameterDef::kMVTitle:
			case CModelInputParameterDef::kMVStaticText:
			{
				CTitleCtrl* pStatic = (CTitleCtrl*) new CTitleCtrl;
				CRect rect = m_variables[i].GetItemRect(1);

				pStatic->Create(CString(m_variables[i].m_caption.c_str()), WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, rect, this, IDC_STATIC);
				if (m_variables[i].GetType() == CModelInputParameterDef::kMVStaticText)
					pStatic->SetFont(pFont);

				m_varCtrlArray.Add(pStatic);
				break;
			}

			case CModelInputParameterDef::kMVLine:
			{

				CStaticLineCtrl* pStatic = (CStaticLineCtrl*) new CStaticLineCtrl;//hiden control
				CRect rect = m_variables[i].GetItemRect(1);
				//rect.bottom = rect.top + 5;

				pStatic->Create(_T(""), WS_CHILD | WS_VISIBLE, rect, this, IDC_STATIC);
				m_varCtrlArray.Add(pStatic);
				break;
			}

			default: ASSERT(false);
			}
		}

		Invalidate();

		return rep;
	}
Exemple #11
0
BOOL CBaseDlg::OnInitDialog()
{
	//CDialog::OnInitDialog();
	if (m_hIcon)
	{
		SetIcon(m_hIcon, TRUE);   // 设置大图标
		SetIcon(m_hIcon, FALSE);  // 设置小图标
	}

	m_bInit = TRUE;

	for (int i = 0; i < m_vecCtrl.size(); i++)
	{
		switch (m_vecCtrl[i].type)
		{
		case BASE_BUTTON:
		case BASE_CHECK_BUTTON:
		{
			CButton* pCtrl = (CButton*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].sCaption, m_vecCtrl[i].dwStyle,
				m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			pCtrl->SetFont(&mFont);
			break;
		}
		case BASE_COMMOM_BUTTON:
		{
			CCommonButton* pCtrl = (CCommonButton*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].sCaption, m_vecCtrl[i].dwStyle,
				m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			pCtrl->SetFont(&mFont);
			break;
		}
		case BASE_STATIC:
		{
			CStatic* pCtrl = (CStatic*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].sCaption, m_vecCtrl[i].dwStyle,
				m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			pCtrl->SetFont(&mFont);
			break;
		}
		case BASE_MY_CHECK_BUTTON:
		{
			CMyCheckButton* pCtrl = (CMyCheckButton*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].sCaption, m_vecCtrl[i].dwStyle,
				m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			pCtrl->SetFont(&mFont);
			break;
		}
		case BASE_INDICATOR:
		{
			CIndicator* pCtrl = (CIndicator*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].sCaption, m_vecCtrl[i].dwStyle,
				m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			pCtrl->SetFont(&mFont);
			break;
		}
		case BASE_GROUPBOX:
		{
			CGroupBox* pCtrl = (CGroupBox*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].sCaption, m_vecCtrl[i].dwStyle,
				m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			pCtrl->SetFont(&mFont);
			break;
		}
		case BASE_EDIT_CSTRING:
		case BASE_EDIT_DOUBLE:
		{
			CEdit* pCtrl = (CEdit*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].dwStyle,
				m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			pCtrl->SetFont(&mFont);
			break;
		}
		case BASE_COLOR_TEXT:
		{
			CColorText* pCtrl = (CColorText*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].sCaption, m_vecCtrl[i].dwStyle,
				m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			break;
		}
		case BASE_DRAWVIEW:
		{
			CDrawView* pCtrl = (CDrawView*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			break;
		}
		case BASE_LIST:
		{
			CListCtrl* pCtrl = (CListCtrl*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].dwStyle, m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			break;
		}
		case BASE_TABVIEW:
		{
			CTabViewCtrl* pCtrl = (CTabViewCtrl*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].dwStyle, m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			break;
		}
		case BASE_GRADIENT_BACKGROUND:
		{
			CGradientBackground* pCtrl = (CGradientBackground*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].sCaption, m_vecCtrl[i].dwStyle, m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			break;
		}
		case BASE_COMBOBOX:
		{
			CComboBox* pCtrl = (CComboBox*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].dwStyle, m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			pCtrl->SetFont(&mFont);
			CString caption = m_vecCtrl[i].sCaption;
			for (int j = 0; j < m_vecCtrl[i].nDataCount; j++)
			{
				int endpos = caption.Find(L"\n");
				CString item = caption.Mid(0, endpos);
				pCtrl->AddString(item);
				caption = caption.Right(caption.GetLength()-endpos-1);
			}
			pCtrl->SetCurSel(0);
			break;
		}
		case BASE_PROGRESS:
		{
			CProgressCtrl* pCtrl = (CProgressCtrl*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].dwStyle, m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			if (m_vecCtrl[i].pInOutData != NULL)
			{
				pCtrl->SetRange32((int)m_vecCtrl[i].dMinVal,(int)m_vecCtrl[i].dMaxVal);
			}
			break;
		}
		case BASE_SLIDER:
		{
			CSliderCtrl* pCtrl = (CSliderCtrl*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].dwStyle, m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			if (m_vecCtrl[i].pInOutData != NULL)
			{
				pCtrl->SetRangeMax((int)m_vecCtrl[i].dMaxVal);
				pCtrl->SetRangeMin((int)m_vecCtrl[i].dMinVal);
			}
			break;
		}
		case BASE_SLIDER_GROUP:
		{
			CSliderGroup* pCtrl = (CSliderGroup*)m_vecCtrl[i].pCtrl;
			pCtrl->Create(m_vecCtrl[i].sCaption, m_vecCtrl[i].dwStyle, m_vecCtrl[i].rect, m_vecCtrl[i].pParent, m_vecCtrl[i].nID);
			if (m_vecCtrl[i].pInOutData!=NULL)
			{
				pCtrl->GetSlider()->SetRangeMax((int)m_vecCtrl[i].dMaxVal);
				pCtrl->GetSlider()->SetRangeMin((int)m_vecCtrl[i].dMinVal);
			}
			break;
		}
		default:
			break;
		}
	}
	UpdateData(FALSE);
	return TRUE;
}
//***********************************************************************************
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();
}
Exemple #13
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++;
	}
}
Exemple #14
0
//creates the appropriate controls for a property
void CPropertyWnd::CreatePropertyControls(CPackerProperty* pProp, uint32 nProp, uint32 nID, const CRect& rOrigArea)
{
	ASSERT(pProp);

	//flags for all controls
	DWORD nBaseFlags = WS_CHILD | WS_VISIBLE | WS_TABSTOP;

	//a working area rectangle
	CRect rArea(rOrigArea);

	switch(pProp->GetType())
	{
	case PROPERTY_REAL:
		{
			//create the edit box for editing the number
			CEdit* pNewEdit = new CEdit;
			if(pNewEdit)
			{
				pNewEdit->CreateEx(WS_EX_CLIENTEDGE, "Edit", "", nBaseFlags | ES_AUTOHSCROLL, 
									rArea.left, rArea.top, rArea.Width(), rArea.Height(),
									GetSafeHwnd(), (HMENU)nID);

				CPackerRealProperty* pReal = (CPackerRealProperty*)pProp;

				//set the default
				CString sText;
				sText.Format((pReal->IsInteger()) ? "%.0f" : "%.2f", pReal->GetValue());
				pNewEdit->SetWindowText(sText);

				//save it in the list
				m_pPropControl[nProp][0] = pNewEdit;

				//setup the tooltip
				m_ToolTip.AddWindowTool(pNewEdit, pProp->GetHelp());
			}
		}
		break;
	case PROPERTY_STRING:
		{
			CPackerStringProperty* pString = (CPackerStringProperty*)pProp;

			//rectangle for the edit control
			CRect rEditArea(rArea);

			//see if this is going to be a filename
			if(pString->IsFilename())
			{
				rEditArea.DeflateRect(0, 0, BROWSE_BUTTON_WIDTH, 0);
			}

			//create the edit box for editing the string
			CEdit* pNewEdit = new CEdit;
			if(pNewEdit)
			{
				pNewEdit->CreateEx(WS_EX_CLIENTEDGE, "Edit", "", nBaseFlags | ES_AUTOHSCROLL, 
									rEditArea.left, rEditArea.top, 
									rEditArea.Width(), rEditArea.Height(),
									GetSafeHwnd(), (HMENU)nID);

				//set the default
				pNewEdit->SetWindowText(pString->GetValue());

				//save it in the list
				m_pPropControl[nProp][0] = pNewEdit;
			}

			//setup the tooltip
			m_ToolTip.AddWindowTool(pNewEdit, pProp->GetHelp());

			//create the browse button if needed
			if(pString->IsFilename())
			{
				CButton* pNewButton = new CButton;
				if(pNewButton)
				{
					pNewButton->Create("...", nBaseFlags, CRect(rEditArea.right, rArea.top, rArea.right, rArea.bottom), this, nID + 1);
					m_pPropControl[nProp][1] = pNewButton;

					//setup the button's tooltip
					m_ToolTip.AddWindowTool(pNewButton, IDS_TOOLTIP_BROWSE_FOR_FILE);
				}					
			}
		}
		break;
	case PROPERTY_ENUM:
		{
			//create the combo box for the drop down of selections
			CComboBox* pNewCombo = new CComboBox;
			if(pNewCombo)
			{
				CPackerEnumProperty* pEnum = (CPackerEnumProperty*)pProp;

				CRect rFullArea(rArea);
				rFullArea.InflateRect(0, 0, 0, PROPERTY_HEIGHT * min(3, pEnum->GetNumItems()));

				pNewCombo->Create(nBaseFlags | CBS_DROPDOWNLIST, rFullArea, this, nID);

				//add the items
				for(uint32 nCurrItem = 0; nCurrItem < pEnum->GetNumItems(); nCurrItem++)
				{
					pNewCombo->InsertString(nCurrItem, pEnum->GetItem(nCurrItem));
				}

				//select the item
				pNewCombo->SetCurSel(pEnum->GetSelection());

				//save it in the list
				m_pPropControl[nProp][0] = pNewCombo;

				//setup the tooltip
				m_ToolTip.AddWindowTool(pNewCombo, pProp->GetHelp());
			}
		}
		break;
	case PROPERTY_BOOL:
		{
			//create a check box for checking/unchecking items
			CButton* pNewButton = new CButton;
			if(pNewButton)
			{
				pNewButton->Create("", nBaseFlags | BS_AUTOCHECKBOX, rArea, this, nID); 
				m_pPropControl[nProp][0] = pNewButton;

				//init the default value
				CPackerBoolProperty* pBoolProp = (CPackerBoolProperty*)pProp;
				pNewButton->SetCheck(pBoolProp->GetValue() ? 1 : 0);
		
				//setup the tooltip
				m_ToolTip.AddWindowTool(pNewButton, pProp->GetHelp());
			}
		}
		break;
	case PROPERTY_INTERFACE:
		{
			CPackerInterfaceProperty* pIntf = (CPackerInterfaceProperty*)pProp;

			DWORD nTextStyle	= 0;
			bool  bDisplayName	= true;

			switch(pIntf->GetInterfaceType())
			{
			case CPackerInterfaceProperty::TEXT_LEFT:
				nTextStyle = SS_LEFT;
				break;
			case CPackerInterfaceProperty::TEXT_RIGHT:
				nTextStyle = SS_RIGHT;
				break;
			case CPackerInterfaceProperty::TEXT_CENTER:
				nTextStyle = SS_CENTER;
				break;
			case CPackerInterfaceProperty::SEPARATOR:
				nTextStyle = SS_GRAYFRAME;
				bDisplayName = false;
				rArea.bottom -= rArea.Height() * 3 / 4;
				break;
			default:
				break;
			}

			if(pIntf->GetInterfaceType() != CPackerInterfaceProperty::BLANK)
			{
				CStatic* pStatic = new CStatic;
				if(pStatic)
				{
					if(bDisplayName)
					{
						rArea.top = rArea.bottom - GetAbsoluteFontHeight();
					}

					pStatic->Create(bDisplayName ? pProp->GetName() : "", nBaseFlags | nTextStyle, rArea, this, nID); 
					m_pPropControl[nProp][0] = pStatic;
				}
			}
		}
		break;
	default:
		ASSERT(FALSE);
		break;
	}

	//setup the fonts for all the new properties
	for(uint32 nCurrCtrl = 0; nCurrCtrl < MAX_CONTROLS_PER_PROP; nCurrCtrl++)
	{
		if(m_pPropControl[nProp][nCurrCtrl])
		{
			m_pPropControl[nProp][nCurrCtrl]->SetFont(&m_Font);
		}
	}
}