fix #1492 RAM Watch editing problem (dont reorder entries when editing them)
This commit is contained in:
parent
f06c81d671
commit
e0d2567e6c
|
@ -101,7 +101,7 @@ bool VerifyWatchNotAlreadyAdded(const AddressWatcher& watch)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsertWatch(const AddressWatcher& Watch, char *Comment)
|
bool InsertWatch(const AddressWatcher& Watch, char *Comment, int atIndex)
|
||||||
{
|
{
|
||||||
if(!VerifyWatchNotAlreadyAdded(Watch))
|
if(!VerifyWatchNotAlreadyAdded(Watch))
|
||||||
return false;
|
return false;
|
||||||
|
@ -109,7 +109,16 @@ bool InsertWatch(const AddressWatcher& Watch, char *Comment)
|
||||||
if(WatchCount >= MAX_WATCH_COUNT)
|
if(WatchCount >= MAX_WATCH_COUNT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int i = WatchCount++;
|
int i = WatchCount;
|
||||||
|
if(atIndex == -1) {}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//move watches down
|
||||||
|
i = atIndex;
|
||||||
|
for(int x=WatchCount;x>atIndex;x--)
|
||||||
|
rswatches[x] = rswatches[x-1];
|
||||||
|
}
|
||||||
|
WatchCount++;
|
||||||
AddressWatcher& NewWatch = rswatches[i];
|
AddressWatcher& NewWatch = rswatches[i];
|
||||||
NewWatch = Watch;
|
NewWatch = Watch;
|
||||||
//if (NewWatch.comment) free(NewWatch.comment);
|
//if (NewWatch.comment) free(NewWatch.comment);
|
||||||
|
@ -760,7 +769,7 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
{
|
{
|
||||||
GetDlgItemText(hDlg,IDC_PROMPT_EDIT,Str_Tmp,80);
|
GetDlgItemText(hDlg,IDC_PROMPT_EDIT,Str_Tmp,80);
|
||||||
if (index < WatchCount) RemoveWatch(index);
|
if (index < WatchCount) RemoveWatch(index);
|
||||||
InsertWatch(Temp,Str_Tmp);
|
InsertWatch(Temp,Str_Tmp,index);
|
||||||
if(RamWatchHWnd)
|
if(RamWatchHWnd)
|
||||||
{
|
{
|
||||||
ListView_SetItemCount(GetDlgItem(RamWatchHWnd,IDC_WATCHLIST),WatchCount);
|
ListView_SetItemCount(GetDlgItem(RamWatchHWnd,IDC_WATCHLIST),WatchCount);
|
||||||
|
|
|
@ -48,7 +48,7 @@ extern int WatchCount; // number of valid items in rswatches
|
||||||
|
|
||||||
extern char Watch_Dir[1024];
|
extern char Watch_Dir[1024];
|
||||||
|
|
||||||
bool InsertWatch(const AddressWatcher& Watch, char *Comment);
|
bool InsertWatch(const AddressWatcher& Watch, char *Comment, int atIndex=-1);
|
||||||
bool InsertWatch(const AddressWatcher& Watch, HWND parent=NULL); // asks user for comment
|
bool InsertWatch(const AddressWatcher& Watch, HWND parent=NULL); // asks user for comment
|
||||||
void Update_RAM_Watch();
|
void Update_RAM_Watch();
|
||||||
bool Load_Watches(bool clear, const char* filename);
|
bool Load_Watches(bool clear, const char* filename);
|
||||||
|
|
Loading…
Reference in New Issue