#include "ImgPF.h" L_BOOL bClamp; L_UINT uOldFlags[3]; LPCLRTHRDLGDATA pTClrThr; LRESULT CALLBACK WP_ClrThrRangeCheck (HWND hWnd, L_UINT uMessage, WPARAM wParam, LPARAM lParam); static L_BOOL ClrThrDlg_OnInitDialog (HWND hWnd, HWND hWndFocus, LPARAM lParam); static L_VOID ClrThrDlg_OnCommand (HWND hWnd, L_INT nID, HWND hWndCtl, UINT CodeNotify); static L_VOID ClrThrDlg_OnHScroll (HWND hWnd, HWND hWndCtl, L_UINT uCode, L_INT nPos); static L_VOID ClrThrDlg_OnTimer (HWND hWnd, L_INT nID); static L_VOID L_ApplyFilter (HWND hWnd); L_BOOL CALLBACK ClThDlgProc(HWND hWnd, L_UINT uMessage, WPARAM wParam, LPARAM lParam) { switch(uMessage) { HANDLE_MSG(hWnd, WM_INITDIALOG, ClrThrDlg_OnInitDialog); HANDLE_MSG(hWnd, WM_COMMAND, ClrThrDlg_OnCommand); HANDLE_MSG(hWnd, WM_HSCROLL, ClrThrDlg_OnHScroll); HANDLE_MSG(hWnd, WM_TIMER, ClrThrDlg_OnTimer); case WM_USER_UPDATEVIEW: StatusProc.ProgressValue = 100; L_ApplyFilter(hWnd); break; } return FALSE; } L_VOID SetFlags(HWND hWnd, L_UINT uFlags) { LPCLRTHRDLGDATA pClrThr; L_INT nCounter; pClrThr = (LPCLRTHRDLGDATA) GetWindowLong(hWnd, GWL_USERDATA); for (nCounter = 0; nCounter < pClrThr->nRadioNum; nCounter++) { Button_SetCheck(GetDlgItem(hWnd, IDC_CLTH_BASS_RAD + nCounter), FALSE); } if (!((pClrThr->pCompData[pClrThr->uCurrentComp].uFlags) & 0x00f)) Button_SetCheck(GetDlgItem(hWnd, IDC_CLTH_BASS_RAD), TRUE); else Button_SetCheck(GetDlgItem(hWnd, IDC_CLTH_REJECT_RAD), TRUE); if (!((pClrThr->pCompData[pClrThr->uCurrentComp].uFlags) & 0x0f0)) Button_SetCheck(GetDlgItem(hWnd, IDC_CLTH_CHNL_RAD), TRUE); else Button_SetCheck(GetDlgItem(hWnd, IDC_CLTH_PIX_RAD), TRUE); if (!((pClrThr->pCompData[pClrThr->uCurrentComp].uFlags) & 0xf00)) Button_SetCheck(GetDlgItem(hWnd, IDC_CLTH_MIN_RAD), TRUE); else if (((pClrThr->pCompData[pClrThr->uCurrentComp].uFlags) & 0xf00) == CLTH_VALUE_CLAMP) Button_SetCheck(GetDlgItem(hWnd, IDC_CLTH_CLAMP_RAD), TRUE); else Button_SetCheck(GetDlgItem(hWnd, IDC_CLTH_MAX_RAD), TRUE); } static L_BOOL ClrThrDlg_OnInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) { HWND hListBox; LPCLRTHRDLGDATA pClrThr; L_INT nCounter; L_INT nCounter1; pCHILDDATA pData; HWND hWndParent; L_INT nSlider; L_INT nRangeMax[] = { 255, 255, 255}; L_INT nRangeMin[] = { 0 , 0 }; L_INT nPosInit [] = { 0 , 255}; L_TCHAR L_FAR * ColorSpace[] = {TEXT("RGB"), TEXT("HSV"), TEXT("HLS"), TEXT("XYZ"), TEXT("YCC"), TEXT("YUV"), TEXT("LAB"), TEXT("CMY")}; hWndParent = FORWARD_WM_MDIGETACTIVE(hWndClient,SendMessage); pData = LOCKCHILDDATA(hWndParent); pClrThr = (LPCLRTHRDLGDATA)lParam; MoveDialogToMiddle(hWnd); StatusProc.bProgress = TRUE; StatusProc.bInvalidate = FALSE; StatusProc.bEnd = FALSE; StatusProc.DlgWnd = hWnd; StatusProc.ProgressValue = 100; StatusProc.ProgWnd = GetDlgItem(hWnd, IDC_CLTH_PROG); Progress_SetRange(StatusProc.ProgWnd, 0, 100); Progress_SetPos(StatusProc.ProgWnd, 0); MemorizeAndCopyBitmap(hWndParent, &pClrThr->LeadBitmap); if (Is16Bit(&pData->LeadBitmap)) { nRangeMax[0] = nRangeMax[1] = nRangeMax[2] = nPosInit[1] = 0xffff; } for (nCounter = 0; nCounter < 8; nCounter++) { for (nCounter1 = 0; nCounter1 < 3; nCounter1++) { pClrThr->Label[nCounter][nCounter1][0] = ColorSpace[nCounter][nCounter1]; pClrThr->Label[nCounter][nCounter1][1] = '\0'; } } pClrThr->nSldBaseID = IDC_CLTH_THR_MIN_SLD; pClrThr->nEdtBaseID = IDC_CLTH_THR_MIN_EDT; pClrThr->nRdoBaseID = IDC_CLTH_BASS_RAD; pClrThr->nSlideNum = 2; pClrThr->nRadioNum = 7; pClrThr->uCurrentComp = 0; pClrThr->uColorSpace = 0; pClrThr->pCompData[0].uStructSize = sizeof(COMPDATA); for (nCounter = 0; nCounter < 3; nCounter++) { uOldFlags[nCounter] = pClrThr->pCompData[nCounter].uFlags = 0; pClrThr->pCompData[nCounter].nMinRange = pClrThr->pCompBound[nCounter].nMinRange = 0; pClrThr->pCompData[nCounter].nMaxRange = pClrThr->pCompBound[nCounter].nMaxRange = nRangeMax[nCounter]; } for (nCounter = 0; nCounter <= 7; nCounter++) ComboBox_InsertString(GetDlgItem(hWnd, IDC_CLTH_SPACE_COM), nCounter, ColorSpace[nCounter]); hListBox = (HWND) GetDlgItem(hWnd, IDC_CLTH_SPACE_COM); ComboBox_SetCurSel(hListBox, pClrThr->uColorSpace); Button_SetCheck(GetDlgItem(hWnd, IDC_CLTH_BASS_RAD), TRUE); Button_SetCheck(GetDlgItem(hWnd, IDC_CLTH_1ST_RAD), TRUE); Button_SetCheck(GetDlgItem(hWnd, IDC_CLTH_CHNL_RAD), TRUE); Button_SetCheck(GetDlgItem(hWnd, IDC_CLTH_MIN_RAD), TRUE); bClamp = FALSE; SetWindowLong(hWnd, GWL_USERDATA, (long)pClrThr); for (nSlider = 0; nSlider < pClrThr->nSlideNum; nSlider++) { Trackbar_SetTheRange(GetDlgItem(hWnd, pClrThr->nSldBaseID + nSlider), TRUE, nRangeMin[nSlider], nRangeMax[nSlider]); Trackbar_SetPos(GetDlgItem(hWnd, pClrThr->nSldBaseID + nSlider), TRUE, nPosInit[nSlider]); SetDlgItemInt(hWnd, pClrThr->nEdtBaseID + nSlider, nPosInit[nSlider], TRUE); } pData->uTimerID = SetTimer(hWnd, 1, 100, NULL); return TRUE; } static L_VOID ClrThrDlg_OnTimer (HWND hWnd, L_INT nID) { Dialog_Timer(nID); } static L_VOID ClrThrDlg_OnCommand(HWND hWnd, L_INT nID, HWND hWndCtl, L_UINT uCodeNotify) { LPCLRTHRDLGDATA pClrThr; L_UINT uCurrentSpace; L_INT nValue; pCHILDDATA pData; HWND hWndParent; L_INT nRangeMax[] = { 255, 255}; L_INT nRangeMin[] = { 0 , 0 }; L_INT nIndex; L_BOOL bIs16BitPerCmp; pClrThr = (LPCLRTHRDLGDATA) GetWindowLong(hWnd, GWL_USERDATA); hWndParent = FORWARD_WM_MDIGETACTIVE(hWndClient,SendMessage); pData = LOCKCHILDDATA (hWndParent); if ((pClrThr->LeadBitmap.BitsPerPixel == 12) || (pClrThr->LeadBitmap.BitsPerPixel == 16) || (pClrThr->LeadBitmap.BitsPerPixel == 48) || (pClrThr->LeadBitmap.BitsPerPixel == 64)) { nRangeMax[0] = nRangeMax[1] = 0xffff; } switch (nID) { case IDCANCEL: StatusProc.bProgress = FALSE; StatusProc.bKillProgress = TRUE ; StatusProc.ProgressValue = 100 ; EndDialog(hWnd, FALSE); break; case IDOK: ShowStatusWindow(FALSE); StatusProc.bStillWork = TRUE; StatusProc.bInvalidate = TRUE; StatusProc.bEnd = TRUE; EndDialog(hWnd, TRUE); break; case IDC_CLTH_1ST_RAD: case IDC_CLTH_2ND_RAD: case IDC_CLTH_3RD_RAD: case IDC_CLTH_4TH_RAD: pClrThr->uCurrentComp = nID - IDC_CLTH_1ST_RAD; Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MIN_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MAX_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); SetDlgItemInt(hWnd, IDC_CLTH_THR_MIN_EDT, pClrThr->pCompData[pClrThr->uCurrentComp].nMinRange, TRUE); SetDlgItemInt(hWnd, IDC_CLTH_THR_MAX_EDT, pClrThr->pCompData[pClrThr->uCurrentComp].nMaxRange, TRUE); SetFlags(hWnd, pClrThr->pCompData[pClrThr->uCurrentComp].uFlags); break; case IDC_CLTH_SPACE_COM: if (uCodeNotify == CBN_SELCHANGE) { uCurrentSpace = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_CLTH_SPACE_COM)); if (pClrThr->uColorSpace != uCurrentSpace) { Button_SetText(GetDlgItem(hWnd, IDC_CLTH_1ST_RAD), pClrThr->Label[uCurrentSpace][0]); Button_SetText(GetDlgItem(hWnd, IDC_CLTH_2ND_RAD), pClrThr->Label[uCurrentSpace][1]); Button_SetText(GetDlgItem(hWnd, IDC_CLTH_3RD_RAD), pClrThr->Label[uCurrentSpace][2]); pClrThr->uColorSpace = uCurrentSpace; bIs16BitPerCmp = ((pClrThr->LeadBitmap.BitsPerPixel == 12) || (pClrThr->LeadBitmap.BitsPerPixel == 16) || (pClrThr->LeadBitmap.BitsPerPixel == 48) || (pClrThr->LeadBitmap.BitsPerPixel == 64)); switch(uCurrentSpace) { case CLTH_LAB_SPACE: pClrThr->pCompData[0].nMinRange = pClrThr->pCompBound[0].nMinRange = 0; pClrThr->pCompData[0].nMaxRange = pClrThr->pCompBound[0].nMaxRange = bIs16BitPerCmp ? 10000 : 100; pClrThr->pCompData[1].nMinRange = pClrThr->pCompBound[1].nMinRange = bIs16BitPerCmp ?-0x8000 :-128; pClrThr->pCompData[1].nMaxRange = pClrThr->pCompBound[1].nMaxRange = bIs16BitPerCmp ? 0x7fff : 127; pClrThr->pCompData[2].nMinRange = pClrThr->pCompBound[2].nMinRange = bIs16BitPerCmp ?-0x8000 :-128; pClrThr->pCompData[2].nMaxRange = pClrThr->pCompBound[2].nMaxRange = bIs16BitPerCmp ? 0x7fff : 127; Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MIN_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MAX_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); SetDlgItemInt(hWnd, IDC_CLTH_THR_MIN_EDT, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, TRUE); SetDlgItemInt(hWnd, IDC_CLTH_THR_MAX_EDT, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange, TRUE); break; case CLTH_HSV_SPACE: pClrThr->pCompData[0].nMinRange = pClrThr->pCompBound[0].nMinRange = 0; pClrThr->pCompData[0].nMaxRange = pClrThr->pCompBound[0].nMaxRange = bIs16BitPerCmp ? 36000 : 360; pClrThr->pCompData[1].nMinRange = pClrThr->pCompBound[1].nMinRange = 0; pClrThr->pCompData[1].nMaxRange = pClrThr->pCompBound[1].nMaxRange = bIs16BitPerCmp ? 10000 : 100; pClrThr->pCompData[2].nMinRange = pClrThr->pCompBound[2].nMinRange = 0; pClrThr->pCompData[2].nMaxRange = pClrThr->pCompBound[2].nMaxRange = bIs16BitPerCmp ? 0xffff : 0xff; Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MIN_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MAX_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); SetDlgItemInt(hWnd, IDC_CLTH_THR_MIN_EDT, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, TRUE); SetDlgItemInt(hWnd, IDC_CLTH_THR_MAX_EDT, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange, TRUE); break; case CLTH_HLS_SPACE: pClrThr->pCompData[0].nMinRange = pClrThr->pCompBound[0].nMinRange = 0; pClrThr->pCompData[0].nMaxRange = pClrThr->pCompBound[0].nMaxRange = bIs16BitPerCmp ? 36000 : 360; pClrThr->pCompData[1].nMinRange = pClrThr->pCompBound[1].nMinRange = 0; pClrThr->pCompData[1].nMaxRange = pClrThr->pCompBound[1].nMaxRange = bIs16BitPerCmp ? 0xffff : 0xff; pClrThr->pCompData[2].nMinRange = pClrThr->pCompBound[2].nMinRange = 0; pClrThr->pCompData[2].nMaxRange = pClrThr->pCompBound[2].nMaxRange = bIs16BitPerCmp ? 10000 : 100; Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MIN_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MAX_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); SetDlgItemInt(hWnd, IDC_CLTH_THR_MIN_EDT, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, TRUE); SetDlgItemInt(hWnd, IDC_CLTH_THR_MAX_EDT, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange, TRUE); break; case CLTH_YCrCb_SPACE: pClrThr->pCompData[0].nMinRange = pClrThr->pCompBound[0].nMinRange = 0; pClrThr->pCompData[0].nMaxRange = pClrThr->pCompBound[0].nMaxRange = bIs16BitPerCmp ? 0xffff : 0xff; pClrThr->pCompData[1].nMinRange = pClrThr->pCompBound[1].nMinRange = bIs16BitPerCmp ?-0x8000 :-128; pClrThr->pCompData[1].nMaxRange = pClrThr->pCompBound[1].nMaxRange = bIs16BitPerCmp ? 0x7fff : 127; pClrThr->pCompData[2].nMinRange = pClrThr->pCompBound[2].nMinRange = bIs16BitPerCmp ?-0x8000 :-128; pClrThr->pCompData[2].nMaxRange = pClrThr->pCompBound[2].nMaxRange = bIs16BitPerCmp ? 0x7fff : 127; Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MIN_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MAX_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); SetDlgItemInt(hWnd, IDC_CLTH_THR_MIN_EDT, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, TRUE); SetDlgItemInt(hWnd, IDC_CLTH_THR_MAX_EDT, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange, TRUE); break; case CLTH_YUV_SPACE: pClrThr->pCompData[0].nMinRange = pClrThr->pCompBound[0].nMinRange = 0; pClrThr->pCompData[0].nMaxRange = pClrThr->pCompBound[0].nMaxRange = bIs16BitPerCmp ? 0xffff : 0xff; pClrThr->pCompData[1].nMaxRange = pClrThr->pCompBound[1].nMaxRange = bIs16BitPerCmp ? 28566 : 111; pClrThr->pCompData[1].nMinRange = pClrThr->pCompBound[1].nMinRange = - pClrThr->pCompBound[1].nMaxRange - 1; pClrThr->pCompData[2].nMaxRange = pClrThr->pCompBound[2].nMaxRange = bIs16BitPerCmp ? 35336 : 137; pClrThr->pCompData[2].nMinRange = pClrThr->pCompBound[2].nMinRange = - pClrThr->pCompBound[2].nMaxRange - 1; Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MIN_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MAX_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); SetDlgItemInt(hWnd, IDC_CLTH_THR_MIN_EDT, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, TRUE); SetDlgItemInt(hWnd, IDC_CLTH_THR_MAX_EDT, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange, TRUE); break; default: for (nIndex = 0; nIndex < 3; nIndex++) { pClrThr->pCompData[nIndex].nMaxRange = pClrThr->pCompBound[nIndex].nMaxRange = bIs16BitPerCmp ? 0xffff : 0xff; pClrThr->pCompData[nIndex].nMinRange = pClrThr->pCompBound[nIndex].nMinRange = 0; } Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MIN_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); Trackbar_SetTheRange(GetDlgItem(hWnd, IDC_CLTH_THR_MAX_SLD), TRUE, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange); SetDlgItemInt(hWnd, IDC_CLTH_THR_MIN_EDT, pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange, TRUE); SetDlgItemInt(hWnd, IDC_CLTH_THR_MAX_EDT, pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange, TRUE); break; } InvalidateRect(hWndCtl, NULL, FALSE); L_ApplyFilter(hWnd); } } break; } if (nID >= pClrThr->nRdoBaseID && nID < pClrThr->nRdoBaseID + pClrThr->nRadioNum) { nIndex = nID - pClrThr->nRdoBaseID; switch(nIndex) { case 0: uOldFlags[pClrThr->uCurrentComp] = pClrThr->pCompData[pClrThr->uCurrentComp].uFlags = (pClrThr->pCompData[pClrThr->uCurrentComp].uFlags & 0xff0) | 0x000; break; case 1: uOldFlags[pClrThr->uCurrentComp] = pClrThr->pCompData[pClrThr->uCurrentComp].uFlags = (pClrThr->pCompData[pClrThr->uCurrentComp].uFlags & 0xff0) | 0x001; break; case 2: uOldFlags[pClrThr->uCurrentComp] = pClrThr->pCompData[pClrThr->uCurrentComp].uFlags = (pClrThr->pCompData[pClrThr->uCurrentComp].uFlags & 0xf0f) | 0x000; break; case 3: uOldFlags[pClrThr->uCurrentComp] = pClrThr->pCompData[pClrThr->uCurrentComp].uFlags = (pClrThr->pCompData[pClrThr->uCurrentComp].uFlags & 0xf0f) | 0x010; break; case 4: pClrThr->pCompData[pClrThr->uCurrentComp].uFlags = (pClrThr->pCompData[pClrThr->uCurrentComp].uFlags & 0x0ff) | 0x000; uOldFlags[pClrThr->uCurrentComp] = (uOldFlags[pClrThr->uCurrentComp] & 0x0ff) | 0x000; bClamp = FALSE; break; case 5: pClrThr->pCompData[pClrThr->uCurrentComp].uFlags = (pClrThr->pCompData[pClrThr->uCurrentComp].uFlags & 0x0ff) | 0x100; uOldFlags[pClrThr->uCurrentComp] = (uOldFlags[pClrThr->uCurrentComp] & 0x0ff) | 0x100; bClamp = FALSE; break; case 6: pClrThr->pCompData[pClrThr->uCurrentComp].uFlags = (pClrThr->pCompData[pClrThr->uCurrentComp].uFlags & 0x0ff) | 0x200; bClamp = TRUE; break; } EnableWindow(GetDlgItem(hWnd, IDC_CLTH_REJECT_RAD), !bClamp); EnableWindow(GetDlgItem(hWnd, IDC_CLTH_BASS_RAD) , !bClamp); EnableWindow(GetDlgItem(hWnd, IDC_CLTH_CHNL_RAD), !bClamp); EnableWindow(GetDlgItem(hWnd, IDC_CLTH_PIX_RAD), !bClamp); if (bClamp) pClrThr->pCompData[pClrThr->uCurrentComp].uFlags = 0x200; else pClrThr->pCompData[pClrThr->uCurrentComp].uFlags = uOldFlags[pClrThr->uCurrentComp]; L_ApplyFilter(hWnd); } if (nID >= pClrThr->nEdtBaseID && nID < pClrThr->nEdtBaseID + pClrThr->nSlideNum) { if ((uCodeNotify == EN_CHANGE)) { nValue = GetDlgItemInt(hWnd, nID, NULL, TRUE); nIndex = nID - pClrThr->nEdtBaseID; if (nValue < pClrThr->pCompBound[pClrThr->uCurrentComp].nMinRange) return; if (nValue > pClrThr->pCompBound[pClrThr->uCurrentComp].nMaxRange) return; if ((nIndex == 0) && (nValue > pClrThr->pCompData[pClrThr->uCurrentComp].nMaxRange)) nValue = pClrThr->pCompData[pClrThr->uCurrentComp].nMaxRange; if ((nIndex == 1) && (nValue < pClrThr->pCompData[pClrThr->uCurrentComp].nMinRange)) nValue = pClrThr->pCompData[pClrThr->uCurrentComp].nMinRange; Trackbar_SetPos(GetDlgItem(hWnd, pClrThr->nSldBaseID + nIndex), TRUE, nValue); switch(nIndex) { case 0: if (pClrThr->pCompData[pClrThr->uCurrentComp].nMinRange == nValue) return; pClrThr->pCompData[pClrThr->uCurrentComp].nMinRange = nValue; break; case 1: if (pClrThr->pCompData[pClrThr->uCurrentComp].nMaxRange == nValue) return; pClrThr->pCompData[pClrThr->uCurrentComp].nMaxRange = nValue; break; } L_ApplyFilter(hWnd); } } } static L_VOID ClrThrDlg_OnHScroll (HWND hWnd, HWND hWndCtl, L_UINT uCode, L_INT nPos) { LPCLRTHRDLGDATA pClrThr = (LPCLRTHRDLGDATA) GetWindowLong(hWnd, GWL_USERDATA); L_INT CtrlID; L_INT nPosition; CtrlID = GetDlgCtrlID(hWndCtl); nPosition = Trackbar_GetPos(hWndCtl); switch(CtrlID) { case IDC_CLTH_THR_MIN_SLD: if (nPosition > Trackbar_GetPos(GetDlgItem(hWnd, IDC_CLTH_THR_MAX_SLD))) nPosition = Trackbar_GetPos(GetDlgItem(hWnd, IDC_CLTH_THR_MAX_SLD)); break; case IDC_CLTH_THR_MAX_SLD: if (nPosition < Trackbar_GetPos(GetDlgItem(hWnd, IDC_CLTH_THR_MIN_SLD))) nPosition = Trackbar_GetPos(GetDlgItem(hWnd, IDC_CLTH_THR_MIN_SLD)); break; } SetDlgItemInt(hWnd, CtrlID - pClrThr->nSlideNum , nPosition, TRUE); } static L_VOID L_ApplyFilter(HWND hWnd) { pCHILDDATA pData; L_INT nRet = 0; HWND hWndParent; LPCLRTHRDLGDATA pClrThr; L_UCHAR Msg[10] = "\0"; if ( 100 != StatusProc.ProgressValue ) { StatusProc.bKillProgress = TRUE ; return ; } pClrThr = (LPCLRTHRDLGDATA) GetWindowLong(hWnd,GWL_USERDATA); hWndParent = FORWARD_WM_MDIGETACTIVE(hWndClient,SendMessage); pData = LOCKCHILDDATA (hWndParent); FreeMemorizedBitmap (hWndParent); //MEMDISK// L_CopyBitmap(&pData->LeadBitmap, &pClrThr->LeadBitmap, sizeof(BITMAPHANDLE)); nRet = L_ColorThresholdBitmap(&pData->LeadBitmap, pClrThr->uColorSpace, pClrThr->pCompData); if(nRet == SUCCESS) { InvalidateRect(hWndParent, NULL, FALSE); StatusProc.ProgressValue = 100; Progress_SetPos(StatusProc.ProgWnd , 0); if(StatusProc.bEnd) { StatusProc.bProgress = FALSE; StatusProc.bKillProgress = TRUE; } } }