/// <summary> /// Copies from another function with a deep copy. /// </summary> public override void CopyFrom(PlotItem item) { base.CopyFrom(item); f = ((Function2D)item).f; rgb = ((Function2D)item).rgb; cache = (Bitmap)((Function2D)item).cache.Clone(); }
/// <summary> /// Copies from another with a deep copy. /// </summary> /// <param name="item"></param> public override void CopyFrom(PlotItem item) { base.CopyFrom(item); source = (string)((FunctionItem)item).source.Clone(); p = (SmallData)((FunctionItem)item).p.Clone(); }
/// <summary> /// Copies from another function with a deep copy. /// </summary> public override void CopyFrom(PlotItem item) { base.CopyFrom(item); f = ((Function1D)item).f; cache = (PointF[])((Function1D)item).cache.Clone(); }
/// <summary> /// Returns a deep copy of the <c>PlotItem</c>. /// </summary> public virtual PlotItem Clone() { PlotItem item = new PlotItem(); item.CopyFrom(this); return item; }
/// <summary> /// Compiles the sourcecode of the <c>PlotItem</c>. /// </summary> /// <param name="load">Specifies if the code should also be loaded, or if only to check the /// items source for compilation errors.</param> public virtual void Compile(bool load) { DeleteDLLs(); ListDictionary opts; if (model != null) opts = model.CompilerOptions; else { opts = new ListDictionary(); opts.Add("target", "library"); opts.Add("o", true); } CompilerError[] err = Compiler.Compile(new string[1]{GetSource()}, new string[1] {"Source"}, DLLName(), GetImports(), opts); compiled = true; if (err.Length > 0) { errors = new string[err.Length]; for (int i = 0; i < err.Length; i++) { compiled = compiled && (err[i].ErrorLevel != ErrorLevel.Error) && (err[i].ErrorLevel != ErrorLevel.FatalError); if (err[i].ErrorLevel == ErrorLevel.Warning) { errors[i] = "warning at line "; } else { errors[i] = "line "; } errors[i] += err[i].SourceLine + ": " + err[i].ErrorMessage; } } else { errors = new string[1] {"No errors found."}; } if (compiled && load) { Assembly a = Assembly.LoadFrom(DLLName()); Type t = a.GetType("FPlotLibrary.Code.Item"+dllIndex.ToString(), true, false); object o = t.GetConstructor(Type.EmptyTypes).Invoke(null); dllIndex++; code = (PlotItem)o; modified = recalc = true; } else if (load) { modified = recalc = true; code = this; } }
/// <summary> /// Inserts a item into the list at a given index. /// </summary> /// <param name="index">The index where to insert the item.</param> /// <param name="item">The item to insert.</param> public virtual void Insert(int index, PlotItem item) { item.model = model; list.Insert(index, item); }
/// <summary> /// Copies from another PlotItem with a deep copy. /// </summary> public virtual void CopyFrom(PlotItem item) { model = item.model; name = (string)item.name.Clone(); color = item.color; lineStyle = item.lineStyle; lineWidth = item.lineWidth; recalc = item.recalc; code = item.code; errors = (string[])errors.Clone(); }
/// <summary> /// Removes a item from the list. /// </summary> /// <param name="item">The item to remove.</param> public virtual void Remove(PlotItem item) { list.Remove(item); }
public EditMenuItem(MainForm form, PlotItem item) { this.item = item; this.Click += new EventHandler(form.EditClick); }
/// <summary> /// Returns the index of a given item. /// </summary> /// <param name="item">The item to return the index of.</param> /// <returns>The index of the item.</returns> public virtual int IndexOf(PlotItem item) { return(list.IndexOf(item)); }
/// <summary> /// Adds a item to the list. /// </summary> /// <param name="item">The item to be inserted.</param> /// <returns>The index of the inserted item.</returns> public virtual int Add(PlotItem item) { item.model = model; return(list.Add(item)); }
/// <summary> /// Returns the index of a given item. /// </summary> /// <param name="item">The item to return the index of.</param> /// <returns>The index of the item.</returns> public virtual int IndexOf(PlotItem item) { return list.IndexOf(item); }
/// <summary> /// Copies from another function with a deep copy. /// </summary> public override void CopyFrom(PlotItem item) { base.CopyFrom(item); cache = (Bitmap)((FunctionColor)item).cache.Clone(); }
/// <summary> /// Copies from another library with a deep copy. /// </summary> public override void CopyFrom(PlotItem item) { base.CopyFrom(item); source = (string)((SourceLibrary)item).source.Clone(); }
/// <summary> /// Copies from another DataItem. /// </summary> public override void CopyFrom(PlotItem item) { base.CopyFrom(item); DataItem data = (DataItem)item; Length = data.Length; x = data.x.Clone(this); y = data.y.Clone(this); dx = data.dx.Clone(this); dy = data.dy.Clone(this); UpdateLinks(); lines = data.lines; marks = data.marks; }
/// <summary> /// Adds a item to the list. /// </summary> /// <param name="item">The item to be inserted.</param> /// <returns>The index of the inserted item.</returns> public virtual int Add(PlotItem item) { item.model = model; return list.Add(item); }