예제 #1
0
void CreateMemoryMapView(int x, int y)
{
    int cxBorder = ::GetSystemMetrics(SM_CXDLGFRAME);
    int cyBorder = ::GetSystemMetrics(SM_CYDLGFRAME);
    int cxScroll = ::GetSystemMetrics(SM_CXVSCROLL);
    int cyScroll = ::GetSystemMetrics(SM_CYHSCROLL);
    int cyCaption = ::GetSystemMetrics(SM_CYSMCAPTION);

    int width = 256 * 2 + cxScroll + cxBorder * 2;
    int height = 256 * 2 + cyScroll + cyBorder * 2 + cyCaption;
    g_hwndMemoryMap = CreateWindowEx(
            WS_EX_TOOLWINDOW | WS_EX_TOPMOST,
            CLASSNAME_OVERLAPPEDWINDOW, _T("BK Memory Map"),
            WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE,
            x, y, width, height,
            NULL, NULL, g_hInst, NULL);

    // ToolWindow subclassing
    m_wndprocMemoryMapToolWindow = (WNDPROC) LongToPtr( SetWindowLongPtr(
            g_hwndMemoryMap, GWLP_WNDPROC, PtrToLong(MemoryMapViewWndProc)) );

    RECT rcClient;  GetClientRect(g_hwndMemoryMap, &rcClient);

    m_hwndMemoryMapViewer = CreateWindow(
            CLASSNAME_MEMORYMAPVIEW, NULL,
            WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | WS_TABSTOP,
            0, 0, rcClient.right, rcClient.bottom,
            g_hwndMemoryMap, NULL, g_hInst, NULL);

    MemoryMapView_InitBitmap();
    MemoryMapView_UpdateScrollPos();
    ::SetFocus(m_hwndMemoryMapViewer);
}
예제 #2
0
void MemoryMapView_Create(HWND hwndParent, int x, int y)
{
    int cxScroll = ::GetSystemMetrics(SM_CXVSCROLL);
    int cyCaption = TOOLWINDOW_CAPTION_HEIGHT;

    int width = m_nMemoryMap_ViewCX + cxScroll;
    int height = m_nMemoryMap_ViewCY + cyCaption;
    g_hwndMemoryMap = CreateWindow(
            CLASSNAME_TOOLWINDOW, _T("Memory Map"),
            WS_CHILD | WS_VISIBLE,
            x, y, width, height,
            hwndParent, NULL, g_hInst, NULL);

    // ToolWindow subclassing
    m_wndprocMemoryMapToolWindow = (WNDPROC) LongToPtr( SetWindowLongPtr(
            g_hwndMemoryMap, GWLP_WNDPROC, PtrToLong(MemoryMapViewWndProc)) );

    RECT rcClient;  GetClientRect(g_hwndMemoryMap, &rcClient);

    m_hwndMemoryMapViewer = CreateWindow(
            CLASSNAME_MEMORYMAPVIEW, NULL,
            WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP,
            0, 0, rcClient.right, rcClient.bottom,
            g_hwndMemoryMap, NULL, g_hInst, NULL);

    MemoryMapView_InitBitmap();
    MemoryMapView_UpdateScrollPos();
}
예제 #3
0
void MemoryMapView_ScrollTo(int newxpos, int newypos)
{
    int maxxpos = 256 - m_nMemoryMap_ViewCX / m_nMemoryMap_scale;
    int maxypos = 512 - m_nMemoryMap_ViewCY / m_nMemoryMap_scale;
    if (newxpos < 0) newxpos = 0;
    if (newxpos > maxxpos) newxpos = maxxpos;
    if (newypos < 0) newypos = 0;
    if (newypos > maxypos) newypos = maxypos;

    m_nMemoryMap_xpos = newxpos;
    m_nMemoryMap_ypos = newypos;

    InvalidateRect(m_hwndMemoryMapViewer, NULL, TRUE);

    MemoryMapView_UpdateScrollPos();
}
예제 #4
0
void MemoryMapView_Scroll(int dx, int dy)
{
    int newxpos = m_nMemoryMap_xpos + dx;
    int newypos = m_nMemoryMap_ypos + dy;

    int maxpos = 256 * (m_nMemoryMap_scale - 2);  //INCORRECT
    if (newxpos < 0) newxpos = 0;
    if (newxpos > maxpos) newxpos = maxpos;
    if (newypos < 0) newypos = 0;
    if (newypos > maxpos) newypos = maxpos;

    m_nMemoryMap_xpos = newxpos;
    m_nMemoryMap_ypos = newypos;

    InvalidateRect(m_hwndMemoryMapViewer, NULL, TRUE);

    MemoryMapView_UpdateScrollPos();
}
예제 #5
0
void MemoryMapView_Zoom(BOOL inout)
{
    if (inout)
    {
        if (m_nMemoryMap_scale >= 40)
            return;
        m_nMemoryMap_scale += 1;
    }
    else
    {
        if (m_nMemoryMap_scale <= 2)
            return;
        m_nMemoryMap_scale -= 1;
    }

    InvalidateRect(m_hwndMemoryMapViewer, NULL, FALSE);
    MemoryMapView_UpdateScrollPos();
}