Example #1
0
static INT_PTR CALLBACK AppDataTestDlgProc(
		HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
	{
	switch (msg) {
		case WM_INITDIALOG:
			theAppDataTest.Init(hWnd);
			CheckDlgButton(hWnd, IDC_APPDATA_XREF, s_through_xref);
			break;
		
		case WM_DESTROY:
			theAppDataTest.Destroy(hWnd);
			break;

		case WM_COMMAND:
			switch (LOWORD(wParam)) {
				case IDOK:
					theAppDataTest.iu->CloseUtility();
					break;

				case IDC_APPDATA_GET:
					theAppDataTest.GetAppData();
					break;

				case IDC_APPDATA_PUT:
					theAppDataTest.PutAppData();
					break;

				case IDC_APPDATA_EDIT:
					switch (HIWORD(wParam)) {
						case EN_SETFOCUS:
							DisableAccelerators();
							break;
						case EN_KILLFOCUS:
							EnableAccelerators();
							break;
						}
					break;
				case IDC_APPDATA_XREF:
					s_through_xref = IsDlgButtonChecked(hWnd, IDC_APPDATA_XREF)?true:false;
					break;
				}
			break;

		case WM_LBUTTONDOWN:
		case WM_LBUTTONUP:
		case WM_MOUSEMOVE:
			theAppDataTest.ip->RollupMouseMessage(hWnd,msg,wParam,lParam); 
			break;

		default:
			return FALSE;
		}
	return TRUE; 
	}
Example #2
0
INT_PTR CALLBACK
BackgroundImageDlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    TCHAR text[MAX_PATH];
    BackgroundObject *th =
        (BackgroundObject *)GetWindowLongPtr( hDlg, GWLP_USERDATA );	

    if ( !th && message != WM_INITDIALOG ) return FALSE;

    switch ( message ) {
    case WM_INITDIALOG: {
        th = (BackgroundObject *)lParam;
        SetWindowLongPtr( hDlg, GWLP_USERDATA, (LONG)th );
        Edit_SetText(GetDlgItem(hDlg, IDC_BACK), th->back.data());
        Edit_SetText(GetDlgItem(hDlg, IDC_BOTTOM), th->bottom.data());
        Edit_SetText(GetDlgItem(hDlg, IDC_FRONT), th->front.data());
        Edit_SetText(GetDlgItem(hDlg, IDC_LEFT), th->left.data());
        Edit_SetText(GetDlgItem(hDlg, IDC_RIGHT), th->right.data());
        Edit_SetText(GetDlgItem(hDlg, IDC_TOP), th->top.data());
        return TRUE;
    }
    
    case WM_COMMAND:			
        switch( LOWORD(wParam) ) {
        case IDC_BACK:
            switch(HIWORD(wParam)) {
            case EN_SETFOCUS:
                DisableAccelerators();					
                break;
            case EN_KILLFOCUS:
                EnableAccelerators();
                break;
            case EN_CHANGE:
                Edit_GetText(GetDlgItem(hDlg, IDC_BACK), text, MAX_PATH);
                th->back = text;
            }
            break;
        case IDC_BOTTOM:
            switch(HIWORD(wParam)) {
            case EN_SETFOCUS:
                DisableAccelerators();					
                break;
            case EN_KILLFOCUS:
                EnableAccelerators();
                break;
            case EN_CHANGE:
                Edit_GetText(GetDlgItem(hDlg, IDC_BOTTOM), text, MAX_PATH);
                th->bottom = text;
            }
            break;
        case IDC_FRONT:
            switch(HIWORD(wParam)) {
            case EN_SETFOCUS:
                DisableAccelerators();					
                break;
            case EN_KILLFOCUS:
                EnableAccelerators();
                break;
            case EN_CHANGE:
                Edit_GetText(GetDlgItem(hDlg, IDC_FRONT), text, MAX_PATH);
                th->front = text;
            }
            break;
        case IDC_LEFT:
            switch(HIWORD(wParam)) {
            case EN_SETFOCUS:
                DisableAccelerators();					
                break;
            case EN_KILLFOCUS:
                EnableAccelerators();
                break;
            case EN_CHANGE:
                Edit_GetText(GetDlgItem(hDlg, IDC_LEFT), text, MAX_PATH);
                th->left = text;
            }
            break;
        case IDC_RIGHT:
            switch(HIWORD(wParam)) {
            case EN_SETFOCUS:
                DisableAccelerators();					
                break;
            case EN_KILLFOCUS:
                EnableAccelerators();
                break;
            case EN_CHANGE:
                Edit_GetText(GetDlgItem(hDlg, IDC_RIGHT), text, MAX_PATH);
                th->right = text;
            }
            break;
        case IDC_TOP:
            switch(HIWORD(wParam)) {
            case EN_SETFOCUS:
                DisableAccelerators();					
                break;
            case EN_KILLFOCUS:
                EnableAccelerators();
                break;
            case EN_CHANGE:
                Edit_GetText(GetDlgItem(hDlg, IDC_TOP), text, MAX_PATH);
                th->top = text;
            }
            break;
        }
        return TRUE;
    default:
        return FALSE;
    }

    return FALSE;
}
Example #3
0
BOOL CALLBACK
    AnchorDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam,
                  AnchorObject *th)
{
    TCHAR text[MAX_PATH];
    int c, camIndex, i, type;
    HWND cb;
    Tab<INode *> cameras;

    switch (message)
    {
    case WM_INITDIALOG:

        th->ParentPickButton = GetICustButton(GetDlgItem(hDlg,
                                                         IDC_PICK_PARENT));
        th->ParentPickButton->SetType(CBT_CHECK);
        th->ParentPickButton->SetButtonDownNotify(TRUE);
        th->ParentPickButton->SetHighlightColor(GREEN_WASH);
        th->ParentPickButton->SetCheck(FALSE);

        th->dlgPrevSel = -1;
        th->hRollup = hDlg;
        if (th->triggerObject)
            Static_SetText(GetDlgItem(hDlg, IDC_TRIGGER_OBJ),
                           th->triggerObject->GetName());
        th->pblock->GetValue(PB_AN_TYPE, th->iObjParams->GetTime(),
                             type, FOREVER);
        th->isJump = type == 0;
        EnableWindow(GetDlgItem(hDlg, IDC_ANCHOR_URL), th->isJump);
        EnableWindow(GetDlgItem(hDlg, IDC_PARAMETER), th->isJump);
        EnableWindow(GetDlgItem(hDlg, IDC_BOOKMARKS), th->isJump);
        EnableWindow(GetDlgItem(hDlg, IDC_CAMERA), !th->isJump);
        GetCameras(th->iObjParams->GetRootNode(), &cameras);
        c = cameras.Count();
        cb = GetDlgItem(hDlg, IDC_CAMERA);
        camIndex = -1;
        for (i = 0; i < c; i++)
        {
            // add the name to the list
            TSTR name = cameras[i]->GetName();
            int ind = ComboBox_AddString(cb, name.data());
            ComboBox_SetItemData(cb, ind, cameras[i]);
            if (cameras[i] == th->cameraObject)
                camIndex = i;
        }
        if (camIndex != -1)
            ComboBox_SelectString(cb, 0, cameras[camIndex]->GetName());

        Edit_SetText(GetDlgItem(hDlg, IDC_DESC), th->description.data());
        Edit_SetText(GetDlgItem(hDlg, IDC_ANCHOR_URL), th->URL.data());
        Edit_SetText(GetDlgItem(hDlg, IDC_PARAMETER), th->parameter.data());

        if (pickMode)
            SetPickMode(th);

        return TRUE;

    case WM_DESTROY:

        if (pickMode)
            SetPickMode(th);
        //th->iObjParams->ClearPickMode();
        //th->previousMode = NULL;
        ReleaseICustButton(th->ParentPickButton);
        return FALSE;

    case WM_MOUSEACTIVATE:
        return FALSE;

    case WM_LBUTTONDOWN:
    case WM_LBUTTONUP:
    case WM_MOUSEMOVE:
        return FALSE;

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_BOOKMARKS:
        {
            // do bookmarks
            TSTR url, cam, desc;
            if (GetBookmarkURL(th->iObjParams, &url, &cam, &desc))
            {
                // get the new URL information;
                Edit_SetText(GetDlgItem(hDlg, IDC_ANCHOR_URL), url.data());
                Edit_SetText(GetDlgItem(hDlg, IDC_DESC), desc.data());
            }
        }
        break;
        case IDC_CAMERA:
            if (HIWORD(wParam) == CBN_SELCHANGE)
            {
                cb = GetDlgItem(hDlg, IDC_CAMERA);
                int sel = ComboBox_GetCurSel(cb);
                INode *rtarg;
                rtarg = (INode *)ComboBox_GetItemData(cb, sel);
                th->ReplaceReference(2, rtarg);
            }
            break;
        case IDC_HYPERLINK:
            th->isJump = IsDlgButtonChecked(hDlg, IDC_HYPERLINK);
            EnableWindow(GetDlgItem(hDlg, IDC_ANCHOR_URL), th->isJump);
            EnableWindow(GetDlgItem(hDlg, IDC_PARAMETER), th->isJump);
            EnableWindow(GetDlgItem(hDlg, IDC_BOOKMARKS), th->isJump);
            EnableWindow(GetDlgItem(hDlg, IDC_CAMERA), !th->isJump);
            break;
        case IDC_SET_CAMERA:
            th->isJump = !IsDlgButtonChecked(hDlg, IDC_SET_CAMERA);
            EnableWindow(GetDlgItem(hDlg, IDC_ANCHOR_URL), th->isJump);
            EnableWindow(GetDlgItem(hDlg, IDC_PARAMETER), th->isJump);
            EnableWindow(GetDlgItem(hDlg, IDC_BOOKMARKS), th->isJump);
            EnableWindow(GetDlgItem(hDlg, IDC_CAMERA), !th->isJump);
            break;
        case IDC_PICK_PARENT: // Pick an object from the scene
            // Set the pickmode...
            switch (HIWORD(wParam))
            {
            case BN_BUTTONDOWN:
                SetPickMode(th);
                /*
                if (th->previousMode) {
                    // reset the command mode
                    th->iObjParams->SetCommandMode(th->previousMode);
                    th->previousMode = NULL;
                } else {
                    th->previousMode = th->iObjParams->GetCommandMode();
                    theParentPick.SetAnchor(th);
                    th->iObjParams->SetPickMode(&theParentPick);
                }
                */
                break;
            }
            return TRUE;
        case IDC_ANCHOR_URL:
            switch (HIWORD(wParam))
            {
            case EN_SETFOCUS:
                DisableAccelerators();
                break;
            case EN_KILLFOCUS:
                EnableAccelerators();
                break;
            case EN_CHANGE:
                Edit_GetText(GetDlgItem(hDlg, IDC_ANCHOR_URL),
                             text, MAX_PATH);
                th->URL = text;
            }
            break;
        case IDC_DESC:
            switch (HIWORD(wParam))
            {
            case EN_SETFOCUS:
                DisableAccelerators();
                break;
            case EN_KILLFOCUS:
                EnableAccelerators();
                break;
            case EN_CHANGE:
                Edit_GetText(GetDlgItem(hDlg, IDC_DESC),
                             text, MAX_PATH);
                th->description = text;
            }
            break;
        case IDC_PARAMETER:
            switch (HIWORD(wParam))
            {
            case EN_SETFOCUS:
                DisableAccelerators();
                break;
            case EN_KILLFOCUS:
                EnableAccelerators();
                break;
            case EN_CHANGE:
                Edit_GetText(GetDlgItem(hDlg, IDC_PARAMETER),
                             text, MAX_PATH);
                th->parameter = text;
            }
            break;
        default:
            return FALSE;
        }
    }
    return FALSE;
}
Example #4
0
static INT_PTR CALLBACK
APITestDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	APITestUtil *pUtil = (APITestUtil*) GetWindowLongPtr(hWnd, GWLP_USERDATA);
	switch (msg) {
	case WM_INITDIALOG:
        pUtil = (APITestUtil*) lParam;
        SetWindowLongPtr(hWnd, GWLP_USERDATA, lParam);
		CheckDlgButton(hWnd, IDC_RELATIONAL, pUtil->mRelational);
		CheckDlgButton(hWnd, IDC_AS_CURVE, pUtil->mAsCurve);
		CheckDlgButton(hWnd, IDC_FILE, pUtil->mToFile);
		SetDlgItemText(hWnd, IDC_FILENAME, pUtil->mFilename); 
		break;
	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_RUN_TEST:
			pUtil->CombinedTests();
			break;

		case IDC_POINT_TEST:
			pUtil->PointTests();
			break;
		case IDC_CURVE_TEST:
			pUtil->CurveTests();
			break;
		case IDC_SURF_TEST:
			pUtil->SurfaceTests();
			break;
		case IDC_COS_TEST:
			pUtil->COSTests();
			break;

		case IDC_DUMP:
			pUtil->DumpSelected();
			break;

		case IDC_AS_CURVE:
			pUtil->mAsCurve = IsDlgButtonChecked(hWnd, IDC_AS_CURVE);
			break;

		case IDC_RELATIONAL:
			pUtil->mRelational = IsDlgButtonChecked(hWnd, IDC_RELATIONAL);
			break;
		case IDC_FILE:
			pUtil->mToFile = IsDlgButtonChecked(hWnd, IDC_FILE);
			break;
		case IDC_FILENAME:
			switch(HIWORD(wParam)) {
			case EN_SETFOCUS:
				DisableAccelerators();					
				break;
			case EN_KILLFOCUS:
				EnableAccelerators();
				break;
			}
			GetDlgItemText(hWnd, IDC_FILENAME, pUtil->mFilename, 255); 
			break;
		}
		break;
	case WM_DESTROY:
		break;
	case WM_LBUTTONDOWN:
	case WM_LBUTTONUP:
	case WM_MOUSEMOVE:
		pUtil->mpIp->RollupMouseMessage(hWnd,msg,wParam,lParam); 
		break;

	default:
		return FALSE;
	}
	return TRUE;
}
Example #5
0
unsigned __stdcall  CallRelaxThread(void *data)
{
	MaxSDK::Util::UseLanguagePackLocale();

	RelaxThreadData *threadData = (RelaxThreadData *) data;

	threadData->mLocalData.SetCount( threadData->mod->GetMeshTopoDataCount());
	for (int i = 0; i <  threadData->mod->GetMeshTopoDataCount(); i++)
		threadData->mLocalData[i] =  threadData->mod->GetMeshTopoData(i);

	threadData->mStarted = TRUE;

	DisableAccelerators();  



	BOOL rigSelected = FALSE;
	MeshTopoData *peltLD = threadData->mod->peltData.mBaseMeshTopoDataCurrent;
	if (threadData->mod->peltData.peltDialog.hWnd)
	{		
		if (peltLD)
		{
			for (int i = 0; i < threadData->mod->peltData.rigPoints.Count(); i++)
			{
				int index = threadData->mod->peltData.rigPoints[i].lookupIndex;
				if (peltLD->GetTVVertSelected(index))
					rigSelected = TRUE;
			}
		}
	}

	GetCOREInterface()->DisableSceneRedraw();
	//if we are not instanced we can just start up unwrap relax and go
	if ((threadData->mod->GetMeshTopoDataCount() == 1) && !rigSelected)
	{
		if (threadData->mType == 0)
			threadData->mod->fnRelaxByFaceAngle(threadData->mIterations,threadData->mStretch,threadData->mAmount,threadData->mBoundary,NULL);
		else if (threadData->mType == 1)
			threadData->mod->fnRelaxByEdgeAngle(threadData->mIterations,threadData->mStretch,threadData->mAmount,threadData->mBoundary,NULL);
		else if (threadData->mType == 2)
			threadData->mod->RelaxVerts2(threadData->mAmount,threadData->mIterations,threadData->mBoundary,threadData->mCorner,FALSE);
	}
	//if we have multiple instance it gets more complicated
	//since only the first relax instance will ever run
	else
	{
		BOOL done = FALSE;
		threadData->mIterations = 5;
		for (int ldID = 0; ldID < threadData->mLocalData.Count(); ldID++)
		{
			threadData->mLocalData[ldID]->SetUserCancel(FALSE);
		}
		while(!done)
		{
			for (int ldID = 0; ldID < threadData->mLocalData.Count(); ldID++)
			{
				if (threadData->mLocalData[ldID]->GetUserCancel())
					done = TRUE;
			}
			if (threadData->mType == 0)
				threadData->mod->fnRelaxByFaceAngle(threadData->mIterations,threadData->mStretch,threadData->mAmount,threadData->mBoundary,NULL);
			else if (threadData->mType == 1)
				threadData->mod->fnRelaxByEdgeAngle(threadData->mIterations,threadData->mStretch,threadData->mAmount,threadData->mBoundary,NULL);
			else if (threadData->mType == 2)
				threadData->mod->RelaxVerts2(threadData->mAmount,threadData->mIterations,threadData->mBoundary,threadData->mCorner,FALSE);

			if (rigSelected)
				threadData->mod->peltData.RelaxRig(threadData->mIterations,threadData->mAmount,threadData->mBoundary,threadData->mod);
		}
	}



	for (int ldID = 0; ldID < threadData->mod->GetMeshTopoDataCount(); ldID++)
	{
		threadData->mod->GetMeshTopoData(ldID)->SetUserCancel(FALSE);
	}


	GetCOREInterface()->EnableSceneRedraw();
	EnableAccelerators();   
	threadData->mStarted = FALSE;

	ICustButton *iButton = GetICustButton(GetDlgItem(threadData->mod->relaxHWND, IDC_RUN_BUTTON));
	if (iButton)
	{
		if (iButton->IsChecked())
		{
			iButton->SetText(GetString(IDS_SPLINEMAP_STARTRELAX));
			iButton->SetCheck(FALSE);
		}
		ReleaseICustButton(iButton);
	}

	_endthreadex(0);


	return 0;
}
Example #6
0
BOOL CALLBACK
    RollupDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam,
                     Cal3DObject *th)
{
    if (!th && message != WM_INITDIALOG)
        return FALSE;

    switch (message)
    {
    case WM_INITDIALOG:
    {
        TimeValue t = 0;

        SendMessage(GetDlgItem(hDlg, IDC_CAL_CFG_URL), WM_SETTEXT, 0, (LPARAM)th->cal3d_cfg.data());
        EnableWindow(GetDlgItem(hDlg, IDC_CAL_CFG_URL), TRUE);

        th->hRollup = hDlg;

        if (pickMode)
            SetPickMode(th);

        return TRUE;
    }
    case WM_DESTROY:
        if (pickMode)
            SetPickMode(th);
        // th->iObjParams->ClearPickMode();
        // th->previousMode = NULL;
        RELEASE_SPIN(animationIDSpin);
        RELEASE_SPIN(actionIDSpin);

        RELEASE_BUT(Cal3DPickButton);
        return FALSE;

    case CC_SPINNER_BUTTONDOWN:
    {
        int id = LOWORD(wParam);
        switch (id)
        {
        case IDC_ANIMATION_SPIN:
        case IDC_ACTION_SPIN2:
            theHold.Begin();
            return TRUE;
        default:
            return FALSE;
        }
    }
    break;

    case CC_SPINNER_BUTTONUP:
    {
        if (!HIWORD(wParam))
        {
            theHold.Cancel();
            break;
        }
        int id = LOWORD(wParam);
        switch (id)
        {
        case IDC_ANIMATION_SPIN:
        case IDC_ACTION_SPIN2:

            if (th->getCoreHelper())
                th->getCoreHelper()->setState(th->animationIDSpin->GetIVal(), 0.0);
            theHold.Accept(GetString(IDS_DS_PARAMCHG));
            return TRUE;
        default:
            return FALSE;
        }
    }

    case CC_SPINNER_CHANGE:
    {
        int animID;
        int id = LOWORD(wParam);
        TimeValue t = 0; // not really needed...yet

        switch (id)
        {
        case IDC_ANIMATION_SPIN:
        case IDC_ACTION_SPIN2:
            if (!HIWORD(wParam))
                theHold.Begin();

            //actionID = th->actionIDSpin->GetIVal();

            //th->animationIDSpin->SetValue(animID, FALSE);
            //th->actionIDSpin->SetValue(actionID, FALSE);
            animID = th->animationIDSpin->GetIVal();
            if (th->getCoreHelper())
                th->getCoreHelper()->setState(animID, 0.0);

            if (!HIWORD(wParam))
                theHold.Accept(GetString(IDS_DS_PARAMCHG));
            return TRUE;
        default:
            return FALSE;
        }
    }

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_CAL_CFG_URL:
            switch (HIWORD(wParam))
            {
            case EN_SETFOCUS:
                DisableAccelerators();
                break;
            case EN_KILLFOCUS:
                EnableAccelerators();
                break;
            case EN_CHANGE:
                int len = (int)SendDlgItemMessage(hDlg, IDC_CAL_CFG_URL, WM_GETTEXTLENGTH, 0, 0);
                TSTR temp;
                temp.Resize(len + 1);
                SendDlgItemMessage(hDlg, IDC_CAL_CFG_URL, WM_GETTEXT, len + 1, (LPARAM)temp.data());

#if MAX_PRODUCT_VERSION_MAJOR > 14
                th->setURL(temp.ToUTF8().data());
#else
                th->setURL((char *)temp);
#endif
                break;
            }
            break;
        }
        return FALSE;
    default:
        return FALSE;
    }

    return FALSE;
}