public void PopAppParamExtendedCombobox( ref ExtendedComboBox appParamComboBox, IList appParamList, int appParamType, bool defaultSelect) { appParamComboBox.CustomizedDataBinding( GetAppParametersByType(appParamList, appParamType), Resources.AppParamDisplay, Resources.AppParamValue, defaultSelect); }
private void AxisSettingComboBox_SelectedIndexChanged(object sender, EventArgs e) { ExtendedComboBox AxisSettingComboBox = sender as ExtendedComboBox; JoystickCapabilities data = (JoystickCapabilities)AxisSettingComboBox.data; JoystickCapabilities nextCap = (JoystickCapabilities)Enum.Parse(typeof(JoystickCapabilities), AxisSettingComboBox.SelectedItem as string); AxisMap aMap = this.controller.Mappings .OfType <AxisMap>() .Where(x => x.inAxis == data) .DefaultIfEmpty(null) .FirstOrDefault(); if (aMap != null) { aMap.SetOut(nextCap); } else { this.controller.Mappings.Add(new AxisMap(data, nextCap)); } }
private void FFBSettingComboBox_SelectedIndexChanged(object sender, EventArgs e) { ExtendedComboBox SettingComboBox = sender as ExtendedComboBox; int vcAxis = (int)SettingComboBox.data; int gcAxis = int.Parse(SettingComboBox.SelectedItem as string); FFBMap aMap = this.controller.Mappings .OfType <FFBMap>() .Where(x => x.gcAxis == vcAxis) .DefaultIfEmpty(null) .FirstOrDefault(); if (aMap != null) { aMap.SetGC(gcAxis); } else { this.controller.Mappings.Add(new FFBMap(this.controller as GameController, vcAxis, gcAxis)); } }
public static void InterfaceThemeControl(Control root) { bLightTheme = GetSetting("ifc_bLightTheme"); fdeltaColorMouseOver = GetSetting("ifc_fdeltaColorMouseOver"); fdeltaColorMouseDown = GetSetting("ifc_fdeltaColorMouseDown"); colBackground = GetSetting("ifc_colBackground"); colForeground = GetSetting("ifc_colText"); colSelection = GetSetting("ifc_colSelection"); colSelectionText = GetSetting("ifc_colSelectionText"); colMouseOver = ColorHSV.ModifyValue(colBackground, fdeltaColorMouseOver, !bLightTheme); colMouseDown = ColorHSV.ModifyValue(colBackground, fdeltaColorMouseDown, !bLightTheme); colAccent = GetSetting("ifc_colAccent"); colBorder = GetSetting("ifc_colBorder"); strFont = GetSetting("ifc_strFont"); bBorders = GetSetting("ifc_bBorders"); borderStyle = bBorders ? BorderStyle.FixedSingle : BorderStyle.None; root.BackColor = colBackground; if (root.ForeColor != Color.OrangeRed && root.ForeColor != colAccent) { root.ForeColor = colForeground; } if (root.Font.FontFamily.Name != "Webdings" && !(root is Form) && !root.HasChildren) { try { //TODO: This is really slow, can we speed it up somehow? root.Font = new Font(new FontFamily(strFont), root.Font.Size, root.Font.Style); } catch { } } if (root is ExtendedPanel || typeof(ExtendedPanel).IsAssignableFrom(root.GetType())) { ExtendedPanel panel = (ExtendedPanel)root; panel.BorderStyle = BorderStyle.None; panel.BorderColor = colBorder; if (panel.HasBorders && panel.AutoScroll && panel.Name != "container") { // special case: we have to wrap this panel inside of another panel for the border to not mess up when scrolling ExtendedPanel container = new ExtendedPanel(); container.Name = "container"; container.Left = panel.Left; container.Top = panel.Top; container.Width = panel.Width; container.Height = panel.Height; container.BackColor = panel.BackColor; container.ForeColor = panel.ForeColor; container.BorderStyle = panel.BorderStyle; container.HasBorders = panel.HasBorders; container.BorderColor = panel.BorderColor; container.Anchor = panel.Anchor; Control parent = panel.Parent; container.Controls.Add(panel); parent.Controls.Add(container); panel.HasBorders = false; panel.Location = new Point(1, 1); panel.Size = new Size(container.Width - 2, container.Height - 2); panel.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; } } else if (root is Panel) { //TODO: Move these to some configurable array instead of hardcoding them in Nimble.dll... if (root.Name != "panelTopBar" && root.Name != "panelFormatting") { Panel panel = (Panel)root; panel.BorderStyle = borderStyle; } } if (root is FlatGroupBox) { FlatGroupBox box = (FlatGroupBox)root; box.BorderColor = colBorder; box.HasBorders = bBorders; } if (root is FlatButton) { FlatButton btn = (FlatButton)root; btn.BackColorOver = colMouseOver; btn.BackColorDown = colMouseDown; btn.BorderColor = colBorder; btn.HasBorder = bBorders; } if (root is ExtendedTextBox) { ExtendedTextBox text = (ExtendedTextBox)root; text.HasBorders = bBorders; text.BorderColor = colBorder; text.BorderColorActive = colBorder; } if (root is DrawBox) { DrawBox db = (DrawBox)root; db.HasBorders = bBorders; db.BorderColor = colBorder; db.ColorPrimary = colAccent; db.ColorSecondary = colBorder; } if (root is DraggablePictureBox) { DraggablePictureBox dpb = (DraggablePictureBox)root; dpb.BorderStyle = BorderStyle.None; dpb.HasBorders = bBorders; dpb.BorderColor = colBorder; } if (root is FlatScrollbar) { FlatScrollbar scrollbar = (FlatScrollbar)root; scrollbar.BorderColor = bBorders ? colBorder : Color.Empty; scrollbar.FillColor = ColorHSV.ModifyValue(colBackground, GetSetting("ifc_fdeltaColorScrollbarFill"), !bLightTheme); scrollbar.HandleMargin = GetSetting("ifc_fScrollbarHandleMargin"); scrollbar.HandleColor = ColorHSV.ModifyValue(colBackground, GetSetting("ifc_fdeltaColorScrollbarHandle"), !bLightTheme); scrollbar.HandleGripColor = ColorHSV.ModifyValue(colBackground, GetSetting("ifc_fdeltaColorScrollbarHandleGrip"), !bLightTheme); scrollbar.HandleGripCount = GetSetting("ifc_iScrollbarHandleCount"); scrollbar.GuidelineColor = ColorHSV.ModifyValue(colBackground, GetSetting("ifc_fdeltaColorScrollbarGuideline"), !bLightTheme); } if (root is FlatList) { FlatList list = (FlatList)root; list.BorderColor = bBorders ? colBorder : Color.Empty; list.HoverColor = colMouseOver; list.SelectionColor = colSelection; list.SelectionTextColor = colSelectionText; list.BorderStyle = borderStyle; list.ForeColorSub = ColorHSV.ModifyValue(colForeground, GetSetting("ifc_fdeltaColorListSubtext"), !bLightTheme); list.FontSub = new Font(list.Font.FontFamily, list.Font.Size * GetSetting("ifc_fListSubtextScale")); } if (root is FlatArrowContainer) { FlatArrowContainer fac = (FlatArrowContainer)root; fac.BorderColor = bBorders ? colBorder : Color.Empty; } if (root is FlatNumberBox) { FlatNumberBox numbox = (FlatNumberBox)root; numbox.ButtonBackColor = colBackground; numbox.ButtonBackColorDown = colMouseDown; numbox.ButtonBackColorOver = colMouseOver; numbox.BorderColor = colBorder; //numbox.ButtonsVertical = false; //TODO: Make this a setting } if (root is ExtendedComboBox) { ExtendedComboBox combo = (ExtendedComboBox)root; combo.FlatStyle = FlatStyle.Popup; combo.HasBorders = bBorders; combo.BorderColor = colBorder; combo.BorderColorActive = colBorder; combo.BorderColorDisabled = colBorder; } if (root is DraggableGraph) { DraggableGraph graph = (DraggableGraph)root; graph.DotColor = colAccent; graph.LineColor = ColorHSV.ModifyValue(colAccent, 0.25, !bLightTheme); graph.BorderColor = colBorder; } CustomCallback?.Invoke(root); #if DEBUG if (root.GetType() == typeof(TextBox) || root.GetType() == typeof(ComboBox) || root.GetType() == typeof(TreeView)) { System.Diagnostics.Debug.Assert(false, "Generic WinForms control of type '" + root.GetType().Name + "' found: " + root.Name + " - can you replace it with its (fixed and better working) extended version?"); } if (root is ListBox || root is ListView || root is NumericUpDown || root is Button) { System.Diagnostics.Debug.Assert(false, "Generic WinForms control of type '" + root.GetType().Name + "' found: " + root.Name + " - can you replace it with a flat control?"); } #endif // ignore if this is in a different namespace //TODO: ScintillaNET is caught on this, we should replace the inline find/replace thing with a custom one! string ns = root.GetType().Namespace; if (ns == "System.Windows.Forms" || ns.StartsWith("Nimble.") || (Namespace == null || ns.StartsWith(Namespace))) { foreach (Control ctl in root.Controls) { InterfaceThemeControl(ctl); } } }