private void SetupEvaluateMethod(ScriptThread thread) { var languageTailRecursive = thread.Runtime.Language.Grammar.LanguageFlags.IsSet(LanguageFlags.TailRecursive); lock (this.LockObject) { var target = TargetRef.Evaluate(thread); if (target is SpecialForm) { _specialForm = target as SpecialForm; _specialFormArgs = Arguments.ChildNodes.ToArray(); this.Evaluate = EvaluateSpecialForm; } else { if (languageTailRecursive) { var isTail = Flags.IsSet(AstNodeFlags.IsTail); if (isTail) { this.Evaluate = EvaluateTail; } else { this.Evaluate = EvaluateWithTailCheck; } } else { this.Evaluate = EvaluateNoTail; } } }//lock }
internal static bool RunModalWin32Form(SpecialForm form, Gtk.Window parent) { while (Gtk.Application.EventsPending()) { Gtk.Application.RunIteration(); } IntPtr ph = HgdiobjGet(parent.GdkWindow); IntPtr hdlg = IntPtr.Zero; form.Shown += delegate { try { hdlg = form.Handle; SetGtkDialogHook(hdlg, false); } catch (Exception ex) { LoggingService.LogError("Failed to hook win32 dialog messages", ex); } }; bool result; try { result = form.ShowMagicDialog() == DialogResult.OK; } finally { if (hdlg != IntPtr.Zero) { ClearGtkDialogHook(hdlg); } } return(result); }
private void SetupEvaluateMethod(ScriptThread thread) { var languageTailRecursive = thread.Runtime.Language.Grammar.LanguageFlags.IsSet(LanguageFlags.TailRecursive); lock (this.LockObject) { var target = TargetRef.Evaluate(thread); if (target is SpecialForm) { _specialForm = target as SpecialForm; _specialFormArgs = Arguments.ChildNodes.ToArray(); this.Evaluate = EvaluateSpecialForm; } else { if (languageTailRecursive) { var isTail = Flags.IsSet(AstNodeFlags.IsTail); if (isTail) this.Evaluate = EvaluateTail; else this.Evaluate = EvaluateWithTailCheck; } else this.Evaluate = EvaluateNoTail; } }//lock }
//Method for adding methods to BuiltIns table in Runtime public static BindingTargetInfo AddSpecialForm(this BindingSourceTable targets, SpecialForm form, string formName, int minChildCount = 0, int maxChildCount = 0, string parameterNames = null) { var formInfo = new SpecialFormBindingInfo(formName, form, minChildCount, maxChildCount, parameterNames); targets.Add(formName, formInfo); return formInfo; }
/*private void MB_Studio_MdiChildActivate(object sender, EventArgs e) * { * if (ActiveMdiChild == null) * tabControl.Visible = false; * // If no any child form, hide tabControl * else * { * ActiveMdiChild.WindowState = FormWindowState.Maximized; * // Child form always maximized * * // If child form is new and no has tabPage, * // create new tabPage * if (ActiveMdiChild.Tag == null) * { * // Add a tabPage to tabControl with child * // form caption * TabPage tp = new TabPage(ActiveMdiChild.Text) * { * Tag = ActiveMdiChild, * Parent = tabControl * }; * tabControl.SelectedTab = tp; * * ActiveMdiChild.Tag = tp; * ActiveMdiChild.FormClosed += new FormClosedEventHandler(ActiveMdiChild_FormClosed); * } * * if (!tabControl.Visible) * tabControl.Visible = true; * } * }*/ private void AddNewTab(SpecialForm form, TabMode tabMode = TabMode.Default) { if (IsShownAsTab(form)) { tabControl.SelectedIndex = tabControl.TabPages.IndexOfKey(form.Name);//TabControlGetIndexOf(form.Text); return; } bool specialForm = false; TabPage tab = new TabPage(form.Text) { Name = form.Name,//is the same name good idea? //Parent = tabControl, }; Control[] ccc = form.Controls.Find("title_lbl", false); if (ccc.Length != 0) { specialForm = !specialForm; // true } tabControl.TabPages.Add(tab); form.TopLevel = false; form.Parent = tab; tabControl.SelectedTab = tab; tab.BackColor = form.BackColor;//check for problems with baseColor here tab.AutoScroll = true; if (!specialForm) { form.FormBorderStyle = FormBorderStyle.None; } else { form.Top = form.Top - ccc[0].Height; } if (tabMode != TabMode.Default) { if ((tabMode & TabMode.FillWidth) == TabMode.FillWidth) { form.Width = tab.Width; } if ((tabMode & TabMode.FillHeight) == TabMode.FillHeight) { form.Height = tab.Height; } } //else //{ // form.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top; // form.Dock = DockStyle.Left; //} form.Visible = true; }
internal static Uri GetHugeFormUri(SpecialForm frm) { NameValueCollection col = new NameValueCollection() { { "action", GetHugeFormName(frm) }, { "lang", string.Format("{0,-3}", Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName) } }; return(string.Concat(WebUrl, "Core.php").GetBuildedUri(col)); }
public SpecialFormBindingInfo(string symbol, SpecialForm form, int minChildCount = 0, int maxChildCount = 0, string childRoles = null) : base(symbol, BindingTargetType.SpecialForm) { Binding = new ConstantBinding(form, this); MinChildCount = minChildCount; MaxChildCount = Math.Max(minChildCount, maxChildCount); //if maxParamCount=0 then set it equal to minParamCount if (!string.IsNullOrEmpty(childRoles)) { ChildRoles = childRoles.Split(','); //TODO: add check that paramNames array is in accord with min/max param counts } }
private static string GetHugeFormName(SpecialForm frm) { switch (frm.GetType().Name) { case "frmDescription": return("get-desc"); case "frmTutorial": return("get-tutorial"); } return(""); }
public SpecialFormBindingInfo(string symbol, SpecialForm form, int minChildCount = 0, int maxChildCount = 0, string childRoles = null) : base(symbol, BindingTargetType.SpecialForm) { Binding = new ConstantBinding(form, this); MinChildCount = minChildCount; MaxChildCount = Math.Max(minChildCount, maxChildCount); //if maxParamCount=0 then set it equal to minParamCount if (!string.IsNullOrEmpty(childRoles)) { ChildRoles = childRoles.Split(','); //TODO: add check that paramNames array is in accord with min/max param counts } }
private bool IsShownAsTab(SpecialForm form) { bool b = false; foreach (TabPage tab in tabControl.TabPages) { if (tab.Text.Equals(form.Text)) { b = true; } } return(b); }
private void ProjectFiles_lb_SelectedIndexChanged(object sender, EventArgs e) { SpecialForm form = null; if (projectFiles_lb.SelectedIndex >= 0) { string item = projectFiles_lb.SelectedItem.ToString(); string itemManagerName = item.Remove(item.Length - 1) + "Manager"; if (item.Equals("Troops")) { form = new TroopManager(); } else if (item.Equals("PartyTemplates")) { form = new PartyTemplateManager(); } else if (item.Equals("Parties")) { form = new PartyManager(); } else if (item.Equals("Menus")) { form = new MenuManager(); } else if (item.Equals("Items")) { form = new ItemManager(); } else if (item.Equals("Skills")) { form = new SkillManager(); } else { foreach (ToolForm cm in scriptCommander.CustomManagers) { if (cm.GetType().Name.Equals(itemManagerName)) { form = cm; } } } } if (form != null) { AddNewTab(form, TabMode.FillHeight); } }
private void panel1_MouseMove(object sender, MouseEventArgs e) { if (pen_state) //Pen enable { if (e.Button == MouseButtons.Left) { Cursor.Current = Cursors.Cross; current = e.Location; g.DrawLine(pen, old, current); old = current; //Add the draw point to the list of Points allPoints.Add(current); drawing = true; } } //Eraser enable if (eraser_state) { if (e.Button == MouseButtons.Left) { current = e.Location; g.DrawLine(eraser, old, current); old = current; //Remove the eraser point from the list of points allPoints.Remove(current); //drawing = true; } } if (specialForm_enabled) { if (e.Button == MouseButtons.Left) { g.DrawImage(Specialform_IMG, e.Location); //Add the draw point to the list of SpecialForm Specialform = new SpecialForm(Specialform_IMG, e.Location); allSpecialForms.Add(Specialform); } } RefreshInformations(); }
private void panel1_MouseDown(object sender, MouseEventArgs e) { if (pen_state) //crayon déjà cliqué { old = e.Location; } //About eraser if (eraser_state) { old = e.Location; } if (specialForm_enabled) { g.DrawImage(Specialform_IMG, e.Location); Specialform = new SpecialForm(Specialform_IMG, e.Location); //drawing = true; } }
private void SetupEvaluateMethod(ScriptThread thread) { var languageTailRecursive = thread.Runtime.Language.Grammar.LanguageFlags.IsSet(LanguageFlags.TailRecursive); lock (this.LockObject) { _specialForm = null; var bnd = thread.Bind(_formName, BindingRequestFlags.Invoke); if (bnd != null) { _specialForm = bnd.GetValueRef(thread) as SpecialForm; } IBindingSource src; var target = thread.Runtime.BuiltIns.TryGetValue(_formName, out src); if (target is SpecialForm) { _specialForm = target as SpecialForm; _specialFormArgs = Arguments.ChildNodes.ToArray(); this.Evaluate = EvaluateSpecialForm; } else { if (languageTailRecursive) { var isTail = Flags.IsSet(AstNodeFlags.IsTail); if (isTail) { this.Evaluate = EvaluateTail; } else { this.Evaluate = EvaluateWithTailCheck; } } else { this.Evaluate = EvaluateNoTail; } } }//lock }
private void SetupEvaluateMethod(ScriptThread thread) { var languageTailRecursive = thread.Runtime.Language.Grammar.LanguageFlags.IsSet(LanguageFlags.TailRecursive); lock (this.LockObject) { _specialForm = null; var bnd = thread.Bind(_formName, BindingRequestFlags.Invoke); if (bnd != null) _specialForm = bnd.GetValueRef(thread) as SpecialForm; IBindingSource src; var target = thread.Runtime.BuiltIns.TryGetValue(_formName, out src); if (target is SpecialForm) { _specialForm = target as SpecialForm; _specialFormArgs = Arguments.ChildNodes.ToArray(); this.Evaluate = EvaluateSpecialForm; } else { if (languageTailRecursive) { var isTail = Flags.IsSet(AstNodeFlags.IsTail); if (isTail) this.Evaluate = EvaluateTail; else this.Evaluate = EvaluateWithTailCheck; } else this.Evaluate = EvaluateNoTail; } }//lock }
internal static bool RunModalWin32Form (SpecialForm form, Gtk.Window parent) { while (Gtk.Application.EventsPending ()) Gtk.Application.RunIteration (); IntPtr ph = HgdiobjGet (parent.GdkWindow); IntPtr hdlg = IntPtr.Zero; form.Shown += delegate { try { hdlg = form.Handle; SetGtkDialogHook (hdlg, false); } catch (Exception ex) { LoggingService.LogError ("Failed to hook win32 dialog messages", ex); } }; bool result; try { result = form.ShowMagicDialog () == DialogResult.OK; } finally { if (hdlg != IntPtr.Zero) ClearGtkDialogHook (hdlg); } return result; }
public static string GenerateCons(Cons args, Environment environment) { // ananlysi cons if (args == null) { return(@"//retval = null; // dont null mite need retval "); } else { Symbol sym = args.Car() as Symbol; object e = Runtime.Eval(sym, environment); if (e is Function) { Function f = e as Function; string v = "{" + NewLine; Cons rest = args.Rest() as Cons; v += GenerateFuncCall(f.Method.DeclaringType.ToString(), f.Method.Name, rest, environment); return(v + "}" + NewLine); } else if (e is SpecialForm) { SpecialForm f = e as SpecialForm; Cons rest = args.Rest() as Cons; string r = Printer.ConsToString(rest); return(Runtime.EvalString("(gen-" + f.Method.Name + " " + r + ")", environment) as string); } else if (e is Macro) { Macro m = e as Macro; Cons rest = args.Rest() as Cons; Cons em = m.Expand(rest) as Cons; return(Generate(em, environment)); } else if (e is Closure) { extracode += Closure(new Cons(sym), environment) as string; string v = "{" + NewLine; Cons rest = args.Rest() as Cons; v += GenerateFuncCall(null, environment.GetValue(sym) as string, rest, environment); return(v + "}" + NewLine); } else if (currsymbols.ContainsKey(sym)) { string v = "{" + NewLine; Cons rest = args.Rest() as Cons; v += GenerateFuncCall(null, environment.GetValue(sym) as string, rest, environment); return(v + "}" + NewLine); } else { // not good, lets not support this for now // try // { // return "// call not supported";// Call(args, environment).ToString(); // } // catch // { string margs = GetArgs(); string v = GenerateList(args.Rest() as Cons, environment, margs); return(string.Format("retval = LSharp.Cons.FromList({0});{1}", margs, NewLine)); // } } } }
//Method for adding methods to BuiltIns table in Runtime public static BindingTargetInfo AddSpecialForm(this BindingSourceTable targets, SpecialForm form, string formName, int minChildCount = 0, int maxChildCount = 0, string parameterNames = null) { var formInfo = new SpecialFormBindingInfo(formName, form, minChildCount, maxChildCount, parameterNames); targets.Add(formName, formInfo); return(formInfo); }