INT_PTR EffectsDlgProc::DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { HWND hwndeffect = GetDlgItem(hWnd, IDC_EFFECTLIST); SendMessage(hwndeffect, CB_RESETCONTENT, 0L, 0L); for (int i = 0; i < vl->NumShaders(); i++) { ClassDesc* pClassD = vl->GetEffectCD(i); int n = SendMessage(hwndeffect, CB_ADDSTRING, 0L, (LPARAM)(pClassD->ClassName()) ); } SendMessage(hwndeffect, CB_INSERTSTRING, 0L, (LPARAM)GetString(IDS_STR_NONE)); SendMessage(hwndeffect, CB_SETCURSEL, vl->effectIndex,0L); if (vl->IsCurrentEffectSupported()) { vl->EnableDlgItem(IDC_ENABLED, TRUE); } else { vl->SetCurrentEffectEnabled(false); vl->EnableDlgItem(IDC_ENABLED, FALSE); } vl->EnableDlgItem(IDC_SAVE_FX, vl->IsSaveFxSupported()); return TRUE; } } return FALSE; }
const TCHAR * ViewportLoader::GetActiveEffectName() { ClassDesc* pCD = GetEffectCD(effectIndex-1); if(pCD) return (TCHAR*)pCD->ClassName(); else return NULL; }
void plComponentDlg::IOpenRightClickMenu() { HWND hTree = GetDlgItem(fhDlg, IDC_TREE); // Get the position of the cursor in screen and tree client coords POINT point, localPoint; GetCursorPos(&point); localPoint = point; ScreenToClient(hTree, &localPoint); // Check if there is a tree item at that point TVHITTESTINFO hitTest; hitTest.pt = localPoint; TreeView_HitTest(hTree, &hitTest); if (!(hitTest.flags & TVHT_ONITEMLABEL)) return; // Check if the tree item has an lParam (is a component) TVITEM item; item.mask = TVIF_PARAM; item.hItem = hitTest.hItem; TreeView_GetItem(hTree, &item); HMENU menu = nil; if (IIsComponent(item.lParam)) menu = fCompMenu; else if (IIsType(item.lParam)) menu = fTypeMenu; else return; // Select the item we're working with, so the user isn't confused TreeView_SelectItem(hTree, item.hItem); // Create the popup menu and get the option the user selects SetForegroundWindow(fhDlg); int sel = TrackPopupMenu(menu, TPM_NONOTIFY | TPM_RETURNCMD, point.x, point.y, 0, fhDlg, NULL); switch(sel) { case kMenuDelete: IDeleteComponent((plMaxNode*)item.lParam); break; case kMenuRename: TreeView_EditLabel(hTree, hitTest.hItem); break; case kMenuCopy: { // Component to copy INode *node = (INode*)item.lParam; INodeTab tab; tab.Append(1, &node); // Copy INodeTab copy; // Make the copy fInterface->CloneNodes(tab, Point3(0,0,0), true, NODE_COPY, NULL, ©); // Delete the targets for the copy and add it to the tree plMaxNode *newNode = (plMaxNode*)copy[0]; newNode->ConvertToComponent()->DeleteAllTargets(); HTREEITEM hItem = IAddComponent(GetDlgItem(fhDlg, IDC_TREE), newNode); TreeView_SelectItem(GetDlgItem(fhDlg, IDC_TREE), hItem); } break; case kMenuHide: { ClassDesc *desc = plComponentMgr::Inst().Get(item.lParam-1); std::vector<Class_ID>::iterator it; it = std::find(fHiddenComps.begin(), fHiddenComps.end(), desc->ClassID()); TSTR name = desc->ClassName(); if (it == fHiddenComps.end()) { fHiddenComps.push_back(desc->ClassID()); name.Append(" (Hidden)"); } else fHiddenComps.erase(it); item.mask = TVIF_TEXT; item.pszText = name; TreeView_SetItem(GetDlgItem(fhDlg, IDC_TREE), &item); plComponentUtil::Instance().IUpdateRollups(); } break; } PostMessage(fhDlg, WM_USER, 0, 0); }
const TCHAR * ViewportLoader::GetEffectName(int i) { ClassDesc* pClassD = GetEffectCD(i-1); return (TCHAR*)pClassD->ClassName(); }