ramwatch: add more (ListView_GetSelectionMark() != -1) checks

This commit is contained in:
gocha 2009-09-25 13:30:04 +00:00
parent bab64f3c94
commit ce279995de
1 changed files with 25 additions and 13 deletions

View File

@ -965,15 +965,21 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
return true; return true;
case IDC_C_WATCH_REMOVE: case IDC_C_WATCH_REMOVE:
watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST)); watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST));
RemoveWatch(watchIndex); if(watchIndex != -1)
ListView_SetItemCount(GetDlgItem(hDlg,IDC_WATCHLIST),WatchCount); {
RWfileChanged=true; RemoveWatch(watchIndex);
SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST)); ListView_SetItemCount(GetDlgItem(hDlg,IDC_WATCHLIST),WatchCount);
RWfileChanged=true;
SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST));
}
return true; return true;
case IDC_C_WATCH_EDIT: case IDC_C_WATCH_EDIT:
watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST)); watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST));
DialogBoxParam(hAppInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, (DLGPROC) EditWatchProc,(LPARAM) watchIndex); if(watchIndex != -1)
SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST)); {
DialogBoxParam(hAppInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, (DLGPROC) EditWatchProc,(LPARAM) watchIndex);
SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST));
}
return true; return true;
case IDC_C_WATCH: case IDC_C_WATCH:
rswatches[WatchCount].Address = rswatches[WatchCount].WrongEndian = 0; rswatches[WatchCount].Address = rswatches[WatchCount].WrongEndian = 0;
@ -984,12 +990,15 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
return true; return true;
case IDC_C_WATCH_DUPLICATE: case IDC_C_WATCH_DUPLICATE:
watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST)); watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST));
rswatches[WatchCount].Address = rswatches[watchIndex].Address; if(watchIndex != -1)
rswatches[WatchCount].WrongEndian = rswatches[watchIndex].WrongEndian; {
rswatches[WatchCount].Size = rswatches[watchIndex].Size; rswatches[WatchCount].Address = rswatches[watchIndex].Address;
rswatches[WatchCount].Type = rswatches[watchIndex].Type; rswatches[WatchCount].WrongEndian = rswatches[watchIndex].WrongEndian;
DialogBoxParam(hAppInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, (DLGPROC) EditWatchProc,(LPARAM) WatchCount); rswatches[WatchCount].Size = rswatches[watchIndex].Size;
SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST)); rswatches[WatchCount].Type = rswatches[watchIndex].Type;
DialogBoxParam(hAppInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, (DLGPROC) EditWatchProc,(LPARAM) WatchCount);
SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST));
}
return true; return true;
case IDC_C_WATCH_UP: case IDC_C_WATCH_UP:
{ {
@ -1038,7 +1047,10 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
case IDC_C_ADDCHEAT: case IDC_C_ADDCHEAT:
{ {
watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST)) | (1 << 24); watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST)) | (1 << 24);
// DialogBoxParam(hAppInst, MAKEINTRESOURCE(IDD_EDITCHEAT), hDlg, (DLGPROC) EditCheatProc,(LPARAM) searchIndex); //TODO: made a IDD_EDITCHEAT dialog, and EditCheatProc (are they in GENS?) and integrate into cheats system if(watchIndex != -1)
{
// DialogBoxParam(hAppInst, MAKEINTRESOURCE(IDD_EDITCHEAT), hDlg, (DLGPROC) EditCheatProc,(LPARAM) searchIndex); //TODO: made a IDD_EDITCHEAT dialog, and EditCheatProc (are they in GENS?) and integrate into cheats system
}
break; break;
} }
case IDCANCEL: case IDCANCEL: