void CtrlRegisterList::mouseEvent(wxMouseEvent& evt) { if (evt.GetEventType() == wxEVT_RIGHT_UP) { int y = evt.GetPosition().y; if (y >= rowHeight) { int row = (y-rowHeight)/rowHeight; if (row != currentRows[category] && row < cpu->getRegisterCount(category)) setCurrentRow(row); } PopupMenu(&menu,evt.GetPosition()); return; } if (evt.ButtonIsDown(wxMOUSE_BTN_LEFT) || evt.ButtonIsDown(wxMOUSE_BTN_RIGHT)) { int x = evt.GetPosition().x; int y = evt.GetPosition().y; if (y < rowHeight) { int piece = GetSize().x/cpu->getRegisterCategoryCount(); int cat = x/piece; if (cat != category) { category = cat; Refresh(); } } else { int row = (y-rowHeight)/rowHeight; if (row != currentRows[category] && row < cpu->getRegisterCount(category)) setCurrentRow(row); } SetFocus(); SetFocusFromKbd(); } }
void CtrlRegisterList::mouseEvent(wxMouseEvent& evt) { int xOffset, yOffset; ((wxScrolledWindow*) this)->GetViewStart(&xOffset, &yOffset); wxClientDC dc(this); wxPoint pos = evt.GetPosition(); int x = dc.DeviceToLogicalX(pos.x) + xOffset; int y = dc.DeviceToLogicalY(pos.y) + yOffset * rowHeight; if (evt.GetEventType() == wxEVT_RIGHT_UP) { if (y >= rowHeight) { int row = (y-rowHeight)/rowHeight; if (row != currentRows[category] && row < cpu->getRegisterCount(category)) setCurrentRow(row); } wxMenu menu; int bits = cpu->getRegisterSize(category); menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY32, L"Display 32 bit"); menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY64, L"Display 64 bit"); menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY128, L"Display 128 bit"); menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY128STRINGS, L"Display 128 bit + Resolve string pointers"); menu.AppendSeparator(); if (bits >= 64) { menu.Append(ID_REGISTERLIST_CHANGELOWER, L"Change lower 64 bit"); menu.Append(ID_REGISTERLIST_CHANGEUPPER, L"Change upper 64 bit"); } else { menu.Append(ID_REGISTERLIST_CHANGEVALUE, L"Change value"); } menu.AppendSeparator(); menu.Append(ID_REGISTERLIST_GOTOINMEMORYVIEW, L"Follow in Memory view"); menu.Append(ID_REGISTERLIST_GOTOINDISASM, L"Follow in Disasm"); switch (maxBits) { case 128: if (resolvePointerStrings) menu.Check(ID_REGISTERLIST_DISPLAY128STRINGS, true); else menu.Check(ID_REGISTERLIST_DISPLAY128,true); break; case 64: menu.Check(ID_REGISTERLIST_DISPLAY64,true); break; case 32: menu.Check(ID_REGISTERLIST_DISPLAY32,true); break; } menu.Bind(wxEVT_MENU, &CtrlRegisterList::onPopupClick, this); PopupMenu(&menu,evt.GetPosition()); return; } if (evt.ButtonIsDown(wxMOUSE_BTN_LEFT) || evt.ButtonIsDown(wxMOUSE_BTN_RIGHT)) { if (y < rowHeight) { int piece = GetSize().x/cpu->getRegisterCategoryCount(); int cat = std::min<int>(x/piece,cpu->getRegisterCategoryCount()-1); if (cat != category) { category = cat; Refresh(); } } else { int row = (y-rowHeight)/rowHeight; if (row != currentRows[category] && row < cpu->getRegisterCount(category)) setCurrentRow(row); } SetFocus(); SetFocusFromKbd(); } }
void TextureArea::mouseEvent(wxMouseEvent &event) { if (!texture) return; if (event.ButtonDown(wxMOUSE_BTN_LEFT)) { SetFocusFromKbd(); if (sel_patch != -1) { int xoff = screen_origin.x + (texture->patches[sel_patch].xoff * zoom); int yoff = screen_origin.y + (texture->patches[sel_patch].yoff * zoom); if (event.GetX() > xoff && event.GetX() < xoff + (images[sel_patch]->GetWidth() * zoom) && event.GetY() > yoff && event.GetY() < yoff + (images[sel_patch]->GetHeight() * zoom)) { move_origin.x = event.GetX(); move_origin.y = event.GetY(); orig_offset.x = texture->patches[sel_patch].xoff; orig_offset.y = texture->patches[sel_patch].yoff; moving = true; Refresh(); Update(); } else sel_patch = -1; } if (sel_patch == -1) { for (int a = texture->patches.size()-1; a >= 0; a--) { int xoff = screen_origin.x + (texture->patches[a].xoff * zoom); int yoff = screen_origin.y + (texture->patches[a].yoff * zoom); if (event.GetX() > xoff && event.GetX() < xoff + (images[a]->GetWidth() * zoom) && event.GetY() > yoff && event.GetY() < yoff + (images[a]->GetHeight() * zoom)) { move_origin.x = event.GetX(); move_origin.y = event.GetY(); orig_offset.x = texture->patches[a].xoff; orig_offset.y = texture->patches[a].yoff; moving = true; sel_patch = a; Refresh(); Update(); break; } } } return; } if (event.ButtonUp(wxMOUSE_BTN_LEFT)) { moving = false; parent->changePatch(sel_patch); Refresh(); Update(); return; } if (moving && event.LeftIsDown()) { texture->patches[sel_patch].xoff = orig_offset.x + ((event.GetX() - move_origin.x) / zoom); texture->patches[sel_patch].yoff = orig_offset.y + ((event.GetY() - move_origin.y) / zoom); Refresh(); Update(); parent->change = true; } }