AISwatchRef checkSwatchListForColor( AIColor& matchColor , AIReal tolerance ) { AISwatchRef currSwatch; AIColor currColor; int numSwatches = sAISwatchList->CountSwatches(NULL); //Loop through the swatches to see if the swatch is already there for (int i = 0 ; i < numSwatches ; i++ ) { currSwatch = sAISwatchList->GetNthSwatch(NULL, i); if (currSwatch) { sAISwatchList->GetAIColor(currSwatch, &currColor); string n1 = GetColorName(matchColor); string n2 = GetColorName(currColor); //if (GetColorName(matchColor) == GetColorName(currColor)) //{ // return currSwatch; //} //else { AIBoolean TintsCloseEnough = sAIRealMath->EqualWithinTol(currColor.c.c.tint, matchColor.c.c.tint, tolerance); AIBoolean ColorsSame = ColorIsEqual(currColor, matchColor, TRUE); if (currColor.kind == kCustomColor && ColorsSame && TintsCloseEnough ) { return currSwatch; } } } } return NULL; }
bool ColorIsBlack(const AIColor color) { if (color.kind == kCustomColor) { if (GetColorName(color) == MICR_BLACK_MAG_COLOR_NAME) { return FALSE; } AICustomColor cColor; sAICustomColor->GetCustomColor(color.c.c.color, &cColor); if ((GetColorName(color) == BLACK_COLOR_NAME) || ((cColor.kind == kCustomFourColor && sAIRealMath->EqualWithinTol(cColor.c.f.cyan, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(cColor.c.f.magenta, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(cColor.c.f.yellow, 0, TOLERANCE) && cColor.c.f.black > 0)) || ((cColor.kind == kCustomThreeColor && sAIRealMath->EqualWithinTol(cColor.c.rgb.red, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(cColor.c.rgb.green, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(cColor.c.rgb.blue, 0, TOLERANCE))) || ((cColor.kind == kCustomLabColor && sAIRealMath->EqualWithinTol(cColor.c.lab.a, 0, (TOLERANCE*255)) && sAIRealMath->EqualWithinTol(cColor.c.lab.b, 0, (TOLERANCE*255)) && cColor.c.lab.l < 100)) ) { return TRUE; } } else if ( (color.kind == kGrayColor && color.c.g.gray > 0) || (color.kind == kFourColor && sAIRealMath->EqualWithinTol(color.c.f.cyan, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(color.c.f.magenta, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(color.c.f.yellow, 0, TOLERANCE) && color.c.f.black > 0) || (color.kind == kFourColor && ////C=70 M=67 Y=64 K=74 sAIRealMath->EqualWithinTol(color.c.f.cyan, .7, TOLERANCE*2.5) && sAIRealMath->EqualWithinTol(color.c.f.magenta, .67, TOLERANCE*2.5) && sAIRealMath->EqualWithinTol(color.c.f.yellow, .64, TOLERANCE*2.5) && sAIRealMath->EqualWithinTol(color.c.f.black, .74, TOLERANCE*2.5)) || (color.kind == kFourColor && ////C=75 M=68 Y=67 K=90 sAIRealMath->EqualWithinTol(color.c.f.cyan, .75, TOLERANCE*2.5) && sAIRealMath->EqualWithinTol(color.c.f.magenta, .68, TOLERANCE*2.5) && sAIRealMath->EqualWithinTol(color.c.f.yellow, .67, TOLERANCE*2.5) && sAIRealMath->EqualWithinTol(color.c.f.black, .90, TOLERANCE*2.5)) || (color.kind == kThreeColor && sAIRealMath->EqualWithinTol(color.c.rgb.red, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(color.c.rgb.green, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(color.c.rgb.blue, 0, TOLERANCE)) ) { return TRUE; } return FALSE; }
string GetInnerPantoneColorNumber(AIColor color) { if (ColorIsPantone(color)) { return GetInnerPantoneColorNumber(GetColorName(color)); } return ""; }
bool ColorIsGripper(const AIColor color) { if (GetColorName(color) == GRIPPER_COLOR_NAME) { return true; } return false; }
LRESULT CColorCombo::OnDrawItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { UINT idControl = wParam; LPDRAWITEMSTRUCT pDrawItem = (LPDRAWITEMSTRUCT)lParam; if (!pDrawItem) return false; RECT rect = pDrawItem->rcItem; CAGBrush Brush(GetBkColor(pDrawItem->hDC)); ::FillRect(pDrawItem->hDC, &rect, Brush); ::InflateRect(&rect, -2, -1); COLORREF Color = RGB(255,255,255); if ((int)pDrawItem->itemID != -1) Color = (COLORREF)GetItemData(pDrawItem->itemID); if (Color == CLR_NONE || Color == CLR_DEFAULT) { HFONT hFont = (HFONT)::GetStockObject(ANSI_VAR_FONT); HFONT hOldFont = (HFONT)::SelectObject(pDrawItem->hDC, hFont); LPCSTR strText = (Color == CLR_NONE ? "Custom..." : "Off"); ::ExtTextOut(pDrawItem->hDC, rect.left, rect.top, ETO_CLIPPED | ETO_OPAQUE, &rect, strText, lstrlen(strText), NULL); ::SelectObject(pDrawItem->hDC, hOldFont); } else { ::FillRect(pDrawItem->hDC, &rect, CAGBrush(Color)); bool bDropDownItem = !(pDrawItem->itemState & ODS_COMBOBOXEDIT); if (bDropDownItem) { LPCSTR szColorName = GetColorName(Color); if (szColorName) { HFONT hFont = (HFONT)::GetStockObject(ANSI_VAR_FONT); HFONT hOldFont = (HFONT)::SelectObject(pDrawItem->hDC, hFont); int iOldMode = ::SetBkMode(pDrawItem->hDC, TRANSPARENT); int iGray = (299 * GetRValue(Color)) + (587 * GetGValue(Color)) + (114 * GetBValue(Color)); // NTSC conversion COLORREF TextColor = (iGray >= 127500 ? RGB(0,0,0) : RGB(255,255,255)); COLORREF lOldColor = ::SetTextColor(pDrawItem->hDC, TextColor); rect.left += 2; ::DrawText(pDrawItem->hDC, szColorName, lstrlen(szColorName), &rect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX); rect.left -= 2; ::SetTextColor(pDrawItem->hDC, lOldColor); ::SetBkMode(pDrawItem->hDC, iOldMode); ::SelectObject(pDrawItem->hDC, hOldFont); } } } if (pDrawItem->itemState & ODS_FOCUS || pDrawItem->itemState & ODS_SELECTED) { ::FrameRect(pDrawItem->hDC, &rect, Brush); ::InflateRect(&rect, +1, +1); ::DrawFocusRect(pDrawItem->hDC, &rect); } return 0; }
/* -------------------------------------------------------------------- */ static void SavePreferences(Widget w, XtPointer client, XtPointer call) { int i; FILE *fp; char *p, temp[100]; printf("Save Preferences: Writing ~/.ncplotrc\n"); if ((p = getenv("HOME")) == NULL) return; sprintf(buffer, "%s/.ncplotrc", p); if ((fp = fopen(buffer, "w+")) == NULL) return; strcpy(buffer, GetColorName(1)); for (i = 2; i < 8; ++i) { sprintf(temp, ", %s", GetColorName(i)); strcat(buffer, temp); } fprintf(fp, "Colors = %s\n", buffer); fprintf(fp, "LineWidth = %zu\n", LineThickness); fprintf(fp, "TemplateDirectory = %s\n", GetTemplateDirectory()); if (printerSetup.color) fprintf(fp, "PrintColor = Color\n"); fprintf(fp, "PrintCommand = %s\n", printerSetup.lpCommand.c_str()); fprintf(fp, "TrueAirspeed = %s\n", tasVarName.c_str()); fprintf(fp, "GpsLongitude = %s\n", gpsVariables[0]); fprintf(fp, "GpsLatitude = %s\n", gpsVariables[1]); fprintf(fp, "GpsAltitude = %s\n", gpsVariables[2]); fprintf(fp, "InertialLongitude = %s\n", insVariables[0]); fprintf(fp, "InertialLatitude = %s\n", insVariables[1]); fprintf(fp, "PressureAltitude = %s\n", insVariables[2]); fprintf(fp, "WindU = %s\n", windVariables[0]); fprintf(fp, "WindV = %s\n", windVariables[1]); fprintf(fp, "WindInterval = %s\n", windVariables[2]); fclose(fp); } /* SAVEPREFERENCES */
bool ColorIsPantone(const AIColor color) { //If the swatch name includes "PANTONE" return true string s = GetColorName(color); ai::UnicodeString colorName(s); if (colorName.caseFind(ai::UnicodeString("PANTONE"), 0) != string::npos) { return TRUE; } return FALSE; }
/* -------------------------------------------------------------------- */ void SetPreferences() { int i; char temp[100]; if (!PreferShell) return; strcpy(buffer, GetColorName(1)); for (i = 2; i < 8; ++i) { sprintf(temp, ", %s", GetColorName(i)); strcat(buffer, temp); } XmTextFieldSetString(prefText[0], buffer); sprintf(buffer, "%zu", LineThickness); XmTextFieldSetString(prefText[1], buffer); XmTextFieldSetString(prefText[2], GetTemplateDirectory()); if (printerSetup.color) XmTextFieldSetString(prefText[3], (char *)"Color"); else XmTextFieldSetString(prefText[3], (char *)"B&W"); XmTextFieldSetString(prefText[4], const_cast<char *>(printerSetup.lpCommand.c_str())); XmTextFieldSetString(prefText[5], const_cast<char *>(tasVarName.c_str())); XmTextFieldSetString(prefText[6], gpsVariables[1]); XmTextFieldSetString(prefText[7], gpsVariables[0]); XmTextFieldSetString(prefText[8], gpsVariables[2]); XmTextFieldSetString(prefText[9], insVariables[1]); XmTextFieldSetString(prefText[10], insVariables[0]); XmTextFieldSetString(prefText[11], insVariables[2]); XmTextFieldSetString(prefText[12], windVariables[0]); XmTextFieldSetString(prefText[13], windVariables[1]); XmTextFieldSetString(prefText[14], windVariables[2]); } /* END SETPREFERENCES */
void CColorPopup::CreateToolTips() { // Create the tool tip if (!m_ToolTip.Create(this)) return; // Add a tool for each cell for (int i = 0; i < m_nNumColors; i++) { CRect rect; if (!GetCellRect(i, rect)) continue; m_ToolTip.AddTool(this, GetColorName(i), rect, 1); } }
bool ColorIsWhite(const AIColor color) { if (color.kind == kCustomColor) { AICustomColor cColor; sAICustomColor->GetCustomColor(color.c.c.color, &cColor); if ((GetColorName(color) == "White") || ((cColor.kind == kCustomFourColor && sAIRealMath->EqualWithinTol(cColor.c.f.cyan, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(cColor.c.f.magenta, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(cColor.c.f.yellow, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(cColor.c.f.black, 0, TOLERANCE))) || ((cColor.kind == kCustomThreeColor && sAIRealMath->EqualWithinTol(cColor.c.rgb.red, 1, TOLERANCE) && sAIRealMath->EqualWithinTol(cColor.c.rgb.green, 1, TOLERANCE) && sAIRealMath->EqualWithinTol(cColor.c.rgb.blue, 1, TOLERANCE))) || ((cColor.kind == kCustomLabColor && sAIRealMath->EqualWithinTol(cColor.c.lab.a, 0, (TOLERANCE*255)) && sAIRealMath->EqualWithinTol(cColor.c.lab.b, 0, (TOLERANCE*255)) && sAIRealMath->EqualWithinTol(cColor.c.lab.l, 100, (TOLERANCE*255)))) ) { return TRUE; } } else if ( (color.kind == kGrayColor && sAIRealMath->EqualWithinTol(color.c.g.gray, 0, TOLERANCE)) || (color.kind == kFourColor && sAIRealMath->EqualWithinTol(color.c.f.cyan, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(color.c.f.magenta, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(color.c.f.yellow, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(color.c.f.black, 0, TOLERANCE)) || (color.kind == kThreeColor && sAIRealMath->EqualWithinTol(color.c.rgb.red, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(color.c.rgb.green, 0, TOLERANCE) && sAIRealMath->EqualWithinTol(color.c.rgb.blue, 0, TOLERANCE)) ) { return TRUE; } return FALSE; }
void COptionTreeColorPopUp::CreateToolTips() { // Create the tool tip if (!m_ttToolTip.Create(this)) { return; } // Add a tool for each cell for (int i = 0; i < m_nNumColors; i++) { CRect rect; if (!GetCellRect(i, rect)) { continue; } m_ttToolTip.AddTool(this, GetColorName(i), rect, 1); } // Create inactive m_ttToolTip.Activate(TRUE); }
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 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; }