[Fix] Button Size
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Project.Tasks.Editor
|
|||||||
private const float MinDetailsWidth = 320f;
|
private const float MinDetailsWidth = 320f;
|
||||||
private const float MinBoardWidth = 420f;
|
private const float MinBoardWidth = 420f;
|
||||||
private const float SplitterWidth = 5f;
|
private const float SplitterWidth = 5f;
|
||||||
|
private const float MinButtonSize = 9f;
|
||||||
private const string CustomOwnerOption = "<Custom>";
|
private const string CustomOwnerOption = "<Custom>";
|
||||||
private const string DetailsWidthPrefsKey = "Project.Tasks.Editor.TaskBoardWindow.DetailsWidth";
|
private const string DetailsWidthPrefsKey = "Project.Tasks.Editor.TaskBoardWindow.DetailsWidth";
|
||||||
private const double DeleteConfirmTimeoutSeconds = 3.0;
|
private const double DeleteConfirmTimeoutSeconds = 3.0;
|
||||||
@@ -54,6 +55,7 @@ namespace Project.Tasks.Editor
|
|||||||
|
|
||||||
private GUIStyle readOnlyWrappedTextArea;
|
private GUIStyle readOnlyWrappedTextArea;
|
||||||
private GUIStyle priorityBadgeStyle;
|
private GUIStyle priorityBadgeStyle;
|
||||||
|
private GUIStyle compactButtonStyle;
|
||||||
private TaskRecord pressedTask;
|
private TaskRecord pressedTask;
|
||||||
private Vector2 pressedMousePosition;
|
private Vector2 pressedMousePosition;
|
||||||
private float detailsWidth = DefaultDetailsWidth;
|
private float detailsWidth = DefaultDetailsWidth;
|
||||||
@@ -119,18 +121,18 @@ namespace Project.Tasks.Editor
|
|||||||
{
|
{
|
||||||
EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
|
EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
|
||||||
|
|
||||||
if (GUILayout.Button("Reload", EditorStyles.toolbarButton, GUILayout.Width(60f)))
|
if (GUILayout.Button("Reload", EditorStyles.toolbarButton))
|
||||||
{
|
{
|
||||||
Reload(selectedTask != null ? selectedTask.Id : null);
|
Reload(selectedTask != null ? selectedTask.Id : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GUILayout.Button("Open Index", EditorStyles.toolbarButton, GUILayout.Width(80f)))
|
if (GUILayout.Button("Index", EditorStyles.toolbarButton))
|
||||||
{
|
{
|
||||||
string indexPath = data != null ? data.IndexPath : TaskBoardService.NormalizePath(System.IO.Path.Combine(TaskBoardService.GetProjectRoot(), "docs", "tasks", "Index.md"));
|
string indexPath = data != null ? data.IndexPath : TaskBoardService.NormalizePath(System.IO.Path.Combine(TaskBoardService.GetProjectRoot(), "docs", "tasks", "Index.md"));
|
||||||
TaskBoardService.OpenInDefaultApp(indexPath);
|
TaskBoardService.OpenInDefaultApp(indexPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GUILayout.Button("Owners Config", EditorStyles.toolbarButton, GUILayout.Width(95f)))
|
if (GUILayout.Button("Owners", EditorStyles.toolbarButton))
|
||||||
{
|
{
|
||||||
OpenOwnersConfig();
|
OpenOwnersConfig();
|
||||||
}
|
}
|
||||||
@@ -194,15 +196,17 @@ namespace Project.Tasks.Editor
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GUIStyle buttonStyle = GetCompactButtonStyle();
|
||||||
|
|
||||||
EditorGUILayout.BeginVertical("box");
|
EditorGUILayout.BeginVertical("box");
|
||||||
EditorGUILayout.BeginHorizontal();
|
EditorGUILayout.BeginHorizontal();
|
||||||
EditorGUILayout.LabelField(label, EditorStyles.boldLabel);
|
EditorGUILayout.LabelField(label, EditorStyles.boldLabel);
|
||||||
if (GUILayout.Button("All", GUILayout.Width(45f)))
|
if (GUILayout.Button("All", buttonStyle))
|
||||||
{
|
{
|
||||||
SetAll(selectedValues, options, true);
|
SetAll(selectedValues, options, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GUILayout.Button("Nothing", GUILayout.Width(65f)))
|
if (GUILayout.Button("Nothing", buttonStyle))
|
||||||
{
|
{
|
||||||
selectedValues.Clear();
|
selectedValues.Clear();
|
||||||
}
|
}
|
||||||
@@ -213,7 +217,7 @@ namespace Project.Tasks.Editor
|
|||||||
{
|
{
|
||||||
string option = options[i];
|
string option = options[i];
|
||||||
bool current = selectedValues.Contains(option);
|
bool current = selectedValues.Contains(option);
|
||||||
bool next = GUILayout.Toggle(current, option, "Button");
|
bool next = GUILayout.Toggle(current, option, buttonStyle);
|
||||||
if (next != current)
|
if (next != current)
|
||||||
{
|
{
|
||||||
if (next)
|
if (next)
|
||||||
@@ -315,7 +319,7 @@ namespace Project.Tasks.Editor
|
|||||||
EditorGUILayout.HelpBox(task.ValidationMessages[0], MessageType.Warning);
|
EditorGUILayout.HelpBox(task.ValidationMessages[0], MessageType.Warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GUILayout.Button("Open Details"))
|
if (GUILayout.Button("Details", GetCompactButtonStyle()))
|
||||||
{
|
{
|
||||||
SelectTask(task);
|
SelectTask(task);
|
||||||
}
|
}
|
||||||
@@ -354,10 +358,12 @@ namespace Project.Tasks.Editor
|
|||||||
EditorGUILayout.HelpBox("Task-файл отсутствует. Поля из task-файла недоступны до создания файла по шаблону.", MessageType.Info);
|
EditorGUILayout.HelpBox("Task-файл отсутствует. Поля из task-файла недоступны до создания файла по шаблону.", MessageType.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GUIStyle btn = GetCompactButtonStyle();
|
||||||
|
|
||||||
EditorGUILayout.BeginHorizontal();
|
EditorGUILayout.BeginHorizontal();
|
||||||
using (new EditorGUI.DisabledScope(!selectedTask.FileExists))
|
using (new EditorGUI.DisabledScope(!selectedTask.FileExists))
|
||||||
{
|
{
|
||||||
if (GUILayout.Button("Open Task File"))
|
if (GUILayout.Button("File", btn, GUILayout.Width(75f), GUILayout.Height(18f)))
|
||||||
{
|
{
|
||||||
TaskBoardService.OpenInDefaultApp(selectedTask.AbsoluteFilePath);
|
TaskBoardService.OpenInDefaultApp(selectedTask.AbsoluteFilePath);
|
||||||
}
|
}
|
||||||
@@ -365,13 +371,13 @@ namespace Project.Tasks.Editor
|
|||||||
|
|
||||||
using (new EditorGUI.DisabledScope(selectedTask.FileExists))
|
using (new EditorGUI.DisabledScope(selectedTask.FileExists))
|
||||||
{
|
{
|
||||||
if (GUILayout.Button("Create From Template"))
|
if (GUILayout.Button("Create", btn, GUILayout.Width(75f), GUILayout.Height(18f)))
|
||||||
{
|
{
|
||||||
CreateSelectedTaskFromTemplate();
|
CreateSelectedTaskFromTemplate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GUILayout.Button("Open Index"))
|
if (GUILayout.Button("Index", btn, GUILayout.Width(75f), GUILayout.Height(18f)))
|
||||||
{
|
{
|
||||||
TaskBoardService.OpenInDefaultApp(data.IndexPath);
|
TaskBoardService.OpenInDefaultApp(data.IndexPath);
|
||||||
}
|
}
|
||||||
@@ -449,7 +455,7 @@ namespace Project.Tasks.Editor
|
|||||||
|
|
||||||
using (new EditorGUI.DisabledScope(!hasChanges || !executionTimeValid))
|
using (new EditorGUI.DisabledScope(!hasChanges || !executionTimeValid))
|
||||||
{
|
{
|
||||||
if (GUILayout.Button("Save Changes"))
|
if (GUILayout.Button("Save", GetCompactButtonStyle()))
|
||||||
{
|
{
|
||||||
SaveSelectedTask();
|
SaveSelectedTask();
|
||||||
}
|
}
|
||||||
@@ -466,7 +472,7 @@ namespace Project.Tasks.Editor
|
|||||||
bool isPending = string.Equals(pendingDeleteTaskId, selectedTask.Id, StringComparison.OrdinalIgnoreCase) && EditorApplication.timeSinceStartup <= pendingDeleteUntil;
|
bool isPending = string.Equals(pendingDeleteTaskId, selectedTask.Id, StringComparison.OrdinalIgnoreCase) && EditorApplication.timeSinceStartup <= pendingDeleteUntil;
|
||||||
Color previous = GUI.backgroundColor;
|
Color previous = GUI.backgroundColor;
|
||||||
GUI.backgroundColor = isPending ? new Color(0.85f, 0.3f, 0.3f) : new Color(0.7f, 0.25f, 0.25f);
|
GUI.backgroundColor = isPending ? new Color(0.85f, 0.3f, 0.3f) : new Color(0.7f, 0.25f, 0.25f);
|
||||||
if (GUILayout.Button(isPending ? "Sure?" : "Delete Task"))
|
if (GUILayout.Button(isPending ? "Sure?" : "Delete Task", GetCompactButtonStyle(), GUILayout.Width(75f), GUILayout.Height(18f)))
|
||||||
{
|
{
|
||||||
if (isPending)
|
if (isPending)
|
||||||
{
|
{
|
||||||
@@ -545,6 +551,22 @@ namespace Project.Tasks.Editor
|
|||||||
return priorityBadgeStyle;
|
return priorityBadgeStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GUIStyle GetCompactButtonStyle()
|
||||||
|
{
|
||||||
|
if (compactButtonStyle == null)
|
||||||
|
{
|
||||||
|
compactButtonStyle = new GUIStyle("Button")
|
||||||
|
{
|
||||||
|
alignment = TextAnchor.MiddleCenter,
|
||||||
|
padding = new RectOffset(4, 4, 2, 2),
|
||||||
|
margin = new RectOffset(1, 1, 1, 1),
|
||||||
|
stretchWidth = true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return compactButtonStyle;
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawPriorityBadge(string priority)
|
private void DrawPriorityBadge(string priority)
|
||||||
{
|
{
|
||||||
GUIStyle style = GetPriorityBadgeStyle();
|
GUIStyle style = GetPriorityBadgeStyle();
|
||||||
|
|||||||
Reference in New Issue
Block a user