public TextResultWriter (IRunner runner, string fileName) : base (runner, fileName) { if ((fileName == null) || (fileName.Length == 0)) { writer = System.Console.Out; string color_override = Environment.GetEnvironmentVariable ("GENDARME_COLOR") ?? "dark"; switch (color_override.ToLowerInvariant ()) { case "none": color_scheme = ColorScheme.None; break; case "light": color_scheme = ColorScheme.Light; break; case "dark": default: color_scheme = ColorScheme.Dark; break; } } else { color_scheme = ColorScheme.None; writer = new StreamWriter (fileName); need_closing = true; } }
/// <summary> /// Creates new instance of the object and provides default values. /// </summary> /// <param name="g">Reference to Graphics object</param> /// <param name="item">Reference to SwitchButtonItem</param> /// <param name="cs">Reference to legacy ColorScheme</param> /// <param name="f">Indicates the font for the text.</param> /// <param name="rtl">Indicates whether item is in Right-To-Left environment.</param> public SwitchButtonRenderEventArgs(Graphics g, SwitchButtonItem item, ColorScheme cs, Font f, bool rtl) { this.Graphics = g; this.SwitchButtonItem = item; this.ColorScheme = cs; this.RightToLeft = rtl; this.Font = f; }
/// <summary> /// Generates multiple random colors. /// </summary> /// <param name="scheme">Which color schemed to use when generating the color.</param> /// <param name="luminosity">The desired luminosity of the color.</param> /// <param name="count">How many colors to generate</param> public static Color[] GetColors(ColorScheme scheme, Luminosity luminosity, int count) { var ret = new Color[count]; for (var i = 0; i < count; i++) { ret[i] = GetColor(scheme, luminosity); } return ret; }
/// <summary> /// Create a GameObject with a certain amount of health, possible active, and /// can fire a GameObjectCreatedEvent /// </summary> /// <param name="manager">The manager which will fire the GameObjectCreatedEvent</param> /// <param name="health"></param> /// <param name="active"></param> /// <param name="fireOnCreateEvent"></param> public GameObject(GameEventManager manager, int health, bool active, bool fireOnCreateEvent) { ColorScheme = new ColorScheme<Hostility>(); PhysicsComponent = new PhysicsComponent(); Behaviors = new List<IBehavior>(); Active = active; Timescale = 1; Health = health; if (fireOnCreateEvent && GameEventManager != null) GameEventManager.AddEvent(new GameObjectCreatedEvent(this)); }
public static Color[] GetPalette(ColorScheme scheme) { switch (scheme) { case ColorScheme.Blue: return new Color[] { Color.FromArgb(0xff, 0xa9, 0xc4, 0xe9), // brTopLeft Color.FromArgb(0xff, 0xe4, 0xec, 0xf7), // brRowHdr Color.FromArgb(0xff, 0xff, 0xd5, 0x8d), // brRowHdrSel Color.FromArgb(0xff, 0xf6, 0xfa, 0xfb), // brColHdr (top) Color.FromArgb(0xff, 0xd5, 0xdd, 0xea), // brColHdr (bot) Color.FromArgb(0xff, 0xf8, 0xd7, 0x9b), // brColHdrSel (top) Color.FromArgb(0xff, 0xf1, 0xc2, 0x63), // brColHdrSel (bot) Color.FromArgb(0xff, 0xd0, 0xd7, 0xe5), // brLines Color.FromArgb(0xff, 0x9e, 0xb6, 0xce), // brHdrLines Color.FromArgb(0xff, 0xea, 0xec, 0xf5) // brSelection }; case ColorScheme.Silver: return new Color[] { Color.FromArgb(0xff, 0xc6, 0xc6, 0xc6), // brTopLeft Color.FromArgb(0xff, 0xe7, 0xe7, 0xe7), // brRowHdr Color.FromArgb(0xff, 0xf5, 0xc7, 0x95), // brRowHdrSel Color.FromArgb(0xff, 0xf1, 0xf3, 0xf3), // brColHdr (top) Color.FromArgb(0xff, 0xc8, 0xc9, 0xca), // brColHdr (bot) Color.FromArgb(0xff, 0xff, 0xc9, 0x96), // brColHdrSel (top) Color.FromArgb(0xff, 0xff, 0x9b, 0x68), // brColHdrSel (bot) Color.FromArgb(0xff, 0xd0, 0xd7, 0xe5), // brLines Color.FromArgb(0xff, 0x90, 0x91, 0x92), // brHdrLines Color.FromArgb(0xff, 0xea, 0xec, 0xf5) // brSelection }; case ColorScheme.Black: return new Color[] { Color.FromArgb(0xff, 0xc9, 0xc9, 0xc9), // brTopLeft Color.FromArgb(0xff, 0xed, 0xed, 0xed), // brRowHdr Color.FromArgb(0xff, 0xff, 0xd5, 0x8d), // brRowHdrSel Color.FromArgb(0xff, 0xf6, 0xf6, 0xf6), // brColHdr (top) Color.FromArgb(0xff, 0xde, 0xde, 0xde), // brColHdr (bot) Color.FromArgb(0xff, 0xf8, 0xd7, 0x9b), // brColHdrSel (top) Color.FromArgb(0xff, 0xf1, 0xc1, 0x5f), // brColHdrSel (bot) Color.FromArgb(0xff, 0xd0, 0xd7, 0xe5), // brLines Color.FromArgb(0xff, 0xb6, 0xb6, 0xb6), // brHdrLines Color.FromArgb(0xff, 0xea, 0xec, 0xf5) // brSelection }; } // invalid color scheme return null; }
/// <summary> /// Copy another Gameobject. Optionally fire a GameObjectCreatedEvent /// </summary> /// <param name="other"></param> /// <param name="fireOnCreateEvent"></param> public GameObject(GameObject other, bool fireOnCreateEvent=true) { ColorScheme = new ColorScheme<Hostility>(other.ColorScheme); GameEventManager = other.GameEventManager; PhysicsComponent = new PhysicsComponent(other.PhysicsComponent); Behaviors = new List<IBehavior>(other.Behaviors); Active = other.Active; Timescale = other.Timescale; Health = other.Health; if (fireOnCreateEvent && GameEventManager != null) GameEventManager.AddEvent(new GameObjectCreatedEvent(this)); }
/// <summary> /// Gets a new random color. /// </summary> /// <param name="scheme">Which color schemed to use when generating the color.</param> /// <param name="luminosity">The desired luminosity of the color.</param> public static Color GetColor(ColorScheme scheme, Luminosity luminosity) { int H, S, B; // First we pick a hue (H) H = PickHue(scheme); // Then use H to determine saturation (S) S = PickSaturation(H, luminosity, scheme); // Then use S and H to determine brightness (B). B = PickBrightness(H, S, luminosity); // Then we return the HSB color in the desired format return HsvToColor(H, S, B); }
public static void ApplyColorScheme(C1FlexGrid grid, ColorScheme cs) { var c = PaletteProvider.GetPalette(cs); if (c != null) { grid.RowBackground = grid.AlternatingRowBackground = grid.CursorBackground = grid.EditorBackground = new SolidColorBrush(Colors.Transparent); grid.TopLeftCellBackground = new SolidColorBrush(c[0]); grid.RowHeaderBackground = new SolidColorBrush(c[1]); grid.RowHeaderSelectedBackground = new SolidColorBrush(c[2]); grid.ColumnHeaderBackground = CreateGradientBrush(c[3], c[4]); grid.ColumnHeaderSelectedBackground = CreateGradientBrush(c[5], c[6]); grid.GridLinesBrush = new SolidColorBrush(c[7]); ; grid.HeaderGridLinesBrush = new SolidColorBrush(c[8]); grid.SelectionBackground = new SolidColorBrush(c[9]); } }
public static SolidColorBrush GetRandomColor(ColorScheme scheme) { SolidColorBrush retVal = null; switch (scheme) { case ColorScheme.Purple: retVal = RandomColorFromList(PurpleScheme); break; case ColorScheme.Red: retVal = RandomColorFromList(RedScheme); break; case ColorScheme.Green: retVal = RandomColorFromList(GreenScheme); break; } return retVal; }
public static List<SolidColorBrush> GetColors(ColorScheme scheme) { var colorList = new List<SolidColorBrush>(); switch (scheme) { case ColorScheme.Purple: colorList = PurpleScheme; break; case ColorScheme.Red: colorList = RedScheme; break; case ColorScheme.Green: colorList = GreenScheme; break; } return colorList; }
public TextResultWriter (IRunner runner, string fileName) : base (runner, fileName) { if (String.IsNullOrEmpty (fileName)) { writer = System.Console.Out; string color_override = Environment.GetEnvironmentVariable ("GENDARME_COLOR") ?? "dark"; switch (color_override.ToLowerInvariant ()) { case "none": break; case "light": color_scheme = ColorScheme.Light; break; case "dark": default: color_scheme = ColorScheme.Dark; break; } } else { writer = new StreamWriter (fileName); } }
private void ApplyColorScheme(ColorScheme colorScheme) { Brush Back = MainTextBox.Background; Brush Front = MainTextBox.Foreground; switch (colorScheme) { case ColorScheme.Fantasy: Back = Brushes.DarkRed; Front = Brushes.Cornsilk; break; case ColorScheme.Mystery: Back = Brushes.Black; Front = Brushes.YellowGreen; break; case ColorScheme.SciFi: Back = Brushes.DarkBlue; Front = Brushes.LightSlateGray; break; } SelectButton.Background = SaveButton.Background = LoadButton.Background = ChoiceListBox.Background = MainTextBox.Background = Back; SelectButton.Foreground = SaveButton.Foreground = LoadButton.Foreground = ChoiceListBox.Foreground = MainTextBox.Foreground = Front; }
/// <summary> /// Resets the color scheme to the original one. /// </summary> private void reset() { currentColorScheme = new VabScheme(); }
public void SetColor(CharType charType, Color foreColor, Color backColor) => ColorScheme.SetColor(charType.ToCharClass(), foreColor, backColor);
/// <summary> /// Raises the Paint event. /// </summary> /// <param name="e">A PaintEventArgs that contains the event data.</param> protected override void OnPaint(PaintEventArgs e) { PanelStyle panelStyle = this.PanelStyle; if (this.m_bShowCaptionbar == false) { return; } using (UseAntiAlias antiAlias = new UseAntiAlias(e.Graphics)) { Graphics graphics = e.Graphics; using (UseClearTypeGridFit clearTypeGridFit = new UseClearTypeGridFit(graphics)) { Rectangle captionRectangle = this.CaptionRectangle; Color colorGradientBegin = this.PanelColors.PanelCaptionGradientBegin; Color colorGradientEnd = this.PanelColors.PanelCaptionGradientEnd; Color colorGradientMiddle = this.PanelColors.PanelCaptionGradientMiddle; Color colorText = this.PanelColors.PanelCaptionText; bool bShowXPanderPanelProfessionalStyle = this.ShowXPanderPanelProfessionalStyle; ColorScheme colorSchema = this.ColorScheme; if ((bShowXPanderPanelProfessionalStyle == true) && (colorSchema == ColorScheme.Professional) && (panelStyle != PanelStyle.Office2007)) { colorGradientBegin = this.PanelColors.XPanderPanelCaptionGradientBegin; colorGradientEnd = this.PanelColors.XPanderPanelCaptionGradientEnd; colorGradientMiddle = this.PanelColors.XPanderPanelCaptionGradientMiddle; colorText = this.PanelColors.XPanderPanelCaptionText; } Image image = this.Image; RightToLeft rightToLeft = this.RightToLeft; Font captionFont = this.CaptionFont; Rectangle clientRectangle = this.ClientRectangle; string strText = this.Text; DockStyle dockStyle = this.Dock; bool bExpand = this.Expand; if (this.m_imageClosePanel == null) { this.m_imageClosePanel = Resources.closePanel; } Color colorCloseIcon = this.PanelColors.PanelCaptionCloseIcon; if (colorCloseIcon == Color.Empty) { colorCloseIcon = colorText; } bool bShowExpandIcon = this.ShowExpandIcon; bool bShowCloseIcon = this.ShowCloseIcon; switch (panelStyle) { case SkyCar.Framework.WindowUI.Controls.PanelStyle.Default: case PanelStyle.Office2007: DrawStyleDefault(graphics, captionRectangle, colorGradientBegin, colorGradientEnd, colorGradientMiddle); break; } DrawBorder( graphics, clientRectangle, captionRectangle, this.PanelColors.BorderColor, this.PanelColors.InnerBorderColor); if ((dockStyle == DockStyle.Fill) || (dockStyle == DockStyle.None) || ((bShowExpandIcon == false) && (bShowCloseIcon == false))) { DrawImagesAndText( graphics, captionRectangle, CaptionSpacing, this.ImageRectangle, image, rightToLeft, captionFont, colorText, strText); return; } if ((bShowExpandIcon == true) || (bShowCloseIcon == true)) { Image imageExpandPanel = GetExpandImage(dockStyle, bExpand); DrawImagesAndText( graphics, dockStyle, CaptionSpacing, captionRectangle, clientRectangle, this.ImageRectangle, image, rightToLeft, bShowCloseIcon, this.m_imageClosePanel, colorCloseIcon, ref this.RectangleCloseIcon, bShowExpandIcon, bExpand, imageExpandPanel, colorText, ref this.RectangleExpandIcon, captionFont, colorText, this.PanelColors.PanelCollapsedCaptionText, strText); if (this.m_imgHoverBackground == null) { this.m_imgHoverBackground = GetPanelIconBackground( graphics, this.ImageRectangle, this.PanelColors.PanelCaptionSelectedGradientBegin, this.PanelColors.PanelCaptionSelectedGradientEnd); } if (this.m_imgHoverBackground != null) { Rectangle rectangleCloseIcon = this.RectangleCloseIcon; if (rectangleCloseIcon != Rectangle.Empty) { if (this.HoverStateCloseIcon == HoverState.Hover) { graphics.DrawImage(this.m_imgHoverBackground, rectangleCloseIcon); DrawIcon(graphics, this.m_imageClosePanel, rectangleCloseIcon, colorCloseIcon, rectangleCloseIcon.Y); } } Rectangle rectangleExpandIcon = this.RectangleExpandIcon; if (rectangleExpandIcon != Rectangle.Empty) { if (this.HoverStateExpandIcon == HoverState.Hover) { graphics.DrawImage(this.m_imgHoverBackground, rectangleExpandIcon); DrawIcon(graphics, imageExpandPanel, rectangleExpandIcon, colorText, rectangleExpandIcon.Y); } } } } } } }
protected override void Client_PlaySong(IPreviewBeatmapLevel desiredLevel, BeatmapCharacteristicSO desiredCharacteristic, BeatmapDifficulty desiredDifficulty, GameplayModifiers gameplayModifiers, PlayerSpecificSettings playerSpecificSettings, OverrideEnvironmentSettings overrideEnvironmentSettings, ColorScheme colorScheme, bool useFloatingScoreboard = false, bool useSync = false, bool disablePause = false, bool disableFail = false) { base.Client_PlaySong(desiredLevel, desiredCharacteristic, desiredDifficulty, gameplayModifiers, playerSpecificSettings, overrideEnvironmentSettings, colorScheme, useFloatingScoreboard, useSync, disablePause, disableFail); //Set up per-play settings Plugin.UseSync = useSync; Plugin.UseFloatingScoreboard = useFloatingScoreboard; Plugin.DisablePause = disablePause; Plugin.DisableFail = disableFail; //Reset score (Plugin.client.Self as Player).Score = 0; (Plugin.client.Self as Player).Accuracy = 0; var playerUpdate = new Event(); playerUpdate.Type = Event.EventType.PlayerUpdated; playerUpdate.ChangedObject = Plugin.client.Self; Plugin.client.Send(new Packet(playerUpdate)); UnityMainThreadDispatcher.Instance().Enqueue(() => { //If the player is still on the results screen, go ahead and boot them out if (_resultsViewController.isInViewControllerHierarchy) { resultsViewController_continueButtonPressedEvent(null); } SongUtils.PlaySong(desiredLevel, desiredCharacteristic, desiredDifficulty, overrideEnvironmentSettings, colorScheme, gameplayModifiers, playerSpecificSettings, SongFinished); }); }
public Color GetBorderColor(ColorScheme colorScheme, string direction) { return(direction == "Top" || direction == "Left" ? colorScheme.lightColor : colorScheme.darkColor); }
private static Range GetHueRange(ColorScheme colorInput) { DefinedColor color; if (ColorDictionary.TryGetValue(colorInput, out color)) { if (color.HueRange != null) { return color.HueRange; } } return new Range(0, 360); }
/// <summary> /// Creates a new instance with the given color scheme and luminosity range. /// </summary> /// <param name="scheme">The color scheme to use when generating the color.</param> /// <param name="luminosity">The luminosity range to use when generating the color.</param> public Options(ColorScheme scheme, Luminosity luminosity) { ColorScheme = scheme; Luminosity = luminosity; }
public StackedCharts(ApplicationConfiguration configuration, IExtendedConsole console, RunContext runContext, ColorScheme colorScheme) : base(configuration, console, runContext, colorScheme) { }
public Direct() { InitializeComponent(); ColorScheme.ApplyColor(this); }
public virtual void OnChangingColorScheme(TFormBase form, ColorScheme colorScheme) { }
/// <summary>Creates a <see cref="Display"/></summary> /// <param name="surface">Surface to wrap</param> /// <param name="offset">Everything drawn on this <see cref="Display"/> will be offset by this</param> /// <param name="scale">Everything drawn on this <see cref="Display"/> will be scaled by this</param> /// <param name="scheme">Gives the base colors of the display</param> /// <param name="sprites">The collection of shapes that can be easility drawn on the surface</param> public Display(IMyTextSurface surface, Vector2?offset = null, float scale = 1f, ColorScheme scheme = null, ShapeCollections sprites = null) { surface.ContentType = ContentType.SCRIPT; surface.Script = ""; this.surface = surface; this.offset = offset ?? Vector2.Zero; this.scale = scale; this.scheme = scheme ?? new ColorScheme(); this.sprites = sprites; }
public TooltipMarkupGen(ColorScheme st) { this.st = st; }
private static int PickHue(ColorScheme scheme) { var hueRange = GetHueRange(scheme); var hue = RandomWithin(hueRange); // Instead of storing red as two separate ranges, // we group them, using negative numbers if (hue < 0) hue = 360 + hue; return hue; }
public static void Theme(int mode) { switch (mode) { case 0: { Colors.Base = new ColorScheme() { Normal = TGAttribute.Make(Color.White, Color.Black), HotNormal = TGAttribute.Make(Color.White, Color.DarkGray), Focus = TGAttribute.Make(Color.White, Color.Blue), HotFocus = TGAttribute.Make(Color.BrighCyan, Color.Blue) }; Colors.Menu = new ColorScheme() { Normal = TGAttribute.Make(Color.Black, Color.Gray), Focus = TGAttribute.Make(Color.White, Color.Blue), HotNormal = TGAttribute.Make(Color.DarkGray, Color.Gray), HotFocus = TGAttribute.Make(Color.BrighCyan, Color.Blue) }; Colors.Dialog = new ColorScheme() { Normal = TGAttribute.Make(Color.White, Color.DarkGray), Focus = TGAttribute.Make(Color.White, Color.Blue), HotNormal = TGAttribute.Make(Color.Blue, Color.White), HotFocus = TGAttribute.Make(Color.BrighCyan, Color.Blue) }; ArchivedList = new ColorScheme() { Normal = TGAttribute.Make(Color.White, Color.Blue), Focus = TGAttribute.Make(Color.White, Color.BrightBlue), HotNormal = TGAttribute.Make(Color.White, Color.Blue), HotFocus = TGAttribute.Make(Color.White, Color.BrightBlue) }; HighlighedLabel = new ColorScheme() { Normal = TGAttribute.Make(Color.BrightYellow, Color.Black) }; break; } case 1: { Colors.Base = new ColorScheme() { Normal = TGAttribute.Make(Color.Black, Color.Gray), HotNormal = TGAttribute.Make(Color.White, Color.DarkGray), Focus = TGAttribute.Make(Color.White, Color.Brown), HotFocus = TGAttribute.Make(Color.BrightYellow, Color.Brown) }; Colors.Menu = new ColorScheme() { Normal = TGAttribute.Make(Color.Black, Color.Gray), Focus = TGAttribute.Make(Color.White, Color.Blue), HotNormal = TGAttribute.Make(Color.DarkGray, Color.Gray), HotFocus = TGAttribute.Make(Color.BrighCyan, Color.Blue) }; Colors.Dialog = new ColorScheme() { Normal = TGAttribute.Make(Color.Black, Color.White), Focus = TGAttribute.Make(Color.White, Color.Brown), HotNormal = TGAttribute.Make(Color.Brown, Color.White), HotFocus = TGAttribute.Make(Color.BrightYellow, Color.Brown) }; ArchivedList = new ColorScheme() { Normal = TGAttribute.Make(Color.White, Color.Brown), Focus = TGAttribute.Make(Color.Black, Color.BrightYellow), HotNormal = TGAttribute.Make(Color.White, Color.Brown), HotFocus = TGAttribute.Make(Color.Black, Color.BrightYellow) }; HighlighedLabel = new ColorScheme() { Normal = TGAttribute.Make(Color.BrightBlue, Color.Gray) }; break; } default: { break; } } StaticWindows.RefreshColors(); Application.Refresh(); }
// public override SpanParser CreateSpanParser (DocumentLine line, CloneableStack<Span> spanStack) // { // return new CSharpSpanParser (this, spanStack ?? line.StartSpan.Clone ()); // } public override ChunkParser CreateChunkParser(SpanParser spanParser, ColorScheme style, DocumentLine line) { return(new CSharpChunkParser(this, spanParser, style, line)); }
public void Internal_Tests() { var cs = new ColorScheme(); Assert.Equal("", cs.caller); }
/// <summary> /// Initialize a new instance of the KryptonColorButton class. /// </summary> public KryptonColorButton() { // We generate click events manually, suppress default // production of them by the base Control class SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false); // Set default color button properties _style = ButtonStyle.Standalone; _visibleThemes = true; _visibleStandard = true; _visibleRecent = true; _visibleNoColor = true; _visibleMoreColors = true; _autoRecentColors = true; _schemeThemes = ColorScheme.OfficeThemes; _schemeStandard = ColorScheme.OfficeStandard; _selectedRect = new Rectangle(0, 12, 16, 4); _selectedColor = Color.Red; _emptyBorderColor = Color.DarkGray; _dialogResult = DialogResult.None; _useMnemonic = true; _maxRecentColors = 10; _recentColors = new List<Color>(); // Create the context menu items _kryptonContextMenu = new KryptonContextMenu(); _separatorTheme = new KryptonContextMenuSeparator(); _headingTheme = new KryptonContextMenuHeading("Theme Colors"); _colorsTheme = new KryptonContextMenuColorColumns(ColorScheme.OfficeThemes); _separatorStandard = new KryptonContextMenuSeparator(); _headingStandard = new KryptonContextMenuHeading("Standard Colors"); _colorsStandard = new KryptonContextMenuColorColumns(ColorScheme.OfficeStandard); _separatorRecent = new KryptonContextMenuSeparator(); _headingRecent = new KryptonContextMenuHeading("Recent Colors"); _colorsRecent = new KryptonContextMenuColorColumns(ColorScheme.None); _separatorNoColor = new KryptonContextMenuSeparator(); _itemNoColor = new KryptonContextMenuItem("&No Color", Properties.Resources.ButtonNoColor, new EventHandler(OnClickNoColor)); _itemsNoColor = new KryptonContextMenuItems(); _itemsNoColor.Items.Add(_itemNoColor); _separatorMoreColors = new KryptonContextMenuSeparator(); _itemMoreColors = new KryptonContextMenuItem("&More Colors...", new EventHandler(OnClickMoreColors)); _itemsMoreColors = new KryptonContextMenuItems(); _itemsMoreColors.Items.Add(_itemMoreColors); _kryptonContextMenu.Items.AddRange(new KryptonContextMenuItemBase[] { _separatorTheme, _headingTheme, _colorsTheme, _separatorStandard, _headingStandard, _colorsStandard, _separatorRecent, _headingRecent, _colorsRecent, _separatorNoColor, _itemsNoColor, _separatorMoreColors, _itemsMoreColors}); // Create content storage _buttonValues = CreateButtonValues(NeedPaintDelegate); _buttonValues.TextChanged += new EventHandler(OnButtonTextChanged); _images = new DropDownButtonImages(NeedPaintDelegate); // Image need an extra redirector to check the local images first _paletteDropDownButtonImages = new PaletteRedirectDropDownButton(Redirector, _images); // Create the palette storage _strings = new PaletteColorButtonStrings(); _stateCommon = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); _stateDisabled = new PaletteTriple(_stateCommon, NeedPaintDelegate); _stateNormal = new PaletteTriple(_stateCommon, NeedPaintDelegate); _stateTracking = new PaletteTriple(_stateCommon, NeedPaintDelegate); _statePressed = new PaletteTriple(_stateCommon, NeedPaintDelegate); _stateDefault = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); _stateFocus = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); // Create the override handling classes _overrideFocus = new PaletteTripleOverride(_stateFocus, _stateNormal, PaletteState.FocusOverride); _overrideNormal = new PaletteTripleOverride(_stateDefault, _overrideFocus, PaletteState.NormalDefaultOverride); _overrideTracking = new PaletteTripleOverride(_stateFocus, _stateTracking, PaletteState.FocusOverride); _overridePressed = new PaletteTripleOverride(_stateFocus, _statePressed, PaletteState.FocusOverride); // Create the view color button instance _drawButton = new ViewDrawButton(_stateDisabled, _overrideNormal, _overrideTracking, _overridePressed, new PaletteMetricRedirect(Redirector), this, VisualOrientation.Top, UseMnemonic); // Set default color button state _drawButton.DropDown = true; _drawButton.Splitter = true; _drawButton.TestForFocusCues = true; _drawButton.DropDownPalette = _paletteDropDownButtonImages; // Create a color button controller to handle button style behaviour _buttonController = new ButtonController(_drawButton, NeedPaintDelegate); _buttonController.BecomesFixed = true; // Assign the controller to the view element to treat as a button _drawButton.MouseController = _buttonController; _drawButton.KeyController = _buttonController; _drawButton.SourceController = _buttonController; // Need to know when user clicks the button view or mouse selects it _buttonController.Click += new MouseEventHandler(OnButtonClick); _buttonController.MouseSelect += new MouseEventHandler(OnButtonSelect); // Create the view manager instance ViewManager = new ViewManager(this, _drawButton); }
protected override void OnRealized() { base.OnRealized(); highlightStyle = SyntaxModeService.GetColorStyle(IdeApp.Preferences.ColorScheme); }
public virtual void SetColorScheme(ColorScheme scheme) { throw new NotImplementedException(); }
public void ApplyScheme_Produce1CategoryForEqualValues() { var target = new ColorScheme(); target.ApplyScheme(ColorSchemeType.Desert, 1, 1); Assert.AreEqual(1, target.Categories.Count); }
/// <summary> /// Initializes a new instance of the <see cref="ColorSchemeDefinition"/> class. /// </summary> /// <param name="baseColorScheme">The base color scheme.</param> protected ColorSchemeDefinition(ColorScheme baseColorScheme) { this.baseColorScheme = baseColorScheme; Initialize(); SystemEvents.UserPreferenceChanged += OnUserPreferenceChanged; }
private void Window_Loaded(object sender, RoutedEventArgs e) { // Configure bindings var binding = new Binding("SelectedItems.Count") { Source = ListBoxProjectData, Converter = new IntegerToVisibilityConverter(), ConverterParameter = "=,1,Hidden" }; MainPixelGrid.SetBinding(VisibilityProperty, binding); GuidePanel.SetBinding(VisibilityProperty, binding); binding = new Binding("IsAscentOverlayVisible") { Source = MainPixelGrid, Mode = BindingMode.TwoWay }; ButtonAscentOverlay.SetBinding(ToggleButton.IsCheckedProperty, binding); binding = new Binding("IsDescentOverlayVisible") { Source = MainPixelGrid, Mode = BindingMode.TwoWay }; ButtonDescentOverlay.SetBinding(ToggleButton.IsCheckedProperty, binding); binding = new Binding("IsBearingOverlayVisible") { Source = MainPixelGrid, Mode = BindingMode.TwoWay }; ButtonBearingOverlay.SetBinding(ToggleButton.IsCheckedProperty, binding); binding = new Binding("IsBaselineGuideVisible") { Source = MainPixelGrid, Mode = BindingMode.TwoWay }; ButtonBaselineGuide.SetBinding(ToggleButton.IsCheckedProperty, binding); binding = new Binding("IsUppercaseGuideVisible") { Source = MainPixelGrid, Mode = BindingMode.TwoWay }; ButtonUppercaseGuide.SetBinding(ToggleButton.IsCheckedProperty, binding); binding = new Binding("IsLowercaseGuideVisible") { Source = MainPixelGrid, Mode = BindingMode.TwoWay }; ButtonLowercaseGuide.SetBinding(ToggleButton.IsCheckedProperty, binding); binding = new Binding("IsBearingGuideVisible") { Source = MainPixelGrid, Mode = BindingMode.TwoWay }; ButtonBearingGuide.SetBinding(ToggleButton.IsCheckedProperty, binding); binding = new Binding("ExtendGuideLines") { Source = MainPixelGrid, Mode = BindingMode.TwoWay }; ButtonExtendGuides.SetBinding(ToggleButton.IsCheckedProperty, binding); // Load the character set color scheme ColorScheme scheme; if (Settings.Default.Preferences_Appearance_CharacterSetColors == null || Settings.Default.Preferences_Appearance_CharacterSetColors.Count == 0) { scheme = ColorScheme.BlackOnlyScheme; } else { scheme = new ColorScheme(Settings.Default.Preferences_Appearance_CharacterSetColors); } // Load the character set database _csManager = new CharacterSetManager(scheme); if (!_csManager.Load(Settings.Default.Database_Filename)) { _csManager.Clear(); _csManager.Add(new CharacterSet()); _csManager.Save(Settings.Default.Database_Filename); MessageBox.Show( "The character set database is either missing or corrupted.\nA new empty database has been created.", "Database missing", MessageBoxButton.OK, MessageBoxImage.Exclamation); } // Subscribe to events MainPixelGrid.GridUpdated += MainPixelGrid_GridUpdated; }
private void ResetColorScheme() { colorScheme = ColorScheme.Default; }
// x y0 y1 y2 ... public void DrawLines(List <double> line, int yCount, string[] curveLabels = null) { int stride = yCount + 1; List <Tuple <Point, string, Pen> > labels = new List <Tuple <Point, string, Pen> >(); // Draw the lines one by one for (int j = 0; j < yCount; j++) { StreamGeometry geometry = new StreamGeometry(); StreamGeometryContext ctx = geometry.Open(); Point p = new Point(); Point p0 = new Point(); double alloc = 0; for (int i = 0; i < line.Count; i += stride) { p = new Point(MapX(line[i]), MapY(alloc = line[i + 1 + j])); if (i == 0) { ctx.BeginFigure(p, false, false); p0 = p; } else { if (Diff(p, p0) >= 0.1) // 1 pixel in 960 dpi { ctx.LineTo(p, true, true); p0 = p; } } } ctx.Close(); ColorScheme pal = m_Palettes[j]; geometry.Freeze(); m_context.DrawGeometry(null, curveLabels == null ? pal.memoryPen2 : pal.memoryPen1, geometry); labels.Add(new Tuple <Point, string, Pen>( p, String.Format("{0} {1:N3} mb", curveLabels == null ? pal.label : curveLabels[j], alloc), pal.memoryPen2)); } double y = m_yAxis - 8; foreach (var v in labels.OrderByDescending(v => v.Item1.Y)) { if (v.Item1.Y < y) { y = v.Item1.Y; } m_context.DrawLine(v.Item3, new Point(v.Item1.X + 3, v.Item1.Y), new Point(v.Item1.X + 8, y)); DrawText(v.Item1.X + 10, y - 5, v.Item2, 10); y -= 10; } }
public CSharpChunkParser(CSharpSyntaxMode csharpSyntaxMode, SpanParser spanParser, ColorScheme style, DocumentLine line) : base(csharpSyntaxMode, spanParser, style, line) { lineNumber = line.LineNumber; this.csharpSyntaxMode = csharpSyntaxMode; foreach (var tag in CommentTag.SpecialCommentTags) { tags.Add(tag.Tag); } }
public void ApplyScheme_Produce2CategoriesForNonEqualValues() { var target = new ColorScheme(); target.ApplyScheme(ColorSchemeType.Desert, 0, 1); Assert.AreEqual(2, target.Categories.Count); }
public override void Setup() { // string txt = ".\n...\n.....\nHELLO\n.....\n...\n."; // string txt = "┌──┴──┐\n┤HELLO├\n└──┬──┘"; string txt = "HELLO WORLD"; var color1 = new ColorScheme { Normal = Application.Driver.MakeAttribute(Color.Black, Color.Gray) }; var color2 = new ColorScheme { Normal = Application.Driver.MakeAttribute(Color.Black, Color.DarkGray) }; var txts = new List <Label> (); // single line var mtxts = new List <Label> (); // multi line // Horizontal Single-Line var labelHL = new Label("Left") { X = 1, Y = 1, Width = 9, Height = 1, TextAlignment = TextAlignment.Right, ColorScheme = Colors.ColorSchemes ["Dialog"] }; var labelHC = new Label("Centered") { X = 1, Y = 2, Width = 9, Height = 1, TextAlignment = TextAlignment.Right, ColorScheme = Colors.ColorSchemes ["Dialog"] }; var labelHR = new Label("Right") { X = 1, Y = 3, Width = 9, Height = 1, TextAlignment = TextAlignment.Right, ColorScheme = Colors.ColorSchemes ["Dialog"] }; var labelHJ = new Label("Justified") { X = 1, Y = 4, Width = 9, Height = 1, TextAlignment = TextAlignment.Right, ColorScheme = Colors.ColorSchemes ["Dialog"] }; var txtLabelHL = new Label(txt) { X = Pos.Right(labelHL) + 1, Y = Pos.Y(labelHL), Width = Dim.Fill(1) - 9, Height = 1, ColorScheme = color1, TextAlignment = TextAlignment.Left }; var txtLabelHC = new Label(txt) { X = Pos.Right(labelHC) + 1, Y = Pos.Y(labelHC), Width = Dim.Fill(1) - 9, Height = 1, ColorScheme = color2, TextAlignment = TextAlignment.Centered }; var txtLabelHR = new Label(txt) { X = Pos.Right(labelHR) + 1, Y = Pos.Y(labelHR), Width = Dim.Fill(1) - 9, Height = 1, ColorScheme = color1, TextAlignment = TextAlignment.Right }; var txtLabelHJ = new Label(txt) { X = Pos.Right(labelHJ) + 1, Y = Pos.Y(labelHJ), Width = Dim.Fill(1) - 9, Height = 1, ColorScheme = color2, TextAlignment = TextAlignment.Justified }; txts.Add(txtLabelHL); txts.Add(txtLabelHC); txts.Add(txtLabelHR); txts.Add(txtLabelHJ); Win.Add(labelHL); Win.Add(txtLabelHL); Win.Add(labelHC); Win.Add(txtLabelHC); Win.Add(labelHR); Win.Add(txtLabelHR); Win.Add(labelHJ); Win.Add(txtLabelHJ); // Vertical Single-Line var labelVT = new Label("Top") { X = Pos.AnchorEnd(8), Y = 1, Width = 2, Height = 9, ColorScheme = color1, TextDirection = TextDirection.TopBottom_LeftRight, VerticalTextAlignment = VerticalTextAlignment.Bottom }; var labelVM = new Label("Middle") { X = Pos.AnchorEnd(6), Y = 1, Width = 2, Height = 9, ColorScheme = color1, TextDirection = TextDirection.TopBottom_LeftRight, VerticalTextAlignment = VerticalTextAlignment.Bottom }; var labelVB = new Label("Bottom") { X = Pos.AnchorEnd(4), Y = 1, Width = 2, Height = 9, ColorScheme = color1, TextDirection = TextDirection.TopBottom_LeftRight, VerticalTextAlignment = VerticalTextAlignment.Bottom }; var labelVJ = new Label("Justified") { X = Pos.AnchorEnd(2), Y = 1, Width = 1, Height = 9, ColorScheme = color1, TextDirection = TextDirection.TopBottom_LeftRight, VerticalTextAlignment = VerticalTextAlignment.Bottom }; var txtLabelVT = new Label(txt) { X = Pos.X(labelVT), Y = Pos.Bottom(labelVT) + 1, Width = 1, Height = Dim.Fill(1), ColorScheme = color1, TextDirection = TextDirection.TopBottom_LeftRight, VerticalTextAlignment = VerticalTextAlignment.Top }; var txtLabelVM = new Label(txt) { X = Pos.X(labelVM), Y = Pos.Bottom(labelVM) + 1, Width = 1, Height = Dim.Fill(1), ColorScheme = color2, TextDirection = TextDirection.TopBottom_LeftRight, VerticalTextAlignment = VerticalTextAlignment.Middle }; var txtLabelVB = new Label(txt) { X = Pos.X(labelVB), Y = Pos.Bottom(labelVB) + 1, Width = 1, Height = Dim.Fill(1), ColorScheme = color1, TextDirection = TextDirection.TopBottom_LeftRight, VerticalTextAlignment = VerticalTextAlignment.Bottom }; var txtLabelVJ = new Label(txt) { X = Pos.X(labelVJ), Y = Pos.Bottom(labelVJ) + 1, Width = 1, Height = Dim.Fill(1), ColorScheme = color2, TextDirection = TextDirection.TopBottom_LeftRight, VerticalTextAlignment = VerticalTextAlignment.Justified }; txts.Add(txtLabelVT); txts.Add(txtLabelVM); txts.Add(txtLabelVB); txts.Add(txtLabelVJ); Win.Add(labelVT); Win.Add(txtLabelVT); Win.Add(labelVM); Win.Add(txtLabelVM); Win.Add(labelVB); Win.Add(txtLabelVB); Win.Add(labelVJ); Win.Add(txtLabelVJ); // Multi-Line var container = new View() { X = 0, Y = Pos.Bottom(txtLabelHJ), Width = Dim.Fill(31), Height = Dim.Fill(7), ColorScheme = color2 }; var txtLabelTL = new Label(txt) { X = 1 /* */, Y = 1, Width = Dim.Percent(100f / 3f), Height = Dim.Percent(100f / 3f), TextAlignment = TextAlignment.Left, VerticalTextAlignment = VerticalTextAlignment.Top, ColorScheme = color1 }; var txtLabelTC = new Label(txt) { X = Pos.Right(txtLabelTL) + 2, Y = 1, Width = Dim.Percent(100f / 3f), Height = Dim.Percent(100f / 3f), TextAlignment = TextAlignment.Centered, VerticalTextAlignment = VerticalTextAlignment.Top, ColorScheme = color1 }; var txtLabelTR = new Label(txt) { X = Pos.Right(txtLabelTC) + 2, Y = 1, Width = Dim.Percent(100f, true), Height = Dim.Percent(100f / 3f), TextAlignment = TextAlignment.Right, VerticalTextAlignment = VerticalTextAlignment.Top, ColorScheme = color1 }; var txtLabelML = new Label(txt) { X = Pos.X(txtLabelTL) /* */, Y = Pos.Bottom(txtLabelTL) + 1, Width = Dim.Width(txtLabelTL), Height = Dim.Percent(100f / 3f), TextAlignment = TextAlignment.Left, VerticalTextAlignment = VerticalTextAlignment.Middle, ColorScheme = color1 }; var txtLabelMC = new Label(txt) { X = Pos.X(txtLabelTC) /* */, Y = Pos.Bottom(txtLabelTC) + 1, Width = Dim.Width(txtLabelTC), Height = Dim.Percent(100f / 3f), TextAlignment = TextAlignment.Centered, VerticalTextAlignment = VerticalTextAlignment.Middle, ColorScheme = color1 }; var txtLabelMR = new Label(txt) { X = Pos.X(txtLabelTR) /* */, Y = Pos.Bottom(txtLabelTR) + 1, Width = Dim.Percent(100f, true), Height = Dim.Percent(100f / 3f), TextAlignment = TextAlignment.Right, VerticalTextAlignment = VerticalTextAlignment.Middle, ColorScheme = color1 }; var txtLabelBL = new Label(txt) { X = Pos.X(txtLabelML) /* */, Y = Pos.Bottom(txtLabelML) + 1, Width = Dim.Width(txtLabelML), Height = Dim.Percent(100f, true), TextAlignment = TextAlignment.Left, VerticalTextAlignment = VerticalTextAlignment.Bottom, ColorScheme = color1 }; var txtLabelBC = new Label(txt) { X = Pos.X(txtLabelMC) /* */, Y = Pos.Bottom(txtLabelMC) + 1, Width = Dim.Width(txtLabelMC), Height = Dim.Percent(100f, true), TextAlignment = TextAlignment.Centered, VerticalTextAlignment = VerticalTextAlignment.Bottom, ColorScheme = color1 }; var txtLabelBR = new Label(txt) { X = Pos.X(txtLabelMR) /* */, Y = Pos.Bottom(txtLabelMR) + 1, Width = Dim.Percent(100f, true), Height = Dim.Percent(100f, true), TextAlignment = TextAlignment.Right, VerticalTextAlignment = VerticalTextAlignment.Bottom, ColorScheme = color1 }; mtxts.Add(txtLabelTL); mtxts.Add(txtLabelTC); mtxts.Add(txtLabelTR); mtxts.Add(txtLabelML); mtxts.Add(txtLabelMC); mtxts.Add(txtLabelMR); mtxts.Add(txtLabelBL); mtxts.Add(txtLabelBC); mtxts.Add(txtLabelBR); // Save Alignments in Data foreach (var t in mtxts) { t.Data = new { h = t.TextAlignment, v = t.VerticalTextAlignment }; } container.Add(txtLabelTL); container.Add(txtLabelTC); container.Add(txtLabelTR); container.Add(txtLabelML); container.Add(txtLabelMC); container.Add(txtLabelMR); container.Add(txtLabelBL); container.Add(txtLabelBC); container.Add(txtLabelBR); Win.Add(container); // Edit Text var editText = new TextView() { X = 1, Y = Pos.Bottom(container) + 1, Width = Dim.Fill(10), Height = Dim.Fill(1), ColorScheme = color2, Text = txt }; editText.MouseClick += (m) => { foreach (var v in txts) { v.Text = editText.Text; } foreach (var v in mtxts) { v.Text = editText.Text; } }; Win.KeyUp += (m) => { foreach (var v in txts) { v.Text = editText.Text; } foreach (var v in mtxts) { v.Text = editText.Text; } }; editText.SetFocus(); Win.Add(editText); // JUSTIFY CHECKBOX var justifyCheckbox = new CheckBox("Justify") { X = Pos.Right(container) + 1, Y = Pos.Y(container) + 1, Width = Dim.Fill(10), Height = 1 }; justifyCheckbox.Toggled += (prevtoggled) => { if (prevtoggled) { foreach (var t in mtxts) { t.TextAlignment = (TextAlignment)((dynamic)t.Data).h; t.VerticalTextAlignment = (VerticalTextAlignment)((dynamic)t.Data).v; } } else { foreach (var t in mtxts) { if (TextFormatter.IsVerticalDirection(t.TextDirection)) { t.VerticalTextAlignment = VerticalTextAlignment.Justified; t.TextAlignment = ((dynamic)t.Data).h; } else { t.TextAlignment = TextAlignment.Justified; t.VerticalTextAlignment = ((dynamic)t.Data).v; } } } }; Win.Add(justifyCheckbox); // Direction Options var directionsEnum = Enum.GetValues(typeof(Terminal.Gui.TextDirection)).Cast <Terminal.Gui.TextDirection> ().ToList(); var directionOptions = new RadioGroup(directionsEnum.Select(e => NStack.ustring.Make(e.ToString())).ToArray()) { X = Pos.Right(container) + 1, Y = Pos.Bottom(justifyCheckbox) + 1, Width = Dim.Fill(10), Height = Dim.Fill(1), HotKeySpecifier = '\xffff' }; directionOptions.SelectedItemChanged += (ev) => { foreach (var v in mtxts) { v.TextDirection = (TextDirection)ev.SelectedItem; } }; Win.Add(directionOptions); }
// ------------------------------------------------------------------------------------------------------ public void setColorScheme(ColorScheme cs) { switch (cs) { case ColorScheme.DARK_GREEN: { Color[] cols = { Color.FromArgb(0,255,0), Color.FromArgb(0,255,0), Color.FromArgb(0,255,0), Color.FromArgb(0,255,0), Color.FromArgb(0,255,0) , Color.FromArgb(0,255,0), Color.FromArgb(0,255,0) }; for (int j = 0; j < display.DataSources.Count; j++) { display.DataSources[j].GraphColor = cols[j % 7]; } display.BackgroundColorTop = Color.FromArgb(0, 64, 0); display.BackgroundColorBot = Color.FromArgb(0, 64, 0); display.SolidGridColor = Color.FromArgb(0, 128, 0); display.DashedGridColor = Color.FromArgb(0, 128, 0); } break; case ColorScheme.WHITE: { Color[] cols = { Color.DarkRed, Color.DarkSlateGray, Color.DarkCyan, Color.DarkGreen, Color.DarkBlue , Color.DarkMagenta, Color.DeepPink }; for (int j = 0; j < display.DataSources.Count; j++) { display.DataSources[j].GraphColor = cols[j % 7]; } display.BackgroundColorTop = Color.White; display.BackgroundColorBot = Color.White; display.SolidGridColor = Color.LightGray; display.DashedGridColor = Color.LightGray; } break; case ColorScheme.BLUE: { Color[] cols = { Color.Red, Color.Orange, Color.Yellow, Color.LightGreen, Color.Blue , Color.DarkSalmon, Color.LightPink }; for (int j = 0; j < display.DataSources.Count; j++) { display.DataSources[j].GraphColor = cols[j % 7]; } display.BackgroundColorTop = Color.Navy; display.BackgroundColorBot = Color.FromArgb(0, 0, 64); display.SolidGridColor = Color.Blue; display.DashedGridColor = Color.Blue; } break; case ColorScheme.GRAY: { Color[] cols = { Color.DarkRed, Color.DarkSlateGray, Color.DarkCyan, Color.DarkGreen, Color.DarkBlue , Color.DarkMagenta, Color.DeepPink }; for (int j = 0; j < display.DataSources.Count; j++) { display.DataSources[j].GraphColor = cols[j % 7]; } display.BackgroundColorTop = Color.White; display.BackgroundColorBot = Color.LightGray; display.SolidGridColor = Color.LightGray; display.DashedGridColor = Color.LightGray; } break; case ColorScheme.RED: { Color[] cols = { Color.DarkCyan, Color.Yellow, Color.DarkCyan, Color.DarkGreen, Color.DarkBlue , Color.DarkMagenta, Color.DeepPink }; for (int j = 0; j < display.DataSources.Count; j++) { display.DataSources[j].GraphColor = cols[j % 7]; } display.BackgroundColorTop = Color.DarkRed; display.BackgroundColorBot = Color.Black; display.SolidGridColor = Color.Red; display.DashedGridColor = Color.Red; } break; case ColorScheme.LIGHT_BLUE: { Color[] cols = { Color.DarkRed, Color.DarkSlateGray, Color.DarkCyan, Color.DarkGreen, Color.DarkBlue , Color.DarkMagenta, Color.DeepPink }; for (int j = 0; j < display.DataSources.Count; j++) { display.DataSources[j].GraphColor = cols[j % 7]; } display.BackgroundColorTop = Color.White; display.BackgroundColorBot = Color.FromArgb(183, 183, 255); display.SolidGridColor = Color.Blue; display.DashedGridColor = Color.Blue; } break; case ColorScheme.BLACK: { Color[] cols = { Color.FromArgb(255,0,0), Color.FromArgb(0,255,0), Color.FromArgb(255,255,0), Color.FromArgb(64,64,255), Color.FromArgb(0,255,255) , Color.FromArgb(255,0,255), Color.FromArgb(255,128,0) }; for (int j = 0; j < display.DataSources.Count; j++) { display.DataSources[j].GraphColor = cols[j % 7]; } display.BackgroundColorTop = Color.Black; display.BackgroundColorBot = Color.Black; display.SolidGridColor = Color.DarkGray; display.DashedGridColor = Color.DarkGray; } break; case ColorScheme.SACHA: { Color[] cols = { Color.Black, Color.Red, Color.LightGreen, Color.Yellow, Color.Magenta }; for (int j = 0; j < display.DataSources.Count; j++) { display.DataSources[j].GraphColor = cols[j % cols.Length]; } display.GraphBoxColor = Color.Black; display.BackgroundColorTop = Color.White; display.BackgroundColorBot = Color.White; display.SolidGridColor = Color.DarkGray; display.DashedGridColor = Color.DarkGray; } break; } }
/// <summary> /// 显示顶点 /// 顶点能够被隐藏 /// </summary> /// <param name="color">顶点颜色</param> /// <param name="vertexSize">顶点大小(像素)</param> public void ShowVertices(System.Drawing.Color color, int vertexSize) { if (Program.frmMain.m_Layers[m_LayerHandle].LayerType != Interfaces.eLayerType.PointShapefile) { Program.frmMain.MapMain.LockWindow(MapWinGIS.tkLockMode.lmLock); try { Program.frmMain.MapMain.set_ShapePointSize(m_LayerHandle, m_ShapeIndex, vertexSize); Program.frmMain.MapMain.set_ShapePointColor(m_LayerHandle, m_ShapeIndex, ColorScheme.ColorToUInt(color)); Program.frmMain.MapMain.set_ShapeDrawPoint(m_LayerHandle, m_ShapeIndex, true); } finally { Program.frmMain.MapMain.LockWindow(MapWinGIS.tkLockMode.lmUnlock); } } }
public Car() { ColorScheme = new ColorScheme("White", new WhiteColor(), new WhiteColor()); }
private static bool ParseCommandGroups <TOptions>(string[] args, ref TOptions options, TypeArgumentInfo arguments, ParserOptions parserOptions) where TOptions : new() { if (arguments.ActionArgument == null) { throw new ArgumentException("Cannot have groups unless Command argument has been specified"); } if (args.Length == 0) { throw new ArgumentException("Required parameters have not been specified"); } // parse based on the command passed in (the first arg). if (!arguments.ArgumentGroups.ContainsKey(args[0])) { throw new ArgumentException($"Unknown command '{args[0]}'"); } // short circuit the request for help! if (args.Length == 2 && (args[1] == "/?" || args[1] == "-?")) { HelpGenerator.DisplayHelpForCommmand(args[0], arguments.ArgumentGroups[args[0]], ColorScheme.Get()); // if we wanted the help, then we successfully parsed it! return(true); } options = InternalParse <TOptions>(args, 1, arguments.ArgumentGroups[args[0]], parserOptions); arguments.ActionArgument.SetValue(options, PropertyHelpers.GetValueAsType(args[0], arguments.ActionArgument)); return(true); }
/// <summary> /// Returns the color scheme used by control. Color scheme for Office2007 style will be retrived from the current renderer instead of /// local color scheme referenced by ColorScheme property. /// </summary> /// <returns>An instance of ColorScheme object.</returns> protected virtual ColorScheme GetColorScheme() { BaseRenderer r = GetRenderer(); if (r is Office2007Renderer) return ((Office2007Renderer)r).ColorTable.LegacyColors; if (m_ColorScheme == null) m_ColorScheme = new ColorScheme(eDotNetBarStyle.Office2007); return m_ColorScheme; }
internal void SetUp(Toplevel top) { var menu = new MenuBar(new MenuBarItem [] { new MenuBarItem("_File (F9)", new MenuItem [] { new MenuItem("_New...", "", () => New()), new MenuItem("_Find...", "", () => Find()), new MenuItem("_Run...", "", () => Run()), new MenuItem("_Refresh...", "", () => Publish()), new MenuItem("_Quit", "", () => Quit()), }), new MenuBarItem("_Diagnostics", new MenuItem [] { mi_default = new MenuItem() { Title = "Query Catalogue", Action = () => Query(nameof(CataloguePatcher)) }, mi_default = new MenuItem() { Title = "Query Data Export", Action = () => Query(nameof(DataExportPatcher)) }, }), new MenuBarItem("_Color Scheme", new MenuItem [] { mi_default = new MenuItem() { Title = "Default", Checked = true, CheckType = MenuItemCheckStyle.Radio, Action = () => SetColorScheme(mi_default) }, mi_green = new MenuItem() { Title = "Green", Checked = false, CheckType = MenuItemCheckStyle.Radio, Action = () => SetColorScheme(mi_green) }, }), }); top.Add(menu); _win = new Window() { X = 0, Y = 1, // menu Width = Dim.Fill(1), Height = Dim.Fill(1) // status bar }; _defaultColorScheme = ColorScheme = _win.ColorScheme; _greenColorScheme = new ColorScheme() { Disabled = Application.Driver.MakeAttribute(Color.Black, Color.Black), Focus = Application.Driver.MakeAttribute(Color.Black, Color.Green), HotFocus = Application.Driver.MakeAttribute(Color.Black, Color.Green), HotNormal = Application.Driver.MakeAttribute(Color.BrightYellow, Color.Black), Normal = Application.Driver.MakeAttribute(Color.Green, Color.Black), }; _treeView = new TreeView <object> () { X = 0, Y = 0, Width = Dim.Fill(), Height = Dim.Fill() }; // Determines how to compute children of any given branch _treeView.TreeBuilder = new DelegateTreeBuilder <object>(ChildGetter); _treeView.AddObjects( new string[] { Catalogues, Projects, Loads, CohortConfigs, BuiltCohorts, Other }); _win.Add(_treeView); top.Add(_win); _treeView.ObjectActivated += _treeView_ObjectActivated; _treeView.KeyPress += treeView_KeyPress; _treeView.SelectionChanged += _treeView_SelectionChanged; _treeView.AspectGetter = AspectGetter; var statusBar = new StatusBar(new StatusItem [] { new StatusItem(Key.Q | Key.CtrlMask, "~^Q~ Quit", () => Quit()), new StatusItem(Key.R | Key.CtrlMask, "~^R~ Run", () => Run()), new StatusItem(Key.F | Key.CtrlMask, "~^F~ Find", () => Find()), new StatusItem(Key.N | Key.CtrlMask, "~^N~ New", () => New()), new StatusItem(Key.F5, "~F5~ Refresh", () => Publish()), }); top.Add(statusBar); string scheme = UserSettings.ConsoleColorScheme; if (scheme == "green") { SetColorScheme(mi_green); } }
/// <summary> /// Initialise a new instance of the KryptonRibbonGroupColorButton class. /// </summary> public KryptonRibbonGroupColorButton() { // Default fields _enabled = true; _visible = true; _checked = false; _visibleThemes = true; _visibleStandard = true; _visibleRecent = true; _visibleNoColor = true; _visibleMoreColors = true; _autoRecentColors = true; _shortcutKeys = Keys.None; _imageSmall = _defaultButtonImageSmall; _imageLarge = _defaultButtonImageLarge; _textLine1 = "Color"; _textLine2 = string.Empty; _keyTip = "B"; _selectedColor = Color.Red; _emptyBorderColor = Color.DarkGray; _selectedRectSmall = new Rectangle(0, 12, 16, 4); _selectedRectLarge = new Rectangle(2, 26, 28, 4); _schemeThemes = ColorScheme.OfficeThemes; _schemeStandard = ColorScheme.OfficeStandard; _buttonType = GroupButtonType.Split; _itemSizeMax = GroupItemSize.Large; _itemSizeMin = GroupItemSize.Small; _itemSizeCurrent = GroupItemSize.Large; _toolTipImageTransparentColor = Color.Empty; _toolTipTitle = string.Empty; _toolTipBody = string.Empty; _toolTipStyle = LabelStyle.SuperTip; _maxRecentColors = 10; _recentColors = new List<Color>(); // Create the context menu items _kryptonContextMenu = new KryptonContextMenu(); _separatorTheme = new KryptonContextMenuSeparator(); _headingTheme = new KryptonContextMenuHeading("Theme Colors"); _colorsTheme = new KryptonContextMenuColorColumns(ColorScheme.OfficeThemes); _separatorStandard = new KryptonContextMenuSeparator(); _headingStandard = new KryptonContextMenuHeading("Standard Colors"); _colorsStandard = new KryptonContextMenuColorColumns(ColorScheme.OfficeStandard); _separatorRecent = new KryptonContextMenuSeparator(); _headingRecent = new KryptonContextMenuHeading("Recent Colors"); _colorsRecent = new KryptonContextMenuColorColumns(ColorScheme.None); _separatorNoColor = new KryptonContextMenuSeparator(); _itemNoColor = new KryptonContextMenuItem("&No Color", Properties.Resources.ButtonNoColor, new EventHandler(OnClickNoColor)); _itemsNoColor = new KryptonContextMenuItems(); _itemsNoColor.Items.Add(_itemNoColor); _separatorMoreColors = new KryptonContextMenuSeparator(); _itemMoreColors = new KryptonContextMenuItem("&More Colors...", new EventHandler(OnClickMoreColors)); _itemsMoreColors = new KryptonContextMenuItems(); _itemsMoreColors.Items.Add(_itemMoreColors); _kryptonContextMenu.Items.AddRange(new KryptonContextMenuItemBase[] { _separatorTheme, _headingTheme, _colorsTheme, _separatorStandard, _headingStandard, _colorsStandard, _separatorRecent, _headingRecent, _colorsRecent, _separatorNoColor, _itemsNoColor, _separatorMoreColors, _itemsMoreColors}); }
public void SetColorScheme(int index) { ColorScheme C = ColorSchemes[index]; SetColorScheme(C); }
private static int PickSaturation(int hue, Luminosity luminosity, ColorScheme scheme) { if (luminosity == Luminosity.Random) { return RandomWithin(0, 100); } if (scheme == ColorScheme.Monochrome) { return 0; } var saturationRange = GetColorInfo(hue).SaturationRange; var sMin = saturationRange.Lower; var sMax = saturationRange.Upper; switch (luminosity) { case Luminosity.Bright: sMin = 55; break; case Luminosity.Dark: sMin = sMax - 10; break; case Luminosity.Light: sMax = 55; break; } return RandomWithin(sMin, sMax); }
public void SetColorScheme(ColorScheme scheme) { BorderColor = scheme.BorderColor; ButtonColor = scheme.ButtonColor; }
private static void DefineColor(ColorScheme scheme, int[] hueRange, int[,] lowerBounds) { int[][] jagged = new int[lowerBounds.GetLength(0)][]; for (int i = 0; i < lowerBounds.GetLength(0); i++) { jagged[i] = new int[lowerBounds.GetLength(1)]; for (int j = 0; j < lowerBounds.GetLength(1); j++) { jagged[i][j] = lowerBounds[i, j]; } } var sMin = jagged[0][0]; var sMax = jagged[jagged.Length - 1][0]; var bMin = jagged[jagged.Length - 1][1]; var bMax = jagged[0][1]; ColorDictionary[scheme] = new DefinedColor() { HueRange = Range.ToRange(hueRange), LowerBounds = jagged.Select(j => new Point(j[0], j[1])).ToArray(), SaturationRange = new Range(sMin, sMax), BrightnessRange = new Range(bMin, bMax) }; }
private InternalComboColors GetComboColors() { InternalComboColors c = new InternalComboColors(); bool bFocus = (m_MouseOverThumb || this.Focused || this.DroppedDownInternal && this.DropDownStyle != ComboBoxStyle.Simple); if (bFocus && !this.Enabled) bFocus = false; if (BarFunctions.IsOffice2007Style(this.Style) && GlobalManager.Renderer is Office2007Renderer) { Office2007ComboBoxColorTable colorTable = ((Office2007Renderer)GlobalManager.Renderer).ColorTable.ComboBox; Office2007ComboBoxStateColorTable stateColors = (IsToolbarStyle && !m_MouseOver ? colorTable.Default : colorTable.DefaultStandalone); if (bFocus) { if (this.DroppedDown) stateColors = colorTable.DroppedDown; else if (bFocus) stateColors = colorTable.MouseOver; } c.Background = stateColors.Background; c.Border = stateColors.Border; c.ThumbBackground = stateColors.ExpandBackground; c.ThumbText = stateColors.ExpandText; c.ThumbBorderOuter = stateColors.ExpandBorderOuter; c.ThumbBorderInner = stateColors.ExpandBorderInner; } else { ColorScheme cs = new ColorScheme(this.Style); if (bFocus) { if (DroppedDownInternal) { c.ThumbBackground = new LinearGradientColorTable(cs.ItemPressedBackground, cs.ItemPressedBackground2, cs.ItemPressedBackgroundGradientAngle); c.Border = cs.ItemPressedBorder; c.ThumbText = cs.ItemPressedText; } else { if (m_MouseOverThumb) c.ThumbBackground = new LinearGradientColorTable(cs.ItemHotBackground, cs.ItemHotBackground2, cs.ItemHotBackgroundGradientAngle); else c.ThumbBackground = new LinearGradientColorTable(cs.BarBackground, cs.BarBackground2, cs.BarBackgroundGradientAngle); c.Border = cs.ItemHotBorder; c.ThumbText = cs.ItemHotText; } } else { c.ThumbBackground = new LinearGradientColorTable(cs.BarBackground, cs.BarBackground2, cs.BarBackgroundGradientAngle); if (m_MouseOver || !IsToolbarStyle) { c.Border = cs.ItemHotBorder; } } } if (_FocusHighlightEnabled && this.Enabled && this.Focused) c.Background = _FocusHighlightColor; else if (!this.Enabled) { c.Background = _DisabledBackColor.IsEmpty ? SystemColors.Control : _DisabledBackColor; c.ThumbText = _DisabledForeColor.IsEmpty ? SystemColors.ControlDark : _DisabledForeColor; ; } return c; }
/// <summary> /// Arguments used when a ColorSchemeChange event occurs. /// </summary> /// <param name="eColorSchema">The color schema which is used for the panel.</param> public ColorSchemeChangeEventArgs(ColorScheme eColorSchema) { ColorSchema = eColorSchema; }
/// <summary> /// Initializes ColorScheme object with the black color scheme. /// </summary> /// <param name="c">ColorScheme object to initialize.</param> public static void InitializeBlackLegacyColors(ColorScheme c, ColorFactory factory) { c.BarBackground = factory.GetColor(0xF2F2F9); c.BarBackground2 = factory.GetColor(0x9997B5); c.BarStripeColor = factory.GetColor(0x6E6D8F); c.BarCaptionBackground = factory.GetColor(0x7A7999); c.BarCaptionBackground2 = factory.GetColor(0x626179); c.BarCaptionInactiveBackground = factory.GetColor(0xF6F7F8); c.BarCaptionInactiveBackground2 = factory.GetColor(0xDADFE6); c.BarCaptionInactiveText = factory.GetColor(0x333333); c.BarCaptionText = factory.GetColor(0xFFFFFF); c.BarFloatingBorder = factory.GetColor(0x7A7999); c.BarPopupBackground = factory.GetColor(0xFDFAFF); c.BarPopupBorder = factory.GetColor(0x7A7999); c.ItemBackground = Color.Empty; c.ItemBackground2 = Color.Empty; c.ItemCheckedBackground = factory.GetColor(0xFFCF92); c.ItemCheckedBackground2 = factory.GetColor(0xFFAF49); c.ItemCheckedBorder = factory.GetColor(0xFFAB3F); c.ItemCheckedText = factory.GetColor(0x000000); c.ItemDisabledBackground = Color.Empty; c.ItemDisabledText = factory.GetColor(0x8D8D8D); c.ItemExpandedShadow = Color.Empty; c.ItemExpandedBackground = factory.GetColor(0xE8E9F1); c.ItemExpandedBackground2 = factory.GetColor(0xBAB9CD); c.ItemExpandedText = factory.GetColor(0x000000); c.ItemHotBackground = factory.GetColor(0xFFF5CC); c.ItemHotBackground2 = factory.GetColor(0xFFDF84); c.ItemHotBorder = factory.GetColor(0xFFBD69); c.ItemHotText = factory.GetColor(0x000000); c.ItemPressedBackground = factory.GetColor(0xFC973D); c.ItemPressedBackground2 = factory.GetColor(0xFFB85E); c.ItemPressedBorder = factory.GetColor(0xFB8C3C); c.ItemPressedText = factory.GetColor(0x000000); c.ItemSeparator = Color.FromArgb(225, factory.GetColor(0x6E6D8F)); c.ItemSeparatorShade = Color.FromArgb(180, factory.GetColor(0xFFFFFF)); c.ItemText = factory.GetColor(0x000000); // SystemColors.ControlText; c.MenuBackground = factory.GetColor(0xFDFAFF); c.MenuBackground2 = Color.Empty; // Color.White; c.MenuBarBackground = factory.GetColor(0xE5E5EE); c.MenuBorder = factory.GetColor(0x7C7C94); c.ItemExpandedBorder = c.MenuBorder; c.MenuSide = factory.GetColor(0xEFEFEF); c.MenuSide2 = Color.Empty; // factory.GetColor(0xDDE0E8); c.MenuUnusedBackground = c.MenuBackground; c.MenuUnusedSide = factory.GetColor(0xE9E9E9); c.MenuUnusedSide2 = Color.Empty;// System.Windows.Forms.ControlPaint.Light(c.MenuSide2); c.ItemDesignTimeBorder = Color.Black; c.BarDockedBorder = factory.GetColor(0x6F7074); c.DockSiteBackColor = factory.GetColor(0xD7D7E5); c.DockSiteBackColor2 = factory.GetColor(0xF3F3F7); c.CustomizeBackground = factory.GetColor(0xB3B2C8); c.CustomizeBackground2 = factory.GetColor(0x767492); c.CustomizeText = factory.GetColor(0x000000); c.PanelBackground = factory.GetColor(0xF0F1F2); c.PanelBackground2 = factory.GetColor(0xBDC2C9); c.PanelText = Color.Black; c.PanelBorder = factory.GetColor(0x6F7074); c.ExplorerBarBackground = factory.GetColor(0xF3F3F7); c.ExplorerBarBackground2 = factory.GetColor(0xD7D7E5); c.SplitterBackground = c.PanelBackground; c.SplitterBackground2 = c.PanelBackground2; c.SplitterText = c.PanelText; c.SplitterBorder = c.PanelBorder; }
private void RunAndShow(OutputWindow output) { output.Show(); output.Activate(); Application.DoEvents(); //huh? var run = options.Run(); scheme = run ? ColorScheme.Green : ColorScheme.Red; scheme.ApplyToMain(this); output.ShowText(run); semaphore.ShowResult(run); this.RunSound(run); }
public ListViewModel(ColorScheme scheme) { colorScheme = new ColorScheme(scheme); schemeName = scheme.SchemeName; viewName = scheme.ViewName; }
/// <summary> /// Creates a new <see cref="Residue" /> object. /// </summary> /// <param name="molecule">The molecule this residue belongs to.</param> /// <param name="atom">An atom in the residue. This is needed to obtain residue properties /// since there is no corresponding PDB file record.</param> internal Residue(Molecule molecule, Atom atom) { this.molecule = molecule; this.molecule.ShowCartoonChanged += this.MoleculeShowCartoonChanged; this.residueName = atom.ResidueName; this.chainIdentifier = atom.ChainIdentifier; this.residueSequenceNumber = atom.ResidueSequenceNumber; this.atoms = new List<Atom>(); this.atoms.Add(atom); this.residueIdentifier = Residue.GetResidueIdentifier(this.residueName); this.residueColor = Residue.GetResidueColor(this.residueName); this.structureColor = this.residueIdentifier != "O" ? Colors.LightGray : Colors.Red; this.colorScheme = ColorScheme.Structure; this.residueStripItems = new List<ResidueStripItem>(); foreach (char character in this.residueIdentifier) { ResidueStripItem residueStripItem = new ResidueStripItem(character.ToString()); residueStripItem.Residue = this; this.residueStripItems.Add(residueStripItem); } this.model = new Model3DGroup(); this.UpdateColorView(); }
/// <summary> /// Resets the color scheme to the original one. /// </summary> private void Reset() => this.currentColorScheme = new VabScheme();
/// <summary> /// Arguments used when a ColorSchemeChange event occurs. /// </summary> /// <param name="eColorSchema">The color schema which is used for the panel.</param> public ColorSchemeChangeEventArgs(ColorScheme eColorSchema) { this.m_eColorSchema = eColorSchema; }
/// <summary> /// Sets the SweetAlertTheme to be used with a given color scheme preference. /// This utilizes the <code>prefers-color-scheme</code> CSS media feature, and behaves similarly. /// Browsers that do not support the feature will fall back to the theme set in /// <code>SweetAlertServiceOptions.Theme</code>. /// </summary> /// <param name="scheme">The user color scheme preference to apply this theme to</param> /// <param name="theme">The theme to use when the user has the provided color scheme preference</param> public void SetThemeForColorSchemePreference(ColorScheme scheme, SweetAlertTheme theme) { ColorSchemeThemes.Add(scheme, theme); }