protected override void drawTop() { GUILayout.Space(10.0f); string labelStr = "Name your search below and it will show up in the dropdown. Searches remember all settings, including the scope and whether to search and replace."; GUIContent content = new GUIContent(labelStr); float height = SRWindow.richTextStyle.CalcHeight(content, position.width); GUILayout.Label(content, SRWindow.richTextStyle, GUILayout.Height(height)); string newName = EditorGUILayout.TextField("Save New Search", searchName); if (errorText != "") { GUILayout.Label(errorText); } if (newName != searchName) { searchName = newName; } if (GUILayout.Button("Save")) { if (searchName != "") { if (searchNameExists(searchName)) { bool confirm = EditorUtility.DisplayDialog("Overwrite?", "Instead of saving a new search, this will overwrite the search '" + searchName + "'. Are you sure?", "Overwrite", "Cancel"); if (confirm) { saveAndClose(searchName, parent.currentSearch, parent.searchOptions); } } else { saveAndClose(searchName, parent.currentSearch, parent.searchOptions); } } else { errorText = "You must input a valid name."; } } GUILayout.Space(10.0f); SRWindow.Divider(); GUILayout.Label("Overwrite Existing Search"); }
protected override void drawTop() { GUILayout.Space(10.0f); string labelStr = ""; if (parent.savedSearches.searches.Count == 0) { labelStr = "You can save searches and use them again later. When you save searches, they will show up in the search dropdown. All search parameters will be saved."; } else { labelStr = "Select a search to edit. Searches remember all settings, including the scope and whether to search and replace."; } GUIContent content = new GUIContent(labelStr); float height = SRWindow.richTextStyle.CalcHeight(content, position.width); GUILayout.Label(content, SRWindow.richTextStyle, GUILayout.Height(height)); GUILayout.Space(10.0f); SRWindow.Divider(); }