fix list-jumping-around annoyance in hotkey mapping dialog

This commit is contained in:
zeromus 2008-05-09 04:27:52 +00:00
parent 6bb20c0dc9
commit ece963731e
1 changed files with 15 additions and 7 deletions
src/drivers/win

View File

@ -484,12 +484,6 @@ void PopulateMappingDisplay(HWND hwndDlg)
// Get the selected filter.
int filter = (int)SendDlgItemMessage(hwndDlg, COMBO_FILTER, CB_GETCURSEL, 0, 0);
// Delete everything in the current display.
for(unsigned i = num; i>0; --i)
{
SendMessage(hwndListView, LVM_DELETEITEM, (WPARAM)i-1, 0);
}
int* conflictTable = 0;
// Get the filter type.
@ -504,6 +498,9 @@ void PopulateMappingDisplay(HWND hwndDlg)
LVITEM lvi;
int newItemCount = 0;
// Populate display.
for(int i = 0, idx = 0; i < EMUCMD_MAX; ++i)
{
@ -518,7 +515,12 @@ void PopulateMappingDisplay(HWND hwndDlg)
lvi.pszText = (char*)FCEUI_CommandTypeNames[FCEUI_CommandTable[i].type];
lvi.lParam = (LPARAM)i;
SendMessage(hwndListView, LVM_INSERTITEM, (WPARAM)0, (LPARAM)&lvi);
if(newItemCount<num)
SendMessage(hwndListView, LVM_SETITEM, (WPARAM)0, (LPARAM)&lvi);
else
SendMessage(hwndListView, LVM_INSERTITEM, (WPARAM)0, (LPARAM)&lvi);
newItemCount++;
memset(&lvi, 0, sizeof(lvi));
lvi.mask = LVIF_TEXT;
@ -540,6 +542,12 @@ void PopulateMappingDisplay(HWND hwndDlg)
}
}
//delete unneeded items
for(int i=newItemCount;i<num;i++)
{
SendMessage(hwndListView, LVM_DELETEITEM, (WPARAM)(newItemCount), 0);
}
if(conflictTable)
{
free(conflictTable);