int TapeHelpCreationManager::proc( HWND hwnd, int msg, int point, int flag, IPoint2 m ) { int res = TRUE; TSTR targName; ViewExp& vpx = createInterface->GetViewExp(hwnd); assert( vpx.IsAlive() ); DWORD hideflags; switch ( msg ) { case MOUSE_POINT: switch ( point ) { case 0: { pt0 = m; assert( tapeObject ); if ( createInterface->SetActiveViewport(hwnd) ) { return FALSE; } if (createInterface->IsCPEdgeOnInView()) { res = FALSE; goto done; } // if helpers were hidden by category, re-display them hideflags = GetCOREInterface()->GetHideByCategoryFlags(); if(hideflags & (HIDE_HELPERS)) { hideflags = hideflags & ~(HIDE_HELPERS); GetCOREInterface()->SetHideByCategoryFlags(hideflags); hideflags = GetCOREInterface()->GetHideByCategoryFlags(); } if ( attachedToNode ) { // send this one on its way tapeObject->EndEditParams( (IObjParam*)createInterface, 0, NULL); macroRec->EmitScript(); // Get rid of the reference. if (tapeNode) DeleteReference(0); // new object CreateNewObject(); // creates tapeObject } needToss = theHold.GetGlobalPutCount()!=lastPutCount; theHold.Begin(); // begin hold for undo mat.IdentityMatrix(); // link it up INode *l_tapeNode = createInterface->CreateObjectNode( tapeObject); attachedToNode = TRUE; assert( l_tapeNode ); createCB = tapeObject->GetCreateMouseCallBack(); createInterface->SelectNode( l_tapeNode ); // Create target object and node targObject = (Object*) createInterface->CreateInstance(GEOMOBJECT_CLASS_ID,Class_ID(TARGET_CLASS_ID,0)); targObject->SetAFlag(A_OBJ_LONG_CREATE); assert(targObject); targNode = createInterface->CreateObjectNode( targObject); assert(targNode); targName = l_tapeNode->GetName(); targName += GetString(IDS_DB_DOT_TARGET); macroRec->Disable(); targNode->SetName(targName); macroRec->Enable(); // hook up camera to target using lookat controller. createInterface->BindToTarget(l_tapeNode,targNode); // Reference the new node so we'll get notifications. theHold.Suspend(); ReplaceReference( 0, l_tapeNode); theHold.Resume(); // Position camera and target at first point then drag. mat.IdentityMatrix(); //mat[3] = vpx.GetPointOnCP(m); #ifdef _3D_CREATE mat.SetTrans( vpx.SnapPoint(m,m,NULL,SNAP_IN_3D) ); #else mat.SetTrans(vpx.SnapPoint(m,m,NULL,SNAP_IN_PLANE)); #endif createInterface->SetNodeTMRelConstPlane(tapeNode, mat); createInterface->SetNodeTMRelConstPlane(targNode, mat); tapeObject->Enable(1); ignoreSelectionChange = TRUE; createInterface->SelectNode( targNode,0); ignoreSelectionChange = FALSE; res = TRUE; } break; case 1: if (Length(m-pt0)<2) goto abort; //mat[3] = vpx.GetPointOnCP(m); #ifdef _3D_CREATE mat.SetTrans( vpx.SnapPoint(m,m,NULL,SNAP_IN_3D) ); #else mat.SetTrans(vpx.SnapPoint(m,m,NULL,SNAP_IN_PLANE)); #endif macroRec->Disable(); createInterface->SetNodeTMRelConstPlane(targNode, mat); macroRec->Enable(); ignoreSelectionChange = TRUE; createInterface->SelectNode( tapeNode); ignoreSelectionChange = FALSE; createInterface->RedrawViews(createInterface->GetTime()); theHold.Accept(IDS_DS_CREATE); targObject->ClearAFlag(A_OBJ_LONG_CREATE); res = FALSE; // We're done break; } break; case MOUSE_MOVE: //mat[3] = vpx.GetPointOnCP(m); #ifdef _3D_CREATE mat.SetTrans( vpx.SnapPoint(m,m,NULL,SNAP_IN_3D) ); #else mat.SetTrans(vpx.SnapPoint(m,m,NULL,SNAP_IN_PLANE)); #endif macroRec->Disable(); createInterface->SetNodeTMRelConstPlane(targNode, mat); macroRec->Enable(); createInterface->RedrawViews(createInterface->GetTime()); macroRec->SetProperty(tapeObject, _T("target"), // JBW 4/23/99 mr_create, Class_ID(TARGET_CLASS_ID, 0), GEOMOBJECT_CLASS_ID, 1, _T("transform"), mr_matrix3, &mat); res = TRUE; break; case MOUSE_FREEMOVE: SetCursor(LoadCursor(hInstance, MAKEINTRESOURCE(IDC_CROSS_HAIR))); #ifdef _OSNAP //Snap Preview #ifdef _3D_CREATE vpx.SnapPreview(m,m,NULL, SNAP_IN_3D); #else vpx.SnapPreview(m,m,NULL, SNAP_IN_PLANE); #endif #endif break; case MOUSE_PROPCLICK: // right click while between creations createInterface->RemoveMode(NULL); break; case MOUSE_ABORT: abort: assert( tapeObject ); tapeObject->EndEditParams( (IObjParam*)createInterface,0,NULL); macroRec->Cancel(); theHold.Cancel(); // deletes both the camera and target. // Toss the undo stack if param changes have been made if (needToss) GetSystemSetting(SYSSET_CLEAR_UNDO); tapeNode = NULL; targNode = NULL; createInterface->RedrawViews(createInterface->GetTime()); CreateNewObject(); attachedToNode = FALSE; res = FALSE; } done: return res; }
int CreateSWrapObjectProc::proc(HWND hwnd,int msg,int point,int flag, IPoint2 m ) { int res=TRUE; ViewExp *vpx = createInterface->GetViewport(hwnd); assert( vpx ); #ifdef _3D_CREATE DWORD snapdim = SNAP_IN_3D; #else DWORD snapdim = SNAP_IN_PLANE; #endif switch ( msg ) { case MOUSE_POINT: switch ( point ) { case 0: assert( SWrapObj ); vpx->CommitImplicitGrid(m, flag ); if ( createInterface->SetActiveViewport(hwnd) ) { return FALSE; } if (createInterface->IsCPEdgeOnInView()) { res = FALSE; goto done; } if ( attachedToNode ) { // send this one on its way #ifdef _OSNAP SWrapObj->ClearAFlag(A_OBJ_LONG_CREATE); #endif SWrapObj->EndEditParams( (IObjParam*)createInterface, 0, NULL); if (SWrapNode) { theHold.Suspend(); DeleteReference(0); theHold.Resume(); } // new object CreateNewObject(); // creates SWrapObj } theHold.Begin(); // begin hold for undo mat.IdentityMatrix(); // link it up SWrapNode = createInterface->CreateObjectNode( SWrapObj); attachedToNode = TRUE; assert( SWrapNode ); createCB = NULL; createInterface->SelectNode( SWrapNode ); // Reference the new node so we'll get notifications. theHold.Suspend(); MakeRefByID( FOREVER, 0, SWrapNode); theHold.Resume(); mat.IdentityMatrix(); default: res = createmethod(vpx,msg,point,flag,m,mat); createInterface->SetNodeTMRelConstPlane(SWrapNode, mat); if (res==CREATE_ABORT) goto abort; if (res==CREATE_STOP){ #ifdef _OSNAP SWrapObj->ClearAFlag(A_OBJ_LONG_CREATE); #endif theHold.Accept(GetString(IDS_AP_CREATE)); } createInterface->RedrawViews(createInterface->GetTime()); break; } break; case MOUSE_MOVE: res = createmethod(vpx,msg,point,flag,m,mat); createInterface->SetNodeTMRelConstPlane(SWrapNode, mat); if (res==CREATE_ABORT) goto abort; if (res==CREATE_STOP){ #ifdef _OSNAP SWrapObj->ClearAFlag(A_OBJ_LONG_CREATE); #endif theHold.Accept(GetString(IDS_AP_CREATE)); } createInterface->RedrawViews(createInterface->GetTime()); break; /* res = createmethod(vpx,msg,point,flag,m,mat); createInterface->SetNodeTMRelConstPlane(SWrapNode, mat); if (res==CREATE_ABORT) goto abort; if (res==CREATE_STOP) theHold.Accept(GetString(IDS_AP_CREATE)); createInterface->RedrawViews(createInterface->GetTime()); break;*/ case MOUSE_PROPCLICK: createInterface->SetStdCommandMode(CID_OBJMOVE); break; case MOUSE_ABORT: abort: assert( SWrapObj ); #ifdef _OSNAP SWrapObj->ClearAFlag(A_OBJ_LONG_CREATE); #endif SWrapObj->EndEditParams( (IObjParam*)createInterface,0,NULL); theHold.Cancel(); // deletes both the object and target. if (theHold.GetGlobalPutCount()!=lastPutCount) GetSystemSetting(SYSSET_CLEAR_UNDO); SWrapNode = NULL; createInterface->RedrawViews(createInterface->GetTime()); CreateNewObject(); attachedToNode = FALSE; res = FALSE; break; case MOUSE_FREEMOVE: SetCursor(LoadCursor(hInstance, MAKEINTRESOURCE(IDC_CROSS_HAIR))); #ifdef _OSNAP //PREVIEW SNAP res = createmethod(vpx,msg,point,flag,m,mat); #endif vpx->TrackImplicitGrid(m); break; } done: if ((res == CREATE_STOP)||(res==CREATE_ABORT)) vpx->ReleaseImplicitGrid(); createInterface->ReleaseViewport(vpx); return res; }