void CTreeOptionsCtrlEx::UpdateCheckBoxGroup(HTREEITEM hItem) { SetRedraw(FALSE); //Iterate through all children and if all the checkboxes are checked, then also //automatically check the item. If no checkboxes are checked, then //also automatically uncheck the item. HTREEITEM hParent = hItem; if (hParent && IsCheckBox(hParent)) { BOOL bNoCheckBoxesChecked = TRUE; BOOL bAllCheckBoxesChecked = TRUE; HTREEITEM hChild = GetNextItem(hParent, TVGN_CHILD); while (hChild) { if (IsCheckBox(hChild)) { BOOL bThisChecked; VERIFY(GetCheckBox(hChild, bThisChecked)); bNoCheckBoxesChecked = bNoCheckBoxesChecked && !bThisChecked; bAllCheckBoxesChecked = bAllCheckBoxesChecked && bThisChecked; } //Move on to the next item hChild = GetNextItem(hChild, TVGN_NEXT); } if (bNoCheckBoxesChecked) { BOOL bOldState; GetCheckBox(hParent, bOldState); SetCheckBox(hParent, FALSE); if (bOldState != FALSE) NotifyParent(BN_CLICKED, hParent); } else if (bAllCheckBoxesChecked) { BOOL bOldState; GetCheckBox(hParent, bOldState); SetCheckBox(hParent, FALSE); //gets rid of the semi state SetCheckBox(hParent, TRUE); if (bOldState != TRUE) NotifyParent(BN_CLICKED, hParent); } else { BOOL bEnable; VERIFY(GetCheckBoxEnable(hParent, bEnable)); SetEnabledSemiCheckBox(hParent, bEnable); } } //Reset the redraw flag SetRedraw(TRUE); }
bool CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) { switch (nChar) { case FWL_VKEY_Return: case FWL_VKEY_Space: { CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); ASSERT(pPageView); CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get()); if (m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp( &pObserved, pPageView, nFlags)) { if (!pObserved) m_pWidget = nullptr; return true; } if (!pObserved) { m_pWidget = nullptr; return true; } CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); CPWL_CheckBox* pWnd = GetCheckBox(pPageView, true); if (pWnd) { CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot); pWnd->SetCheck(!pWidget->IsChecked()); } return CommitData(pPageView, nFlags); } default: return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); } }
void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) { CPWL_CheckBox* pWnd = GetCheckBox(pPageView, false); if (!pWnd) return; bool bNewChecked = pWnd->IsChecked(); if (bNewChecked) { CPDF_FormField* pField = m_pWidget->GetFormField(); for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) { if (CPDF_FormControl* pCtrl = pField->GetControl(i)) { if (pCtrl->IsChecked()) { break; } } } } CPDFSDK_Widget::ObservedPtr observed_widget(m_pWidget.Get()); CFFL_CheckBox::ObservedPtr observed_this(this); m_pWidget->SetCheck(bNewChecked, NotificationOption::kDoNotNotify); if (!observed_widget) return; m_pWidget->UpdateField(); if (!observed_widget || !observed_this) return; SetChangeMark(); }
LRESULT CALLBACK RecursiveCheckBoxProc(HWND hwnd, UINT umsg, WPARAM wparm, LPARAM lparm) { switch (umsg) { case WM_DESTROY: dirRecursive=GetCheckBox(GetParent(hwnd),ID_RECURSIVE); DeleteObject(recursiveFont); break; default: break; } return CallWindowProc((WNDPROC)GetWindowLong(hwnd,GWL_USERDATA),hwnd,umsg,wparm,lparm); }
void CTreeOptionsCtrlEx::HandleCheckBox(HTREEITEM hItem, BOOL bCheck) { //Turn of redraw to Q all the changes we're going to make here SetRedraw(FALSE); //Toggle the state BOOL bOldState; GetCheckBox(hItem, bOldState); VERIFY(SetCheckBox(hItem, !bCheck)); if (bOldState != !bCheck) NotifyParent(BN_CLICKED, hItem); //If the item has children, then iterate through them and for all items //which are check boxes set their state to be the same as the parent HTREEITEM hChild = GetNextItem(hItem, TVGN_CHILD); while (hChild) { if (IsCheckBox(hChild)){ BOOL bThisChecked; GetCheckBox(hChild, bThisChecked); SetCheckBox(hChild, !bCheck); if (bThisChecked != !bCheck) NotifyParent(BN_CLICKED, hChild); } //Move on to the next item hChild = GetNextItem(hChild, TVGN_NEXT); } //Get the parent item and if it is a checkbox, then iterate through //all its children and if all the checkboxes are checked, then also //automatically check the parent. If no checkboxes are checked, then //also automatically uncheck the parent. HTREEITEM hParent = GetNextItem(hItem, TVGN_PARENT); UpdateCheckBoxGroup(hParent); //Reset the redraw flag SetRedraw(TRUE); }
static BOOL CALLBACK PrefsDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { BOOL err; SkeletonExporter *se = (SkeletonExporter*)GetWindowLong(hWnd,GWL_USERDATA); if (!se && msg!=WM_INITDIALOG) return FALSE; switch (msg) { case WM_INITDIALOG: // Update class pointer se = (SkeletonExporter*)lParam; SetWindowLong(hWnd,GWL_USERDATA,lParam); // Setup preferences initial state SetCheckBox(hWnd, CHECK_ADM, se->makeADM); SetCheckBox(hWnd, CHECK_ADL, se->makeADL); SetCheckBox(hWnd, CHECK_ADO, se->makeADO); //SetCheckBox(hWnd, CHECK_ADD, se->makeADD); SetCheckBox(hWnd, CHECK_ADP, se->makeADP); SetCheckBox(hWnd, CHECK_ADS, se->makeADS); SetCheckBox(hWnd, CHECK_RAY, se->makeRAY); buddy=GetDlgItem(hWnd, IDC_CSRATE); SendDlgItemMessage(hWnd, IDC_SPIN1, UDM_SETBUDDY, (LONG)buddy, 0L); SendDlgItemMessage(hWnd, IDC_SPIN1, UDM_SETRANGE, 0L, MAKELONG(1, 1000)); SendDlgItemMessage(hWnd, IDC_SPIN1, UDM_SETPOS, 0L, MAKELONG(20, 0)); break; case WM_DESTROY: break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_CANCEL: EndDialog(hWnd,1); break; case IDC_OK: // Retrieve preferences se->makeADM = GetCheckBox(hWnd, CHECK_ADM); se->makeADL = GetCheckBox(hWnd, CHECK_ADL); se->makeADO = GetCheckBox(hWnd, CHECK_ADO); //se->makeADD = GetCheckBox(hWnd, CHECK_ADD); se->makeADP = GetCheckBox(hWnd, CHECK_ADP); se->makeADS = GetCheckBox(hWnd, CHECK_ADS); se->makeRAY = GetCheckBox(hWnd, CHECK_RAY); se->cs_rate=GetDlgItemInt(hWnd, IDC_CSRATE, &err, FALSE); EndDialog(hWnd,0); break; } break; default: return FALSE; } return TRUE; }
bool CFFL_CheckBox::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, const CFX_PointF& point) { CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point); if (!IsValid()) return true; CPWL_CheckBox* pWnd = GetCheckBox(pPageView, true); if (pWnd) { CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot); pWnd->SetCheck(!pWidget->IsChecked()); } return CommitData(pPageView, nFlags); }
bool CFFL_CheckBox::IsDataChanged(CPDFSDK_PageView* pPageView) { CPWL_CheckBox* pWnd = GetCheckBox(pPageView, false); return pWnd && pWnd->IsChecked() != m_pWidget->IsChecked(); }
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; }
LRESULT CALLBACK AFPluginsOptionsProc(HWND hwnd, UINT umsg, WPARAM wparm, LPARAM lparm) { char str[MAX_PATH+256],dir[MAX_PATH]; char lpszTitle[]="Select audio file plug-in directory:"; int index; PluginNode *pnode; AFPlugin *plugin; LPNMHDR lpnmhdr; BROWSEINFO bi; LPITEMIDLIST lpidl; switch (umsg) { case WM_INITDIALOG: SetDlgItemText(hwnd,ID_PLUGINDIR,"Audio file plug-in &directory (takes effect on startup)"); SetDlgItemText(hwnd,ID_PLUGINLIST,"Audio file &plug-ins"); pnode=afFirstPlugin; while (pnode!=NULL) { wsprintf(str,"%s %s (%s)",AFNODE(pnode)->Description,AFNODE(pnode)->Version,pnode->pluginFileName); index=(int)SendDlgItemMessage(hwnd,ID_PLUGINS,LB_ADDSTRING,0,(LPARAM)str); SendDlgItemMessage(hwnd,ID_PLUGINS,LB_SETITEMDATA,(WPARAM)index,(LPARAM)(AFNODE(pnode))); pnode=pnode->next; } SetCheckBox(hwnd,ID_PLUGINALLOW,opAllowMultipleAFPlugins); CorrectDirString(afPluginDir); SetDlgItemText(hwnd,ID_DIR,afPluginDir); CheckCurAFSel(hwnd); DisableApply(hwnd); return TRUE; case WM_NOTIFY: lpnmhdr=(LPNMHDR)lparm; switch (lpnmhdr->code) { case PSN_APPLY: TrackPropPage(hwnd,3); opAllowMultipleAFPlugins=GetCheckBox(hwnd,ID_PLUGINALLOW); GetDlgItemText(hwnd,ID_DIR,afPluginDir,sizeof(afPluginDir)); CorrectDirString(afPluginDir); DisableApply(hwnd); SetWindowLong(hwnd,DWL_MSGRESULT,PSNRET_NOERROR); break; case PSN_RESET: DisableApply(hwnd); TrackPropPage(hwnd,3); break; default: break; } break; case WM_COMMAND: switch (LOWORD(wparm)) { case ID_DIR: GetDlgItemText(hwnd,ID_DIR,dir,sizeof(dir)); if (!DirectoryExists(dir)) CreateDirectoryRecursive(dir); bi.hwndOwner=hwnd; bi.pidlRoot=NULL; bi.pszDisplayName=dir; bi.lpszTitle=lpszTitle; bi.ulFlags=BIF_RETURNONLYFSDIRS; bi.lpfn=BrowseProc; if (dir[lstrlen(dir)-1]=='\\') dir[lstrlen(dir)-1]=0; bi.lParam=(LPARAM)dir; if ((lpidl=SHBrowseForFolder(&bi))!=NULL) { SHGetPathFromIDList(lpidl,dir); CorrectDirString(dir); SetDlgItemText(hwnd,ID_DIR,dir); EnableApply(hwnd); } break; case ID_PLUGINS: switch (HIWORD(wparm)) { case LBN_DBLCLK: CheckCurAFSel(hwnd); plugin=(AFPlugin*)GetCurPlugin(hwnd); if ((plugin!=NULL) && (plugin->Config!=NULL)) plugin->Config(hwnd); break; case LBN_KILLFOCUS: case LBN_SETFOCUS: case LBN_SELCANCEL: case LBN_SELCHANGE: CheckCurAFSel(hwnd); break; default: break; } break; case ID_PLUGINCONFIG: plugin=(AFPlugin*)GetCurPlugin(hwnd); if ((plugin!=NULL) && (plugin->Config!=NULL)) plugin->Config(hwnd); break; case ID_PLUGINABOUT: plugin=(AFPlugin*)GetCurPlugin(hwnd); if ((plugin!=NULL) && (plugin->About!=NULL)) plugin->About(hwnd); break; case ID_PLUGINALLOW: EnableApply(hwnd); break; default: break; } break; default: break; } return FALSE; }
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; }
BOOL CALLBACK HotkeysDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { WORD lw = LOWORD (wParam); WORD hw = HIWORD (wParam); static BOOL bKeyScanOn; static BOOL bTPlaySoundOnSuccessfulHkDismount; static BOOL bTDisplayBalloonOnSuccessfulHkDismount; switch (msg) { case WM_INITDIALOG: { LVCOLUMNW col; HWND hList = GetDlgItem (hwndDlg, IDC_HOTKEY_LIST); bKeyScanOn = FALSE; nSelectedHotkeyId = -1; currentVKeyCode = 0; memcpy (tmpHotkeys, Hotkeys, sizeof(tmpHotkeys)); memset (vkeysDown, 0, sizeof(vkeysDown)); SendMessageW (hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0, LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP|LVS_EX_LABELTIP ); memset (&col,0,sizeof(col)); col.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT; col.pszText = GetString ("ACTION"); col.cx = CompensateXDPI (341); col.fmt = LVCFMT_LEFT; SendMessageW (hList,LVM_INSERTCOLUMNW,0,(LPARAM)&col); col.pszText = GetString ("SHORTCUT"); col.cx = CompensateXDPI (190); col.fmt = LVCFMT_LEFT; SendMessageW (hList,LVM_INSERTCOLUMNW,1,(LPARAM)&col); LocalizeDialog (hwndDlg, "IDD_HOTKEYS_DLG"); SetCheckBox (hwndDlg, IDC_HK_MOD_CTRL, TRUE); SetCheckBox (hwndDlg, IDC_HK_MOD_SHIFT, FALSE); SetCheckBox (hwndDlg, IDC_HK_MOD_ALT, TRUE); SetCheckBox (hwndDlg, IDC_HK_MOD_WIN, FALSE); SetCheckBox (hwndDlg, IDC_HK_DISMOUNT_PLAY_SOUND, bPlaySoundOnSuccessfulHkDismount); SetCheckBox (hwndDlg, IDC_HK_DISMOUNT_BALLOON_TOOLTIP, bDisplayBalloonOnSuccessfulHkDismount); bTPlaySoundOnSuccessfulHkDismount = bPlaySoundOnSuccessfulHkDismount; bTDisplayBalloonOnSuccessfulHkDismount = bDisplayBalloonOnSuccessfulHkDismount; EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_ASSIGN), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_REMOVE), FALSE); DisplayHotkeyList(hwndDlg); SetTimer (hwndDlg, 0xfe, 10, NULL); return 1; } case WM_TIMER: { if ((nSelectedHotkeyId > -1) && (GetFocus () == GetDlgItem (hwndDlg, IDC_HOTKEY_KEY))) { wchar_t keyName [MAX_KEY_COMB_NAME_LEN]; UINT tmpVKeyCode; keyName[0] = 0; ScanAndProcessKey (&tmpVKeyCode, &keyName[0]); if (keyName[0] != 0) { currentVKeyCode = tmpVKeyCode; SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), keyName); EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_ASSIGN), TRUE); } else if ((currentVKeyCode != 0) && GetKeyName (currentVKeyCode, keyName)) { SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), keyName); } } return 1; } case WM_NOTIFY: if (wParam == IDC_HOTKEY_LIST) { if (((LPNMHDR) lParam)->code == LVN_ITEMACTIVATE || ((LPNMHDR) lParam)->code == LVN_ITEMCHANGED && (((LPNMLISTVIEW) lParam)->uNewState & LVIS_FOCUSED)) { LVITEM item; memset(&item,0,sizeof(item)); nSelectedHotkeyId = ((LPNMLISTVIEW) lParam)->iItem; currentVKeyCode = 0; memset (vkeysDown, 0, sizeof(vkeysDown)); SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), GetString ("PRESS_A_KEY_TO_ASSIGN")); EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_REMOVE), (tmpHotkeys[nSelectedHotkeyId].vKeyCode > 0)); EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_ASSIGN), FALSE); bKeyScanOn = TRUE; return 1; } } return 0; case WM_COMMAND: if (lw == IDC_HOTKEY_KEY && hw == EN_CHANGE) { if (!bKeyScanOn && nSelectedHotkeyId < 0 && GetWindowTextLengthW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY))) SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), L""); } if (lw == IDC_HOTKEY_ASSIGN) { BOOL bOwnActiveShortcut = FALSE; if (nSelectedHotkeyId >= 0 && currentVKeyCode != 0) { UINT modifiers = 0; if (GetCheckBox (hwndDlg, IDC_HK_MOD_CTRL)) modifiers = MOD_CONTROL; if (GetCheckBox (hwndDlg, IDC_HK_MOD_ALT)) modifiers |= MOD_ALT; if (GetCheckBox (hwndDlg, IDC_HK_MOD_SHIFT)) modifiers |= MOD_SHIFT; if (GetCheckBox (hwndDlg, IDC_HK_MOD_WIN)) modifiers |= MOD_WIN; // Check if it's not already assigned if (ShortcutInUse (currentVKeyCode, modifiers, tmpHotkeys)) { Error ("SHORTCUT_ALREADY_IN_USE", hwndDlg); return 1; } // Check for reserved system keys switch (currentVKeyCode) { case VK_F1: case VK_F12: /* F1 is help and F12 is reserved for use by the debugger at all times */ if (modifiers == 0) { Error ("CANNOT_USE_RESERVED_KEY", hwndDlg); return 1; } break; } bOwnActiveShortcut = ShortcutInUse (currentVKeyCode, modifiers, Hotkeys); // Test if the shortcut can be assigned without errors if (!bOwnActiveShortcut && !RegisterHotKey (hwndDlg, nSelectedHotkeyId, modifiers, currentVKeyCode)) { handleWin32Error(hwndDlg, SRC_POS); return 1; } else { if (!bOwnActiveShortcut && !UnregisterHotKey (hwndDlg, nSelectedHotkeyId)) handleWin32Error(hwndDlg, SRC_POS); tmpHotkeys[nSelectedHotkeyId].vKeyCode = currentVKeyCode; tmpHotkeys[nSelectedHotkeyId].vKeyModifiers = modifiers; SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), L""); EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_ASSIGN), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_REMOVE), FALSE); nSelectedHotkeyId = -1; bKeyScanOn = FALSE; currentVKeyCode = 0; memset (vkeysDown, 0, sizeof(vkeysDown)); } } DisplayHotkeyList(hwndDlg); return 1; } if (lw == IDC_HOTKEY_REMOVE) { if (nSelectedHotkeyId >= 0) { tmpHotkeys[nSelectedHotkeyId].vKeyCode = 0; tmpHotkeys[nSelectedHotkeyId].vKeyModifiers = 0; SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), L""); EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_ASSIGN), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_REMOVE), FALSE); nSelectedHotkeyId = -1; bKeyScanOn = FALSE; currentVKeyCode = 0; memset (vkeysDown, 0, sizeof(vkeysDown)); DisplayHotkeyList(hwndDlg); } return 1; } if (lw == IDC_RESET_HOTKEYS) { int i; for (i = 0; i < NBR_HOTKEYS; i++) { tmpHotkeys[i].vKeyCode = 0; tmpHotkeys[i].vKeyModifiers = 0; } SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), L""); EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_ASSIGN), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_HOTKEY_REMOVE), FALSE); nSelectedHotkeyId = -1; bKeyScanOn = FALSE; currentVKeyCode = 0; memset (vkeysDown, 0, sizeof(vkeysDown)); DisplayHotkeyList(hwndDlg); return 1; } if (lw == IDC_HK_DISMOUNT_PLAY_SOUND) { bTPlaySoundOnSuccessfulHkDismount = GetCheckBox (hwndDlg, IDC_HK_DISMOUNT_PLAY_SOUND); } if (lw == IDC_HK_DISMOUNT_BALLOON_TOOLTIP) { bTDisplayBalloonOnSuccessfulHkDismount = GetCheckBox (hwndDlg, IDC_HK_DISMOUNT_BALLOON_TOOLTIP); } if (lw == IDCANCEL || lw == IDCLOSE) { KillTimer (hwndDlg, 0xfe); EndDialog (hwndDlg, IDCANCEL); return 1; } if (lw == IDOK) { HWND hwndMainDlg = hwndDlg; while (GetParent (hwndMainDlg) != NULL) { hwndMainDlg = GetParent (hwndMainDlg); } UnregisterAllHotkeys (hwndMainDlg, Hotkeys); memcpy (Hotkeys, tmpHotkeys, sizeof(Hotkeys)); RegisterAllHotkeys (hwndMainDlg, Hotkeys); KillTimer (hwndDlg, 0xfe); bPlaySoundOnSuccessfulHkDismount = bTPlaySoundOnSuccessfulHkDismount; bDisplayBalloonOnSuccessfulHkDismount = bTDisplayBalloonOnSuccessfulHkDismount; SaveSettings (hwndDlg); EndDialog (hwndDlg, IDCANCEL); return 1; } return 0; case WM_CLOSE: KillTimer (hwndDlg, 0xfe); EndDialog (hwndDlg, IDCANCEL); return 1; } return 0; }
static INT_PTR CALLBACK UVStripDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: theUVStrip.Init(hWnd); TCHAR s[50]; _stprintf(s,GetString(IDS_OBJ_SELECTED),theUVStrip.ip->GetSelNodeCount()); SetWindowText(GetDlgItem(hWnd,IDC_SEL),s); break; case WM_DESTROY: theUVStrip.Destroy(hWnd); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_R1: { int cn = theUVStrip.ip->GetSelNodeCount(); Interval valid=FOREVER; if(cn>0) { for(int x=0;x<cn;x++) { // then osm stack Object* obj = theUVStrip.ip->GetSelNode(x)->GetObjectRef(); //check to make sure no modifiers on the object int ct = 0; SClass_ID sc; IDerivedObject* dobj; if ((sc = obj->SuperClassID()) == GEN_DERIVOB_CLASS_ID) { dobj = (IDerivedObject*)obj; while (sc == GEN_DERIVOB_CLASS_ID) { ct += dobj->NumModifiers(); dobj = (IDerivedObject*)dobj->GetObjRef(); sc = dobj->SuperClassID(); } } if ((dobj = theUVStrip.ip->GetSelNode(x)->GetWSMDerivedObject()) != NULL) { ct += dobj->NumModifiers(); } if (ct != 0) { //error message here TSTR buf2 = GetString(IDS_ERROR); TSTR buf1 = GetString(IDS_ERROR_MESH); MessageBox(hWnd,buf1,buf2,MB_ICONEXCLAMATION); } else { ObjectState os = theUVStrip.ip->GetSelNode(x)->EvalWorldState(theUVStrip.ip->GetTime()); if (os.obj && os.obj->SuperClassID() == GEOMOBJECT_CLASS_ID && os.obj->IsSubClassOf(triObjectClassID)) { Object *bobj = os.obj->FindBaseObject(); if (bobj->ClassID() ==Class_ID(EDITTRIOBJ_CLASS_ID,0)) { TriObject *T1 = (TriObject *)os.obj; T1->GetMesh().setNumTVerts(0); T1->GetMesh().setNumTVFaces(0); } else { //error message here TSTR buf2 = GetString(IDS_ERROR); TSTR buf1 = GetString(IDS_ERROR_MESH); MessageBox(hWnd,buf1,buf2,MB_ICONEXCLAMATION); } } else { //error message here TSTR buf2 = GetString(IDS_ERROR); TSTR buf1 = GetString(IDS_ERROR_MESH); MessageBox(hWnd,buf1,buf2,MB_ICONEXCLAMATION); } } theUVStrip.ip->ForceCompleteRedraw(); } } break; } case IDC_R2:{ int cn = theUVStrip.ip->GetSelNodeCount(); if(cn>0){ for(int x=0;x<cn;x++){ INode *tmp=theUVStrip.ip->GetSelNode(x); tmp->SetMtl(NULL); if(GetCheckBox(hWnd, IDC_BLANK)) tmp->SetWireColor(RGB(160,160,160)); } theUVStrip.ip->ForceCompleteRedraw(); } break;} } break; default: return FALSE; } return TRUE; }
BOOL WardShaderDlg::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<WARD_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)Hilite2WndProc); slevSpin = SetupIntSpinner(hwndDlg, IDC_SLEV_SPIN, IDC_SLEV_EDIT, 0,400, 0); dlevSpin = SetupIntSpinner(hwndDlg, IDC_DLEV_SPIN, IDC_DLEV_EDIT, 0, 400, 0); glxSpin = SetupIntSpinner(hwndDlg, IDC_GLX_SPIN, IDC_GLX_EDIT, 0,100, 0); glySpin = SetupIntSpinner(hwndDlg, IDC_GLY_SPIN, IDC_GLY_EDIT, 0,100, 0); trSpin = SetupIntSpinner(hwndDlg, IDC_TR_SPIN, IDC_TR_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); 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_NORMALIZE_CHECK: pShader->SetNormalizeOn( ! GetCheckBox(hwndDlg, IDC_NORMALIZE_CHECK) ); UpdateHilite(); NotifyChanged(); UpdateMtlDisplay(); break; 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; } 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_GLX_SPIN: pShader->SetGlossiness(ALPHA_MAX - PcToFrac( glxSpin->GetIVal() ) * ALPHA_SZ, curTime); UpdateHilite(); break; case IDC_GLY_SPIN: pShader->SetGlossinessY(ALPHA_MAX - PcToFrac(glySpin->GetIVal()) * ALPHA_SZ, curTime); UpdateHilite(); break; case IDC_SLEV_SPIN: pShader->SetSpecularLevel(SPEC_MAX * PcToFrac(slevSpin->GetIVal()),curTime); UpdateHilite(); break; case IDC_DLEV_SPIN: pShader->SetDiffuseLevel(PcToFrac(dlevSpin->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; }
BOOL CompositeDlg::PanelProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { int id = LOWORD(wParam); int code = HIWORD(wParam); switch (msg) { case WM_INITDIALOG: { hScroll = GetDlgItem(hWnd,IDC_COMP_SCROLL); SetScrollRange(hScroll,SB_CTL,0,theTex->NumSubTexmaps()-NDLG,FALSE); SetScrollPos(hScroll,SB_CTL,theTex->offset,TRUE); EnableWindow(hScroll,theTex->NumSubTexmaps()>NDLG); for (int i=0; i<NDLG; i++) { iBut[i] = GetICustButton(GetDlgItem(hWnd,IDC_COMP_TEX1+i)); iBut[i]->SetDADMgr(&dadMgr); // if (i-theTex->offset<theTex->mapOn.Count()) // SetCheckBox(hWnd, mapOnIDs[i], theTex->mapOn[i-theTex->offset]); } return TRUE; } case WM_PAINT: if (!valid) { valid = TRUE; ReloadDialog(); } return FALSE; case WM_VSCROLL: VScroll(LOWORD(wParam),(short int)HIWORD(wParam)); break; case WM_COMMAND: switch (id) { case IDC_COMP_TEX1: PostMessage(hwmedit,WM_TEXMAP_BUTTON,theTex->offset,(LPARAM)theTex); break; case IDC_COMP_TEX2: PostMessage(hwmedit,WM_TEXMAP_BUTTON,theTex->offset+1,(LPARAM)theTex); break; case IDC_COMP_TEX3: PostMessage(hwmedit,WM_TEXMAP_BUTTON,theTex->offset+2,(LPARAM)theTex); break; case IDC_COMP_TEX4: PostMessage(hwmedit,WM_TEXMAP_BUTTON,theTex->offset+3,(LPARAM)theTex); break; case IDC_COMP_TEX5: PostMessage(hwmedit,WM_TEXMAP_BUTTON,theTex->offset+4,(LPARAM)theTex); break; case IDC_COMP_TEX6: PostMessage(hwmedit,WM_TEXMAP_BUTTON,theTex->offset+5,(LPARAM)theTex); break; case IDC_MAPON1: case IDC_MAPON2: case IDC_MAPON3: case IDC_MAPON4: case IDC_MAPON5: case IDC_MAPON6: theTex->pblock->SetValue(comptex_ons,0,GetCheckBox(hWnd, id),id-IDC_MAPON1+theTex->offset); // theTex->mapOn[id-IDC_MAPON1+theTex->offset] = GetCheckBox(hWnd, id); theTex->NotifyChanged(); break; case IDC_COMP_SETNUM: SetNumMaps(); break; } break; case WM_DESTROY: Destroy(hWnd); break; } return FALSE; }
CExtGridCellEx* PropertiesBar::AddPropertyItemToTree(CPropItem& item, CExtPropertyItem* pRoot, CString& retStr, PropReturn& Return) { CExtGridCellString* pString; CExtGridCellDropListComboBox* pCombo; CExtGridCellNumber* pNumber; CExtGridCellCurrency* pCurr; CExtGridCellCheckBox* pCheck; CExtGridCellColor* pColor; CExtGridCellHyperLink* pLink; CExtGridCellSlider* pSlider; CExtGridCellFont* pFont; switch (item.Type) { // Edit case 0: { pString = GetEdit(pRoot); pString->TextSet(retStr); return pString; } // Static case 1: { pString = GetEdit(pRoot); pString->TextSet(retStr); pString->ModifyStyle(__EGCS_READ_ONLY | __EGCS_NO_INPLACE_CONTROL); return pString; } // Button case 2: { pLink = GetHyperLink(pRoot); pLink->TextSet(item.Text); return pLink; } // Value case 3: { pNumber = GetInteger(pRoot); pNumber->_VariantAssign(Return.val); return pNumber; } // Combo case 4: { pCombo = GetCombo(pRoot); // Add items CString Work = item.Text; int count = Work.Replace("|", ""); count++; for (int e = 0; e < count; e++) { CString tok; AfxExtractSubString(tok, item.Text, e, '|'); pCombo->InsertString(tok); } pCombo->SetCurSel(Return.val); return pCombo; } // Float case 5: { pNumber = GetFloat(pRoot); pNumber->_VariantAssign(Return.fVal); return pNumber; } // Color case 6: { pColor = GetColor(pRoot); pColor->SetColor((COLORREF)Return.val); return pColor; } // Checkbox (bool) case 7: { pCheck = GetCheckBox(pRoot); pCheck->SetCheck(Return.val); return pCheck; } // Font case 8: { pFont = GetFont(pRoot); return pFont; } // Percentage case 9: { pCurr = GetPercent(pRoot); pCurr->_VariantAssign(Return.fVal * 100.0); return pCurr; } // Slider (same as value) case 10: { pSlider = GetSlider(pRoot); pSlider->SetPos(Return.val); return pSlider; } // Frame property (int) case 11: { pCombo = GetCombo(pRoot); // Add frames for (int e = 0; e < m_pCurrentApplication->layouts.GetSize(); e++) pCombo->InsertString(m_pCurrentApplication->layouts.GetAt(m_pCurrentApplication->layouts.FindIndex(e))->GetName()); pCombo->SetCurSel(Return.val); return pCombo; } } // Invalid return NULL; }
void CTexturePropDlg::OnOk() { TCHAR theText[200]; if(GetDlgItemText(IDC_TEXTUREPROP_FLAGS, theText, 200) != 0) { m_TextureFlags = atoi(theText); } if(GetDlgItemText(IDC_TEXTURE_GROUP, theText, 200) != 0) { m_TextureGroup = atoi(theText); } if(GetDlgItemText(IDC_DTX_NONS3TCMIPMAPOFFSET, theText, 200) != 0) { m_NonS3TCMipmapOffset = atoi(theText); } if(GetDlgItemText(IDC_UIMIPMAPOFFSET, theText, 200) != 0) { m_UIMipmapOffset = atoi(theText); } if(GetDlgItemText(IDC_TEXTUREPRIORITY, theText, 200) != 0) { m_TexturePriority = atoi(theText); } if(GetDlgItemText(IDC_DETAILTEXTURESCALE, theText, 200) != 0) { m_DetailTextureScale = (float)atof(theText); } if(GetDlgItemText(IDC_DETAILTEXTUREANGLE, theText, 200) != 0) { m_DetailTextureAngle = atoi(theText); } if(GetDlgItemText(IDC_NUMBER_OF_MIPMAPS, theText, 200) != 0) { m_nMipmaps = atoi(theText); // Make sure they enter a valid range. if(m_nMipmaps <= 0 || m_nMipmaps > MAX_DTX_MIPMAPS) { AppMessageBox(IDS_INVALID_MIPMAP_COUNT, MB_OK); return; } } m_bFullBrights = GetCheckBox(IDC_FULLBRITE); m_b32BitSysCopy= GetCheckBox(IDC_32BITSYSCOPY); m_bNoSysCache = GetCheckBox(IDC_NOSYSCACHE); m_bPrefer4444 = GetCheckBox(IDC_PREFER4444); m_bPrefer5551 = GetCheckBox(IDC_PREFER5551); m_bPrefer16Bit = GetCheckBox(IDC_PREFER16BIT); GetDlgItemText(IDC_DTX_COMMAND_STRING2, m_CommandString, sizeof(m_CommandString)); EndDialog(IDOK); }
void PropertiesBar::DoAppProperties() { CExtPropertyItem* pRoot; CExtPropertyItem* pItem; CExtGridCellString* pString; CExtGridCellDropListComboBox* pCombo; CExtGridCellNumber* pNumber; CExtGridCellCheckBox* pCheck; CExtGridCellHyperLinkEx* pLink; CApplication* app = m_pCurrentApplication; ////////////////////////// // INFORMATION CATEGORY /////////////////////////////////////////////////// pRoot = InsertCategory(PROPERTIES_INFORMATION, PROPERTIES_DESC_INFORMATION); pItem = InsertAppItem(PROPERTIES_CREATOR, PROPERTIES_DESC_CREATOR, pRoot); pString = GetEdit(pItem); pString->TextSet(app->file_information.creator); pItem->ValueActiveFromDefault(); pItem = InsertAppItem(PROPERTIES_TITLE, PROPERTIES_DESC_TITLE, pRoot); pString = GetEdit(pItem); pString->TextSet(app->file_information.name); pItem->ValueActiveFromDefault(); ///////////////////// // WINDOW CATEGORY /////////////////////////////////////////////////// pRoot = InsertCategory(PROPERTIES_WINDOW, PROPERTIES_DESC_WINDOW); pItem = InsertAppItem("Menu", "Show a menu by default.", pRoot); pCheck = GetCheckBox(pItem); pCheck->SetCheck(app->window_information.show_menu); pItem->ValueActiveFromDefault(); pItem = InsertAppItem("Caption", "Have a window titlebar and border.", pRoot); pCheck = GetCheckBox(pItem); pCheck->SetCheck(app->window_information.caption); pItem->ValueActiveFromDefault(); pItem = InsertAppItem("Resizing", "Make the window resizable and decide what happens when the window is resized.", pRoot); pCombo = GetCombo(pItem); pCombo->InsertString("Disabled"); pCombo->InsertString("Show more window content"); // Stretch option only available to DX games if (m_pCurrentApplication->runtime == CApplication::rt_directx) pCombo->InsertString("Stretch window content"); pCombo->SetCurSel(app->window_information.resizable); pItem->ValueActiveFromDefault(); pItem = InsertAppItem("Minimize Box", "Show a minimize box on the application window.", pRoot); pCheck = GetCheckBox(pItem); pCheck->SetCheck(app->window_information.minimize_box); pItem->ValueActiveFromDefault(); pItem = InsertAppItem("Maximize Box", "Show a maximize box on the application window.", pRoot); pCheck = GetCheckBox(pItem); pCheck->SetCheck(app->window_information.maximize_box); pItem->ValueActiveFromDefault(); pItem = InsertAppItem(PROPERTIES_WINDOWWIDTH, PROPERTIES_DESC_WINDOWWIDTH, pRoot); pNumber = GetInteger(pItem); pNumber->_VariantAssign(app->window_information.window_width); pItem->ValueActiveFromDefault(); pItem = InsertAppItem(PROPERTIES_WINDOWHEIGHT, PROPERTIES_DESC_WINDOWHEIGHT, pRoot); pNumber = GetInteger(pItem); pNumber->_VariantAssign(app->window_information.window_height); pItem->ValueActiveFromDefault(); pItem = InsertAppItem("Eye Distance (3d)", "If you use 3d box or a 3d mesh distortion, this value determines how far back the eye of the viewer is from the screen", pRoot); pNumber = GetFloat(pItem); pNumber->_VariantAssign(app->window_information.eye_distance); pItem->ValueActiveFromDefault(); ////////////////////// // RUNTIME CATEGORY /////////////////////////////////////////////////// pRoot = InsertCategory(PROPERTIES_CRUNTIME, PROPERTIES_DESC_CRUNTIME); pItem = InsertAppItem("Enable Scripting", "Enable Python scripting. Requires Python26.dll redistribution.", pRoot); pCheck = GetCheckBox(pItem); pCheck->SetCheck(app->game_information.use_python); pItem->ValueActiveFromDefault(); if (m_pCurrentApplication->runtime == CApplication::rt_directx) { pItem = InsertAppItem(PROPERTIES_FRAMERATEMODE, PROPERTIES_DESC_FRAMERATEMODE, pRoot); pCombo = GetCombo(pItem); pCombo->InsertString(PROPERTIES_VSYNCED); pCombo->InsertString(PROPERTIES_UNLIMITED); pCombo->InsertString(PROPERTIES_FIXED); pCombo->SetCurSel(app->game_information.fps_mode); pItem->ValueActiveFromDefault(); pItem = InsertAppItem(PROPERTIES_FPS, PROPERTIES_DESC_FPS, pRoot); pNumber = GetInteger(pItem); pNumber->_VariantAssign(app->game_information.fps); pItem->ValueActiveFromDefault(); pItem = InsertAppItem("FPS in caption", "Show the framerate in the window caption.", pRoot); pCheck = GetCheckBox(pItem); pCheck->SetCheck(app->game_information.fps_in_caption); pItem->ValueActiveFromDefault(); pItem = InsertAppItem(PROPERTIES_FULLSCREEN, PROPERTIES_DESC_FULLSCREEN, pRoot); pCheck = GetCheckBox(pItem); pCheck->SetCheck(app->game_information.fullscreen); pItem->ValueActiveFromDefault(); } pItem = InsertAppItem(PROPERTIES_RUNTIME, PROPERTIES_DESC_RUNTIME, pRoot); pCombo = GetCombo(pItem); pCombo->InsertString(PROPERTIES_APPLICATION); pCombo->InsertString(_T("Direct-X 9")); pCombo->SetCurSel(app->runtime); pItem->ValueActiveFromDefault(); // SDL not yet implemented -AG /* if (m_pCurrentApplication->m_Runtime == RUNTIME_SDL) { pItem = InsertAppItem(_T("Use hardware"), _T("SDL will use hardware acceleration where available."), pRoot); pCheck = GetCheckBox(pItem); pCheck->SetCheck(m_pCurrentApplication->m_SDLUseHardware); pItem->ValueActiveFromDefault(); } */ if (m_pCurrentApplication->runtime == CApplication::rt_directx) { pItem = InsertAppItem(_T("Load Textures"), _T("Specify when object textures are loaded in to VRAM."), pRoot); pCombo = GetCombo(pItem); pCombo->InsertString(_T("On application start")); pCombo->InsertString(_T("Per layout")); pCombo->SetCurSel((int)app->game_information.texture_loading); pItem->ValueActiveFromDefault(); pItem = InsertAppItem(_T("Sampling"), _T("Specify point or linear sampling for rotations and scaling."), pRoot); pCombo = GetCombo(pItem); pCombo->InsertString(_T("Point")); pCombo->InsertString(_T("Linear")); pCombo->SetCurSel((int)app->game_information.sampler); pItem->ValueActiveFromDefault(); pItem = InsertAppItem(_T("Text rendering"), _T("Specify the quality of the text rendering."), pRoot); pCombo = GetCombo(pItem); pCombo->InsertString(_T("Aliased")); pCombo->InsertString(_T("Antialiased")); pCombo->InsertString(_T("Cleartype")); pCombo->SetCurSel((int)app->game_information.text_rendering_mode); pItem->ValueActiveFromDefault(); pItem = InsertAppItem(_T("Multisampling"), _T("Antialiasing of object edges"), pRoot); pCombo = GetCombo(pItem); pCombo->InsertString(_T("Off")); pCombo->InsertString(_T("2x")); pCombo->InsertString(_T("4x")); pCombo->InsertString(_T("8x")); pCombo->SetCurSel((int)app->game_information.multisamples); pItem->ValueActiveFromDefault(); } // Advanced timedelta settings subcategory pRoot = InsertCategory("Advanced", "Advanced runtime settings", pRoot); pItem = InsertAppItem("Minimum FPS", "Minimum framerate. Game slows down below this point to compensate.", pRoot); pNumber = GetFloat(pItem); pNumber->_VariantAssign(app->game_information.minimum_fps); pItem->ValueActiveFromDefault(); pItem = InsertAppItem("Override TimeDelta", "Override the time delta such that a constant value is returned.", pRoot); pCheck = GetCheckBox(pItem); pCheck->SetCheck(app->game_information.override_timedelta); pItem->ValueActiveFromDefault(); pItem = InsertAppItem("Timer FPS", "The intended framerate. TimeDelta will evaluate to 1 divided by this value.", pRoot); pNumber = GetInteger(pItem); pNumber->_VariantAssign(app->game_information.time_delta_override); pItem->ValueActiveFromDefault(); if (m_pCurrentApplication->runtime == CApplication::rt_directx) { pRoot = InsertCategory("Effects", "Settings and information about this application's pixel shaders and effects."); CString s; CD3DDisplay* pDisplay = m_pCurrentApplication->m_display; if (pDisplay != NULL) { // For version checking shaders UINT ps_major = D3DSHADER_VERSION_MAJOR(pDisplay->GetD3DCaps()->PixelShaderVersion); UINT ps_minor = D3DSHADER_VERSION_MINOR(pDisplay->GetD3DCaps()->PixelShaderVersion); s.Format("PS %d.%d", ps_major, ps_minor); } else s = "Unknown"; pItem = InsertAppItem("Shader version", "Your computer's supported pixel shader version.", pRoot); pString = GetEdit(pItem); pString->ModifyStyle(__EGCS_READ_ONLY | __EGCS_NO_INPLACE_CONTROL); pString->TextSet(s); pItem->ValueActiveFromDefault(); pItem = InsertAppItem(_T("Run without PS"), _T("Allow effects not supported by hardware to be disabled, and continue running game."), pRoot); pCheck = GetCheckBox(pItem); pCheck->SetCheck(m_pCurrentApplication->game_information.run_without_ps); pItem->ValueActiveFromDefault(); pItem = InsertAppItem("Simulate shader", "Simulate limited pixel shader capability for testing.", pRoot); pCombo = GetCombo(pItem); pCombo->AddString("(no override)"); pCombo->AddString("PS 1.4"); pCombo->AddString("PS 1.1"); pCombo->AddString("PS 0.0"); pCombo->SetCurSel((int)m_pCurrentApplication->game_information.simulate_shaders); pItem->ValueActiveFromDefault(); int MotionBlurCombo[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20 }; pItem = InsertAppItem("Motion Blur", "Enable a global motion blur effect at runtime.", pRoot); pCombo = GetCombo(pItem); pCombo->AddString("Off"); pCombo->AddString("2x (lowest quality)"); pCombo->AddString("3x"); pCombo->AddString("4x"); pCombo->AddString("5x (recommended)"); pCombo->AddString("6x"); pCombo->AddString("7x"); pCombo->AddString("8x"); pCombo->AddString("9x"); pCombo->AddString("10x"); pCombo->AddString("15x"); pCombo->AddString("20x (highest quality)"); int x; for (x = 0; x < 12; x++) { if (MotionBlurCombo[x] == m_pCurrentApplication->game_information.motion_blur_steps) break; } pCombo->SetCurSel(x); pItem->ValueActiveFromDefault(); } /* pRoot = InsertCategory(PROPERTIES_GLOBALVARS, PROPERTIES_DESC_GLOBALVARS); // Add global vars list<CApplication::GlobalVariable>::iterator g = m_pCurrentApplication->global_variables.begin(); list<CApplication::GlobalVariable>::iterator globals_end = m_pCurrentApplication->global_variables.end(); for ( ; g != globals_end; g++) { pItem = InsertGlobalItem(g->name, PROPERTIES_DESC_GLOBALVAR, pRoot); pString = GetEdit(pItem); pString->TextSet(g->value); pItem->ValueActiveFromDefault(); } pItem = InsertAppItem(PROPERTIES_EDITGLOBALS, PROPERTIES_DESC_EDITGLOBALS , pRoot); pLink = GetHyperLink(pItem); pLink->TextSet(PROPERTIES_ADD_EDIT); pItem->ValueActiveFromDefault();*/ CExtPropertyItem* pTransitionRoot = InsertCategory("Transitions", "A list of all transitions available to the application."); list<CTransition>::iterator t = m_pCurrentApplication->m_Transitions.begin(); for ( ; t != m_pCurrentApplication->m_Transitions.end(); t++) { CExtPropertyItem* pTransitionCat = InsertCategory(t->m_Name, "", pTransitionRoot); pItem = InsertTransitionItem("Name", "", &(*t), pTransitionCat); pString = GetEdit(pItem); pString->TextSet(t->m_Name); pItem->ValueActiveFromDefault(); // Add each of the transition's properties. vector<EffectParameter>::iterator i = t->params.begin(); const vector<EffectParameter>::const_iterator params_end = t->params.end(); for ( ; i != params_end; i++) { // Make a fake set of information to represent this property and add it CPropItem item; item.Description = i->description; item.Label = i->name; item.Type = i->type; item.Text = "???"; CString itemText = i->value; PropReturn itemValue; itemValue.fVal = atof(itemText); itemValue.val = atoi(itemText); itemValue.val64 = _atoi64(itemText); pItem = InsertTransitionItem(item.Label, item.Description, &(*t), pTransitionCat); AddPropertyItemToTree(item, pItem, itemText, itemValue); pItem->ValueActiveFromDefault(); } pItem = InsertTransitionItem("Remove", "", &(*t), pTransitionCat); pLink = GetHyperLink(pItem); pLink->TextSet("Remove"); pItem->ValueActiveFromDefault(); } pItem = InsertAppItem("Add transition", "Click to add a new transition.", pTransitionRoot); pLink = GetHyperLink(pItem); pLink->TextSet(PROPERTIES_ADD_EDIT); pItem->ValueActiveFromDefault(); // Event lists /*CExtPropertyItem* pEventSheetRoot = InsertCategory("Event Sheets", "A list of all event sheets in the application."); list<EventSheet*>::iterator e = m_pCurrentApplication->event_sheets.begin(); for ( ; e != m_pCurrentApplication->event_sheets.end(); e++) { CExtPropertyItem* pEventSheet = InsertEventSheetItem((*e)->GetName(), "", (*e), pEventSheetRoot); pLink = GetHyperLink(pEventSheet); pLink->TextSet("Edit"); pEventSheet->ValueActiveFromDefault(); } pItem = InsertAppItem("Manage Event Sheets", "Click to edit and delete all the application's event sheets.", pEventSheetRoot); pLink = GetHyperLink(pItem); pLink->TextSet(PROPERTIES_ADD_EDIT); pItem->ValueActiveFromDefault();*/ pRoot = InsertCategory("Grouping", "Modify the grouping tools in this application."); pItem = InsertAppItem("Edit Attributes", "Click to edit which attributes are available in Construct.", pRoot); pLink = GetHyperLink(pItem); pLink->TextSet(PROPERTIES_ADD_EDIT); pItem->ValueActiveFromDefault(); pItem = InsertAppItem("Edit Families", "Click to edit which families are available in Construct.", pRoot); pLink = GetHyperLink(pItem); pLink->TextSet(PROPERTIES_ADD_EDIT); pItem->ValueActiveFromDefault(); pItem = InsertAppItem("Manage Families", "Click to edit which families are available in Construct.", pRoot); pLink = GetHyperLink(pItem); pLink->TextSet("Open"); pItem->ValueActiveFromDefault(); pRoot = InsertCategory("Controls", "Set the controls used for movements."); vector<BehaviorControl>::iterator c = app->m_Controls.begin(); for ( ; c != app->m_Controls.end(); c++) { CString label; label.Format("%s (P%d)", c->name, c->player + 1); pItem = InsertControlItem(label, "A control key.", c->player, pRoot); pCombo = GetCombo(pItem); int numElems = sizeof(controlTable) / sizeof(ControlTableEntry); for (int i = 0; i < numElems; i++) pCombo->InsertString(controlTable[i].name); pCombo->SetCurSel(c->comboIndex); pItem->ValueActiveFromDefault(); } pItem = InsertAppItem("Manage Controls", "Click to edit controls.", pRoot); pLink = GetHyperLink(pItem); pLink->TextSet(PROPERTIES_ADD_EDIT); pItem->ValueActiveFromDefault(); /* pRoot = InsertCategory("Python", "Setting for python script"); pItem = InsertAppItem("Manage Python", "Click to edit python distribution options.", pRoot); pLink = GetHyperLink(pItem); pLink->TextSet(PROPERTIES_ADD_EDIT); pItem->ValueActiveFromDefault(); */ /* pItem = InsertAppItem(_T("Runjlkj without PS"), _T(""), pRoot); pCheck = GetCheckBox(pItem); pCheck->SetCheck(m_pCurrentApplication->m_runWithoutPs); pItem->ValueActiveFromDefault(); */ }