Exemplo n.º 1
0
BOOL CTimeSetMember::UpdatePosition(time_t tkey)
{
	BOOL rt = FALSE; 
	if(NeedUpdatePosition(tkey))
	{
		ref<CTimeBtree> timetree = owner;
		write_access<CTimeBtree> wtimetree = modify(timetree);

		//remove from the owner
		wtimetree->RemovePlain(this);

		//update the key val
		UpdateKeyVal(tkey);

		//insert in the owner
		wtimetree->InsertPlain(this);

		rt = TRUE;
	}
	return rt;
}
Exemplo n.º 2
0
static MRESULT EXPENTRY pm_keyset(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    static int set1 = TRUE;
    static int id = 0;

    switch (msg) {
        case WM_INITDLG:
            {
                int j1, j2;

                resources_get_int("JoyDevice1", &j1);
                resources_get_int("JoyDevice2", &j2);
                WinSendMsg(hwnd, WM_KPROCESS, (void*)!!((j1 | j2) & JOYDEV_KEYSET1), (void*)!!((j1 | j2) & JOYDEV_KEYSET2));
            }
            break;
        case WM_CONTROL:
            {
                int ctrl = SHORT1FROMMP(mp1);

                switch (ctrl) {
                    case RB_SET1:
                    case RB_SET2:
                        if (!(ctrl == RB_SET1 && set1) && !(ctrl == RB_SET2 && !set1)) {
                            set1 = !set1;
                            WinSendMsg(hwnd, WM_KENABLECTRL, 0, 0);
                            WinSendMsg(hwnd, WM_KFILLSPB, 0, 0);
                        }
                        break;
                    case SPB_N:
                    case SPB_NE:
                    case SPB_E:
                    case SPB_SE:
                    case SPB_S:
                    case SPB_SW:
                    case SPB_W:
                    case SPB_NW:
                    case SPB_FIRE:
                        if (SHORT2FROMMP(mp1) == SPBN_SETFOCUS) {
                            id = ctrl;
                        }
                        break;
                }
                break;
            }
        case WM_KPROCESS:
            if (((int)mp1 ^ (int)mp2) & 1) {
                set1 = (int)mp1;
            }

            WinCheckButton(hwnd, set1 ? RB_SET1 : RB_SET2, 1);
            WinEnableControl(hwnd, RB_SET1, (ULONG)mp1);
            WinEnableControl(hwnd, RB_SET2, (ULONG)mp2);

            WinSendMsg(hwnd, WM_KENABLECTRL, (void*)(!mp1 && !mp2), NULL);
            WinSendMsg(hwnd, WM_KFILLSPB, 0, 0);
            break;
        case WM_TRANSLATEACCEL:
            if (id >= SPB_N && id <= SPB_FIRE) {
                //
                // Returning FALSE and using WM_CHAR doesn't work
                // for all keys - I don't know why
                //
                SetKeyVal(hwnd, id, set1, CHAR4FROMMP(((QMSG*)mp1)->mp1));
                return FALSE;
            }
            break;
        case WM_SETKEY:
            {
                ULONG state1 = mp1 ? 1 : 0;
                ULONG state2 = mp2 ? 1 : 0;

                WinEnableControl(hwnd, RB_SET1, state1);
                WinEnableControl(hwnd, RB_SET2, state2);
                WinSendMsg(hwnd, WM_KPROCESS, (void*)state1, (void*)state2);
            }
            break;
        case WM_KENABLECTRL:
            WinEnableControl(hwnd, SPB_N, mp1 ? 0 : 1);
            WinEnableControl(hwnd, SPB_E, mp1 ? 0 : 1);
            WinEnableControl(hwnd, SPB_S, mp1 ? 0 : 1);
            WinEnableControl(hwnd, SPB_W, mp1 ? 0 : 1);
            WinEnableControl(hwnd, SPB_NE, mp1 ? 0 : 1);
            WinEnableControl(hwnd, SPB_SE, mp1 ? 0 : 1);
            WinEnableControl(hwnd, SPB_SW, mp1 ? 0 : 1);
            WinEnableControl(hwnd, SPB_NW, mp1 ? 0 : 1);
            WinEnableControl(hwnd, SPB_FIRE, mp1 ? 0 : 1);
            return FALSE;
        case WM_KFILLSPB:
            UpdateKeyVal(hwnd, SPB_N, set1);
            UpdateKeyVal(hwnd, SPB_E, set1);
            UpdateKeyVal(hwnd, SPB_S, set1);
            UpdateKeyVal(hwnd, SPB_W, set1);
            UpdateKeyVal(hwnd, SPB_NE, set1);
            UpdateKeyVal(hwnd, SPB_SE, set1);
            UpdateKeyVal(hwnd, SPB_SW, set1);
            UpdateKeyVal(hwnd, SPB_NW, set1);
            UpdateKeyVal(hwnd, SPB_FIRE, set1);
            return FALSE;
    }
    return WinDefDlgProc (hwnd, msg, mp1, mp2);
}