Fix output log history popup management to smoother usage
This commit is contained in:
@@ -355,7 +355,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
|||||||
if (_previouslyFocused != null)
|
if (_previouslyFocused != null)
|
||||||
{
|
{
|
||||||
_previouslyFocused.RootWindow?.Focus();
|
_previouslyFocused.RootWindow?.Focus();
|
||||||
_previouslyFocused.Focus();
|
_previouslyFocused?.Focus();
|
||||||
_previouslyFocused = null;
|
_previouslyFocused = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -176,7 +176,8 @@ namespace FlaxEditor.Windows
|
|||||||
if (Owner != null && (!Owner._searchPopup?.Visible ?? true))
|
if (Owner != null && (!Owner._searchPopup?.Visible ?? true))
|
||||||
{
|
{
|
||||||
// Focus back the input field as user want to modify command from history
|
// Focus back the input field as user want to modify command from history
|
||||||
Owner._searchPopup?.Hide();
|
Owner.HideHistory();
|
||||||
|
Owner.HideSearch();
|
||||||
Owner.RootWindow.Focus();
|
Owner.RootWindow.Focus();
|
||||||
Owner.Focus();
|
Owner.Focus();
|
||||||
Owner.OnKeyDown(key);
|
Owner.OnKeyDown(key);
|
||||||
@@ -209,6 +210,7 @@ namespace FlaxEditor.Windows
|
|||||||
|
|
||||||
private OutputLogWindow _window;
|
private OutputLogWindow _window;
|
||||||
private ItemsListContextMenu _searchPopup;
|
private ItemsListContextMenu _searchPopup;
|
||||||
|
private ItemsListContextMenu _historyPopup;
|
||||||
private bool _isSettingText;
|
private bool _isSettingText;
|
||||||
|
|
||||||
public CommandLineBox(float x, float y, float width, OutputLogWindow window)
|
public CommandLineBox(float x, float y, float width, OutputLogWindow window)
|
||||||
@@ -226,6 +228,24 @@ namespace FlaxEditor.Windows
|
|||||||
_isSettingText = false;
|
_isSettingText = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HideSearch()
|
||||||
|
{
|
||||||
|
if (_searchPopup != null)
|
||||||
|
{
|
||||||
|
_searchPopup.Hide();
|
||||||
|
_searchPopup = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HideHistory()
|
||||||
|
{
|
||||||
|
if (_historyPopup != null)
|
||||||
|
{
|
||||||
|
_historyPopup.Dispose();
|
||||||
|
_historyPopup = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ShowPopup(ref ItemsListContextMenu cm, IEnumerable<string> commands, string searchText = null)
|
private void ShowPopup(ref ItemsListContextMenu cm, IEnumerable<string> commands, string searchText = null)
|
||||||
{
|
{
|
||||||
if (cm == null)
|
if (cm == null)
|
||||||
@@ -295,7 +315,7 @@ namespace FlaxEditor.Windows
|
|||||||
private void OnRootWindowLostFocus()
|
private void OnRootWindowLostFocus()
|
||||||
{
|
{
|
||||||
// Prevent popup from staying active when editor window looses focus
|
// Prevent popup from staying active when editor window looses focus
|
||||||
_searchPopup?.Hide();
|
HideSearch();
|
||||||
if (RootWindow?.Window != null)
|
if (RootWindow?.Window != null)
|
||||||
RootWindow.Window.LostFocus -= OnRootWindowLostFocus;
|
RootWindow.Window.LostFocus -= OnRootWindowLostFocus;
|
||||||
}
|
}
|
||||||
@@ -330,6 +350,7 @@ namespace FlaxEditor.Windows
|
|||||||
if (isWhitespaceOnly)
|
if (isWhitespaceOnly)
|
||||||
DebugCommands.GetAllCommands(out commands);
|
DebugCommands.GetAllCommands(out commands);
|
||||||
|
|
||||||
|
HideHistory();
|
||||||
ShowPopup(ref _searchPopup, isWhitespaceOnly ? commands : matches, text);
|
ShowPopup(ref _searchPopup, isWhitespaceOnly ? commands : matches, text);
|
||||||
|
|
||||||
if (isWhitespaceOnly)
|
if (isWhitespaceOnly)
|
||||||
@@ -342,7 +363,7 @@ namespace FlaxEditor.Windows
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_searchPopup?.Hide();
|
HideSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -353,7 +374,8 @@ namespace FlaxEditor.Windows
|
|||||||
case KeyboardKeys.Return:
|
case KeyboardKeys.Return:
|
||||||
{
|
{
|
||||||
// Run command
|
// Run command
|
||||||
_searchPopup?.Hide();
|
HideSearch();
|
||||||
|
HideHistory();
|
||||||
var command = Text.Trim();
|
var command = Text.Trim();
|
||||||
if (command.Length == 0)
|
if (command.Length == 0)
|
||||||
return true;
|
return true;
|
||||||
@@ -430,9 +452,8 @@ namespace FlaxEditor.Windows
|
|||||||
if (_window._commandHistory != null && _window._commandHistory.Count != 0)
|
if (_window._commandHistory != null && _window._commandHistory.Count != 0)
|
||||||
{
|
{
|
||||||
// Show command history popup
|
// Show command history popup
|
||||||
_searchPopup?.Hide();
|
HideSearch();
|
||||||
ItemsListContextMenu cm = null;
|
ShowPopup(ref _historyPopup, _window._commandHistory);
|
||||||
ShowPopup(ref cm, _window._commandHistory);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user