コード例 #1
0
ファイル: cal3dHelper.cpp プロジェクト: nixz/covise
BOOL CALLBACK
    RollupDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam,
                     Cal3DObject *th)
{
    if (!th && message != WM_INITDIALOG)
        return FALSE;

    switch (message)
    {
    case WM_INITDIALOG:
    {
        TimeValue t = 0;

        SendMessage(GetDlgItem(hDlg, IDC_CAL_CFG_URL), WM_SETTEXT, 0, (LPARAM)th->cal3d_cfg.data());
        EnableWindow(GetDlgItem(hDlg, IDC_CAL_CFG_URL), TRUE);

        th->hRollup = hDlg;

        if (pickMode)
            SetPickMode(th);

        return TRUE;
    }
    case WM_DESTROY:
        if (pickMode)
            SetPickMode(th);
        // th->iObjParams->ClearPickMode();
        // th->previousMode = NULL;
        RELEASE_SPIN(animationIDSpin);
        RELEASE_SPIN(actionIDSpin);

        RELEASE_BUT(Cal3DPickButton);
        return FALSE;

    case CC_SPINNER_BUTTONDOWN:
    {
        int id = LOWORD(wParam);
        switch (id)
        {
        case IDC_ANIMATION_SPIN:
        case IDC_ACTION_SPIN2:
            theHold.Begin();
            return TRUE;
        default:
            return FALSE;
        }
    }
    break;

    case CC_SPINNER_BUTTONUP:
    {
        if (!HIWORD(wParam))
        {
            theHold.Cancel();
            break;
        }
        int id = LOWORD(wParam);
        switch (id)
        {
        case IDC_ANIMATION_SPIN:
        case IDC_ACTION_SPIN2:

            if (th->getCoreHelper())
                th->getCoreHelper()->setState(th->animationIDSpin->GetIVal(), 0.0);
            theHold.Accept(GetString(IDS_DS_PARAMCHG));
            return TRUE;
        default:
            return FALSE;
        }
    }

    case CC_SPINNER_CHANGE:
    {
        int animID;
        int id = LOWORD(wParam);
        TimeValue t = 0; // not really needed...yet

        switch (id)
        {
        case IDC_ANIMATION_SPIN:
        case IDC_ACTION_SPIN2:
            if (!HIWORD(wParam))
                theHold.Begin();

            //actionID = th->actionIDSpin->GetIVal();

            //th->animationIDSpin->SetValue(animID, FALSE);
            //th->actionIDSpin->SetValue(actionID, FALSE);
            animID = th->animationIDSpin->GetIVal();
            if (th->getCoreHelper())
                th->getCoreHelper()->setState(animID, 0.0);

            if (!HIWORD(wParam))
                theHold.Accept(GetString(IDS_DS_PARAMCHG));
            return TRUE;
        default:
            return FALSE;
        }
    }

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_CAL_CFG_URL:
            switch (HIWORD(wParam))
            {
            case EN_SETFOCUS:
                DisableAccelerators();
                break;
            case EN_KILLFOCUS:
                EnableAccelerators();
                break;
            case EN_CHANGE:
                int len = (int)SendDlgItemMessage(hDlg, IDC_CAL_CFG_URL, WM_GETTEXTLENGTH, 0, 0);
                TSTR temp;
                temp.Resize(len + 1);
                SendDlgItemMessage(hDlg, IDC_CAL_CFG_URL, WM_GETTEXT, len + 1, (LPARAM)temp.data());

#if MAX_PRODUCT_VERSION_MAJOR > 14
                th->setURL(temp.ToUTF8().data());
#else
                th->setURL((char *)temp);
#endif
                break;
            }
            break;
        }
        return FALSE;
    default:
        return FALSE;
    }

    return FALSE;
}