| 2946 | |
| 2947 | |
| 2948 | BOOL CColorCopDlg::OnMouseWheel(UINT nFlags, int16_t zDelta, CPoint pt) { |
| 2949 | // first check if we are magnifying... |
| 2950 | |
| 2951 | if (m_isEyedropping) { |
| 2952 | return TRUE; |
| 2953 | } else if (m_isMagnifying) { |
| 2954 | m_MagLevel += zDelta / WHEEL_DELTA; |
| 2955 | m_MagLevel = std::clamp<int>(m_MagLevel, kMinZoom, kMaxZoom); |
| 2956 | return TRUE; |
| 2957 | } |
| 2958 | |
| 2959 | // determine which edit control has the focus?? |
| 2960 | |
| 2961 | CWnd* curfocus = GetFocus(); // handle to the window with focus |
| 2962 | |
| 2963 | if (curfocus == NULL) // There is nothing with the focus |
| 2964 | return TRUE; // jump out |
| 2965 | |
| 2966 | int offset = 1; // default |
| 2967 | |
| 2968 | if (nFlags == MK_CONTROL) // jump by 5 if control is down |
| 2969 | offset = 5; |
| 2970 | else if (nFlags == MK_SHIFT) // jump by 2 if shift is down |
| 2971 | offset = 2; |
| 2972 | |
| 2973 | // if bSnaptoWebsafe is on then incrementing by 1, 5 or 2 won't do any good |
| 2974 | // because it will just snap lower. |
| 2975 | |
| 2976 | if (m_Appflags & SnaptoWebsafe) { |
| 2977 | // therefore, increment or decrement by 51 |
| 2978 | offset = WEBSAFE_STEP; |
| 2979 | } |
| 2980 | |
| 2981 | if (curfocus == GetDlgItem(IDC_RED)) { // red has focus |
| 2982 | m_Reddec += zDelta / WHEEL_DELTA * offset; |
| 2983 | m_Reddec = std::clamp(m_Reddec, RGB_MIN, RGB_MAX); |
| 2984 | |
| 2985 | } else if (curfocus == GetDlgItem(IDC_GREEN)) { // green has focus |
| 2986 | m_Greendec += zDelta / WHEEL_DELTA * offset; |
| 2987 | m_Greendec = std::clamp(m_Greendec, RGB_MIN, RGB_MAX); |
| 2988 | } else if (curfocus == GetDlgItem(IDC_BLUE)) { // blue has focus |
| 2989 | m_Bluedec += zDelta / WHEEL_DELTA * offset; |
| 2990 | m_Bluedec = std::clamp(m_Bluedec, RGB_MIN, RGB_MAX); |
| 2991 | } else { // there is focus, but it's not on either the Red, |
| 2992 | return TRUE; // Green, or Blue edit controls -> jump out |
| 2993 | } |
| 2994 | |
| 2995 | UpdateData(false); |
| 2996 | CalcColorPal(); |
| 2997 | OnconvertRGB(); |
| 2998 | OnCopytoclip(); |
| 2999 | |
| 3000 | return CDialog::OnMouseWheel(nFlags, zDelta, pt); |
| 3001 | } |
| 3002 | |
| 3003 | void CColorCopDlg::OnTimer(UINT nIDEvent) { |
| 3004 | // this allows animations to be magnified and eyedropped |
nothing calls this directly
no outgoing calls
no test coverage detected