void RandKeysUtil::SetStates() { if (doTime) { iPosTime->Enable(); EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_POSTIMELABEL),TRUE); iNegTime->Enable(); EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_NEGTIMELABEL),TRUE); } else { iPosTime->Disable(); EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_POSTIMELABEL),FALSE); iNegTime->Disable(); EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_NEGTIMELABEL),FALSE); } if (doVal) { iPosVal->Enable(); EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_POSVALLABEL),TRUE); iNegVal->Enable(); EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_NEGVALLABEL),TRUE); } else { iPosVal->Disable(); EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_POSVALLABEL),FALSE); iNegVal->Disable(); EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_NEGVALLABEL),FALSE); } switch (iu->GetMajorMode()) { case TVMODE_EDITKEYS: case TVMODE_EDITFCURVE: SetDlgItemText(hWnd,IDC_RANDKEYS_TEXT, GetString(IDS_RANDKEYS_KEYTEXT)); EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_APPLY),TRUE); break; case TVMODE_EDITTIME: { Interval iv = iu->GetTimeSelection(); TSTR buf, start, end; TimeToString(iv.Start(),start); TimeToString(iv.End(),end); buf.printf(GetString(IDS_RANDKEYS_TIMETEXT),start,end); SetDlgItemText(hWnd,IDC_RANDKEYS_TEXT,buf); EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_APPLY),TRUE); break; } case TVMODE_EDITRANGES: case TVMODE_POSRANGES: SetDlgItemText(hWnd,IDC_RANDKEYS_TEXT,_T("")); EnableWindow(GetDlgItem(hWnd,IDC_RANDKEYS_APPLY),FALSE); break; } }
void EditFaceDataMod::UpdateDialog () { TSTR buf; int numFaces=0, whichFace=0; float value = 1.0f; bool valueDetermined = true; if (!hParams) return; ModContextList mcList; INodeTab nodes; ip->GetModContexts(mcList,nodes); if (selLevel) { for (int i = 0; i < mcList.Count(); i++) { EditFaceDataModData *meshData = (EditFaceDataModData*)mcList[i]->localData; if (!meshData) continue; int numSelectedHere; meshData->DescribeSelection (numSelectedHere, whichFace, value, valueDetermined); numFaces += numSelectedHere; } } ISpinnerControl *spin = GetISpinner (GetDlgItem (hParams, IDC_VALUE_SPIN)); ICustButton *but = GetICustButton (GetDlgItem (hParams, IDC_RESET_SELECTION)); switch (selLevel) { case SEL_FACE: if (numFaces==1) { buf.printf (GetString(IDS_FACE_SELECTED), whichFace+1); } else { if (numFaces) buf.printf (GetString (IDS_FACES_SELECTED), numFaces); else buf = GetString (IDS_NO_FACE_SELECTED); } but->Enable (numFaces); spin->Enable (numFaces); if (numFaces && valueDetermined) { spin->SetIndeterminate (false); spin->SetValue (value, FALSE); } else { spin->SetIndeterminate (true); } break; case SEL_OBJECT: buf = GetString (IDS_OBJECT_SELECTED); spin->Disable(); but->Disable (); break; } SetDlgItemText(hParams,IDC_FACE_SELECTED,buf); ReleaseISpinner (spin); ReleaseICustButton (but); }
void FooControl::set_enable() { if (parent_rollout != NULL && parent_rollout->page != NULL) { // set spinner enable ISpinnerControl *spin = GetISpinner(GetDlgItem(parent_rollout->page, control_ID)); if (enabled) spin->Enable(); else spin->Disable(); ReleaseISpinner(spin); // set editbox enable ICustEdit *edit = GetICustEdit(GetDlgItem(parent_rollout->page, control_ID+2)); if (enabled) edit->Enable(); else edit->Disable(); ReleaseICustEdit(edit); // set caption enable HWND ctrl = GetDlgItem(parent_rollout->page, control_ID+1); if (ctrl) EnableWindow(ctrl, enabled); } }
void RendSpline::OnAspectLock(HWND hWnd, TimeValue t) { BOOL aspectLock; if(UseViewOrRenderParams(t) == rbViewport) pblock->GetValue(rnd_v2_vpt_aspect_lock,t,aspectLock,FOREVER); else pblock->GetValue(rnd_v2_aspect_lock,t,aspectLock,FOREVER); ISpinnerControl *iSpin = GetISpinner(GetDlgItem(hWnd, IDC_ASPECTSPIN)); if(aspectLock) { if(!mAspectLock) mAspect = GetAspect(t,(UseViewOrRenderParams(t)== rbViewport)); iSpin->SetValue(mAspect,FALSE); iSpin->Disable(); mAspectLock = aspectLock; } ReleaseISpinner(iSpin); }
static INT_PTR CALLBACK FaceDataDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { EditFaceDataMod *em = (EditFaceDataMod *) GetWindowLongPtr (hWnd, GWLP_USERDATA); ISpinnerControl *spin; switch (msg) { case WM_INITDIALOG: em = (EditFaceDataMod*) lParam; em->SetDialogHandle (hWnd); SetWindowLongPtr (hWnd,GWLP_USERDATA,lParam); spin = GetISpinner(GetDlgItem(hWnd,IDC_VALUE_SPIN)); spin->SetLimits (0.0f, 100.0f, FALSE); spin->SetScale (0.1f); spin->LinkToEdit (GetDlgItem(hWnd, IDC_VALUE), EDITTYPE_POS_FLOAT); spin->SetValue (1.0f, FALSE); spin->Disable(); ReleaseISpinner(spin); CheckDlgButton (hWnd, IDC_COLLAPSABLE, em->GetCollapsable()); em->UpdateDialog (); break; case CC_SPINNER_BUTTONDOWN: switch (LOWORD(wParam)) { case IDC_VALUE_SPIN: em->ChangeBegin (); break; } break; case CC_SPINNER_CHANGE: spin = (ISpinnerControl*)lParam; switch (LOWORD(wParam)) { case IDC_VALUE_SPIN: em->ChangeTo (spin->GetFVal()); break; } break; case CC_SPINNER_BUTTONUP: switch (LOWORD(wParam)) { case IDC_VALUE_SPIN: em->ChangeFinish (HIWORD(wParam) ? true : false); break; } break; case WM_CUSTEDIT_ENTER: switch (LOWORD(wParam)) { case IDC_VALUE: em->ChangeFinish (true); break; } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_RESET_SELECTION: em->ResetSelection (); break; case IDC_COLLAPSABLE: em->SetCollapsable (IsDlgButtonChecked (hWnd, IDC_COLLAPSABLE)?true:false); break; } break; case WM_PAINT: // Good place for call to UpdateDialog, if needed. return FALSE; default: return FALSE; } return TRUE; }