FormulaSourceEditor.cs 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420
  1. namespace Easychart.Finance.Win
  2. {
  3. using Easychart.Finance;
  4. using System;
  5. using System.CodeDom.Compiler;
  6. using System.ComponentModel;
  7. using System.Drawing;
  8. using System.IO;
  9. using System.Resources;
  10. using System.Windows.Forms;
  11. [ToolboxItem(false)]
  12. public class FormulaSourceEditor : Form
  13. {
  14. private Button btnClose;
  15. private Button btnCompile;
  16. private Button btnDebug;
  17. private Button btnFormula;
  18. private Button btnInsertMethod;
  19. private CheckBox cbIsMainView;
  20. private CheckBox cbNotRealNameSpace;
  21. private ComboBox cbParamType;
  22. private ContextMenu cmTree;
  23. private IContainer components;
  24. private static FormulaSourceEditor CurrentEditor;
  25. private bool DisableChange;
  26. private string filename = "";
  27. private TreeView FormulaTree;
  28. private FormulaSpace fs;
  29. private ColumnHeader HeaderColumn;
  30. private ColumnHeader HeaderLine;
  31. private ColumnHeader HeaderMessage;
  32. private ColumnHeader HeaderName;
  33. private ColumnHeader HeaderNumber;
  34. private ImageList ilFormula;
  35. private TreeNode LastNode;
  36. private ListBox lbIntelliSence;
  37. private Label lDefaultValue;
  38. private Label lFormulaProgramCode;
  39. private Label lFormulaProgramDesc;
  40. private Label lFormulaProgramName;
  41. private Label lFullName;
  42. private Label lMaxValue;
  43. private Label lMinValue;
  44. private Label lNamespaceDescription;
  45. private Label lNamespaceName;
  46. private Label lOverride = new Label();
  47. private Label lParamDesc;
  48. private Label lParamName;
  49. private Label lParamType;
  50. private ListView lvErrors;
  51. private Label lVersion;
  52. private MenuItem menuItem1;
  53. private MenuItem menuItem4;
  54. private MenuItem miAddFormulaProgram;
  55. private MenuItem miAddNamespace;
  56. private MenuItem miAddParam;
  57. private MenuItem miCompile;
  58. private MenuItem miDeleteNode;
  59. private MenuItem miExit;
  60. private MenuItem miNew;
  61. private MenuItem miOpen;
  62. private MenuItem miSave;
  63. private MenuItem miSaveAs;
  64. private MainMenu mmFumular;
  65. private bool modified;
  66. private OpenFileDialog odFormula;
  67. private Panel pnBottom;
  68. private Panel pnCode;
  69. private Panel pnFormula;
  70. private Panel pnNamespace;
  71. private Panel pnProgram;
  72. private Panel pnTop;
  73. private SaveFileDialog sdFormula;
  74. private Splitter spFormula;
  75. private Splitter spProgram;
  76. private TextBox tbDefaultValue;
  77. private RichTextBox tbFormulaProgramCode;
  78. private TextBox tbFormulaProgramDesc;
  79. private TextBox tbFormulaProgramName;
  80. private TextBox tbMaxValue;
  81. private TextBox tbMinValue;
  82. private TextBox tbNamespaceDesc;
  83. private TextBox tbNamespaceName;
  84. private TextBox tbParamDesc;
  85. private TextBox tbParamName;
  86. private TextBox tbProgramFullName;
  87. private TextBox tbVersion;
  88. private TabControl tcFormula;
  89. private TabPage tpFormulaProgram;
  90. private TabPage tpNamespace;
  91. private TabPage tpParameter;
  92. public FormulaSourceEditor()
  93. {
  94. this.InitializeComponent();
  95. this.fs = new FormulaSpace("FML");
  96. this.fs.Description = "Namespace description";
  97. this.fs.Version = "1.0.0.0";
  98. this.LoadToTree(this.fs);
  99. this.lOverride.Parent = this.pnFormula;
  100. this.lOverride.Width = 0x7d0;
  101. this.lOverride.Height = 0x18;
  102. this.lOverride.Top = this.tcFormula.Top;
  103. this.lOverride.Left = 0;
  104. this.lOverride.BringToFront();
  105. this.lOverride.BackColor = Color.WhiteSmoke;
  106. this.lOverride.Font = new Font("verdana", 11f, FontStyle.Bold);
  107. this.lOverride.ForeColor = Color.DarkGray;
  108. this.AddChangeEvent(this);
  109. }
  110. private void AddChangeEvent(Control c)
  111. {
  112. if (c is TextBox)
  113. {
  114. ((TextBox)c).TextChanged += new EventHandler(this.cbIsMainView_CheckedChanged);
  115. }
  116. else if (c is CheckBox)
  117. {
  118. ((CheckBox)c).TextChanged += new EventHandler(this.cbIsMainView_CheckedChanged);
  119. }
  120. else if (c is RichTextBox)
  121. {
  122. ((RichTextBox)c).TextChanged += new EventHandler(this.cbIsMainView_CheckedChanged);
  123. }
  124. foreach (Control control in c.Controls)
  125. {
  126. this.AddChangeEvent(control);
  127. }
  128. }
  129. private void AddError(CompilerErrorCollection ces, FormulaProgram fp)
  130. {
  131. this.lvErrors.Items.Clear();
  132. foreach (CompilerError error in ces)
  133. {
  134. ListViewItem item = null;
  135. if (fp != null)
  136. {
  137. item = this.lvErrors.Items.Add(fp.Name);
  138. item.Tag = fp;
  139. }
  140. else
  141. {
  142. FormulaProgram programByLineNum = this.fs.GetProgramByLineNum(error.Line);
  143. if (programByLineNum != null)
  144. {
  145. item = this.lvErrors.Items.Add(programByLineNum.Name);
  146. programByLineNum.AdjustErrors(error);
  147. item.Tag = programByLineNum;
  148. }
  149. else
  150. {
  151. item = this.lvErrors.Items.Add("");
  152. }
  153. }
  154. if (item != null)
  155. {
  156. item.SubItems.Add(error.Line.ToString());
  157. item.SubItems.Add(error.Column.ToString());
  158. item.SubItems.Add(error.ErrorNumber.ToString());
  159. item.SubItems.Add(error.ErrorText);
  160. }
  161. }
  162. }
  163. private void btnClose_Click(object sender, EventArgs e)
  164. {
  165. base.Close();
  166. }
  167. private void btnCompile_Click(object sender, EventArgs e)
  168. {
  169. this.Compile();
  170. }
  171. private void btnDebug_Click(object sender, EventArgs e)
  172. {
  173. FormulaProgram tag = (FormulaProgram)this.FormulaTree.SelectedNode.Tag;
  174. try
  175. {
  176. tag.Compile();
  177. this.lvErrors.Items.Clear();
  178. this.lvErrors.Items.Add("OK!");
  179. }
  180. catch (FormulaErrorException exception)
  181. {
  182. this.AddError(exception.ces, tag);
  183. }
  184. }
  185. private void btnFormula_Click(object sender, EventArgs e)
  186. {
  187. string str = ChartWinControl.DoSelectFormula(null, null, true);
  188. if (str != null)
  189. {
  190. Clipboard.SetDataObject("\"" + str + "\"");
  191. this.tbFormulaProgramCode.Paste();
  192. }
  193. }
  194. private void btnInsertMethod_Click(object sender, EventArgs e)
  195. {
  196. string data = ChartWinControl.OnSelectMethod(null);
  197. if (data != null)
  198. {
  199. Clipboard.SetDataObject(data);
  200. this.tbFormulaProgramCode.Paste();
  201. }
  202. }
  203. private void cbIsMainView_CheckedChanged(object sender, EventArgs e)
  204. {
  205. if (!this.DisableChange)
  206. {
  207. this.Modified = true;
  208. }
  209. }
  210. private bool Compile()
  211. {
  212. bool flag;
  213. try
  214. {
  215. long ticks = DateTime.Now.Ticks;
  216. this.SaveDataToNode();
  217. ////todo:ÎļþÃû´ø"."ÓÐÎÊÌâ
  218. this.fs.SaveCShartSource(this.Filename.Replace('.', '_') + ".cs");
  219. this.fs.Compile(this.Filename.Replace('.', '_') + ".dll", "");
  220. this.lvErrors.Items.Clear();
  221. this.lvErrors.Items.Add("OK! - " + ((DateTime.Now.Ticks - ticks) / 0x2710L) + "ms");
  222. flag = true;
  223. }
  224. catch (FormulaErrorException exception)
  225. {
  226. this.AddError(exception.ces, null);
  227. flag = false;
  228. }
  229. finally
  230. {
  231. this.LocateFirstProgram();
  232. }
  233. return flag;
  234. }
  235. protected override void Dispose(bool disposing)
  236. {
  237. if (disposing && (this.components != null))
  238. {
  239. this.components.Dispose();
  240. }
  241. base.Dispose(disposing);
  242. }
  243. private TreeNode FindNode(TreeNode tn, FormulaProgram fp)
  244. {
  245. if (tn.Tag == fp)
  246. {
  247. return tn;
  248. }
  249. foreach (TreeNode node in tn.Nodes)
  250. {
  251. TreeNode node2 = this.FindNode(node, fp);
  252. if (node2 != null)
  253. {
  254. return node2;
  255. }
  256. }
  257. return null;
  258. }
  259. private TreeNode FindNode(TreeNode tn, string ProgramName)
  260. {
  261. if ((tn.Tag is FormulaProgram) && ((tn.Tag as FormulaProgram).Name == ProgramName))
  262. {
  263. return tn;
  264. }
  265. foreach (TreeNode node in tn.Nodes)
  266. {
  267. TreeNode node2 = this.FindNode(node, ProgramName);
  268. if (node2 != null)
  269. {
  270. return node2;
  271. }
  272. }
  273. return null;
  274. }
  275. private void FormulaEditor_Activated(object sender, EventArgs e)
  276. {
  277. this.tbFormulaProgramCode.Focus();
  278. }
  279. private void FormulaEditor_Closing(object sender, CancelEventArgs e)
  280. {
  281. if (this.Modified)
  282. {
  283. e.Cancel = true;
  284. }
  285. }
  286. private void FormulaEditor_Load(object sender, EventArgs e)
  287. {
  288. this.cbParamType.Items.Clear();
  289. this.cbParamType.Items.AddRange(Enum.GetNames(typeof(FormulaParamType)));
  290. string[] commandLineArgs = Environment.GetCommandLineArgs();
  291. if (commandLineArgs.Length == 2)
  292. {
  293. this.LoadEditor(commandLineArgs[1], null);
  294. }
  295. else if (commandLineArgs.Length == 3)
  296. {
  297. this.LoadEditor(commandLineArgs[1], commandLineArgs[2]);
  298. }
  299. }
  300. private void FormulaTree_AfterSelect(object sender, TreeViewEventArgs e)
  301. {
  302. this.DisableChange = true;
  303. try
  304. {
  305. if (e.Node.Tag is FormulaSpace)
  306. {
  307. FormulaSpace tag = (FormulaSpace)e.Node.Tag;
  308. this.tbNamespaceName.Text = tag.Name;
  309. this.tbNamespaceDesc.Text = tag.Description;
  310. this.tbVersion.Visible = e.Node.Parent == null;
  311. this.lVersion.Visible = this.tbVersion.Visible;
  312. this.tbVersion.Text = tag.Version;
  313. this.cbNotRealNameSpace.Checked = tag.GroupOnly;
  314. this.tcFormula.SelectedTab = this.tpNamespace;
  315. this.lOverride.Text = "Namespace properties:" + tag.Name;
  316. }
  317. else if (e.Node.Tag is FormulaProgram)
  318. {
  319. FormulaProgram program = (FormulaProgram)e.Node.Tag;
  320. this.tbFormulaProgramName.Text = program.Name;
  321. this.tbProgramFullName.Text = program.FullName;
  322. if (program.Code != null)
  323. {
  324. this.tbFormulaProgramCode.Lines = this.Trim(program.Code.Split(new char[] { '\n' }));
  325. }
  326. else
  327. {
  328. this.tbFormulaProgramCode.Text = "";
  329. }
  330. if (program.Description != null)
  331. {
  332. this.tbFormulaProgramDesc.Lines = this.Trim(program.Description.Split(new char[] { '\n' }));
  333. }
  334. else
  335. {
  336. this.tbFormulaProgramDesc.Text = "";
  337. }
  338. this.cbIsMainView.Checked = program.IsMainView;
  339. this.tcFormula.SelectedTab = this.tpFormulaProgram;
  340. this.lOverride.Text = "Formula script code:" + program.Name;
  341. }
  342. else if (e.Node.Tag is FormulaParam)
  343. {
  344. FormulaParam param = (FormulaParam)e.Node.Tag;
  345. this.tbParamName.Text = param.Name;
  346. this.tbParamDesc.Text = param.Description;
  347. this.tbMinValue.Text = param.MinValue;
  348. this.tbMaxValue.Text = param.MaxValue;
  349. this.tbDefaultValue.Text = param.DefaultValue;
  350. this.cbParamType.SelectedIndex = (int)param.ParamType;
  351. this.tcFormula.SelectedTab = this.tpParameter;
  352. this.lOverride.Text = "Formula script parameter:" + param.Name;
  353. }
  354. this.FormulaTree.Focus();
  355. this.LastNode = e.Node;
  356. }
  357. finally
  358. {
  359. this.DisableChange = false;
  360. }
  361. }
  362. private void FormulaTree_BeforeSelect(object sender, TreeViewCancelEventArgs e)
  363. {
  364. this.SaveDataToNode(this.LastNode);
  365. }
  366. private void FormulaTree_MouseDown(object sender, MouseEventArgs e)
  367. {
  368. if (e.Button == MouseButtons.Right)
  369. {
  370. TreeNode nodeAt = this.FormulaTree.GetNodeAt(e.X, e.Y);
  371. if (nodeAt == null)
  372. {
  373. nodeAt = this.FormulaTree.SelectedNode;
  374. }
  375. else
  376. {
  377. this.FormulaTree.SelectedNode = nodeAt;
  378. }
  379. if (nodeAt.Tag is FormulaSpace)
  380. {
  381. this.miAddFormulaProgram.Visible = true;
  382. this.miAddNamespace.Visible = true;
  383. this.miAddParam.Visible = false;
  384. }
  385. else if (nodeAt.Tag is FormulaProgram)
  386. {
  387. this.miAddFormulaProgram.Visible = false;
  388. this.miAddNamespace.Visible = false;
  389. this.miAddParam.Visible = true;
  390. }
  391. else if (nodeAt.Tag is FormulaParam)
  392. {
  393. this.miAddFormulaProgram.Visible = false;
  394. this.miAddNamespace.Visible = false;
  395. this.miAddParam.Visible = false;
  396. }
  397. this.cmTree.Show(this.FormulaTree, new Point(e.X, e.Y));
  398. }
  399. }
  400. private void InitializeComponent()
  401. {
  402. this.components = new Container();
  403. ResourceManager manager = new ResourceManager(typeof(FormulaSourceEditor));
  404. this.FormulaTree = new TreeView();
  405. this.ilFormula = new ImageList(this.components);
  406. this.tcFormula = new TabControl();
  407. this.tpNamespace = new TabPage();
  408. this.pnNamespace = new Panel();
  409. this.cbNotRealNameSpace = new CheckBox();
  410. this.lNamespaceDescription = new Label();
  411. this.tbNamespaceDesc = new TextBox();
  412. this.lNamespaceName = new Label();
  413. this.tbNamespaceName = new TextBox();
  414. this.tpFormulaProgram = new TabPage();
  415. this.spProgram = new Splitter();
  416. this.pnProgram = new Panel();
  417. this.btnFormula = new Button();
  418. this.btnInsertMethod = new Button();
  419. this.btnCompile = new Button();
  420. this.lbIntelliSence = new ListBox();
  421. this.lFullName = new Label();
  422. this.tbProgramFullName = new TextBox();
  423. this.btnDebug = new Button();
  424. this.lFormulaProgramDesc = new Label();
  425. this.tbFormulaProgramDesc = new TextBox();
  426. this.cbIsMainView = new CheckBox();
  427. this.tbFormulaProgramName = new TextBox();
  428. this.lFormulaProgramName = new Label();
  429. this.lFormulaProgramCode = new Label();
  430. this.pnCode = new Panel();
  431. this.tbFormulaProgramCode = new RichTextBox();
  432. this.lvErrors = new ListView();
  433. this.HeaderName = new ColumnHeader();
  434. this.HeaderLine = new ColumnHeader();
  435. this.HeaderColumn = new ColumnHeader();
  436. this.HeaderNumber = new ColumnHeader();
  437. this.HeaderMessage = new ColumnHeader();
  438. this.tpParameter = new TabPage();
  439. this.cbParamType = new ComboBox();
  440. this.lParamType = new Label();
  441. this.tbParamDesc = new TextBox();
  442. this.lParamDesc = new Label();
  443. this.tbParamName = new TextBox();
  444. this.lParamName = new Label();
  445. this.tbMaxValue = new TextBox();
  446. this.tbMinValue = new TextBox();
  447. this.tbDefaultValue = new TextBox();
  448. this.lDefaultValue = new Label();
  449. this.lMaxValue = new Label();
  450. this.lMinValue = new Label();
  451. this.mmFumular = new MainMenu();
  452. this.menuItem1 = new MenuItem();
  453. this.miNew = new MenuItem();
  454. this.miOpen = new MenuItem();
  455. this.miSave = new MenuItem();
  456. this.miSaveAs = new MenuItem();
  457. this.miCompile = new MenuItem();
  458. this.menuItem4 = new MenuItem();
  459. this.miExit = new MenuItem();
  460. this.cmTree = new ContextMenu();
  461. this.miAddNamespace = new MenuItem();
  462. this.miAddFormulaProgram = new MenuItem();
  463. this.miAddParam = new MenuItem();
  464. this.miDeleteNode = new MenuItem();
  465. this.odFormula = new OpenFileDialog();
  466. this.sdFormula = new SaveFileDialog();
  467. this.pnFormula = new Panel();
  468. this.pnTop = new Panel();
  469. this.spFormula = new Splitter();
  470. this.pnBottom = new Panel();
  471. this.btnClose = new Button();
  472. this.lVersion = new Label();
  473. this.tbVersion = new TextBox();
  474. this.tcFormula.SuspendLayout();
  475. this.tpNamespace.SuspendLayout();
  476. this.pnNamespace.SuspendLayout();
  477. this.tpFormulaProgram.SuspendLayout();
  478. this.pnProgram.SuspendLayout();
  479. this.pnCode.SuspendLayout();
  480. this.tpParameter.SuspendLayout();
  481. this.pnFormula.SuspendLayout();
  482. this.pnTop.SuspendLayout();
  483. this.pnBottom.SuspendLayout();
  484. base.SuspendLayout();
  485. this.FormulaTree.BorderStyle = BorderStyle.FixedSingle;
  486. this.FormulaTree.Dock = DockStyle.Left;
  487. this.FormulaTree.FullRowSelect = true;
  488. this.FormulaTree.HideSelection = false;
  489. this.FormulaTree.ImageList = this.ilFormula;
  490. this.FormulaTree.Location = new Point(0, 0);
  491. this.FormulaTree.Name = "FormulaTree";
  492. this.FormulaTree.Size = new Size(200, 0x241);
  493. this.FormulaTree.TabIndex = 0;
  494. this.FormulaTree.MouseDown += new MouseEventHandler(this.FormulaTree_MouseDown);
  495. this.FormulaTree.AfterSelect += new TreeViewEventHandler(this.FormulaTree_AfterSelect);
  496. this.FormulaTree.BeforeSelect += new TreeViewCancelEventHandler(this.FormulaTree_BeforeSelect);
  497. this.ilFormula.ImageSize = new Size(0x10, 0x10);
  498. this.ilFormula.ImageStream = (ImageListStreamer)manager.GetObject("ilFormula.ImageStream");
  499. this.ilFormula.TransparentColor = Color.Transparent;
  500. this.tcFormula.AllowDrop = true;
  501. this.tcFormula.Appearance = TabAppearance.FlatButtons;
  502. this.tcFormula.Controls.Add(this.tpNamespace);
  503. this.tcFormula.Controls.Add(this.tpFormulaProgram);
  504. this.tcFormula.Controls.Add(this.tpParameter);
  505. this.tcFormula.Dock = DockStyle.Fill;
  506. this.tcFormula.ItemSize = new Size(1, 0);
  507. this.tcFormula.Location = new Point(0, 0);
  508. this.tcFormula.Name = "tcFormula";
  509. this.tcFormula.SelectedIndex = 0;
  510. this.tcFormula.Size = new Size(0x28c, 0x241);
  511. this.tcFormula.TabIndex = 4;
  512. this.tcFormula.TabStop = false;
  513. this.tpNamespace.Controls.Add(this.pnNamespace);
  514. this.tpNamespace.Location = new Point(4, 0x19);
  515. this.tpNamespace.Name = "tpNamespace";
  516. this.tpNamespace.Size = new Size(0x284, 0x224);
  517. this.tpNamespace.TabIndex = 0;
  518. this.tpNamespace.Text = "Namespace";
  519. this.pnNamespace.Controls.Add(this.tbVersion);
  520. this.pnNamespace.Controls.Add(this.lVersion);
  521. this.pnNamespace.Controls.Add(this.cbNotRealNameSpace);
  522. this.pnNamespace.Controls.Add(this.lNamespaceDescription);
  523. this.pnNamespace.Controls.Add(this.tbNamespaceDesc);
  524. this.pnNamespace.Controls.Add(this.lNamespaceName);
  525. this.pnNamespace.Controls.Add(this.tbNamespaceName);
  526. this.pnNamespace.Dock = DockStyle.Fill;
  527. this.pnNamespace.Location = new Point(0, 0);
  528. this.pnNamespace.Name = "pnNamespace";
  529. this.pnNamespace.Size = new Size(0x284, 0x224);
  530. this.pnNamespace.TabIndex = 3;
  531. this.cbNotRealNameSpace.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom;
  532. this.cbNotRealNameSpace.Location = new Point(0x10, 520);
  533. this.cbNotRealNameSpace.Name = "cbNotRealNameSpace";
  534. this.cbNotRealNameSpace.Size = new Size(600, 0x11);
  535. this.cbNotRealNameSpace.TabIndex = 7;
  536. this.cbNotRealNameSpace.Text = "Group Only";
  537. this.lNamespaceDescription.BackColor = SystemColors.Control;
  538. this.lNamespaceDescription.Location = new Point(20, 0x30);
  539. this.lNamespaceDescription.Name = "lNamespaceDescription";
  540. this.lNamespaceDescription.Size = new Size(80, 0x10);
  541. this.lNamespaceDescription.TabIndex = 6;
  542. this.lNamespaceDescription.Text = "Description";
  543. this.tbNamespaceDesc.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
  544. this.tbNamespaceDesc.BackColor = SystemColors.Info;
  545. this.tbNamespaceDesc.BorderStyle = BorderStyle.FixedSingle;
  546. this.tbNamespaceDesc.Location = new Point(0x6c, 0x30);
  547. this.tbNamespaceDesc.Multiline = true;
  548. this.tbNamespaceDesc.Name = "tbNamespaceDesc";
  549. this.tbNamespaceDesc.Size = new Size(0x204, 0x1a0);
  550. this.tbNamespaceDesc.TabIndex = 5;
  551. this.tbNamespaceDesc.Text = "";
  552. this.lNamespaceName.AccessibleName = "";
  553. this.lNamespaceName.BackColor = SystemColors.Control;
  554. this.lNamespaceName.Location = new Point(0x15, 0x10);
  555. this.lNamespaceName.Name = "lNamespaceName";
  556. this.lNamespaceName.Size = new Size(0x48, 14);
  557. this.lNamespaceName.TabIndex = 4;
  558. this.lNamespaceName.Text = "Name";
  559. this.tbNamespaceName.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
  560. this.tbNamespaceName.BorderStyle = BorderStyle.FixedSingle;
  561. this.tbNamespaceName.Location = new Point(0x6c, 0x10);
  562. this.tbNamespaceName.Name = "tbNamespaceName";
  563. this.tbNamespaceName.Size = new Size(0x204, 0x15);
  564. this.tbNamespaceName.TabIndex = 3;
  565. this.tbNamespaceName.Text = "";
  566. this.tpFormulaProgram.Controls.Add(this.spProgram);
  567. this.tpFormulaProgram.Controls.Add(this.pnProgram);
  568. this.tpFormulaProgram.Controls.Add(this.lvErrors);
  569. this.tpFormulaProgram.Location = new Point(4, 0x18);
  570. this.tpFormulaProgram.Name = "tpFormulaProgram";
  571. this.tpFormulaProgram.Size = new Size(0x284, 0x225);
  572. this.tpFormulaProgram.TabIndex = 1;
  573. this.tpFormulaProgram.Text = "FormulaProgram";
  574. this.spProgram.Dock = DockStyle.Bottom;
  575. this.spProgram.Location = new Point(0, 0x1da);
  576. this.spProgram.MinExtra = 300;
  577. this.spProgram.MinSize = 0;
  578. this.spProgram.Name = "spProgram";
  579. this.spProgram.Size = new Size(0x284, 3);
  580. this.spProgram.TabIndex = 14;
  581. this.spProgram.TabStop = false;
  582. this.pnProgram.Controls.Add(this.btnFormula);
  583. this.pnProgram.Controls.Add(this.btnInsertMethod);
  584. this.pnProgram.Controls.Add(this.btnCompile);
  585. this.pnProgram.Controls.Add(this.lbIntelliSence);
  586. this.pnProgram.Controls.Add(this.lFullName);
  587. this.pnProgram.Controls.Add(this.tbProgramFullName);
  588. this.pnProgram.Controls.Add(this.btnDebug);
  589. this.pnProgram.Controls.Add(this.lFormulaProgramDesc);
  590. this.pnProgram.Controls.Add(this.tbFormulaProgramDesc);
  591. this.pnProgram.Controls.Add(this.cbIsMainView);
  592. this.pnProgram.Controls.Add(this.tbFormulaProgramName);
  593. this.pnProgram.Controls.Add(this.lFormulaProgramName);
  594. this.pnProgram.Controls.Add(this.lFormulaProgramCode);
  595. this.pnProgram.Controls.Add(this.pnCode);
  596. this.pnProgram.Dock = DockStyle.Fill;
  597. this.pnProgram.Location = new Point(0, 0);
  598. this.pnProgram.Name = "pnProgram";
  599. this.pnProgram.Size = new Size(0x284, 0x1dd);
  600. this.pnProgram.TabIndex = 13;
  601. this.btnFormula.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
  602. this.btnFormula.Location = new Point(0x130, 0x13e);
  603. this.btnFormula.Name = "btnFormula";
  604. this.btnFormula.Size = new Size(0xb8, 0x17);
  605. this.btnFormula.TabIndex = 0x19;
  606. this.btnFormula.Text = "Insert Formula";
  607. this.btnFormula.Click += new EventHandler(this.btnFormula_Click);
  608. this.btnInsertMethod.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
  609. this.btnInsertMethod.Location = new Point(0x80, 0x13e);
  610. this.btnInsertMethod.Name = "btnInsertMethod";
  611. this.btnInsertMethod.Size = new Size(160, 0x17);
  612. this.btnInsertMethod.TabIndex = 0x18;
  613. this.btnInsertMethod.Text = "Insert Method";
  614. this.btnInsertMethod.Click += new EventHandler(this.btnInsertMethod_Click);
  615. this.btnCompile.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
  616. this.btnCompile.Location = new Point(320, 0x1be);
  617. this.btnCompile.Name = "btnCompile";
  618. this.btnCompile.TabIndex = 0x17;
  619. this.btnCompile.Text = "&Compile";
  620. this.btnCompile.Click += new EventHandler(this.btnCompile_Click);
  621. this.lbIntelliSence.BorderStyle = BorderStyle.FixedSingle;
  622. this.lbIntelliSence.Location = new Point(0xa8, 0x90);
  623. this.lbIntelliSence.Name = "lbIntelliSence";
  624. this.lbIntelliSence.Size = new Size(0xe0, 0x84);
  625. this.lbIntelliSence.TabIndex = 0x16;
  626. this.lbIntelliSence.TabStop = false;
  627. this.lbIntelliSence.Visible = false;
  628. this.lbIntelliSence.KeyDown += new KeyEventHandler(this.lbIntelliSence_KeyDown);
  629. this.lFullName.Location = new Point(13, 0x29);
  630. this.lFullName.Name = "lFullName";
  631. this.lFullName.Size = new Size(0x48, 0x17);
  632. this.lFullName.TabIndex = 0x15;
  633. this.lFullName.Text = "Full Name:";
  634. this.tbProgramFullName.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
  635. this.tbProgramFullName.BackColor = Color.SeaShell;
  636. this.tbProgramFullName.BorderStyle = BorderStyle.FixedSingle;
  637. this.tbProgramFullName.Location = new Point(0x65, 0x27);
  638. this.tbProgramFullName.Name = "tbProgramFullName";
  639. this.tbProgramFullName.Size = new Size(0x213, 0x15);
  640. this.tbProgramFullName.TabIndex = 13;
  641. this.tbProgramFullName.Text = "";
  642. this.btnDebug.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
  643. this.btnDebug.Location = new Point(0xe8, 0x1be);
  644. this.btnDebug.Name = "btnDebug";
  645. this.btnDebug.TabIndex = 0x11;
  646. this.btnDebug.Text = "&Debug";
  647. this.btnDebug.Click += new EventHandler(this.btnDebug_Click);
  648. this.lFormulaProgramDesc.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
  649. this.lFormulaProgramDesc.Location = new Point(8, 0x159);
  650. this.lFormulaProgramDesc.Name = "lFormulaProgramDesc";
  651. this.lFormulaProgramDesc.Size = new Size(80, 0x17);
  652. this.lFormulaProgramDesc.TabIndex = 0x12;
  653. this.lFormulaProgramDesc.Text = "Description:";
  654. this.tbFormulaProgramDesc.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom;
  655. this.tbFormulaProgramDesc.BorderStyle = BorderStyle.FixedSingle;
  656. this.tbFormulaProgramDesc.Location = new Point(100, 0x159);
  657. this.tbFormulaProgramDesc.Multiline = true;
  658. this.tbFormulaProgramDesc.Name = "tbFormulaProgramDesc";
  659. this.tbFormulaProgramDesc.Size = new Size(0x213, 0x5c);
  660. this.tbFormulaProgramDesc.TabIndex = 15;
  661. this.tbFormulaProgramDesc.Text = "";
  662. this.tbFormulaProgramDesc.Leave += new EventHandler(this.tbFormulaProgramCode_Leave);
  663. this.cbIsMainView.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
  664. this.cbIsMainView.FlatStyle = FlatStyle.Flat;
  665. this.cbIsMainView.Location = new Point(0x10, 0x1bd);
  666. this.cbIsMainView.Name = "cbIsMainView";
  667. this.cbIsMainView.TabIndex = 0x10;
  668. this.cbIsMainView.Text = "Main View";
  669. this.cbIsMainView.Leave += new EventHandler(this.tbFormulaProgramCode_Leave);
  670. this.tbFormulaProgramName.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
  671. this.tbFormulaProgramName.BorderStyle = BorderStyle.FixedSingle;
  672. this.tbFormulaProgramName.Location = new Point(0x65, 8);
  673. this.tbFormulaProgramName.Name = "tbFormulaProgramName";
  674. this.tbFormulaProgramName.Size = new Size(0x213, 0x15);
  675. this.tbFormulaProgramName.TabIndex = 12;
  676. this.tbFormulaProgramName.Text = "";
  677. this.tbFormulaProgramName.Leave += new EventHandler(this.tbFormulaProgramCode_Leave);
  678. this.lFormulaProgramName.Location = new Point(13, 10);
  679. this.lFormulaProgramName.Name = "lFormulaProgramName";
  680. this.lFormulaProgramName.Size = new Size(0x48, 0x17);
  681. this.lFormulaProgramName.TabIndex = 0x11;
  682. this.lFormulaProgramName.Text = "Name:";
  683. this.lFormulaProgramCode.Location = new Point(13, 0x48);
  684. this.lFormulaProgramCode.Name = "lFormulaProgramCode";
  685. this.lFormulaProgramCode.Size = new Size(0x48, 0x17);
  686. this.lFormulaProgramCode.TabIndex = 0x10;
  687. this.lFormulaProgramCode.Text = "Code:";
  688. this.pnCode.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
  689. this.pnCode.BorderStyle = BorderStyle.FixedSingle;
  690. this.pnCode.Controls.Add(this.tbFormulaProgramCode);
  691. this.pnCode.Location = new Point(0x65, 0x48);
  692. this.pnCode.Name = "pnCode";
  693. this.pnCode.Size = new Size(0x213, 0xf2);
  694. this.pnCode.TabIndex = 14;
  695. this.pnCode.TabStop = true;
  696. this.tbFormulaProgramCode.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
  697. this.tbFormulaProgramCode.BackColor = SystemColors.Info;
  698. this.tbFormulaProgramCode.BorderStyle = BorderStyle.None;
  699. this.tbFormulaProgramCode.Location = new Point(0, 0);
  700. this.tbFormulaProgramCode.Name = "tbFormulaProgramCode";
  701. this.tbFormulaProgramCode.Size = new Size(0x211, 240);
  702. this.tbFormulaProgramCode.TabIndex = 14;
  703. this.tbFormulaProgramCode.Text = "";
  704. this.tbFormulaProgramCode.KeyDown += new KeyEventHandler(this.tbFormulaProgramCode_KeyDown);
  705. this.tbFormulaProgramCode.Leave += new EventHandler(this.tbFormulaProgramCode_Leave);
  706. this.lvErrors.BorderStyle = BorderStyle.FixedSingle;
  707. this.lvErrors.Columns.AddRange(new ColumnHeader[] { this.HeaderName, this.HeaderLine, this.HeaderColumn, this.HeaderNumber, this.HeaderMessage });
  708. this.lvErrors.Dock = DockStyle.Bottom;
  709. this.lvErrors.FullRowSelect = true;
  710. this.lvErrors.HeaderStyle = ColumnHeaderStyle.Nonclickable;
  711. this.lvErrors.Location = new Point(0, 0x1dd);
  712. this.lvErrors.Name = "lvErrors";
  713. this.lvErrors.Size = new Size(0x284, 0x48);
  714. this.lvErrors.TabIndex = 0x12;
  715. this.lvErrors.View = View.Details;
  716. this.lvErrors.DoubleClick += new EventHandler(this.lvErrors_DoubleClick);
  717. this.HeaderName.Text = "Name";
  718. this.HeaderName.Width = 80;
  719. this.HeaderLine.Text = "Line";
  720. this.HeaderColumn.Text = "Column";
  721. this.HeaderNumber.Text = "Number";
  722. this.HeaderNumber.Width = 80;
  723. this.HeaderMessage.Text = "Message";
  724. this.HeaderMessage.Width = 200;
  725. this.tpParameter.Controls.Add(this.cbParamType);
  726. this.tpParameter.Controls.Add(this.lParamType);
  727. this.tpParameter.Controls.Add(this.tbParamDesc);
  728. this.tpParameter.Controls.Add(this.lParamDesc);
  729. this.tpParameter.Controls.Add(this.tbParamName);
  730. this.tpParameter.Controls.Add(this.lParamName);
  731. this.tpParameter.Controls.Add(this.tbMaxValue);
  732. this.tpParameter.Controls.Add(this.tbMinValue);
  733. this.tpParameter.Controls.Add(this.tbDefaultValue);
  734. this.tpParameter.Controls.Add(this.lDefaultValue);
  735. this.tpParameter.Controls.Add(this.lMaxValue);
  736. this.tpParameter.Controls.Add(this.lMinValue);
  737. this.tpParameter.Location = new Point(4, 0x18);
  738. this.tpParameter.Name = "tpParameter";
  739. this.tpParameter.Size = new Size(0x284, 0x225);
  740. this.tpParameter.TabIndex = 2;
  741. this.tpParameter.Text = "Parameter";
  742. this.cbParamType.DropDownStyle = ComboBoxStyle.DropDownList;
  743. this.cbParamType.Location = new Point(0x60, 0x88);
  744. this.cbParamType.Name = "cbParamType";
  745. this.cbParamType.TabIndex = 10;
  746. this.lParamType.Location = new Point(8, 0x88);
  747. this.lParamType.Name = "lParamType";
  748. this.lParamType.Size = new Size(0x58, 0x17);
  749. this.lParamType.TabIndex = 9;
  750. this.lParamType.Text = "Type:";
  751. this.tbParamDesc.BorderStyle = BorderStyle.FixedSingle;
  752. this.tbParamDesc.Location = new Point(0x60, 0xa8);
  753. this.tbParamDesc.Multiline = true;
  754. this.tbParamDesc.Name = "tbParamDesc";
  755. this.tbParamDesc.Size = new Size(0x138, 0x68);
  756. this.tbParamDesc.TabIndex = 5;
  757. this.tbParamDesc.Text = "";
  758. this.tbParamDesc.Leave += new EventHandler(this.tbFormulaProgramCode_Leave);
  759. this.lParamDesc.Location = new Point(8, 0xa8);
  760. this.lParamDesc.Name = "lParamDesc";
  761. this.lParamDesc.Size = new Size(0x58, 0x17);
  762. this.lParamDesc.TabIndex = 8;
  763. this.lParamDesc.Text = "Description:";
  764. this.tbParamName.BorderStyle = BorderStyle.FixedSingle;
  765. this.tbParamName.Location = new Point(0x60, 8);
  766. this.tbParamName.Name = "tbParamName";
  767. this.tbParamName.Size = new Size(0x88, 0x15);
  768. this.tbParamName.TabIndex = 0;
  769. this.tbParamName.Text = "";
  770. this.tbParamName.Leave += new EventHandler(this.tbFormulaProgramCode_Leave);
  771. this.lParamName.Location = new Point(8, 8);
  772. this.lParamName.Name = "lParamName";
  773. this.lParamName.Size = new Size(80, 0x17);
  774. this.lParamName.TabIndex = 6;
  775. this.lParamName.Text = "Name:";
  776. this.tbMaxValue.BackColor = SystemColors.Info;
  777. this.tbMaxValue.BorderStyle = BorderStyle.FixedSingle;
  778. this.tbMaxValue.Location = new Point(0x60, 0x68);
  779. this.tbMaxValue.Name = "tbMaxValue";
  780. this.tbMaxValue.Size = new Size(0x88, 0x15);
  781. this.tbMaxValue.TabIndex = 3;
  782. this.tbMaxValue.Text = "";
  783. this.tbMaxValue.Leave += new EventHandler(this.tbFormulaProgramCode_Leave);
  784. this.tbMinValue.BackColor = SystemColors.Info;
  785. this.tbMinValue.BorderStyle = BorderStyle.FixedSingle;
  786. this.tbMinValue.Location = new Point(0x60, 0x48);
  787. this.tbMinValue.Name = "tbMinValue";
  788. this.tbMinValue.Size = new Size(0x88, 0x15);
  789. this.tbMinValue.TabIndex = 2;
  790. this.tbMinValue.Text = "";
  791. this.tbMinValue.Leave += new EventHandler(this.tbFormulaProgramCode_Leave);
  792. this.tbDefaultValue.BackColor = SystemColors.Info;
  793. this.tbDefaultValue.BorderStyle = BorderStyle.FixedSingle;
  794. this.tbDefaultValue.Location = new Point(0x60, 40);
  795. this.tbDefaultValue.Name = "tbDefaultValue";
  796. this.tbDefaultValue.Size = new Size(0x88, 0x15);
  797. this.tbDefaultValue.TabIndex = 1;
  798. this.tbDefaultValue.Text = "";
  799. this.tbDefaultValue.Leave += new EventHandler(this.tbFormulaProgramCode_Leave);
  800. this.lDefaultValue.Location = new Point(8, 40);
  801. this.lDefaultValue.Name = "lDefaultValue";
  802. this.lDefaultValue.Size = new Size(80, 0x17);
  803. this.lDefaultValue.TabIndex = 2;
  804. this.lDefaultValue.Text = "Default:";
  805. this.lMaxValue.Location = new Point(8, 0x68);
  806. this.lMaxValue.Name = "lMaxValue";
  807. this.lMaxValue.Size = new Size(80, 0x17);
  808. this.lMaxValue.TabIndex = 1;
  809. this.lMaxValue.Text = "Maximum:";
  810. this.lMinValue.Location = new Point(8, 0x48);
  811. this.lMinValue.Name = "lMinValue";
  812. this.lMinValue.Size = new Size(80, 0x17);
  813. this.lMinValue.TabIndex = 0;
  814. this.lMinValue.Text = "Minimum:";
  815. this.mmFumular.MenuItems.AddRange(new MenuItem[] { this.menuItem1 });
  816. this.menuItem1.Index = 0;
  817. this.menuItem1.MenuItems.AddRange(new MenuItem[] { this.miNew, this.miOpen, this.miSave, this.miSaveAs, this.miCompile, this.menuItem4, this.miExit });
  818. this.menuItem1.Text = "&File";
  819. this.miNew.Index = 0;
  820. this.miNew.Text = "&New";
  821. this.miNew.Click += new EventHandler(this.miNew_Click);
  822. this.miOpen.Index = 1;
  823. this.miOpen.Shortcut = Shortcut.F3;
  824. this.miOpen.Text = "&Open";
  825. this.miOpen.Click += new EventHandler(this.miOpen_Click);
  826. this.miSave.Index = 2;
  827. this.miSave.Shortcut = Shortcut.F2;
  828. this.miSave.Text = "&Save";
  829. this.miSave.Click += new EventHandler(this.miSave_Click);
  830. this.miSaveAs.Index = 3;
  831. this.miSaveAs.Text = "Save &As";
  832. this.miSaveAs.Click += new EventHandler(this.miSaveAs_Click);
  833. this.miCompile.Index = 4;
  834. this.miCompile.Shortcut = Shortcut.F9;
  835. this.miCompile.Text = "&Compile";
  836. this.miCompile.Click += new EventHandler(this.miCompile_Click);
  837. this.menuItem4.Index = 5;
  838. this.menuItem4.Text = "-";
  839. this.miExit.Index = 6;
  840. this.miExit.Text = "&Exit";
  841. this.miExit.Click += new EventHandler(this.miExit_Click);
  842. this.cmTree.MenuItems.AddRange(new MenuItem[] { this.miAddNamespace, this.miAddFormulaProgram, this.miAddParam, this.miDeleteNode });
  843. this.miAddNamespace.Index = 0;
  844. this.miAddNamespace.Text = "Add Namespace";
  845. this.miAddNamespace.Click += new EventHandler(this.miAddNamespace_Click);
  846. this.miAddFormulaProgram.Index = 1;
  847. this.miAddFormulaProgram.Text = "Add Formula Program";
  848. this.miAddFormulaProgram.Click += new EventHandler(this.miAddFormulaProgram_Click);
  849. this.miAddParam.Index = 2;
  850. this.miAddParam.Text = "Add Formula Parameter";
  851. this.miAddParam.Click += new EventHandler(this.miAddParam_Click);
  852. this.miDeleteNode.Index = 3;
  853. this.miDeleteNode.Text = "Delete Node";
  854. this.miDeleteNode.Click += new EventHandler(this.miDeleteNode_Click);
  855. this.odFormula.DefaultExt = "fml";
  856. this.odFormula.Filter = "Formula File(*.fml)|*.fml|All files (*.*)|*.*";
  857. this.odFormula.RestoreDirectory = true;
  858. this.sdFormula.DefaultExt = "fml";
  859. this.sdFormula.Filter = "Formula File(*.fml)|*.fml|All files (*.*)|*.*";
  860. this.sdFormula.RestoreDirectory = true;
  861. this.pnFormula.Controls.Add(this.tcFormula);
  862. this.pnFormula.Dock = DockStyle.Fill;
  863. this.pnFormula.Location = new Point(0xcc, 0);
  864. this.pnFormula.Name = "pnFormula";
  865. this.pnFormula.Size = new Size(0x28c, 0x241);
  866. this.pnFormula.TabIndex = 6;
  867. this.pnTop.Controls.Add(this.pnFormula);
  868. this.pnTop.Controls.Add(this.spFormula);
  869. this.pnTop.Controls.Add(this.FormulaTree);
  870. this.pnTop.Dock = DockStyle.Fill;
  871. this.pnTop.Location = new Point(0, 0);
  872. this.pnTop.Name = "pnTop";
  873. this.pnTop.Size = new Size(0x358, 0x241);
  874. this.pnTop.TabIndex = 7;
  875. this.spFormula.BackColor = Color.FromArgb(0xe0, 0xe0, 0xe0);
  876. this.spFormula.Location = new Point(200, 0);
  877. this.spFormula.MinExtra = 400;
  878. this.spFormula.MinSize = 150;
  879. this.spFormula.Name = "spFormula";
  880. this.spFormula.Size = new Size(4, 0x241);
  881. this.spFormula.TabIndex = 7;
  882. this.spFormula.TabStop = false;
  883. this.pnBottom.Controls.Add(this.btnClose);
  884. this.pnBottom.Dock = DockStyle.Bottom;
  885. this.pnBottom.Location = new Point(0, 0x241);
  886. this.pnBottom.Name = "pnBottom";
  887. this.pnBottom.Size = new Size(0x358, 0x20);
  888. this.pnBottom.TabIndex = 8;
  889. this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  890. this.btnClose.Location = new Point(0x288, 6);
  891. this.btnClose.Name = "btnClose";
  892. this.btnClose.TabIndex = 0;
  893. this.btnClose.Text = "Close";
  894. this.btnClose.Click += new EventHandler(this.btnClose_Click);
  895. this.lVersion.AutoSize = true;
  896. this.lVersion.Location = new Point(0x20, 0x1df);
  897. this.lVersion.Name = "lVersion";
  898. this.lVersion.Size = new Size(0x30, 0x11);
  899. this.lVersion.TabIndex = 8;
  900. this.lVersion.Text = "Version";
  901. this.tbVersion.BorderStyle = BorderStyle.FixedSingle;
  902. this.tbVersion.Location = new Point(0x6c, 0x1db);
  903. this.tbVersion.Name = "tbVersion";
  904. this.tbVersion.Size = new Size(0x9c, 0x15);
  905. this.tbVersion.TabIndex = 9;
  906. this.tbVersion.Text = "";
  907. this.AutoScaleBaseSize = new Size(6, 14);
  908. base.CancelButton = this.btnClose;
  909. base.ClientSize = new Size(0x358, 0x261);
  910. base.Controls.Add(this.pnTop);
  911. base.Controls.Add(this.pnBottom);
  912. this.Font = new Font("Verdana", 8.5f);
  913. base.Menu = this.mmFumular;
  914. base.MinimumSize = new Size(640, 480);
  915. base.Name = "FormulaSourceEditor";
  916. base.StartPosition = FormStartPosition.CenterScreen;
  917. this.Text = "Formula Editor";
  918. base.Click += new EventHandler(this.btnDebug_Click);
  919. base.Closing += new CancelEventHandler(this.FormulaEditor_Closing);
  920. base.Load += new EventHandler(this.FormulaEditor_Load);
  921. base.Activated += new EventHandler(this.FormulaEditor_Activated);
  922. this.tcFormula.ResumeLayout(false);
  923. this.tpNamespace.ResumeLayout(false);
  924. this.pnNamespace.ResumeLayout(false);
  925. this.tpFormulaProgram.ResumeLayout(false);
  926. this.pnProgram.ResumeLayout(false);
  927. this.pnCode.ResumeLayout(false);
  928. this.tpParameter.ResumeLayout(false);
  929. this.pnFormula.ResumeLayout(false);
  930. this.pnTop.ResumeLayout(false);
  931. this.pnBottom.ResumeLayout(false);
  932. base.ResumeLayout(false);
  933. }
  934. private void lbIntelliSence_KeyDown(object sender, KeyEventArgs e)
  935. {
  936. if (e.KeyCode == Keys.Escape)
  937. {
  938. this.lbIntelliSence.Visible = false;
  939. }
  940. else if (e.KeyCode == Keys.Enter)
  941. {
  942. Clipboard.SetDataObject(this.lbIntelliSence.SelectedItem.ToString());
  943. this.tbFormulaProgramCode.Paste();
  944. this.lbIntelliSence.Visible = false;
  945. }
  946. }
  947. private void LoadEditor(string Filename, string Formula)
  948. {
  949. if (File.Exists(Filename))
  950. {
  951. this.LoadFromFile(Filename);
  952. if (Formula != null)
  953. {
  954. int num = Formula.LastIndexOf('.');
  955. if (num >= 0)
  956. {
  957. Formula = Formula.Substring(num + 1);
  958. }
  959. TreeNode node = this.FindNode(this.FormulaTree.Nodes[0], Formula);
  960. if (node != null)
  961. {
  962. this.FormulaTree.SelectedNode = node;
  963. this.FormulaTree.SelectedNode.Expand();
  964. }
  965. }
  966. }
  967. base.ShowDialog();
  968. }
  969. private void LoadFromFile(string FileName)
  970. {
  971. if (File.Exists(FileName))
  972. {
  973. this.fs = FormulaSpace.Read(FileName);
  974. this.fs.AddVersion();
  975. this.Filename = FileName;
  976. this.sdFormula.FileName = this.Filename;
  977. this.LoadToTree(this.fs);
  978. this.Modified = false;
  979. this.FormulaTree.Nodes[0].Expand();
  980. }
  981. }
  982. private void LoadToTree(FormulaSpace fs)
  983. {
  984. this.FormulaTree.BeginUpdate();
  985. try
  986. {
  987. this.FormulaTree.Nodes.Clear();
  988. TreeNode node = new TreeNode("FML", 0, 0);
  989. this.FormulaTree.Nodes.Add(node);
  990. this.LoadToTree(this.FormulaTree.Nodes[0], fs);
  991. }
  992. finally
  993. {
  994. this.FormulaTree.EndUpdate();
  995. }
  996. this.FormulaTree.SelectedNode = this.FormulaTree.TopNode;
  997. }
  998. private void LoadToTree(TreeNode tn, FormulaParam fp)
  999. {
  1000. tn.Text = fp.Name;
  1001. tn.Tag = fp;
  1002. }
  1003. private void LoadToTree(TreeNode tn, FormulaProgram p)
  1004. {
  1005. tn.Text = p.Name;
  1006. tn.Tag = p;
  1007. foreach (FormulaParam param in p.Params)
  1008. {
  1009. TreeNode node = new TreeNode();
  1010. node.ImageIndex = 2;
  1011. node.SelectedImageIndex = 2;
  1012. tn.Nodes.Add(node);
  1013. this.LoadToTree(node, param);
  1014. }
  1015. }
  1016. private void LoadToTree(TreeNode tn, FormulaSpace fs)
  1017. {
  1018. tn.Text = fs.Name;
  1019. tn.Tag = fs;
  1020. foreach (FormulaSpace space in fs.Namespaces)
  1021. {
  1022. TreeNode node = new TreeNode();
  1023. node.ImageIndex = 0;
  1024. node.SelectedImageIndex = 0;
  1025. tn.Nodes.Add(node);
  1026. this.LoadToTree(node, space);
  1027. }
  1028. foreach (FormulaProgram program in fs.Programs)
  1029. {
  1030. TreeNode node2 = new TreeNode();
  1031. node2.ImageIndex = 1;
  1032. node2.SelectedImageIndex = 1;
  1033. tn.Nodes.Add(node2);
  1034. this.LoadToTree(node2, program);
  1035. }
  1036. }
  1037. private void LocateFirstProgram()
  1038. {
  1039. TreeNode selectedNode = this.FormulaTree.SelectedNode;
  1040. if (!(selectedNode.Tag is FormulaProgram))
  1041. {
  1042. selectedNode = this.FormulaTree.Nodes[0];
  1043. while (!(selectedNode.Tag is FormulaProgram) && (selectedNode.Nodes.Count > 0))
  1044. {
  1045. selectedNode = selectedNode.Nodes[0];
  1046. }
  1047. }
  1048. this.FormulaTree.SelectedNode = selectedNode;
  1049. }
  1050. private void lvErrors_DoubleClick(object sender, EventArgs e)
  1051. {
  1052. ListViewItem focusedItem = this.lvErrors.FocusedItem;
  1053. if (focusedItem != null)
  1054. {
  1055. FormulaProgram tag = (FormulaProgram)focusedItem.Tag;
  1056. if (tag != null)
  1057. {
  1058. TreeNode node = this.FindNode(this.FormulaTree.Nodes[0], tag);
  1059. if (node != null)
  1060. {
  1061. this.FormulaTree.SelectedNode = node;
  1062. int num = int.Parse(focusedItem.SubItems[1].Text);
  1063. int num2 = int.Parse(focusedItem.SubItems[2].Text);
  1064. for (int i = 0; (i < (num - 1)) && (i < this.tbFormulaProgramCode.Lines.Length); i++)
  1065. {
  1066. num2 += this.tbFormulaProgramCode.Lines[i].Length + 1;
  1067. }
  1068. if (num2 < 0)
  1069. {
  1070. num2 = 0;
  1071. }
  1072. this.tbFormulaProgramCode.SelectionStart = num2;
  1073. this.tbFormulaProgramCode.Focus();
  1074. }
  1075. }
  1076. }
  1077. }
  1078. private void miAddFormulaProgram_Click(object sender, EventArgs e)
  1079. {
  1080. TreeNode selectedNode = this.FormulaTree.SelectedNode;
  1081. FormulaSpace tag = (FormulaSpace)selectedNode.Tag;
  1082. FormulaProgram program = new FormulaProgram();
  1083. tag.Programs.Add(program);
  1084. TreeNode node = new TreeNode("NewCode");
  1085. program.Name = node.Text;
  1086. selectedNode.Nodes.Add(node);
  1087. node.ImageIndex = 1;
  1088. node.SelectedImageIndex = 1;
  1089. node.Tag = program;
  1090. this.FormulaTree.SelectedNode = node;
  1091. }
  1092. private void miAddNamespace_Click(object sender, EventArgs e)
  1093. {
  1094. TreeNode selectedNode = this.FormulaTree.SelectedNode;
  1095. FormulaSpace tag = (FormulaSpace)selectedNode.Tag;
  1096. FormulaSpace space2 = new FormulaSpace();
  1097. tag.Namespaces.Add(space2);
  1098. TreeNode node = new TreeNode("NewSpace");
  1099. space2.Name = node.Text;
  1100. selectedNode.Nodes.Add(node);
  1101. node.ImageIndex = 0;
  1102. node.SelectedImageIndex = 0;
  1103. node.Tag = space2;
  1104. this.FormulaTree.SelectedNode = node;
  1105. }
  1106. private void miAddParam_Click(object sender, EventArgs e)
  1107. {
  1108. TreeNode selectedNode = this.FormulaTree.SelectedNode;
  1109. FormulaProgram tag = (FormulaProgram)selectedNode.Tag;
  1110. FormulaParam fp = new FormulaParam();
  1111. tag.Params.Add(fp);
  1112. TreeNode node = new TreeNode("NewParam");
  1113. fp.Name = node.Text;
  1114. selectedNode.Nodes.Add(node);
  1115. node.ImageIndex = 2;
  1116. node.SelectedImageIndex = 2;
  1117. node.Tag = fp;
  1118. this.FormulaTree.SelectedNode = node;
  1119. }
  1120. private void miCompile_Click(object sender, EventArgs e)
  1121. {
  1122. this.Compile();
  1123. }
  1124. private void miDeleteNode_Click(object sender, EventArgs e)
  1125. {
  1126. TreeNode selectedNode = this.FormulaTree.SelectedNode;
  1127. TreeNode parent = selectedNode.Parent;
  1128. if (parent != null)
  1129. {
  1130. object tag = parent.Tag;
  1131. object obj3 = selectedNode.Tag;
  1132. if (tag is FormulaSpace)
  1133. {
  1134. if (obj3 is FormulaSpace)
  1135. {
  1136. ((FormulaSpace)tag).Namespaces.Remove((FormulaSpace)obj3);
  1137. }
  1138. else if (obj3 is FormulaProgram)
  1139. {
  1140. ((FormulaSpace)tag).Programs.Remove((FormulaProgram)obj3);
  1141. }
  1142. }
  1143. else if ((tag is FormulaProgram) && (obj3 is FormulaParam))
  1144. {
  1145. ((FormulaProgram)tag).Params.Remove((FormulaParam)obj3);
  1146. }
  1147. selectedNode.Remove();
  1148. }
  1149. }
  1150. private void miExit_Click(object sender, EventArgs e)
  1151. {
  1152. base.Close();
  1153. }
  1154. private void miNew_Click(object sender, EventArgs e)
  1155. {
  1156. if (!this.Modified)
  1157. {
  1158. this.Filename = "";
  1159. this.fs = new FormulaSpace("FML");
  1160. this.LoadToTree(this.fs);
  1161. }
  1162. }
  1163. private void miOpen_Click(object sender, EventArgs e)
  1164. {
  1165. if (!this.Modified && (this.odFormula.ShowDialog() == DialogResult.OK))
  1166. {
  1167. try
  1168. {
  1169. this.LoadFromFile(this.odFormula.FileName);
  1170. }
  1171. catch (Exception exception)
  1172. {
  1173. MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  1174. }
  1175. }
  1176. }
  1177. private void miSave_Click(object sender, EventArgs e)
  1178. {
  1179. this.Save();
  1180. }
  1181. private void miSaveAs_Click(object sender, EventArgs e)
  1182. {
  1183. this.SaveAs();
  1184. }
  1185. public static void Open(string Filename, string Formula)
  1186. {
  1187. if (CurrentEditor == null)
  1188. {
  1189. CurrentEditor = new FormulaSourceEditor();
  1190. }
  1191. CurrentEditor.LoadEditor(Filename, Formula);
  1192. }
  1193. private bool Save()
  1194. {
  1195. if (this.Filename == "")
  1196. {
  1197. return this.SaveAs();
  1198. }
  1199. try
  1200. {
  1201. if (this.Compile())
  1202. {
  1203. this.SaveDataToNode();
  1204. this.fs.Write(this.Filename);
  1205. this.Modified = false;
  1206. return true;
  1207. }
  1208. }
  1209. catch (Exception exception)
  1210. {
  1211. MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  1212. }
  1213. return false;
  1214. }
  1215. private bool SaveAs()
  1216. {
  1217. if (this.sdFormula.ShowDialog() == DialogResult.OK)
  1218. {
  1219. this.SaveDataToNode();
  1220. this.Filename = this.sdFormula.FileName;
  1221. this.odFormula.FileName = this.Filename;
  1222. try
  1223. {
  1224. if (this.Compile())
  1225. {
  1226. this.fs.Write(this.Filename);
  1227. this.Modified = false;
  1228. return true;
  1229. }
  1230. }
  1231. catch (Exception exception)
  1232. {
  1233. MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  1234. }
  1235. }
  1236. return false;
  1237. }
  1238. private void SaveDataToNode()
  1239. {
  1240. this.SaveDataToNode(this.FormulaTree.SelectedNode);
  1241. }
  1242. private void SaveDataToNode(TreeNode tn)
  1243. {
  1244. if (tn != null)
  1245. {
  1246. if (tn.Tag is FormulaProgram)
  1247. {
  1248. FormulaProgram tag = tn.Tag as FormulaProgram;
  1249. tag.Name = this.tbFormulaProgramName.Text;
  1250. tag.FullName = this.tbProgramFullName.Text;
  1251. tag.Code = this.tbFormulaProgramCode.Text;
  1252. tag.Description = this.tbFormulaProgramDesc.Text;
  1253. tag.IsMainView = this.cbIsMainView.Checked;
  1254. tn.Text = tag.Name;
  1255. }
  1256. else if (tn.Tag is FormulaSpace)
  1257. {
  1258. FormulaSpace space = tn.Tag as FormulaSpace;
  1259. space.Name = this.tbNamespaceName.Text;
  1260. space.Description = this.tbNamespaceDesc.Text;
  1261. space.Version = this.tbVersion.Text;
  1262. space.GroupOnly = this.cbNotRealNameSpace.Checked;
  1263. tn.Text = space.Name;
  1264. }
  1265. else if (tn.Tag is FormulaParam)
  1266. {
  1267. FormulaParam param = tn.Tag as FormulaParam;
  1268. param.Name = this.tbParamName.Text;
  1269. param.MinValue = this.tbMinValue.Text;
  1270. param.MaxValue = this.tbMaxValue.Text;
  1271. param.DefaultValue = this.tbDefaultValue.Text;
  1272. if (this.cbParamType.Text == "")
  1273. {
  1274. this.cbParamType.SelectedIndex = 0;
  1275. }
  1276. param.ParamType = (FormulaParamType)this.cbParamType.SelectedIndex;
  1277. param.Description = this.tbParamDesc.Text;
  1278. tn.Text = param.Name;
  1279. }
  1280. }
  1281. }
  1282. private void tbFormulaProgramCode_KeyDown(object sender, KeyEventArgs e)
  1283. {
  1284. if ((e.KeyCode == Keys.J) && e.Control)
  1285. {
  1286. this.lbIntelliSence.Items.Clear();
  1287. this.lbIntelliSence.Items.AddRange(FormulaBase.GetAllFormulas());
  1288. int selectionStart = this.tbFormulaProgramCode.SelectionStart;
  1289. int lineFromCharIndex = this.tbFormulaProgramCode.GetLineFromCharIndex(selectionStart);
  1290. Point location = this.pnCode.Location;
  1291. Point positionFromCharIndex = this.tbFormulaProgramCode.GetPositionFromCharIndex(selectionStart);
  1292. positionFromCharIndex.Offset(location.X + 8, location.Y + 14);
  1293. this.lbIntelliSence.Location = positionFromCharIndex;
  1294. this.lbIntelliSence.Visible = true;
  1295. this.lbIntelliSence.Focus();
  1296. }
  1297. }
  1298. private void tbFormulaProgramCode_Leave(object sender, EventArgs e)
  1299. {
  1300. this.SaveDataToNode();
  1301. }
  1302. private string[] Trim(string[] ss)
  1303. {
  1304. for (int i = 0; i < ss.Length; i++)
  1305. {
  1306. ss[i] = ss[i].Trim();
  1307. }
  1308. return ss;
  1309. }
  1310. public static bool EditorVisible
  1311. {
  1312. get
  1313. {
  1314. return ((CurrentEditor != null) && CurrentEditor.Visible);
  1315. }
  1316. }
  1317. public string Filename
  1318. {
  1319. get
  1320. {
  1321. return this.filename;
  1322. }
  1323. set
  1324. {
  1325. this.filename = value;
  1326. this.Text = this.filename;
  1327. }
  1328. }
  1329. private bool Modified
  1330. {
  1331. get
  1332. {
  1333. if (this.modified)
  1334. {
  1335. switch (MessageBox.Show("Text modified. Save modifications ?", "Confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question))
  1336. {
  1337. case DialogResult.Yes:
  1338. return !this.Save();
  1339. case DialogResult.No:
  1340. return false;
  1341. }
  1342. return true;
  1343. }
  1344. return false;
  1345. }
  1346. set
  1347. {
  1348. if (this.modified != value)
  1349. {
  1350. this.modified = value;
  1351. if (this.modified)
  1352. {
  1353. if (!this.Text.EndsWith("*"))
  1354. {
  1355. this.Text = this.Text + "*";
  1356. }
  1357. }
  1358. else
  1359. {
  1360. this.Text = this.Filename;
  1361. }
  1362. }
  1363. }
  1364. }
  1365. }
  1366. }