void plAgeDescInterface::IInitControls() { #ifdef MAXASS_AVAILABLE // Fill the branch combo box SendDlgItemMessage( fhDlg, IDC_BRANCHCOMBO, CB_RESETCONTENT, 0, 0 ); const jvTypeArray &branches = (*fAssetManIface)->GetBranches(); int i, curr = 0; for( i = 0; i < branches.Size(); i++ ) { int idx = SendDlgItemMessage( fhDlg, IDC_BRANCHCOMBO, CB_ADDSTRING, 0, (LPARAM)(const char *)( branches[ i ].Name ) ); SendDlgItemMessage( fhDlg, IDC_BRANCHCOMBO, CB_SETITEMDATA, idx, (LPARAM)branches[ i ].Id ); if( branches[ i ].Id == fAssetManIface->GetCurrBranch() ) curr = i; } SendDlgItemMessage( fhDlg, IDC_BRANCHCOMBO, CB_SETCURSEL, curr, 0 ); fSpin = SetupFloatSpinner(fhDlg, IDC_DAYLEN_SPINNER, IDC_DAYLEN_EDIT, 1.f, 100.f, 24.f); fCapSpin = SetupIntSpinner(fhDlg, IDC_CAP_SPINNER, IDC_CAP_EDIT, 1, 250, kDefaultCapacity); fSeqPrefixSpin = SetupIntSpinner(fhDlg, IDC_SEQPREFIX_SPIN, IDC_SEQPREFIX_EDIT, 1, 102400, 1); SendDlgItemMessage( fhDlg, IDC_AGELIST_STATIC, WM_SETFONT, (WPARAM)fBoldFont, MAKELPARAM( TRUE, 0 ) ); SendDlgItemMessage( fhDlg, IDC_AGEDESC, WM_SETFONT, (WPARAM)fBoldFont, MAKELPARAM( TRUE, 0 ) ); #endif ISetControlDefaults(); IEnableControls(false); }
BOOL SceneViewer::DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { fhDlg = hDlg; // Set the exe to use HWND hExeCombo = GetDlgItem(hDlg, IDC_EXE); ComboBox_AddString(hExeCombo, "Release"); ComboBox_AddString(hExeCombo, "Debug"); ComboBox_SetCurSel(hExeCombo, fReleaseExe ? 0 : 1); // Set the client path const char *path = plMaxConfig::GetClientPath(false, true); ICustEdit *edit = GetICustEdit(GetDlgItem(hDlg, IDC_CLIENT_PATH)); edit->SetText((char*)path); // Set the "Load old data" checkbox HWND hLoadOld = GetDlgItem(hDlg, IDC_REUSE_DATA); Button_SetCheck(hLoadOld, fLoadOld ? BST_CHECKED : BST_UNCHECKED); Button_Enable(hLoadOld, SceneSync::Instance().CanLoadOldResMgr()); // Set the update controls float val = float(fUpdateFreq) / 1000.f; ISpinnerControl *spin = SetupFloatSpinner(hDlg, IDC_SPINNER, IDC_EDIT, 0.1, 1.f, val); spin->Enable(fUpdate); CheckDlgButton(hDlg, IDC_UPDATE, fUpdate ? BST_CHECKED : BST_UNCHECKED); IEnableSetupControls(!SceneSync::Instance().IsClientRunning()); } return TRUE; case WM_COMMAND: // Start/Stop SceneViewer if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_START) { IToggleRunning(); IEnableSetupControls(!SceneSync::Instance().IsClientRunning()); return TRUE; } // Close dialog else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDCANCEL) { DestroyWindow(hDlg); fhDlg = NULL; return TRUE; } // Browse for directory else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_DIR) { const char *path = plMaxConfig::GetClientPath(true); if (path) { ICustEdit *edit = GetICustEdit(GetDlgItem(hDlg, IDC_CLIENT_PATH)); edit->SetText((char*)path); } return TRUE; } // "Load old data" selection changed else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_REUSE_DATA) { fLoadOld = (Button_GetCheck((HWND)lParam) == BST_CHECKED); return TRUE; } // Release/Debug exe selection changed else if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_EXE) { int sel = ComboBox_GetCurSel((HWND)lParam); fReleaseExe = (sel == 0); return TRUE; } else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_UPDATE) { fUpdate = (SendMessage((HWND)lParam, BM_GETCHECK, 0, 0) == BST_CHECKED); ISpinnerControl *spin = GetISpinner(GetDlgItem(hDlg, IDC_SPINNER)); spin->Enable(fUpdate); ReleaseISpinner(spin); // If update was turned on, send out an update message so any dirty objects // will be reconverted right away if (fUpdate) SceneSync::Instance().SetUpdateFreq(fUpdateFreq); return TRUE; } break; // Update frequency changed case CC_SPINNER_CHANGE: if (LOWORD(wParam) == IDC_SPINNER) { ISpinnerControl *spin = (ISpinnerControl*)lParam; float val = spin->GetFVal(); fUpdateFreq = int(val*1000.f); SceneSync::Instance().SetUpdateFreq(fUpdateFreq); } return TRUE; // Type in directory case WM_CUSTEDIT_ENTER: if (wParam == IDC_CLIENT_PATH) { ICustEdit *edit = GetICustEdit((HWND)lParam); char path[MAX_PATH]; edit->GetText(path, sizeof(path)); plMaxConfig::SetClientPath(path); } return TRUE; } 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; }
BOOL OrenNayarShaderDlg::PanelProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam ) { int id = LOWORD(wParam); int code = HIWORD(wParam); switch (msg) { case WM_INITDIALOG: { int i; HDC theHDC = GetDC(hwndDlg); hOldPal = GetGPort()->PlugPalette(theHDC); ReleaseDC(hwndDlg,theHDC); for (i=0; i<NCOLBOX; i++) { cs[i] = GetIColorSwatch(GetDlgItem(hwndDlg, colID[i]), GetMtlColor(i, pShader), GetColorName(i)); } hwHilite = GetDlgItem(hwndDlg, IDC_HIGHLIGHT); SetWindowLongPtr( hwHilite, GWLP_WNDPROC, (LONG_PTR)HiliteWndProc); shSpin = SetupIntSpinner(hwndDlg, IDC_SH_SPIN, IDC_SH_EDIT, 0,100, 0); ssSpin = SetupIntSpinner(hwndDlg, IDC_SS_SPIN, IDC_SS_EDIT, 0,999, 0); softSpin = SetupFloatSpinner(hwndDlg, IDC_SOFT_SPIN, IDC_SOFT_EDIT, 0.0f,1.0f,0.0f,.01f); trSpin = SetupIntSpinner(hwndDlg, IDC_TR_SPIN, IDC_TR_EDIT, 0,100, 0); dlevSpin = SetupIntSpinner(hwndDlg, IDC_DIFFLEV_SPIN, IDC_DIFFLEV_EDIT, 0, 400, 0); roughSpin = SetupIntSpinner(hwndDlg, IDC_DIFFROUGH_SPIN, IDC_DIFFROUGH_EDIT, 0, 100, 0); for (int j=0; j<NMBUTS; j++) { texMBut[j] = GetICustButton(GetDlgItem(hwndDlg,texMButtonsIDC[j])); assert( texMBut[j] ); texMBut[j]->SetRightClickNotify(TRUE); texMBut[j]->SetDADMgr(&dadMgr); } SetupLockButton(hwndDlg,IDC_LOCK_AD,FALSE); SetupLockButton(hwndDlg,IDC_LOCK_DS,FALSE); SetupPadLockButton(hwndDlg,IDC_LOCK_ADTEX, TRUE); /* // mjm - 5.10.99 - isn't this already created above when i == N_SI_CLR? // create both a self-illum color as well as a spinner cs[N_SI_CLR] = GetIColorSwatch(GetDlgItem(hwndDlg, colID[N_SI_CLR] ), GetMtlColor(N_SI_CLR, pShader), GetColorName(N_SI_CLR)); */ siSpin = SetupIntSpinner(hwndDlg, IDC_SI_SPIN, IDC_SI_EDIT, 0,100, 0); if( pShader->IsSelfIllumClrOn() ) { // enable the color swatch, disable the spinner ShowWindow( GetDlgItem(hwndDlg, IDC_SI_EDIT), SW_HIDE ); ShowWindow( GetDlgItem(hwndDlg, IDC_SI_SPIN), SW_HIDE ); } else { // disable the color swatch ShowWindow( cs[N_SI_CLR]->GetHwnd(), SW_HIDE ); } LoadDialog(TRUE); } break; case WM_COMMAND: { for ( int i=0; i<NMBUTS; i++) { if (id == texMButtonsIDC[i]) { PostMessage(hwmEdit,WM_TEXMAP_BUTTON, texmapFromMBut[i],(LPARAM)pMtl ); UpdateMapButtons(); goto exit; } } } switch (id) { case IDC_LOCK_AD: SetLockAD(IsButtonChecked(hwndDlg, IDC_LOCK_AD)); UpdateMtlDisplay(); break; case IDC_LOCK_DS: SetLockDS(IsButtonChecked(hwndDlg, IDC_LOCK_DS)); UpdateMtlDisplay(); break; case IDC_LOCK_ADTEX:{ BOOL on = IsButtonChecked(hwndDlg, IDC_LOCK_ADTEX); SetLockADTex(on); UpdateMtlDisplay(); } break; case IDC_SI_COLORON:{ int isOn = GetCheckBox(hwndDlg, IDC_SI_COLORON ); pShader->SetSelfIllumClrOn( isOn ); if ( isOn ) { // enable the color swatch, disable the spinner ShowWindow( GetDlgItem(hwndDlg, IDC_SI_EDIT), SW_HIDE ); ShowWindow( GetDlgItem(hwndDlg, IDC_SI_SPIN), SW_HIDE ); ShowWindow( cs[N_SI_CLR]->GetHwnd(), SW_SHOW ); } else { // disable the color swatch ShowWindow( cs[N_SI_CLR]->GetHwnd(), SW_HIDE ); ShowWindow( GetDlgItem(hwndDlg, IDC_SI_EDIT), SW_SHOW ); ShowWindow( GetDlgItem(hwndDlg, IDC_SI_SPIN), SW_SHOW ); } NotifyChanged(); // UpdateMtlDisplay(); } break; } break; case CC_COLOR_SEL: { int id = LOWORD(wParam); SelectEditColor(ColorIDCToIndex(id)); } break; case CC_COLOR_DROP: { int id = LOWORD(wParam); SelectEditColor(ColorIDCToIndex(id)); UpdateMtlDisplay(); } break; case CC_COLOR_BUTTONDOWN: theHold.Begin(); break; case CC_COLOR_BUTTONUP: if (HIWORD(wParam)) theHold.Accept(GetString(IDS_DS_PARAMCHG)); else theHold.Cancel(); UpdateMtlDisplay(); break; case CC_COLOR_CHANGE: { int id = LOWORD(wParam); int buttonUp = HIWORD(wParam); int n = ColorIDCToIndex(id); if (buttonUp) theHold.Begin(); Color curColor(cs[n]->GetColor()); SetMtlColor(n, curColor, pShader, cs, curTime); if (buttonUp) { theHold.Accept(GetString(IDS_DS_PARAMCHG)); // DS: 5/11/99- this was commented out. I put it back in, because // it is necessary for the Reset button in the color picker to // update the viewport. UpdateMtlDisplay(); } } break; case WM_PAINT: if (!valid) { valid = TRUE; ReloadDialog(); } return FALSE; case WM_CLOSE: case WM_DESTROY: break; case CC_SPINNER_CHANGE: if (!theHold.Holding()) theHold.Begin(); switch (id) { case IDC_SH_SPIN: pShader->SetGlossiness(PcToFrac(shSpin->GetIVal()), curTime); UpdateHilite(); break; case IDC_SS_SPIN: pShader->SetSpecularLevel(PcToFrac(ssSpin->GetIVal()),curTime); UpdateHilite(); break; case IDC_SOFT_SPIN: pShader->SetSoftenLevel(softSpin->GetFVal(),curTime); break; case IDC_SI_SPIN: pShader->SetSelfIllum(PcToFrac(siSpin->GetIVal()),curTime); break; case IDC_DIFFLEV_SPIN: pShader->SetDiffuseLevel(PcToFrac(dlevSpin->GetIVal()),curTime); break; case IDC_DIFFROUGH_SPIN: pShader->SetDiffuseRoughness(PcToFrac(roughSpin->GetIVal()),curTime); break; //******** >>>><<<< required handling for opacity....must be present in all dialogs case IDC_TR_SPIN: pMtl->SetOpacity(PcToFrac( trSpin->GetIVal()),curTime); break; } // UpdateMtlDisplay(); break; case CC_SPINNER_BUTTONDOWN: theHold.Begin(); break; case WM_CUSTEDIT_ENTER: case CC_SPINNER_BUTTONUP: if (HIWORD(wParam) || msg==WM_CUSTEDIT_ENTER) theHold.Accept(GetString(IDS_DS_PARAMCHG)); else theHold.Cancel(); UpdateMtlDisplay(); break; } exit: return FALSE; }
INT_PTR CALLBACK UnwrapFlattenFloaterDlgProc( 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 *iAngle = NULL; static ISpinnerControl *iSpacing = NULL; switch (msg) { case WM_INITDIALOG: mod = (UnwrapMod*)lParam; mod->flattenHWND = hWnd; DLSetWindowLongPtr(hWnd, lParam); ::SetWindowContextHelpId(hWnd, idh_unwrap_flattenmap); //create spinners and set value iAngle = SetupFloatSpinner( hWnd,IDC_UNWRAP_ANGLESPIN,IDC_UNWRAP_ANGLE, 0.0f,180.0f,mod->flattenAngleThreshold); iSpacing = SetupFloatSpinner( hWnd,IDC_UNWRAP_SPACINGSPIN,IDC_UNWRAP_SPACING, 0.0f,1.0f,mod->flattenSpacing); //set align cluster CheckDlgButton(hWnd,IDC_NORMALIZE_CHECK,mod->flattenNormalize); CheckDlgButton(hWnd,IDC_ROTATE_CHECK,mod->flattenRotate); CheckDlgButton(hWnd,IDC_COLLAPSE_CHECK,mod->flattenCollapse); mod->SetFlattenDialogPos(); break; case WM_SYSCOMMAND: if ((wParam & 0xfff0) == SC_CONTEXTHELP) { MaxSDK::IHelpSystem::GetInstance()->ShowProductHelpForTopic(idh_unwrap_flattenmap); } return FALSE; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_OK: { mod->SaveFlattenDialogPos(); float tempSpacing, tempAngle; BOOL tempNormalize, tempRotate, tempCollapse; tempSpacing = mod->flattenSpacing; tempAngle = mod->flattenAngleThreshold; tempNormalize = mod->flattenNormalize; tempRotate = mod->flattenRotate; tempCollapse = mod->flattenCollapse; mod->flattenSpacing = iSpacing->GetFVal()*0.5f; mod->flattenAngleThreshold = iAngle->GetFVal(); mod->flattenNormalize = IsDlgButtonChecked(hWnd,IDC_NORMALIZE_CHECK); mod->flattenRotate = IsDlgButtonChecked(hWnd,IDC_ROTATE_CHECK); mod->flattenCollapse = IsDlgButtonChecked(hWnd,IDC_COLLAPSE_CHECK); BOOL byMatID = IsDlgButtonChecked(hWnd,IDC_BYMATIDS_CHECK); if (byMatID) mod->fnFlattenMapByMatIDNoParams(); else mod->fnFlattenMapNoParams(); mod->flattenSpacing *= 2.0f; /* mod->flattenSpacing = tempSpacing; mod->flattenAngleThreshold = tempAngle; mod->flattenNormalize = tempNormalize; mod->flattenRotate = tempRotate; mod->flattenCollapse= tempCollapse; */ ReleaseISpinner(iAngle); iAngle = NULL; ReleaseISpinner(iSpacing); iSpacing = NULL; EndDialog(hWnd,1); break; } case IDC_CANCEL: { mod->SaveFlattenDialogPos(); ReleaseISpinner(iAngle); iAngle = NULL; ReleaseISpinner(iSpacing); iSpacing = NULL; EndDialog(hWnd,0); break; } case IDC_DEFAULT: { //get bias mod->flattenSpacing = iSpacing->GetFVal(); mod->flattenAngleThreshold = iAngle->GetFVal(); //get align mod->flattenNormalize = IsDlgButtonChecked(hWnd,IDC_NORMALIZE_CHECK); mod->flattenRotate = IsDlgButtonChecked(hWnd,IDC_ROTATE_CHECK); mod->flattenCollapse = IsDlgButtonChecked(hWnd,IDC_COLLAPSE_CHECK); //set as defaults break; } } break; default: return FALSE; } return TRUE; }
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; }