win32: the updown control in ram watch now works well
This commit is contained in:
parent
a208def471
commit
77a8d25a13
|
@ -877,53 +877,70 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
LPNMHDR lP = (LPNMHDR) lParam;
|
switch(wParam)
|
||||||
switch (lP->code)
|
|
||||||
{
|
{
|
||||||
case LVN_GETDISPINFO:
|
case ID_WATCHES_UPDOWN:
|
||||||
{
|
{
|
||||||
LV_DISPINFO *Item = (LV_DISPINFO *)lParam;
|
switch(((LPNMUPDOWN)lParam)->hdr.code)
|
||||||
Item->item.mask = LVIF_TEXT;
|
|
||||||
Item->item.state = 0;
|
|
||||||
Item->item.iImage = 0;
|
|
||||||
const unsigned int iNum = Item->item.iItem;
|
|
||||||
static char num[11];
|
|
||||||
switch (Item->item.iSubItem)
|
|
||||||
{
|
{
|
||||||
case 0:
|
case UDN_DELTAPOS:
|
||||||
sprintf(num,"%08X",rswatches[iNum].Address);
|
int delta = ((LPNMUPDOWN)lParam)->iDelta;
|
||||||
Item->item.pszText = num;
|
SendMessage(hDlg, WM_COMMAND, delta<0 ? IDC_C_WATCH_UP : IDC_C_WATCH_DOWN,0);
|
||||||
return true;
|
break;
|
||||||
case 1: {
|
|
||||||
int i = rswatches[iNum].CurValue;
|
|
||||||
int t = rswatches[iNum].Type;
|
|
||||||
int size = rswatches[iNum].Size;
|
|
||||||
const char* formatString = ((t=='s') ? "%d" : (t=='u') ? "%u" : (size=='d' ? "%08X" : size=='w' ? "%04X" : "%02X"));
|
|
||||||
switch (size)
|
|
||||||
{
|
|
||||||
case 'b':
|
|
||||||
default: sprintf(num, formatString, t=='s' ? (char)(i&0xff) : (unsigned char)(i&0xff)); break;
|
|
||||||
case 'w': sprintf(num, formatString, t=='s' ? (short)(i&0xffff) : (unsigned short)(i&0xffff)); break;
|
|
||||||
case 'd': sprintf(num, formatString, t=='s' ? (long)(i&0xffffffff) : (unsigned long)(i&0xffffffff)); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Item->item.pszText = num;
|
|
||||||
} return true;
|
|
||||||
case 2:
|
|
||||||
Item->item.pszText = rswatches[iNum].comment ? rswatches[iNum].comment : "";
|
|
||||||
return true;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case LVN_ODFINDITEM:
|
|
||||||
{
|
default:
|
||||||
// disable search by keyboard typing,
|
{
|
||||||
// because it interferes with some of the accelerators
|
LPNMHDR lP = (LPNMHDR) lParam;
|
||||||
// and it isn't very useful here anyway
|
switch (lP->code)
|
||||||
SetWindowLong(hDlg, DWL_MSGRESULT, ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST)));
|
{
|
||||||
return 1;
|
case LVN_GETDISPINFO:
|
||||||
|
{
|
||||||
|
LV_DISPINFO *Item = (LV_DISPINFO *)lParam;
|
||||||
|
Item->item.mask = LVIF_TEXT;
|
||||||
|
Item->item.state = 0;
|
||||||
|
Item->item.iImage = 0;
|
||||||
|
const unsigned int iNum = Item->item.iItem;
|
||||||
|
static char num[11];
|
||||||
|
switch (Item->item.iSubItem)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
sprintf(num,"%08X",rswatches[iNum].Address);
|
||||||
|
Item->item.pszText = num;
|
||||||
|
return true;
|
||||||
|
case 1: {
|
||||||
|
int i = rswatches[iNum].CurValue;
|
||||||
|
int t = rswatches[iNum].Type;
|
||||||
|
int size = rswatches[iNum].Size;
|
||||||
|
const char* formatString = ((t=='s') ? "%d" : (t=='u') ? "%u" : (size=='d' ? "%08X" : size=='w' ? "%04X" : "%02X"));
|
||||||
|
switch (size)
|
||||||
|
{
|
||||||
|
case 'b':
|
||||||
|
default: sprintf(num, formatString, t=='s' ? (char)(i&0xff) : (unsigned char)(i&0xff)); break;
|
||||||
|
case 'w': sprintf(num, formatString, t=='s' ? (short)(i&0xffff) : (unsigned short)(i&0xffff)); break;
|
||||||
|
case 'd': sprintf(num, formatString, t=='s' ? (long)(i&0xffffffff) : (unsigned long)(i&0xffffffff)); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Item->item.pszText = num;
|
||||||
|
} return true;
|
||||||
|
case 2:
|
||||||
|
Item->item.pszText = rswatches[iNum].comment ? rswatches[iNum].comment : "";
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case LVN_ODFINDITEM:
|
||||||
|
{
|
||||||
|
// disable search by keyboard typing,
|
||||||
|
// because it interferes with some of the accelerators
|
||||||
|
// and it isn't very useful here anyway
|
||||||
|
SetWindowLong(hDlg, DWL_MSGRESULT, ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST)));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1005,12 +1022,6 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
RWfileChanged=true;
|
RWfileChanged=true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case ID_WATCHES_UPDOWN:
|
|
||||||
{
|
|
||||||
int delta = ((LPNMUPDOWN)lParam)->iDelta;
|
|
||||||
SendMessage(hDlg, WM_COMMAND, delta<0 ? IDC_C_WATCH_UP : IDC_C_WATCH_DOWN,0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case RAMMENU_FILE_AUTOLOAD:
|
case RAMMENU_FILE_AUTOLOAD:
|
||||||
{
|
{
|
||||||
AutoRWLoad ^= 1;
|
AutoRWLoad ^= 1;
|
||||||
|
|
Loading…
Reference in New Issue