/// <summary> /// Called by solution explorer to provide tooltips for items. Returns a text describing the source control status of the item. /// </summary> public int GetGlyphTipText([InAttribute] IVsHierarchy phierHierarchy, [InAttribute] uint itemidNode, out string pbstrTooltipText) { pbstrTooltipText = ""; GitFileStatus status = GetFileStatus(phierHierarchy, itemidNode); pbstrTooltipText = status.ToString(); //TODO: use resources return(VSConstants.S_OK); }
/// <summary> /// Called by solution explorer to provide tooltips for items. Returns a text describing the source control status of the item. /// </summary> public int GetGlyphTipText([In] IVsHierarchy phierHierarchy, [InAttribute] uint itemidNode, out string pbstrTooltipText) { pbstrTooltipText = ""; GitFileStatus status = ThreadHelper.JoinableTaskFactory.Run(async delegate { GitFileStatus fileStatus = await GetFileStatus(phierHierarchy, itemidNode); return(fileStatus); }); pbstrTooltipText = status.ToString(); //TODO: use resources return(VSConstants.S_OK); }
private static void OnProjectWindowItemGUI(string guid, Rect itemRect) { if (!EnsureInitialized()) { return; } if (Event.current.type != EventType.Repaint || string.IsNullOrEmpty(guid)) { return; } var index = guids.IndexOf(guid); var indexLock = guidsLocks.IndexOf(guid); if (index < 0 && indexLock < 0) { return; } GitStatusEntry?gitStatusEntry = null; GitFileStatus status = GitFileStatus.None; if (index >= 0) { gitStatusEntry = entries[index]; status = gitStatusEntry.Value.Status; } var isLocked = indexLock >= 0; var texture = Styles.GetFileStatusIcon(status, isLocked); if (texture == null) { var path = gitStatusEntry.HasValue ? gitStatusEntry.Value.Path : string.Empty; Logger.Warning("Unable to retrieve texture for Guid:{0} EntryPath:{1} Status: {2} IsLocked:{3}", guid, path, status.ToString(), isLocked); return; } Rect rect; // End of row placement if (itemRect.width > itemRect.height) { rect = new Rect(itemRect.xMax - texture.width, itemRect.y, texture.width, Mathf.Min(texture.height, EditorGUIUtility.singleLineHeight)); } // Corner placement // TODO: Magic numbers that need reviewing. Make sure this works properly with long filenames and wordwrap. else { var scale = itemRect.height / 90f; var size = new Vector2(texture.width * scale, texture.height * scale); size = size / EditorGUIUtility.pixelsPerPoint; var offset = new Vector2(itemRect.width * Mathf.Min(.4f * scale, .2f), itemRect.height * Mathf.Min(.2f * scale, .2f)); rect = new Rect(itemRect.center.x - size.x * .5f + offset.x, itemRect.center.y - size.y * .5f + offset.y, size.x, size.y); } GUI.DrawTexture(rect, texture, ScaleMode.ScaleToFit); }