void axis_Save(object sender, EventArgs e)
{
if (sender is ctrlAxisEditor)
{
ctrlAxisEditor editor = (ctrlAxisEditor)sender;
// recalculate the values back and store it in the file at the correct location
float[] newvalues = editor.GetData();
// well.. recalculate the data based on these new values
//editor.CorrectionFactor
int[] iValues = new int[newvalues.Length];
// calculate back to integer values
for (int i = 0; i < newvalues.Length; i++)
{
int iValue = Convert.ToInt32(Convert.ToDouble(newvalues.GetValue(i))/editor.CorrectionFactor);
iValues.SetValue(iValue, i);
}
byte[] barr = new byte[iValues.Length * 2];
int bCount = 0;
for (int i = 0; i < iValues.Length; i++)
{
int iVal = (int)iValues.GetValue(i);
byte b1 = (byte)((iVal & 0x00FF00) / 256);
byte b2 = (byte)(iVal & 0x0000FF);
barr[bCount++] = b1;
barr[bCount++] = b2;
}
string note = string.Empty;
if (m_appSettings.RequestProjectNotes && Tools.Instance.m_CurrentWorkingProject != "")
{
//request a small note from the user in which he/she can denote a description of the change
frmChangeNote changenote = new frmChangeNote();
changenote.ShowDialog();
note = changenote.Note;
}
SaveAxisDataIncludingSyncOption(editor.AxisAddress, barr.Length, barr, Tools.Instance.m_currentfile, true, note);
// and we need to update mapviewers maybe?
UpdateOpenViewers(Tools.Instance.m_currentfile);
}
}