StraussShaderDlg::~StraussShaderDlg() { HDC hdc = GetDC(hRollup); GetGPort()->RestorePalette(hdc, hOldPal); ReleaseDC(hRollup, hdc); if( pShader ) pShader->SetParamDlg(NULL,0); for (long i=0; i < NMBUTS; i++ ){ ReleaseICustButton( texMBut[i] ); texMBut[i] = NULL; } for (long i=0; i<STRAUSS_NCOLBOX; i++) if (cs[i]) ReleaseIColorSwatch(cs[i]); // mjm - 5.10.99 ReleaseISpinner(glSpin); ReleaseISpinner(mtSpin); ReleaseISpinner(trSpin); DLSetWindowLongPtr(hRollup, NULL); DLSetWindowLongPtr(hwHilite, NULL); if(pShader){ IRollupWindow* pRollup = pMtlPar->GetMtlEditorRollup(); pShader->SetPanelOpen(pRollup->IsPanelOpen(pRollup->GetPanelIndex(hRollup))); } hwHilite = hRollup = NULL; }
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { IParamBlock2 *pb = map->GetParamBlock(); // Enable the min and max controls (that are only valid with stop points) // if at least one of the targets has a stop point plAnimComponent *comp = (plAnimComponent*)pb->GetOwner(); int num = comp->NumTargets(); bool stopPoints = false; for (int i = 0; i < num; i++) { if (DoesHaveStopPoints(comp->GetTarget(i))) { stopPoints = true; break; } } EnableStopPoints(map, stopPoints); // If we're doing an ease, set the ease rollup to open if (pb->GetInt(kAnimEaseInType) != plAnimEaseTypes::kNoEase || pb->GetInt(kAnimEaseOutType) != plAnimEaseTypes::kNoEase) PostMessage(hWnd, WM_ROLLOUT_OPEN, 0, 0); } return TRUE; // Max doesn't know about the rollup until after WM_CREATE, so we get // around it by posting a message case WM_ROLLOUT_OPEN: { IRollupWindow *rollup = GetCOREInterface()->GetCommandPanelRollup(); int idx = rollup->GetPanelIndex(hWnd); rollup->SetPanelOpen(idx, TRUE); } return TRUE; } return FALSE; }
BOOL plAutoUIBase::DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_INITDIALOG) { fhDlg = hDlg; ICreateControls(); PostMessage(fhDlg, WM_SIZE_PANEL, 0, 0); } uint32_t count = fParams.size(); for (uint32_t i = 0; i < count; i++) { if (fParams[i]->IsMyMessage(msg, wParam, lParam, fPBlock)) { if (fParams[i]->GetParamType() == plAutoUIParam::kTypeDropDownList && HIWORD(wParam) == CBN_SELENDOK) { plDropDownListParam* ddl = (plDropDownListParam*)fParams[i]; ParamID id = ddl->GetID(); std::string str = ddl->GetString(fPBlock); int yOffset = 10; // We now have the id and current state of the drop-down list that changed // so now we need to update the visible state of the controls for (uint32_t idx = 0; idx < fParams.size(); idx++) { plAutoUIParam* par = fParams[idx]; if (par->CheckVisibility(id, str)) { par->Show(yOffset); yOffset += par->GetHeight() + 5; } else { par->Hide(); } } IRollupWindow *rollup = GetCOREInterface()->GetCommandPanelRollup(); int index = rollup->GetPanelIndex(fhDlg); if (index >= 0) rollup->SetPageDlgHeight(index, yOffset); InvalidateRect(fhDlg, NULL, TRUE); } return TRUE; } } // During init but after everything else we want to update the visibility if (msg == WM_SIZE_PANEL) { // Ok, this sucks but I don't know of a better way at this point // We need to intialize the visible state of the controls, and the only way to do this // is by looping through and finding all of the drop-down lists for (uint32_t i = 0; i < fParams.size(); i++) { if (fParams[i]->GetParamType() == plAutoUIParam::kTypeDropDownList) { plDropDownListParam* ddl = (plDropDownListParam*)fParams[i]; ParamID id = ddl->GetID(); std::string str = ""; const char* cstr = ddl->GetString(fPBlock); int yOffset = 10; if (cstr) str = cstr; // We now have the id and current state of the drop-down list that changed // so now we need to update the visible state of the controls for (uint32_t idx = 0; idx < fParams.size(); idx++) { if (fParams[idx]->CheckVisibility(id, str)) { fParams[idx]->Show(yOffset); yOffset += fParams[idx]->GetHeight() + 5; } else { fParams[idx]->Hide(); } } IRollupWindow *rollup = GetCOREInterface()->GetCommandPanelRollup(); int index = rollup->GetPanelIndex(fhDlg); if (index >= 0) rollup->SetPageDlgHeight(index, yOffset); InvalidateRect(fhDlg, NULL, TRUE); } } return TRUE; } return FALSE; }