public virtual void CreateOptionsUI() { Dictionary <string, RibbonCommandValue> newValues = Values.Where(v => v.Value.isDrawn == false).ToDictionary(k => k.Key, v => v.Value); RibbonContainerCapsule container, valueContainer = new RibbonContainerCapsule("Values", this, RibbonCollectionCapsule.LayoutOrientation.vertical, true); var valueColumns = new List <Dictionary <string, RibbonCommandValue> >(); var valueColumn = new Dictionary <string, RibbonCommandValue>(); for (int i = 0; i < newValues.Count; i++) { newValues.ElementAt(i).Value.isDrawn = true; if (i % 3 == 0) { valueColumn = new Dictionary <string, RibbonCommandValue>(); valueColumns.Add(valueColumn); } valueColumn.Add(newValues.Keys.ToArray()[i], newValues.Values.ToArray()[i]); } Graphics graphics = Graphics.FromImage(new System.Drawing.Bitmap(400, 50)); Font font = new Font("Sans Serif", 8.25f, FontStyle.Regular); if (newValues.Count != 0) { int i = 0; foreach (Dictionary <string, RibbonCommandValue> column in valueColumns) { int width = 0; foreach (string name in column.Keys) { width = Math.Max(width, (int)graphics.MeasureString(name, font).Width); } valueContainer = new RibbonContainerCapsule(String.Format("Values{0}", i++), this, RibbonCollectionCapsule.LayoutOrientation.vertical, true); foreach (string name in column.Keys) { container = new RibbonContainerCapsule(name + "Container", valueContainer, RibbonCollectionCapsule.LayoutOrientation.horizontal, false); new RibbonLabelCapsule(name + "Label", name, name, container, width); newValues[name].Command = new RibbonTextBoxCapsule(name + "TextBox", newValues[name].Value.ToString(), name, container, 42).Command; } } } if (Booleans.Count != 0) { container = new RibbonContainerCapsule("Checkboxes", this, RibbonCollectionCapsule.LayoutOrientation.vertical, true); foreach (string name in Booleans.Keys) { Booleans[name].Command = new RibbonCheckBoxCapsule(name + "Checkbox", name, null, name, container, Booleans[name].Value).Command; } } }
public virtual void CreateOptionsUI() { Dictionary<string, RibbonCommandValue> newValues = Values.Where(v => v.Value.isDrawn == false).ToDictionary(k => k.Key, v => v.Value); RibbonContainerCapsule container, valueContainer = new RibbonContainerCapsule("Values", this, RibbonCollectionCapsule.LayoutOrientation.vertical, true); var valueColumns = new List<Dictionary<string, RibbonCommandValue>>(); var valueColumn = new Dictionary<string, RibbonCommandValue>(); for (int i = 0; i < newValues.Count; i++) { newValues.ElementAt(i).Value.isDrawn = true; if (i % 3 == 0) { valueColumn = new Dictionary<string, RibbonCommandValue>(); valueColumns.Add(valueColumn); } valueColumn.Add(newValues.Keys.ToArray()[i], newValues.Values.ToArray()[i]); } Graphics graphics = Graphics.FromImage(new System.Drawing.Bitmap(400, 50)); Font font = new Font("Sans Serif", 8.25f, FontStyle.Regular); if (newValues.Count != 0) { int i = 0; foreach (Dictionary<string, RibbonCommandValue> column in valueColumns) { int width = 0; foreach (string name in column.Keys) { width = Math.Max(width, (int)graphics.MeasureString(name, font).Width); } valueContainer = new RibbonContainerCapsule(String.Format("Values{0}", i++), this, RibbonCollectionCapsule.LayoutOrientation.vertical, true); foreach (string name in column.Keys) { container = new RibbonContainerCapsule(name + "Container", valueContainer, RibbonCollectionCapsule.LayoutOrientation.horizontal, false); new RibbonLabelCapsule(name + "Label", name, name, container, width); newValues[name].Command = new RibbonTextBoxCapsule(name + "TextBox", newValues[name].Value.ToString(), name, container, 42).Command; } } } if (Booleans.Count != 0) { container = new RibbonContainerCapsule("Checkboxes", this, RibbonCollectionCapsule.LayoutOrientation.vertical, true); foreach (string name in Booleans.Keys) Booleans[name].Command = new RibbonCheckBoxCapsule(name + "Checkbox", name, null, name, container, Booleans[name].Value).Command; } }
public void CreateOptionsUI() { IsEnabledCommandBoolean.Command = new RibbonCheckBoxCapsule(booleanText, booleanText, null, booleanText, this, false).Command; RibbonContainerCapsule topContainer = new RibbonContainerCapsule("BooleanGroup", this, RibbonCollectionCapsule.LayoutOrientation.horizontal, false); RibbonContainerCapsule container, valueContainer; Debug.Assert(Values.Count > 0); var valueColumns = new List<Dictionary<string, RibbonInput>>(); var valueColumn = new Dictionary<string, RibbonInput>(); for (int i = 0; i < Values.Count; i++) { if (i % 2 == 0) { valueColumn = new Dictionary<string, RibbonInput>(); valueColumns.Add(valueColumn); } valueColumn.Add(Values.Keys.ToArray()[i], Values.Values.ToArray()[i]); } Graphics graphics = Graphics.FromImage(new System.Drawing.Bitmap(400, 50)); Font font = new Font("Sans Serif", 8.25f, FontStyle.Regular); if (Values.Count != 0) { int i = 0; foreach (Dictionary<string, RibbonInput> column in valueColumns) { int width = 0; foreach (string name in column.Keys) { width = Math.Max(width, (int)graphics.MeasureString(name, font).Width); } // if (valueColumn.Count == 1) // valueContainer = topContainer; // else // valueContainer = new RibbonContainerCapsule(String.Format("Values{0}", i++), topContainer, LayoutOrientation.vertical, false); foreach (string name in column.Keys) { container = new RibbonContainerCapsule(name + "Container", this, LayoutOrientation.horizontal, false); // container = new RibbonContainerCapsule(name + "Container", valueContainer, LayoutOrientation.horizontal, false); new RibbonLabelCapsule(name + "Label", name, name, container, width).Command.Updating += delegate(object sender, EventArgs e) { ((Command)sender).IsEnabled = IsEnabledCommandBoolean.Command.IsChecked; }; Values[name].Command = new RibbonTextBoxCapsule(name + "TextBox", Values[name].Value.ToString(), name, container, 42).Command; Values[name].Command.Updating += delegate(object sender, EventArgs e) { ((Command)sender).IsEnabled = IsEnabledCommandBoolean.Command.IsChecked; }; } } } Debug.Assert(Booleans.Count == 0); //if (Booleans.Count != 0) { // container = new RibbonContainerCapsule("Checkboxes", this, RibbonCollectionCapsule.LayoutOrientation.vertical, true); // foreach (string name in Booleans.Keys) // Booleans[name].Command = new RibbonCheckBoxCapsule(name + "Checkbox", name, null, name, container, Booleans[name].Value).Command; //} }
public void CreateOptionsUI() { IsEnabledCommandBoolean.Command = new RibbonCheckBoxCapsule(booleanText, booleanText, null, booleanText, this, false).Command; RibbonContainerCapsule topContainer = new RibbonContainerCapsule("BooleanGroup", this, RibbonCollectionCapsule.LayoutOrientation.horizontal, false); RibbonContainerCapsule container, valueContainer; Debug.Assert(Values.Count > 0); var valueColumns = new List <Dictionary <string, RibbonInput> >(); var valueColumn = new Dictionary <string, RibbonInput>(); for (int i = 0; i < Values.Count; i++) { if (i % 2 == 0) { valueColumn = new Dictionary <string, RibbonInput>(); valueColumns.Add(valueColumn); } valueColumn.Add(Values.Keys.ToArray()[i], Values.Values.ToArray()[i]); } Graphics graphics = Graphics.FromImage(new System.Drawing.Bitmap(400, 50)); Font font = new Font("Sans Serif", 8.25f, FontStyle.Regular); if (Values.Count != 0) { int i = 0; foreach (Dictionary <string, RibbonInput> column in valueColumns) { int width = 0; foreach (string name in column.Keys) { width = Math.Max(width, (int)graphics.MeasureString(name, font).Width); } // if (valueColumn.Count == 1) // valueContainer = topContainer; // else // valueContainer = new RibbonContainerCapsule(String.Format("Values{0}", i++), topContainer, LayoutOrientation.vertical, false); foreach (string name in column.Keys) { container = new RibbonContainerCapsule(name + "Container", this, LayoutOrientation.horizontal, false); // container = new RibbonContainerCapsule(name + "Container", valueContainer, LayoutOrientation.horizontal, false); new RibbonLabelCapsule(name + "Label", name, name, container, width).Command.Updating += delegate(object sender, EventArgs e) { ((Command)sender).IsEnabled = IsEnabledCommandBoolean.Command.IsChecked; }; Values[name].Command = new RibbonTextBoxCapsule(name + "TextBox", Values[name].Value.ToString(), name, container, 42).Command; Values[name].Command.Updating += delegate(object sender, EventArgs e) { ((Command)sender).IsEnabled = IsEnabledCommandBoolean.Command.IsChecked; }; } } } Debug.Assert(Booleans.Count == 0); //if (Booleans.Count != 0) { // container = new RibbonContainerCapsule("Checkboxes", this, RibbonCollectionCapsule.LayoutOrientation.vertical, true); // foreach (string name in Booleans.Keys) // Booleans[name].Command = new RibbonCheckBoxCapsule(name + "Checkbox", name, null, name, container, Booleans[name].Value).Command; //} }
public void Initialize() { var tab = new RibbonTabCapsule("UnfoldMore", Resources.TabText, ribbonRoot); RibbonGroupCapsule group; RibbonContainerCapsule container; RibbonButtonCapsule button; group = new RibbonGroupCapsule("Tabs", Resources.TabsGroupText, tab, RibbonCollectionCapsule.LayoutOrientation.horizontal); container = new RibbonContainerCapsule("Buttons", group, RibbonCollectionCapsule.LayoutOrientation.vertical, false); button = new EdgeTabButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); new OffsetEdgesButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); new MakeTabsButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); group.CreateOptionsUI(); /* group = new RibbonGroupCapsule("Excel", Resources.ExcelGroupText, tab, RibbonCollectionCapsule.LayoutOrientation.vertical); new ExcelResetButtonCapsule(group, RibbonButtonCapsule.ButtonSize.small); new ExcelLengthButtonCapsule(group, RibbonButtonCapsule.ButtonSize.small); new ExcelAngleButtonCapsule(group, RibbonButtonCapsule.ButtonSize.small); */ tab = new RibbonTabCapsule("Discrete", Resources.DiscreteTabText, ribbonRoot); group = new RibbonGroupCapsule("Procedural", Resources.ProceduralGroupText, tab, RibbonCollectionCapsule.LayoutOrientation.horizontal); container = new RibbonContainerCapsule("Buttons", group, RibbonCollectionCapsule.LayoutOrientation.vertical, false); new CreateFigure8ButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); new CreateAnimateButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); container = new RibbonContainerCapsule("Tools", group, RibbonCollectionCapsule.LayoutOrientation.vertical, false); new LawsonToolButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); new LawsonRelaxButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); new CreateLawsonButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); group.CreateOptionsUI(); container = new RibbonContainerCapsule("More", group, RibbonCollectionCapsule.LayoutOrientation.vertical, false); new LawsonCirclesButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); group = new RibbonGroupCapsule("Gyroid", Resources.GyroidGroupText, tab, RibbonCollectionCapsule.LayoutOrientation.horizontal); container = new RibbonContainerCapsule("Tools", group, RibbonCollectionCapsule.LayoutOrientation.vertical, false); new GyroidRelaxButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); new BoyToolButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); new BrowseToolButtonCapsule(group, RibbonButtonCapsule.ButtonSize.large); group = new RibbonGroupCapsule("Quadrant", "Octant", tab, RibbonCollectionCapsule.LayoutOrientation.horizontal); container = new RibbonContainerCapsule("0", group, RibbonCollectionCapsule.LayoutOrientation.vertical, false); new SelectQuadrant000ButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); new SelectQuadrant100ButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); new SelectQuadrant010ButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); new SelectQuadrant110ButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); container = new RibbonContainerCapsule("1", group, RibbonCollectionCapsule.LayoutOrientation.vertical, false); new SelectQuadrant001ButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); new SelectQuadrant101ButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); new SelectQuadrant011ButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); new SelectQuadrant111ButtonCapsule(container, RibbonButtonCapsule.ButtonSize.small); tab = new RibbonTabCapsule("Lenticular", Resources.Lenticular, ribbonRoot); group = new RibbonGroupCapsule("Lenticular", Resources.Lenticular, tab, RibbonCollectionCapsule.LayoutOrientation.horizontal); new LenticularPlanarCommandCapsule(group, RibbonButtonCapsule.ButtonSize.large); new LenticularCylindricalCommandCapsule(group, RibbonButtonCapsule.ButtonSize.large); group.CreateOptionsUI(); // group = new RibbonGroupCapsule("Wilf", Resources.WilfGroupText, tab, RibbonCollectionCapsule.LayoutOrientation.horizontal); // new WilfButtonCapsule(group, RibbonButtonCapsule.ButtonSize.small); Application.AddFileHandler(new SvgFileSaveHandler()); Application.AddFileHandler(new DxfFileSaveHandler()); }