private PreviewRowInfo[] GetPreviewRowDataFromObjectsToRename() { var previewRowInfos = new PreviewRowInfo[this.ObjectsToRename.Count]; var selectedNames = this.GetNamesFromObjectsToRename(); var namePreviews = this.bulkRenamer.GetRenamePreviews(selectedNames); for (int i = 0; i < namePreviews.Count; ++i) { var info = new PreviewRowInfo(); var namePreview = namePreviews [i]; info.OriginalName = namePreview.OriginalName; info.DiffName = namePreview.GetDiffAsFormattedString(AddedTextColorTag, DeletedTextColorTag); info.NewName = namePreview.NewName; info.Icon = GetIconForObject(this.ObjectsToRename [i]); previewRowInfos [i] = info; } return(previewRowInfos); }
private bool DrawPreviewRow(PreviewRowInfo info) { bool isDeleteClicked = false; // Draw the icon EditorGUILayout.BeginHorizontal(GUILayout.Height(18.0f)); // Space gives us a bit of padding or else we're just too bunched up to the side GUILayout.Space(4.0f); if (GUILayout.Button("x", EditorStyles.miniButton, GUILayout.Width(16.0f))) { isDeleteClicked = true; } if (info.Icon != null) { GUILayout.Box(info.Icon, this.guiStyles.Icon, GUILayout.Width(16.0f), GUILayout.Height(16.0f)); } // Display diff var diffStyle = info.NamesAreDifferent ? this.guiStyles.DiffLabelWhenModified : this.guiStyles.DiffLabelUnModified; diffStyle.richText = true; var diffName = this.ShowDiff ? info.DiffName : info.OriginalName; EditorGUILayout.LabelField(diffName, diffStyle); // Display new name var style = info.NamesAreDifferent ? this.guiStyles.NewNameLabelModified : this.guiStyles.NewNameLabelUnModified; EditorGUILayout.LabelField(info.NewName, style); EditorGUILayout.EndHorizontal(); return(isDeleteClicked); }
private static void DrawPreviewRow(PreviewRowInfo info) { // Draw the icon EditorGUILayout.BeginHorizontal(GUILayout.Height(18.0f)); GUILayout.Space(8.0f); if (info.Icon != null) { GUIStyle boxStyle = GUIStyle.none; GUILayout.Box(info.Icon, boxStyle, GUILayout.Width(16.0f), GUILayout.Height(16.0f)); } // Display diff var diffStyle = info.NamesAreDifferent ? EditorStyles.boldLabel : new GUIStyle(EditorStyles.label); diffStyle.richText = true; EditorGUILayout.LabelField(info.DiffName, diffStyle); // Display new name var style = info.NamesAreDifferent ? EditorStyles.boldLabel : new GUIStyle(EditorStyles.label); EditorGUILayout.LabelField(info.NewName, style); EditorGUILayout.EndHorizontal(); }