Beispiel #1
0
 public void Execute(DrawTheory theory)
 {
     foreach (IAtom atom in this.elements)
     {
         atom.Execute(theory);
     }
 }
Beispiel #2
0
 public override void Execute(DrawTheory theory, params object[] parameters)
 {
     if (parameters.Length > 0x00) {
         EventKey ek = parameters [0x00] as EventKey;
         if (ek != null && ek.Key.ToString ().ToLower ().Equals (this.Key)) {
             Console.Error.WriteLine ("FIRE!");
             base.Execute (theory, parameters);
         } else {
             //Console.Error.WriteLine (ek.Key.ToString ());
         }
     }
 }
Beispiel #3
0
 public override object ExecuteResult(DrawTheory theory, IEnumerable <IFunctionInstance> arguments, IEnumerable <IAtom> body)
 {
     object[] val = EnumerableUtils.FirstsLast(EnumerableUtils.HeadTail(theory, TypeSystem.GetArguments(arguments, this.TermTypes, this.Method.GetParameters().Skip(0x01).SkipLast(0x01).Select(x => x.ParameterType))), body).ToArray();
     try {
         return(this.Method.Invoke(null, val));
     } catch (Exception e) {
         Console.Error.WriteLine("Could not execute the {0} atom.", this.TermString(arguments));
         Console.Error.WriteLine(string.Join(" ; ", val.Select(x => x.GetType())));
         Console.Error.WriteLine(e);
         return(null);
     }
 }
 public override object ExecuteResult(DrawTheory theory, IEnumerable<IFunctionInstance> arguments, IEnumerable<IAtom> body)
 {
     object[] val = EnumerableUtils.FirstsLast (EnumerableUtils.HeadTail (theory, TypeSystem.GetArguments (arguments, this.TermTypes, this.Method.GetParameters ().Skip (0x01).SkipLast (0x01).Select (x => x.ParameterType))), body).ToArray ();
     try {
         return this.Method.Invoke (null, val);
     } catch (Exception e) {
         Console.Error.WriteLine ("Could not execute the {0} atom.", this.TermString (arguments));
         Console.Error.WriteLine (string.Join (" ; ", val.Select (x => x.GetType ())));
         Console.Error.WriteLine (e);
         return null;
     }
 }
 public virtual object ExecuteResult(DrawTheory theory, IEnumerable<IFunctionInstance> arguments, IEnumerable<IAtom> body)
 {
     object[] val = EnumerableUtils.HeadTail (theory, TypeSystem.GetArguments (arguments, this.TermTypes, this.method.GetParameters ().Skip (0x01).Select (x => x.ParameterType))).ToArray ();
     try {
         object result = this.method.Invoke (null, val);
         base.Execute (theory, arguments, body);
         return result;
     } catch (Exception e) {
         Console.Error.WriteLine ("Could not execute the {0} atom.", this.TermString (arguments));
         Console.Error.WriteLine (e);
         return null;
     }
 }
Beispiel #6
0
 public virtual object ExecuteResult(DrawTheory theory, IEnumerable <IFunctionInstance> arguments, IEnumerable <IAtom> body)
 {
     object[] val = EnumerableUtils.HeadTail(theory, TypeSystem.GetArguments(arguments, this.TermTypes, this.method.GetParameters().Skip(0x01).Select(x => x.ParameterType))).ToArray();
     try {
         object result = this.method.Invoke(null, val);
         base.Execute(theory, arguments, body);
         return(result);
     } catch (Exception e) {
         Console.Error.WriteLine("Could not execute the {0} atom.", this.TermString(arguments));
         Console.Error.WriteLine(e);
         return(null);
     }
 }
Beispiel #7
0
        public void CreateTab <T> (DrawTheory dt, T widget) where T : Widget, IMediaObject
        {
            string name = dt.Name;

            this.mainhierarchy.Add(widget);
            Box.BoxChild w = ((Box.BoxChild)(this.mainhierarchy [widget]));
            w.Position = 0;
            w.Expand   = true;
            w.Fill     = true;
            this.sheets.Add(widget, dt);
            this.SetCurrent(widget);
            widget.HasFocus = true;
            this.tabcontrol.Open(name);
        }
        public OutputHttpServerDevice(DrawTheory dt, IProgramManager manager) : base(dt, manager)
        {
            string serverFolder = manager.ServerFolder;
            string navbarfile   = Path.Combine(serverFolder, "navbar.idpml");

            if (File.Exists(navbarfile))
            {
                this.navbar = Navbar.FromStream(serverFolder, navbarfile);
                this.navbar.PostDeserialize();
            }
            else
            {
                throw new ArgumentException("The navbar file does not exists!");
            }
        }
Beispiel #9
0
 public override void Execute(DrawTheory theory, params object[] parameters)
 {
     if (parameters.Length > 0x00)
     {
         EventKey ek = parameters [0x00] as EventKey;
         if (ek != null && ek.Key.ToString().ToLower().Equals(this.Key))
         {
             Console.Error.WriteLine("FIRE!");
             base.Execute(theory, parameters);
         }
         else
         {
             //Console.Error.WriteLine (ek.Key.ToString ());
         }
     }
 }
Beispiel #10
0
        public static OutputDevice CreateDevice(string name, DrawTheory theory, ProgramManager pm)
        {
            Tuple <string, ConstructorInfo> ci;

            if (constructors.TryGetValue(name.Trim().ToLower(), out ci))
            {
                try {
                    return((OutputDevice)ci.Item2.Invoke(new object[] { theory, pm }));
                } catch (Exception e) {
                    Console.WriteLine(e.InnerException);
                    throw e;
                }
            }
            else
            {
                throw new IdpGieException("Cannot find the appropriate output device \"{0}\". Run `idp --list-devices' for a list of installed devices.", name);
            }
        }
Beispiel #11
0
 private void SetCurrent <T> (T current) where T : Widget, IMediaObject
 {
     if (this.current != null)
     {
         this.current.Hide();
         this.mediabar.CurrentChanged -= (x, y) => current.Seek(y);
     }
     this.current = current;
     if (this.current != null)
     {
         DrawTheory dt = this.sheets [this.current];
         this.mediabar.Min             = dt.MinTime;
         this.mediabar.Max             = dt.MaxTime + 1.0d;
         this.mediabar.CurrentChanged += (x, y) => current.Seek(y);
         this.current.Show();
     }
     else
     {
         this.mediabar.Mode = MediaMode.Pause;
         this.mediabar.SetMinCurrentMax(0.0d, 0.0d, 0.0d);
     }
 }
Beispiel #12
0
 public static void Image(DrawTheory dt, IFunctionInstance name, string filepath, double width, double height)
 {
     dt.AddShape (new ShapeImage (name, filepath, width, height));
 }
Beispiel #13
0
 public virtual void FilteredExecute(DrawTheory theory)
 {
     this.body.Execute (theory);
 }
Beispiel #14
0
 public static void Chapter(DrawTheory dt, double time = double.NaN)
 {
     dt.AddChapter(time);
 }
Beispiel #15
0
 public static void Graph(DrawTheory dt, IFunctionInstance name, double width, double height)
 {
 }
Beispiel #16
0
 public static void Title(DrawTheory dt, string title)
 {
     dt.SetName(title);
 }
Beispiel #17
0
 public static void Node(DrawTheory dt, IFunctionInstance name, string graph, double time = double.NaN)
 {
 }
Beispiel #18
0
 public static void Xpos(DrawTheory dt, IFunctionInstance name, double xpos, double time = double.NaN)
 {
     dt.AddModifier(name, time, x => x.SetXPos(xpos));
 }
Beispiel #19
0
 public void Execute(DrawTheory theory)
 {
     this.Predicate.Execute(theory, this.Terms);
 }
Beispiel #20
0
 public static void Image(DrawTheory dt, IFunctionInstance name, string filepath, double width, double height)
 {
     dt.AddShape(new ShapeImage(name, filepath, width, height));
 }
Beispiel #21
0
 public static void Edge(DrawTheory dt, string node1, string node2, string graph)
 {
 }
Beispiel #22
0
 public static void Text(DrawTheory dt, IFunctionInstance name, string text, double time = double.NaN)
 {
     dt.AddModifier(name, time, x => x.SetElement("Text", text));
 }
 public override void Execute(DrawTheory theory, IEnumerable<IFunctionInstance> arguments, IEnumerable<IAtom> body)
 {
     ExecuteResult (theory, arguments, body);
 }
Beispiel #24
0
 public virtual void FilteredExecute(DrawTheory theory)
 {
     this.body.Execute(theory);
 }
Beispiel #25
0
 public static void Ellipse(DrawTheory dt, string text)
 {
     Console.WriteLine(text);
 }
Beispiel #26
0
 public static void Graph(DrawTheory dt, IFunctionInstance name, double width, double height)
 {
 }
Beispiel #27
0
 public static void Execute(DrawTheory dt)
 {
     dt.Source.Reload();
 }
Beispiel #28
0
 public static void RotateZ(DrawTheory dt, IFunctionInstance name, double alpha, double time = double.NaN)
 {
 }
Beispiel #29
0
 public virtual void Execute(DrawTheory theory, IEnumerable <IFunctionInstance> arguments)
 {
     this.Execute(theory, arguments, EnumerableUtils.Zero <IAtom> ());
 }
Beispiel #30
0
 public static void Scale(DrawTheory dt, IFunctionInstance name, double xscale, double yscale, double zscale, double time = double.NaN)
 {
     Xscale (dt, name, xscale, time);
     Yscale (dt, name, yscale, time);
     Zscale (dt, name, zscale, time);
 }
Beispiel #31
0
 public static void Ellipse(DrawTheory dt, string text)
 {
     Console.WriteLine (text);
 }
Beispiel #32
0
 public static void Shift(DrawTheory dt, IFunctionInstance name, double xpos, double ypos, double zpos, double time = double.NaN)
 {
     Xshift (dt, name, xpos, time);
     Yshift (dt, name, ypos, time);
     Zshift (dt, name, zpos, time);
 }
Beispiel #33
0
 public static void Hide(DrawTheory dt, IFunctionInstance name, double time = double.NaN)
 {
     dt.AddModifier (name, time, x => x.SetElement ("Visible", false));
 }
Beispiel #34
0
 public static void Text(DrawTheory dt, IFunctionInstance name, string text, double time = double.NaN)
 {
     dt.AddModifier (name, time, x => x.SetElement ("Text", text));
 }
Beispiel #35
0
 public virtual void Execute(DrawTheory theory, params object[] parameters)
 {
     this.FilteredExecute (theory);
 }
Beispiel #36
0
 public static void Title(DrawTheory dt, string title)
 {
     dt.SetName (title);
 }
Beispiel #37
0
 protected OutputDevice(DrawTheory theory, IProgramManager manager)
 {
     this.theory  = theory;
     this.manager = manager;
 }
Beispiel #38
0
 public static void Zpos(DrawTheory dt, IFunctionInstance name, double zpos, double time = double.NaN)
 {
     dt.AddModifier (name, time, x => x.SetZPos (zpos));
 }
Beispiel #39
0
 public OutputPrintDevice(DrawTheory theory, IProgramManager manager) : base(theory, manager)
 {
 }
Beispiel #40
0
 public virtual void Execute(DrawTheory theory)
 {
     this.head.Predicate.Execute(theory, this.head.Terms, this.Body.Elements);
 }
Beispiel #41
0
 public virtual void Execute(DrawTheory theory, IEnumerable<IFunctionInstance> arguments, IEnumerable<IAtom> body)
 {
 }
Beispiel #42
0
        public override void Execute(DrawTheory theory, IEnumerable <IFunctionInstance> arguments, IEnumerable <IAtom> body)
        {
            IHook hook = this.ExecuteResult(theory, arguments, body) as IHook;

            theory.AddHook(hook);
        }
Beispiel #43
0
 public static void Zscale(DrawTheory dt, IFunctionInstance name, double zscale, double time = double.NaN)
 {
 }
Beispiel #44
0
 public static void Ellipse(DrawTheory dt, IFunctionInstance name, double width, double height)
 {
     dt.AddShape(new ShapeEllipse(name, width, height));
 }
Beispiel #45
0
 public virtual void Execute(DrawTheory theory, IEnumerable<IFunctionInstance> arguments)
 {
     this.Execute (theory, arguments, EnumerableUtils.Zero<IAtom> ());
 }
Beispiel #46
0
 public static void Zshift(DrawTheory dt, IFunctionInstance name, double zpos, double time = double.NaN)
 {
 }
 public OutputLaTeXDevice(DrawTheory theory, IProgramManager manager)
     : base(theory,manager)
 {
 }
 public OutputPdfStripDevice(DrawTheory dt, IProgramManager manager)
     : base(dt,manager)
 {
 }
Beispiel #49
0
 public static void Chapter(DrawTheory dt, double time = double.NaN)
 {
     dt.AddChapter (time);
 }
Beispiel #50
0
 public static void Execute(DrawTheory dt, string command)
 {
     dt.Source.Alter (command);
 }
Beispiel #51
0
 public OutputPdfDevice(DrawTheory dt, IProgramManager manager) : base(dt, manager)
 {
 }
Beispiel #52
0
 public static void Color(DrawTheory dt, IFunctionInstance name, double r, double g, double b, double time = double.NaN)
 {
     InnerColor (dt, name, r, g, b, time);
 }
Beispiel #53
0
 public static void Execute(DrawTheory dt)
 {
     dt.Source.Reload ();
 }
Beispiel #54
0
 public static void Depth(DrawTheory dt, IFunctionInstance name, double index, double time = double.NaN)
 {
     dt.AddModifier (name, time, x => x.SetZPos (index));
 }
Beispiel #55
0
 public static void Execute(DrawTheory dt, string command)
 {
     dt.Source.Alter(command);
 }
Beispiel #56
0
 public static void Edge(DrawTheory dt, string node1, string node2, string graph)
 {
 }
Beispiel #57
0
 public virtual void Execute(DrawTheory theory, params object[] parameters)
 {
     this.FilteredExecute(theory);
 }
Beispiel #58
0
 public static void EdgeColor(DrawTheory dt, IFunctionInstance name, double r, double g, double b, double time = double.NaN)
 {
     dt.AddModifier (name, time, x => x.SetElement ("EdgeColor", new Color (r * MathExtra.Inv255, g * MathExtra.Inv255, b * MathExtra.Inv255)));
 }
Beispiel #59
0
 public virtual void Execute(DrawTheory theory, IEnumerable <IFunctionInstance> arguments, IEnumerable <IAtom> body)
 {
 }
Beispiel #60
0
 public static void Ellipse(DrawTheory dt, IFunctionInstance name, double width, double height)
 {
     dt.AddShape (new ShapeEllipse (name, width, height));
 }