Ejemplo n.º 1
0
void GeometryButton::ResetLocation(ViewExp *vpt)
{
	if ( ! vpt || ! vpt->IsAlive() )
	{	
		// why are we here?
		DbgAssert(!_T("Doing ResetLocation() on invalid viewport!"));
		return;
	}

	if(GetEnabled()==true&&mLabel.Length()>0)
	{
		SIZE sp;
		GraphicsWindow *gw = vpt->getGW();
		gw->getTextExtents(mLabel.data(),&sp);
		RECT rect;
		HWND hWnd = vpt->GetHWnd();
		GetWindowRect (hWnd, &rect);
		int width = rect.right - rect.left;
		mLocation.x = width/2 - sp.cx/2;

		//need to reset the y here also...
		IGeometryCheckerManager *man = GetIGeometryCheckerManager();
		if(man->GetDisplayTextUpTop()==false)
		{
			int mult = 1; // at least for top
			if(man->DoesGeometryCheckerHavePropDlg(man->GetActivatedGeometryCheckerIndex()))
				++mult;
			if(man->GetAutoUpdate()==false)
				++mult;
			mLocation.y = (rect.bottom-rect.top) - mult*(4+OFFSET) + OFFSET;
		}
	}
}
Ejemplo n.º 2
0
Value*
getTextExtent_gw_cf(Value** arg_list, int count)
{
	check_arg_count_with_keys(getTextExtent, 1, count);
	const TCHAR			*text	= arg_list[0]->to_string();
	GraphicsWindow	*gw		= MAXScript_interface->GetActiveViewExp().getGW();	
	SIZE size;
	gw->getTextExtents(text, &size);
	return new Point2Value((float)size.cx, (float)size.cy);
}