public static FGTooltip CreateTokenWidget(FGTextEditor editor, Rect tokenRect, ParseTree.Leaf leaf, bool horizontal = false) { var tool = Create(editor, tokenRect, leaf, horizontal, false); tool.isTokenTooltip = false; return(tool); }
private static void CompileErrorsCheck() { if (EditorApplication.isCompiling) { return; } EditorApplication.update -= CompileErrorsCheck; reloadingAssembly = false; //EditorUtility.DisplayDialog("Script Inspector 2", "Compile errors!", "OK"); FGTextEditor.RepaintAllInstances(); }
//[PostProcessScene] //private static void OnBuild() //{ // SaveAllModified(false); // //AssetDatabase.SaveAssets(); //} #if UNITY_2017_2_OR_NEWER private static void OnPlaymodeStateChanged(PlayModeStateChange state) { if (_instance == null) { return; } if (state == PlayModeStateChange.ExitingEditMode) { FGTextEditor.MenuReloadAssemblies(); } }
public static GoToLineWindow Create(FGTextEditor editor) { var owner = EditorWindow.focusedWindow; var wnd = EditorWindow.GetWindow<GoToLineWindow>(true); wnd.editor = editor; wnd.text = (editor.caretPosition.line + 1).ToString(); if (owner != null) { var center = owner.position.center; wnd.position = new Rect((int)(center.x - 0.5f * 256f), (int)(center.y - 0.5f * 100f), 256f, 100f); } wnd.ShowAuxWindow(); return wnd; }
void Initialize() { textStyle = new GUIStyle(); textStyle.alignment = TextAnchor.UpperCenter; bigTextStyle = new GUIStyle(EditorStyles.boldLabel); bigTextStyle.fontSize = 24; bigTextStyle.alignment = TextAnchor.UpperCenter; miniTextStyle = new GUIStyle(EditorStyles.miniLabel); miniTextStyle.alignment = TextAnchor.UpperCenter; flipbookLogo = FGTextEditor.LoadEditorResource <Texture2D>("CreatedByFlipbookGames.png"); }
public static GoToLineWindow Create(FGTextEditor editor) { var owner = EditorWindow.focusedWindow; var wnd = EditorWindow.GetWindow <GoToLineWindow>(true); wnd.editor = editor; wnd.text = (editor.caretPosition.line + 1).ToString(); if (owner != null) { var center = owner.position.center; wnd.position = new Rect((int)(center.x - 0.5f * 256f), (int)(center.y - 0.5f * 100f), 256f, 100f); } wnd.ShowAuxWindow(); return(wnd); }
private static void CompileErrorsCheck() { if (EditorApplication.isCompiling) return; EditorApplication.update -= CompileErrorsCheck; reloadingAssemblies = false; //EditorUtility.DisplayDialog("Script Inspector", "Compile errors!", "OK"); FGTextEditor.RepaintAllInstances(); FGConsole.repaintOnUpdateCounter = 1; if (SISettings.autoFocusConsole != 0) { FGConsole.ShowConsole(); var siConsole = FGConsole.FindInstance(); if (siConsole) siConsole.SendEvent(Event.KeyboardEvent("%end")); } }
private static void LoadResources(FGTextEditor editor) { if (symbolIcons == null) { LoadSymbolIcons(); } listItemStyle = new GUIStyle { fixedHeight = 0, //listItemHeight, padding = { left = 2, top = 2, bottom = 4, right = 2 }, border = new RectOffset(2, 2, 2, 2), margin = new RectOffset(3, 3, 0, 0), overflow = { left = -20 }, normal = { textColor = editor.styles.normalStyle.normal.textColor }, onFocused = { background = selectedListItem }, onNormal = { background = inactiveListItem, textColor = editor.styles.normalStyle.normal.textColor }, }; }
static HermanLight() { FGTextEditor.AddTheme(_colourTheme, _themeName); }
static SonOfObsidian() { FGTextEditor.AddTheme(_colourTheme, _themeName); }
public static FGTooltip Create(FGTextEditor editor, Rect tokenRect, ParseTree.Leaf leaf, bool horizontal = false, bool showError = true) { string tooltipText = null; var symbolDefinition = leaf.resolvedSymbol; SymbolDefinition[] overloads = null; int currentOverload = 0; if (symbolDefinition != null) { try { //Debug.Log("Creating tooltip: " + symbolDefinition.GetTooltipText()); ConstructedTypeDefinition constructedType = symbolDefinition.parentSymbol as ConstructedTypeDefinition; if (symbolDefinition.kind == SymbolKind.MethodGroup) { var group = symbolDefinition as MethodGroupDefinition; if (group == null) { var constructedGroup = symbolDefinition as ConstructedSymbolReference; if (constructedGroup != null) { var genericGroup = constructedGroup.referencedSymbol as MethodGroupDefinition; if (constructedType != null) symbolDefinition = constructedType.GetConstructedMember(genericGroup.methods.FirstOrDefault()); } } if (group != null && group.methods != null) symbolDefinition = group.methods.FirstOrDefault() ?? symbolDefinition; //else // Debug.Log("Can't convert to MethodGroupDefinition. " + symbolDefinition.GetTooltipText()); } tooltipText = GetTooltipText(symbolDefinition, leaf); //tooltipText += symbolDefinition.IsValid(); var methodGroup = symbolDefinition; if (methodGroup.parentSymbol != null) { if (methodGroup.parentSymbol.kind == SymbolKind.MethodGroup) { var constructedMethodGroup = methodGroup.parentSymbol as ConstructedMethodGroupDefinition; methodGroup = constructedMethodGroup ?? methodGroup.parentSymbol; } else { if (constructedType != null) { var constructedMethod = methodGroup as ConstructedSymbolReference; methodGroup = constructedMethod != null ? constructedMethod.referencedSymbol.parentSymbol as MethodGroupDefinition : null; } } } if (methodGroup != null && methodGroup.kind == SymbolKind.MethodGroup) { var group = methodGroup as MethodGroupDefinition; if (group != null && group.methods.Count > 1) { var methodOverloads = new MethodDefinition[group.methods.Count]; //group.methods.CopyTo(methodOverloads); Scope leafScope = null; for (var i = leaf.parent; i != null; i = i.parent) if (i.scope != null) { leafScope = i.scope; break; } var candidates = group.CollectCandidates(null, null, leafScope); if (candidates != null) { methodOverloads = candidates.ToArray(); if (constructedType != null) { overloads = new SymbolDefinition[methodOverloads.Length]; for (int i = 0; i < overloads.Length; ++i) overloads[i] = constructedType.GetConstructedMember(methodOverloads[i]); } else { overloads = methodOverloads; } currentOverload = Mathf.Clamp(System.Array.IndexOf(overloads, symbolDefinition), 0, overloads.Length - 1); } } //else if (group == null) // Debug.Log("Can't convert to MethodGroupDefinition. " + symbolDefinition); } //else if (methodGroup != null) // Debug.Log("symbolDefinition: " + symbolDefinition.GetType()); //if (overloads != null) //{ // var constructedMethodGroup = methodGroup as ConstructedMethodGroupDefinition; // if (constructedMethodGroup != null) // { // var typeParameters = constructedMethodGroup.GetTypeParameters(); // Debug.Log(string.Join(", ", (from x in typeParameters select x.ToString()).ToArray())); // } //} if (overloads == null && symbolDefinition.kind == SymbolKind.Method) { overloads = new SymbolDefinition[] { symbolDefinition }; currentOverload = 0; } } catch (System.Exception e) { // Debug.LogException(e); tooltipText = e.ToString(); } } if (showError) { if (leaf.syntaxError != null) { tooltipText = leaf.syntaxError; } else if (leaf.semanticError != null && (symbolDefinition == null || symbolDefinition.kind != SymbolKind.Error)) { if (tooltipText != "") tooltipText = tooltipText + "\n\nSemantic error:\n\t" + leaf.semanticError; else tooltipText = leaf.semanticError; } } if (string.IsNullOrEmpty(tooltipText)) return null; Rect position = horizontal ? new Rect(tokenRect.xMax, tokenRect.y, 1f, 1f) : new Rect(tokenRect.x, tokenRect.yMax, 1f, 1f); var owner = EditorWindow.focusedWindow; var window = CreatePopup<FGTooltip>(); window.wantsMouseMove = true; window.dropDownRect = tokenRect; window.horizontal = horizontal; window.hideFlags = HideFlags.HideAndDontSave; window.textEditor = editor; #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 window.title = string.Empty; #else window.titleContent.text = string.Empty; #endif window.minSize = Vector2.one; window.owner = owner; window.tokenLeaf = leaf; window.text = tooltipText; window.overloads = overloads; window.currentOverload = currentOverload; //window.style = new GUIStyle(editor.styles.style); //window.style.wordWrap = true; // window.style.fixedWidth = 300f; // window.style.stretchHeight = true; window.style = editor.styles.tooltipTextStyle; window.style.normal.textColor = SISettings.useStandardColorInPopups ? editor.CurrentTheme.text : editor.CurrentTheme.tooltipText; window.style.font = EditorStyles.standardFont; window.style.fontSize = SISettings.fontSizeDelta + 11; window.boldStyle = new GUIStyle(window.style); window.boldStyle.font = EditorStyles.boldFont; //window.backgroundStyle = new GUIStyle(editor.styles.style); //if (window.backgroundStyle.normal.background) window.position = position; window.ShowPopup(); //if (window.owner != null) // window.owner.Focus(); return window; }
static HermanGreen() { FGTextEditor.AddTheme(_colourTheme, _themeName); }
private static string _themeName = "Xcode"; // Xcode (updated to Xcode 5 by inventor2010) static Xcode() { FGTextEditor.AddTheme(_colourTheme, _themeName); // Loaded by default }
static VisualStudio() { FGTextEditor.AddTheme(_colourTheme, _themeName); }
static SolarizedLight() { FGTextEditor.AddTheme(_colourTheme, _themeName); }
private static void LoadSymbolIcons() { SymbolKind[] kinds = { SymbolKind.Namespace, SymbolKind.Interface, SymbolKind.Enum, SymbolKind.Struct, SymbolKind.Class, SymbolKind.Delegate, SymbolKind.Field, SymbolKind.ConstantField,SymbolKind.LocalConstant, SymbolKind.EnumMember, SymbolKind.Property, SymbolKind.Event, SymbolKind.Indexer, SymbolKind.Method, SymbolKind.Constructor, SymbolKind.Destructor, SymbolKind.Operator, SymbolKind.Accessor, SymbolKind.Parameter, SymbolKind.CatchParameter, SymbolKind.Variable, SymbolKind.ForEachVariable, SymbolKind.FromClauseVariable, SymbolKind.TypeParameter, SymbolKind.Label }; var oneForAll = new HashSet <SymbolKind> { SymbolKind.Namespace, SymbolKind.EnumMember, SymbolKind.Parameter, SymbolKind.CatchParameter, SymbolKind.Variable, SymbolKind.ForEachVariable, SymbolKind.FromClauseVariable, SymbolKind.TypeParameter, SymbolKind.Label, SymbolKind.LocalConstant, SymbolKind.Constructor, SymbolKind.Destructor }; symbolIcons = new Texture2D[System.Enum.GetNames(typeof(SymbolKind)).Length, 3]; for (var i = 0; i < kinds.Length; i++) { var kind = kinds[i].ToString(); if (kind == "ConstantField" || kind == "LocalConstant") { kind = "Constant"; } else if (kind == "EnumMember") { kind = "EnumItem"; } var index = (int)kinds[i]; symbolIcons[index, 0] = FGTextEditor.LoadEditorResource <Texture2D>("Symbol Icons/VSObject_" + kind + ".png"); if (oneForAll.Contains(kinds[i])) { symbolIcons[index, 1] = symbolIcons[index, 0]; symbolIcons[index, 2] = symbolIcons[index, 0]; } else { symbolIcons[index, 1] = FGTextEditor.LoadEditorResource <Texture2D>("Symbol Icons/VSObject_" + kind + "_Protected.png"); symbolIcons[index, 2] = FGTextEditor.LoadEditorResource <Texture2D>("Symbol Icons/VSObject_" + kind + "_Private.png"); } #if SI3_WARNINGS if (symbolIcons[index, 0] == null) { Debug.LogWarning("No icon for " + kind); } if (symbolIcons[index, 1] == null) { Debug.LogWarning("No icon for protected " + kind); } if (symbolIcons[index, 2] == null) { Debug.LogWarning("No icon for private " + kind); } #endif } symbolIcons[(int)SymbolKind._Keyword, 0] = keywordIcon = FGTextEditor.LoadEditorResource <Texture2D>("Symbol Icons/Keyword.png"); symbolIcons[(int)SymbolKind._Keyword, 1] = keywordIcon; symbolIcons[(int)SymbolKind._Keyword, 2] = keywordIcon; var snippetIcon = FGTextEditor.LoadEditorResource <Texture2D>("Symbol Icons/Snippet.png"); symbolIcons[(int)SymbolKind._Snippet, 0] = snippetIcon; symbolIcons[(int)SymbolKind._Snippet, 1] = snippetIcon; symbolIcons[(int)SymbolKind._Snippet, 2] = snippetIcon; inactiveListItem = FGTextEditor.LoadEditorResource <Texture2D>("inactiveListItem.png"); selectedListItem = FGTextEditor.LoadEditorResource <Texture2D>("selectedListItem.png"); }
public static FGListPopup Create(FGTextEditor editor, Rect buttonRect, bool flipped) { if (listItemStyle == null) { LoadResources(editor); } listItemStyle.fontSize = SISettings.fontSizeDelta + 11; listItemHeight = Mathf.Max(19f, listItemStyle.CalcHeight(new GUIContent(symbolIcons[0, 0], "W"), 100f)); listItemStyle.onNormal.textColor = editor.styles.normalStyle.normal.textColor; listItemStyle.normal.textColor = editor.styles.normalStyle.normal.textColor; topSuggestion = null; string typedInPart = ""; int tokenIndex; bool atTokenEnd; var onToken = editor.TextBuffer.GetTokenAt(editor.caretPosition, out lineIndex, out tokenIndex, out atTokenEnd); if (onToken != null && /*!atTokenEnd &&*/ onToken.tokenKind >= SyntaxToken.Kind.Keyword) { // eat var textSpan = editor.TextBuffer.GetTokenSpan(lineIndex, tokenIndex); startAtCharacterIndex = textSpan.StartPosition.index; tokenLeft = editor.TextBuffer.GetNonTriviaTokenLeftOf(lineIndex, startAtCharacterIndex); typedInPart = onToken.text.Substring(0, editor.caretPosition.characterIndex - textSpan.index); // Debug.Log("typedInPart " + typedInPart); } else { if (!atTokenEnd && onToken.tokenKind == SyntaxToken.Kind.Comment) { return(null); } if (onToken != null && ( onToken.tokenKind == SyntaxToken.Kind.StringLiteral || onToken.tokenKind == SyntaxToken.Kind.VerbatimStringLiteral || onToken.tokenKind == SyntaxToken.Kind.CharLiteral || onToken.tokenKind == SyntaxToken.Kind.CharLiteral || onToken.tokenKind >= SyntaxToken.Kind.Preprocessor && onToken.tokenKind <= SyntaxToken.Kind.PreprocessorUnexpectedDirective)) { return(null); } //Debug.Log(onToken.tokenKind); startAtCharacterIndex = editor.caretPosition.characterIndex; lineIndex = editor.caretPosition.line; tokenLeft = editor.TextBuffer.GetNonTriviaTokenLeftOf(lineIndex, startAtCharacterIndex); } FGListPopup window = CreatePopup <FGListPopup>(); window.Flipped = flipped; window.minSize = new Vector2(1f, 1f); window.textEditor = editor; window.textBuffer = editor.TextBuffer; window.owner = EditorWindow.focusedWindow; startAtCharacterIndex = editor.caretPosition.characterIndex; lineIndex = editor.caretPosition.line; //tokenLeft = null; Vector2 screenPoint = GUIUtility.GUIToScreenPoint( new Vector2(buttonRect.x, flipped ? buttonRect.y : buttonRect.yMax)); Rect position = new Rect(screenPoint.x - 24f - editor.charSize.x * typedInPart.Length, flipped ? screenPoint.y - 21f : screenPoint.y, 1f, 21f); window.dropDownRect = new Rect(position.x, flipped ? position.y + 21f : position.y - editor.charSize.y, 1f, editor.charSize.y); window.position = position; window.TypedInPart = typedInPart; window.ShowPopup(); //if (window.owner != null) // window.owner.Focus(); return(window); }
protected void OnGUI() { if (Event.current.isKey && TabSwitcher.OnGUIGlobal()) { return; } EditorWindow console = consoleWindowField.GetValue(null) as EditorWindow; if (console == null) { EditorGUILayout.HelpBox(@"Script Inspector Console can only work when the Console tab is also open. Click the button below to open the Console window...", MessageType.Info); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Open Console Widnow")) { GetWindow(consoleWindowType); Focus(); Repaint(); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); return; } Rect oldPosition = console.position; editorWindowPosField.SetValue(console, position); try { bool contextClick = Event.current.type == EventType.ContextClick || Event.current.type == EventType.MouseUp && Event.current.button == 1 && Application.platform == RuntimePlatform.OSXEditor; if (contextClick && GUIUtility.hotControl == 0 && Event.current.mousePosition.y > EditorStyles.toolbar.fixedHeight) { int lvHeight = (int)consoleLVHeightField.GetValue(console); if (lvHeight > Event.current.mousePosition.y - EditorStyles.toolbar.fixedHeight) { Event.current.type = EventType.MouseDown; Event.current.button = 0; Event.current.clickCount = 1; try { consoleOnGUIMethod.Invoke(console, null); } catch { } GUIUtility.hotControl = 0; DoPopupMenu(console); } } else if (Event.current.type == EventType.MouseDown && Event.current.clickCount == 2 && Event.current.mousePosition.y > EditorStyles.toolbar.fixedHeight || Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return) { OpenLogEntry(console); GUIUtility.hotControl = 0; GUIUtility.ExitGUI(); } try { consoleOnGUIMethod.Invoke(console, null); } catch { } #if UNITY_2019_3_OR_NEWER var rc = new Rect(413f, -1f, 160f, 18f); #elif UNITY_2017_1_OR_NEWER var rc = new Rect(355f, -1f, 144f, 18f); #else var rc = new Rect(254f, -1f, 144f, 18f); #endif var autoFocusText = SISettings.autoFocusConsole == 0 ? "Auto-Focus: Never" : SISettings.autoFocusConsole == 1 ? "Auto-Focus: On Error" : "Auto-Focus: On Compile"; if (GUI.Button(rc, autoFocusText, EditorStyles.toolbarDropDown)) { var menu = new GenericMenu(); menu.AddItem(new GUIContent("Never"), SISettings.autoFocusConsole == 0, () => { SISettings.autoFocusConsole.Value = 0; }); menu.AddItem(new GUIContent("On Compile Error"), SISettings.autoFocusConsole == 1, () => { SISettings.autoFocusConsole.Value = 1; }); menu.AddItem(new GUIContent("On Compile"), SISettings.autoFocusConsole == 2, () => { SISettings.autoFocusConsole.Value = 2; }); menu.DropDown(rc); } #if !UNITY_2019_3_OR_NEWER if (font == null && SISettings.monospacedFontConsole) { font = FGTextEditor.LoadEditorResource <Font>("Smooth Fonts/DejaVu Sans Mono.ttf"); SetConsoleFont(font); } rc.xMin = rc.xMax + 4f; rc.xMax = rc.xMin + 100f; if (SISettings.monospacedFontConsole != GUI.Toggle(rc, SISettings.monospacedFontConsole, "Monospaced Font", EditorStyles.toolbarButton)) { SISettings.monospacedFontConsole.Value = !SISettings.monospacedFontConsole; if (font == null && SISettings.monospacedFontConsole) { font = FGTextEditor.LoadEditorResource <Font>("Smooth Fonts/DejaVu Sans Mono.ttf"); } SetConsoleFont(SISettings.monospacedFontConsole ? font : null); } #endif } finally { editorWindowPosField.SetValue(console, oldPosition); } }
private static string _themeName = "VS Dark with Resharper"; // Visual Studio Dark with Resharper 9.1 (courtesy of Sarper Soher) static VSDarkWithResharper() { FGTextEditor.AddTheme(_colourTheme, _themeName); }
static TangoLight() { FGTextEditor.AddTheme(_colourTheme, _themeName); }
static TangoDark_Oblivion() { FGTextEditor.AddTheme(_colourTheme, _themeName); }
public static FGTooltip Create(FGTextEditor editor, Rect tokenRect, ParseTree.Leaf leaf, bool horizontal = false, bool showError = true) { string tooltipText = null; var symbolDefinition = leaf.resolvedSymbol; SymbolDefinition[] overloads = null; int currentOverload = 0; if (symbolDefinition != null) { try { //Debug.Log("Creating tooltip: " + symbolDefinition.GetTooltipText()); ConstructedTypeDefinition constructedType = symbolDefinition.parentSymbol as ConstructedTypeDefinition; if (symbolDefinition.kind == SymbolKind.MethodGroup) { var group = symbolDefinition as MethodGroupDefinition; if (group == null) { var constructedGroup = symbolDefinition as ConstructedSymbolReference; if (constructedGroup != null) { var genericGroup = constructedGroup.referencedSymbol as MethodGroupDefinition; if (constructedType != null) { symbolDefinition = constructedType.GetConstructedMember(genericGroup.methods.FirstOrDefault()); } } } if (group != null && group.methods != null) { symbolDefinition = group.methods.FirstOrDefault() ?? symbolDefinition; } //else // Debug.Log("Can't convert to MethodGroupDefinition. " + symbolDefinition.GetTooltipText()); } tooltipText = GetTooltipText(symbolDefinition, leaf); //tooltipText += symbolDefinition.IsValid(); var methodGroup = symbolDefinition; if (methodGroup.parentSymbol != null) { if (methodGroup.parentSymbol.kind == SymbolKind.MethodGroup) { var constructedMethodGroup = methodGroup.parentSymbol as ConstructedMethodGroupDefinition; methodGroup = constructedMethodGroup ?? methodGroup.parentSymbol; } else { if (constructedType != null) { var constructedMethod = methodGroup as ConstructedSymbolReference; methodGroup = constructedMethod != null ? constructedMethod.referencedSymbol.parentSymbol as MethodGroupDefinition : null; } } } if (methodGroup != null && methodGroup.kind == SymbolKind.MethodGroup) { var group = methodGroup as MethodGroupDefinition; if (group != null && group.methods.Count > 1) { var methodOverloads = new MethodDefinition[group.methods.Count]; //group.methods.CopyTo(methodOverloads); Scope leafScope = null; for (var i = leaf.parent; i != null; i = i.parent) { if (i.scope != null) { leafScope = i.scope; break; } } var candidates = group.CollectCandidates(null, null, leafScope); if (candidates != null) { methodOverloads = candidates.ToArray(); if (constructedType != null) { overloads = new SymbolDefinition[methodOverloads.Length]; for (int i = 0; i < overloads.Length; ++i) { overloads[i] = constructedType.GetConstructedMember(methodOverloads[i]); } } else { overloads = methodOverloads; } currentOverload = Mathf.Clamp(System.Array.IndexOf(overloads, symbolDefinition), 0, overloads.Length - 1); } } //else if (group == null) // Debug.Log("Can't convert to MethodGroupDefinition. " + symbolDefinition); } //else if (methodGroup != null) // Debug.Log("symbolDefinition: " + symbolDefinition.GetType()); //if (overloads != null) //{ // var constructedMethodGroup = methodGroup as ConstructedMethodGroupDefinition; // if (constructedMethodGroup != null) // { // var typeParameters = constructedMethodGroup.GetTypeParameters(); // Debug.Log(string.Join(", ", (from x in typeParameters select x.ToString()).ToArray())); // } //} if (overloads == null && symbolDefinition.kind == SymbolKind.Method) { overloads = new SymbolDefinition[] { symbolDefinition }; currentOverload = 0; } } catch (System.Exception e) { // Debug.LogException(e); tooltipText = e.ToString(); } } if (showError) { if (leaf.syntaxError != null) { tooltipText = leaf.syntaxError; } else if (leaf.semanticError != null && (symbolDefinition == null || symbolDefinition.kind != SymbolKind.Error)) { if (tooltipText != "") { tooltipText = tooltipText + "\n\nSemantic error:\n\t" + leaf.semanticError; } else { tooltipText = leaf.semanticError; } } } if (string.IsNullOrEmpty(tooltipText)) { return(null); } Rect position = horizontal ? new Rect(tokenRect.xMax, tokenRect.y, 1f, 1f) : new Rect(tokenRect.x, tokenRect.yMax, 1f, 1f); var owner = EditorWindow.focusedWindow; var window = CreatePopup <FGTooltip>(); window.wantsMouseMove = true; window.dropDownRect = tokenRect; window.horizontal = horizontal; window.hideFlags = HideFlags.HideAndDontSave; window.textEditor = editor; #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 window.title = string.Empty; #else window.titleContent.text = string.Empty; #endif window.minSize = Vector2.one; window.owner = owner; window.tokenLeaf = leaf; window.text = tooltipText; window.overloads = overloads; window.currentOverload = currentOverload; //window.style = new GUIStyle(editor.styles.style); //window.style.wordWrap = true; // window.style.fixedWidth = 300f; // window.style.stretchHeight = true; window.style = editor.styles.tooltipTextStyle; window.style.normal.textColor = SISettings.useStandardColorInPopups ? editor.CurrentTheme.text : editor.CurrentTheme.tooltipText; window.style.font = EditorStyles.standardFont; window.style.fontSize = SISettings.fontSizeDelta + 11; window.boldStyle = new GUIStyle(window.style); window.boldStyle.font = EditorStyles.boldFont; //window.backgroundStyle = new GUIStyle(editor.styles.style); //if (window.backgroundStyle.normal.background) window.position = position; window.ShowPopup(); //if (window.owner != null) // window.owner.Focus(); return(window); }
static VSCodeMonokai() { FGTextEditor.AddTheme(_colourTheme, _themeName); }
private static string _themeName = "VS Dark with VA X"; // Visual Studio Dark with Visual Assist X static VSDarkWithVAX() { FGTextEditor.AddTheme(_colourTheme, _themeName); }
private static string _themeName = "MD Brown"; // MD Brown (courtesy of Little Angel) static MDBrown() { FGTextEditor.AddTheme(_colourTheme, _themeName); }
public static void SaveSettings() { FGTextEditor.RepaintAllInstances(); }
public static FGTooltip CreateTokenWidget(FGTextEditor editor, Rect tokenRect, ParseTree.Leaf leaf, bool horizontal = false) { var tool = Create(editor, tokenRect, leaf, horizontal, false); tool.isTokenTooltip = false; return tool; }