public BackButton() : base(Vector2.Zero) { if (Screen.IsFullHeadless) { return; } Button controls = EditorTheme.CreateButton(new Vector2(1760, 910), new Point(150, 70), "Hide Controls", Transform, EditorTheme.ColorSet.Blue); Button back = EditorTheme.CreateButton(new Vector2(1760, 990), new Point(150, 70), "Back to Menu", Transform, EditorTheme.ColorSet.Blue); Button disableMultithreading = EditorTheme.CreateButton(new Vector2(1450, 990), new Point(300, 70), "Disable Multi-Threading", Transform, EditorTheme.ColorSet.Blue); back.Clicked += (sender, args) => SceneManager.SetCurrentScene("_DEMOS\\menu"); disableMultithreading.Clicked += (sender, args) => { multithreadingToggle = !multithreadingToggle; disableMultithreading.TextString = multithreadingToggle ? "Disable Multi-threading" : "Enable Multi-threading"; }; controls.Clicked += (sender, args) => { showControls = !showControls; back.SetActive(showControls); disableMultithreading.SetActive(showControls); controls.TextString = showControls ? "Hide Controls" : "Show Controls"; }; }
/// <summary> /// Sets up the <see cref="OptionsBox"/> UI. /// </summary> /// <param name="EventData">Handled by parent.</param> protected override void OnLoad(EventArgs EventData) { base.OnLoad(EventData); if (!Enum.TryParse(Settings.Default.CurrentEditorTheme, out OldTheme)) { OldTheme = EditorTheme.OSDefault; SystemSounds.Beep.Play(); Logger.Log(LogLevel.Error, string.Format(CultureInfo.InvariantCulture, Resources.ErrorParseFailed, nameof(Settings.Default.CurrentEditorTheme))); } foreach (var radioButton in ThemeRadioButtons.Values) { radioButton.Checked = false; } ThemeRadioButtons[Settings.Default.CurrentEditorTheme].Checked = true; foreach (var radioButton in DirectoryRadioButtons.Values) { radioButton.Checked = false; } DirectoryRadioButtons[Settings.Default.DefaultDirectory].Checked = true; CheckBoxFlavorFilters.Checked = Settings.Default.UseFlavorFilters; CheckBoxSuggestStoryIDs.Checked = Settings.Default.SuggestStoryIDs; NewAutoSaveInterval = Settings.Default.AutoSaveInterval; TextBoxAutoSaveInterval.Text = NewAutoSaveInterval.ToString(CultureInfo.InvariantCulture); RadioButtonEditInCustomApp.Checked = Settings.Default.EditInApp; RadioButtonEditInOSDefault.Checked = !Settings.Default.EditInApp; TextBoxImageEditorPath.Text = Settings.Default.ImageEditor; ApplyCurrentTheme(); }
public void Save() { using (var writer = XmlWriter.Create(SettingsPath, new XmlWriterSettings { Indent = true })) { writer.WriteStartElement(typeof(EditorSettings).Name); writer.WriteElementString(WindowStateElement, WindowState.ToString()); writer.WriteElementString(EditorThemeElement, EditorTheme.ToString()); writer.WriteStartElement(DesktopBoundsElement); writer.WriteElementString(RectangleXElement, DesktopBounds.X.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString(RectangleYElement, DesktopBounds.Y.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString(RectangleWidthElement, DesktopBounds.Width.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString(RectangleHeightElement, DesktopBounds.Height.ToString(CultureInfo.InvariantCulture)); writer.WriteEndElement(); if (recentlyUsedFiles.Count > 0) { writer.WriteStartElement(RecentlyUsedFilesElement); foreach (var file in recentlyUsedFiles) { writer.WriteStartElement(RecentlyUsedFileElement); writer.WriteElementString(FileTimestampElement, file.Timestamp.ToString("o")); writer.WriteElementString(FileNameElement, file.FileName); writer.WriteEndElement(); } writer.WriteEndElement(); } writer.WriteEndElement(); } }
/// <summary> /// Assigns the colors corresponding to the current <see cref="EditorTheme"/>. /// </summary> /// <param name="inThemeToSet">Identifier for the newly-selected theme.</param> public static void SetUpTheme(EditorTheme inThemeToSet) { switch (inThemeToSet) { case EditorTheme.Femme: ControlBackgroundWhite = Color.Snow; ControlBackgroundColor = Color.MistyRose; UneditableBackgroundColor = Color.Pink; HighlightColor = Color.HotPink; ControlForegroundColor = Color.Indigo; BorderColor = Color.PaleVioletRed; MouseDownColor = Color.PaleVioletRed; MouseOverColor = Color.LightPink; GamesTabColor = Color.MistyRose; ParquetsTabColor = Color.MistyRose; BeingsTabColor = Color.MistyRose; ItemsTabColor = Color.MistyRose; RecipesTabColor = Color.MistyRose; RegionsTabColor = Color.MistyRose; ScriptsTabColor = Color.MistyRose; break; case EditorTheme.Colorful: ControlBackgroundWhite = Color.FloralWhite; ControlBackgroundColor = Color.AntiqueWhite; UneditableBackgroundColor = Color.Linen; HighlightColor = Color.MediumOrchid; ControlForegroundColor = Color.FromArgb(51, 0, 0); BorderColor = Color.RosyBrown; MouseDownColor = Color.RosyBrown; MouseOverColor = Color.Wheat; GamesTabColor = Color.NavajoWhite; ParquetsTabColor = Color.BurlyWood; BeingsTabColor = Color.LightPink; ItemsTabColor = Color.PaleGoldenrod; RecipesTabColor = Color.Plum; RegionsTabColor = Color.DarkSalmon; ScriptsTabColor = Color.LightSteelBlue; break; // EditorTheme.OSDefault: default: ControlBackgroundWhite = SystemColors.Window; ControlBackgroundColor = SystemColors.Control; UneditableBackgroundColor = SystemColors.ControlLight; HighlightColor = SystemColors.Highlight; ControlForegroundColor = SystemColors.ControlText; BorderColor = Color.Empty; MouseDownColor = Color.Empty; MouseOverColor = Color.Empty; GamesTabColor = SystemColors.Control; ParquetsTabColor = SystemColors.Control; BeingsTabColor = SystemColors.Control; ItemsTabColor = SystemColors.Control; RecipesTabColor = SystemColors.Control; RegionsTabColor = SystemColors.Control; ScriptsTabColor = SystemColors.Control; break; } }
public void SetSchemeColors(EditorTheme scheme) { BackgroundColor = SyntaxHighlightingService.GetColor(scheme, EditorThemeColors.TooltipBackground); PagerTextColor = SyntaxHighlightingService.GetColor(scheme, EditorThemeColors.TooltipPagerText); PagerBackgroundColor = SyntaxHighlightingService.GetColor(scheme, EditorThemeColors.TooltipPager); PagerTriangleColor = SyntaxHighlightingService.GetColor(scheme, EditorThemeColors.TooltipPagerTriangle); }
public void LoadTheme(EditorTheme theme) { currentTheme = theme.Clone(); UpdateFont(currentTheme.Font); UpdateCodeBackgroundColor(currentTheme.CodeBackgroundColor); UpdateTabLength(currentTheme.TabLength); }
public CodePreviewWindow( Gdk.Window parentWindow, string fontName = null, EditorTheme theme = null) : base(Gtk.WindowType.Popup) { ParentWindow = parentWindow ?? MonoDevelop.Ide.IdeApp.Workbench.RootWindow.GdkWindow; AppPaintable = true; SkipPagerHint = SkipTaskbarHint = true; TypeHint = WindowTypeHint.Menu; this.fontName = fontName = fontName ?? DefaultSourceEditorOptions.Instance.FontName; layout = PangoUtil.CreateLayout(this); fontDescription = Pango.FontDescription.FromString(fontName); fontDescription.Size = (int)(fontDescription.Size * 0.8f); layout.FontDescription = fontDescription; layout.Ellipsize = Pango.EllipsizeMode.End; var geometry = Screen.GetUsableMonitorGeometry(Screen.GetMonitorAtWindow(ParentWindow)); maxWidth = geometry.Width * 2 / 5; maxHeight = geometry.Height * 2 / 5; layout.SetText("n"); layout.GetPixelSize(out int _, out int lineHeight); MaximumLineCount = maxHeight / lineHeight; theme = theme ?? DefaultSourceEditorOptions.Instance.GetEditorTheme(); colorText = SyntaxHighlightingService.GetColor(theme, EditorThemeColors.Foreground); colorBg = SyntaxHighlightingService.GetColor(theme, EditorThemeColors.Background); colorFold = SyntaxHighlightingService.GetColor(theme, EditorThemeColors.CollapsedText); }
public static void AppendTaggedText(this StringBuilder markup, EditorTheme theme, IEnumerable <TaggedText> text, int col, int maxColumn) { foreach (var part in text) { if (part.Tag != TextTags.Text) { markup.Append("<span foreground=\""); markup.Append(GetThemeColor(theme, GetThemeColor(part.Tag))); markup.Append("\">"); } if (maxColumn >= 0 && col + part.Text.Length > maxColumn) { AppendAndBreakText(markup, part.Text, col, maxColumn); col = 0; } else { markup.Append(Ambience.EscapeText(part.Text)); var lineBreak = part.Text.LastIndexOfAny(new [] { '\n', '\r' }); if (lineBreak >= 0) { col += part.Text.Length - lineBreak; } else { col += part.Text.Length; } } if (part.Tag != TextTags.Text) { markup.Append("</span>"); } } }
public StatsUI(SpriteBatch spriteBatch, FPSCounter fpsCounter) : base(Vector2.Zero) { Panel p = EditorTheme.CreatePanel(Vector2.Zero, new Color(Color.Black, 0.8f), new Point(300, 500), Transform); this.fpsCounter = fpsCounter; this.spriteBatch = spriteBatch; }
public override Components.HslColor GetBackgroundMarkerColor(EditorTheme style) { var key = (ReferenceUsageType & ReferenceUsageType.Write) != 0 || (ReferenceUsageType & ReferenceUsageType.Declaration) != 0 ? EditorThemeColors.ChangingUsagesRectangle : EditorThemeColors.UsagesRectangle; return(SyntaxHighlightingService.GetColor(style, key)); }
public MenuUI() : base(Vector2.Zero) { if (Screen.IsFullHeadless) { return; } Button networkTestBtn = EditorTheme.CreateButton(new Vector2(200, 100), new Point(200, 100), "Network Test", Transform, EditorTheme.ColorSet.Blue); networkTestBtn.Clicked += (sender, args) => SceneManager.SetCurrentScene("_DEMOS\\networktest"); }
public HighlightingVisitior(EditorTheme theme, SemanticModel resolver, Action <StyledTreeSegment> colorizeCallback, CancellationToken cancellationToken, ISegment textSpan) : base(resolver) { if (resolver == null) { throw new ArgumentNullException(nameof(resolver)); } this.theme = theme; this.cancellationToken = cancellationToken; this.colorizeCallback = colorizeCallback; this.region = new TextSpan(textSpan.Offset, textSpan.Length); theme.TryGetColor(EditorThemeColors.Foreground, out defaultColor); Setup(); }
public override async Task <TooltipItem> GetItem(TextEditor editor, DocumentContext ctx, int offset, CancellationToken token = default(CancellationToken)) { if (ctx == null) { return(null); } var analysisDocument = ctx.AnalysisDocument; if (analysisDocument == null) { return(null); } var unit = await analysisDocument.GetSemanticModelAsync(token); if (unit == null) { return(null); } int caretOffset = editor.CaretOffset; EditorTheme theme = SyntaxHighlightingService.GetIdeFittingTheme(editor.Options.GetEditorTheme()); return(await Task.Run(async() => { var root = unit.SyntaxTree.GetRoot(token); SyntaxToken syntaxToken; try { syntaxToken = root.FindToken(offset); } catch (ArgumentOutOfRangeException) { return null; } if (!syntaxToken.Span.Contains(offset)) { return null; } var node = GetBestFitResolveableNode(syntaxToken.Parent); var symbolInfo = unit.GetSymbolInfo(node, token); var symbol = symbolInfo.Symbol; if (symbol == null && syntaxToken.IsKind(SyntaxKind.IdentifierToken)) { symbol = unit.GetDeclaredSymbol(node, token); } var tooltipInformation = await CreateTooltip(symbol, syntaxToken, caretOffset, theme, ctx, offset); if (tooltipInformation == null || string.IsNullOrEmpty(tooltipInformation.SignatureMarkup)) { return null; } return new TooltipItem(tooltipInformation, syntaxToken.Span.Start, syntaxToken.Span.Length); })); }
public MainWindow() { InitializeComponent(); DependencyProviders = new Dictionary <string, MethodInfo>(); //Resolve dependencies PopulateProviders(); ResolveDependencies(this); RaiseAfterInjection(this); var editor = new EditorTheme(File.ReadAllText("son-of-obsidian.vssettings")); ceCodeEditor.LoadTheme(editor); }
void UpdateStyles(object sender = null, EventArgs e = null) { highlightStyle = SyntaxHighlightingService.GetEditorTheme(IdeApp.Preferences.ColorScheme); if (!highlightStyle.FitsIdeTheme(IdeApp.Preferences.UserInterfaceTheme)) { highlightStyle = SyntaxHighlightingService.GetDefaultColorStyle(Ide.IdeApp.Preferences.UserInterfaceTheme); } if (IsRealized) { store.Foreach((model, path, iter) => { model.EmitRowChanged(path, iter); return(false); }); } }
public static void AppendTaggedText(this StringBuilder markup, EditorTheme theme, IEnumerable <TaggedText> text) { foreach (var part in text) { if (part.Tag != TextTags.Text) { markup.Append("<span foreground=\""); markup.Append(GetThemeColor(theme, GetThemeColor(part.Tag))); markup.Append("\">"); } markup.Append(Ambience.EscapeText(part.Text)); if (part.Tag != TextTags.Text) { markup.Append("</span>"); } } }
public NetworkTestMenu() : base(Vector2.Zero) { if (Screen.IsFullHeadless) { return; } notConnectedMenu = new GameObject(Vector2.Zero, 0f, Vector2.One); Transform parentTransform = notConnectedMenu.Transform; parentTransform.SetParent(Transform); Button hostServer = EditorTheme.CreateButton(new Vector2(100, 100), new Point(200, 100), "Start server", parentTransform, EditorTheme.ColorSet.Blue); spawnButton = EditorTheme.CreateButton(new Vector2(100, 100), new Point(200, 100), "Spawn stuff", Transform, EditorTheme.ColorSet.Light); Button connect = EditorTheme.CreateButton(new Vector2(100, 400), new Point(200, 100), "Connect", parentTransform, EditorTheme.ColorSet.Blue); TextInputField addressField = EditorTheme.CreateTextField(new Vector2(310, 100), new Point(200, 40), null, parentTransform); addressField.DefocusOnConfirm = false; addressField.ClearOnUnfocus = false; addressField.SetValue("127.0.0.1"); TextInputField portField = EditorTheme.CreateTextField(new Vector2(620, 100), new Point(100, 40), null, parentTransform); portField.DefocusOnConfirm = false; portField.ConfirmOnEnter = false; portField.ClearOnUnfocus = false; portField.SetValue(Random.Next(1, 25000).ToString()); spawnButton.Disable(); addressField.Confirmed += (sender, args) => Network.Connect(addressField.Input.Value, Convert.ToInt32(portField.Input.Value), 919); hostServer.Clicked += (sender, args) => Network.StartServer(919, 920); spawnButton.Clicked += (sender, args) => Game.SpawnStuff(); connect.Clicked += (sender, args) => Network.Connect(addressField.Input.Value, Convert.ToInt32(portField.Input.Value), 919); }
public static string GenerateHtml(List <List <ClipboardColoredText> > chunks, EditorTheme style, ITextEditorOptions options, bool includeBoilerplate = true) { var htmlText = new StringBuilder(); if (includeBoilerplate) { htmlText.AppendLine(@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">"); htmlText.AppendLine("<HTML>"); htmlText.AppendLine("<HEAD>"); htmlText.AppendLine("<META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=utf-8\">"); htmlText.AppendLine("<META NAME=\"GENERATOR\" CONTENT=\"Mono Text Editor\">"); htmlText.AppendLine("</HEAD>"); htmlText.AppendLine("<BODY>"); } htmlText.AppendLine("<FONT face = '" + options.Font.Family + "'>"); bool first = true; foreach (var line in chunks) { if (!first) { htmlText.AppendLine("<BR>"); } else { first = false; } foreach (var chunk in line) { var chunkStyle = style.GetChunkStyle(chunk.ScopeStack); htmlText.Append("<SPAN style='"); if (chunkStyle.FontWeight != Xwt.Drawing.FontWeight.Normal) { htmlText.Append("font-weight:" + ((int)chunkStyle.FontWeight) + ";"); } if (chunkStyle.FontStyle != Xwt.Drawing.FontStyle.Normal) { htmlText.Append("font-style:" + chunkStyle.FontStyle.ToString().ToLower() + ";"); } htmlText.Append("color:" + ((HslColor)chunkStyle.Foreground).ToPangoString() + ";"); htmlText.Append("'>"); AppendHtmlText(htmlText, chunk.Text, options); htmlText.Append("</SPAN>"); } } htmlText.AppendLine("</FONT>"); if (includeBoilerplate) { htmlText.AppendLine("</BODY></HTML>"); } if (Platform.IsWindows) { return(GenerateCFHtml(htmlText.ToString())); } return(htmlText.ToString()); }
public static async Task <TooltipInformation> GetQuickInfoAsync(int caretOffset, EditorTheme theme, DocumentContext ctx, ISymbol symbol, CancellationToken cancellationToken = default(CancellationToken)) { var tooltipInfo = new TooltipInformation(); var model = await ctx.AnalysisDocument.GetSemanticModelAsync(); var descriptionService = ctx.RoslynWorkspace.Services.GetLanguageServices(model.Language).GetService <ISymbolDisplayService> (); var sections = await descriptionService.ToDescriptionGroupsAsync(ctx.RoslynWorkspace, model, caretOffset, new [] { symbol }.AsImmutable(), default(CancellationToken)).ConfigureAwait(false); ImmutableArray <TaggedText> parts; var sb = StringBuilderCache.Allocate(); if (sections.TryGetValue(SymbolDescriptionGroups.MainDescription, out parts)) { TaggedTextUtil.AppendTaggedText(sb, theme, parts); } // if generating quick info for an attribute, bind to the class instead of the constructor if (symbol.ContainingType?.IsAttribute() == true) { symbol = symbol.ContainingType; } var formatter = ctx.RoslynWorkspace.Services.GetLanguageServices(model.Language).GetService <IDocumentationCommentFormattingService> (); var documentation = symbol.GetDocumentationParts(model, caretOffset, formatter, cancellationToken); sb.Append("<span font='" + FontService.SansFontName + "' size='small'>"); if (documentation != null && documentation.Any()) { sb.AppendLine(); sb.AppendLine(); TaggedTextUtil.AppendTaggedText(sb, theme, documentation); } if (sections.TryGetValue(SymbolDescriptionGroups.AnonymousTypes, out parts)) { if (!parts.IsDefaultOrEmpty) { sb.AppendLine(); TaggedTextUtil.AppendTaggedText(sb, theme, parts); } } if (sections.TryGetValue(SymbolDescriptionGroups.AwaitableUsageText, out parts)) { if (!parts.IsDefaultOrEmpty) { sb.AppendLine(); TaggedTextUtil.AppendTaggedText(sb, theme, parts); } } if (sections.TryGetValue(SymbolDescriptionGroups.Exceptions, out parts)) { if (!parts.IsDefaultOrEmpty) { sb.AppendLine(); TaggedTextUtil.AppendTaggedText(sb, theme, parts); } } sb.Append("</span>"); tooltipInfo.SignatureMarkup = StringBuilderCache.ReturnAndFree(sb); return(tooltipInfo); }
async Task <TooltipInformation> CreateTooltip(ISymbol symbol, SyntaxToken token, int caretOffset, EditorTheme theme, DocumentContext doc, int offset) { try { TooltipInformation result; var sig = new SignatureMarkupCreator(doc, offset); sig.BreakLineAfterReturnType = false; var typeOfExpression = token.Parent as TypeOfExpressionSyntax; if (typeOfExpression != null && symbol is ITypeSymbol) { return(sig.GetTypeOfTooltip(typeOfExpression, (ITypeSymbol)symbol)); } result = sig.GetKeywordTooltip(token); if (result != null) { return(result); } if (symbol != null) { result = await QuickInfoProvider.GetQuickInfoAsync(caretOffset, theme, doc, symbol); } return(result); } catch (Exception e) { LoggingService.LogError("Error while creating tooltip.", e); return(null); } }
void SetStyle() { colorStyle = SyntaxHighlightingService.GetEditorTheme(IdeApp.Preferences.ColorScheme); }
public DescriptionMarkupFormatter(MSBuildRootDocument doc) { theme = GetColorTheme(); this.doc = doc; }
public virtual Components.HslColor GetBackgroundMarkerColor(EditorTheme style) { return(SyntaxHighlightingService.GetColor(style, EditorThemeColors.FindHighlight));; }
public ConsoleUI() : base(Vector2.Zero) { consoleColor = new Color(0, 0, 0, 200); if (Screen.DisplayMode != DisplayMode.Normal) { background = new Image(new Vector2(0, 0), new Point(1920 - 30, 1040), AssetManager.Get <SpriteTexture>(this, "uiRect")) { SpriteColor = consoleColor, Parent = Transform }; ScrollView = new ScrollView(new Vector2(0, 0), new Point(1920 - 30, 1040), new Rectangle(0, 40, 1920, 1040)) { Parent = background.Transform, DisableHidden = true }; TextInputField = EditorTheme.CreateTextField(new Vector2(0, 1040), new Point(1920, 40), ">", background.Transform); ScrollBar = new ScrollBar(new Vector2(1920 - 30, 0), new Point(30, 1040), new Point(50, 50), AssetManager.Get <SpriteTexture>(this, "uiRect"), AssetManager.Get <SpriteTexture>(this, "uiRect")) { BackgroundColor = Color.Black, HandleColor = Color.White, Parent = background.Transform }; } else { background = new Image(new Vector2(0, 1080 - 300), new Point(1920 - 30, 300), AssetManager.Get <SpriteTexture>(this, "uiRect")) { SpriteColor = consoleColor, Parent = Transform }; ScrollView = new ScrollView(new Vector2(0, 0), new Point(1920 - 30, 300), new Rectangle(0, 1080 - 300, 1920, 300)) { Parent = background.Transform, DisableHidden = true }; TextInputField = EditorTheme.CreateTextField(new Vector2(0, 265), new Point(1920, 35), ">", background.Transform); ScrollBar = new ScrollBar(new Vector2(1920 - 30, 0), new Point(30, 265), new Point(50, 50), AssetManager.Get <SpriteTexture>(this, "uiRect"), AssetManager.Get <SpriteTexture>(this, "uiRect")) { BackgroundColor = Color.Black, HandleColor = Color.White, Parent = background.Transform }; } textLines = new List <Text>(maxLines); textPool = new GameObjectPool <Text>(() => EditorTheme.CreateText(Vector2.Zero, Color.Red, "", ScrollView.Transform), maxLines) { Behaviour = PoolBehavior.Fixed, ReturnOnDestroy = true }; ScrollView.ScrollBar = ScrollBar; TextInputField.DefocusOnConfirm = false; }
static string GetThemeColor(EditorTheme theme, string scope) { return(SyntaxHighlightingService.GetColorFromScope(theme, scope, EditorThemeColors.Foreground).ToPangoString()); }