BOOL CChromaDlg::OnCommand(WPARAM wParam, LPARAM lParam) { HWND hDlg = GetSafeHwnd(); BOOL bReturn = TRUE; UINT id = LOWORD(wParam); HWND hControl = (HWND)lParam; int codeNotify = HIWORD(wParam); int i; long Color; HWND hActiveWnd; char Buff[10]; BYTE mask; hActiveWnd = m_pView->GetSafeHwnd(); switch (id) { case IDC_CHROMASELECT: i = TableHandleCombo(hDlg, &iCombo[0], nCombo, id, codeNotify); if (i != IDC_CHROMA_NORMAL && i != IDC_CHROMA_HSL && i != IDC_CHROMA_LUMIN) break; lpChromaMask->ChromaColorMode = i; lpChromaMask->SetupChroma(); break; case IDC_MAP_PROBE: ::GetWindowText(hControl, Buff, 10); id = atoi(Buff); if (id < 1 || id > 8) break; id += IDC_MASKCOLOR1 - 1; GetDlgItem(id)->ShowWindow(SW_SHOW); GetDlgItem(id)->SetFocus(); ::ShowWindow(hControl, SW_HIDE); case IDC_MASKCOLOR1: case IDC_MASKCOLOR2: case IDC_MASKCOLOR3: case IDC_MASKCOLOR4: case IDC_MASKCOLOR5: case IDC_MASKCOLOR6: case IDC_MASKCOLOR7: case IDC_MASKCOLOR8: lpChromaMask->ActiveChromaMask = i = id - IDC_MASKCOLOR1; if (codeNotify != 1 /*Not A DoubleClick*/) { if (hActiveWnd) bProbePending = YES; } else { bProbePending = NO; if (!ColorPicker(&lpChromaMask->MaskColor[i], NULL)) break; CopyRGB(&lpChromaMask->MaskColor[i].rgb, &Color); SetWindowLong(::GetDlgItem(hDlg, id), GWL_ACTIVE, Color); AstralControlRepaint(hDlg, IDC_MASKCOLOR1+i); } mask = 1 << (id - IDC_MASKCOLOR1); if (lpChromaMask->Mask & mask) break; id = id - IDC_MASKCOLOR1 + IDC_MASKACTIVE1; case IDC_MASKACTIVE1: case IDC_MASKACTIVE2: case IDC_MASKACTIVE3: case IDC_MASKACTIVE4: case IDC_MASKACTIVE5: case IDC_MASKACTIVE6: case IDC_MASKACTIVE7: case IDC_MASKACTIVE8: { mask = 1 << (id - IDC_MASKACTIVE1); lpChromaMask->Mask ^= mask; CheckDlgButton(id, lpChromaMask->Mask & mask); lpChromaMask->SetupChroma(); } break; case IDC_CHROMA_FADE: if (::GetFocus() != ::GetDlgItem(hDlg, id)) break; if ( codeNotify == EN_CHANGE ) { BOOL Bool; lpChromaMask->Fade = GetDlgItemSpin(hDlg, id, &Bool, NO); lpChromaMask->SetupChroma(); } break; case IDC_MASKRANGE1: case IDC_MASKRANGE2: case IDC_MASKRANGE3: case IDC_MASKRANGE4: case IDC_MASKRANGE5: case IDC_MASKRANGE6: case IDC_MASKRANGE7: case IDC_MASKRANGE8: if (::GetFocus() != ::GetDlgItem(hDlg, id)) break; if ( codeNotify == EN_CHANGE ) { BOOL Bool; lpChromaMask->MaskRange[id-IDC_MASKRANGE1] = GetDlgItemSpin(hDlg, id, &Bool, NO); lpChromaMask->SetupChroma(); } break; case IDC_MASKMODE_ADD: case IDC_MASKMODE_SUBTRACT: case IDC_MASKMODE_REVERSE: lpChromaMask->ChromaCombineMode = SHAPE_REVERSE + (id - IDC_MASKMODE_REVERSE); CheckRadioButton(IDC_MASKMODE_REVERSE, IDC_MASKMODE_SUBTRACT,id); break; case IDC_DELETEMASK: lpChromaMask->Delete = !lpChromaMask->Delete; CheckDlgButton(id, lpChromaMask->Delete); break; case IDC_CHROMA: if (hActiveWnd) { idLastTool = ActivateTool(id); CreateProc(hActiveWnd, 0, 0, this); bPreview = YES; } break; case IDC_RESET: if ( bPreview ) DeactivateTool(); bPreview = NO; break; default: bReturn = FALSE; break; } return bReturn ? bReturn : CPPViewModalDlg::OnCommand(wParam, lParam); }
BOOL CMiscPrefPage::OnCommand(WPARAM wParam, LPARAM lParam) { HWND hActiveWnd = GetActiveDoc(); HWND hDlg = GetSafeHwnd(); int id = GET_WM_COMMAND_ID(wParam, lParam); UINT codeNotify = GET_WM_COMMAND_CMD(wParam, lParam); switch (id) { case IDC_PREF_POUCH: if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) ) break; if ( codeNotify != EN_CHANGE ) break; ::GetDlgItemText( hDlg, id, Control.PouchPath, sizeof(Control.PouchPath)); FixPath( Lowercase( Control.PouchPath ) ); SetModified(TRUE); break; case IDC_PREF_TABLET: // case IDC_PREF_TABLETUNUSED: // case IDC_PREF_TABLETOPACITY: // case IDC_PREF_TABLETSIZE: // case IDC_PREF_TABLETBOTH: if ( !(id = HandleCombo( hDlg, id, codeNotify )) ) break; Control.UseTablet = id-IDC_PREF_TABLETUNUSED; SetModified(TRUE); break; case IDC_PREF_STARTMACRO: GetExtNameN( hDlg, id, IDC_FILENAME, Names.StartMacro, IDN_MACRO, codeNotify, IDS_NONE, NO ); SetModified(TRUE); break; case IDC_PREF_MASKTINT: // case IDC_PREF_MASKTINT1: // case IDC_PREF_MASKTINT2: // case IDC_PREF_MASKTINT3: // case IDC_PREF_MASKTINT4: // case IDC_PREF_MASKTINT5: // case IDC_PREF_MASKTINT6: if ( !(id = HandleCombo( hDlg, id, codeNotify )) ) break; Control.MaskTint = id - IDC_PREF_MASKTINT1; SetModified(TRUE); break; case IDC_PREF_TOOLSETTINGS: Control.IndependentSettings = !Control.IndependentSettings; ::CheckDlgButton(hDlg, id, Control.IndependentSettings); SetModified(TRUE); break; case IDC_CMS_ENABLED: Control.CMSEnabled = CMSOpen( !Control.CMSEnabled ); ::CheckDlgButton(hDlg, id, Control.CMSEnabled); SetModified(TRUE); break; case IDC_PREF_PASTEATREALSIZE: Mask.PasteAtRealSize = !Mask.PasteAtRealSize; ::CheckDlgButton( hDlg, IDC_PREF_PASTEATREALSIZE, Mask.PasteAtRealSize); SetModified(TRUE); break; case IDC_PREF_USEGRAYSCALEICONS: Control.UseGrayScaleIcons = !Control.UseGrayScaleIcons; ::CheckDlgButton( hDlg, IDC_PREF_USEGRAYSCALEICONS, Control.UseGrayScaleIcons); SetModified(TRUE); break; case IDC_PREF_DISABLEAUTOSCROLL: Control.DisableAutoScroll = !Control.DisableAutoScroll; ::CheckDlgButton( hDlg, IDC_PREF_DISABLEAUTOSCROLL, Control.DisableAutoScroll); SetModified(TRUE); break; case IDC_PREF_DISABLEDITHER: Vignette.DisableDither = !Vignette.DisableDither; ::CheckDlgButton( hDlg, IDC_PREF_DISABLEDITHER, Vignette.DisableDither); SetModified(TRUE); break; case IDC_PREF_FILETYPE: if( Control.Retail ) { if (! (id = TableHandleCombo(hDlg, FileType_Table, sizeof(FileType_Table)/sizeof(ITEMID), id, codeNotify))) break; } else { if (! (id = TableHandleCombo(hDlg, FileType_TableOEM, sizeof(FileType_TableOEM)/sizeof(ITEMID), id, codeNotify))) break; } Control.DefaultFileType = AppFileType(id); SetModified(TRUE); break; default: return (CPPPropertyPage::OnCommand(wParam, lParam)); break; } return(TRUE); }