コード例 #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 プロジェクト: artemeliy/inf4715
RefTargetHandle TapeHelpObject::Clone(RemapDir& remap)
{
    TapeHelpObject* newob = new TapeHelpObject();
    newob->ReplaceReference(0,remap.CloneRef(pblock));
    newob->specLenState = specLenState;
    newob->ivalid.SetEmpty();
    newob->enable = enable;
    BaseClone(this, newob, remap);
    return(newob);
}
コード例 #3
0
ファイル: tapehelp.cpp プロジェクト: artemeliy/inf4715
void TapeHelpCreationManager::CreateNewObject()
{
    tapeObject = (TapeHelpObject*)cDesc->Create();
    lastPutCount = theHold.GetGlobalPutCount();

    macroRec->BeginCreate(cDesc);
    // Start the edit params process
    if ( tapeObject ) {

        tapeObject->SetAFlag(A_OBJ_LONG_CREATE);
#ifndef NO_CREATE_TASK  // russom - 12/04/01
        tapeObject->BeginEditParams( (IObjParam*)createInterface, BEGIN_EDIT_CREATE, NULL );
#endif
    }
}
コード例 #4
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;
}
コード例 #5
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;
}
コード例 #6
0
ファイル: tapehelp.cpp プロジェクト: artemeliy/inf4715
INT_PTR CALLBACK TapeHelpParamDialogProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
    TapeHelpObject *th = DLGetWindowLongPtr<TapeHelpObject *>( hDlg);
    if ( !th && message != WM_INITDIALOG ) return FALSE;

    switch ( message ) {
    case WM_INITDIALOG:
        th = (TapeHelpObject *)lParam;
        DLSetWindowLongPtr( hDlg, th);
        SetDlgFont( hDlg, th->iObjParams->GetAppHFont() );

        th->lengthSpin = GetISpinner(GetDlgItem(hDlg,IDC_LENSPINNER));
        th->lengthSpin->SetLimits( MIN_TAPE_LEN, MAX_TAPE_LEN, FALSE );
        // alexc - 03.06.09 - increments proportional to the spinner value
        th->lengthSpin->SetAutoScale();
        if(th->specLenState)
            th->lengthSpin->SetValue( th->GetLength(th->iObjParams->GetTime()), FALSE );
        else
            th->lengthSpin->SetValue( th->lastDist, FALSE );
        th->lengthSpin->LinkToEdit( GetDlgItem(hDlg,IDC_LENGTH), EDITTYPE_UNIVERSE );

        CheckDlgButton( hDlg, IDC_SPEC_LEN, th->specLenState );
        EnableWindow(GetDlgItem(hDlg, IDC_LENGTH), th->specLenState);
        EnableWindow(GetDlgItem(hDlg, IDC_LENSPINNER), th->specLenState);

        return FALSE;

    case WM_DESTROY:
        ReleaseISpinner( th->lengthSpin );
        return FALSE;

    case CC_SPINNER_BUTTONDOWN:
        theHold.Begin();
        return TRUE;

    case CC_SPINNER_CHANGE:
        if (!theHold.Holding()) theHold.Begin();
        switch ( LOWORD(wParam) ) {
        case IDC_LENSPINNER:
            th->SetLength( th->iObjParams->GetTime(), th->lengthSpin->GetFVal() );
            th->lengthSpin->SetKeyBrackets(th->pblock->KeyFrameAtTime(PB_LENGTH,th->iObjParams->GetTime()));
            th->iObjParams->RedrawViews(th->iObjParams->GetTime(),REDRAW_INTERACTIVE);
            break;
        }
        return TRUE;

    case WM_CUSTEDIT_ENTER:
    case CC_SPINNER_BUTTONUP:
        if (HIWORD(wParam) || message==WM_CUSTEDIT_ENTER) theHold.Accept(GetString(IDS_DS_PARAMCHG));
        else theHold.Cancel();
        th->iObjParams->RedrawViews(th->iObjParams->GetTime(),REDRAW_END);
        return TRUE;

    case WM_MOUSEACTIVATE:
        th->iObjParams->RealizeParamPanel();
        return FALSE;

    case WM_LBUTTONDOWN:
    case WM_LBUTTONUP:
    case WM_MOUSEMOVE:
        th->iObjParams->RollupMouseMessage(hDlg,message,wParam,lParam);
        return FALSE;

    case WM_COMMAND:
        switch( LOWORD(wParam) ) {
        case IDC_SPEC_LEN:
            th->SetSpecLen( IsDlgButtonChecked( hDlg, IDC_SPEC_LEN ) );
            EnableWindow(GetDlgItem(hDlg, IDC_LENGTH), th->specLenState);
            EnableWindow(GetDlgItem(hDlg, IDC_LENSPINNER), th->specLenState);
            th->iObjParams->RedrawViews(th->iObjParams->GetTime());
            break;
        }
        return FALSE;

    default:
        return FALSE;
    }
}