INT_PTR EditPolyPaintDeformDlgProc::DlgProc (TimeValue t, IParamMap2 *pmap, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { //BOOL ret; switch (msg) { case WM_INITDIALOG: { uiValid = false; ICustButton *btn = GetICustButton(GetDlgItem(hWnd,IDC_PAINTDEFORM_PUSHPULL)); btn->SetType(CBT_CHECK); ReleaseICustButton(btn); btn = GetICustButton(GetDlgItem(hWnd,IDC_PAINTDEFORM_RELAX)); btn->SetType(CBT_CHECK); ReleaseICustButton(btn); btn = GetICustButton(GetDlgItem(hWnd,IDC_PAINTDEFORM_REVERT)); btn->SetType(CBT_CHECK); ReleaseICustButton(btn); break; } case WM_PAINT: if (uiValid) break; SetEnables (hWnd); break; case WM_COMMAND: //uiValid = false; switch (LOWORD(wParam)) { case IDC_PAINTDEFORM_PUSHPULL: mpEPoly->OnPaintBtn( PAINTMODE_PAINTPUSHPULL, t ); SetEnables (hWnd); break; case IDC_PAINTDEFORM_RELAX: mpEPoly->OnPaintBtn( PAINTMODE_PAINTRELAX, t ); SetEnables (hWnd); break; case IDC_PAINTDEFORM_REVERT: mpEPoly->OnPaintBtn( PAINTMODE_ERASEDEFORM, t ); SetEnables (hWnd); break; case IDC_PAINTDEFORM_APPLY: theHold.Begin (); mpEPoly->EpModCommit (t, false, true); theHold.Accept (GetString (IDS_PAINTDEFORM)); break; case IDC_PAINTDEFORM_CANCEL: mpEPoly->EpModCancel (); break; case IDC_PAINTDEFORM_OPTIONS: GetMeshPaintMgr()->BringUpOptions(); break; default: InvalidateUI (hWnd); break; } } return FALSE; }
void SetupPadLockButton(HWND hWnd,int id, BOOL check) { ICustButton *iBut; iBut = GetICustButton(GetDlgItem(hWnd,id)); iBut->SetImage(hLockButtons,2,2,2,2,16,15); iBut->SetType(CBT_CHECK); ReleaseICustButton(iBut); }
void CppOut::Init(HWND hWnd) { iPick = GetICustButton(GetDlgItem(hWnd,IDC_CPPOUT_PICK)); iPick->SetType(CBT_CHECK); iPick->SetHighlightColor(GREEN_WASH); }
BOOL SWrapObjectDlgProc::DlgProc( TimeValue t,IParamMap *map,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) {int FToTick=(int)((float)TIME_TICKSPERSEC/(float)GetFrameRate()); switch (msg) { case WM_INITDIALOG: { ICustButton *iBut = GetICustButton(GetDlgItem(hWnd,IDC_AP_WRAPBUTTON)); iBut->SetType(CBT_CHECK); iBut->SetHighlightColor(GREEN_WASH); ReleaseICustButton(iBut); po->hParams=hWnd; Update(t); return FALSE; // stop default keyboard focus - DB 2/27 } case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_AP_WRAPBUTTON: { if (po->ip->GetCommandMode()->ID() == CID_STDPICK) { if (po->creating) { theCreateSWrapObjectMode.JumpStart(po->ip,po); po->ip->SetCommandMode(&theCreateSWrapObjectMode); } else {po->ip->SetStdCommandMode(CID_OBJMOVE);} } else { po->pickCB.po = po; po->ip->SetPickMode(&po->pickCB); } break; } } break; } return TRUE; }
void RendSplineParamsMapDlgProc::Initialize(HWND hWnd, TimeValue t) { if (hWnd == NULL) return; else { ISpinnerControl *iSpin = GetISpinner(GetDlgItem(hWnd, IDC_ASPECTSPIN)); iSpin->LinkToEdit(GetDlgItem(hWnd, IDC_ASPECT), EDITTYPE_FLOAT); iSpin->SetLimits(0.0f,99999999.0f); iSpin->SetAutoScale(TRUE); ReleaseISpinner(iSpin); if (RendSpline::hLockButton == NULL) { HBITMAP hBitmap, hMask; RendSpline::hLockButton = ImageList_Create(16, 15, TRUE, 2, 0); hBitmap = LoadBitmap(RendSplineDesc.HInstance(), MAKEINTRESOURCE(IDB_LOCK)); hMask = LoadBitmap(RendSplineDesc.HInstance(), MAKEINTRESOURCE(IDB_LOCKMASK)); ImageList_Add(RendSpline::hLockButton,hBitmap,hMask); DeleteObject(hBitmap); DeleteObject(hMask); } ICustButton *lockAspect = GetICustButton(GetDlgItem(hWnd,IDC_ASPECTLOCK)); lockAspect->SetImage(RendSpline::hLockButton,0,0,1,1,16,15); lockAspect->SetType(CBT_CHECK); ReleaseICustButton(lockAspect); CheckRadioButton(hWnd, IDC_VIEWPORT, IDC_RENDERER, IDC_RENDERER); BOOL usePhysUVs = mod->GetUsePhysicalScaleUVs(); CheckDlgButton(hWnd, IDC_REAL_WORLD_MAP_SIZE, usePhysUVs); } }
INT_PTR MonoFlectorTypeObjDlgProc::DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { int id = LOWORD(wParam); switch (msg) { case WM_INITDIALOG: { ICustButton *iBut = GetICustButton(GetDlgItem(hWnd,IDC_EP_PICKBUTTON)); iBut->SetType(CBT_CHECK); iBut->SetHighlightColor(GREEN_WASH); ReleaseICustButton(iBut); mf->hParams=hWnd; mf->ShowName(mf->pblock2->GetINode(PB_MESHNODE)); } break; case WM_DESTROY: ICustButton *iBut; iBut=GetICustButton(GetDlgItem(hWnd,IDC_EP_PICKBUTTON)); if (iBut) iBut->SetCheck(FALSE); ReleaseICustButton(iBut); break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_EP_PICKBUTTON: { sso->IntoPickMode(); break; } } break; } return TRUE; }
void BlobMesh::DisableButtons(HWND hWnd) { if (GetCOREInterface()->GetCommandPanelTaskMode() == TASK_MODE_CREATE) { ICustButton *iBut = GetICustButton(GetDlgItem(hWnd, IDC_ADD)); if (iBut) { iBut->Enable(FALSE); ReleaseICustButton(iBut); } iBut = NULL; iBut = GetICustButton(GetDlgItem(hWnd, IDC_PICK)); if (iBut) { iBut->Enable(FALSE); ReleaseICustButton(iBut); } iBut = NULL; iBut = GetICustButton(GetDlgItem(hWnd, IDC_REMOVE)); if (iBut) { iBut->Enable(FALSE); ReleaseICustButton(iBut); } } else { ICustButton *iBut = GetICustButton(GetDlgItem(hWnd, IDC_ADD)); if (iBut) { iBut->Enable(TRUE); iBut->SetHighlightColor(GREEN_WASH); ReleaseICustButton(iBut); } iBut = NULL; iBut = GetICustButton(GetDlgItem(hWnd, IDC_PICK)); if (iBut) { iBut->Enable(TRUE); iBut->SetType(CBT_CHECK); iBut->SetHighlightColor(GREEN_WASH); ReleaseICustButton(iBut); } } }
void BlobMesh::fnPickMode() { thePickMode.hWnd = paramsHWND; PickNodesMode(); ICustButton *iBut = GetICustButton(GetDlgItem(paramsHWND, IDC_PICK)); if (iBut) { iBut->SetType(CBT_CHECK); iBut->SetCheck( inPickMode); ReleaseICustButton(iBut); } }
static INT_PTR CALLBACK MorphParamDlgProc1( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { MorphObject *mo = DLGetWindowLongPtr<MorphObject*>(hWnd); if (!mo && message!=WM_INITDIALOG) return FALSE; switch (message) { case WM_INITDIALOG: { mo = (MorphObject*)lParam; DLSetWindowLongPtr(hWnd, lParam); mo->hParams1 = hWnd; ICustButton *iBut = GetICustButton(GetDlgItem(hWnd,IDC_PICK_MORPHTARG)); iBut->SetType(CBT_CHECK); iBut->SetHighlightColor(GREEN_WASH); ReleaseICustButton(iBut); mo->SetTargMethod(mo->addTargMethod); break; } case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_PICK_MORPHTARG: if (mo->ip->GetCommandMode()->ID() == CID_STDPICK) { if (mo->creating) { theCreateMorphMode.JumpStart(mo->ip,mo); mo->ip->SetCommandMode(&theCreateMorphMode); } else { mo->ip->SetStdCommandMode(CID_OBJMOVE); } } else { mo->pickCB.mo = mo; mo->ip->SetPickMode(&mo->pickCB); } break; } break; case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_MOUSEMOVE: mo->ip->RollupMouseMessage(hWnd,message,wParam,lParam); return FALSE; default: return FALSE; } return TRUE; }
INT_PTR BlobMeshParamsDlgProc::DlgProc( TimeValue t,IParamMap2 *map, HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { switch (msg) { case WM_INITDIALOG: obj->paramsHWND = hWnd; obj->DisableButtons(hWnd); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_PICK: { thePickMode.hWnd = hWnd; obj->PickNodesMode(); ICustButton *iBut = GetICustButton(GetDlgItem(hWnd, IDC_PICK)); if (iBut) { iBut->SetType(CBT_CHECK); iBut->SetCheck( obj->inPickMode); ReleaseICustButton(iBut); } break; } case IDC_ADD: { obj->ip->DoHitByNameDialog(new DumpHitDialog(obj)); break; } // case IDC_REMOVE: // { // obj->RemoveSelectedNode(); // } } break; } return FALSE; }
INT_PTR SmoothDlgProc::DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: #ifndef USE_SIMPLIFIED_SMOOTH_MODIFIER_UI { for (int i=IDC_SMOOTH_GRP1; i<IDC_SMOOTH_GRP1+32; i++) { ICustButton *iBut = GetICustButton(GetDlgItem(hWnd,i)); iBut->SetType (CBT_CHECK); ReleaseICustButton (iBut); } } #endif uiValid = false; break; case WM_PAINT: if (uiValid) break; Update (hWnd, t); break; case WM_COMMAND: if (LOWORD(wParam)>=IDC_SMOOTH_GRP1 && LOWORD(wParam)<=IDC_SMOOTH_GRP32) { IParamBlock2 *pblock = (IParamBlock2*)map->GetParamBlock(); ICustButton *iBut = GetICustButton(GetDlgItem(hWnd,LOWORD(wParam))); int bits; pblock->GetValue (sm_smoothbits, t, bits, FOREVER); int shift = LOWORD(wParam) - IDC_SMOOTH_GRP1; if (iBut->IsChecked()) bits |= 1<<shift; else bits &= ~(1<<shift); theHold.Begin (); pblock->SetValue (sm_smoothbits, t, bits); theHold.Accept (GetString (IDS_VS_SMGROUP)); ReleaseICustButton(iBut); return REDRAW_VIEWS; } 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; }
INT_PTR ParticleMesherParamsMapDlgProc::DlgProc( TimeValue t,IParamMap2 *map,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { mod->hParams = hWnd; ICustButton *iBut = GetICustButton(GetDlgItem(hWnd,IDC_PICKBB)); iBut->SetType(CBT_CHECK); iBut->SetHighlightColor(GREEN_WASH); if (mod->ip) { if (mod->ip->GetCommandPanelTaskMode() == TASK_MODE_CREATE) { iBut->Enable(FALSE); } } ReleaseICustButton(iBut); mod->UpdateUI(); break; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDC_ADDPF_EVENT_BUTTON: mod->PickPFEvents(hWnd); break; case IDC_BBOX: { mod->UpdateUI(); break; } case IDC_UPDATE: { mod->lastTime = -999999; mod->ivalid.SetEmpty(); mod->NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE); break; } case IDC_PICKBB: { if (mod->ip->GetCommandMode() == (CommandMode *) &thePickMode) { mod->ip->SetStdCommandMode(CID_OBJMOVE); } else { thePickMode.mod = mod; mod->ip->SetPickMode(&thePickMode); } } } break; } } return FALSE; }
INT_PTR CALLBACK UnwrapUnfoldMapFloaterDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { UnwrapMod *mod = DLGetWindowLongPtr<UnwrapMod*>(hWnd); static ISpinnerControl *spinThreshold = NULL; static int bottomHeight = 0; switch (msg) { case WM_INITDIALOG: { mod = (UnwrapMod*)lParam; mod->fnRegularMapSetHWND(hWnd); DLSetWindowLongPtr(hWnd, lParam); ::SetWindowContextHelpId(hWnd, idh_unwrap_peltmap); SendMessage(hWnd, WM_SETICON, ICON_SMALL, GetClassLongPtr(mod->ip->GetMAXHWnd(), GCLP_HICONSM)); // mjm - 3.12.99 HWND hMethod = GetDlgItem(hWnd,IDC_LIMIT_COMBO); SendMessage(hMethod, CB_RESETCONTENT, 0, 0); SendMessage(hMethod, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR) GetString(IDS_LIMIT_FULL)); SendMessage(hMethod, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR) GetString(IDS_LIMIT_PARTIAL)); SendMessage(hMethod, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR) GetString(IDS_LIMIT_ALWAYS)); HWND hAutoFit = GetDlgItem(hWnd,IDC_AUTOFIT_COMBO); SendMessage(hAutoFit, CB_RESETCONTENT, 0, 0); SendMessage(hAutoFit, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR) GetString(IDS_AUTOFIT_NONE)); SendMessage(hAutoFit, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR) GetString(IDS_AUTOFIT_LAST)); SendMessage(hAutoFit, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR) GetString(IDS_AUTOFIT_ALL)); spinThreshold = SetupFloatSpinner( hWnd,IDC_UNWRAP_AUTOWELD_THRESHOLD_SPIN,IDC_UNWRAP_AUTOWELD_THRESHOLD, 0.0f,1.0f,mod->fnRegularMapGetAutoWeldThreshold()); ICustButton *iButton = GetICustButton(GetDlgItem(hWnd, IDC_UNWRAP_STARTNEWCLUSTER)); if (iButton) { iButton->SetType(CBT_CHECK); ReleaseICustButton(iButton); } mod->fnRegularMapSetPickStartFace(TRUE); mod->fnRegularMapUpdateUI(); break; } case WM_SYSCOMMAND: if ((wParam & 0xfff0) == SC_CONTEXTHELP) { MaxSDK::IHelpSystem::GetInstance()->ShowProductHelpForTopic(idh_unwrap_peltmap); } return FALSE; break; case CC_SPINNER_CHANGE: { mod->fnRegularMapSetAutoWeldThreshold(spinThreshold->GetFVal()); TSTR mstr = _T("$.modifiers[#unwrap_uvw].unwrap6.RegularMapSetAutoWeldThreshold"); macroRecorder->FunctionCall(mstr, 1, 0,mr_float,mod->fnRegularMapGetAutoWeldThreshold()); macroRecorder->EmitScript(); break; } case WM_DESTROY: mod->fnRegularMapSetHWND(NULL); mod->fnRegularMapEnd(); ReleaseISpinner(spinThreshold); spinThreshold = NULL; break; case WM_CLOSE: { EndDialog(hWnd,1); break; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_UNWRAP_STARTNEWCLUSTER: { ICustButton *iButton = GetICustButton(GetDlgItem(hWnd, IDC_UNWRAP_STARTNEWCLUSTER)); if (iButton) { if (mod->fnRegularMapGetPickStartFace()) { iButton->SetCheck(FALSE); mod->fnRegularMapSetPickStartFace(FALSE); } else { iButton->SetCheck(TRUE); mod->fnRegularMapSetPickStartFace(TRUE); } ReleaseICustButton(iButton); } break; } case IDC_LIMIT_COMBO: { if (HIWORD(wParam)== CBN_SELCHANGE) { HWND hMethod = GetDlgItem(hWnd,IDC_LIMIT_COMBO); int limit = SendMessage(hMethod, CB_GETCURSEL, 0L, 0); TSTR mstr = _T("$.modifiers[#unwrap_uvw].unwrap6.RegularMapSetLimit"); macroRecorder->FunctionCall(mstr, 1, 0,mr_int,limit); macroRecorder->EmitScript(); if (limit == 0) mod->fnRegularMapSetLimit(kRegular); else if (limit == 1) mod->fnRegularMapSetLimit(kPartial); else if (limit == 2) mod->fnRegularMapSetLimit(kAbnormal); } break; } case IDC_AUTOFIT_COMBO: { if (HIWORD(wParam)== CBN_SELCHANGE) { HWND hAutofit = GetDlgItem(hWnd,IDC_AUTOFIT_COMBO); int autofit = SendMessage(hAutofit, CB_GETCURSEL, 0L, 0); TSTR mstr = _T("$.modifiers[#unwrap_uvw].unwrap6.RegularMapSetAutoFit"); macroRecorder->FunctionCall(mstr, 1, 0,mr_int,autofit); macroRecorder->EmitScript(); mod->fnRegularMapSetAutoFit(autofit); } break; } case IDC_AUTOWELD_CHECK: { BOOL value = GetCheckBox(hWnd,IDC_AUTOWELD_CHECK); TSTR mstr = _T("$.modifiers[#unwrap_uvw].unwrap6.RegularMapSetAutoWeld"); macroRecorder->FunctionCall(mstr, 1, 0,mr_bool,value); macroRecorder->EmitScript(); mod->fnRegularMapSetAutoWeld(value); break; } case IDC_SINGLESTEP_CHECK: { BOOL value = GetCheckBox(hWnd,IDC_SINGLESTEP_CHECK); TSTR mstr = _T("$.modifiers[#unwrap_uvw].unwrap6.RegularMapSetSingleStep"); macroRecorder->FunctionCall(mstr, 1, 0,mr_bool,value); macroRecorder->EmitScript(); mod->fnRegularMapSetSingleStep(value); break; } case IDC_NORMALIZE_CHECK: { BOOL value = GetCheckBox(hWnd,IDC_NORMALIZE_CHECK); TSTR mstr = _T("$.modifiers[#unwrap_uvw].unwrap6.RegularMapSetNormalize"); macroRecorder->FunctionCall(mstr, 1, 0,mr_bool,value); macroRecorder->EmitScript(); mod->fnRegularMapSetNormalize(value); break; } case IDC_RESETFACES: { TSTR mstr = _T("$.modifiers[#unwrap_uvw].unwrap6.RegularMapResetFaces"); macroRecorder->FunctionCall(mstr, 0, 0); macroRecorder->EmitScript(); mod->fnRegularMapResetFaces(); break; } case IDC_ADVANCESELECTED: { TSTR mstr = _T("$.modifiers[#unwrap_uvw].unwrap6.RegularMapAdvanceSelected"); macroRecorder->FunctionCall(mstr, 1, 0,mr_bool,mod->fnRegularMapGetSingleStep()); macroRecorder->EmitScript(); mod->fnRegularMapAdvanceSelected(mod->fnRegularMapGetSingleStep()); mod->fnRegularMapFitView(); break; } case IDC_ADVANCEU: { TSTR mstr = _T("$.modifiers[#unwrap_uvw].unwrap6.RegularMapAdvanceUV"); macroRecorder->FunctionCall(mstr, 5, 0, mr_bool,true, mr_bool,false, mr_bool,true, mr_bool,false, mr_bool,mod->fnRegularMapGetSingleStep()); macroRecorder->EmitScript(); mod->fnRegularMapAdvanceUV(true,false,true,false,mod->fnRegularMapGetSingleStep()); mod->fnRegularMapFitView(); break; } case IDC_ADVANCEV: { TSTR mstr = _T("$.modifiers[#unwrap_uvw].unwrap6.RegularMapAdvanceUV"); macroRecorder->FunctionCall(mstr, 5, 0, mr_bool,false, mr_bool,true, mr_bool,false, mr_bool,true, mr_bool,mod->fnRegularMapGetSingleStep()); mod->fnRegularMapAdvanceUV(false,true,false,true,mod->fnRegularMapGetSingleStep()); mod->fnRegularMapFitView(); break; } case IDC_COMMIT: { mod->fnRegularMapEnd(); mod->fnSetMapMode(UNFOLDMAP); break; } } default: return FALSE; } return TRUE; }
INT_PTR CALLBACK UnwrapRelaxFloaterDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { UnwrapMod *mod = DLGetWindowLongPtr<UnwrapMod*>(hWnd); //POINTS p = MAKEPOINTS(lParam); commented out by sca 10/7/98 -- causing warning since unused. static ISpinnerControl *iAmount = NULL; static ISpinnerControl *iIterations = NULL; static ISpinnerControl *iStretch = NULL; static BOOL bBoundary = TRUE; static BOOL bCorner = FALSE; static float amount = 1.0f; static int iterations = 1; switch (msg) { case WM_INITDIALOG: { mod = (UnwrapMod*)lParam; mod->relaxHWND = hWnd; DLSetWindowLongPtr(hWnd, lParam); ::SetWindowContextHelpId(hWnd, idh_unwrap_relax); ICustButton *iButton = GetICustButton(GetDlgItem(hWnd, IDC_RUN_BUTTON)); if (iButton) { iButton->SetType(CBT_CHECK); iButton->SetCheck(FALSE); iButton->SetHighlightColor(GREEN_WASH); ReleaseICustButton(iButton); } //create relax amount spinner and set value iAmount = SetupFloatSpinner( hWnd,IDC_RELAX_AMOUNTSPIN,IDC_RELAX_AMOUNT, 0.0f,1.0f,mod->relaxAmount); iAmount->SetScale(0.01f); amount = mod->relaxAmount; iIterations = SetupIntSpinner( hWnd,IDC_RELAX_ITERATIONSSPIN,IDC_RELAX_ITERATIONS, 0,100000,mod->relaxIteration); iIterations->SetScale(1.f); iterations = mod->relaxIteration; iStretch = SetupFloatSpinner( hWnd,IDC_RELAX_STRETCHSPIN,IDC_RELAX_STRETCH, 0.0f,1.0f,mod->relaxStretch); iStretch->SetScale(0.001f); HWND hType = GetDlgItem(hWnd,IDC_RELAXTYPE_COMBO); SendMessage(hType, CB_RESETCONTENT, 0, 0); SendMessage(hType, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR) GetString(IDS_PW_RELAX_FACE)); SendMessage(hType, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR) GetString(IDS_PW_RELAX_EDGE)); SendMessage(hType, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR) GetString(IDS_PW_RELAX_CENTERS)); SendMessage(hType, CB_SETCURSEL, (mod->relaxType), 0L); //set align cluster bBoundary = mod->relaxBoundary; bCorner = mod->relaxSaddle; CheckDlgButton(hWnd,IDC_BOUNDARY_CHECK,bBoundary); CheckDlgButton(hWnd,IDC_CORNERS_CHECK,bCorner); //restore window pos mod->SetRelaxDialogPos(); //start the hold begin if (mod->relaxType == 2) { iStretch->Enable(FALSE); HWND hCheck = GetDlgItem(hWnd,IDC_BOUNDARY_CHECK); EnableWindow(hCheck,TRUE); hCheck = GetDlgItem(hWnd,IDC_CORNERS_CHECK); EnableWindow(hCheck,TRUE); } else { iStretch->Enable(TRUE); HWND hCheck = GetDlgItem(hWnd,IDC_BOUNDARY_CHECK); EnableWindow(hCheck,TRUE); hCheck = GetDlgItem(hWnd,IDC_CORNERS_CHECK); EnableWindow(hCheck,FALSE); } break; } case WM_SYSCOMMAND: if ((wParam & 0xfff0) == SC_CONTEXTHELP) { MaxSDK::IHelpSystem::GetInstance()->ShowProductHelpForTopic(idh_unwrap_relax); } return FALSE; break; case CC_SPINNER_BUTTONDOWN: if (LOWORD(wParam) == IDC_UNWRAP_BIASSPIN) { } break; case WM_CUSTEDIT_ENTER: case CC_SPINNER_BUTTONUP: mod->RelaxThreadOp(UnwrapMod::KThreadReStart,hWnd); break; case WM_CLOSE: mod->RelaxThreadOp(UnwrapMod::KThreadEnd,hWnd); if (iAmount) ReleaseISpinner(iAmount); if (iIterations) ReleaseISpinner(iIterations); if (iStretch) ReleaseISpinner(iStretch); iAmount = NULL; iIterations = NULL; iStretch = NULL; mod->hRelaxDialog = NULL; EndDialog(hWnd,0); break; case WM_ACTIVATE: mod->RelaxThreadOp(UnwrapMod::KThreadEnd,hWnd); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_BOUNDARY_CHECK: case IDC_CORNERS_CHECK: mod->RelaxThreadOp(UnwrapMod::KThreadReStart,hWnd); break; case IDC_RUN_BUTTON: { ICustButton *iButton = GetICustButton(GetDlgItem(hWnd, IDC_RUN_BUTTON)); if (iButton && iButton->IsChecked()) { theHold.Begin(); mod->HoldPoints(); theHold.Accept(GetString(IDS_PW_RELAX)); mod->RelaxThreadOp(UnwrapMod::KThreadStart,hWnd); } else mod->RelaxThreadOp(UnwrapMod::KThreadEnd,hWnd); mod->InvalidateView(); TimeValue t = GetCOREInterface()->GetTime(); mod->NotifyDependents(FOREVER, PART_TEXMAP, REFMSG_CHANGE); GetCOREInterface()->RedrawViews(t); break; } break; case IDC_APPLY: { //make sure when end any existing threads mod->RelaxThreadOp(UnwrapMod::KThreadEnd,hWnd); theHold.Begin(); mod->HoldPoints(); theHold.Accept(GetString(IDS_PW_RELAX)); bBoundary = IsDlgButtonChecked(hWnd,IDC_BOUNDARY_CHECK); bCorner = IsDlgButtonChecked(hWnd,IDC_CORNERS_CHECK); amount = iAmount->GetFVal(); float stretch = iStretch->GetFVal(); iterations = iIterations->GetIVal(); HWND hType = GetDlgItem(hWnd,IDC_RELAXTYPE_COMBO); int type = SendMessage(hType, CB_GETCURSEL, 0L, 0); HWND hStatus = GetDlgItem(hWnd,IDC_STATUSTEXT); if (type == 0) mod->fnRelaxByFaceAngle(iterations,stretch,amount,bBoundary,hStatus); else if (type == 1) mod->fnRelaxByEdgeAngle(iterations,stretch,amount,bBoundary,hStatus); else if (type == 2) mod->RelaxVerts2(amount,iterations,bBoundary,bCorner); mod->InvalidateView(); TimeValue t = GetCOREInterface()->GetTime(); mod->NotifyDependents(FOREVER, PART_TEXMAP, REFMSG_CHANGE); GetCOREInterface()->RedrawViews(t); mod->relaxAmount = amount; mod->relaxIteration = iterations; mod->relaxStretch = stretch; mod->relaxType = type; mod->relaxBoundary = bBoundary; mod->relaxSaddle = bCorner; break; } case IDC_REVERT: { mod->RelaxThreadOp(UnwrapMod::KThreadEnd,hWnd); mod->hRelaxDialog = NULL; EndDialog(hWnd,0); break; } case IDC_RELAXTYPE_COMBO: if (HIWORD(wParam)== CBN_SELCHANGE) { mod->RelaxThreadOp(UnwrapMod::KThreadReStart,hWnd); HWND hType = GetDlgItem(hWnd,IDC_RELAXTYPE_COMBO); int type = SendMessage(hType, CB_GETCURSEL, 0L, 0); if (type == 2) { iStretch->Enable(FALSE); HWND hCheck = GetDlgItem(hWnd,IDC_BOUNDARY_CHECK); EnableWindow(hCheck,TRUE); hCheck = GetDlgItem(hWnd,IDC_CORNERS_CHECK); EnableWindow(hCheck,TRUE); } else { iStretch->Enable(TRUE); HWND hCheck = GetDlgItem(hWnd,IDC_BOUNDARY_CHECK); EnableWindow(hCheck,TRUE); hCheck = GetDlgItem(hWnd,IDC_CORNERS_CHECK); EnableWindow(hCheck,FALSE); } } break; case IDC_DEFAULT: { mod->RelaxThreadOp(UnwrapMod::KThreadEnd,hWnd); //get bias amount = iAmount->GetFVal(); iterations = iIterations->GetIVal(); float stretch = iStretch->GetFVal(); HWND hType = GetDlgItem(hWnd,IDC_RELAXTYPE_COMBO); int type = SendMessage(hType, CB_GETCURSEL, 0L, 0); mod->relaxAmount = amount; mod->relaxIteration = iterations; mod->relaxStretch = stretch; mod->relaxType = type; //get align bCorner = IsDlgButtonChecked(hWnd,IDC_CORNERS_CHECK); bBoundary = IsDlgButtonChecked(hWnd,IDC_BOUNDARY_CHECK); mod->relaxBoundary = bBoundary; mod->relaxSaddle = bCorner; //set as defaults break; } } break; default: return FALSE; } return TRUE; }
INT_PTR CALLBACK ProtHelpParamDialogProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) { ICustButton *iBut = NULL; ProtHelpObject *ph = DLGetWindowLongPtr<ProtHelpObject *>( hDlg); if ( !ph && message != WM_INITDIALOG ) return FALSE; switch ( message ) { case WM_INITDIALOG: ph = (ProtHelpObject *)lParam; DLSetWindowLongPtr( hDlg, ph); SetDlgFont( hDlg, ph->iObjParams->GetAppHFont() ); iBut = GetICustButton(GetDlgItem(hDlg, IDC_PROT_PICK_TARGET1)); if( iBut != NULL) { iBut->SetType (CBT_CHECK); iBut->SetHighlightColor (GREEN_WASH); ReleaseICustButton(iBut); } iBut = GetICustButton(GetDlgItem(hDlg, IDC_PROT_PICK_TARGET2)); if( iBut != NULL) { iBut->SetType (CBT_CHECK); iBut->SetHighlightColor (GREEN_WASH); ReleaseICustButton(iBut); } return FALSE; case WM_DESTROY: return FALSE; case WM_MOUSEACTIVATE: ph->iObjParams->RealizeParamPanel(); return FALSE; case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_MOUSEMOVE: ph->iObjParams->RollupMouseMessage(hDlg,message,wParam,lParam); return FALSE; case WM_COMMAND: switch( LOWORD(wParam) ) { case IDC_PROT_PICK_TARGET1: case IDC_PROT_PICK_TARGET2: if(ph->created == FALSE) { iBut = GetICustButton(GetDlgItem(hDlg, IDC_PROT_PICK_TARGET1)); if(iBut != NULL) { iBut->SetCheck(FALSE); ReleaseICustButton(iBut); } iBut = GetICustButton(GetDlgItem(hDlg, IDC_PROT_PICK_TARGET2)); if(iBut != NULL) { iBut->SetCheck(FALSE); ReleaseICustButton(iBut); } break; } pickCB.ph = ph; pickCB.hDlg = hDlg; if(pickCB.doingPick) ph->iObjParams->SetCommandMode(pickCB.cm); else pickCB.cm = ph->iObjParams->GetCommandMode(); pickCB.which = ((LOWORD(wParam) - IDC_PROT_PICK_TARGET1) > 0); ph->iObjParams->SetPickMode (&pickCB); ph->UpdateUI(ph->iObjParams->GetTime()); ph->iObjParams->RedrawViews (ph->iObjParams->GetTime()); break; } return FALSE; default: return FALSE; } }
INT_PTR DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { OrientConstRotation* p = (OrientConstRotation*)map->GetParamBlock()->GetOwner(); UpdateOrientName(p); p->hWnd = hWnd; int ct = p->pblock->Count(orientation_target_list); // int ctf = p->pblock->Count(orientation_target_weight); switch (msg) { case WM_INITDIALOG: { int selection = p->last_selection; ICustButton *iBut = GetICustButton(GetDlgItem(hWnd,IDC_ORIENT_TARG_PICKNODE)); iBut->SetType(CBT_CHECK); iBut->SetHighlightColor(GREEN_WASH); ReleaseICustButton(iBut); ISpinnerControl* spin = SetupFloatSpinner(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER, IDC_ORIENT_CONS_WEIGHT_EDIT, 0.0f, 100.0f, 50.0f, 1.0f); spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER)); // CAL-09/10/02: automatically set last_selection to 0 when there're targets if (p->pblock->Count(orientation_target_list) < 1) { // nothing is selected OR there are no targets // all buttons - target_delete, weight_edit, weight_spinner -- are disabled EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), FALSE); EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), FALSE); ICustButton *iPickOb1; iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG)); if (iPickOb1 != NULL){ iPickOb1->Enable(FALSE); ReleaseICustButton(iPickOb1); } spin->SetValue(0.0f, FALSE); } else { if (selection < 0) p->last_selection = selection = 0; // there is a valid selection // automatically means there is AT LEAST one target Control *cont = p->pblock->GetControllerByID(orientation_target_weight, selection); // until it is animated, paramblock doesn't have a controller assigned in it yet. if (spin) { if ((cont != NULL) && cont->IsKeyAtTime(t,KEYAT_ROTATION)) spin->SetKeyBrackets(TRUE); else spin->SetKeyBrackets(FALSE); } if(p->pickWorldFlag){ ICustButton *iPickOb; iPickOb = GetICustButton(GetDlgItem(p->hWnd, IDC_ORIENT_PICK_WORLD)); if (iPickOb != NULL){ iPickOb->Enable(FALSE); ReleaseICustButton(iPickOb); } } if (p->pblock->Count(orientation_target_list) == 1){// there is only one target // the "delete" button should be enabled ICustButton *iPickOb1; iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG)); if (iPickOb1 != NULL){ iPickOb1->Enable(TRUE); ReleaseICustButton(iPickOb1); } // the rest are disabled // EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), FALSE); // EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), FALSE); } else if (p->pblock->Count(orientation_target_list) > 1){ // there are more than one targets // all buttons - delete, weight_edit, weight_spinner -- are enabled EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), TRUE); EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), TRUE); ICustButton *iPickOb1; iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG)); if (iPickOb1 != NULL){ iPickOb1->Enable(TRUE); ReleaseICustButton(iPickOb1); } } } ReleaseISpinner(spin); p->RedrawListbox(GetCOREInterface()->GetTime(), selection); return TRUE; } break; case WM_COMMAND: { int selection; if (LOWORD(wParam) == IDC_ORIENT_TARG_LIST && HIWORD(wParam) == LBN_SELCHANGE) { selection = SendDlgItemMessage(p->hWnd, IDC_ORIENT_TARG_LIST, LB_GETCURSEL, 0, 0); p->last_selection = selection; if (selection >= 0){ // there is a valid selection // automatically means there is AT LEAST one target if (p->pblock->Count(orientation_target_list) == 1){ // there is only one target // the "delete" button should be enabled ICustButton *iPickOb1; iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG)); if (iPickOb1 != NULL){ iPickOb1->Enable(TRUE); ReleaseICustButton(iPickOb1); } // // the rest are disabled // EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), FALSE); // EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), FALSE); } else if (p->pblock->Count(orientation_target_list) > 1){ // there are more than one targets // all buttons - delete, weight_edit, weight_spinner -- are enabled EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), TRUE); EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), TRUE); ICustButton *iPickOb1; iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG)); if (iPickOb1 != NULL){ iPickOb1->Enable(TRUE); ReleaseICustButton(iPickOb1); } ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER)); float value = map->GetParamBlock()->GetFloat(orientation_target_weight, t, selection); spin->SetValue(value, FALSE); Control *cont = p->pblock->GetControllerByID(orientation_target_weight, selection); // until it is animated, paramblock doesn't have a controller assigned in it yet. if (spin && (cont != NULL)) { if (cont->IsKeyAtTime(t,KEYAT_ROTATION)){ spin->SetKeyBrackets(TRUE); } } else { spin->SetKeyBrackets(FALSE); } ReleaseISpinner(spin); } p->RedrawListbox(GetCOREInterface()->GetTime(), selection); } else if (selection < 0 || p->pblock->Count(orientation_target_list) < 1){ // nothing is selected OR there are no targets // all buttons - target_delete, weight_edit, weight_spinner -- are disabled EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_EDIT), FALSE); EnableWindow(GetDlgItem(p->hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER), FALSE); ICustButton *iPickOb1; iPickOb1 = GetICustButton(GetDlgItem(p->hWnd, IDC_REMOVE_ORIENT_TARG)); if (iPickOb1 != NULL){ iPickOb1->Enable(FALSE); ReleaseICustButton(iPickOb1); } } } else if (LOWORD(wParam) == IDC_ORIENT_TARG_PICKNODE){ thePickMode.p = p; p->ip->SetPickMode(&thePickMode); } else if (LOWORD(wParam) == IDC_REMOVE_ORIENT_TARG){ selection = SendDlgItemMessage(p->hWnd, IDC_ORIENT_TARG_LIST, LB_GETCURSEL, 0, 0); p->last_selection = selection; if (selection >= 0){ theHold.Begin(); p->DeleteTarget(selection); theHold.Accept(GetString(IDS_AG_ORIENTATION_LIST)); } // p->RedrawListbox(GetCOREInterface()->GetTime(), selection-1); } else if (LOWORD(wParam) == IDC_ORIENT_PICK_WORLD){ INode *nullNode = NULL; p->AppendTarget(nullNode); p->pickWorldFlag = 1; p->NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE); // so that the change is updated ICustButton *iPickOb; iPickOb = GetICustButton(GetDlgItem(p->hWnd, IDC_ORIENT_PICK_WORLD)); if (iPickOb != NULL){ iPickOb->Enable(FALSE); ReleaseICustButton(iPickOb); } p->RedrawListbox(GetCOREInterface()->GetTime()); } } break; case CC_SPINNER_CHANGE: { if (LOWORD(wParam) == IDC_ORIENT_CONS_WEIGHT_SPINNER) { int selection = SendDlgItemMessage(p->hWnd, IDC_ORIENT_TARG_LIST, LB_GETCURSEL, 0, 0); // CAL-09/10/02: need to start a hold if it's not holding to handle type-in values BOOL isHold = theHold.Holding(); if (!isHold) theHold.Begin(); ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER)); if (selection >= 0) { float value = ((ISpinnerControl *)lParam)->GetFVal(); map->GetParamBlock()->SetValue(orientation_target_weight, t, value, selection); Control *cont = p->pblock->GetControllerByID(orientation_target_weight, selection); // until it is animated, paramblock doesn't have a controller assigned in it yet. if (spin) spin->SetKeyBrackets(((cont != NULL) && cont->IsKeyAtTime(t,KEYAT_ROTATION)) ? TRUE : FALSE); p->RedrawListbox(GetCOREInterface()->GetTime(), selection); } else { if (spin) spin->SetValue(0.0f, FALSE); } if (spin) ReleaseISpinner(spin); if (!isHold) theHold.Accept(GetString(IDS_RB_PARAMETERCHANGE)); } } break; } return FALSE; }