Ram Watch - Implement AskSave() function and hook it up to NewList function
This commit is contained in:
parent
5908be430f
commit
ff7271c2e2
|
@ -19,6 +19,8 @@ namespace BizHawk.MultiClient
|
||||||
//Currently address is 4 digit hex, but at some point it needs to be smart enough to adjust size based on the emulator core used
|
//Currently address is 4 digit hex, but at some point it needs to be smart enough to adjust size based on the emulator core used
|
||||||
//Make Edit/Add/Duplicate Watch windows appear in relation to the listview box
|
//Make Edit/Add/Duplicate Watch windows appear in relation to the listview box
|
||||||
//Make a context menu for add/remove/Dup/etc, make the context menu & edit watch windows appear in relation to where they right clicked
|
//Make a context menu for add/remove/Dup/etc, make the context menu & edit watch windows appear in relation to where they right clicked
|
||||||
|
//TODO: Call AskSave in main client close function
|
||||||
|
//TODO: make so that only 1 instance of ram watch can be open at once (so that ask save can be reliable, as well as the watch button in ram search dialogs
|
||||||
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
|
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
|
||||||
int defaultHeight;
|
int defaultHeight;
|
||||||
List<Watch> watchList = new List<Watch>();
|
List<Watch> watchList = new List<Watch>();
|
||||||
|
@ -41,6 +43,31 @@ namespace BizHawk.MultiClient
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool AskSave()
|
||||||
|
{
|
||||||
|
if (changes)
|
||||||
|
{
|
||||||
|
DialogResult result = MessageBox.Show("Save Changes?", "Ram Watch", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);
|
||||||
|
|
||||||
|
if (result == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
//TOOD: Do quicksave if filename, else save as
|
||||||
|
if (string.Compare(currentWatchFile, "") == 0)
|
||||||
|
{
|
||||||
|
SaveAs();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SaveWatchFile(currentWatchFile);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (result == DialogResult.No)
|
||||||
|
return true;
|
||||||
|
else if (result == DialogResult.Cancel)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadWatchFromRecent(string file)
|
public void LoadWatchFromRecent(string file)
|
||||||
{
|
{
|
||||||
bool r = LoadWatchFile(file, false);
|
bool r = LoadWatchFile(file, false);
|
||||||
|
@ -56,11 +83,16 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
private void NewWatchList()
|
private void NewWatchList()
|
||||||
{
|
{
|
||||||
//TODO: ask to save changes if necessary
|
bool result = true;
|
||||||
watchList.Clear();
|
if (changes) result = AskSave();
|
||||||
DisplayWatchList();
|
|
||||||
currentWatchFile = "";
|
if (AskSave() == true)
|
||||||
changes = false;
|
{
|
||||||
|
watchList.Clear();
|
||||||
|
DisplayWatchList();
|
||||||
|
currentWatchFile = "";
|
||||||
|
changes = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SaveWatchFile(string path)
|
private bool SaveWatchFile(string path)
|
||||||
|
@ -313,7 +345,7 @@ namespace BizHawk.MultiClient
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void SaveAs()
|
||||||
{
|
{
|
||||||
var file = GetSaveFileFromUser();
|
var file = GetSaveFileFromUser();
|
||||||
if (file != null)
|
if (file != null)
|
||||||
|
@ -321,6 +353,11 @@ namespace BizHawk.MultiClient
|
||||||
//TODO: inform the user (with using an annoying message box)
|
//TODO: inform the user (with using an annoying message box)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SaveAs();
|
||||||
|
}
|
||||||
|
|
||||||
private void appendFileToolStripMenuItem_Click(object sender, EventArgs e)
|
private void appendFileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var file = GetFileFromUser();
|
var file = GetFileFromUser();
|
||||||
|
|
Loading…
Reference in New Issue