Пример #1
0
void WeightTableWindow::PaintCellNameVertically(HDC hdc, int x, int y, int height, BOOL sel, TSTR name)
	{
	HBRUSH textBackground;
	DWORD textColor;
	DWORD textBKColor;
	
	if (sel)
		{
		
		textBackground = GetSysColorBrush(COLOR_HIGHLIGHT);
		textColor = GetSysColor(COLOR_HIGHLIGHTTEXT) ;
		textBKColor = GetSysColor(COLOR_HIGHLIGHT) ;
		SelectObject(hdc, hFixedFontBold);
 		}
	else
		{
		textBackground = ColorMan()->GetBrush(kWindow );
		textColor = ColorMan()->GetColor(kWindowText ) ;
		textBKColor = ColorMan()->GetColor(kWindow ) ;
		SelectObject(hdc, hFixedFont);
		}
	SetTextColor(hdc, textColor);
	SelectObject(hdc, textBackground);
	SetBkColor(hdc,  textBKColor);
	SelectObject(hdc,pBackPen);
	Rectangle(hdc, x,  y,x+textHeight+1,y+height+1);
	int th = textHeight -4;
	if ((th * name.Length()) <= height)
		{
		y = height - textHeight+1;

		for	(int i= (name.Length()-1); i >= 0 ; i--)
			{
			TCHAR *t = &name[i];
			int offset = textHeight/4;
			TextOut(hdc, x+offset,y,t,1);
			y -= th;
			}
		}
	else
		{
		y = 1;

		for	(int i= 0 ; i < name.Length() ; i++)
			{
			TCHAR *t = &name[i];
			int offset = textHeight/4;
			TextOut(hdc, x+offset,y,t,1);
			y += th;
			}

		}

	}
Пример #2
0
//5.1.01
void WeightTableWindow::PaintCellName(HDC hdc, int x, int y,int width, BOOL sel, int justify, TSTR name)
	{
	HBRUSH textBackground;
	DWORD textColor;
	DWORD textBKColor;
	
	if (sel)
		{
		
		textBackground = GetSysColorBrush(COLOR_HIGHLIGHT);
		textColor = GetSysColor(COLOR_HIGHLIGHTTEXT) ;
		textBKColor = GetSysColor(COLOR_HIGHLIGHT) ;
		SelectObject(hdc, hFixedFontBold);
 		}
	else
		{
		textBackground = ColorMan()->GetBrush(kWindow );
		textColor = ColorMan()->GetColor(kWindowText ) ;
		textBKColor = ColorMan()->GetColor(kWindow ) ;
		SelectObject(hdc, hFixedFont);
		}
	SetTextColor(hdc, textColor);
	SelectObject(hdc, textBackground);
	SetBkColor(hdc,  textBKColor);
	SelectObject(hdc,pBackPen);

	int offset = 0;

	  //5.1.01
	if (justify == TEXT_CENTER_JUSTIFIED)
		{
		SIZE strSize;
		GetTextExtentPoint32(hdc, (LPCTSTR) name, name.Length(), (LPSIZE) &strSize ); 

		offset = width/2 - strSize.cx/2;
		}
	else if (justify == TEXT_RIGHT_JUSTIFIED)
		{
		SIZE strSize;
		GetTextExtentPoint32(hdc, (LPCTSTR) name, name.Length(), (LPSIZE) &strSize ); 

		offset = width - strSize.cx - 4;
		}

	Rectangle(hdc, x,  y,x+width+1,y+textHeight+1);
	TextOut(hdc, x+3+offset,y+1,name,name.Length());   //5.1.01

	}
Пример #3
0
void WeightTableWindow::BuildOffScreenBuffers()
	{	
	iWeightListBuf = CreateIOffScreenBuf(hWeightList );
	iNameListBuf = CreateIOffScreenBuf(hNameList );
	iAttribListBuf = CreateIOffScreenBuf(hAttribList );

	iWeightListGlobalBuf = CreateIOffScreenBuf(hWeightListGlobal );
	iAttribListGlobalBuf = CreateIOffScreenBuf(hAttribListGlobal );

	iWeightListLabelBuf = CreateIOffScreenBuf(hWeightListLabel );
	iNameListLabelBuf = CreateIOffScreenBuf(hNameListLabel );
	iAttribListLabelBuf = CreateIOffScreenBuf(hAttribListLabel );

	COLORREF bkColor = ColorMan()->GetColor(kWindow ) ;
	iWeightListBuf->SetBkColor(bkColor);
	iNameListBuf->SetBkColor(bkColor);
	iAttribListBuf->SetBkColor(bkColor);

	iWeightListGlobalBuf->SetBkColor(bkColor);
	iAttribListGlobalBuf->SetBkColor(bkColor);

	iWeightListLabelBuf->SetBkColor(bkColor);
	iNameListLabelBuf->SetBkColor(bkColor);
	iAttribListLabelBuf->SetBkColor(bkColor);

	}
Пример #4
0
bool GeometryButton::OnAction(HWND hwnd,GraphicsWindow *gw,IPoint2 hitLoc,IViewportButton::Action action)
{
	bool val = false;
	if(GetEnabled()==true)
	{
		IViewportButtonManager *vpm = static_cast<IViewportButtonManager*>(GetCOREInterface(IVIEWPORTBUTTONMANAGER_INTERFACE ));
		if(vpm)
			val =  vpm->HitTest(hwnd,gw,mLocation,hitLoc,mLabel);
	}
	if(val==true&&(action == IViewportButton::eRightClick||action == IViewportButton::eLeftClick))
	{
		IGeometryCheckerManager *man = GetIGeometryCheckerManager();
		if(man)
			man->PopupMenuSelect();
	}
	//now make sure we set the color correclty, but only set it when it changes
	Color textColor;
	if(val==true) //okay we hit it so change the color
	{
		 textColor = GetUIColor(COLOR_VP_LABEL_HIGHLIGHT);
	}
	else
	{
		COLORREF cr = ColorMan()->GetColor(GEOMETRY_TEXT_COLOR);
		textColor = Color(cr);
	}
	if(textColor!=mColor)
		SetColor(textColor);
	return val;
}
Пример #5
0
void WeightTableWindow::PaintCellAttribute(HDC hdc, int x, int y, BOOL sel, int state)
	{
	HBRUSH textBackground;
	DWORD textColor;
	DWORD textBKColor;
	SIZE strSize;

	if (sel)
		{
		
		textBackground = GetSysColorBrush(COLOR_HIGHLIGHT);
		textColor = GetSysColor(COLOR_HIGHLIGHTTEXT) ;
		textBKColor = GetSysColor(COLOR_HIGHLIGHT) ;
		SelectObject(hdc, hFixedFontBold);
 		}
	else
		{
		textBackground = ColorMan()->GetBrush(kWindow );
		textColor = ColorMan()->GetColor(kWindowText ) ;
		textBKColor = ColorMan()->GetColor(kWindow ) ;
		SelectObject(hdc, hFixedFont);
		}
	SetTextColor(hdc, textColor);
	SelectObject(hdc, textBackground);
	SetBkColor(hdc,  textBKColor);
	SelectObject(hdc,pBackPen);

	TSTR stateStr;
	if (state == STATE_CHECKED)
		stateStr.printf("X");
	else if (state == STATE_INDETERMIANT)
		stateStr.printf("-");
	else stateStr.printf(" ");

	int offset;
	GetTextExtentPoint32(hdc, (LPCTSTR) stateStr, stateStr.Length(), (LPSIZE) &strSize ); 
	if (GetFlipFlopUI())
		offset = vertNameWidth/2 - strSize.cx/2;
	else offset = textHeight/2 - strSize.cx/2;
	if (GetFlipFlopUI())
		Rectangle(hdc, x,  y,x+vertNameWidth+1,y+textHeight+1);
	else Rectangle(hdc, x,  y,x+textHeight+1,y+textHeight+1);

	TextOut(hdc, x+offset,y+1,stateStr,stateStr.Length());

	}
Пример #6
0
void FlippedFacesChecker::DisplayOverride(TimeValue t, INode* inode, HWND hwnd,Tab<int> &results)
{
	DisplayIn3DViewport d3dViewport;
	Color c;
	COLORREF cr = ColorMan()->GetColor(GEOMETRY_DISPLAY_COLOR);

	c = Color(cr);
	DisplayIn3DViewport::DisplayParams params;
	params.mC = &c;
	params.mSeeThrough = false;
	params.mLighted = false;
	params.mFlipFaces= true;
	params.mDrawEdges = true;
	d3dViewport.DisplayResults(params,t,inode,hwnd,TypeReturned(),results);
}
Пример #7
0
void WeightTableWindow::PaintCellWeight(HDC hdc, int x, int y,int width, BOOL sel, BOOL centered, 
										float value,BOOL indeterminant, BOOL locked, BOOL excluded)

	{
	HBRUSH textBackground;
	DWORD textColor;
	DWORD textBKColor;


	
	if (sel)
		{
		
		textBackground = GetSysColorBrush(COLOR_HIGHLIGHT);
		textColor = GetSysColor(COLOR_HIGHLIGHTTEXT) ;
		textBKColor = GetSysColor(COLOR_HIGHLIGHT) ;
		SelectObject(hdc, hFixedFontBold);
 		}
	else
		{
		textBackground = ColorMan()->GetBrush(kWindow );
		textColor = ColorMan()->GetColor(kWindowText ) ;
		textBKColor = ColorMan()->GetColor(kWindow ) ;
		SelectObject(hdc, hFixedFont);
		}

	SetTextColor(hdc, textColor);
	SelectObject(hdc, textBackground);
	SetBkColor(hdc,  textBKColor);
	SelectObject(hdc,pBackPen);

	int offset = 0;
	TSTR weightStr;

	if (indeterminant)
		weightStr.printf("-");
	else weightStr.printf("%0.3f",value);

	SIZE strSize;
	GetTextExtentPoint32(hdc,  (LPCTSTR) weightStr,    weightStr.Length(),  (LPSIZE) &strSize ); 

	int xPos;
	
	if (indeterminant)
		xPos = width/2 - strSize.cx/2;
	else xPos = 3;

	if (centered)
		{

		GetTextExtentPoint32(hdc, (LPCTSTR) weightStr, weightStr.Length(), (LPSIZE) &strSize ); 

		xPos = width/2 - strSize.cx/2;
		}

	Rectangle(hdc, x,  y,x+width+1,y+textHeight+1);
	TextOut(hdc, x+xPos,y+1,weightStr,weightStr.Length());

/*	if ((locked) || (excluded))
		{
		textBackground = ColorMan()->GetBrush(kWindow );
		textColor = GetSysColor(COLOR_GRAYTEXT ) ;
		textBKColor = ColorMan()->GetColor(kWindow ) ;
		}
*/
	if (this->GetShowExclusion())
		{
		SelectObject(hdc,pBackPen);
		Rectangle(hdc, x+width-9,  y,x+width+1,y+9+1);
		if (excluded)
			{
			SelectObject(hdc,pSelPen);
			MoveToEx(hdc,x+width-9, y, NULL);
			LineTo(hdc,x+width+1,y+9+1);

			MoveToEx(hdc,x+width, y, NULL);
			LineTo(hdc,x+width-9,y+9);
			}
		}

	if (GetShowLock())
		{
		SelectObject(hdc,pBackPen);
		Rectangle(hdc, x+width-18,  y,x+width-9+1,y+9+1);
		if (locked)
			{
			SelectObject(hdc,pSelPen);

			MoveToEx(hdc,x+width-16, y+2, NULL);
			LineTo(hdc,x+width-16,y+7);
			LineTo(hdc,x+width-11,y+7);
			}
		}
	
	}
Пример #8
0
void MorphByBone::BuildTreeList()
{
//get our handle

	suspendUI = TRUE;
	HWND treeHWND = GetDlgItem(rollupHWND,IDC_TREE1);
	int tempBone, tempMorph;
	tempBone = currentBone;
	tempMorph = currentMorph;

	
	COLORREF clrBk = ColorMan()->GetColor(kWindow);
	TreeView_SetBkColor( treeHWND, clrBk); 



//	TVITEM tvi;

	BitArray expanded;
	expanded.SetSize(boneData.Count());
	expanded.ClearAll();
	for (int i = 0; i < boneData.Count(); i++)
		{
	//if !null
		INode *node = GetNode(i);
		if (node != NULL)
			{
	//add to parent
			TSTR name = node->GetName();
	//add the node as a root entry
			BOOL expand = TreeView_GetItemState(treeHWND,boneData[i]->treeHWND,TVIS_EXPANDED);
			if (expand)
				{
				expanded.Set(i);
				}
			}
		}

	TreeView_DeleteAllItems(treeHWND);	
	currentBone = tempBone;
	currentMorph = tempMorph;

	//DebugPrint(_T("Morph name creatiuon\n"));
//loop through our nodes
	for (int i = 0; i < boneData.Count(); i++)
		{
	//if !null
		INode *node = GetNode(i);
		if (node != NULL)
			{
	//add to parent
			TSTR name = node->GetName();
	//add the node as a root entry
			boneData[i]->tvi.state = 0;

			HTREEITEM parent = AddItemToTree(treeHWND, boneData[i]->tvi, name,i,TVI_ROOT);
			
			boneData[i]->treeHWND = parent;
			if (expanded[i])
			{
				boneData[i]->tvi.state = TVIS_EXPANDED;
				TreeView_SetItemState(treeHWND,boneData[i]->treeHWND,TVIS_EXPANDED,TVIS_EXPANDED);
			}
			if ((currentMorph == -1) && (i==currentBone))
			{
				if (i==currentBone)
				{
 				TreeView_SetItemState(treeHWND,boneData[currentBone]->treeHWND,TVIS_SELECTED,TVIS_SELECTED);
				TreeView_SetItemState(treeHWND,boneData[currentBone]->treeHWND,TVIS_BOLD,TVIS_BOLD);
				}
				else
				{
				TreeView_SetItemState(treeHWND,boneData[currentBone]->treeHWND,0,TVIS_SELECTED);
				TreeView_SetItemState(treeHWND,boneData[currentBone]->treeHWND,0,TVIS_BOLD);

				}
			}
	//loop through targets and add those as children
			for (int j = 0 ; j < boneData[i]->morphTargets.Count(); j++)
				{
				if (!boneData[i]->morphTargets[j]->IsDead())
					{
//add morph target to list
					TSTR morphName;
					if (boneData[i]->morphTargets[j]->IsDisabled())
						morphName.printf(_T("%s(%s)"),boneData[i]->morphTargets[j]->name,GetString(IDS_DISABLED));
					else morphName.printf(_T("%s(%0.1f)"),boneData[i]->morphTargets[j]->name,boneData[i]->morphTargets[j]->weight*100.f);

//					boneData[i]->morphTargets[j]->tvi.state = TVIS_BOLD ;
//					boneData[i]->morphTargets[j]->tvi.stateMask |= TVIS_BOLD ;
//DebugPrint(_T("Morph name %s\n"),morphName);
					boneData[i]->morphTargets[j]->tvi.state = 0;
					boneData[i]->morphTargets[j]->treeHWND = AddItemToTree(treeHWND ,boneData[i]->morphTargets[j]->tvi, morphName, (i+1)*1000+j,parent);

					if ((i== currentBone) && (j == currentMorph))
					{
						TreeView_SetItemState(treeHWND,boneData[i]->morphTargets[j]->treeHWND,TVIS_SELECTED ,TVIS_SELECTED );
						TreeView_SetItemState(treeHWND,boneData[i]->morphTargets[j]->treeHWND,TVIS_BOLD ,TVIS_BOLD );
					}
					else
					{
						TreeView_SetItemState(treeHWND,boneData[i]->morphTargets[j]->treeHWND,0 ,TVIS_SELECTED );
						TreeView_SetItemState(treeHWND,boneData[i]->morphTargets[j]->treeHWND,0 ,TVIS_BOLD );
					}





					
					}
				}
			}
		}
	suspendUI = FALSE;

}