mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Fast navigation in "address bar"
This commit is contained in:
@@ -1149,7 +1149,7 @@ namespace GlitchyEditor.EditWindows
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Shows the context menu for the given file/folder.
|
/// Shows the context menu for the given file/folder.
|
||||||
private void ShowItemContextMenu() //(TreeNode<AssetNode> fileOrFolder, DirectoryItemType itemType, ref bool wantsDelete)
|
private void ShowItemContextMenu()
|
||||||
{
|
{
|
||||||
bool singleEntry = _selectedFiles.Count == 1;
|
bool singleEntry = _selectedFiles.Count == 1;
|
||||||
|
|
||||||
@@ -1223,24 +1223,21 @@ namespace GlitchyEditor.EditWindows
|
|||||||
ImGui.EndMenu();
|
ImGui.EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (singleEntry && itemType != .ParentDirectory)
|
ImGui.Separator();
|
||||||
|
|
||||||
|
if (ImGui.MenuItem("Rename"))
|
||||||
{
|
{
|
||||||
ImGui.Separator();
|
// Copy the path, just for the rare case that fileOrFolder gets deleted
|
||||||
|
_assetToRename.Set(firstEntry->Path);
|
||||||
|
|
||||||
if (ImGui.MenuItem("Rename"))
|
firstEntry->Name.CopyTo(_renameFileNameBuffer);
|
||||||
{
|
|
||||||
// Copy the path, just for the rare case that fileOrFolder gets deleted
|
|
||||||
_assetToRename.Set(fileOrFolder->Path);
|
|
||||||
|
|
||||||
fileOrFolder->Name.CopyTo(_renameFileNameBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui.MenuItem("Delete"))
|
|
||||||
{
|
|
||||||
wantsDelete = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
if (ImGui.MenuItem("Delete"))
|
||||||
|
{
|
||||||
|
_wantsDelete = true;
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
if (singleEntry && ImGui.MenuItem("Properties..."))
|
if (singleEntry && ImGui.MenuItem("Properties..."))
|
||||||
@@ -1279,6 +1276,8 @@ namespace GlitchyEditor.EditWindows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TreeNode<AssetNode> _directoryToShowChildren;
|
||||||
|
|
||||||
void DrawNavigationBar()
|
void DrawNavigationBar()
|
||||||
{
|
{
|
||||||
ImGui.BeginDisabled(!_directoryHistory.CanGoBack);
|
ImGui.BeginDisabled(!_directoryHistory.CanGoBack);
|
||||||
@@ -1337,6 +1336,48 @@ namespace GlitchyEditor.EditWindows
|
|||||||
|
|
||||||
String buttonText = scope .(128);
|
String buttonText = scope .(128);
|
||||||
|
|
||||||
|
void DirectorySelectionContextMenu(TreeNode<AssetNode> parent, ImGui.PopupFlags flags = .MouseButtonRight)
|
||||||
|
{
|
||||||
|
void ShowDirectories(TreeNode<AssetNode> parent)
|
||||||
|
{
|
||||||
|
for (TreeNode<AssetNode> node in parent.Children.Where((c) => c->IsDirectory))
|
||||||
|
{
|
||||||
|
buttonText.SetF($"{node->Name}##{node->Path}");
|
||||||
|
|
||||||
|
if (node.Children.Any((c) => c->IsDirectory))
|
||||||
|
{
|
||||||
|
if (ImGui.BeginMenu(buttonText))
|
||||||
|
{
|
||||||
|
ShowDirectories(node);
|
||||||
|
ImGui.EndMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui.IsItemClicked())
|
||||||
|
{
|
||||||
|
Navigate(node);
|
||||||
|
ImGui.CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ImGui.MenuItem(buttonText))
|
||||||
|
{
|
||||||
|
Navigate(node);
|
||||||
|
ImGui.CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// id == null -> Use ID of last Item
|
||||||
|
if (ImGui.BeginPopupContextItem(null, flags))
|
||||||
|
{
|
||||||
|
ShowDirectories(parent);
|
||||||
|
|
||||||
|
ImGui.EndPopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (TreeNode<AssetNode> node in path)
|
for (TreeNode<AssetNode> node in path)
|
||||||
{
|
{
|
||||||
buttonText.SetF($"{node->Name}##{node->Path}");
|
buttonText.SetF($"{node->Name}##{node->Path}");
|
||||||
@@ -1346,6 +1387,8 @@ namespace GlitchyEditor.EditWindows
|
|||||||
Navigate(node);
|
Navigate(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DirectorySelectionContextMenu(node.Parent);
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGui.Text("/");
|
ImGui.Text("/");
|
||||||
@@ -1353,6 +1396,13 @@ namespace GlitchyEditor.EditWindows
|
|||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_currentDirectoryNode.Children.Any((c) => c->IsDirectory))
|
||||||
|
{
|
||||||
|
ImGui.Button("...");
|
||||||
|
|
||||||
|
DirectorySelectionContextMenu(_currentDirectoryNode, .MouseButtonLeft);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.NewLine();
|
ImGui.NewLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user