BOOL CHistogramDlg::OnCommand( WPARAM wParam, LPARAM lParam ) { int id = LOWORD(wParam); //unpack the message WORD codeNotify = HIWORD(wParam); HWND hControl = (HWND) lParam; int i, val; switch (id) { case IDC_CHANNELS: i=ChannelsCombo_Handle(id, codeNotify); if (!i) break; m_wChannel = i; set_histo_channel(); break; case IDC_HISTOGRAM: // value changed if (WITHIN(codeNotify, HTN_CHANGED_FIRST, HTN_CHANGED_LAST)) i = codeNotify-HTN_CHANGED_FIRST; else if (WITHIN(codeNotify, HTN_CHANGING_FIRST, HTN_CHANGING_LAST)) i = codeNotify-HTN_CHANGING_FIRST; else if (codeNotify = HTN_BROWSE) { val = Histo_GetBrowse(hControl); histo_browse(val); break; } else break; val = Histo_GetMark(hControl, i); histo_browse(val); histo_change_mark(i, val); break; case IDC_TAGS: // value changed if (WITHIN(codeNotify, TN_CHANGED_FIRST, TN_CHANGED_LAST)) i = codeNotify-TN_CHANGED_FIRST; else if (WITHIN(codeNotify, TN_CHANGING_FIRST, TN_CHANGING_LAST)) i = codeNotify-TN_CHANGING_FIRST; else break; val = Tag_GetMark(hControl, i); histo_browse(val); histo_change_mark(i, val); break; default: break; } return CWnd::OnCommand(wParam, lParam); }
BOOL CToneBalanceDlg::OnCommand( WPARAM wParam, LPARAM lParam ) { int id = LOWORD(wParam); //unpack the message WORD codeNotify = HIWORD(wParam); HWND hControl = (HWND) lParam; HWND hDlg = GetSafeHwnd(); int i, val; BOOL Bool; HWND hActiveWnd; LPIMAGE lpImage = NULL; lpImage = GetImage(); switch (id) { case IDC_CHANNELS: i=ChannelsCombo_Handle(id, codeNotify); if (!i) break; m_lpData->wChannel = i; set_quarter_channel(m_lpData->wChannel); break; case IDC_QUART1_PROBE: case IDC_QUART2_PROBE: case IDC_QUART3_PROBE: if (!Probe_Begin(codeNotify)) break; CheckDlgButton(id, YES ); m_lpData->iProbe = id-IDC_QUART1_PROBE; if (m_lpData->iProbe == 0) m_lpData->OriginalValue = m_lpData->iShadow; else if (m_lpData->iProbe == 1) m_lpData->OriginalValue = m_lpData->iMidtone; else m_lpData->OriginalValue = m_lpData->iHighlight; // unpreview UnAutoPreview(); break; case IDC_QUART1_VALUE: case IDC_QUART2_VALUE: case IDC_QUART3_VALUE: if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) ) break; if ( codeNotify != EN_CHANGE) break; val = GetDlgItemSpin(hDlg, id, &Bool, NO); if (!Bool) break; // convert to 'real' location if (id == IDC_QUART2_VALUE && m_bUseMidPer) i = m_lpData->iShadow + (LONG)val*(m_lpData->iHighlight-m_lpData->iShadow)/100; else i = FROM_DISPLAY(val); if (id != IDC_QUART2_VALUE) val = INT_MAX; change_mark(m_lpData, id-IDC_QUART1_VALUE, i, val); AutoPreview(m_lpData->lpMap, m_bAutoPreview, NO); break; case IDC_MINHIGHLIGHT: if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) ) break; if ( codeNotify != EN_CHANGE) break; i = GetDlgItemSpin(hDlg, id, &Bool, NO); if (!Bool) break; i = FROM_DISPLAY(i); m_lpData->lpMap->Pnt[2].y = i; m_lpData->lpMap->Pnt[1].y = (m_lpData->lpMap->Pnt[2].y+m_lpData->lpMap->Pnt[0].y)/2; AutoPreview(m_lpData->lpMap,m_bAutoPreview, YES); break; case IDC_MAXSHADOW: if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) ) break; if ( codeNotify != EN_CHANGE) break; i = GetDlgItemSpin(hDlg, id, &Bool, NO); if (!Bool) break; i = FROM_DISPLAY(i); m_lpData->lpMap->Pnt[0].y = i; m_lpData->lpMap->Pnt[1].y = (m_lpData->lpMap->Pnt[2].y+m_lpData->lpMap->Pnt[0].y)/2; AutoPreview(m_lpData->lpMap, m_bAutoPreview, YES); break; case IDC_HISTOGRAM: // value changed if (WITHIN(codeNotify, HTN_CHANGED_FIRST, HTN_CHANGED_LAST)) { i = codeNotify-HTN_CHANGED_FIRST; Bool = TRUE; } else if (WITHIN(codeNotify, HTN_CHANGING_FIRST, HTN_CHANGING_LAST)) { i = codeNotify-HTN_CHANGING_FIRST; Bool = FALSE; } else break; val = Histo_GetMark(hControl, i); change_mark(m_lpData, i, val, INT_MAX); AutoPreview(m_lpData->lpMap, m_bAutoPreview, Bool); break; case IDC_TAGS: // value changed if (WITHIN(codeNotify, TN_CHANGED_FIRST, TN_CHANGED_LAST)) { i = codeNotify-TN_CHANGED_FIRST; Bool = TRUE; } else if (WITHIN(codeNotify, TN_CHANGING_FIRST, TN_CHANGING_LAST)) { i = codeNotify-TN_CHANGING_FIRST; Bool = FALSE; } else break; val = Tag_GetMark(hControl, i); change_mark(m_lpData, i, val, INT_MAX); AutoPreview(m_lpData->lpMap, m_bAutoPreview, Bool); break; // case IDC_PREVIEW: // AutoPreview_Button(m_lpData->lpMap); // break; // case IDC_QUART_DEFAULTS: // // setup channel with sacrifice defaults // set_sacrifice(m_lpData, m_lpData->wChannel); // // setup the actual histogram and controls // set_quarter_channel(m_lpData->wChannel); // AutoPreview(m_lpData->lpMap, m_bAutoPreview, YES); // break; default: break; } return CWnd::OnCommand(wParam, lParam); }