public bool HistogramToGM() { Func <string, string, bool> setString = delegate(string name, string value) { Data.ParamSlot p = null; foreach (var parameter in this.gm.ParameterValues) { if (parameter.Key.Name == name) { p = parameter.Key; } } if (p != null) { // this is the apex of shit this.gm.ParameterValues[p] = value; return(true); } return(false); }; if (this.gm.Module.Name == "TransferFunction") { for (int i = 0; i < Math.Min(11, res); ++i) { Color c = Color.FromArgb( (int)(255.0 * a_histo[i]), (int)(255.0 * r_histo[i]), (int)(255.0 * g_histo[i]), (int)(255.0 * b_histo[i])); string suffix = (i + 1).ToString("D2"); setString("enable" + suffix, "True"); setString("colour" + suffix, Data.ParamType.Color.ToString(c)); } this.parentForm.UpdateParameters(this.gm); } else { Debug.Assert(false, "Unknown type of transfer function (should be unrechable)"); } return(false); }
private void okButton_Click(object sender, EventArgs e) { GraphicalModule gm = null; foreach (ListViewItem lvi in listView1.Items) { Data.ParamSlot p = lvi.Tag as Data.ParamSlot; if (p == null) { GraphicalModule m = lvi.SubItems[0].Tag as GraphicalModule; if (m != null) { gm = m; } continue; } if (lvi.SubItems.Count < 3) { continue; } if (lvi.SubItems[2].Text != "<<<") { continue; } System.Diagnostics.Debug.Assert(gm != null); System.Diagnostics.Debug.Assert(gm.ParameterValues.ContainsKey(p)); if (!p.Type.ValuesEqual(gm.ParameterValues[p], lvi.SubItems[3].Text)) { gm.ParameterValues[p] = lvi.SubItems[3].Text; } } DialogResult = DialogResult.OK; }
public GraphicalModuleButtonParameterDescriptor(Data.ParamSlot p, bool useInCmdLine) : base(p, useInCmdLine) { }
public GraphicalModuleParameterDescriptor(Data.ParamSlot p, bool useInCmdLine) : base(p.Name, new Attribute[] { }) { this.p = p; this.useInCmdLine = useInCmdLine; }