Beispiel #1
0
void TresizeAspectPage::cfg2dlg(void)
{
    resize2dlg();
    resizeIf2dlg();
    aspect2dlg();
    userAspect2dlg();
}
void TresizePage::cfg2dlg(void)
{
    resize2dlg();
    aspect2dlg();
}
HRESULT TresizePage::msgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
    case WM_SHOWWINDOW:
        if (wParam) cfg2dlg();
        break;

    case WM_HSCROLL:
        if (HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_ASPECT_USER))
        {
            int a=SendDlgItemMessage(m_hwnd,IDC_TBR_ASPECT_USER,TBM_GETPOS,0,0);
            cfgSet(IDFF_aspectRatio,a*256);
            aspect2dlg();
            return TRUE;
        }
        else if (HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_RESIZE_GBLUR_LUM))
        {
            cfgSet(IDFF_resizeGblurLum,SendDlgItemMessage(m_hwnd,IDC_TBR_RESIZE_GBLUR_LUM,TBM_GETPOS,0,0));
            resize2dlg();
            return TRUE;
        }
        else if (HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_RESIZE_GBLUR_CHROM))
        {
            cfgSet(IDFF_resizeGblurChrom,SendDlgItemMessage(m_hwnd,IDC_TBR_RESIZE_GBLUR_CHROM,TBM_GETPOS,0,0));
            resize2dlg();
            return TRUE;
        }
        else if (HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_RESIZE_SHARPEN_LUM))
        {
            cfgSet(IDFF_resizeSharpenLum,SendDlgItemMessage(m_hwnd,IDC_TBR_RESIZE_SHARPEN_LUM,TBM_GETPOS,0,0));
            resize2dlg();
            return TRUE;
        }
        else if (HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_RESIZE_SHARPEN_CHROM))
        {
            cfgSet(IDFF_resizeSharpenChrom,SendDlgItemMessage(m_hwnd,IDC_TBR_RESIZE_SHARPEN_CHROM,TBM_GETPOS,0,0));
            resize2dlg();
            return TRUE;
        }
        else break;

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_CHB_RESIZE:
            cfgSet(IDFF_isResize,getCheck(IDC_CHB_RESIZE));
            return TRUE;

        case IDC_CHB_RESIZE_FIRST:
            cfgSet(IDFF_resizeFirst,getCheck(IDC_CHB_RESIZE_FIRST));
            return TRUE;
        case IDC_CBX_RESIZE_METHOD:
            if (HIWORD(wParam)==CBN_SELCHANGE)
            {
                int i=SendDlgItemMessage(m_hwnd,IDC_CBX_RESIZE_METHOD,CB_GETCURSEL,0,0);
                cfgSet(IDFF_resizeMethod,i);
                return TRUE;
            }
            break;
        case IDC_RBT_ASPECT_NO:
            cfgSet(IDFF_resizeAspect,0);
            aspect2dlg();
            return TRUE;
        case IDC_RBT_ASPECT_KEEP:
            cfgSet(IDFF_resizeAspect,1);
            aspect2dlg();
            return TRUE;
        case IDC_RBT_ASPECT_USER:
            cfgSet(IDFF_resizeAspect,2);
            aspect2dlg();
            return TRUE;

        case IDC_ED_RESIZEDX:
        case IDC_ED_RESIZEDY:
            if (HIWORD(wParam)==EN_CHANGE)
            {
                enableWindow(IDC_BT_RESIZE_SET,applyResizeXY(true));
                return TRUE;
            };
            break;
        case IDC_BT_RESIZE_SET:
            applyResizeXY(false);
            return TRUE;
        };
        break;
    };
    return FALSE;
};
Beispiel #4
0
INT_PTR TresizeAspectPage::msgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg) {
        case WM_HSCROLL:
            switch (GetWindowLong(HWND(lParam), GWL_ID)) {
                case IDC_TBR_ASPECT_USER: {
                    int a = tbrGet(IDC_TBR_ASPECT_USER);
                    cfgSet(IDFF_aspectRatio, a * 256);
                    userAspect2dlg();
                    return TRUE;
                }
                case IDC_TBR_HWOVERLAY_ASPECT: {
                    int a = tbrGet(IDC_TBR_HWOVERLAY_ASPECT);
                    cfgSet(IDFF_hwOverlayAspect, a * 256);
                    aspect2dlg();
                    return TRUE;
                }
            }
            break;
        case WM_COMMAND:
            switch (LOWORD(wParam)) {
                case IDC_ED_RESIZEDX:
                case IDC_ED_RESIZEDY:
                    if (HIWORD(wParam) == EN_CHANGE && !isSetWindowText) {
                        HWND hed = GetDlgItem(m_hwnd, LOWORD(wParam));
                        if (hed != GetFocus()) {
                            return FALSE;
                        }
                        repaint(hed);
                        applyResizeXY();
                        return TRUE;
                    }
                    break;
                case IDC_BT_RESIZE_XCOND:
                    if (HIWORD(wParam) == BN_CLICKED) {
                        cfgSet(IDFF_resizeIfXcond, -1 * cfgGet(IDFF_resizeIfXcond));
                        resizeIf2dlg();
                        return TRUE;
                    }
                    break;
                case IDC_BT_RESIZE_YCOND:
                    if (HIWORD(wParam) == BN_CLICKED) {
                        cfgSet(IDFF_resizeIfYcond, -1 * cfgGet(IDFF_resizeIfYcond));
                        resizeIf2dlg();
                        return TRUE;
                    }
                    break;
                case IDC_BT_RESIZE_XYCOND:
                    if (HIWORD(wParam) == BN_CLICKED) {
                        cfgSet(IDFF_resizeIfXYcond, 1 - cfgGet(IDFF_resizeIfXYcond));
                        resizeIf2dlg();
                        return TRUE;
                    }
                    break;
                case IDC_BT_RESIZE_PIXCOND:
                    if (HIWORD(wParam) == BN_CLICKED) {
                        cfgSet(IDFF_resizeIfPixCond, -1 * cfgGet(IDFF_resizeIfPixCond));
                        resizeIf2dlg();
                        return TRUE;
                    }
                    break;
            }
            break;
        case WM_CTLCOLOREDIT: {
            HWND hwnd = HWND(lParam);
            bool ok;
            switch (getId(hwnd)) {
                case IDC_ED_RESIZEDX:
                    ok = sizeXok(hwnd);
                    break;
                case IDC_ED_RESIZEDY:
                    ok = sizeYok(hwnd);
                    break;
                default:
                    goto colorEnd;
            }
            if (!ok) {
                HDC dc = HDC(wParam);
                SetBkColor(dc, RGB(255, 0, 0));
                return INT_PTR(getRed());
            } else {
                return FALSE;
            }
colorEnd:
            ;
            break;
        }
        case WM_DRAWITEM:
            switch (wParam) {
                case IDC_BT_RESIZE_PIXCOND:
                case IDC_BT_RESIZE_XCOND:
                case IDC_BT_RESIZE_YCOND:
                case IDC_BT_RESIZE_XYCOND: {
                    DRAWITEMSTRUCT *dis = (LPDRAWITEMSTRUCT)lParam;
                    ((TflatButton*)Twidget::getDlgItem(dis->hwndItem))->paint(dis);
                    return TRUE;
                }
            }
            break;
    }
    return TconfPageDecVideo::msgProc(uMsg, wParam, lParam);
}