コード例 #1
0
ファイル: tapehelp.cpp プロジェクト: artemeliy/inf4715
//TapeHelpCreationManager::~TapeHelpCreationManager
void TapeHelpCreationManager::End()
{
    if ( tapeObject ) {
        tapeObject->ClearAFlag(A_OBJ_LONG_CREATE);

#ifndef NO_CREATE_TASK  // russom - 12/04/01
        tapeObject->EndEditParams( (IObjParam*)createInterface,
                                   END_EDIT_REMOVEUI, NULL);
#endif

        if ( !attachedToNode ) {
            // RB 4-9-96: Normally the hold isn't holding when this
            // happens, but it can be in certain situations (like a track view paste)
            // Things get confused if it ends up with undo...
            theHold.Suspend();
            tapeObject->DeleteAllRefsFromMe();
            tapeObject->DeleteAllRefsToMe();
            tapeObject->DeleteThis();
            tapeObject = NULL;
            theHold.Resume();
            // RB 7/28/97: If something has been put on the undo stack since this object was created, we have to flush the undo stack.
            if (theHold.GetGlobalPutCount()!=lastPutCount) {
                GetSystemSetting(SYSSET_CLEAR_UNDO);
            }
            macroRec->Cancel();
        }
        else if ( tapeNode ) {
            // Get rid of the reference.
            DeleteReference(0);  // sets tapeNode = NULL
        }
    }
}
コード例 #2
0
ファイル: tapehelp.cpp プロジェクト: innovatelogic/ilogic-vm
RefResult TapeHelpCreationManager::NotifyRefChanged(
    const Interval& changeInt,
    RefTargetHandle hTarget,
    PartID& partID,
    RefMessage message,
    BOOL propagate)
{
    switch (message) {
    case REFMSG_PRENOTIFY_PASTE:
    case REFMSG_TARGET_SELECTIONCHANGE:
        if ( ignoreSelectionChange ) {
            break;
        }
        if ( tapeObject && tapeNode==hTarget ) {
            // this will set tapeNode== NULL;
            DeleteReference(0);
            goto endEdit;
        }
    // fall through

    case REFMSG_TARGET_DELETED:
        if ( tapeObject && tapeNode==hTarget ) {
endEdit:
            tapeObject->EndEditParams( (IObjParam*)createInterface, 0, NULL);
            tapeObject  = NULL;
            tapeNode    = NULL;
            CreateNewObject();
            attachedToNode = FALSE;
        }
        else if (targNode==hTarget) {
            targNode = NULL;
            targObject = NULL;
        }
        break;
    }
    return REF_SUCCEED;
}
コード例 #3
0
ファイル: tapehelp.cpp プロジェクト: artemeliy/inf4715
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;
}