Skip to content

Commit

Permalink
use the dictionary from Main form
Browse files Browse the repository at this point in the history
  • Loading branch information
Sayter99 committed Aug 30, 2017
1 parent 89be17a commit 75f14c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions 86ME/FSMGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class FSMGen
private List<int> keyboard_keys = new List<int>();
private List<ME_Trigger> commands;
private NewMotion Motion;
private Dictionary<string, string> FSMGen_lang_dic;
private bool[] method_flag = new bool[16];
private int[] offset = new int[45];
private string[] ps2_pins = new string[4];
Expand All @@ -56,8 +57,10 @@ class FSMGen
private bool IMU_compensatory = false;
private Quaternion invQ = new Quaternion();

public FSMGen(NewMotion nMotion, int[] off, ArrayList motionlist, GlobalSettings gs, int opVar_num, List<ME_Trigger> trigger_cmd)
public FSMGen(NewMotion nMotion, int[] off, ArrayList motionlist, GlobalSettings gs,
int opVar_num, List<ME_Trigger> trigger_cmd, Dictionary<string, string> lang_dic)
{
this.FSMGen_lang_dic = lang_dic;
this.Motion = nMotion;
this.opVar_num = opVar_num;
this.offset = off;
Expand Down Expand Up @@ -2069,7 +2072,7 @@ private void generate_example2(TextWriter writer, string class_name)
public void generate_AllinOne()
{
FolderBrowserDialog path = new FolderBrowserDialog();
path.Description = Motion.NewMotion_lang_dic["GenerateAllInOne_Description"];
path.Description = FSMGen_lang_dic["GenerateAllInOne_Description"];
var dialogResult = path.ShowDialog();

if (dialogResult == DialogResult.OK && path.SelectedPath != null)
Expand Down Expand Up @@ -2120,7 +2123,7 @@ public void generate_AllinOne()
public void generate_Library(string library_dir = "")
{
FolderBrowserDialog path = new FolderBrowserDialog();
path.Description = Motion.NewMotion_lang_dic["Generate_Description"];
path.Description = FSMGen_lang_dic["Generate_Description"];
var dialogResult = path.ShowDialog();

if (dialogResult == DialogResult.OK && path.SelectedPath != null)
Expand Down Expand Up @@ -2422,7 +2425,7 @@ private void generate_s2e(string path, string port)

public void generate_ScratchProject()
{
ScratchProperty properties = new ScratchProperty(Motion.NewMotion_lang_dic);
ScratchProperty properties = new ScratchProperty(FSMGen_lang_dic);
var dialogResult = properties.ShowDialog();
string path = properties.path;
if (dialogResult == DialogResult.OK)
Expand Down
6 changes: 3 additions & 3 deletions 86ME/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3705,7 +3705,7 @@ private void Generate_Click(object sender, EventArgs e)
MessageBox.Show(Main_lang_dic["errorMsg16"]);
return;
}
FSMGen g = new FSMGen(Motion, offset, ME_Motionlist, gs, compute_var.Count, trigger_cmd);
FSMGen g = new FSMGen(Motion, offset, ME_Motionlist, gs, compute_var.Count, trigger_cmd, Main_lang_dic);
string lib_dir = Path.GetFileNameWithoutExtension(load_filename);
//if ((new System.Text.RegularExpressions.Regex("^[a-zA-Z0-9_]{1,20}$")).IsMatch(lib_dir))
// g.generate_Library("\\" + lib_dir);
Expand All @@ -3724,7 +3724,7 @@ private void GenerateAllInOne_Click(object sender, EventArgs e)
MessageBox.Show(Main_lang_dic["errorMsg16"]);
return;
}
FSMGen g = new FSMGen(Motion, offset, ME_Motionlist, gs, compute_var.Count, trigger_cmd);
FSMGen g = new FSMGen(Motion, offset, ME_Motionlist, gs, compute_var.Count, trigger_cmd, Main_lang_dic);
g.generate_AllinOne();
clearTmpData();
}
Expand All @@ -3738,7 +3738,7 @@ private void GenerateScratch_Click(object sender, EventArgs e)
MessageBox.Show(Main_lang_dic["errorMsg16"]);
return;
}
FSMGen g = new FSMGen(Motion, offset, ME_Motionlist, gs, compute_var.Count, trigger_cmd);
FSMGen g = new FSMGen(Motion, offset, ME_Motionlist, gs, compute_var.Count, trigger_cmd, Main_lang_dic);
g.generate_ScratchProject();
clearTmpData();
}
Expand Down

0 comments on commit 75f14c3

Please sign in to comment.