public DeviceIconSet( ISimpleDeviceIconSet large, ISimpleDeviceIconSet medium, IInteractiveDeviceIconSet small, Image background, IColorSet colors) { this._large = large; this._medium = medium; this._small = small; this._background = background; this._colors = colors; }
/// <summary> /// Gets the index in the plot color set that is the specified number of steps away from the given color index. /// </summary> /// <param name="colorSet">The given color set.</param> /// <param name="idx">Original index in the given color set.</param> /// <param name="step">The number of step.</param> /// <param name="wraps">On return, this value contains the number of wraps that have been made to find the return color. That means, that when by the specified number of steps the end of the color set is reached, a value of one is added to the wraps value.</param> /// <returns>The index in the plot color set that is the specified number of steps away of the specified color index in the set.</returns> public static int GetNextPlotColorIndex(this IColorSet colorSet, int idx, int step, out int wraps) { if (colorSet == null) { wraps = 0; return(idx); } if (idx >= 0) { wraps = Calc.BasicFunctions.NumberOfWraps(colorSet.Count, idx, step); return(Calc.BasicFunctions.PMod(idx + step, colorSet.Count)); } else { // default if idx<0 wraps = 0; return(0); } }
/// <summary> /// Gets a key that is used during serialization to decide whether or not a color set was already serialized. /// Use the returned key to retrieve a string from the properties of the serialization info. If the returned property string /// is null, then the color set needs to be serialized; otherwise, it was already serialized before. /// </summary> /// <param name="set">The color set for which the property key should be evaluated.</param> /// <returns>The property key to be used to retrieve a property from the serialization info.</returns> public static string GetSerializationRegistrationKey(IColorSet set) { return _serializationRegistrationKey + set.Name; }
public NGTreeNodeForColorSet(IColorSet colorSet) : base(true) { _tag = colorSet; _text = colorSet.Name; }
/// <summary> /// Updates the TreeView tree nodes of the color tree. /// </summary> /// <param name="rootNode">The root node of the color tree.</param> /// <param name="showPlotColorsOnly">if set to <c>true</c>, the tree will show plot colors only.</param> /// <param name="currentSelectedObject">The current selected object. Can either be a <see cref="IColorSet"/> or a <see cref="NamedColor"/>.</param> /// <exception cref="System.InvalidProgramException"></exception> public static void UpdateColorTreeViewTreeNodes(NGTreeNode rootNode, bool showPlotColorsOnly, object currentSelectedObject) { var manager = ColorSetManager.Instance; var builtIn = new NGTreeNode() { Text = "Builtin", Tag = Altaxo.Main.ItemDefinitionLevel.Builtin }; var app = new NGTreeNode() { Text = "Application", Tag = Altaxo.Main.ItemDefinitionLevel.Application }; var user = new NGTreeNode() { Text = "User", Tag = Altaxo.Main.ItemDefinitionLevel.UserDefined }; var proj = new NGTreeNode() { Text = "Project", Tag = Altaxo.Main.ItemDefinitionLevel.Project }; IColorSet parentColorSetOfColor = null; NamedColor selectedColor; if (currentSelectedObject is NamedColor) { selectedColor = (NamedColor)currentSelectedObject; parentColorSetOfColor = selectedColor.ParentColorSet; } else { selectedColor = NamedColors.Black; } foreach (var set in manager.GetEntryValues()) { if (showPlotColorsOnly && !set.IsPlotColorSet) { continue; } NGTreeNode newNode; switch (set.Level) { case Altaxo.Main.ItemDefinitionLevel.Builtin: builtIn.Nodes.Add(newNode = new NGTreeNodeForColorSet(set.List)); break; case Altaxo.Main.ItemDefinitionLevel.Application: app.Nodes.Add(newNode = new NGTreeNodeForColorSet(set.List)); break; case Altaxo.Main.ItemDefinitionLevel.UserDefined: user.Nodes.Add(newNode = new NGTreeNodeForColorSet(set.List)); break; case Altaxo.Main.ItemDefinitionLevel.Project: proj.Nodes.Add(newNode = new NGTreeNodeForColorSet(set.List)); break; default: throw new InvalidProgramException(string.Format("Unknown level {0}. Please report this error to the forum.", set.Level)); } if (currentSelectedObject is IColorSet) { bool isCurrentlySelected = object.ReferenceEquals(set, currentSelectedObject); newNode.IsSelected = isCurrentlySelected; if (isCurrentlySelected) { newNode.IsExpanded = true; } } else if (parentColorSetOfColor != null && object.ReferenceEquals(set, parentColorSetOfColor)) { newNode.IsExpanded = true; foreach (var node in newNode.Nodes) { if ((node.Tag is NamedColor) && ((NamedColor)node.Tag) == selectedColor) { node.IsSelected = true; } } } } rootNode.Nodes.Clear(); rootNode.Nodes.Add(builtIn); rootNode.Nodes.Add(app); rootNode.Nodes.Add(user); rootNode.Nodes.Add(proj); }
private void button1_Click(object sender, EventArgs e) { _selectedColor = ColorSetLibrary.ColorSets.Where(x => x.Key == (string)colorSet.SelectedItem).FirstOrDefault().Value; this.Dispose(); }
public BackgroundImageAndColors(Image backgroundImage, IColorSet colors) { this._backgroundImage = backgroundImage; this._colors = colors; }
/// <summary> /// Gets a key that is used during serialization to decide whether or not a color set was already serialized. /// Use the returned key to retrieve a string from the properties of the serialization info. If the returned property string /// is null, then the color set needs to be serialized; otherwise, it was already serialized before. /// </summary> /// <param name="set">The color set for which the property key should be evaluated.</param> /// <returns>The property key to be used to retrieve a property from the serialization info.</returns> public static string GetSerializationRegistrationKey(IColorSet set) { return(_serializationRegistrationKey + set.Name); }
public static void Initialize(IColorSet primary, IColorSet accent) { Primary = primary; Accent = accent; }