CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Windows/Debugger/CtrlRegisterList.h
Views: 1401
#pragma once12//////////////////////////////////////////////////////////////////////////3//CtrlRegisterList4// CtrlRegisterList.cpp5//////////////////////////////////////////////////////////////////////////6//This Win32 control is made to be flexible and usable with7//every kind of CPU architechture that has fixed width instruction words.8//Just supply it an instance of a class derived from Debugger, with all methods9//overridden for full functionality. Look at the ppc one for an example.10//11//To add to a dialog box, just draw a User Control in the dialog editor,12//and set classname to "CtrlRegisterList". you also need to call CtrlRegisterList::init()13//before opening this dialog, to register the window class.14//15//To get a class instance to be able to access it, just use16// CtrlRegisterList::getFrom(GetDlgItem(yourdialog, IDC_yourid)).1718#include "../../Core/Debugger/DebugInterface.h"1920class CtrlRegisterList21{22HWND wnd;23HFONT font;24RECT rect;2526int rowHeight;27int selection = 0;28int category = 0;2930int oldSelection = 0;3132bool selecting = false;33bool hasFocus = false;34DebugInterface *cpu = nullptr;35static TCHAR szClassName[];3637u32 lastPC = 0;38u32 *lastCat0Values = nullptr;39bool *changedCat0Regs = nullptr;40bool ctrlDown = false;4142u32 getSelectedRegValue(char *out, size_t size);43void copyRegisterValue();44void editRegisterValue();45public:46CtrlRegisterList(HWND _wnd);47~CtrlRegisterList();48static void init();49static void deinit();50static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);51static CtrlRegisterList * getFrom(HWND wnd);5253void onPaint(WPARAM wParam, LPARAM lParam);54void onKeyDown(WPARAM wParam, LPARAM lParam);55void onMouseDown(WPARAM wParam, LPARAM lParam, int button);56void onMouseUp(WPARAM wParam, LPARAM lParam, int button);57void onMouseMove(WPARAM wParam, LPARAM lParam, int button);58void redraw();5960int yToIndex(int y);6162void setCPU(DebugInterface *deb)63{64cpu = deb;6566int regs = cpu->GetNumRegsInCategory(0);67lastCat0Values = new u32[regs+3];68changedCat0Regs = new bool[regs+3];69memset(lastCat0Values, 0, (regs+3) * sizeof(u32));70memset(changedCat0Regs, 0, (regs+3) * sizeof(bool));71}72DebugInterface *getCPU()73{74return cpu;75}7677private:78bool redrawScheduled_ = false;79};808182