BOOL PFOperatorSimpleShapeDlgProc::DlgProc( TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg,
											   WPARAM wParam, LPARAM lParam )
{
	IParamBlock2* pblock;
	switch ( msg )
	{
	case WM_INITDIALOG:
		// Send the message to notify the initialization of dialog
		pblock = map->GetParamBlock();
		if (pblock)
			pblock->NotifyDependents( FOREVER, (PartID)map, kSimpleShape_RefMsg_InitDlg );
		break;
	case WM_DESTROY:
		break;
	case WM_COMMAND:
		switch ( LOWORD( wParam ) )
		{
		case kSimpleShape_message_useScale:
			pblock = map->GetParamBlock();
			if (pblock)
				UpdateScaleDlg(hWnd, pblock->GetInt(kSimpleShape_useScale, 0) );
			break;
		}
		break;
	}
	return FALSE;
}
INT_PTR PFOperatorInstanceShapeDlgProc::DlgProc( TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg,
											   WPARAM wParam, LPARAM lParam )
{
	ICustButton *iBut;
	PFOperatorInstanceShape *op;
	INode* obj;
	TSTR name;
	BOOL separateAny, animatedShape, addRandomOffset, setScale;

	switch ( msg )
	{
	case WM_INITDIALOG:
		// Set ICustButton properties
		iBut = GetICustButton(GetDlgItem(hWnd, IDC_PICK));
		iBut->SetType(CBT_CHECK);
		iBut->SetHighlightColor(GREEN_WASH);
		ReleaseICustButton(iBut);
		// Send the message to notify the initialization of dialog
		map->GetParamBlock()->NotifyDependents( FOREVER, (PartID)map, kInstanceShape_RefMsg_InitDlg );
		break;
	case WM_DESTROY:
		break;
	case WM_COMMAND:
		switch ( LOWORD( wParam ) )
		{
		case IDC_PICK:
			map->GetParamBlock()->NotifyDependents( FOREVER, PART_OBJ, kInstanceShape_RefMsg_PickObj );
			break;
		case IDC_UPDATESHAPE:
			map->GetParamBlock()->NotifyDependents( FOREVER, PART_OBJ, kInstanceShape_RefMsg_UpdateShape );
			break;
		case IDC_NEW:
			map->GetParamBlock()->NotifyDependents( FOREVER, PART_OBJ, kInstanceShape_RefMsg_NewRand );
			break;
		case kInstanceShape_message_name:
			op = reinterpret_cast <PFOperatorInstanceShape *> (lParam);
			obj = (op) ? const_cast <INode*> (op->object()) : NULL;
			name = (obj) ? obj->GetName() : GetString(IDS_NONE);
			UpdateObjectNameDlg(hWnd, name);
			break;
		case kInstanceShape_message_type:
			op = reinterpret_cast <PFOperatorInstanceShape *> (lParam);
			separateAny = map->GetParamBlock()->GetInt(kInstanceShape_sepGroup, t) ||
							map->GetParamBlock()->GetInt(kInstanceShape_sepHierarchy, t) ||
							map->GetParamBlock()->GetInt(kInstanceShape_sepElements, t);
			UpdateParticleShapeDlg(hWnd, op->meshData());
			UpdateRandomShapeDlg(hWnd, separateAny);
			break;
		case kInstanceShape_message_enterPick:
			iBut = GetICustButton(GetDlgItem(hWnd, IDC_PICK));
			iBut->SetCheck(TRUE);
			ReleaseICustButton(iBut);
			break;
		case kInstanceShape_message_exitPick:
			iBut = GetICustButton(GetDlgItem(hWnd, IDC_PICK));
			iBut->SetCheck(FALSE);
			ReleaseICustButton(iBut);
			break;
		case kInstanceShape_message_animate:
			animatedShape = map->GetParamBlock()->GetInt(kInstanceShape_animatedShape, t);
			addRandomOffset = map->GetParamBlock()->GetInt(kInstanceShape_syncRandom, t);
			UpdateAnimatedSahpeDlg( hWnd, animatedShape, addRandomOffset );
			break;
		case kInstanceShape_message_setScale:
			setScale = map->GetParamBlock()->GetInt(kInstanceShape_setScale, t);
			UpdateScaleDlg( hWnd, setScale);
			break;
		}
		break;
	}
	return FALSE;
}