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);
break;
case IDC_BREAKPOINTLIST:
breakpointList->HandleNotify(lParam);
break;
SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, breakpointList->HandleNotify(lParam));
return TRUE;
case IDC_THREADLIST:
threadList->HandleNotify(lParam);
break;
SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, threadList->HandleNotify(lParam));
return TRUE;
case IDC_STACKFRAMES:
stackTraceView->HandleNotify(lParam);
break;
SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, stackTraceView->HandleNotify(lParam));
return TRUE;
case IDC_MODULELIST:
moduleList->HandleNotify(lParam);
break;
SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, moduleList->HandleNotify(lParam));
return TRUE;
case IDC_DEBUG_BOTTOMTABS:
bottomTabs->HandleNotify(lParam);
break;

View file

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

View file

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

View file

@ -355,8 +355,8 @@ BOOL TabVertices::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
switch (wParam)
{
case IDC_GEDBG_VERTICES:
values->HandleNotify(lParam);
break;
SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, values->HandleNotify(lParam));
return TRUE;
}
break;
}
@ -652,8 +652,8 @@ BOOL TabMatrices::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
switch (wParam)
{
case IDC_GEDBG_MATRICES:
values->HandleNotify(lParam);
break;
SetWindowLongPtr(m_hDlg, DWLP_MSGRESULT, values->HandleNotify(lParam));
return TRUE;
}
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);
}
void GenericListControl::HandleNotify(LPARAM lParam)
{
int GenericListControl::HandleNotify(LPARAM lParam) {
LPNMHDR mhdr = (LPNMHDR) lParam;
if (mhdr->code == NM_DBLCLK)
@ -224,7 +223,7 @@ void GenericListControl::HandleNotify(LPARAM lParam)
LPNMITEMACTIVATE item = (LPNMITEMACTIVATE) lParam;
if ((item->iItem != -1 && item->iItem < GetRowCount()) || sendInvalidRows)
OnDoubleClick(item->iItem,item->iSubItem);
return;
return 0;
}
if (mhdr->code == NM_RCLICK)
@ -232,7 +231,23 @@ void GenericListControl::HandleNotify(LPARAM lParam)
const LPNMITEMACTIVATE item = (LPNMITEMACTIVATE)lParam;
if ((item->iItem != -1 && item->iItem < GetRowCount()) || sendInvalidRows)
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)
@ -247,7 +262,7 @@ void GenericListControl::HandleNotify(LPARAM lParam)
dispInfo->item.pszText = stringBuffer;
dispInfo->item.mask |= LVIF_TEXT;
return;
return 0;
}
// handle checkboxes
@ -263,8 +278,10 @@ void GenericListControl::HandleNotify(LPARAM lParam)
OnToggle(item->iItem,newImage == 2);
}
return;
return 0;
}
return 0;
}
void GenericListControl::Update() {

View file

@ -33,6 +33,7 @@ struct GenericListViewDef
#define GLVC_CENTERED 1
typedef struct tagNMLVCUSTOMDRAW *LPNMLVCUSTOMDRAW;
// 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
@ -44,7 +45,7 @@ class GenericListControl
public:
GenericListControl(HWND hwnd, const GenericListViewDef& def);
virtual ~GenericListControl();
void HandleNotify(LPARAM lParam);
int HandleNotify(LPARAM lParam);
void Update();
int GetSelectedIndex();
HWND GetHandle() { return handle; };
@ -62,6 +63,9 @@ protected:
virtual void CopyRows(int start, int size);
virtual void OnToggle(int item, bool newValue) { };
virtual bool ListenRowPrePaint() { return false; }
virtual bool OnRowPrePaint(int row, LPNMLVCUSTOMDRAW msg) { return false; }
private:
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
void ProcessUpdate();