Debugger: Allow custom draw and generic lists.

This commit is contained in:
Unknown W. Brackets 2022-02-13 10:22:38 -08:00
parent df1a15938d
commit b654ee9d44
6 changed files with 46 additions and 25 deletions

View file

@ -361,17 +361,17 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
leftTabs->HandleNotify(lParam); leftTabs->HandleNotify(lParam);
break; break;
case IDC_BREAKPOINTLIST: case IDC_BREAKPOINTLIST:
breakpointList->HandleNotify(lParam); SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, breakpointList->HandleNotify(lParam));
break; return TRUE;
case IDC_THREADLIST: case IDC_THREADLIST:
threadList->HandleNotify(lParam); SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, threadList->HandleNotify(lParam));
break; return TRUE;
case IDC_STACKFRAMES: case IDC_STACKFRAMES:
stackTraceView->HandleNotify(lParam); SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, stackTraceView->HandleNotify(lParam));
break; return TRUE;
case IDC_MODULELIST: case IDC_MODULELIST:
moduleList->HandleNotify(lParam); SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, moduleList->HandleNotify(lParam));
break; return TRUE;
case IDC_DEBUG_BOTTOMTABS: case IDC_DEBUG_BOTTOMTABS:
bottomTabs->HandleNotify(lParam); bottomTabs->HandleNotify(lParam);
break; break;

View file

@ -258,11 +258,11 @@ BOOL TabDisplayLists::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
switch (wParam) switch (wParam)
{ {
case IDC_GEDBG_LISTS_STACK: case IDC_GEDBG_LISTS_STACK:
stack->HandleNotify(lParam); SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, stack->HandleNotify(lParam));
break; return TRUE;
case IDC_GEDBG_LISTS_ALLLISTS: case IDC_GEDBG_LISTS_ALLLISTS:
allLists->HandleNotify(lParam); SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, allLists->HandleNotify(lParam));
break; return TRUE;
} }
break; break;

View file

@ -1054,8 +1054,8 @@ BOOL TabStateValues::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
switch (wParam) switch (wParam)
{ {
case IDC_GEDBG_VALUES: case IDC_GEDBG_VALUES:
values->HandleNotify(lParam); SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, values->HandleNotify(lParam));
break; return TRUE;
} }
break; break;
} }

View file

@ -355,8 +355,8 @@ BOOL TabVertices::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
switch (wParam) switch (wParam)
{ {
case IDC_GEDBG_VERTICES: case IDC_GEDBG_VERTICES:
values->HandleNotify(lParam); SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, values->HandleNotify(lParam));
break; return TRUE;
} }
break; break;
} }
@ -652,8 +652,8 @@ BOOL TabMatrices::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
switch (wParam) switch (wParam)
{ {
case IDC_GEDBG_MATRICES: case IDC_GEDBG_MATRICES:
values->HandleNotify(lParam); SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, values->HandleNotify(lParam));
break; return TRUE;
} }
break; break;
} }

View file

@ -215,8 +215,7 @@ void GenericListControl::SetIconList(int w, int h, const std::vector<HICON> &ico
ListView_SetImageList(handle, (HIMAGELIST)images_, LVSIL_STATE); ListView_SetImageList(handle, (HIMAGELIST)images_, LVSIL_STATE);
} }
void GenericListControl::HandleNotify(LPARAM lParam) int GenericListControl::HandleNotify(LPARAM lParam) {
{
LPNMHDR mhdr = (LPNMHDR) lParam; LPNMHDR mhdr = (LPNMHDR) lParam;
if (mhdr->code == NM_DBLCLK) if (mhdr->code == NM_DBLCLK)
@ -224,7 +223,7 @@ void GenericListControl::HandleNotify(LPARAM lParam)
LPNMITEMACTIVATE item = (LPNMITEMACTIVATE) lParam; LPNMITEMACTIVATE item = (LPNMITEMACTIVATE) lParam;
if ((item->iItem != -1 && item->iItem < GetRowCount()) || sendInvalidRows) if ((item->iItem != -1 && item->iItem < GetRowCount()) || sendInvalidRows)
OnDoubleClick(item->iItem,item->iSubItem); OnDoubleClick(item->iItem,item->iSubItem);
return; return 0;
} }
if (mhdr->code == NM_RCLICK) if (mhdr->code == NM_RCLICK)
@ -232,7 +231,23 @@ void GenericListControl::HandleNotify(LPARAM lParam)
const LPNMITEMACTIVATE item = (LPNMITEMACTIVATE)lParam; const LPNMITEMACTIVATE item = (LPNMITEMACTIVATE)lParam;
if ((item->iItem != -1 && item->iItem < GetRowCount()) || sendInvalidRows) if ((item->iItem != -1 && item->iItem < GetRowCount()) || sendInvalidRows)
OnRightClick(item->iItem,item->iSubItem,item->ptAction); OnRightClick(item->iItem,item->iSubItem,item->ptAction);
return; return 0;
}
if (mhdr->code == NM_CUSTOMDRAW && ListenRowPrePaint()) {
LPNMLVCUSTOMDRAW msg = (LPNMLVCUSTOMDRAW)lParam;
switch (msg->nmcd.dwDrawStage) {
case CDDS_PREPAINT:
return CDRF_NOTIFYITEMDRAW;
case CDDS_ITEMPREPAINT:
if (OnRowPrePaint((int)msg->nmcd.dwItemSpec, msg)) {
return CDRF_NEWFONT;
}
return CDRF_DODEFAULT;
}
return CDRF_DODEFAULT;
} }
if (mhdr->code == LVN_GETDISPINFO) if (mhdr->code == LVN_GETDISPINFO)
@ -247,7 +262,7 @@ void GenericListControl::HandleNotify(LPARAM lParam)
dispInfo->item.pszText = stringBuffer; dispInfo->item.pszText = stringBuffer;
dispInfo->item.mask |= LVIF_TEXT; dispInfo->item.mask |= LVIF_TEXT;
return; return 0;
} }
// handle checkboxes // handle checkboxes
@ -263,8 +278,10 @@ void GenericListControl::HandleNotify(LPARAM lParam)
OnToggle(item->iItem,newImage == 2); OnToggle(item->iItem,newImage == 2);
} }
return; return 0;
} }
return 0;
} }
void GenericListControl::Update() { void GenericListControl::Update() {

View file

@ -33,6 +33,7 @@ struct GenericListViewDef
#define GLVC_CENTERED 1 #define GLVC_CENTERED 1
typedef struct tagNMLVCUSTOMDRAW *LPNMLVCUSTOMDRAW;
// the most significant bit states whether the key is currently down. // the most significant bit states whether the key is currently down.
// simply checking if it's != 0 is not enough, as bit0 is set if // simply checking if it's != 0 is not enough, as bit0 is set if
@ -44,7 +45,7 @@ class GenericListControl
public: public:
GenericListControl(HWND hwnd, const GenericListViewDef& def); GenericListControl(HWND hwnd, const GenericListViewDef& def);
virtual ~GenericListControl(); virtual ~GenericListControl();
void HandleNotify(LPARAM lParam); int HandleNotify(LPARAM lParam);
void Update(); void Update();
int GetSelectedIndex(); int GetSelectedIndex();
HWND GetHandle() { return handle; }; HWND GetHandle() { return handle; };
@ -62,6 +63,9 @@ protected:
virtual void CopyRows(int start, int size); virtual void CopyRows(int start, int size);
virtual void OnToggle(int item, bool newValue) { }; virtual void OnToggle(int item, bool newValue) { };
virtual bool ListenRowPrePaint() { return false; }
virtual bool OnRowPrePaint(int row, LPNMLVCUSTOMDRAW msg) { return false; }
private: private:
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
void ProcessUpdate(); void ProcessUpdate();