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); } } }
BOOL UnwrapMod::AddDefaultActionToBar(ICustToolbar *toolBar, int id) { int numOps = NumElements(spActions)/3; UnwrapAction *wtActions = NULL; int ct = 0; for (int i =0; i < numOps; i++) { int testid, ids1, ids2; testid = spActions[ct++]; ids1 = spActions[ct++]; ids2 = spActions[ct++]; if (testid == id) { TSTR name; name.printf(_T("%s"),GetString(ids2)); int l = name.Length(); toolBar->AddTool(ToolButtonItem(CTB_PUSHBUTTON,0, 0, 0, 0, 16, 15, l*8, 22, id)); ICustButton *but = toolBar->GetICustButton(id); but->SetHighlightColor(GREEN_WASH); but->SetTooltip(TRUE,GetString(ids1)); but->SetImage(NULL,0,0,0,0,0,0); but->SetText(GetString(ids2)); ReleaseICustButton(but); i = numOps; return TRUE; } } return FALSE; }
void CppOut::Init(HWND hWnd) { iPick = GetICustButton(GetDlgItem(hWnd,IDC_CPPOUT_PICK)); iPick->SetType(CBT_CHECK); iPick->SetHighlightColor(GREEN_WASH); }
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; }
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; }
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; }
void ToolBarFrame::AddButton(int id, ToolButtonItem item, const MCHAR* toolTip, FlyOffData *flyOff, int flyOffCount, int flyOffValue) { mToolBar->AddTool(item); ICustButton *but = mToolBar->GetICustButton(id); if (but) { but->SetHighlightColor(GREEN_WASH); if (flyOff && (flyOffCount > 0) ) but->SetFlyOff(flyOffCount,flyOff,GetCOREInterface()->GetFlyOffTime(),flyOffValue,FLY_VARIABLE); else GetToolTipExtender().SetToolTip(but->GetHwnd(), TSTR(toolTip)); ReleaseICustButton(but); } }
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 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 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 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; }