Ram Search - Remove Save Changes related code that was imported from Ram Watch. Due to the nature of this dialog, that is not a useful feature.

This commit is contained in:
andres.delikat 2011-02-21 15:56:25 +00:00
parent 5e2932f8e2
commit 13eace7d50
1 changed files with 8 additions and 50 deletions

View File

@ -37,7 +37,6 @@ namespace BizHawk.MultiClient
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
int defaultHeight;
string currentSearchFile = "";
bool changes = false;
public RamSearch()
{
@ -102,16 +101,11 @@ namespace BizHawk.MultiClient
{
var file = GetFileFromUser();
if (file != null)
{
bool r = true;
if (changes) r = AskSave();
if (r)
{
LoadSearchFile(file.FullName, false);
DisplaySearchList();
}
}
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
@ -1006,7 +1000,6 @@ namespace BizHawk.MultiClient
sw.WriteLine(str);
}
changes = false;
return true;
}
@ -1037,38 +1030,7 @@ namespace BizHawk.MultiClient
OutputLabel.Text = Path.GetFileName(currentSearchFile) + " saved.";
}
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(currentSearchFile, "") == 0)
{
SaveAs();
}
else
SaveSearchFile(currentSearchFile);
return true;
}
else if (result == DialogResult.No)
return true;
else if (result == DialogResult.Cancel)
return false;
}
return true;
}
private void LoadSearchFromRecent(string file)
{
bool z = true;
if (changes) z = AskSave();
if (z)
{
bool r = LoadSearchFile(file, false);
if (!r)
@ -1078,8 +1040,6 @@ namespace BizHawk.MultiClient
Global.Config.RecentSearches.Remove(file);
}
DisplaySearchList();
changes = false;
}
}
public int HowMany(string str, char c)
@ -1156,7 +1116,6 @@ namespace BizHawk.MultiClient
}
Global.Config.RecentSearches.Add(file.FullName);
changes = false;
OutputLabel.Text = Path.GetFileName(file.FullName);
//Update the number of watches
SetTotal();
@ -1215,7 +1174,6 @@ namespace BizHawk.MultiClient
if (file != null)
LoadSearchFile(file.FullName, true);
DisplaySearchList();
changes = true;
}
private FileInfo GetFileFromUser()